From 2c544567f5f9322b51b26a32bdb6280ee12f16de Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 19 Oct 2010 16:33:40 -0400 Subject: Adding vectors to gr_block_detail that keep track of the number of samples read and written from each block's input. Accessor functions allow query of values through gr_block. Had to add gr_uint64 typedef to SWIG for it to understand how to handle the type. --- gnuradio-core/src/lib/runtime/gr_block.cc | 10 ++++++++++ gnuradio-core/src/lib/runtime/gr_block.h | 6 ++++++ gnuradio-core/src/lib/runtime/gr_block.i | 3 +++ gnuradio-core/src/lib/runtime/gr_block_detail.cc | 23 ++++++++++++++++++----- gnuradio-core/src/lib/runtime/gr_block_detail.h | 16 ++++++++++++++++ gnuradio-core/src/lib/swig/gnuradio.i | 1 + 6 files changed, 54 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 8915f3360..83cc58738 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -117,6 +117,16 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) throw std::runtime_error("Unimplemented"); } +gr_uint64 +gr_block::n_items_read(unsigned int which_input) { + return d_detail->n_items_read(which_input); +} + +gr_uint64 +gr_block::n_items_written(unsigned int which_output) { + return d_detail->n_items_written(which_output); +} + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index b6f724dde..22e60da57 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -198,6 +198,12 @@ class gr_block : public gr_basic_block { */ virtual int fixed_rate_noutput_to_ninput(int noutput); + // Return the number of items read on input stream which_input + gr_uint64 n_items_read(unsigned int which_input); + + // Return the number of items written on output stream which_output + gr_uint64 n_items_written(unsigned int which_output); + // ---------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index c2e2aa4b8..d70a5854a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -49,6 +49,9 @@ class gr_block : public gr_basic_block { bool start(); bool stop(); + gr_uint64 n_items_read(unsigned int which_input); + gr_uint64 n_items_written(unsigned int which_output); + // internal use gr_block_detail_sptr detail () const { return d_detail; } void set_detail (gr_block_detail_sptr detail) { d_detail = detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 38d4a13ca..1f80fe2d4 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -39,6 +39,7 @@ gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) : d_produce_or(0), d_ninputs (ninputs), d_noutputs (noutputs), d_input (ninputs), d_output (noutputs), + d_n_items_read(ninputs, 0), d_n_items_written(noutputs, 0), d_done (false) { s_ncurrently_allocated++; @@ -88,16 +89,25 @@ gr_block_detail::set_done (bool done) void gr_block_detail::consume (int which_input, int how_many_items) { - if (how_many_items > 0) + if (how_many_items > 0) { input (which_input)->update_read_pointer (how_many_items); + + // Carefull here; we check that which_input exists above + // is this good enough protection that we don't get here? + d_n_items_read[which_input] += how_many_items; + } } + void gr_block_detail::consume_each (int how_many_items) { - if (how_many_items > 0) - for (int i = 0; i < ninputs (); i++) + if (how_many_items > 0) { + for (int i = 0; i < ninputs (); i++) { d_input[i]->update_read_pointer (how_many_items); + d_n_items_read[i] += how_many_items; + } + } } void @@ -105,6 +115,7 @@ gr_block_detail::produce (int which_output, int how_many_items) { if (how_many_items > 0){ d_output[which_output]->update_write_pointer (how_many_items); + d_n_items_written[which_output] += how_many_items; d_produce_or |= how_many_items; } } @@ -112,9 +123,11 @@ gr_block_detail::produce (int which_output, int how_many_items) void gr_block_detail::produce_each (int how_many_items) { - if (how_many_items > 0){ - for (int i = 0; i < noutputs (); i++) + if (how_many_items > 0) { + for (int i = 0; i < noutputs (); i++) { d_output[i]->update_write_pointer (how_many_items); + d_n_items_written[i] += how_many_items; + } d_produce_or |= how_many_items; } } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index c5787a5ad..e830ddd47 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -88,6 +88,20 @@ class gr_block_detail { */ void _post(pmt::pmt_t msg); + // Return the number of items read on input stream which_input + gr_uint64 n_items_read(unsigned int which_input) { + if(which_input >= d_ninputs) + throw std::invalid_argument ("gr_block_detail::n_input_items"); + return d_n_items_read[which_input]; + } + + // Return the number of items written on output stream which_output + gr_uint64 n_items_written(unsigned int which_output) { + if(which_output >= d_noutputs) + throw std::invalid_argument ("gr_block_detail::n_output_items"); + return d_n_items_written[which_output]; + } + gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -98,6 +112,8 @@ class gr_block_detail { unsigned int d_noutputs; std::vector d_input; std::vector d_output; + std::vector d_n_items_read; + std::vector d_n_items_written; bool d_done; diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 7d0241f1c..60cbf0d58 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -46,6 +46,7 @@ typedef std::complex gr_complex; typedef std::complex gr_complexd; +typedef unsigned long long gr_uint64; // instantiate the required template specializations -- cgit From b22efee47c7d891a8c10b1493f20976534fdb751 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 26 Oct 2010 19:59:42 -0400 Subject: Giving gr_block_detail a list of pmt tuples to hold item tagging information. Adds ability to add new tags from a block. --- gnuradio-core/src/lib/runtime/gr_block.cc | 8 ++++++++ gnuradio-core/src/lib/runtime/gr_block.h | 5 +++++ gnuradio-core/src/lib/runtime/gr_block_detail.cc | 18 ++++++++++++++++++ gnuradio-core/src/lib/runtime/gr_block_detail.h | 7 +++++++ 4 files changed, 38 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 83cc58738..ed848e3ed 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -127,6 +127,14 @@ gr_block::n_items_written(unsigned int which_output) { return d_detail->n_items_written(which_output); } +void +gr_block::add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value) +{ + d_detail->add_item_tag(which_output, offset, key, value); +} + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 22e60da57..c4d639314 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -204,6 +204,11 @@ class gr_block : public gr_basic_block { // Return the number of items written on output stream which_output gr_uint64 n_items_written(unsigned int which_output); + void add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value); + + // ---------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 1f80fe2d4..656cdb13a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -138,3 +138,21 @@ gr_block_detail::_post(pmt::pmt_t msg) { d_tpb.insert_tail(msg); } + +void +gr_block_detail::add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value) +{ + if(pmt::pmt_is_symbol(key) == false) { + throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); + } + else { + pmt::pmt_t nitem = pmt::pmt_from_uint64(offset); + pmt::pmt_t stream = pmt::pmt_string_to_symbol("NULL"); + pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, stream, key, value); + d_item_tags.push_back(tuple); + + // need to add prunning routing + } +} diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index e830ddd47..6a8d94c72 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -101,6 +101,12 @@ class gr_block_detail { throw std::invalid_argument ("gr_block_detail::n_output_items"); return d_n_items_written[which_output]; } + + // Add an item tag tuple to list of tags + // -> is this just based on output stream? how to handle this... + void add_item_tag(unsigned int which_output, + uint64_t offset, + const pmt::pmt_t &key, const pmt::pmt_t &value); gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -114,6 +120,7 @@ class gr_block_detail { std::vector d_output; std::vector d_n_items_read; std::vector d_n_items_written; + std::list d_item_tags; bool d_done; -- cgit From d07a944f0c327b255285a8fef4604b65fa8fd7c8 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 26 Oct 2010 21:01:22 -0400 Subject: First stab at adding get functions for item tags in a given range. --- gnuradio-core/src/lib/runtime/gr_block.cc | 17 ++++++++++- gnuradio-core/src/lib/runtime/gr_block.h | 9 +++++- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 38 +++++++++++++++++++++++- gnuradio-core/src/lib/runtime/gr_block_detail.h | 9 +++++- 4 files changed, 69 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index ed848e3ed..a2b495867 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -129,12 +129,27 @@ gr_block::n_items_written(unsigned int which_output) { void gr_block::add_item_tag(unsigned int which_output, - uint64_t offset, + gr_uint64 offset, const pmt::pmt_t &key, const pmt::pmt_t &value) { d_detail->add_item_tag(which_output, offset, key, value); } +std::list +gr_block::get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end) +{ + return d_detail->get_tags_in_range(which_output, start, end); +} + +std::list +gr_block::get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end, + const pmt::pmt_t &key) +{ + return d_detail->get_tags_in_range(which_output, start, end, key); +} + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index c4d639314..888ca811a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_BLOCK_H #include +#include /*! * \brief The abstract base class for all 'terminal' processing blocks. @@ -205,9 +206,15 @@ class gr_block : public gr_basic_block { gr_uint64 n_items_written(unsigned int which_output); void add_item_tag(unsigned int which_output, - uint64_t offset, + gr_uint64 offset, const pmt::pmt_t &key, const pmt::pmt_t &value); + std::list get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end); + + std::list get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end, + const pmt::pmt_t &key); // ---------------------------------------------------------------------------- diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 656cdb13a..dbe49f37c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -141,7 +141,7 @@ gr_block_detail::_post(pmt::pmt_t msg) void gr_block_detail::add_item_tag(unsigned int which_output, - uint64_t offset, + gr_uint64 offset, const pmt::pmt_t &key, const pmt::pmt_t &value) { if(pmt::pmt_is_symbol(key) == false) { @@ -156,3 +156,39 @@ gr_block_detail::add_item_tag(unsigned int which_output, // need to add prunning routing } } + +std::list +gr_block_detail::get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end) +{ + std::list found_items; + std::list::iterator itr = d_item_tags.begin(); + + gr_uint64 item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + while(itr != d_item_tags.end()) { + if((item_time < start) && (item_time < end)) { + found_items.push_back(*itr); + } + + itr++; + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + + // items are pushed onto list in sequential order; stop if we're past end + if(item_time > end) { + break; + } + } + + return found_items; +} + +std::list +gr_block_detail::get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end, + const pmt::pmt_t &key) +{ + std::list found_items; + std::list::iterator itr = d_item_tags.begin(); + + return found_items; +} diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 6a8d94c72..cb590cec9 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -105,9 +105,16 @@ class gr_block_detail { // Add an item tag tuple to list of tags // -> is this just based on output stream? how to handle this... void add_item_tag(unsigned int which_output, - uint64_t offset, + gr_uint64 offset, const pmt::pmt_t &key, const pmt::pmt_t &value); + std::list get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end); + + std::list get_tags_in_range(unsigned int which_output, + gr_uint64 start, gr_uint64 end, + const pmt::pmt_t &key); + gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; -- cgit From e3b866883186ed2fbf125964a7ca3a3a3022675c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 17:02:10 -0400 Subject: Fix to get_tags_in_range. Returns proper list and handles times when list is empty. --- gnuradio-core/src/lib/runtime/gr_block.cc | 6 ++++-- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index a2b495867..f3e0ecc91 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -118,12 +118,14 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) } gr_uint64 -gr_block::n_items_read(unsigned int which_input) { +gr_block::n_items_read(unsigned int which_input) +{ return d_detail->n_items_read(which_input); } gr_uint64 -gr_block::n_items_written(unsigned int which_output) { +gr_block::n_items_written(unsigned int which_output) +{ return d_detail->n_items_written(which_output); } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index dbe49f37c..6a920f7c0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -164,19 +164,20 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, std::list found_items; std::list::iterator itr = d_item_tags.begin(); - gr_uint64 item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + gr_uint64 item_time; while(itr != d_item_tags.end()) { - if((item_time < start) && (item_time < end)) { - found_items.push_back(*itr); - } - - itr++; item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); // items are pushed onto list in sequential order; stop if we're past end if(item_time > end) { break; } + + if((item_time > start) && (item_time < end)) { + found_items.push_back(*itr); + } + + itr++; } return found_items; -- cgit From e6dedf7fb1075e22e8ea46c9c8d456ba92f92df1 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 17:11:34 -0400 Subject: Adds functional ability to call get_tags_in_range with a specified key. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 6a920f7c0..18f3601fc 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -191,5 +191,23 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, std::list found_items; std::list::iterator itr = d_item_tags.begin(); + gr_uint64 item_time; + pmt::pmt_t itemkey; + while(itr != d_item_tags.end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + + // items are pushed onto list in sequential order; stop if we're past end + if(item_time > end) { + break; + } + + itemkey = pmt::pmt_tuple_ref(*itr, 2); + if((item_time > start) && (item_time < end) && (key == itemkey)) { + found_items.push_back(*itr); + } + + itr++; + } + return found_items; } -- cgit From 246c0b96f22b3eb945fb1cef1aafd32bbb7cd815 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 17:13:36 -0400 Subject: get_tags_in_range now gets items between start and end INCLUSIVELY. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 18f3601fc..69f65f0d0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -173,7 +173,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, break; } - if((item_time > start) && (item_time < end)) { + if((item_time >= start) && (item_time <= end)) { found_items.push_back(*itr); } @@ -202,7 +202,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, } itemkey = pmt::pmt_tuple_ref(*itr, 2); - if((item_time > start) && (item_time < end) && (key == itemkey)) { + if((item_time >= start) && (item_time <= end) && (key == itemkey)) { found_items.push_back(*itr); } -- cgit From 13f00f0ad96ee54a98751f9dceca005078850c93 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 18:06:39 -0400 Subject: Checks for duplicate entry when adding a new tag. add_item_tag looks at the last tag entered with the given key and tests if the value is the same. If it is the same value, then don't do add a new item. If the value is different, add a new tag of that key to the list. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 32 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 69f65f0d0..1007f13ef 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -142,18 +142,38 @@ gr_block_detail::_post(pmt::pmt_t msg) void gr_block_detail::add_item_tag(unsigned int which_output, gr_uint64 offset, - const pmt::pmt_t &key, const pmt::pmt_t &value) + const pmt::pmt_t &key, + const pmt::pmt_t &value) { if(pmt::pmt_is_symbol(key) == false) { throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); } else { - pmt::pmt_t nitem = pmt::pmt_from_uint64(offset); - pmt::pmt_t stream = pmt::pmt_string_to_symbol("NULL"); - pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, stream, key, value); - d_item_tags.push_back(tuple); + bool duplicate = false; + + // Search through list of tags to see if new tag is a duplicate + std::list::reverse_iterator itr = d_item_tags.rbegin(); + while(itr != d_item_tags.rend()) { + // find the last item with this key if there is one + if(pmt::pmt_eqv(pmt::pmt_tuple_ref(*itr, 2), key)) { + // check if this value is the same as last; its a duplicate if yes + if(pmt::pmt_eqv(pmt::pmt_tuple_ref(*itr, 3), value)) { + duplicate = true; + } + break; // only looking for the last item of this key + } + itr++; + } + + // It not a duplicate, add new tag to the list + if(!duplicate) { + pmt::pmt_t nitem = pmt::pmt_from_uint64(offset); + pmt::pmt_t stream = pmt::pmt_string_to_symbol("NULL"); + pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, stream, key, value); + d_item_tags.push_back(tuple); + } - // need to add prunning routing + // need to add prunning routine } } -- cgit From 0bc7116e5227f95b7a5de944bc65c5a8b55e0ed5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 31 Oct 2010 18:09:19 -0400 Subject: Using pmt_eqv for key testing instead of == to make sure typing is worked out properly. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 1007f13ef..effaf5269 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -222,7 +222,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, } itemkey = pmt::pmt_tuple_ref(*itr, 2); - if((item_time >= start) && (item_time <= end) && (key == itemkey)) { + if((item_time >= start) && (item_time <= end) && pmt::pmt_eqv(key, itemkey)) { found_items.push_back(*itr); } -- cgit From 428ccb2218464a33923b3e576ad42af21468c82d Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 2 Nov 2010 15:59:51 -0400 Subject: Adding some protection to the nitems read/written accessors. Should this return 0 or throw? --- gnuradio-core/src/lib/runtime/gr_block.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index f3e0ecc91..e0a223135 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -120,13 +120,25 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) gr_uint64 gr_block::n_items_read(unsigned int which_input) { - return d_detail->n_items_read(which_input); + if(d_detail) { + return d_detail->n_items_read(which_input); + } + else { + //throw std::runtime_error("No block_detail associated with block yet"); + return 0; + } } gr_uint64 gr_block::n_items_written(unsigned int which_output) { - return d_detail->n_items_written(which_output); + if(d_detail) { + return d_detail->n_items_written(which_output); + } + else { + //throw std::runtime_error("No block_detail associated with block yet"); + return 0; + } } void -- cgit From 1c7119f52792da359fc5638a589b8cc8fa959864 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 2 Nov 2010 16:00:51 -0400 Subject: Adding QA code to perform some tests on tags. Setting and getting items read/written; testing adding and retrieving tags. --- gnuradio-core/src/lib/runtime/Makefile.am | 2 + gnuradio-core/src/lib/runtime/qa_block_tags.cc | 118 +++++++++++++++++++++++++ gnuradio-core/src/lib/runtime/qa_block_tags.h | 44 +++++++++ gnuradio-core/src/lib/runtime/qa_runtime.cc | 2 + 4 files changed, 166 insertions(+) create mode 100644 gnuradio-core/src/lib/runtime/qa_block_tags.cc create mode 100644 gnuradio-core/src/lib/runtime/qa_block_tags.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index abd789a1d..4c52f3ab0 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -79,6 +79,7 @@ libruntime_qa_la_SOURCES = \ qa_gr_top_block.cc \ qa_gr_io_signature.cc \ qa_gr_vmcircbuf.cc \ + qa_block_tags.cc \ qa_runtime.cc grinclude_HEADERS = \ @@ -136,6 +137,7 @@ noinst_HEADERS = \ qa_gr_io_signature.h \ qa_gr_top_block.h \ qa_gr_vmcircbuf.h \ + qa_block_tags.h \ qa_runtime.h if PYTHON diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc new file mode 100644 index 000000000..c9ec788b0 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -0,0 +1,118 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include + + +// ---------------------------------------------------------------- + + +void +qa_block_tags::t0 () +{ + printf("\nqa_block_tags::t0\n"); + + unsigned int N = 1000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_block_sptr snk (gr_make_null_sink(sizeof(int))); + + tb->connect(src, 0, head, 0); + tb->connect(head, 0, snk, 0); + + //CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::runtime_error); + //CPPUNIT_ASSERT_THROW(src->n_items_written(0), std::runtime_error); + CPPUNIT_ASSERT_EQUAL(src->n_items_read(0), (gr_uint64)0); + CPPUNIT_ASSERT_EQUAL(src->n_items_written(0), (gr_uint64)0); + + tb->run(); + + CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::invalid_argument); + CPPUNIT_ASSERT(src->n_items_written(0) >= N); + CPPUNIT_ASSERT_EQUAL(snk->n_items_read(0), (gr_uint64)1000); + CPPUNIT_ASSERT_THROW(snk->n_items_written(0), std::invalid_argument); +} + + +void +qa_block_tags::t1 () +{ + printf("\nqa_block_tags::t1\n"); + + int N = 1000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_block_sptr snk (gr_make_null_sink(sizeof(int))); + + tb->connect(src, 0, head, 0); + tb->connect(head, 0, snk, 0); + tb->run(); + + gr_uint64 W = src->n_items_written(0); + src->add_item_tag(0, N, + pmt::pmt_string_to_symbol("test1"), + pmt::pmt_from_double(1.234)); + + // Make sure we can't get duplicates + src->add_item_tag(0, N, + pmt::pmt_string_to_symbol("test1"), + pmt::pmt_from_double(1.234)); + + // Add new tag at another position + src->add_item_tag(0, W, + pmt::pmt_string_to_symbol("test2"), + pmt::pmt_from_double(2.345)); + + // Test how many tags we get for different ranges + // should be 1, 0, 0, and 2 + std::list tags0, tags1, tags2, tags3; + tags0 = src->get_tags_in_range(0, N-10, N+10); + tags1 = src->get_tags_in_range(0, N-10, N- 1); + tags2 = src->get_tags_in_range(0, N+ 1, N+10); + tags3 = src->get_tags_in_range(0, 0, W); + + CPPUNIT_ASSERT(tags0.size() == 1); + CPPUNIT_ASSERT(tags1.size() == 0); + CPPUNIT_ASSERT(tags2.size() == 0); + CPPUNIT_ASSERT(tags3.size() == 2); + + // Check types and values are good + pmt::pmt_t tuple = tags0.front(); + pmt::pmt_t key = pmt::pmt_tuple_ref(tuple, 2); + double value = pmt::pmt_to_double(pmt::pmt_tuple_ref(tuple, 3)); + + CPPUNIT_ASSERT(pmt::pmt_is_tuple(tuple)); + CPPUNIT_ASSERT(pmt::pmt_eqv(key, pmt::pmt_string_to_symbol("test1"))); + CPPUNIT_ASSERT_EQUAL(value, 1.234); +} + diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h new file mode 100644 index 000000000..b7388885f --- /dev/null +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_QA_BLOCK_TAGS_H +#define INCLUDED_QA_BLOCK_TAGS_H + +#include +#include +#include + +class qa_block_tags : public CppUnit::TestCase { + + CPPUNIT_TEST_SUITE (qa_block_tags); + CPPUNIT_TEST (t0); + CPPUNIT_TEST (t1); + CPPUNIT_TEST_SUITE_END (); + + private: + void t0 (); + void t1 (); + +}; + + +#endif /* INCLUDED_QA_BLOCK_TAGS_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc index 31e3a82d6..967d4bfa8 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.cc +++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc @@ -38,6 +38,7 @@ #include #include #include +#include CppUnit::TestSuite * qa_runtime::suite () @@ -52,6 +53,7 @@ qa_runtime::suite () s->addTest (qa_gr_hier_block2::suite ()); s->addTest (qa_gr_hier_block2_derived::suite ()); s->addTest (qa_gr_buffer::suite ()); + s->addTest (qa_block_tags::suite ()); return s; } -- cgit From e70f8a0d50474784c1f1b64b94907feb9b913a2b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 2 Nov 2010 19:57:24 -0400 Subject: Moved number items read/written from gr_block_detail into gr_buffer (abs_written_offset) and gr_buffer_reader (abs_read_offset). Keeps the API exposed in gr_blocks for now. --- gnuradio-core/src/lib/runtime/gr_block.cc | 4 ++-- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 24 ++++++++++++++++-------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 14 ++------------ gnuradio-core/src/lib/runtime/gr_buffer.cc | 5 +++-- gnuradio-core/src/lib/runtime/gr_buffer.h | 10 +++++++++- 5 files changed, 32 insertions(+), 25 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index e0a223135..c00a034de 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -121,7 +121,7 @@ gr_uint64 gr_block::n_items_read(unsigned int which_input) { if(d_detail) { - return d_detail->n_items_read(which_input); + return d_detail->nitems_read(which_input); } else { //throw std::runtime_error("No block_detail associated with block yet"); @@ -133,7 +133,7 @@ gr_uint64 gr_block::n_items_written(unsigned int which_output) { if(d_detail) { - return d_detail->n_items_written(which_output); + return d_detail->nitems_written(which_output); } else { //throw std::runtime_error("No block_detail associated with block yet"); diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index effaf5269..d12d808e9 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -39,7 +39,6 @@ gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) : d_produce_or(0), d_ninputs (ninputs), d_noutputs (noutputs), d_input (ninputs), d_output (noutputs), - d_n_items_read(ninputs, 0), d_n_items_written(noutputs, 0), d_done (false) { s_ncurrently_allocated++; @@ -91,10 +90,6 @@ gr_block_detail::consume (int which_input, int how_many_items) { if (how_many_items > 0) { input (which_input)->update_read_pointer (how_many_items); - - // Carefull here; we check that which_input exists above - // is this good enough protection that we don't get here? - d_n_items_read[which_input] += how_many_items; } } @@ -105,7 +100,6 @@ gr_block_detail::consume_each (int how_many_items) if (how_many_items > 0) { for (int i = 0; i < ninputs (); i++) { d_input[i]->update_read_pointer (how_many_items); - d_n_items_read[i] += how_many_items; } } } @@ -115,7 +109,6 @@ gr_block_detail::produce (int which_output, int how_many_items) { if (how_many_items > 0){ d_output[which_output]->update_write_pointer (how_many_items); - d_n_items_written[which_output] += how_many_items; d_produce_or |= how_many_items; } } @@ -126,7 +119,6 @@ gr_block_detail::produce_each (int how_many_items) if (how_many_items > 0) { for (int i = 0; i < noutputs (); i++) { d_output[i]->update_write_pointer (how_many_items); - d_n_items_written[i] += how_many_items; } d_produce_or |= how_many_items; } @@ -139,6 +131,22 @@ gr_block_detail::_post(pmt::pmt_t msg) d_tpb.insert_tail(msg); } +gr_uint64 +gr_block_detail::nitems_read(unsigned int which_input) +{ + if(which_input >= d_ninputs) + throw std::invalid_argument ("gr_block_detail::n_input_items"); + return d_input[which_input]->nitems_read(); +} + +gr_uint64 +gr_block_detail::nitems_written(unsigned int which_output) +{ + if(which_output >= d_noutputs) + throw std::invalid_argument ("gr_block_detail::n_output_items"); + return d_output[which_output]->nitems_written(); +} + void gr_block_detail::add_item_tag(unsigned int which_output, gr_uint64 offset, diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index cb590cec9..ee226a349 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -89,18 +89,10 @@ class gr_block_detail { void _post(pmt::pmt_t msg); // Return the number of items read on input stream which_input - gr_uint64 n_items_read(unsigned int which_input) { - if(which_input >= d_ninputs) - throw std::invalid_argument ("gr_block_detail::n_input_items"); - return d_n_items_read[which_input]; - } + gr_uint64 nitems_read(unsigned int which_input); // Return the number of items written on output stream which_output - gr_uint64 n_items_written(unsigned int which_output) { - if(which_output >= d_noutputs) - throw std::invalid_argument ("gr_block_detail::n_output_items"); - return d_n_items_written[which_output]; - } + gr_uint64 nitems_written(unsigned int which_output); // Add an item tag tuple to list of tags // -> is this just based on output stream? how to handle this... @@ -125,8 +117,6 @@ class gr_block_detail { unsigned int d_noutputs; std::vector d_input; std::vector d_output; - std::vector d_n_items_read; - std::vector d_n_items_written; std::list d_item_tags; bool d_done; diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index db2db5d6d..42d00e06f 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -80,7 +80,7 @@ minimum_buffer_items (long type_size, long page_size) gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) : d_base (0), d_bufsize (0), d_vmcircbuf (0), d_sizeof_item (sizeof_item), d_link(link), - d_write_index (0), d_done (false) + d_write_index (0), d_abs_write_offset(0), d_done (false) { if (!allocate_buffer (nitems, sizeof_item)) throw std::bad_alloc (); @@ -225,7 +225,7 @@ gr_buffer_ncurrently_allocated () gr_buffer_reader::gr_buffer_reader(gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link) - : d_buffer(buffer), d_read_index(read_index), d_link(link) + : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link) { s_buffer_reader_count++; } @@ -253,6 +253,7 @@ gr_buffer_reader::update_read_pointer (int nitems) { gruel::scoped_lock guard(*mutex()); d_read_index = d_buffer->index_add (d_read_index, nitems); + d_abs_read_offset += nitems; } long diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 207bfe7c5..8af72741a 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -88,6 +88,8 @@ class gr_buffer { gruel::mutex *mutex() { return &d_mutex; } + gr_uint64 nitems_written() { return d_abs_write_offset; } + // ------------------------------------------------------------------------- private: @@ -106,10 +108,13 @@ class gr_buffer { boost::weak_ptr d_link; // block that writes to this buffer // - // The mutex protects d_write_index, d_done and the d_read_index's in the buffer readers. + // The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's + // and d_abs_read_offset's in the buffer readers. // gruel::mutex d_mutex; unsigned int d_write_index; // in items [0,d_bufsize) + gr_uint64 d_abs_write_offset; // num items written since the start + //deq tag_tuples bool d_done; unsigned @@ -220,6 +225,8 @@ class gr_buffer_reader { gruel::mutex *mutex() { return d_buffer->mutex(); } + gr_uint64 nitems_read() { return d_abs_read_offset; } + /*! * \brief Return the block that reads via this reader. */ @@ -236,6 +243,7 @@ class gr_buffer_reader { gr_buffer_sptr d_buffer; unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) + gr_uint64 d_abs_read_offset; // num items seen since the start boost::weak_ptr d_link; // block that reads via this buffer reader //! constructor is private. Use gr_buffer::add_reader to create instances -- cgit From c3725a7269a7e96252a957b6d078686352365de6 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 11:38:27 -0400 Subject: Fixing buffer to update abs_write_offset counter. Keeping access to counters exposed through gr_block for now, just remaining to nitem_*. --- gnuradio-core/src/lib/runtime/gr_block.cc | 4 ++-- gnuradio-core/src/lib/runtime/gr_block.h | 4 ++-- gnuradio-core/src/lib/runtime/gr_block.i | 4 ++-- gnuradio-core/src/lib/runtime/gr_buffer.cc | 1 + gnuradio-core/src/lib/runtime/qa_block_tags.cc | 18 +++++++++--------- 5 files changed, 16 insertions(+), 15 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index c00a034de..13035aa96 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -118,7 +118,7 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) } gr_uint64 -gr_block::n_items_read(unsigned int which_input) +gr_block::nitems_read(unsigned int which_input) { if(d_detail) { return d_detail->nitems_read(which_input); @@ -130,7 +130,7 @@ gr_block::n_items_read(unsigned int which_input) } gr_uint64 -gr_block::n_items_written(unsigned int which_output) +gr_block::nitems_written(unsigned int which_output) { if(d_detail) { return d_detail->nitems_written(which_output); diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 888ca811a..7564acd87 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -200,10 +200,10 @@ class gr_block : public gr_basic_block { virtual int fixed_rate_noutput_to_ninput(int noutput); // Return the number of items read on input stream which_input - gr_uint64 n_items_read(unsigned int which_input); + gr_uint64 nitems_read(unsigned int which_input); // Return the number of items written on output stream which_output - gr_uint64 n_items_written(unsigned int which_output); + gr_uint64 nitems_written(unsigned int which_output); void add_item_tag(unsigned int which_output, gr_uint64 offset, diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index d70a5854a..4684bd2f2 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -49,8 +49,8 @@ class gr_block : public gr_basic_block { bool start(); bool stop(); - gr_uint64 n_items_read(unsigned int which_input); - gr_uint64 n_items_written(unsigned int which_output); + gr_uint64 nitems_read(unsigned int which_input); + gr_uint64 nitems_written(unsigned int which_output); // internal use gr_block_detail_sptr detail () const { return d_detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 42d00e06f..89db99b69 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -177,6 +177,7 @@ gr_buffer::update_write_pointer (int nitems) { gruel::scoped_lock guard(*mutex()); d_write_index = index_add (d_write_index, nitems); + d_abs_write_offset += nitems; } void diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index c9ec788b0..73faa6ca7 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -49,17 +49,17 @@ qa_block_tags::t0 () tb->connect(src, 0, head, 0); tb->connect(head, 0, snk, 0); - //CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::runtime_error); - //CPPUNIT_ASSERT_THROW(src->n_items_written(0), std::runtime_error); - CPPUNIT_ASSERT_EQUAL(src->n_items_read(0), (gr_uint64)0); - CPPUNIT_ASSERT_EQUAL(src->n_items_written(0), (gr_uint64)0); + //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error); + //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error); + CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (gr_uint64)0); + CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (gr_uint64)0); tb->run(); - CPPUNIT_ASSERT_THROW(src->n_items_read(0), std::invalid_argument); - CPPUNIT_ASSERT(src->n_items_written(0) >= N); - CPPUNIT_ASSERT_EQUAL(snk->n_items_read(0), (gr_uint64)1000); - CPPUNIT_ASSERT_THROW(snk->n_items_written(0), std::invalid_argument); + CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument); + CPPUNIT_ASSERT(src->nitems_written(0) >= N); + CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (gr_uint64)1000); + CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument); } @@ -78,7 +78,7 @@ qa_block_tags::t1 () tb->connect(head, 0, snk, 0); tb->run(); - gr_uint64 W = src->n_items_written(0); + gr_uint64 W = src->nitems_written(0); src->add_item_tag(0, N, pmt::pmt_string_to_symbol("test1"), pmt::pmt_from_double(1.234)); -- cgit From 779f498c46175bb12828c9db4643eada3e364b16 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 12:31:18 -0400 Subject: Moves gr_block functions dealing with tags into protected space. Adds documentation to functions in header. Adds a "srcid" parameter to the add_item_tag function. --- gnuradio-core/src/lib/runtime/gr_block.cc | 12 +++-- gnuradio-core/src/lib/runtime/gr_block.h | 83 +++++++++++++++++++++++++------ gnuradio-core/src/lib/runtime/gr_block.i | 2 +- 3 files changed, 76 insertions(+), 21 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 13035aa96..eb377953d 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009 Free Software Foundation, Inc. + * Copyright 2004,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -144,19 +144,21 @@ gr_block::nitems_written(unsigned int which_output) void gr_block::add_item_tag(unsigned int which_output, gr_uint64 offset, - const pmt::pmt_t &key, const pmt::pmt_t &value) + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid) { - d_detail->add_item_tag(which_output, offset, key, value); + d_detail->add_item_tag(which_output, offset, key, value, srcid); } -std::list +std::deque gr_block::get_tags_in_range(unsigned int which_output, gr_uint64 start, gr_uint64 end) { return d_detail->get_tags_in_range(which_output, start, end); } -std::list +std::deque gr_block::get_tags_in_range(unsigned int which_output, gr_uint64 start, gr_uint64 end, const pmt::pmt_t &key) diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 7564acd87..25886eb10 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2007,2009 Free Software Foundation, Inc. + * Copyright 2004,2007,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,7 +24,7 @@ #define INCLUDED_GR_BLOCK_H #include -#include +#include /*! * \brief The abstract base class for all 'terminal' processing blocks. @@ -199,23 +199,16 @@ class gr_block : public gr_basic_block { */ virtual int fixed_rate_noutput_to_ninput(int noutput); - // Return the number of items read on input stream which_input + /*! + * \brief Return the number of items read on input stream which_input + */ gr_uint64 nitems_read(unsigned int which_input); - // Return the number of items written on output stream which_output + /*! + * \brief Return the number of items written on output stream which_output + */ gr_uint64 nitems_written(unsigned int which_output); - void add_item_tag(unsigned int which_output, - gr_uint64 offset, - const pmt::pmt_t &key, const pmt::pmt_t &value); - - std::list get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end); - - std::list get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end, - const pmt::pmt_t &key); - // ---------------------------------------------------------------------------- private: @@ -234,6 +227,66 @@ class gr_block : public gr_basic_block { void set_fixed_rate(bool fixed_rate){ d_fixed_rate = fixed_rate; } + + /*! + * \brief Adds a new tag to the deque of tags on a given buffer. + * + * This is a call-through method to gr_block_detail to add the new tag. + * gr_block_detail takes care of formatting the tuple from the inputs here, + * it then calls gr_buffer::add_item_tag(pmt::pmt_t t), which appends the + * tag onto its deque of tags. + * + * \param which_ouput an integer of which output stream to attach the tag + * \param abs_offset a uint64 number of the absolute item number + * assicated with the tag. Can get from nitems_written. + * \param key a PMT symbol holding the key name (i.e., a string) + * \param value any PMT holding any value for the given key + * \param srcid optional source ID specifier; defauls to string "NA" + */ + void add_item_tag(unsigned int which_output, + gr_uint64 abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::pmt_string_to_symbol("NA")); + + /*! + * \brief Given a [start,end), returns a deque copy of all tags in the range. + * + * Pass-through function to gr_block_detail. Range of counts is from + * start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + */ + std::deque get_tags_in_range(unsigned int which_input, + gr_uint64 abs_start, + gr_uint64 abs_end); + + /*! + * \brief Given a [start,end), returns a deque copy of all tags in the range + * with a given key. + * + * Pass-through function to gr_block_detail. Range of counts is from + * start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param key a PMT symbol key to filter only tags of this key + */ + std::deque get_tags_in_range(unsigned int which_input, + gr_uint64 abs_start, + gr_uint64 abs_end, + const pmt::pmt_t &key); + + // These are really only for internal use, but leaving them public avoids // having to work up an ever-varying list of friends diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index 4684bd2f2..e6ea06060 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * -- cgit From 309b05cbb38125a910b6199f7adc4ff93bc98064 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 12:33:20 -0400 Subject: Changing API to match changes to gr_block, including adding "srcid" param to add_item_tag. Added documentation to header file. Changing to deque from list. Still holding the deque locally in block_detail, but will be moved to gr_buffer. Adding tag just builds the tag tuple and appends it; doesn't worry about duplications. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 61 +++++++------------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 72 ++++++++++++++++++++---- 2 files changed, 81 insertions(+), 52 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index d12d808e9..2ab762a30 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009 Free Software Foundation, Inc. + * Copyright 2004,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -149,59 +149,39 @@ gr_block_detail::nitems_written(unsigned int which_output) void gr_block_detail::add_item_tag(unsigned int which_output, - gr_uint64 offset, + gr_uint64 abs_offset, const pmt::pmt_t &key, - const pmt::pmt_t &value) + const pmt::pmt_t &value, + const pmt::pmt_t &srcid) { if(pmt::pmt_is_symbol(key) == false) { throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); } else { - bool duplicate = false; - - // Search through list of tags to see if new tag is a duplicate - std::list::reverse_iterator itr = d_item_tags.rbegin(); - while(itr != d_item_tags.rend()) { - // find the last item with this key if there is one - if(pmt::pmt_eqv(pmt::pmt_tuple_ref(*itr, 2), key)) { - // check if this value is the same as last; its a duplicate if yes - if(pmt::pmt_eqv(pmt::pmt_tuple_ref(*itr, 3), value)) { - duplicate = true; - } - break; // only looking for the last item of this key - } - itr++; - } - - // It not a duplicate, add new tag to the list - if(!duplicate) { - pmt::pmt_t nitem = pmt::pmt_from_uint64(offset); - pmt::pmt_t stream = pmt::pmt_string_to_symbol("NULL"); - pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, stream, key, value); - d_item_tags.push_back(tuple); - } - - // need to add prunning routine + pmt::pmt_t nitem = pmt::pmt_from_uint64(abs_offset); + pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, srcid, key, value); + d_item_tags.push_back(tuple); } } -std::list +std::deque gr_block_detail::get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end) + gr_uint64 abs_start, + gr_uint64 abs_end) { - std::list found_items; - std::list::iterator itr = d_item_tags.begin(); + std::deque found_items; + std::deque::iterator itr = d_item_tags.begin(); gr_uint64 item_time; while(itr != d_item_tags.end()) { item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); // items are pushed onto list in sequential order; stop if we're past end - if(item_time > end) { + if(item_time > abs_end) { break; } - if((item_time >= start) && (item_time <= end)) { + if((item_time >= abs_start) && (item_time <= abs_end)) { found_items.push_back(*itr); } @@ -211,13 +191,14 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, return found_items; } -std::list +std::deque gr_block_detail::get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end, + gr_uint64 abs_start, + gr_uint64 abs_end, const pmt::pmt_t &key) { - std::list found_items; - std::list::iterator itr = d_item_tags.begin(); + std::deque found_items; + std::deque::iterator itr = d_item_tags.begin(); gr_uint64 item_time; pmt::pmt_t itemkey; @@ -225,12 +206,12 @@ gr_block_detail::get_tags_in_range(unsigned int which_output, item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); // items are pushed onto list in sequential order; stop if we're past end - if(item_time > end) { + if(item_time > abs_end) { break; } itemkey = pmt::pmt_tuple_ref(*itr, 2); - if((item_time >= start) && (item_time <= end) && pmt::pmt_eqv(key, itemkey)) { + if((item_time >= abs_start) && (item_time <= abs_end) && pmt::pmt_eqv(key, itemkey)) { found_items.push_back(*itr); } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index ee226a349..547d7c22f 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009 Free Software Foundation, Inc. + * Copyright 2004,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -94,18 +94,66 @@ class gr_block_detail { // Return the number of items written on output stream which_output gr_uint64 nitems_written(unsigned int which_output); - // Add an item tag tuple to list of tags - // -> is this just based on output stream? how to handle this... - void add_item_tag(unsigned int which_output, - gr_uint64 offset, - const pmt::pmt_t &key, const pmt::pmt_t &value); - std::list get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end); + /*! + * \brief Adds a new tag to the deque of tags on a given buffer. + * + * Adds a new tag to deque of tags on a given buffer. This takes the input + * parameters and builds a PMT tuple from it. It then calls + * gr_buffer::add_item_tag(pmt::pmt_t t), which appends the + * tag onto its deque of tags. + * + * \param which_ouput an integer of which output stream to attach the tag + * \param abs_offset a uint64 number of the absolute item number + * assicated with the tag. Can get from nitems_written. + * \param key a PMT symbol holding the key name (i.e., a string) + * \param value any PMT holding any value for the given key + * \param srcid a PMT source ID specifier + */ + void add_item_tag(unsigned int which_output, + gr_uint64 abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid); + + /*! + * \brief Given a [start,end), returns a deque copy of all tags in the range. + * + * Pass-through function to gr_buffer to get a deque of tags in given range. + * Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + */ + std::deque get_tags_in_range(unsigned int which_input, + gr_uint64 abs_start, + gr_uint64 abs_end); - std::list get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end, - const pmt::pmt_t &key); + /*! + * \brief Given a [start,end), returns a deque copy of all tags in the range + * with a given key. + * + * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a deque of + * tags from the buffers. This function then provides a secondary filter to + * the tags to extract only tags with the given 'key'. Returns a dequeu + * of these tags. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + * \param key a PMT symbol key to filter only tags of this key + */ + std::deque get_tags_in_range(unsigned int which_input, + gr_uint64 abs_start, + gr_uint64 abs_end, + const pmt::pmt_t &key); gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -117,7 +165,7 @@ class gr_block_detail { unsigned int d_noutputs; std::vector d_input; std::vector d_output; - std::list d_item_tags; + std::deque d_item_tags; bool d_done; -- cgit From 54803ebc0450e9ee46e66b15d3b29249e44c55ed Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 12:38:52 -0400 Subject: Adding shell block for a random annotator. This will be used only for testing the stream tags, which is why its sitting in runtime. --- gnuradio-core/src/lib/runtime/Makefile.am | 3 ++ .../src/lib/runtime/gr_random_annotator.cc | 53 ++++++++++++++++++++++ .../src/lib/runtime/gr_random_annotator.h | 51 +++++++++++++++++++++ .../src/lib/runtime/gr_random_annotator.i | 32 +++++++++++++ gnuradio-core/src/lib/runtime/runtime.i | 2 + 5 files changed, 141 insertions(+) create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.cc create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.h create mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 4c52f3ab0..1af91d80d 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -49,6 +49,7 @@ libruntime_la_SOURCES = \ gr_msg_queue.cc \ gr_pagesize.cc \ gr_preferences.cc \ + gr_random_annotator.cc \ gr_realtime.cc \ gr_scheduler.cc \ gr_scheduler_sts.cc \ @@ -103,6 +104,7 @@ grinclude_HEADERS = \ gr_msg_queue.h \ gr_pagesize.h \ gr_preferences.h \ + gr_random_annotator.h \ gr_realtime.h \ gr_runtime_types.h \ gr_scheduler.h \ @@ -153,6 +155,7 @@ swiginclude_HEADERS = \ gr_message.i \ gr_msg_handler.i \ gr_msg_queue.i \ + gr_random_annotator.i \ gr_realtime.i \ gr_single_threaded_scheduler.i \ gr_sync_block.i \ diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc new file mode 100644 index 000000000..85995fde1 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) + : gr_sync_block ("random_annotator", + gr_make_io_signature (1, 1, sizeof_stream_item), + gr_make_io_signature (1, 1, sizeof_stream_item)) +{ +} + +gr_random_annotator::~gr_random_annotator () +{ +} + +gr_random_annotator_sptr +gr_make_random_annotator (size_t sizeof_stream_item) +{ + return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item)); +} + +int +gr_random_annotator::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + return noutput_items; +} diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h new file mode 100644 index 000000000..cf894c640 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_RANDOM_ANNOTATOR_H +#define INCLUDED_GR_RANDOM_ANNOTATOR_H + +#include + +class gr_random_annotator; +typedef boost::shared_ptr gr_random_annotator_sptr; + +// public constructor +gr_random_annotator_sptr +gr_make_random_annotator (size_t sizeof_stream_item); + +class gr_random_annotator : public gr_sync_block +{ + public: + ~gr_random_annotator (); + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +protected: + gr_random_annotator (size_t sizeof_stream_item); + + private: + friend gr_random_annotator_sptr + gr_make_random_annotator (size_t sizeof_stream_item); +}; + +#endif diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.i b/gnuradio-core/src/lib/runtime/gr_random_annotator.i new file mode 100644 index 000000000..f8765a294 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,random_annotator); + +gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); + +class gr_random_annotator : public gr_sync_block +{ +private: + gr_random_annotator (size_t sizeof_stream_item); +}; + diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index 20cf68a03..51b32de17 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ %include %include %include +%include %include %include %include -- cgit From d75b1bb7ae118e191ef31c5691d409b680f723df Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 12:55:51 -0400 Subject: Makding random_annotator simply copy input to output streams; fixes IO signatures. --- .../src/lib/runtime/gr_random_annotator.cc | 27 +++++++++++++++------- .../src/lib/runtime/gr_random_annotator.h | 2 ++ 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index 85995fde1..25e7458e5 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -26,22 +26,24 @@ #include #include +#include -gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) - : gr_sync_block ("random_annotator", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (1, 1, sizeof_stream_item)) +gr_random_annotator_sptr +gr_make_random_annotator (size_t sizeof_stream_item) { + return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item)); } -gr_random_annotator::~gr_random_annotator () +gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) + : gr_sync_block ("random_annotator", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item) { } -gr_random_annotator_sptr -gr_make_random_annotator (size_t sizeof_stream_item) +gr_random_annotator::~gr_random_annotator () { - return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item)); } int @@ -49,5 +51,14 @@ gr_random_annotator::work (int noutput_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]; + + // Work does nothing to the data stream; just copy all inputs to outputs + int ninputs = input_items.size(); + for (int i = 0; i < ninputs; i++){ + memcpy(out[i], in[i], noutput_items * d_itemsize); + } + return noutput_items; } diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h index cf894c640..7f200eff7 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h @@ -44,6 +44,8 @@ protected: gr_random_annotator (size_t sizeof_stream_item); private: + size_t d_itemsize; + friend gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); }; -- cgit From ef9ff4ce4ab97a557f08fa5dad091b0cf63d313f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 13:19:00 -0400 Subject: Making annotator block build up tags with the noutput_items as the value held. Simply prints info to stdout when tags are retreived. --- .../src/lib/runtime/gr_random_annotator.cc | 23 +++++++++++ gnuradio-core/src/lib/runtime/qa_block_tags.cc | 45 ++++------------------ 2 files changed, 30 insertions(+), 38 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index 25e7458e5..bd74f5b84 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -27,6 +27,7 @@ #include #include #include +#include gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item) @@ -54,11 +55,33 @@ gr_random_annotator::work (int noutput_items, const float **in = (const float **) &input_items[0]; float **out = (float **) &output_items[0]; + gr_uint64 abs_N = nitems_written(0); + std::deque all_tags = get_tags_in_range(0, (gr_uint64)0, abs_N); + std::deque::iterator itr; + std::cout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + gr_uint64 nitem = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + std::string srcid = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 1)); + std::string key = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 2)); + gr_uint64 value = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 3)); + + std::cout << "Tag at " << nitem << " from " << srcid + << " with key = \"" << key << "\" had value = " << value << std::endl; + } + // Work does nothing to the data stream; just copy all inputs to outputs int ninputs = input_items.size(); for (int i = 0; i < ninputs; i++){ memcpy(out[i], in[i], noutput_items * d_itemsize); } + // Storing the current noutput_items as the value to the "noutput_items" key + std::stringstream str; + str << name() << unique_id(); + pmt::pmt_t cur_N = pmt::pmt_from_uint64(noutput_items); + pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); + pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items"); + add_item_tag(0, abs_N, key, cur_N, srcid); + return noutput_items; } diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 73faa6ca7..7fe1b4bfd 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -68,51 +69,19 @@ qa_block_tags::t1 () { printf("\nqa_block_tags::t1\n"); - int N = 1000; + int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_block_sptr ann0 (gr_make_random_annotator(sizeof(int))); + gr_block_sptr ann1 (gr_make_random_annotator(sizeof(int))); gr_block_sptr snk (gr_make_null_sink(sizeof(int))); tb->connect(src, 0, head, 0); - tb->connect(head, 0, snk, 0); + tb->connect(head, 0, ann0, 0); + tb->connect(ann0, 0, ann1, 0); + tb->connect(ann1, 0, snk, 0); tb->run(); - gr_uint64 W = src->nitems_written(0); - src->add_item_tag(0, N, - pmt::pmt_string_to_symbol("test1"), - pmt::pmt_from_double(1.234)); - - // Make sure we can't get duplicates - src->add_item_tag(0, N, - pmt::pmt_string_to_symbol("test1"), - pmt::pmt_from_double(1.234)); - - // Add new tag at another position - src->add_item_tag(0, W, - pmt::pmt_string_to_symbol("test2"), - pmt::pmt_from_double(2.345)); - - // Test how many tags we get for different ranges - // should be 1, 0, 0, and 2 - std::list tags0, tags1, tags2, tags3; - tags0 = src->get_tags_in_range(0, N-10, N+10); - tags1 = src->get_tags_in_range(0, N-10, N- 1); - tags2 = src->get_tags_in_range(0, N+ 1, N+10); - tags3 = src->get_tags_in_range(0, 0, W); - - CPPUNIT_ASSERT(tags0.size() == 1); - CPPUNIT_ASSERT(tags1.size() == 0); - CPPUNIT_ASSERT(tags2.size() == 0); - CPPUNIT_ASSERT(tags3.size() == 2); - - // Check types and values are good - pmt::pmt_t tuple = tags0.front(); - pmt::pmt_t key = pmt::pmt_tuple_ref(tuple, 2); - double value = pmt::pmt_to_double(pmt::pmt_tuple_ref(tuple, 3)); - - CPPUNIT_ASSERT(pmt::pmt_is_tuple(tuple)); - CPPUNIT_ASSERT(pmt::pmt_eqv(key, pmt::pmt_string_to_symbol("test1"))); - CPPUNIT_ASSERT_EQUAL(value, 1.234); } -- cgit From 70ca24e7cc6ba744589e3d5fb8077f706e813d28 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 18:16:26 -0400 Subject: Moving add_item_tag into gr_buffer and get_tags_in_range to gr_buffer_reader. gr_block_detail takes care of the high-level adding and retrieving tags via the buffers/readers; also takes care of filtering tags by key. Tags are now added to the gr_buffers on 'which_output' while they are retrieved from the gr_buffer_reader based on 'which_input." --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 61 +++++++++--------------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 5 +- gnuradio-core/src/lib/runtime/gr_buffer.cc | 35 +++++++++++++- gnuradio-core/src/lib/runtime/gr_buffer.h | 36 +++++++++++++- 4 files changed, 93 insertions(+), 44 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 2ab762a30..85b663ac6 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -158,65 +158,48 @@ gr_block_detail::add_item_tag(unsigned int which_output, throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); } else { + // build tag tuple pmt::pmt_t nitem = pmt::pmt_from_uint64(abs_offset); pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, srcid, key, value); - d_item_tags.push_back(tuple); + + // Add tag to gr_buffer's deque tags + d_output[which_output]->add_item_tag(tuple); } } std::deque -gr_block_detail::get_tags_in_range(unsigned int which_output, +gr_block_detail::get_tags_in_range(unsigned int which_input, gr_uint64 abs_start, gr_uint64 abs_end) { - std::deque found_items; - std::deque::iterator itr = d_item_tags.begin(); - - gr_uint64 item_time; - while(itr != d_item_tags.end()) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - - // items are pushed onto list in sequential order; stop if we're past end - if(item_time > abs_end) { - break; - } - - if((item_time >= abs_start) && (item_time <= abs_end)) { - found_items.push_back(*itr); - } - - itr++; - } - - return found_items; + // get from gr_buffer_reader's deque of tags + return d_input[which_input]->get_tags_in_range(which_input, + abs_start, + abs_end); } std::deque -gr_block_detail::get_tags_in_range(unsigned int which_output, +gr_block_detail::get_tags_in_range(unsigned int which_input, gr_uint64 abs_start, gr_uint64 abs_end, const pmt::pmt_t &key) { - std::deque found_items; - std::deque::iterator itr = d_item_tags.begin(); - - gr_uint64 item_time; - pmt::pmt_t itemkey; - while(itr != d_item_tags.end()) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + std::deque found_items, found_items_by_key; - // items are pushed onto list in sequential order; stop if we're past end - if(item_time > abs_end) { - break; - } + // get from gr_buffer_reader's deque of tags + found_items = d_input[which_input]->get_tags_in_range(which_input, + abs_start, + abs_end); + // Filter further by key name + pmt::pmt_t itemkey; + std::deque::iterator itr; + for(itr = found_items.begin(); itr != found_items.end(); itr++) { itemkey = pmt::pmt_tuple_ref(*itr, 2); - if((item_time >= abs_start) && (item_time <= abs_end) && pmt::pmt_eqv(key, itemkey)) { - found_items.push_back(*itr); + if(pmt::pmt_eqv(key, itemkey)) { + found_items_by_key.push_back(*itr); } - - itr++; } - return found_items; + return found_items_by_key; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 547d7c22f..ada807f68 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -119,8 +119,8 @@ class gr_block_detail { /*! * \brief Given a [start,end), returns a deque copy of all tags in the range. * - * Pass-through function to gr_buffer to get a deque of tags in given range. - * Range of counts is from start to end-1. + * Pass-through function to gr_buffer_reader to get a deque of tags + * in given range. Range of counts is from start to end-1. * * Tags are tuples of: * (item count, source id, key, value) @@ -165,7 +165,6 @@ class gr_block_detail { unsigned int d_noutputs; std::vector d_input; std::vector d_output; - std::deque d_item_tags; bool d_done; diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 89db99b69..da7866f48 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009 Free Software Foundation, Inc. + * Copyright 2004,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -216,6 +216,12 @@ gr_buffer::drop_reader (gr_buffer_reader *reader) d_readers.erase (result); } +void +gr_buffer::add_item_tag(const pmt::pmt_t &tag) +{ + d_item_tags.push_back(tag); +} + long gr_buffer_ncurrently_allocated () { @@ -257,6 +263,33 @@ gr_buffer_reader::update_read_pointer (int nitems) d_abs_read_offset += nitems; } +std::deque +gr_buffer_reader::get_tags_in_range(unsigned int which_output, + gr_uint64 abs_start, + gr_uint64 abs_end) +{ + std::deque found_items; + std::deque::iterator itr = d_item_tags.begin(); + + gr_uint64 item_time; + while(itr != d_item_tags.end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + + // items are pushed onto list in sequential order; stop if we're past end + if(item_time > abs_end) { + break; + } + + if((item_time >= abs_start) && (item_time <= abs_end)) { + found_items.push_back(*itr); + } + + itr++; + } + + return found_items; +} + long gr_buffer_reader_ncurrently_allocated () { diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 8af72741a..e50f638b5 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009 Free Software Foundation, Inc. + * Copyright 2004,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,6 +26,7 @@ #include #include #include +#include class gr_vmcircbuf; @@ -90,6 +91,19 @@ class gr_buffer { gr_uint64 nitems_written() { return d_abs_write_offset; } + + /*! + * \brief Adds a new tag to the deque of tags on a given buffer. + * + * Adds a new tag to deque of tags on a given buffer. This takes the input + * parameters and builds a PMT tuple from it. It then calls + * gr_buffer::add_item_tag(pmt::pmt_t t), which appends the + * tag onto its deque of tags. + * + * \param tag a PMT tuple containing the new tag + */ + void add_item_tag(const pmt::pmt_t &tag); + // ------------------------------------------------------------------------- private: @@ -107,6 +121,8 @@ class gr_buffer { std::vector d_readers; boost::weak_ptr d_link; // block that writes to this buffer + std::deque d_item_tags; + // // The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's // and d_abs_read_offset's in the buffer readers. @@ -232,6 +248,23 @@ class gr_buffer_reader { */ gr_block_sptr link() { return gr_block_sptr(d_link); } + + /*! + * \brief Given a [start,end), returns a deque copy of all tags in the range. + * + * Get a deque of tags in given range. Range of counts is from start to end-1. + * + * Tags are tuples of: + * (item count, source id, key, value) + * + * \param which_input an integer of which input stream to pull from + * \param abs_start a uint64 count of the start of the range of interest + * \param abs_end a uint64 count of the end of the range of interest + */ + std::deque get_tags_in_range(unsigned int which_input, + gr_uint64 abs_start, + gr_uint64 abs_end); + // ------------------------------------------------------------------------- private: @@ -245,6 +278,7 @@ class gr_buffer_reader { unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) gr_uint64 d_abs_read_offset; // num items seen since the start boost::weak_ptr d_link; // block that reads via this buffer reader + std::deque d_item_tags; //! constructor is private. Use gr_buffer::add_reader to create instances gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link); -- cgit From 7f6f2a377bf8bca6880ecc030792202e09b631a7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 18:30:17 -0400 Subject: gr_buffer_reader doesn't need to know which input it is. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 3 +-- gnuradio-core/src/lib/runtime/gr_buffer.h | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index da7866f48..58cffe495 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -264,8 +264,7 @@ gr_buffer_reader::update_read_pointer (int nitems) } std::deque -gr_buffer_reader::get_tags_in_range(unsigned int which_output, - gr_uint64 abs_start, +gr_buffer_reader::get_tags_in_range(gr_uint64 abs_start, gr_uint64 abs_end) { std::deque found_items; diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index e50f638b5..6498ee296 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -257,12 +257,10 @@ class gr_buffer_reader { * Tags are tuples of: * (item count, source id, key, value) * - * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::deque get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, + std::deque get_tags_in_range(gr_uint64 abs_start, gr_uint64 abs_end); // ------------------------------------------------------------------------- -- cgit From bf079e66e50f4aff775175c288e952b6325ea71c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 4 Nov 2010 18:36:05 -0400 Subject: Fixing api call to gr_buffer_reader that no longer takes in which_input. --- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 85b663ac6..de4fb2196 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -173,9 +173,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, gr_uint64 abs_end) { // get from gr_buffer_reader's deque of tags - return d_input[which_input]->get_tags_in_range(which_input, - abs_start, - abs_end); + return d_input[which_input]->get_tags_in_range(abs_start, abs_end); } std::deque @@ -187,9 +185,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, std::deque found_items, found_items_by_key; // get from gr_buffer_reader's deque of tags - found_items = d_input[which_input]->get_tags_in_range(which_input, - abs_start, - abs_end); + found_items = d_input[which_input]->get_tags_in_range(abs_start, abs_end); // Filter further by key name pmt::pmt_t itemkey; -- cgit From d58d250c82ff8b106aec02f5222cea385b74d729 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 6 Nov 2010 13:03:28 -0400 Subject: buffer_reader does not hold its own tags but looks upstream to the associated buffer to get them. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 4 ++-- gnuradio-core/src/lib/runtime/gr_buffer.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 58cffe495..9048d57a4 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -268,10 +268,10 @@ gr_buffer_reader::get_tags_in_range(gr_uint64 abs_start, gr_uint64 abs_end) { std::deque found_items; - std::deque::iterator itr = d_item_tags.begin(); + std::deque::iterator itr = d_buffer->get_tags_begin(); gr_uint64 item_time; - while(itr != d_item_tags.end()) { + while(itr != d_buffer->get_tags_end()) { item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); // items are pushed onto list in sequential order; stop if we're past end diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 6498ee296..8174b7e67 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -104,6 +104,9 @@ class gr_buffer { */ void add_item_tag(const pmt::pmt_t &tag); + std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } + std::deque::iterator get_tags_end() { return d_item_tags.end(); } + // ------------------------------------------------------------------------- private: @@ -121,7 +124,7 @@ class gr_buffer { std::vector d_readers; boost::weak_ptr d_link; // block that writes to this buffer - std::deque d_item_tags; + std::deque d_item_tags; // temp. store tags until moved to reader // // The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's @@ -276,7 +279,6 @@ class gr_buffer_reader { unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) gr_uint64 d_abs_read_offset; // num items seen since the start boost::weak_ptr d_link; // block that reads via this buffer reader - std::deque d_item_tags; //! constructor is private. Use gr_buffer::add_reader to create instances gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link); -- cgit From 6cc6925ec231897a2e46f3d7bfb52ba3aecfc492 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 6 Nov 2010 13:18:32 -0400 Subject: Better formatting of tag information to make info more readable. --- gnuradio-core/src/lib/runtime/gr_random_annotator.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index bd74f5b84..d9ad15a55 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -28,6 +28,7 @@ #include #include #include +#include gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item) @@ -55,18 +56,27 @@ gr_random_annotator::work (int noutput_items, const float **in = (const float **) &input_items[0]; float **out = (float **) &output_items[0]; + std::stringstream str; + str << name() << unique_id(); + gr_uint64 abs_N = nitems_written(0); std::deque all_tags = get_tags_in_range(0, (gr_uint64)0, abs_N); std::deque::iterator itr; std::cout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; + + std::cout.setf(std::ios::left); + std::cout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" + << std::setw(10) << "nitem" << std::setw(20) << "key" + << std::setw(10) << "value" << std::endl; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { gr_uint64 nitem = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); std::string srcid = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 1)); std::string key = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 2)); gr_uint64 value = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 3)); - std::cout << "Tag at " << nitem << " from " << srcid - << " with key = \"" << key << "\" had value = " << value << std::endl; + std::cout << std::setw(25) << str.str() << std::setw(25) << srcid + << std::setw(10) << nitem << std::setw(20) << key + << std::setw(10) << value << std::endl; } // Work does nothing to the data stream; just copy all inputs to outputs @@ -76,8 +86,6 @@ gr_random_annotator::work (int noutput_items, } // Storing the current noutput_items as the value to the "noutput_items" key - std::stringstream str; - str << name() << unique_id(); pmt::pmt_t cur_N = pmt::pmt_from_uint64(noutput_items); pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items"); -- cgit From 20adc2d657d189cd07f9585aeb4cb213ffe0bb07 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 6 Nov 2010 14:17:04 -0400 Subject: Because tags can be appended from upstream, they are not consecutive in time, so we need to cycle through them all. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 5 ----- 1 file changed, 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 9048d57a4..8387a3168 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -274,11 +274,6 @@ gr_buffer_reader::get_tags_in_range(gr_uint64 abs_start, while(itr != d_buffer->get_tags_end()) { item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - // items are pushed onto list in sequential order; stop if we're past end - if(item_time > abs_end) { - break; - } - if((item_time >= abs_start) && (item_time <= abs_end)) { found_items.push_back(*itr); } -- cgit From 8b184fda9da4e7fdf08ddfd4d973d5d8d83be308 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 6 Nov 2010 14:18:32 -0400 Subject: Adding call in scheduler to handle tag movements between blocks and some helper functions to get access and keep track of tags. --- gnuradio-core/src/lib/runtime/gr_block.cc | 7 +++++++ gnuradio-core/src/lib/runtime/gr_block.h | 9 +++++++++ gnuradio-core/src/lib/runtime/gr_block_detail.cc | 19 ++++++++++++++++++- gnuradio-core/src/lib/runtime/gr_block_detail.h | 9 +++++++++ gnuradio-core/src/lib/runtime/gr_buffer.h | 18 +++++++++++++++++- gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc | 2 ++ 6 files changed, 62 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index eb377953d..51eb5b498 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -166,6 +166,13 @@ gr_block::get_tags_in_range(unsigned int which_output, return d_detail->get_tags_in_range(which_output, start, end, key); } +void +gr_block::handle_tags() +{ + d_detail->handle_tags(); +} + + std::ostream& operator << (std::ostream& os, const gr_block *m) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 25886eb10..89d762847 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -209,6 +209,15 @@ class gr_block : public gr_basic_block { */ gr_uint64 nitems_written(unsigned int which_output); + + /*! + * \brief Function to move tags downstream + * + * The default behavior proxies to gr_block_detail, which just moves all tags + * from input to output and flows them all downstream. + */ + virtual void handle_tags(); + // ---------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index de4fb2196..7994919d4 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -39,7 +39,8 @@ gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) : d_produce_or(0), d_ninputs (ninputs), d_noutputs (noutputs), d_input (ninputs), d_output (noutputs), - d_done (false) + d_done (false), + d_last_tag(0) { s_ncurrently_allocated++; } @@ -199,3 +200,19 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, return found_items_by_key; } + +void +gr_block_detail::handle_tags() +{ + for(unsigned int i = 0; i < d_ninputs; i++) { + pmt::pmt_t tuple; + while(d_input[i]->get_tag(d_last_tag, tuple)) { + d_last_tag++; + if(!sink_p()) { + for(unsigned int o = 0; o < d_noutputs; o++) { + d_output[o]->add_item_tag(tuple); + } + } + } + } +} diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index ada807f68..cbb59a689 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -155,6 +155,14 @@ class gr_block_detail { gr_uint64 abs_end, const pmt::pmt_t &key); + /*! + * \brief Default tag handler; moves all tags downstream + * + * Move all tags from input to output and flows them all downstream. Each input + * stream's tags get appended to each output streams tags. + */ + void handle_tags(); + gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -167,6 +175,7 @@ class gr_block_detail { std::vector d_output; bool d_done; + size_t d_last_tag; // keep track of which tags we've already received from upstream gr_block_detail (unsigned int ninputs, unsigned int noutputs); diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 8174b7e67..6dcbff0b9 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -107,6 +107,17 @@ class gr_buffer { std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } std::deque::iterator get_tags_end() { return d_item_tags.end(); } + bool get_tag(size_t n, pmt::pmt_t &t) + { + if(n < d_item_tags.size()) { + t = d_item_tags[n]; + return true; + } + else { + return false; + } + } + // ------------------------------------------------------------------------- private: @@ -265,7 +276,12 @@ class gr_buffer_reader { */ std::deque get_tags_in_range(gr_uint64 abs_start, gr_uint64 abs_end); - + + bool get_tag(size_t n, pmt::pmt_t &t) + { + return d_buffer->get_tag(n, t); + } + // ------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc index 03eef17d9..6a84f4be8 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc +++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc @@ -45,6 +45,8 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block) while ((msg = d->d_tpb.delete_head_nowait())) block->handle_msg(msg); + block->handle_tags(); + d->d_tpb.clear_changed(); s = d_exec.run_one_iteration(); -- cgit From cafe83aa6bd47f8e05bd347cc4495d3662b5440f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 6 Nov 2010 14:24:19 -0400 Subject: Don't directly output tag info to screen from gr_random_annotator; instead, store the stream and write it to stdout when block is being destroyed. This avoids issues of the muliple threads writing simultaneously to screen. --- gnuradio-core/src/lib/runtime/gr_random_annotator.cc | 20 +++++++++++--------- gnuradio-core/src/lib/runtime/gr_random_annotator.h | 1 + gnuradio-core/src/lib/runtime/qa_block_tags.cc | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index d9ad15a55..93d9aa793 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -46,6 +46,7 @@ gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) gr_random_annotator::~gr_random_annotator () { + std::cout << d_sout.str(); } int @@ -62,21 +63,22 @@ gr_random_annotator::work (int noutput_items, gr_uint64 abs_N = nitems_written(0); std::deque all_tags = get_tags_in_range(0, (gr_uint64)0, abs_N); std::deque::iterator itr; - std::cout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; - std::cout.setf(std::ios::left); - std::cout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" - << std::setw(10) << "nitem" << std::setw(20) << "key" - << std::setw(10) << "value" << std::endl; + d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; + d_sout.setf(std::ios::left); + d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" + << std::setw(10) << "nitem" << std::setw(20) << "key" + << std::setw(10) << "value" << std::endl; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { gr_uint64 nitem = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); std::string srcid = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 1)); std::string key = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 2)); gr_uint64 value = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 3)); - std::cout << std::setw(25) << str.str() << std::setw(25) << srcid - << std::setw(10) << nitem << std::setw(20) << key - << std::setw(10) << value << std::endl; + d_sout << std::setw(25) << str.str() << std::setw(25) << srcid + << std::setw(10) << nitem << std::setw(20) << key + << std::setw(10) << value << std::endl; } // Work does nothing to the data stream; just copy all inputs to outputs @@ -86,7 +88,7 @@ gr_random_annotator::work (int noutput_items, } // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t cur_N = pmt::pmt_from_uint64(noutput_items); + pmt::pmt_t cur_N = pmt::pmt_from_uint64(random()); pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items"); add_item_tag(0, abs_N, key, cur_N, srcid); diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h index 7f200eff7..3f21b71ad 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h @@ -45,6 +45,7 @@ protected: private: size_t d_itemsize; + std::stringstream d_sout; friend gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 7fe1b4bfd..ab3db6653 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -75,12 +75,14 @@ qa_block_tags::t1 () gr_block_sptr head (gr_make_head(sizeof(int), N)); gr_block_sptr ann0 (gr_make_random_annotator(sizeof(int))); gr_block_sptr ann1 (gr_make_random_annotator(sizeof(int))); + gr_block_sptr ann2 (gr_make_random_annotator(sizeof(int))); gr_block_sptr snk (gr_make_null_sink(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, snk, 0); + tb->connect(ann1, 0, ann2, 0); + tb->connect(ann2, 0, snk, 0); tb->run(); } -- cgit From 95eaad323daecbd2c4c0a7aaf5176f9a1b33eec0 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 7 Nov 2010 16:05:08 -0500 Subject: Cleaning up. Better use of PMTs; comment mods; returning vectors when getting tags. --- gnuradio-core/src/lib/runtime/gr_block.cc | 14 +++--- gnuradio-core/src/lib/runtime/gr_block.h | 38 ++++++++-------- gnuradio-core/src/lib/runtime/gr_block.i | 4 +- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 50 +++++++++++----------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 42 +++++++++--------- gnuradio-core/src/lib/runtime/gr_buffer.cc | 10 ++--- gnuradio-core/src/lib/runtime/gr_buffer.h | 23 ++++------ .../src/lib/runtime/gr_random_annotator.cc | 20 ++++----- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 6 +-- 9 files changed, 98 insertions(+), 109 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 51eb5b498..73a86e38b 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -117,7 +117,7 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput) throw std::runtime_error("Unimplemented"); } -gr_uint64 +uint64_t gr_block::nitems_read(unsigned int which_input) { if(d_detail) { @@ -129,7 +129,7 @@ gr_block::nitems_read(unsigned int which_input) } } -gr_uint64 +uint64_t gr_block::nitems_written(unsigned int which_output) { if(d_detail) { @@ -143,7 +143,7 @@ gr_block::nitems_written(unsigned int which_output) void gr_block::add_item_tag(unsigned int which_output, - gr_uint64 offset, + uint64_t offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid) @@ -151,16 +151,16 @@ gr_block::add_item_tag(unsigned int which_output, d_detail->add_item_tag(which_output, offset, key, value, srcid); } -std::deque +std::vector gr_block::get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end) + uint64_t start, uint64_t end) { return d_detail->get_tags_in_range(which_output, start, end); } -std::deque +std::vector gr_block::get_tags_in_range(unsigned int which_output, - gr_uint64 start, gr_uint64 end, + uint64_t start, uint64_t end, const pmt::pmt_t &key) { return d_detail->get_tags_in_range(which_output, start, end, key); diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 89d762847..4d1d6f875 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -24,7 +24,6 @@ #define INCLUDED_GR_BLOCK_H #include -#include /*! * \brief The abstract base class for all 'terminal' processing blocks. @@ -202,12 +201,12 @@ class gr_block : public gr_basic_block { /*! * \brief Return the number of items read on input stream which_input */ - gr_uint64 nitems_read(unsigned int which_input); + uint64_t nitems_read(unsigned int which_input); /*! * \brief Return the number of items written on output stream which_output */ - gr_uint64 nitems_written(unsigned int which_output); + uint64_t nitems_written(unsigned int which_output); /*! @@ -238,28 +237,25 @@ class gr_block : public gr_basic_block { /*! - * \brief Adds a new tag to the deque of tags on a given buffer. + * \brief Adds a new tag onto the given output buffer. * - * This is a call-through method to gr_block_detail to add the new tag. - * gr_block_detail takes care of formatting the tuple from the inputs here, - * it then calls gr_buffer::add_item_tag(pmt::pmt_t t), which appends the - * tag onto its deque of tags. + * This is a call-through method to gr_block_detail. * * \param which_ouput an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number * assicated with the tag. Can get from nitems_written. - * \param key a PMT symbol holding the key name (i.e., a string) + * \param key a PMT symbol holding the key name * \param value any PMT holding any value for the given key - * \param srcid optional source ID specifier; defauls to string "NA" + * \param srcid optional source ID specifier; defaults to PMT_F */ void add_item_tag(unsigned int which_output, - gr_uint64 abs_offset, + uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, - const pmt::pmt_t &srcid=pmt::pmt_string_to_symbol("NA")); + const pmt::pmt_t &srcid=pmt::PMT_F); /*! - * \brief Given a [start,end), returns a deque copy of all tags in the range. + * \brief Given a [start,end), returns a vector of all tags in the range. * * Pass-through function to gr_block_detail. Range of counts is from * start to end-1. @@ -271,12 +267,12 @@ class gr_block : public gr_basic_block { * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::deque get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end); + std::vector get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end); /*! - * \brief Given a [start,end), returns a deque copy of all tags in the range + * \brief Given a [start,end), returns a vector of all tags in the range * with a given key. * * Pass-through function to gr_block_detail. Range of counts is from @@ -290,10 +286,10 @@ class gr_block : public gr_basic_block { * \param abs_end a uint64 count of the end of the range of interest * \param key a PMT symbol key to filter only tags of this key */ - std::deque get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end, - const pmt::pmt_t &key); + std::vector get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key); // These are really only for internal use, but leaving them public avoids diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index e6ea06060..2de354878 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -49,8 +49,8 @@ class gr_block : public gr_basic_block { bool start(); bool stop(); - gr_uint64 nitems_read(unsigned int which_input); - gr_uint64 nitems_written(unsigned int which_output); + uint64_t nitems_read(unsigned int which_input); + uint64_t nitems_written(unsigned int which_output); // internal use gr_block_detail_sptr detail () const { return d_detail; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 7994919d4..b3d1a7194 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -27,6 +27,8 @@ #include #include +using namespace pmt; + static long s_ncurrently_allocated = 0; long @@ -127,12 +129,12 @@ gr_block_detail::produce_each (int how_many_items) void -gr_block_detail::_post(pmt::pmt_t msg) +gr_block_detail::_post(pmt_t msg) { d_tpb.insert_tail(msg); } -gr_uint64 +uint64_t gr_block_detail::nitems_read(unsigned int which_input) { if(which_input >= d_ninputs) @@ -140,7 +142,7 @@ gr_block_detail::nitems_read(unsigned int which_input) return d_input[which_input]->nitems_read(); } -gr_uint64 +uint64_t gr_block_detail::nitems_written(unsigned int which_output) { if(which_output >= d_noutputs) @@ -150,50 +152,50 @@ gr_block_detail::nitems_written(unsigned int which_output) void gr_block_detail::add_item_tag(unsigned int which_output, - gr_uint64 abs_offset, - const pmt::pmt_t &key, - const pmt::pmt_t &value, - const pmt::pmt_t &srcid) + uint64_t abs_offset, + const pmt_t &key, + const pmt_t &value, + const pmt_t &srcid) { - if(pmt::pmt_is_symbol(key) == false) { - throw pmt::pmt_wrong_type("gr_block_detail::set_item_tag key", key); + if(!pmt_is_symbol(key)) { + throw pmt_wrong_type("gr_block_detail::set_item_tag key", key); } else { // build tag tuple - pmt::pmt_t nitem = pmt::pmt_from_uint64(abs_offset); - pmt::pmt_t tuple = pmt::pmt_make_tuple(nitem, srcid, key, value); + pmt_t nitem = pmt_from_uint64(abs_offset); + pmt_t tuple = pmt_make_tuple(nitem, srcid, key, value); // Add tag to gr_buffer's deque tags d_output[which_output]->add_item_tag(tuple); } } -std::deque +std::vector gr_block_detail::get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end) + uint64_t abs_start, + uint64_t abs_end) { // get from gr_buffer_reader's deque of tags return d_input[which_input]->get_tags_in_range(abs_start, abs_end); } -std::deque +std::vector gr_block_detail::get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end, - const pmt::pmt_t &key) + uint64_t abs_start, + uint64_t abs_end, + const pmt_t &key) { - std::deque found_items, found_items_by_key; + std::vector found_items, found_items_by_key; // get from gr_buffer_reader's deque of tags found_items = d_input[which_input]->get_tags_in_range(abs_start, abs_end); // Filter further by key name - pmt::pmt_t itemkey; - std::deque::iterator itr; + pmt_t itemkey; + std::vector::iterator itr; for(itr = found_items.begin(); itr != found_items.end(); itr++) { - itemkey = pmt::pmt_tuple_ref(*itr, 2); - if(pmt::pmt_eqv(key, itemkey)) { + itemkey = pmt_tuple_ref(*itr, 2); + if(pmt_eqv(key, itemkey)) { found_items_by_key.push_back(*itr); } } @@ -205,7 +207,7 @@ void gr_block_detail::handle_tags() { for(unsigned int i = 0; i < d_ninputs; i++) { - pmt::pmt_t tuple; + pmt_t tuple; while(d_input[i]->get_tag(d_last_tag, tuple)) { d_last_tag++; if(!sink_p()) { diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index cbb59a689..3a2b82190 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -89,19 +89,18 @@ class gr_block_detail { void _post(pmt::pmt_t msg); // Return the number of items read on input stream which_input - gr_uint64 nitems_read(unsigned int which_input); + uint64_t nitems_read(unsigned int which_input); // Return the number of items written on output stream which_output - gr_uint64 nitems_written(unsigned int which_output); + uint64_t nitems_written(unsigned int which_output); /*! - * \brief Adds a new tag to the deque of tags on a given buffer. + * \brief Adds a new tag to the given output stream. * - * Adds a new tag to deque of tags on a given buffer. This takes the input - * parameters and builds a PMT tuple from it. It then calls - * gr_buffer::add_item_tag(pmt::pmt_t t), which appends the - * tag onto its deque of tags. + * This takes the input parameters and builds a PMT tuple + * from it. It then calls gr_buffer::add_item_tag(pmt::pmt_t t), + * which appends the tag onto its deque. * * \param which_ouput an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number @@ -111,15 +110,15 @@ class gr_block_detail { * \param srcid a PMT source ID specifier */ void add_item_tag(unsigned int which_output, - gr_uint64 abs_offset, + uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid); /*! - * \brief Given a [start,end), returns a deque copy of all tags in the range. + * \brief Given a [start,end), returns a vector of all tags in the range. * - * Pass-through function to gr_buffer_reader to get a deque of tags + * Pass-through function to gr_buffer_reader to get a vector of tags * in given range. Range of counts is from start to end-1. * * Tags are tuples of: @@ -129,18 +128,17 @@ class gr_block_detail { * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::deque get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end); + std::vector get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end); /*! - * \brief Given a [start,end), returns a deque copy of all tags in the range + * \brief Given a [start,end), returns a vector of all tags in the range * with a given key. * - * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a deque of + * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of * tags from the buffers. This function then provides a secondary filter to - * the tags to extract only tags with the given 'key'. Returns a dequeu - * of these tags. + * the tags to extract only tags with the given 'key'. * * Tags are tuples of: * (item count, source id, key, value) @@ -148,12 +146,12 @@ class gr_block_detail { * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest - * \param key a PMT symbol key to filter only tags of this key + * \param key a PMT symbol key to select only tags of this key */ - std::deque get_tags_in_range(unsigned int which_input, - gr_uint64 abs_start, - gr_uint64 abs_end, - const pmt::pmt_t &key); + std::vector get_tags_in_range(unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key); /*! * \brief Default tag handler; moves all tags downstream diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 8387a3168..862d92b81 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -263,14 +263,14 @@ gr_buffer_reader::update_read_pointer (int nitems) d_abs_read_offset += nitems; } -std::deque -gr_buffer_reader::get_tags_in_range(gr_uint64 abs_start, - gr_uint64 abs_end) +std::vector +gr_buffer_reader::get_tags_in_range(uint64_t abs_start, + uint64_t abs_end) { - std::deque found_items; + std::vector found_items; std::deque::iterator itr = d_buffer->get_tags_begin(); - gr_uint64 item_time; + uint64_t item_time; while(itr != d_buffer->get_tags_end()) { item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 6dcbff0b9..5b8f21c94 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -89,17 +89,12 @@ class gr_buffer { gruel::mutex *mutex() { return &d_mutex; } - gr_uint64 nitems_written() { return d_abs_write_offset; } + uint64_t nitems_written() { return d_abs_write_offset; } /*! - * \brief Adds a new tag to the deque of tags on a given buffer. + * \brief Adds a new tag to the buffer. * - * Adds a new tag to deque of tags on a given buffer. This takes the input - * parameters and builds a PMT tuple from it. It then calls - * gr_buffer::add_item_tag(pmt::pmt_t t), which appends the - * tag onto its deque of tags. - * * \param tag a PMT tuple containing the new tag */ void add_item_tag(const pmt::pmt_t &tag); @@ -143,7 +138,7 @@ class gr_buffer { // gruel::mutex d_mutex; unsigned int d_write_index; // in items [0,d_bufsize) - gr_uint64 d_abs_write_offset; // num items written since the start + uint64_t d_abs_write_offset; // num items written since the start //deq tag_tuples bool d_done; @@ -255,7 +250,7 @@ class gr_buffer_reader { gruel::mutex *mutex() { return d_buffer->mutex(); } - gr_uint64 nitems_read() { return d_abs_read_offset; } + uint64_t nitems_read() { return d_abs_read_offset; } /*! * \brief Return the block that reads via this reader. @@ -264,9 +259,9 @@ class gr_buffer_reader { /*! - * \brief Given a [start,end), returns a deque copy of all tags in the range. + * \brief Given a [start,end), returns a vector all tags in the range. * - * Get a deque of tags in given range. Range of counts is from start to end-1. + * Get a vector of tags in given range. Range of counts is from start to end-1. * * Tags are tuples of: * (item count, source id, key, value) @@ -274,8 +269,8 @@ class gr_buffer_reader { * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::deque get_tags_in_range(gr_uint64 abs_start, - gr_uint64 abs_end); + std::vector get_tags_in_range(uint64_t abs_start, + uint64_t abs_end); bool get_tag(size_t n, pmt::pmt_t &t) { @@ -293,7 +288,7 @@ class gr_buffer_reader { gr_buffer_sptr d_buffer; unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) - gr_uint64 d_abs_read_offset; // num items seen since the start + uint64_t d_abs_read_offset; // num items seen since the start boost::weak_ptr d_link; // block that reads via this buffer reader //! constructor is private. Use gr_buffer::add_reader to create instances diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index 93d9aa793..d360c13a5 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -60,9 +60,9 @@ gr_random_annotator::work (int noutput_items, std::stringstream str; str << name() << unique_id(); - gr_uint64 abs_N = nitems_written(0); - std::deque all_tags = get_tags_in_range(0, (gr_uint64)0, abs_N); - std::deque::iterator itr; + uint64_t abs_N = nitems_written(0); + std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); + std::vector::iterator itr; d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; d_sout.setf(std::ios::left); @@ -71,14 +71,12 @@ gr_random_annotator::work (int noutput_items, << std::setw(10) << "value" << std::endl; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - gr_uint64 nitem = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - std::string srcid = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 1)); - std::string key = pmt::pmt_symbol_to_string(pmt::pmt_tuple_ref(*itr, 2)); - gr_uint64 value = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 3)); - - d_sout << std::setw(25) << str.str() << std::setw(25) << srcid - << std::setw(10) << nitem << std::setw(20) << key - << std::setw(10) << value << std::endl; + d_sout << std::setw(25) << str.str() + << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) + << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) + << std::endl; } // Work does nothing to the data stream; just copy all inputs to outputs diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index ab3db6653..2fedb28fd 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -52,14 +52,14 @@ qa_block_tags::t0 () //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error); //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error); - CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (gr_uint64)0); - CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (gr_uint64)0); + CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0); + CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0); tb->run(); CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument); CPPUNIT_ASSERT(src->nitems_written(0) >= N); - CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (gr_uint64)1000); + CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000); CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument); } -- cgit From 3bf4a8423acded7743470adffcd9dcc57b049560 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 7 Nov 2010 17:30:59 -0500 Subject: Moving tags downstream is moved into gr_block_executor. Predefined three methods of moving tags that are selectable by a gr_block. --- gnuradio-core/src/lib/runtime/gr_block.cc | 11 ++++-- gnuradio-core/src/lib/runtime/gr_block.h | 10 +---- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 28 +++++++------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 19 +++++----- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 43 ++++++++++++++++++++++ .../src/lib/runtime/gr_tpb_thread_body.cc | 2 - 6 files changed, 77 insertions(+), 36 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 73a86e38b..1fb4633e5 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -166,12 +166,17 @@ gr_block::get_tags_in_range(unsigned int which_output, return d_detail->get_tags_in_range(which_output, start, end, key); } -void -gr_block::handle_tags() +int +gr_block::tag_handling_method() { - d_detail->handle_tags(); + return d_detail->tag_handling_method(); } +void +gr_block::set_tag_handling_method(int m) +{ + set_tag_handling_method(m); +} std::ostream& operator << (std::ostream& os, const gr_block *m) diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 4d1d6f875..4b246884e 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -208,14 +208,8 @@ class gr_block : public gr_basic_block { */ uint64_t nitems_written(unsigned int which_output); - - /*! - * \brief Function to move tags downstream - * - * The default behavior proxies to gr_block_detail, which just moves all tags - * from input to output and flows them all downstream. - */ - virtual void handle_tags(); + int tag_handling_method(); + void set_tag_handling_method(int m); // ---------------------------------------------------------------------------- diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index b3d1a7194..b7dc52a60 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -42,7 +42,7 @@ gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) d_ninputs (ninputs), d_noutputs (noutputs), d_input (ninputs), d_output (noutputs), d_done (false), - d_last_tag(0) + d_tag_handling_method(gr_block_detail::TAGS_ALL_TO_ALL) { s_ncurrently_allocated++; } @@ -203,18 +203,18 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, return found_items_by_key; } -void -gr_block_detail::handle_tags() -{ - for(unsigned int i = 0; i < d_ninputs; i++) { - pmt_t tuple; - while(d_input[i]->get_tag(d_last_tag, tuple)) { - d_last_tag++; - if(!sink_p()) { - for(unsigned int o = 0; o < d_noutputs; o++) { - d_output[o]->add_item_tag(tuple); - } - } - } +int +gr_block_detail::tag_handling_method() +{ + return d_tag_handling_method; +} + +void +gr_block_detail::set_tag_handling_method(int m) +{ + if((m == TAGS_ONE_TO_ONE) && (ninputs() != noutputs())) { + throw std::invalid_argument ("gr_block_detail::set_handling method to ONE-TO-ONE requires ninputs == noutputs"); } + + d_tag_handling_method = m; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 3a2b82190..711f59cf0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -37,6 +37,13 @@ */ class gr_block_detail { public: + + enum { + TAGS_NONE = 0, + TAGS_ALL_TO_ALL = 1, + TAGS_ONE_TO_ONE = 2 + }; + ~gr_block_detail (); int ninputs () const { return d_ninputs; } @@ -153,13 +160,8 @@ class gr_block_detail { uint64_t abs_end, const pmt::pmt_t &key); - /*! - * \brief Default tag handler; moves all tags downstream - * - * Move all tags from input to output and flows them all downstream. Each input - * stream's tags get appended to each output streams tags. - */ - void handle_tags(); + int tag_handling_method(); + void set_tag_handling_method(int m); gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -172,8 +174,7 @@ class gr_block_detail { std::vector d_input; std::vector d_output; bool d_done; - - size_t d_last_tag; // keep track of which tags we've already received from upstream + int d_tag_handling_method; gr_block_detail (unsigned int ninputs, unsigned int noutputs); diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 2c21a0b0f..f201c3937 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -294,12 +294,55 @@ gr_block_executor::run_one_iteration() for (int i = 0; i < d->noutputs (); i++) d_output_items[i] = d->output(i)->write_pointer(); + // store number of items consumed so far on in stream + std::vector start_count; + for (int i = 0; i < d->ninputs(); i++) + start_count.push_back(d->nitems_read(i)); + // Do the actual work of the block int n = m->general_work (noutput_items, d_ninput_items, d_input_items, d_output_items); LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); + // store number of items consumed after work + std::vector end_count; + for (int i = 0; i < d->ninputs (); i++) + end_count.push_back(d->nitems_read(i)); + + // Move tags downstream + // if a sink, we don't need to move downstream; + // and do not bother if block uses TAGS_NONE attribute + if(!d->sink_p() && (d->tag_handling_method() != gr_block_detail::TAGS_NONE)) { + + // every tag on every input propogates to everyone downstream + if(d->tag_handling_method() == gr_block_detail::TAGS_ALL_TO_ALL) { + for(int i = 0; i < d->ninputs(); i++) { + std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); + std::vector::iterator t; + for(t = tuple.begin(); t != tuple.end(); t++ ) { + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(*t); + } + } + } + + // tags from input i only go to output i + // this requires d->ninputs() == d->noutputs; this is checked when this + // type of tag-handling system is selected in gr_block_detail + else if(d->tag_handling_method() == gr_block_detail::TAGS_ONE_TO_ONE) { + for(int i = 0; i < d->ninputs(); i++) { + std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); + std::vector::iterator t; + for(t = tuple.begin(); t != tuple.end(); t++ ) { + d->output(i)->add_item_tag(*t); + } + } + } + + // else ; do nothing + } + if (n == gr_block::WORK_DONE) goto were_done; diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc index 6a84f4be8..03eef17d9 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc +++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc @@ -45,8 +45,6 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block) while ((msg = d->d_tpb.delete_head_nowait())) block->handle_msg(msg); - block->handle_tags(); - d->d_tpb.clear_changed(); s = d_exec.run_one_iteration(); -- cgit From 23285af07c88890daea3c9da011f983ae0e0da2d Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 7 Nov 2010 18:39:15 -0500 Subject: Moving tag handling setup back into gr_block so it can be set in the constructor of a derived block. --- gnuradio-core/src/lib/runtime/gr_block.cc | 15 +++++++++++---- gnuradio-core/src/lib/runtime/gr_block.h | 15 ++++++++++++++- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 19 +------------------ gnuradio-core/src/lib/runtime/gr_block_detail.h | 11 ----------- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 20 ++++++++++++-------- 5 files changed, 38 insertions(+), 42 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 1fb4633e5..94cf23103 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -36,7 +36,8 @@ gr_block::gr_block (const std::string &name, d_output_multiple (1), d_relative_rate (1.0), d_history(1), - d_fixed_rate(false) + d_fixed_rate(false), + d_tag_handling_method(TAGS_ALL_TO_ALL) { } @@ -166,16 +167,22 @@ gr_block::get_tags_in_range(unsigned int which_output, return d_detail->get_tags_in_range(which_output, start, end, key); } -int +int gr_block::tag_handling_method() { - return d_detail->tag_handling_method(); + return d_tag_handling_method; } void gr_block::set_tag_handling_method(int m) { - set_tag_handling_method(m); + /* + if((m == TAGS_ONE_TO_ONE) && (ninputs() != noutputs())) { + throw std::invalid_argument ("gr_block::set_handling method to ONE-TO-ONE requires ninputs == noutputs"); + } + */ + + d_tag_handling_method = m; } std::ostream& diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 4b246884e..e278e8e9c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -25,6 +25,12 @@ #include +enum { + TAGS_NONE = 0, + TAGS_ALL_TO_ALL = 1, + TAGS_ONE_TO_ONE = 2 +}; + /*! * \brief The abstract base class for all 'terminal' processing blocks. * \ingroup base_blk @@ -208,7 +214,14 @@ class gr_block : public gr_basic_block { */ uint64_t nitems_written(unsigned int which_output); + /*! + * \brief Asks for the method used by the scheduler to moved tags downstream. + */ int tag_handling_method(); + + /*! + * \brief Used by the scheduler to determine how tags are moved downstream. + */ void set_tag_handling_method(int m); // ---------------------------------------------------------------------------- @@ -220,6 +233,7 @@ class gr_block : public gr_basic_block { gr_block_detail_sptr d_detail; // implementation details unsigned d_history; bool d_fixed_rate; + int d_tag_handling_method; protected: @@ -285,7 +299,6 @@ class gr_block : public gr_basic_block { uint64_t abs_end, const pmt::pmt_t &key); - // These are really only for internal use, but leaving them public avoids // having to work up an ever-varying list of friends diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index b7dc52a60..1888b8839 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -41,8 +41,7 @@ gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs) : d_produce_or(0), d_ninputs (ninputs), d_noutputs (noutputs), d_input (ninputs), d_output (noutputs), - d_done (false), - d_tag_handling_method(gr_block_detail::TAGS_ALL_TO_ALL) + d_done (false) { s_ncurrently_allocated++; } @@ -202,19 +201,3 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, return found_items_by_key; } - -int -gr_block_detail::tag_handling_method() -{ - return d_tag_handling_method; -} - -void -gr_block_detail::set_tag_handling_method(int m) -{ - if((m == TAGS_ONE_TO_ONE) && (ninputs() != noutputs())) { - throw std::invalid_argument ("gr_block_detail::set_handling method to ONE-TO-ONE requires ninputs == noutputs"); - } - - d_tag_handling_method = m; -} diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 711f59cf0..929e36fc8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -37,13 +37,6 @@ */ class gr_block_detail { public: - - enum { - TAGS_NONE = 0, - TAGS_ALL_TO_ALL = 1, - TAGS_ONE_TO_ONE = 2 - }; - ~gr_block_detail (); int ninputs () const { return d_ninputs; } @@ -160,9 +153,6 @@ class gr_block_detail { uint64_t abs_end, const pmt::pmt_t &key); - int tag_handling_method(); - void set_tag_handling_method(int m); - gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; @@ -174,7 +164,6 @@ class gr_block_detail { std::vector d_input; std::vector d_output; bool d_done; - int d_tag_handling_method; gr_block_detail (unsigned int ninputs, unsigned int noutputs); diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index f201c3937..3fc536845 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -313,10 +313,10 @@ gr_block_executor::run_one_iteration() // Move tags downstream // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute - if(!d->sink_p() && (d->tag_handling_method() != gr_block_detail::TAGS_NONE)) { + if(!d->sink_p() && (m->tag_handling_method() != TAGS_NONE)) { // every tag on every input propogates to everyone downstream - if(d->tag_handling_method() == gr_block_detail::TAGS_ALL_TO_ALL) { + if(m->tag_handling_method() == TAGS_ALL_TO_ALL) { for(int i = 0; i < d->ninputs(); i++) { std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); std::vector::iterator t; @@ -330,14 +330,18 @@ gr_block_executor::run_one_iteration() // tags from input i only go to output i // this requires d->ninputs() == d->noutputs; this is checked when this // type of tag-handling system is selected in gr_block_detail - else if(d->tag_handling_method() == gr_block_detail::TAGS_ONE_TO_ONE) { - for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); - std::vector::iterator t; - for(t = tuple.begin(); t != tuple.end(); t++ ) { - d->output(i)->add_item_tag(*t); + else if(m->tag_handling_method() == TAGS_ONE_TO_ONE) { + if(d->ninputs() != d->noutputs()) { + for(int i = 0; i < d->ninputs(); i++) { + std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); + std::vector::iterator t; + for(t = tuple.begin(); t != tuple.end(); t++ ) { + d->output(i)->add_item_tag(*t); + } } } + else + throw std::invalid_argument ("handling method 'ONE-TO-ONE' requires ninputs == noutputs"); } // else ; do nothing -- cgit From 75c9c767079868b1c938fbb9a8c5522a60f28c96 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 8 Nov 2010 19:20:19 -0500 Subject: cleaning up; comments, naming, typos, excess code, etc. Moving to make gr_block_executor more readable. --- gnuradio-core/src/lib/runtime/gr_block.cc | 2 +- gnuradio-core/src/lib/runtime/gr_block.h | 22 +++++++++------------- gnuradio-core/src/lib/runtime/gr_block_detail.cc | 2 +- gnuradio-core/src/lib/runtime/gr_block_detail.h | 4 ++-- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 22 +++++++++------------- gnuradio-core/src/lib/runtime/gr_buffer.h | 19 ++----------------- .../src/lib/runtime/gr_random_annotator.cc | 2 +- 7 files changed, 25 insertions(+), 48 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 94cf23103..b3e6b0edc 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -37,7 +37,7 @@ gr_block::gr_block (const std::string &name, d_relative_rate (1.0), d_history(1), d_fixed_rate(false), - d_tag_handling_method(TAGS_ALL_TO_ALL) + d_tag_handling_method(TPP_ALL_TO_ALL) { } diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index e278e8e9c..be39a7b95 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -25,12 +25,6 @@ #include -enum { - TAGS_NONE = 0, - TAGS_ALL_TO_ALL = 1, - TAGS_ONE_TO_ONE = 2 -}; - /*! * \brief The abstract base class for all 'terminal' processing blocks. * \ingroup base_blk @@ -69,6 +63,12 @@ class gr_block : public gr_basic_block { WORK_DONE = -1 }; + enum TAG_PROPOGATION_POLICY { + TPP_DONT = 0, + TPP_ALL_TO_ALL = 1, + TPP_ONE_TO_ONE = 2 + }; + virtual ~gr_block (); /*! @@ -247,12 +247,10 @@ class gr_block : public gr_basic_block { /*! * \brief Adds a new tag onto the given output buffer. * - * This is a call-through method to gr_block_detail. - * * \param which_ouput an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number * assicated with the tag. Can get from nitems_written. - * \param key a PMT symbol holding the key name + * \param key the tag key as a PMT symbol * \param value any PMT holding any value for the given key * \param srcid optional source ID specifier; defaults to PMT_F */ @@ -265,8 +263,7 @@ class gr_block : public gr_basic_block { /*! * \brief Given a [start,end), returns a vector of all tags in the range. * - * Pass-through function to gr_block_detail. Range of counts is from - * start to end-1. + * Range of counts is from start to end-1. * * Tags are tuples of: * (item count, source id, key, value) @@ -283,8 +280,7 @@ class gr_block : public gr_basic_block { * \brief Given a [start,end), returns a vector of all tags in the range * with a given key. * - * Pass-through function to gr_block_detail. Range of counts is from - * start to end-1. + * Range of counts is from start to end-1. * * Tags are tuples of: * (item count, source id, key, value) diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 1888b8839..4f3ffc8dc 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -157,7 +157,7 @@ gr_block_detail::add_item_tag(unsigned int which_output, const pmt_t &srcid) { if(!pmt_is_symbol(key)) { - throw pmt_wrong_type("gr_block_detail::set_item_tag key", key); + throw pmt_wrong_type("gr_block_detail::add_item_tag key", key); } else { // build tag tuple diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 929e36fc8..5902d1559 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -105,7 +105,7 @@ class gr_block_detail { * \param which_ouput an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number * assicated with the tag. Can get from nitems_written. - * \param key a PMT symbol holding the key name (i.e., a string) + * \param key the tag key as a PMT symbol * \param value any PMT holding any value for the given key * \param srcid a PMT source ID specifier */ @@ -146,7 +146,7 @@ class gr_block_detail { * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest - * \param key a PMT symbol key to select only tags of this key + * \param key a PMT symbol to select only tags of this key */ std::vector get_tags_in_range(unsigned int which_input, uint64_t abs_start, diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 3fc536845..c43f22895 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -295,9 +295,10 @@ gr_block_executor::run_one_iteration() d_output_items[i] = d->output(i)->write_pointer(); // store number of items consumed so far on in stream - std::vector start_count; + std::vector d_start_nitems_read; + d_start_nitems_read.resize(d->ninputs()); for (int i = 0; i < d->ninputs(); i++) - start_count.push_back(d->nitems_read(i)); + d_start_nitems_read[i] = d->nitems_read(i); // Do the actual work of the block int n = m->general_work (noutput_items, d_ninput_items, @@ -305,20 +306,15 @@ gr_block_executor::run_one_iteration() LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); - // store number of items consumed after work - std::vector end_count; - for (int i = 0; i < d->ninputs (); i++) - end_count.push_back(d->nitems_read(i)); - // Move tags downstream // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute - if(!d->sink_p() && (m->tag_handling_method() != TAGS_NONE)) { + if(!d->sink_p() && (m->tag_handling_method() != gr_block::TPP_DONT)) { // every tag on every input propogates to everyone downstream - if(m->tag_handling_method() == TAGS_ALL_TO_ALL) { + if(m->tag_handling_method() == gr_block::TPP_ALL_TO_ALL) { for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); + std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); std::vector::iterator t; for(t = tuple.begin(); t != tuple.end(); t++ ) { for(int o = 0; o < d->noutputs(); o++) @@ -330,10 +326,10 @@ gr_block_executor::run_one_iteration() // tags from input i only go to output i // this requires d->ninputs() == d->noutputs; this is checked when this // type of tag-handling system is selected in gr_block_detail - else if(m->tag_handling_method() == TAGS_ONE_TO_ONE) { - if(d->ninputs() != d->noutputs()) { + else if(m->tag_handling_method() == gr_block::TPP_ONE_TO_ONE) { + if(d->ninputs() == d->noutputs()) { for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_count[i], end_count[i]); + std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); std::vector::iterator t; for(t = tuple.begin(); t != tuple.end(); t++ ) { d->output(i)->add_item_tag(*t); diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 5b8f21c94..5f11b4581 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -102,17 +102,6 @@ class gr_buffer { std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } std::deque::iterator get_tags_end() { return d_item_tags.end(); } - bool get_tag(size_t n, pmt::pmt_t &t) - { - if(n < d_item_tags.size()) { - t = d_item_tags[n]; - return true; - } - else { - return false; - } - } - // ------------------------------------------------------------------------- private: @@ -130,7 +119,8 @@ class gr_buffer { std::vector d_readers; boost::weak_ptr d_link; // block that writes to this buffer - std::deque d_item_tags; // temp. store tags until moved to reader + std::deque d_item_tags; + // // The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's @@ -272,11 +262,6 @@ class gr_buffer_reader { std::vector get_tags_in_range(uint64_t abs_start, uint64_t abs_end); - bool get_tag(size_t n, pmt::pmt_t &t) - { - return d_buffer->get_tag(n, t); - } - // ------------------------------------------------------------------------- private: diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index d360c13a5..08589984e 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -60,7 +60,7 @@ gr_random_annotator::work (int noutput_items, std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = nitems_written(0); + uint64_t abs_N = nitems_read(0) + noutput_items; std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); std::vector::iterator itr; -- cgit From 0a2cb50b6b7e50bb69df9478e49db4d77599c324 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 8 Nov 2010 19:30:54 -0500 Subject: Renaming "handling_method" to "propagation_policy". --- gnuradio-core/src/lib/runtime/gr_block.cc | 16 +++++----------- gnuradio-core/src/lib/runtime/gr_block.h | 12 ++++++------ gnuradio-core/src/lib/runtime/gr_block_executor.cc | 10 +++++----- 3 files changed, 16 insertions(+), 22 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index b3e6b0edc..e595b60b8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -37,7 +37,7 @@ gr_block::gr_block (const std::string &name, d_relative_rate (1.0), d_history(1), d_fixed_rate(false), - d_tag_handling_method(TPP_ALL_TO_ALL) + d_tag_propagation_policy(TPP_ALL_TO_ALL) { } @@ -168,21 +168,15 @@ gr_block::get_tags_in_range(unsigned int which_output, } int -gr_block::tag_handling_method() +gr_block::tag_propagation_policy() { - return d_tag_handling_method; + return d_tag_propagation_policy; } void -gr_block::set_tag_handling_method(int m) +gr_block::set_tag_propagation_policy(TAG_PROPAGATION_POLICY p) { - /* - if((m == TAGS_ONE_TO_ONE) && (ninputs() != noutputs())) { - throw std::invalid_argument ("gr_block::set_handling method to ONE-TO-ONE requires ninputs == noutputs"); - } - */ - - d_tag_handling_method = m; + d_tag_propagation_policy = p; } std::ostream& diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index be39a7b95..e2f00bb6f 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -63,7 +63,7 @@ class gr_block : public gr_basic_block { WORK_DONE = -1 }; - enum TAG_PROPOGATION_POLICY { + enum TAG_PROPAGATION_POLICY { TPP_DONT = 0, TPP_ALL_TO_ALL = 1, TPP_ONE_TO_ONE = 2 @@ -215,14 +215,14 @@ class gr_block : public gr_basic_block { uint64_t nitems_written(unsigned int which_output); /*! - * \brief Asks for the method used by the scheduler to moved tags downstream. + * \brief Asks for the policy used by the scheduler to moved tags downstream. */ - int tag_handling_method(); + int tag_propagation_policy(); /*! - * \brief Used by the scheduler to determine how tags are moved downstream. + * \brief Set the policy by the scheduler to determine how tags are moved downstream. */ - void set_tag_handling_method(int m); + void set_tag_propagation_policy(TAG_PROPAGATION_POLICY p); // ---------------------------------------------------------------------------- @@ -233,7 +233,7 @@ class gr_block : public gr_basic_block { gr_block_detail_sptr d_detail; // implementation details unsigned d_history; bool d_fixed_rate; - int d_tag_handling_method; + TAG_PROPAGATION_POLICY d_tag_propagation_policy; // policy for moving tags downstream protected: diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index c43f22895..35aa8cf1e 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -309,10 +309,10 @@ gr_block_executor::run_one_iteration() // Move tags downstream // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute - if(!d->sink_p() && (m->tag_handling_method() != gr_block::TPP_DONT)) { + if(!d->sink_p() && (m->tag_propagation_policy() != gr_block::TPP_DONT)) { // every tag on every input propogates to everyone downstream - if(m->tag_handling_method() == gr_block::TPP_ALL_TO_ALL) { + if(m->tag_propagation_policy() == gr_block::TPP_ALL_TO_ALL) { for(int i = 0; i < d->ninputs(); i++) { std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); std::vector::iterator t; @@ -325,8 +325,8 @@ gr_block_executor::run_one_iteration() // tags from input i only go to output i // this requires d->ninputs() == d->noutputs; this is checked when this - // type of tag-handling system is selected in gr_block_detail - else if(m->tag_handling_method() == gr_block::TPP_ONE_TO_ONE) { + // type of tag-propagation system is selected in gr_block_detail + else if(m->tag_propagation_policy() == gr_block::TPP_ONE_TO_ONE) { if(d->ninputs() == d->noutputs()) { for(int i = 0; i < d->ninputs(); i++) { std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); @@ -337,7 +337,7 @@ gr_block_executor::run_one_iteration() } } else - throw std::invalid_argument ("handling method 'ONE-TO-ONE' requires ninputs == noutputs"); + throw std::invalid_argument ("propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs"); } // else ; do nothing -- cgit From 4cb301dec845778e468c73dac5eb04a9dfccb14a Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 8 Nov 2010 19:46:32 -0500 Subject: Made propagate_tags a function to be called from block_executor to move tags downstream. Also made d_start_nitems_read a member of gr_block_executor to better handle allocation. --- gnuradio-core/src/lib/runtime/gr_block.cc | 2 +- gnuradio-core/src/lib/runtime/gr_block.h | 2 +- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 88 ++++++++++++---------- gnuradio-core/src/lib/runtime/gr_block_executor.h | 1 + 4 files changed, 53 insertions(+), 40 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index e595b60b8..778344769 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -167,7 +167,7 @@ gr_block::get_tags_in_range(unsigned int which_output, return d_detail->get_tags_in_range(which_output, start, end, key); } -int +gr_block::TAG_PROPAGATION_POLICY gr_block::tag_propagation_policy() { return d_tag_propagation_policy; diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index e2f00bb6f..a717946d2 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -217,7 +217,7 @@ class gr_block : public gr_basic_block { /*! * \brief Asks for the policy used by the scheduler to moved tags downstream. */ - int tag_propagation_policy(); + TAG_PROPAGATION_POLICY tag_propagation_policy(); /*! * \brief Set the policy by the scheduler to determine how tags are moved downstream. diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 35aa8cf1e..7d19f44ab 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -87,7 +87,53 @@ min_available_space (gr_block_detail *d, int output_multiple) return min_space; } +static void +propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, + const std::vector &start_nitems_read) +{ + // Move tags downstream + // if a sink, we don't need to move downstream; + // and do not bother if block uses TAGS_NONE attribute + if(!d->sink_p()) { + return; + } + switch(policy) { + case(gr_block::TPP_DONT): + return; + break; + case(gr_block::TPP_ALL_TO_ALL): + // every tag on every input propogates to everyone downstream + for(int i = 0; i < d->ninputs(); i++) { + std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], d->nitems_read(i)); + std::vector::iterator t; + for(t = tuple.begin(); t != tuple.end(); t++ ) { + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(*t); + } + } + break; + case(gr_block::TPP_ONE_TO_ONE): + // tags from input i only go to output i + // this requires d->ninputs() == d->noutputs; this is checked when this + // type of tag-propagation system is selected in gr_block_detail + if(d->ninputs() == d->noutputs()) { + for(int i = 0; i < d->ninputs(); i++) { + std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], d->nitems_read(i)); + std::vector::iterator t; + for(t = tuple.begin(); t != tuple.end(); t++ ) { + d->output(i)->add_item_tag(*t); + } + } + } + else + throw std::invalid_argument ("propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs"); + + break; + default: + return; + } +} gr_block_executor::gr_block_executor (gr_block_sptr block) : d_block(block), d_log(0) @@ -134,6 +180,7 @@ gr_block_executor::run_one_iteration() d_input_items.resize (0); d_input_done.resize(0); d_output_items.resize (d->noutputs ()); + d_start_nitems_read.resize(0); // determine the minimum available output space noutput_items = min_available_space (d, m->output_multiple ()); @@ -155,6 +202,7 @@ gr_block_executor::run_one_iteration() d_input_items.resize (d->ninputs ()); d_input_done.resize(d->ninputs()); d_output_items.resize (0); + d_start_nitems_read.resize(d->ninputs()); LOG(*d_log << " sink\n"); max_items_avail = 0; @@ -198,6 +246,7 @@ gr_block_executor::run_one_iteration() d_input_items.resize (d->ninputs ()); d_input_done.resize(d->ninputs()); d_output_items.resize (d->noutputs ()); + d_start_nitems_read.resize(d->ninputs()); max_items_avail = 0; for (int i = 0; i < d->ninputs (); i++){ @@ -295,8 +344,6 @@ gr_block_executor::run_one_iteration() d_output_items[i] = d->output(i)->write_pointer(); // store number of items consumed so far on in stream - std::vector d_start_nitems_read; - d_start_nitems_read.resize(d->ninputs()); for (int i = 0; i < d->ninputs(); i++) d_start_nitems_read[i] = d->nitems_read(i); @@ -306,42 +353,7 @@ gr_block_executor::run_one_iteration() LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); - // Move tags downstream - // if a sink, we don't need to move downstream; - // and do not bother if block uses TAGS_NONE attribute - if(!d->sink_p() && (m->tag_propagation_policy() != gr_block::TPP_DONT)) { - - // every tag on every input propogates to everyone downstream - if(m->tag_propagation_policy() == gr_block::TPP_ALL_TO_ALL) { - for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); - std::vector::iterator t; - for(t = tuple.begin(); t != tuple.end(); t++ ) { - for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(*t); - } - } - } - - // tags from input i only go to output i - // this requires d->ninputs() == d->noutputs; this is checked when this - // type of tag-propagation system is selected in gr_block_detail - else if(m->tag_propagation_policy() == gr_block::TPP_ONE_TO_ONE) { - if(d->ninputs() == d->noutputs()) { - for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, d_start_nitems_read[i], d->nitems_read(i)); - std::vector::iterator t; - for(t = tuple.begin(); t != tuple.end(); t++ ) { - d->output(i)->add_item_tag(*t); - } - } - } - else - throw std::invalid_argument ("propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs"); - } - - // else ; do nothing - } + propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read); if (n == gr_block::WORK_DONE) goto were_done; diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h index 41b5ede7c..22b782883 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.h +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h @@ -47,6 +47,7 @@ protected: gr_vector_const_void_star d_input_items; std::vector d_input_done; gr_vector_void_star d_output_items; + std::vector d_start_nitems_read; //stores where tag counts are before work public: gr_block_executor(gr_block_sptr block); -- cgit From ab8c921bf73b61c19305bc0bf1fc4d26b110779e Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 8 Nov 2010 19:52:50 -0500 Subject: Adding mutex protection around adding and getting tags from buffers. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 3 +++ gnuradio-core/src/lib/runtime/gr_buffer.h | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 862d92b81..1d67470ec 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -219,6 +219,7 @@ gr_buffer::drop_reader (gr_buffer_reader *reader) void gr_buffer::add_item_tag(const pmt::pmt_t &tag) { + gruel::scoped_lock guard(*mutex()); d_item_tags.push_back(tag); } @@ -267,6 +268,8 @@ std::vector gr_buffer_reader::get_tags_in_range(uint64_t abs_start, uint64_t abs_end) { + gruel::scoped_lock guard(*mutex()); + std::vector found_items; std::deque::iterator itr = d_buffer->get_tags_begin(); diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 5f11b4581..d6d5564e8 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -119,18 +119,16 @@ class gr_buffer { std::vector d_readers; boost::weak_ptr d_link; // block that writes to this buffer - std::deque d_item_tags; - - // - // The mutex protects d_write_index, d_abs_write_offset, d_done and the d_read_index's - // and d_abs_read_offset's in the buffer readers. + // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags + // and the d_read_index's and d_abs_read_offset's in the buffer readers. // gruel::mutex d_mutex; unsigned int d_write_index; // in items [0,d_bufsize) uint64_t d_abs_write_offset; // num items written since the start - //deq tag_tuples bool d_done; + std::deque d_item_tags; + unsigned index_add (unsigned a, unsigned b) -- cgit From ec79e6f688c0ef94e66c938eba24c8b95e9856ba Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 8 Nov 2010 20:03:21 -0500 Subject: Burned by another copy-paste error. Correctly checking and acting if its a sink. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 7d19f44ab..804c9e197 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -94,7 +94,7 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, // Move tags downstream // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute - if(!d->sink_p()) { + if(d->sink_p()) { return; } -- cgit From b47b9ca40ecf49afa44c993b8da9af4ff876c9ba Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 13 Oct 2010 22:25:16 -0600 Subject: regenerated from template --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 210 ++++++++++++++++++++------- 1 file changed, 156 insertions(+), 54 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index e24ba5a96..fab8afd62 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -72,7 +72,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc +swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -86,7 +86,7 @@ gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \ _gnuradio_swig_py_runtime.la _gnuradio_swig_py_runtime_la_SOURCES = \ - gnuradio_swig_py_runtime.cc \ + gnuradio_swig_py_runtime-python.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) _gnuradio_swig_py_runtime_la_LIBADD = \ @@ -107,7 +107,7 @@ gnuradio_swig_py_runtime_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc: gnuradio_swig_py_runtime.i +gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime-python.cc: gnuradio_swig_py_runtime.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -159,11 +159,12 @@ gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime. ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -187,11 +188,27 @@ gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime. ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + > $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_runtime.Sd $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -202,7 +219,7 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime.cc $(WHAT); then \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ @@ -249,7 +266,7 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, @@ -331,7 +348,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general.cc +swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -345,7 +362,7 @@ gnuradio_swig_py_general_pylib_LTLIBRARIES = \ _gnuradio_swig_py_general.la _gnuradio_swig_py_general_la_SOURCES = \ - gnuradio_swig_py_general.cc \ + gnuradio_swig_py_general-python.cc \ $(gnuradio_swig_py_general_la_swig_sources) _gnuradio_swig_py_general_la_LIBADD = \ @@ -366,7 +383,7 @@ gnuradio_swig_py_general_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general.cc: gnuradio_swig_py_general.i +gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general-python.cc: gnuradio_swig_py_general.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -418,11 +435,12 @@ gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general. ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -446,11 +464,27 @@ gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general. ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_general-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_general-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ + > $(DEPDIR)/gnuradio_swig_py_general.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_general.Sd $(DEPDIR)/gnuradio_swig_py_general.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -461,7 +495,7 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_general_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general.cc $(WHAT); then \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ @@ -508,7 +542,7 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_general-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, @@ -590,7 +624,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc +swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -604,7 +638,7 @@ gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \ _gnuradio_swig_py_gengen.la _gnuradio_swig_py_gengen_la_SOURCES = \ - gnuradio_swig_py_gengen.cc \ + gnuradio_swig_py_gengen-python.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) _gnuradio_swig_py_gengen_la_LIBADD = \ @@ -625,7 +659,7 @@ gnuradio_swig_py_gengen_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: gnuradio_swig_py_gengen.i +gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen-python.cc: gnuradio_swig_py_gengen.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -677,11 +711,12 @@ gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -705,11 +740,27 @@ gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + > $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_gengen.Sd $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -720,7 +771,7 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen.cc $(WHAT); then \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ @@ -767,7 +818,7 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, @@ -849,7 +900,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc +swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -863,7 +914,7 @@ gnuradio_swig_py_filter_pylib_LTLIBRARIES = \ _gnuradio_swig_py_filter.la _gnuradio_swig_py_filter_la_SOURCES = \ - gnuradio_swig_py_filter.cc \ + gnuradio_swig_py_filter-python.cc \ $(gnuradio_swig_py_filter_la_swig_sources) _gnuradio_swig_py_filter_la_LIBADD = \ @@ -884,7 +935,7 @@ gnuradio_swig_py_filter_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: gnuradio_swig_py_filter.i +gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter-python.cc: gnuradio_swig_py_filter.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -936,11 +987,12 @@ gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -964,11 +1016,27 @@ gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_filter-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ + > $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_filter.Sd $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -979,7 +1047,7 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_filter_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter.cc $(WHAT); then \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ @@ -1026,7 +1094,7 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, @@ -1108,7 +1176,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io.cc +swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1122,7 +1190,7 @@ gnuradio_swig_py_io_pylib_LTLIBRARIES = \ _gnuradio_swig_py_io.la _gnuradio_swig_py_io_la_SOURCES = \ - gnuradio_swig_py_io.cc \ + gnuradio_swig_py_io-python.cc \ $(gnuradio_swig_py_io_la_swig_sources) _gnuradio_swig_py_io_la_LIBADD = \ @@ -1143,7 +1211,7 @@ gnuradio_swig_py_io_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_swig_py_io.i +gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io-python.cc: gnuradio_swig_py_io.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1195,11 +1263,12 @@ gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_sw ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -1223,11 +1292,27 @@ gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_sw ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_io-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_io-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ + > $(DEPDIR)/gnuradio_swig_py_io.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_io.Sd $(DEPDIR)/gnuradio_swig_py_io.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -1238,7 +1323,7 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_io_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io.cc $(WHAT); then \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ @@ -1285,7 +1370,7 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_io-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, @@ -1367,7 +1452,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc +swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier-python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1381,7 +1466,7 @@ gnuradio_swig_py_hier_pylib_LTLIBRARIES = \ _gnuradio_swig_py_hier.la _gnuradio_swig_py_hier_la_SOURCES = \ - gnuradio_swig_py_hier.cc \ + gnuradio_swig_py_hier-python.cc \ $(gnuradio_swig_py_hier_la_swig_sources) _gnuradio_swig_py_hier_la_LIBADD = \ @@ -1402,7 +1487,7 @@ gnuradio_swig_py_hier_python_PYTHON = \ ## Entry rule for running SWIG -gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnuradio_swig_py_hier.i +gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier-python.cc: gnuradio_swig_py_hier.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1454,11 +1539,12 @@ gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnura ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp; \ + rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -1482,11 +1568,27 @@ gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnura ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp; \ + test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_hier-generate-stamp: +$(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ + -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier-guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ + > $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_hier.Sd $(DEPDIR)/gnuradio_swig_py_hier.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp + +$(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -1497,7 +1599,7 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_hier_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier.cc $(WHAT); then \ + -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier-python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ @@ -1544,7 +1646,7 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, -- cgit From 29fef37cdee9eced2ff7c6ff44da2e8e8fa88aa7 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 13 Oct 2010 22:27:08 -0600 Subject: split out _SOURCES into separate values for the different scripting languages. --- gnuradio-core/src/lib/swig/Makefile.am | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 1a50b8c8e..afd6ef268 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -32,6 +32,7 @@ swiginclude_HEADERS = \ gnuradio.i \ gr_swig_block_magic.i \ gr_shared_ptr.i +# std_complex.i # special install for this top-level Python script which includes all # of the split Python libraries. @@ -88,7 +89,7 @@ include $(top_srcdir)/Makefile.swig # include the SWIG-generated .h files in the BUILT SOURCES, since they # aren't by default when using Makefile.swig; order doesn't matter. -BUILT_SOURCES = \ +PYTHON_GEN = \ gnuradio_swig_py_runtime.h \ gnuradio_swig_py_general.h \ gnuradio_swig_py_gengen.h \ @@ -98,6 +99,15 @@ BUILT_SOURCES = \ $(grinclude_HEADERS) \ $(swig_built_sources) +BUILT_GUILE = \ + $(grinclude_HEADERS) \ + $(swig_built_sources) + +BUILT_SOURCES = $(PYTHON_GEN) +if GUILE +BUILT_SOURCES += $(BUILT_GUILE) +endif + # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -endif +endif # end of if python -- cgit From ed4094208c501e91838ccc333059e4731e8ae908 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 14 Oct 2010 12:34:08 -0600 Subject: regenerated after changes to the template --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 216 +++++++++++++++++++-------- 1 file changed, 156 insertions(+), 60 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index fab8afd62..9d7112169 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -72,7 +72,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime-python.cc +swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -83,21 +83,21 @@ gnuradio_swig_py_runtime_swiginclude_HEADERS = \ $(gnuradio_swig_py_runtime_swiginclude_headers) gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_runtime.la + _gnuradio_swig_py_runtime_python.la -_gnuradio_swig_py_runtime_la_SOURCES = \ - gnuradio_swig_py_runtime-python.cc \ +_gnuradio_swig_py_runtime_python_la_SOURCES = \ + gnuradio_swig_py_runtime_python.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) -_gnuradio_swig_py_runtime_la_LIBADD = \ +_gnuradio_swig_py_runtime_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_runtime_la_swig_libadd) -_gnuradio_swig_py_runtime_la_LDFLAGS = \ +_gnuradio_swig_py_runtime_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_runtime_la_swig_ldflags) -_gnuradio_swig_py_runtime_la_CXXFLAGS = \ +_gnuradio_swig_py_runtime_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_runtime_la_swig_cxxflags) @@ -105,9 +105,23 @@ gnuradio_swig_py_runtime_python_PYTHON = \ gnuradio_swig_py_runtime.py \ $(gnuradio_swig_py_runtime_python) +if GUILE +gnuradio_swig_py_runtime_pylib_LTLIBRARIES += _gnuradio_swig_py_runtime_guile.la + +_gnuradio_swig_py_runtime_guile_la_SOURCES = \ + gnuradio_swig_py_runtime_guile.cc \ + $(gnuradio_swig_py_runtime_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_python_la_LIBADD) +_gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_python_la_LDFLAGS) +_gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime-python.cc: gnuradio_swig_py_runtime.i +gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -193,9 +207,10 @@ gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime- fi; $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ @@ -207,6 +222,7 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -219,7 +235,7 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime-python.cc $(WHAT); then \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ @@ -348,7 +364,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general-python.cc +swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -359,21 +375,21 @@ gnuradio_swig_py_general_swiginclude_HEADERS = \ $(gnuradio_swig_py_general_swiginclude_headers) gnuradio_swig_py_general_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_general.la + _gnuradio_swig_py_general_python.la -_gnuradio_swig_py_general_la_SOURCES = \ - gnuradio_swig_py_general-python.cc \ +_gnuradio_swig_py_general_python_la_SOURCES = \ + gnuradio_swig_py_general_python.cc \ $(gnuradio_swig_py_general_la_swig_sources) -_gnuradio_swig_py_general_la_LIBADD = \ +_gnuradio_swig_py_general_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_general_la_swig_libadd) -_gnuradio_swig_py_general_la_LDFLAGS = \ +_gnuradio_swig_py_general_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_general_la_swig_ldflags) -_gnuradio_swig_py_general_la_CXXFLAGS = \ +_gnuradio_swig_py_general_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_general_la_swig_cxxflags) @@ -381,9 +397,23 @@ gnuradio_swig_py_general_python_PYTHON = \ gnuradio_swig_py_general.py \ $(gnuradio_swig_py_general_python) +if GUILE +gnuradio_swig_py_general_pylib_LTLIBRARIES += _gnuradio_swig_py_general_guile.la + +_gnuradio_swig_py_general_guile_la_SOURCES = \ + gnuradio_swig_py_general_guile.cc \ + $(gnuradio_swig_py_general_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_python_la_LIBADD) +_gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_python_la_LDFLAGS) +_gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general-python.cc: gnuradio_swig_py_general.i +gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc: gnuradio_swig_py_general.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -469,9 +499,10 @@ gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general- fi; $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ @@ -483,6 +514,7 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_general.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -495,7 +527,7 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_general_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general-python.cc $(WHAT); then \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ @@ -624,7 +656,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen-python.cc +swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -635,21 +667,21 @@ gnuradio_swig_py_gengen_swiginclude_HEADERS = \ $(gnuradio_swig_py_gengen_swiginclude_headers) gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_gengen.la + _gnuradio_swig_py_gengen_python.la -_gnuradio_swig_py_gengen_la_SOURCES = \ - gnuradio_swig_py_gengen-python.cc \ +_gnuradio_swig_py_gengen_python_la_SOURCES = \ + gnuradio_swig_py_gengen_python.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) -_gnuradio_swig_py_gengen_la_LIBADD = \ +_gnuradio_swig_py_gengen_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_gengen_la_swig_libadd) -_gnuradio_swig_py_gengen_la_LDFLAGS = \ +_gnuradio_swig_py_gengen_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_gengen_la_swig_ldflags) -_gnuradio_swig_py_gengen_la_CXXFLAGS = \ +_gnuradio_swig_py_gengen_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_gengen_la_swig_cxxflags) @@ -657,9 +689,23 @@ gnuradio_swig_py_gengen_python_PYTHON = \ gnuradio_swig_py_gengen.py \ $(gnuradio_swig_py_gengen_python) +if GUILE +gnuradio_swig_py_gengen_pylib_LTLIBRARIES += _gnuradio_swig_py_gengen_guile.la + +_gnuradio_swig_py_gengen_guile_la_SOURCES = \ + gnuradio_swig_py_gengen_guile.cc \ + $(gnuradio_swig_py_gengen_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_python_la_LIBADD) +_gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_python_la_LDFLAGS) +_gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen-python.cc: gnuradio_swig_py_gengen.i +gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc: gnuradio_swig_py_gengen.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -745,9 +791,10 @@ gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen-pyt fi; $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ @@ -759,6 +806,7 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -771,7 +819,7 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen-python.cc $(WHAT); then \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ @@ -900,7 +948,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter-python.cc +swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -911,21 +959,21 @@ gnuradio_swig_py_filter_swiginclude_HEADERS = \ $(gnuradio_swig_py_filter_swiginclude_headers) gnuradio_swig_py_filter_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_filter.la + _gnuradio_swig_py_filter_python.la -_gnuradio_swig_py_filter_la_SOURCES = \ - gnuradio_swig_py_filter-python.cc \ +_gnuradio_swig_py_filter_python_la_SOURCES = \ + gnuradio_swig_py_filter_python.cc \ $(gnuradio_swig_py_filter_la_swig_sources) -_gnuradio_swig_py_filter_la_LIBADD = \ +_gnuradio_swig_py_filter_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_filter_la_swig_libadd) -_gnuradio_swig_py_filter_la_LDFLAGS = \ +_gnuradio_swig_py_filter_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_filter_la_swig_ldflags) -_gnuradio_swig_py_filter_la_CXXFLAGS = \ +_gnuradio_swig_py_filter_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_filter_la_swig_cxxflags) @@ -933,9 +981,23 @@ gnuradio_swig_py_filter_python_PYTHON = \ gnuradio_swig_py_filter.py \ $(gnuradio_swig_py_filter_python) +if GUILE +gnuradio_swig_py_filter_pylib_LTLIBRARIES += _gnuradio_swig_py_filter_guile.la + +_gnuradio_swig_py_filter_guile_la_SOURCES = \ + gnuradio_swig_py_filter_guile.cc \ + $(gnuradio_swig_py_filter_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_python_la_LIBADD) +_gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_python_la_LDFLAGS) +_gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter-python.cc: gnuradio_swig_py_filter.i +gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc: gnuradio_swig_py_filter.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1021,9 +1083,10 @@ gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter-pyt fi; $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ @@ -1035,6 +1098,7 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_filter.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1047,7 +1111,7 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_filter_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter-python.cc $(WHAT); then \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ @@ -1176,7 +1240,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io-python.cc +swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1187,21 +1251,21 @@ gnuradio_swig_py_io_swiginclude_HEADERS = \ $(gnuradio_swig_py_io_swiginclude_headers) gnuradio_swig_py_io_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_io.la + _gnuradio_swig_py_io_python.la -_gnuradio_swig_py_io_la_SOURCES = \ - gnuradio_swig_py_io-python.cc \ +_gnuradio_swig_py_io_python_la_SOURCES = \ + gnuradio_swig_py_io_python.cc \ $(gnuradio_swig_py_io_la_swig_sources) -_gnuradio_swig_py_io_la_LIBADD = \ +_gnuradio_swig_py_io_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_io_la_swig_libadd) -_gnuradio_swig_py_io_la_LDFLAGS = \ +_gnuradio_swig_py_io_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_io_la_swig_ldflags) -_gnuradio_swig_py_io_la_CXXFLAGS = \ +_gnuradio_swig_py_io_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_io_la_swig_cxxflags) @@ -1209,9 +1273,23 @@ gnuradio_swig_py_io_python_PYTHON = \ gnuradio_swig_py_io.py \ $(gnuradio_swig_py_io_python) +if GUILE +gnuradio_swig_py_io_pylib_LTLIBRARIES += _gnuradio_swig_py_io_guile.la + +_gnuradio_swig_py_io_guile_la_SOURCES = \ + gnuradio_swig_py_io_guile.cc \ + $(gnuradio_swig_py_io_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_python_la_LIBADD) +_gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_python_la_LDFLAGS) +_gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io-python.cc: gnuradio_swig_py_io.i +gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc: gnuradio_swig_py_io.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1297,9 +1375,10 @@ gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io-python.cc: gnur fi; $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ @@ -1311,6 +1390,7 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_io.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1323,7 +1403,7 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_io_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io-python.cc $(WHAT); then \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ @@ -1452,7 +1532,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier-python.cc +swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1463,21 +1543,21 @@ gnuradio_swig_py_hier_swiginclude_HEADERS = \ $(gnuradio_swig_py_hier_swiginclude_headers) gnuradio_swig_py_hier_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_hier.la + _gnuradio_swig_py_hier_python.la -_gnuradio_swig_py_hier_la_SOURCES = \ - gnuradio_swig_py_hier-python.cc \ +_gnuradio_swig_py_hier_python_la_SOURCES = \ + gnuradio_swig_py_hier_python.cc \ $(gnuradio_swig_py_hier_la_swig_sources) -_gnuradio_swig_py_hier_la_LIBADD = \ +_gnuradio_swig_py_hier_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_hier_la_swig_libadd) -_gnuradio_swig_py_hier_la_LDFLAGS = \ +_gnuradio_swig_py_hier_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_hier_la_swig_ldflags) -_gnuradio_swig_py_hier_la_CXXFLAGS = \ +_gnuradio_swig_py_hier_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_hier_la_swig_cxxflags) @@ -1485,9 +1565,23 @@ gnuradio_swig_py_hier_python_PYTHON = \ gnuradio_swig_py_hier.py \ $(gnuradio_swig_py_hier_python) +if GUILE +gnuradio_swig_py_hier_pylib_LTLIBRARIES += _gnuradio_swig_py_hier_guile.la + +_gnuradio_swig_py_hier_guile_la_SOURCES = \ + gnuradio_swig_py_hier_guile.cc \ + $(gnuradio_swig_py_hier_la_swig_sources) + +# Guile can use the same flags as python does +_gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_python_la_LIBADD) +_gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_python_la_LDFLAGS) +_gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier-python.cc: gnuradio_swig_py_hier.i +gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc: gnuradio_swig_py_hier.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1573,9 +1667,10 @@ gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier-python.cc fi; $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: +if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier-guile.cc $(WHAT); then \ + -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ @@ -1587,6 +1682,7 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: $(RM) $(DEPDIR)/gnuradio_swig_py_hier.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp +endif $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1599,7 +1695,7 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_hier_swig_args) \ -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier-python.cc $(WHAT); then \ + -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ -- cgit From 07272e97741fa028101e09b09ced24804f562852 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 14 Oct 2010 12:35:14 -0600 Subject: look for the python name in the dependency for gnuradio_swig_bug_workaround.h --- gnuradio-core/src/lib/swig/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index afd6ef268..3ae6a5386 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -42,8 +42,8 @@ ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.cc $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime.cc $@ +gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime_python.cc $(srcdir)/gen-swig-bug-fix + $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime_python.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ -- cgit From ae3875c7116fa910da0b4d407550265852d0c94f Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 14 Oct 2010 19:00:35 -0600 Subject: guile doesn't seem to need the header files --- gnuradio-core/src/lib/swig/Makefile.am | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 3ae6a5386..391182616 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -32,7 +32,6 @@ swiginclude_HEADERS = \ gnuradio.i \ gr_swig_block_magic.i \ gr_shared_ptr.i -# std_complex.i # special install for this top-level Python script which includes all # of the split Python libraries. @@ -42,8 +41,12 @@ ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime_python.cc $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime_python.cc $@ +workarounds = gnuradio_swig_py_runtime_python.cc +# if GUILE +# workarounds += gnuradio_swig_py_runtime_guile.cc +# endif +gnuradio_swig_bug_workaround.h : $(workarounds) $(srcdir)/gen-swig-bug-fix + $(PYTHON) $(srcdir)/gen-swig-bug-fix $(workarounds) $@ # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ @@ -90,13 +93,13 @@ include $(top_srcdir)/Makefile.swig # include the SWIG-generated .h files in the BUILT SOURCES, since they # aren't by default when using Makefile.swig; order doesn't matter. PYTHON_GEN = \ - gnuradio_swig_py_runtime.h \ - gnuradio_swig_py_general.h \ - gnuradio_swig_py_gengen.h \ - gnuradio_swig_py_filter.h \ - gnuradio_swig_py_io.h \ - gnuradio_swig_py_hier.h \ - $(grinclude_HEADERS) \ + gnuradio_swig_py_runtime_python.h \ + gnuradio_swig_py_general_python.h \ + gnuradio_swig_py_gengen_python.h \ + gnuradio_swig_py_filter_python.h \ + gnuradio_swig_py_io_python.h \ + gnuradio_swig_py_hier_python.h \ + $(grinclude_HEADERS) \ $(swig_built_sources) BUILT_GUILE = \ @@ -104,9 +107,9 @@ BUILT_GUILE = \ $(swig_built_sources) BUILT_SOURCES = $(PYTHON_GEN) -if GUILE -BUILT_SOURCES += $(BUILT_GUILE) -endif +# if GUILE +# BUILT_SOURCES += $(BUILT_GUILE) +# endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -- cgit From 826869b666094bba2349e725e90878cc7e0aad8b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 14 Oct 2010 20:15:42 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 318 ++++++++++++++++----------- 1 file changed, 186 insertions(+), 132 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 9d7112169..42c431204 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -121,7 +121,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i +gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc gnuradio_swig_py_runtime_guile.cc gnuradio_swig_py_runtime_guile.h: gnuradio_swig_py_runtime.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -209,19 +209,28 @@ gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_ $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ - > $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_runtime.Sd $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + cp $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: @@ -234,17 +243,17 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_python.Std \ -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ - > $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_runtime.Sd $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd $(DEPDIR)/gnuradio_swig_py_runtime_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -256,27 +265,27 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.d + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_runtime.Std $(DEPDIR)/gnuradio_swig_py_runtime.d + cp $(DEPDIR)/gnuradio_swig_py_runtime_python.Std $(DEPDIR)/gnuradio_swig_py_runtime_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -288,7 +297,7 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_python.d@am__quote@ # -*- Makefile -*- # @@ -413,7 +422,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc: gnuradio_swig_py_general.i +gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc gnuradio_swig_py_general_guile.cc gnuradio_swig_py_general_guile.h: gnuradio_swig_py_general.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -501,19 +510,28 @@ gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general_ $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ -module gnuradio_swig_py_general -o gnuradio_swig_py_general_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ - > $(DEPDIR)/gnuradio_swig_py_general.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_general.Sd $(DEPDIR)/gnuradio_swig_py_general.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.d + cp $(DEPDIR)/gnuradio_swig_py_general_guile.Std $(DEPDIR)/gnuradio_swig_py_general_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_general_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: @@ -526,17 +544,17 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_general_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_general_python.Std \ -module gnuradio_swig_py_general -o gnuradio_swig_py_general_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ - > $(DEPDIR)/gnuradio_swig_py_general.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_general.Sd $(DEPDIR)/gnuradio_swig_py_general.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_general_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_general_python.Sd $(DEPDIR)/gnuradio_swig_py_general_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -548,27 +566,27 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_general.d + $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_general.Std $(DEPDIR)/gnuradio_swig_py_general.d + cp $(DEPDIR)/gnuradio_swig_py_general_python.Std $(DEPDIR)/gnuradio_swig_py_general_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_general.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_general_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -580,7 +598,7 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_python.d@am__quote@ # -*- Makefile -*- # @@ -705,7 +723,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc: gnuradio_swig_py_gengen.i +gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc gnuradio_swig_py_gengen_guile.cc gnuradio_swig_py_gengen_guile.h: gnuradio_swig_py_gengen.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -793,19 +811,28 @@ gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_pyt $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ - > $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_gengen.Sd $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + cp $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: @@ -818,17 +845,17 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_python.Std \ -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ - > $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_gengen.Sd $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd $(DEPDIR)/gnuradio_swig_py_gengen_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -840,27 +867,27 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.d + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_gengen.Std $(DEPDIR)/gnuradio_swig_py_gengen.d + cp $(DEPDIR)/gnuradio_swig_py_gengen_python.Std $(DEPDIR)/gnuradio_swig_py_gengen_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -872,7 +899,7 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_python.d@am__quote@ # -*- Makefile -*- # @@ -997,7 +1024,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc: gnuradio_swig_py_filter.i +gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc gnuradio_swig_py_filter_guile.cc gnuradio_swig_py_filter_guile.h: gnuradio_swig_py_filter.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1085,19 +1112,28 @@ gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_pyt $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ - > $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_filter.Sd $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.d + cp $(DEPDIR)/gnuradio_swig_py_filter_guile.Std $(DEPDIR)/gnuradio_swig_py_filter_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: @@ -1110,17 +1146,17 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_filter_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_python.Std \ -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ - > $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_filter.Sd $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_filter_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_filter_python.Sd $(DEPDIR)/gnuradio_swig_py_filter_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -1132,27 +1168,27 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.d + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_filter.Std $(DEPDIR)/gnuradio_swig_py_filter.d + cp $(DEPDIR)/gnuradio_swig_py_filter_python.Std $(DEPDIR)/gnuradio_swig_py_filter_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_filter.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -1164,7 +1200,7 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_python.d@am__quote@ # -*- Makefile -*- # @@ -1289,7 +1325,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc: gnuradio_swig_py_io.i +gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc gnuradio_swig_py_io_guile.cc gnuradio_swig_py_io_guile.h: gnuradio_swig_py_io.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1377,19 +1413,28 @@ gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc: gnur $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ -module gnuradio_swig_py_io -o gnuradio_swig_py_io_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ - > $(DEPDIR)/gnuradio_swig_py_io.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_io.Sd $(DEPDIR)/gnuradio_swig_py_io.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.d + cp $(DEPDIR)/gnuradio_swig_py_io_guile.Std $(DEPDIR)/gnuradio_swig_py_io_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_io_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: @@ -1402,17 +1447,17 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_io_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_io_python.Std \ -module gnuradio_swig_py_io -o gnuradio_swig_py_io_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ - > $(DEPDIR)/gnuradio_swig_py_io.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_io.Sd $(DEPDIR)/gnuradio_swig_py_io.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_io_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_io_python.Sd $(DEPDIR)/gnuradio_swig_py_io_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -1424,27 +1469,27 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_io.d + $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_io.Std $(DEPDIR)/gnuradio_swig_py_io.d + cp $(DEPDIR)/gnuradio_swig_py_io_python.Std $(DEPDIR)/gnuradio_swig_py_io_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_io.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_io_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -1456,7 +1501,7 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_python.d@am__quote@ # -*- Makefile -*- # @@ -1581,7 +1626,7 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc: gnuradio_swig_py_hier.i +gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc gnuradio_swig_py_hier_guile.cc gnuradio_swig_py_hier_guile.h: gnuradio_swig_py_hier.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1669,19 +1714,28 @@ gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: if GUILE if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_guile.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ - > $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_hier.Sd $(DEPDIR)/gnuradio_swig_py_hier.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.S*; exit 1; \ fi; touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.d + cp $(DEPDIR)/gnuradio_swig_py_hier_guile.Std $(DEPDIR)/gnuradio_swig_py_hier_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_guile.d@am__quote@ endif $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: @@ -1694,17 +1748,17 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_hier_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_python.Std \ -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \ - > $(DEPDIR)/gnuradio_swig_py_hier.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_hier.Sd $(DEPDIR)/gnuradio_swig_py_hier.Std; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_python.Std \ + > $(DEPDIR)/gnuradio_swig_py_hier_python.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_hier_python.Sd $(DEPDIR)/gnuradio_swig_py_hier_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.S*; exit 1; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -1716,27 +1770,27 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.d + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/gnuradio_swig_py_hier.Std $(DEPDIR)/gnuradio_swig_py_hier.d + cp $(DEPDIR)/gnuradio_swig_py_hier_python.Std $(DEPDIR)/gnuradio_swig_py_hier_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/gnuradio_swig_py_hier.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -1748,5 +1802,5 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_python.d@am__quote@ -- cgit From 1caa7d707377d093cf7d9b7e65176848a93bba5c Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 16 Oct 2010 08:51:47 -0600 Subject: wrap all %pythoncode in SWIGPYTHON so they don't get inserted into other languages --- gnuradio-core/src/lib/runtime/gr_basic_block.i | 6 ++++++ gnuradio-core/src/lib/runtime/gr_block.i | 5 +++++ gnuradio-core/src/lib/runtime/gr_msg_queue.i | 5 +++++ gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 5 +++++ 4 files changed, 21 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i index 60e08aac3..847ef3689 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.i +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i @@ -47,6 +47,12 @@ public: %rename(block_ncurrently_allocated) gr_basic_block_ncurrently_allocated; long gr_basic_block_ncurrently_allocated(); +#ifdef SWIGPYTHON %pythoncode %{ gr_basic_block_sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} +#endif + +#ifdef SWIGGUILE +#endif + diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index c2e2aa4b8..d89e638b2 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -54,7 +54,12 @@ class gr_block : public gr_basic_block { void set_detail (gr_block_detail_sptr detail) { d_detail = detail; } }; +#ifdef SWIGPYTHON %pythoncode %{ gr_block_sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) gr_block_sptr.block = lambda self: self %} +#endif + +#ifdef SWIGGUILE +#endif diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i index 9ca92b6ec..64aea602a 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i @@ -97,9 +97,14 @@ public: } %} +#ifdef SWIGPYTHON // smash in new python delete_head and insert_tail methods... %pythoncode %{ gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail %} +#endif + +#ifdef SWIGGUILE +#endif diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index 78e838012..e25afbdb5 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -30,10 +30,15 @@ typedef boost::shared_ptr NAME ## _sptr; %template(NAME ## _sptr) boost::shared_ptr; %rename(BASE_NAME) PKG ## _make_ ## BASE_NAME; +#ifdef SWIGPYTHON %pythoncode %{ NAME ## _sptr.block = lambda self: NAME ## _block (self) NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} +#endif %ignore NAME; %enddef + +#ifdef SWIGGUILE +#endif -- cgit From 422d912f685b412bdfd91f088628da6f5f8196ba Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 16 Oct 2010 08:53:40 -0600 Subject: wrap pyrun python code in SWIGPYTHON ifdef so it doesn't appear in other languages --- gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i index 5e9032449..2378a1880 100644 --- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i +++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i @@ -42,6 +42,7 @@ class gr_single_threaded_scheduler { gr_single_threaded_scheduler (const std::vector &modules); }; +#ifdef SWIGPYTHON %inline %{ void sts_pyrun (gr_single_threaded_scheduler_sptr s) { Py_BEGIN_ALLOW_THREADS; // release global interpreter lock @@ -49,3 +50,5 @@ class gr_single_threaded_scheduler { Py_END_ALLOW_THREADS; // acquire global interpreter lock } %} +#endif + -- cgit From b72fd746010bc724acfb6a7c5ae2be82e6b828c2 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 16 Oct 2010 08:54:32 -0600 Subject: include complex too for std::complex --- gnuradio-core/src/lib/swig/gnuradio.i | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 7d0241f1c..ec0264107 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -32,6 +32,7 @@ #include "gnuradio_swig_bug_workaround.h" // mandatory bug fix #include #include // size_t +#include %} %feature("autodoc","1"); @@ -57,6 +58,7 @@ namespace std { %template() vector; %template() vector; %template() vector; + // %template() std::complex; %template() vector< std::complex >; %template() vector< std::vector< unsigned char > >; -- cgit From 54bfe42875fc8625b193b63dc8a4d7327e89edc2 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 16 Oct 2010 09:47:39 -0600 Subject: add #warning for missing guile support --- gnuradio-core/src/lib/runtime/gr_basic_block.i | 1 + gnuradio-core/src/lib/runtime/gr_block.i | 1 + gnuradio-core/src/lib/runtime/gr_msg_queue.i | 3 ++- gnuradio-core/src/lib/runtime/gr_top_block.i | 8 ++++++++ gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i index 847ef3689..f1de9e08a 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.i +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i @@ -54,5 +54,6 @@ gr_basic_block_sptr.__repr__ = lambda self: "" % (self.n #endif #ifdef SWIGGUILE +#warning "gr_basic_block.i: gr_block_sptr needs to be implemented!" #endif diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index d89e638b2..d13c268ca 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -62,4 +62,5 @@ gr_block_sptr.block = lambda self: self #endif #ifdef SWIGGUILE +#warning "gr_block.i: gr_block_sptr needs to be implemented!" #endif diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i index 64aea602a..5b8fea49f 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i @@ -81,6 +81,7 @@ public: * 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 gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) { gr_message_sptr msg; @@ -97,7 +98,6 @@ public: } %} -#ifdef SWIGPYTHON // smash in new python delete_head and insert_tail methods... %pythoncode %{ gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head @@ -107,4 +107,5 @@ gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail #endif #ifdef SWIGGUILE +#warning "gr_msg_queue.i: gr_msg_queue_sptr needs to be implemented!" #endif diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index 670e5b5e5..579ef8f70 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -49,6 +49,8 @@ public: void dump(); }; +#ifdef SWIGPYTHON + %inline %{ void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error) { @@ -64,3 +66,9 @@ void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error) Py_END_ALLOW_THREADS; // acquire global interpreter lock } %} + +#endif + +#ifdef SWIG_GUILE +#warning "gr_top_block.i: top_block_run_unlocked needs to be implemented!" +#endif diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index e25afbdb5..99e01b0ef 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -41,4 +41,5 @@ NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self. %enddef #ifdef SWIGGUILE +#warning "gr_block_sptr needs to be implemented!" #endif -- cgit From d97eacbf2444393d2698b1627ef7e6219ae32a3e Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 16 Oct 2010 09:48:27 -0600 Subject: don't use ensure_py_gil_state for guile --- gnuradio-core/src/lib/general/gr_feval.i | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i index 8594a6fa1..9a1269375 100644 --- a/gnuradio-core/src/lib/general/gr_feval.i +++ b/gnuradio-core/src/lib/general/gr_feval.i @@ -65,8 +65,8 @@ // catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; } //} +#ifdef SWIGPYTHON %{ - // class that ensures we acquire and release the Python GIL class ensure_py_gil_state { @@ -77,6 +77,18 @@ public: }; %} +#endif + +#ifdef SWIGGUILE +// FIXME: this is a bogus stub, just here so things build +class ensure_py_gil_state { +public: + ensure_py_gil_state() { } + ~ensure_py_gil_state() { } +}; + +#warning "class ensure_py_gil_state needs to be implemented!" +#endif /* * These are the real C++ base classes, however we don't want these exposed. -- cgit From 1366ce59314bb24825715a1a041b63081b5181e2 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 12:48:54 -0600 Subject: add the load-extension command for guile --- gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i | 6 ++++++ gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i | 6 ++++++ gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i | 6 ++++++ gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i | 6 ++++++ gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i | 6 ++++++ gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i | 7 +++++++ 6 files changed, 37 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i index 6396a97d0..42e46d444 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i @@ -28,3 +28,9 @@ %include "gnuradio.i" // the common stuff %include "filter.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_filter_guile" "SWIG_init") +%} + #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i index 3ab1b056a..dcf284ab3 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i @@ -28,3 +28,9 @@ %include "gnuradio.i" // the common stuff %include "general.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_general_guile" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i index 95e85cf6b..ee18abc18 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i @@ -28,3 +28,9 @@ %include "gnuradio.i" // the common stuff %include "gengen.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_gengen_guile" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i index a82b5ae41..36ee3c40d 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i @@ -28,3 +28,9 @@ %include "gnuradio.i" // the common stuff %include "hier.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_heir_guile" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i index 9318f5d86..cb8509b10 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i @@ -28,3 +28,9 @@ %include "gnuradio.i" // the common stuff %include "io.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_io_guile" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i index 8f444f9c5..a3ab8d012 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i @@ -30,3 +30,10 @@ %include "gnuradio.i" // the common stuff %include "runtime.i" + + +#if SWIGGUILE +%scheme %{ +(load-extension "_gnuradio_swig_py_runtime_guile" "SWIG_init") +%} +#endif -- cgit From bf1f10e1fefa2b342c1f10ccc8863e800eb1870b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 12:50:21 -0600 Subject: don't stub out ensure_py_gil_state, ifdef it out as it's python specific --- gnuradio-core/src/lib/general/gr_feval.i | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i index 9a1269375..843ca3f2a 100644 --- a/gnuradio-core/src/lib/general/gr_feval.i +++ b/gnuradio-core/src/lib/general/gr_feval.i @@ -80,13 +80,14 @@ public: #endif #ifdef SWIGGUILE +#if 0 // FIXME: this is a bogus stub, just here so things build class ensure_py_gil_state { public: ensure_py_gil_state() { } ~ensure_py_gil_state() { } }; - +#endif #warning "class ensure_py_gil_state needs to be implemented!" #endif @@ -157,7 +158,9 @@ class gr_py_feval_dd : public gr_feval_dd public: double calleval(double x) { +#ifdef PYTHON ensure_py_gil_state _lock; +#endif return eval(x); } }; @@ -167,7 +170,9 @@ class gr_py_feval_cc : public gr_feval_cc public: gr_complex calleval(gr_complex x) { +#ifdef PYTHON ensure_py_gil_state _lock; +#endif return eval(x); } }; @@ -177,7 +182,9 @@ class gr_py_feval_ll : public gr_feval_ll public: long calleval(long x) { +#ifdef PYTHON ensure_py_gil_state _lock; +#endif return eval(x); } }; @@ -187,7 +194,9 @@ class gr_py_feval : public gr_feval public: void calleval() { +#ifdef PYTHON ensure_py_gil_state _lock; +#endif eval(); } }; -- cgit From 2038e0981a95ac2093843cdc8c82e5fa0bdeadfa Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 12:52:26 -0600 Subject: use foreach...subst to make a list of generated files instead of cut & paste for BUILT_SOURCES --- gnuradio-core/src/lib/swig/Makefile.am | 45 ++++++++++++---------------------- 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 391182616..cbb2a80a5 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -20,6 +20,9 @@ # include $(top_srcdir)/Makefile.common +include $(top_srcdir)/Makefile.swig + +BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) if PYTHON AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ @@ -41,16 +44,11 @@ ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -workarounds = gnuradio_swig_py_runtime_python.cc -# if GUILE -# workarounds += gnuradio_swig_py_runtime_guile.cc -# endif -gnuradio_swig_bug_workaround.h : $(workarounds) $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix $(workarounds) $@ +gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime_python.cc $(srcdir)/gen-swig-bug-fix + $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime_python.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - gnuradio_swig_bug_workaround.h +grinclude_HEADERS = gnuradio_swig_bug_workaround.h # ---------------------------------------------------------------- # We've split the previously monstrous gnuradio_swig_python into 6 @@ -86,31 +84,20 @@ gnuradio_swig_py_filter_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_swig_py_io_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_swig_py_hier_la_swig_libadd = $(GNURADIO_CORE_LA) -include $(top_srcdir)/Makefile.swig - # add some of the variables generated inside the Makefile.swig # include the SWIG-generated .h files in the BUILT SOURCES, since they # aren't by default when using Makefile.swig; order doesn't matter. -PYTHON_GEN = \ - gnuradio_swig_py_runtime_python.h \ - gnuradio_swig_py_general_python.h \ - gnuradio_swig_py_gengen_python.h \ - gnuradio_swig_py_filter_python.h \ - gnuradio_swig_py_io_python.h \ - gnuradio_swig_py_hier_python.h \ - $(grinclude_HEADERS) \ - $(swig_built_sources) - -BUILT_GUILE = \ - $(grinclude_HEADERS) \ - $(swig_built_sources) - -BUILT_SOURCES = $(PYTHON_GEN) -# if GUILE -# BUILT_SOURCES += $(BUILT_GUILE) -# endif +PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,_python.h,$(HFILE))) +BUILT_SOURCES += $(PYTHON_GEN) + +endif # end of if python + +if GUILE +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,_guile.h,$(HFILE))) +BUILT_SOURCES += $(GUILE_GEN) +endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -endif # end of if python + -- cgit From c4f8aab885d6a188591cebc9683cc297b60b445c Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 17:26:04 -0600 Subject: add top level guile file --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm new file mode 100644 index 000000000..f57cd1982 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -0,0 +1,31 @@ +;;; +;;; Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc., +;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +;;; + +(set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) + +;;; %load-path() +;;; (list (%site-dir) (%library-dir) (%package-data-dir) "."), + +;; (load "gnuradio/gnuradio_swig_py_filter.scm") +;; (load "gnuradio/gnuradio_swig_py_general.scm") +;; (load "gnuradio/gnuradio_swig_py_gengen.scm") +;; (load "gnuradio/gnuradio_swig_py_heir.scm") +(load "gnuradio/gnuradio_swig_py_io.scm") +(load "gnuradio/gnuradio_swig_py_runtime.scm") -- cgit From 2ecda7ddb8dc062caa2e87fa1a53c09ca483af4c Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 18:15:04 -0600 Subject: load what'll load for now --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm index f57cd1982..687f7f1f5 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -18,14 +18,17 @@ ;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ;;; -(set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) +;; Only use these if load-* fails t find a .scm or .so. If you can't +;; find a .so. try running ldconfig. guile seems to only load modules +;; that are in the ldconfig paths. +;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) +;; (set! %load-path (append %load-path '("/usr/share/gnuradio"))) -;;; %load-path() -;;; (list (%site-dir) (%library-dir) (%package-data-dir) "."), +(load "gnuradio/gnuradio_swig_py_filter.scm") +(load "gnuradio/gnuradio_swig_py_io.scm") +(load "gnuradio/gnuradio_swig_py_runtime.scm") -;; (load "gnuradio/gnuradio_swig_py_filter.scm") +;; FIXME: these don't load for sme reason ;; (load "gnuradio/gnuradio_swig_py_general.scm") ;; (load "gnuradio/gnuradio_swig_py_gengen.scm") ;; (load "gnuradio/gnuradio_swig_py_heir.scm") -(load "gnuradio/gnuradio_swig_py_io.scm") -(load "gnuradio/gnuradio_swig_py_runtime.scm") -- cgit From 0876f100362f6275e9d16bfed0fc389d082f86b9 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 18:15:41 -0600 Subject: install the scm files for guile too --- gnuradio-core/src/lib/swig/Makefile.am | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index cbb2a80a5..73ba23b84 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -41,6 +41,12 @@ swiginclude_HEADERS = \ ourpythondir = $(grpythondir)/gr ourpython_PYTHON = gnuradio_swig_python.py +# This is the top level guile file, which loads all the other scm files +# for gnuradio. This has to be installed top level to be found in the +# default search path. +guiledir = @GUILE_PKDATADIR@ +guile_DATA = gnuradio_swig_guile.scm + # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... @@ -94,10 +100,17 @@ BUILT_SOURCES += $(PYTHON_GEN) endif # end of if python if GUILE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,_guile.h,$(HFILE))) +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.scm,$(HFILE))) BUILT_SOURCES += $(GUILE_GEN) endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) +#gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i +# gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i +# .cc..i: +# @echo "FIXME1: $(BUILT_SOURCES) $<" + +# .scm..i: +# @echo "FIXME2: $(BUILT_SOURCES) $<" -- cgit From 5ea1059c943a8a6dcb67c2a151f27b84b653f549 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 18:15:58 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 558 +++++++++++++++++++-------- 1 file changed, 390 insertions(+), 168 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 42c431204..091cdf82b 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -38,6 +38,16 @@ gnuradio_swig_py_runtime_pylibdir_category ?= $(gnuradio_swig_py_runtime_pythond gnuradio_swig_py_runtime_pythondir = $(pythondir)/$(gnuradio_swig_py_runtime_pythondir_category) gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_runtime_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_runtime +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_runtime_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir) @@ -73,6 +83,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -106,11 +119,11 @@ gnuradio_swig_py_runtime_python_PYTHON = \ $(gnuradio_swig_py_runtime_python) if GUILE -gnuradio_swig_py_runtime_pylib_LTLIBRARIES += _gnuradio_swig_py_runtime_guile.la - +gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = _gnuradio_swig_py_runtime_guile.la _gnuradio_swig_py_runtime_guile_la_SOURCES = \ - gnuradio_swig_py_runtime_guile.cc \ + gnuradio_swig_py_runtime_guile.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) +gnuradio_swig_py_runtime_scm_DATA = gnuradio_swig_py_runtime.scm # Guile can use the same flags as python does _gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_python_la_LIBADD) @@ -121,7 +134,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc gnuradio_swig_py_runtime_guile.cc gnuradio_swig_py_runtime_guile.h: gnuradio_swig_py_runtime.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_runtime.i +gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -178,7 +192,6 @@ gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_r ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -206,32 +219,23 @@ gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_r exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_runtime_guile.h gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime_guile.cc: gnuradio_swig_py_runtime.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_runtime-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - cp $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -299,6 +303,39 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + cp $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + # -*- Makefile -*- # # Copyright 2009 Free Software Foundation, Inc. @@ -339,6 +376,16 @@ gnuradio_swig_py_general_pylibdir_category ?= $(gnuradio_swig_py_general_pythond gnuradio_swig_py_general_pythondir = $(pythondir)/$(gnuradio_swig_py_general_pythondir_category) gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_general_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_general +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_general_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_general_swigincludedir = $(swigincludedir) @@ -374,6 +421,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_general.scm gnuradio_swig_py_general_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -407,11 +457,11 @@ gnuradio_swig_py_general_python_PYTHON = \ $(gnuradio_swig_py_general_python) if GUILE -gnuradio_swig_py_general_pylib_LTLIBRARIES += _gnuradio_swig_py_general_guile.la - +gnuradio_swig_py_general_scmlib_LTLIBRARIES = _gnuradio_swig_py_general_guile.la _gnuradio_swig_py_general_guile_la_SOURCES = \ - gnuradio_swig_py_general_guile.cc \ + gnuradio_swig_py_general_guile.cc \ $(gnuradio_swig_py_general_la_swig_sources) +gnuradio_swig_py_general_scm_DATA = gnuradio_swig_py_general.scm # Guile can use the same flags as python does _gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_python_la_LIBADD) @@ -422,7 +472,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc gnuradio_swig_py_general_guile.cc gnuradio_swig_py_general_guile.h: gnuradio_swig_py_general.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_general.i +gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc: gnuradio_swig_py_general.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -479,7 +530,6 @@ gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_g ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -507,32 +557,23 @@ gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_g exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_general_guile.h gnuradio_swig_py_general.scm gnuradio_swig_py_general_guile.cc: gnuradio_swig_py_general.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_general-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_general-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.d - cp $(DEPDIR)/gnuradio_swig_py_general_guile.Std $(DEPDIR)/gnuradio_swig_py_general_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_general_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -600,6 +641,39 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.d + cp $(DEPDIR)/gnuradio_swig_py_general_guile.Std $(DEPDIR)/gnuradio_swig_py_general_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_general_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + # -*- Makefile -*- # # Copyright 2009 Free Software Foundation, Inc. @@ -640,6 +714,16 @@ gnuradio_swig_py_gengen_pylibdir_category ?= $(gnuradio_swig_py_gengen_pythondir gnuradio_swig_py_gengen_pythondir = $(pythondir)/$(gnuradio_swig_py_gengen_pythondir_category) gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_gengen_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_gengen +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_gengen_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir) @@ -675,6 +759,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -708,11 +795,11 @@ gnuradio_swig_py_gengen_python_PYTHON = \ $(gnuradio_swig_py_gengen_python) if GUILE -gnuradio_swig_py_gengen_pylib_LTLIBRARIES += _gnuradio_swig_py_gengen_guile.la - +gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = _gnuradio_swig_py_gengen_guile.la _gnuradio_swig_py_gengen_guile_la_SOURCES = \ - gnuradio_swig_py_gengen_guile.cc \ + gnuradio_swig_py_gengen_guile.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) +gnuradio_swig_py_gengen_scm_DATA = gnuradio_swig_py_gengen.scm # Guile can use the same flags as python does _gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_python_la_LIBADD) @@ -723,7 +810,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc gnuradio_swig_py_gengen_guile.cc gnuradio_swig_py_gengen_guile.h: gnuradio_swig_py_gengen.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_gengen.i +gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc: gnuradio_swig_py_gengen.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -780,7 +868,6 @@ gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gen ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -808,32 +895,23 @@ gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gen exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_gengen_guile.h gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen_guile.cc: gnuradio_swig_py_gengen.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_gengen-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - cp $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -901,6 +979,39 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + cp $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + # -*- Makefile -*- # # Copyright 2009 Free Software Foundation, Inc. @@ -941,6 +1052,16 @@ gnuradio_swig_py_filter_pylibdir_category ?= $(gnuradio_swig_py_filter_pythondir gnuradio_swig_py_filter_pythondir = $(pythondir)/$(gnuradio_swig_py_filter_pythondir_category) gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_filter_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_filter +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_filter_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_filter_swigincludedir = $(swigincludedir) @@ -976,6 +1097,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_filter.scm gnuradio_swig_py_filter_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1009,11 +1133,11 @@ gnuradio_swig_py_filter_python_PYTHON = \ $(gnuradio_swig_py_filter_python) if GUILE -gnuradio_swig_py_filter_pylib_LTLIBRARIES += _gnuradio_swig_py_filter_guile.la - +gnuradio_swig_py_filter_scmlib_LTLIBRARIES = _gnuradio_swig_py_filter_guile.la _gnuradio_swig_py_filter_guile_la_SOURCES = \ - gnuradio_swig_py_filter_guile.cc \ + gnuradio_swig_py_filter_guile.cc \ $(gnuradio_swig_py_filter_la_swig_sources) +gnuradio_swig_py_filter_scm_DATA = gnuradio_swig_py_filter.scm # Guile can use the same flags as python does _gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_python_la_LIBADD) @@ -1024,7 +1148,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc gnuradio_swig_py_filter_guile.cc gnuradio_swig_py_filter_guile.h: gnuradio_swig_py_filter.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_filter.i +gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc: gnuradio_swig_py_filter.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1081,7 +1206,6 @@ gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_fil ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -1109,32 +1233,23 @@ gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_fil exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_filter_guile.h gnuradio_swig_py_filter.scm gnuradio_swig_py_filter_guile.cc: gnuradio_swig_py_filter.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_filter-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.d - cp $(DEPDIR)/gnuradio_swig_py_filter_guile.Std $(DEPDIR)/gnuradio_swig_py_filter_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1202,6 +1317,39 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.d + cp $(DEPDIR)/gnuradio_swig_py_filter_guile.Std $(DEPDIR)/gnuradio_swig_py_filter_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + # -*- Makefile -*- # # Copyright 2009 Free Software Foundation, Inc. @@ -1242,6 +1390,16 @@ gnuradio_swig_py_io_pylibdir_category ?= $(gnuradio_swig_py_io_pythondir_categor gnuradio_swig_py_io_pythondir = $(pythondir)/$(gnuradio_swig_py_io_pythondir_category) gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_io_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_io +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_io_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_io_swigincludedir = $(swigincludedir) @@ -1277,6 +1435,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_io.scm gnuradio_swig_py_io_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1310,11 +1471,11 @@ gnuradio_swig_py_io_python_PYTHON = \ $(gnuradio_swig_py_io_python) if GUILE -gnuradio_swig_py_io_pylib_LTLIBRARIES += _gnuradio_swig_py_io_guile.la - +gnuradio_swig_py_io_scmlib_LTLIBRARIES = _gnuradio_swig_py_io_guile.la _gnuradio_swig_py_io_guile_la_SOURCES = \ - gnuradio_swig_py_io_guile.cc \ + gnuradio_swig_py_io_guile.cc \ $(gnuradio_swig_py_io_la_swig_sources) +gnuradio_swig_py_io_scm_DATA = gnuradio_swig_py_io.scm # Guile can use the same flags as python does _gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_python_la_LIBADD) @@ -1325,7 +1486,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc gnuradio_swig_py_io_guile.cc gnuradio_swig_py_io_guile.h: gnuradio_swig_py_io.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_io.i +gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc: gnuradio_swig_py_io.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1382,7 +1544,6 @@ gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.c ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -1410,32 +1571,23 @@ gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.c exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_io_guile.h gnuradio_swig_py_io.scm gnuradio_swig_py_io_guile.cc: gnuradio_swig_py_io.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_io-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_io-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.d - cp $(DEPDIR)/gnuradio_swig_py_io_guile.Std $(DEPDIR)/gnuradio_swig_py_io_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_io_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1503,6 +1655,39 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.d + cp $(DEPDIR)/gnuradio_swig_py_io_guile.Std $(DEPDIR)/gnuradio_swig_py_io_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_io_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + # -*- Makefile -*- # # Copyright 2009 Free Software Foundation, Inc. @@ -1543,6 +1728,16 @@ gnuradio_swig_py_hier_pylibdir_category ?= $(gnuradio_swig_py_hier_pythondir_cat gnuradio_swig_py_hier_pythondir = $(pythondir)/$(gnuradio_swig_py_hier_pythondir_category) gnuradio_swig_py_hier_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_hier_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_hier_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/gnuradio_swig_py_hier +# FIXME: determince whether these should be installed with gnuradio. +gnuradio_swig_py_hier_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. gnuradio_swig_py_hier_swigincludedir = $(swigincludedir) @@ -1578,6 +1773,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc +if GUILE +swig_built_sources += gnuradio_swig_py_hier.scm gnuradio_swig_py_hier_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -1611,11 +1809,11 @@ gnuradio_swig_py_hier_python_PYTHON = \ $(gnuradio_swig_py_hier_python) if GUILE -gnuradio_swig_py_hier_pylib_LTLIBRARIES += _gnuradio_swig_py_hier_guile.la - +gnuradio_swig_py_hier_scmlib_LTLIBRARIES = _gnuradio_swig_py_hier_guile.la _gnuradio_swig_py_hier_guile_la_SOURCES = \ - gnuradio_swig_py_hier_guile.cc \ + gnuradio_swig_py_hier_guile.cc \ $(gnuradio_swig_py_hier_la_swig_sources) +gnuradio_swig_py_hier_scm_DATA = gnuradio_swig_py_hier.scm # Guile can use the same flags as python does _gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_python_la_LIBADD) @@ -1626,7 +1824,8 @@ endif # end of GUILE ## Entry rule for running SWIG -gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc gnuradio_swig_py_hier_guile.cc gnuradio_swig_py_hier_guile.h: gnuradio_swig_py_hier.i +# $(python_deps) $(guile_deps): gnuradio_swig_py_hier.i +gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc: gnuradio_swig_py_hier.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -1683,7 +1882,6 @@ gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_py ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -1711,32 +1909,23 @@ gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_py exit $$?; \ fi; -$(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +gnuradio_swig_py_hier_guile.h gnuradio_swig_py_hier.scm gnuradio_swig_py_hier_guile.cc: gnuradio_swig_py_hier.i if GUILE - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ - fi; \ + trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_hier-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; \ else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.S*; exit 1; \ + while test -d $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.d - cp $(DEPDIR)/gnuradio_swig_py_hier_guile.Std $(DEPDIR)/gnuradio_swig_py_hier_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_guile.d@am__quote@ -endif +endif # end of GUILE $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -1804,3 +1993,36 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_python.d@am__quote@ +if GUILE +$(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ + -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ + > $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.d + cp $(DEPDIR)/gnuradio_swig_py_hier_guile.Std $(DEPDIR)/gnuradio_swig_py_hier_guile.d + echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d + $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp +else + touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i + -- cgit From d3d187f1beb6525977079a6f9c822f971cced8da Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 18:21:09 -0600 Subject: improve comment --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm index 687f7f1f5..c653a04b0 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -18,8 +18,8 @@ ;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ;;; -;; Only use these if load-* fails t find a .scm or .so. If you can't -;; find a .so. try running ldconfig. guile seems to only load modules +;; Only use these if load-* fails to find a .scm or .so. If you can't +;; find a .so, try running ldconfig. guile seems to only load modules ;; that are in the ldconfig paths. ;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) ;; (set! %load-path (append %load-path '("/usr/share/gnuradio"))) @@ -28,7 +28,7 @@ (load "gnuradio/gnuradio_swig_py_io.scm") (load "gnuradio/gnuradio_swig_py_runtime.scm") -;; FIXME: these don't load for sme reason +;; FIXME: these don't load for sme reason cause of issues with the .so files ;; (load "gnuradio/gnuradio_swig_py_general.scm") ;; (load "gnuradio/gnuradio_swig_py_gengen.scm") ;; (load "gnuradio/gnuradio_swig_py_heir.scm") -- cgit From bb04443e9299a2eebf44a6aef5633091b0135f1f Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 18:43:33 -0600 Subject: correct copyright date --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm index c653a04b0..64f6f1415 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -1,5 +1,5 @@ ;;; -;;; Copyright 2006,2009 Free Software Foundation, Inc. +;;; Copyright 2010 Free Software Foundation, Inc. ;;; ;;; This file is part of GNU Radio ;;; -- cgit From f64af4b3b4221bbe9480791b3e863aa05c6aad06 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 18 Oct 2010 19:28:25 -0700 Subject: gitignore swig generated files --- gnuradio-core/src/lib/swig/.gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 9d7d01056..0f7b58d51 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -34,3 +34,15 @@ /gnuradio_swig_py_hier.cc /gnuradio_swig_py_hier.h /gnuradio_swig_py_hier.py +/gnuradio_swig_py_filter_python.cc +/gnuradio_swig_py_filter_python.h +/gnuradio_swig_py_general_python.cc +/gnuradio_swig_py_general_python.h +/gnuradio_swig_py_gengen_python.cc +/gnuradio_swig_py_gengen_python.h +/gnuradio_swig_py_hier_python.cc +/gnuradio_swig_py_hier_python.h +/gnuradio_swig_py_io_python.cc +/gnuradio_swig_py_io_python.h +/gnuradio_swig_py_runtime_python.cc +/gnuradio_swig_py_runtime_python.h -- cgit From 3e5e68383e0b1283ad1a40216ef11e777c245824 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 18 Oct 2010 19:56:02 -0700 Subject: gitignore more swig generated files --- gnuradio-core/src/lib/swig/.gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 0f7b58d51..5c514650d 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -46,3 +46,15 @@ /gnuradio_swig_py_io_python.h /gnuradio_swig_py_runtime_python.cc /gnuradio_swig_py_runtime_python.h +/gnuradio_swig_py_filter.scm +/gnuradio_swig_py_filter_guile.cc +/gnuradio_swig_py_general.scm +/gnuradio_swig_py_general_guile.cc +/gnuradio_swig_py_gengen.scm +/gnuradio_swig_py_gengen_guile.cc +/gnuradio_swig_py_hier.scm +/gnuradio_swig_py_hier_guile.cc +/gnuradio_swig_py_io.scm +/gnuradio_swig_py_io_guile.cc +/gnuradio_swig_py_runtime.scm +/gnuradio_swig_py_runtime_guile.cc -- cgit From 3d55841ec05f1a09eb2de304f9ad30b9ed068986 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 18 Oct 2010 20:14:26 -0700 Subject: Make fft window parameter a const vector ref to ease swigging. --- gnuradio-core/src/lib/general/gr_fft_vcc.i | 4 ++-- gnuradio-core/src/lib/general/gr_fft_vfc.cc | 6 +++--- gnuradio-core/src/lib/general/gr_fft_vfc.h | 10 +++++----- gnuradio-core/src/lib/general/gr_fft_vfc.i | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.i b/gnuradio-core/src/lib/general/gr_fft_vcc.i index 247571374..f35316e70 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.i +++ b/gnuradio-core/src/lib/general/gr_fft_vcc.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2007,2008 Free Software Foundation, Inc. + * Copyright 2004,2007,2008,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,7 +23,7 @@ GR_SWIG_BLOCK_MAGIC(gr, fft_vcc) gr_fft_vcc_sptr -gr_make_fft_vcc (int fft_size, bool forward, const std::vector window, bool shift=false); +gr_make_fft_vcc (int fft_size, bool forward, const std::vector &window, bool shift=false); class gr_fft_vcc : public gr_sync_block { diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.cc b/gnuradio-core/src/lib/general/gr_fft_vfc.cc index 608161efe..561c63740 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.cc +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.cc @@ -40,12 +40,12 @@ gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, const std::vector window) +gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window) { return gnuradio::get_initial_sptr(new gr_fft_vfc (fft_size, forward, window)); } -gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward, const std::vector window) +gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward, const std::vector &window) : gr_sync_block ("fft_vfc", gr_make_io_signature (1, 1, fft_size * sizeof (float)), gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))), @@ -107,7 +107,7 @@ gr_fft_vfc::work (int noutput_items, } bool -gr_fft_vfc::set_window(const std::vector window) +gr_fft_vfc::set_window(const std::vector &window) { if(window.size()==0 || window.size()==d_fft_size) { d_window=window; diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h index 054a383ef..074574477 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.h +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,7 +31,7 @@ class gr_fft_vfc; typedef boost::shared_ptr gr_fft_vfc_sptr; gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, const std::vector); +gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window); /*! * \brief Compute forward FFT. float vector in / complex vector out. @@ -41,13 +41,13 @@ gr_make_fft_vfc (int fft_size, bool forward, const std::vector); class gr_fft_vfc : public gr_sync_block { friend gr_fft_vfc_sptr - gr_make_fft_vfc (int fft_size, bool forward, const std::vector window); + gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window); unsigned int d_fft_size; std::vector d_window; gri_fft_complex *d_fft; - gr_fft_vfc (int fft_size, bool forward, const std::vector window); + gr_fft_vfc (int fft_size, bool forward, const std::vector &window); public: ~gr_fft_vfc (); @@ -55,7 +55,7 @@ class gr_fft_vfc : public gr_sync_block int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - bool set_window(const std::vector window); + bool set_window(const std::vector &window); }; diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.i b/gnuradio-core/src/lib/general/gr_fft_vfc.i index 90c368fe6..f680c4022 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.i +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,13 +23,13 @@ GR_SWIG_BLOCK_MAGIC(gr, fft_vfc) gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, const std::vector window); +gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window); class gr_fft_vfc : public gr_sync_block { protected: - gr_fft_vfc (int fft_size, bool forward, const std::vector window); + gr_fft_vfc (int fft_size, bool forward, const std::vector &window); public: - bool set_window(const std::vector window); + bool set_window(const std::vector &window); }; -- cgit From 221ad7b19e370fab816fbfb8fae3b947f77151fc Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 21:58:28 -0600 Subject: put the ifdef in the right place --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 091cdf82b..f847e7b28 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -303,8 +303,8 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ @@ -641,8 +641,8 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ @@ -979,8 +979,8 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ @@ -1317,8 +1317,8 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ @@ -1655,8 +1655,8 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ @@ -1993,8 +1993,8 @@ $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: @am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_python.d@am__quote@ -if GUILE $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: +if GUILE # the comments for the target above apply to this target as well, but it seemed # silly to include them twice. The only main change is for guile. if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ -- cgit From 31661e655660a77c28cf14fcb5f648ea05505450 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 18 Oct 2010 20:58:22 -0700 Subject: Change const vector to const vector ref to ease swigging. --- gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t | 4 ++-- gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t | 10 +++++----- gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t | 8 ++++---- gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t | 4 ++-- gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t | 10 +++++----- gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t index 2a0a3ba3f..f49be062e 100755 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t @@ -30,12 +30,12 @@ #include @SPTR_NAME@ -gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k) +gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k) { return gnuradio::get_initial_sptr (new @NAME@ (k)); } -@NAME@::@NAME@ (const std::vector<@I_TYPE@> k) +@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k) : gr_sync_block ("@BASE_NAME@", gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()), gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size())) diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t index 33b6fc396..574fc686c 100755 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006 Free Software Foundation, Inc. + * Copyright 2004,2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -30,7 +30,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); +@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); /*! * \brief output vector = input vector + constant vector @@ -38,14 +38,14 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; */ class @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); + friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); std::vector<@I_TYPE@> d_k; // the constant - @NAME@ (const std::vector<@I_TYPE@> k); + @NAME@ (const std::vector<@I_TYPE@> &k); public: const std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> k) { d_k = k; } + void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t index a2e7dd70b..ad1643a7e 100755 --- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t +++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006 Free Software Foundation, Inc. + * Copyright 2004,2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,14 +24,14 @@ GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); +@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); class @NAME@ : public gr_sync_block { private: - @NAME@ (const std::vector<@I_TYPE@> k); + @NAME@ (const std::vector<@I_TYPE@> &k); public: std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> k) { d_k = k; } + void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } }; diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t index 8286453f1..5725c1c46 100755 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t @@ -30,12 +30,12 @@ #include @SPTR_NAME@ -gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k) +gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k) { return gnuradio::get_initial_sptr (new @NAME@ (k)); } -@NAME@::@NAME@ (const std::vector<@I_TYPE@> k) +@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k) : gr_sync_block ("@BASE_NAME@", gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()), gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size())) diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t index 22334505a..81e781895 100755 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006 Free Software Foundation, Inc. + * Copyright 2004,2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -30,7 +30,7 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); +@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); /*! * \brief output vector = input vector * constant vector (element-wise) @@ -38,14 +38,14 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; */ class @NAME@ : public gr_sync_block { - friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); + friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); std::vector<@I_TYPE@> d_k; // the constant - @NAME@ (const std::vector<@I_TYPE@> k); + @NAME@ (const std::vector<@I_TYPE@> &k); public: const std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> k) { d_k = k; } + void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t index a2e7dd70b..ad1643a7e 100755 --- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t +++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006 Free Software Foundation, Inc. + * Copyright 2004,2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,14 +24,14 @@ GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k); +@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k); class @NAME@ : public gr_sync_block { private: - @NAME@ (const std::vector<@I_TYPE@> k); + @NAME@ (const std::vector<@I_TYPE@> &k); public: std::vector<@I_TYPE@> k () const { return d_k; } - void set_k (const std::vector<@I_TYPE@> k) { d_k = k; } + void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; } }; -- cgit From 1812c93c7c282bd4b5ff7bd602f9f88d7f1dd97c Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 18 Oct 2010 22:30:05 -0600 Subject: load the general and gengen files, now that they compile. --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm index 64f6f1415..89c4a0e09 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -29,6 +29,6 @@ (load "gnuradio/gnuradio_swig_py_runtime.scm") ;; FIXME: these don't load for sme reason cause of issues with the .so files -;; (load "gnuradio/gnuradio_swig_py_general.scm") -;; (load "gnuradio/gnuradio_swig_py_gengen.scm") +(load "gnuradio/gnuradio_swig_py_general.scm") +(load "gnuradio/gnuradio_swig_py_gengen.scm") ;; (load "gnuradio/gnuradio_swig_py_heir.scm") -- cgit From 9cc65810f63623a7132656005495dfd3ebbc84ed Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 19 Oct 2010 10:56:04 -0600 Subject: correct which lines are under comment --- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm index 89c4a0e09..d08840071 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm @@ -27,8 +27,8 @@ (load "gnuradio/gnuradio_swig_py_filter.scm") (load "gnuradio/gnuradio_swig_py_io.scm") (load "gnuradio/gnuradio_swig_py_runtime.scm") - -;; FIXME: these don't load for sme reason cause of issues with the .so files (load "gnuradio/gnuradio_swig_py_general.scm") (load "gnuradio/gnuradio_swig_py_gengen.scm") + +;; FIXME: this don't load for some reason cause of issues with the .so files ;; (load "gnuradio/gnuradio_swig_py_heir.scm") -- cgit From 05c1f489753af80453182243475110586eb0b242 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 19 Oct 2010 22:00:55 -0600 Subject: use suffixes to build scm and py files --- gnuradio-core/src/lib/swig/Makefile.am | 37 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 73ba23b84..5f55e63b5 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -22,7 +22,13 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig +# VPATH += python guile + BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) +CLEANFILES = python/gnuradio* +if GUILE +CLEANFILES += guile/gnuradio* +endif if PYTHON AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ @@ -39,19 +45,19 @@ swiginclude_HEADERS = \ # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr -ourpython_PYTHON = gnuradio_swig_python.py +ourpython_PYTHON = gnuradio_swig.py # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the # default search path. guiledir = @GUILE_PKDATADIR@ -guile_DATA = gnuradio_swig_guile.scm +guile_DATA = gnuradio_swig.scm # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime_python.cc $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime_python.cc $@ +gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.py $(srcdir)/gen-swig-bug-fix + $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_swig_py_runtime.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = gnuradio_swig_bug_workaround.h @@ -94,23 +100,30 @@ gnuradio_swig_py_hier_la_swig_libadd = $(GNURADIO_CORE_LA) # include the SWIG-generated .h files in the BUILT SOURCES, since they # aren't by default when using Makefile.swig; order doesn't matter. -PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,_python.h,$(HFILE))) +PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) +#BUILT_SOURCES += $(foreach HFILE,$(PYTHON_GEN), $(subst gnuradio,python/gnuradio,$(HFILE))) BUILT_SOURCES += $(PYTHON_GEN) - endif # end of if python if GUILE GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.scm,$(HFILE))) +# BUILT_SOURCES += $(foreach HFILE,$(GUILE_GEN), $(subst gnuradio,guile/gnuradio,$(HFILE))) BUILT_SOURCES += $(GUILE_GEN) endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -#gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i -# gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i -# .cc..i: -# @echo "FIXME1: $(BUILT_SOURCES) $<" +# Compile a .i to what guile needs +.i.scm: + @test -d "guile" || $(mkinstalldirs) "guile" + $(SWIG) $(STD_SWIG_GUILE_ARGS) $($*_swig_args) \ + -module $* -o guile/$*.cc $< + +# Compile a .i file to what python needs +.i.py: + @test -d "python" || $(mkinstalldirs) "python" + $(SWIG) $(STD_SWIG_PYTHON_ARGS) $($*_swig_args) \ + -MD -MF python/$(DEPDIR)/$*.Std \ + -module $* -o python/$*.cc -oh python/$*.h $< -# .scm..i: -# @echo "FIXME2: $(BUILT_SOURCES) $<" -- cgit From 03418fed87089ce9ea3e354632d5f151a1b33ebd Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 19 Oct 2010 22:02:29 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 1386 +++----------------------- 1 file changed, 114 insertions(+), 1272 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index f847e7b28..77127e462 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -82,9 +82,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc +swig_built_sources += gnuradio_swig_py_runtime.py #gnuradio_swig_py_runtime.cc if GUILE -swig_built_sources += gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime_guile.cc +swig_built_sources += gnuradio_swig_py_runtime.scm #gnuradio_swig_py_runtime.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -96,245 +96,52 @@ gnuradio_swig_py_runtime_swiginclude_HEADERS = \ $(gnuradio_swig_py_runtime_swiginclude_headers) gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_runtime_python.la + _gnuradio_swig_py_runtime.la -_gnuradio_swig_py_runtime_python_la_SOURCES = \ - gnuradio_swig_py_runtime_python.cc \ +_gnuradio_swig_py_runtime_la_SOURCES = \ + python/gnuradio_swig_py_runtime.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) -_gnuradio_swig_py_runtime_python_la_LIBADD = \ +_gnuradio_swig_py_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_runtime_la_swig_libadd) -_gnuradio_swig_py_runtime_python_la_LDFLAGS = \ +_gnuradio_swig_py_runtime_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_runtime_la_swig_ldflags) -_gnuradio_swig_py_runtime_python_la_CXXFLAGS = \ +_gnuradio_swig_py_runtime_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_runtime_la_swig_cxxflags) gnuradio_swig_py_runtime_python_PYTHON = \ - gnuradio_swig_py_runtime.py \ - $(gnuradio_swig_py_runtime_python) + python/gnuradio_swig_py_runtime.py \ + $(gnuradio_swig_py_runtime) if GUILE -gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = _gnuradio_swig_py_runtime_guile.la -_gnuradio_swig_py_runtime_guile_la_SOURCES = \ - gnuradio_swig_py_runtime_guile.cc \ +gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = gnuradio_swig_py_runtime_guile.la +gnuradio_swig_py_runtime_guile_la_SOURCES = \ + guile/gnuradio_swig_py_runtime.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) gnuradio_swig_py_runtime_scm_DATA = gnuradio_swig_py_runtime.scm # Guile can use the same flags as python does -_gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_python_la_LIBADD) -_gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_python_la_LDFLAGS) -_gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_python_la_CXXFLAGS) +gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_la_LIBADD) +gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLAGS) +gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_runtime.i -gnuradio_swig_py_runtime_python.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime_python.cc: gnuradio_swig_py_runtime.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_runtime-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_runtime-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_runtime_guile.h gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime_guile.cc: gnuradio_swig_py_runtime.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_runtime-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc: gnuradio_swig_py_runtime.i +guile/gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i +python/gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_python.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_python.Sd $(DEPDIR)/gnuradio_swig_py_runtime_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_runtime_python.Std $(DEPDIR)/gnuradio_swig_py_runtime_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_runtime_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ - -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Sd $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - cp $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_runtime_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i # -*- Makefile -*- # @@ -420,9 +227,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc +swig_built_sources += gnuradio_swig_py_general.py #gnuradio_swig_py_general.cc if GUILE -swig_built_sources += gnuradio_swig_py_general.scm gnuradio_swig_py_general_guile.cc +swig_built_sources += gnuradio_swig_py_general.scm #gnuradio_swig_py_general.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -434,245 +241,52 @@ gnuradio_swig_py_general_swiginclude_HEADERS = \ $(gnuradio_swig_py_general_swiginclude_headers) gnuradio_swig_py_general_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_general_python.la + _gnuradio_swig_py_general.la -_gnuradio_swig_py_general_python_la_SOURCES = \ - gnuradio_swig_py_general_python.cc \ +_gnuradio_swig_py_general_la_SOURCES = \ + python/gnuradio_swig_py_general.cc \ $(gnuradio_swig_py_general_la_swig_sources) -_gnuradio_swig_py_general_python_la_LIBADD = \ +_gnuradio_swig_py_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_general_la_swig_libadd) -_gnuradio_swig_py_general_python_la_LDFLAGS = \ +_gnuradio_swig_py_general_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_general_la_swig_ldflags) -_gnuradio_swig_py_general_python_la_CXXFLAGS = \ +_gnuradio_swig_py_general_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_general_la_swig_cxxflags) gnuradio_swig_py_general_python_PYTHON = \ - gnuradio_swig_py_general.py \ - $(gnuradio_swig_py_general_python) + python/gnuradio_swig_py_general.py \ + $(gnuradio_swig_py_general) if GUILE -gnuradio_swig_py_general_scmlib_LTLIBRARIES = _gnuradio_swig_py_general_guile.la -_gnuradio_swig_py_general_guile_la_SOURCES = \ - gnuradio_swig_py_general_guile.cc \ +gnuradio_swig_py_general_scmlib_LTLIBRARIES = gnuradio_swig_py_general_guile.la +gnuradio_swig_py_general_guile_la_SOURCES = \ + guile/gnuradio_swig_py_general.cc \ $(gnuradio_swig_py_general_la_swig_sources) gnuradio_swig_py_general_scm_DATA = gnuradio_swig_py_general.scm # Guile can use the same flags as python does -_gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_python_la_LIBADD) -_gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_python_la_LDFLAGS) -_gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_python_la_CXXFLAGS) +gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_la_LIBADD) +gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLAGS) +gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_general.i -gnuradio_swig_py_general_python.h gnuradio_swig_py_general.py gnuradio_swig_py_general_python.cc: gnuradio_swig_py_general.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_general-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_general-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_general-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_general_guile.h gnuradio_swig_py_general.scm gnuradio_swig_py_general_guile.cc: gnuradio_swig_py_general.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_general-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_general-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general.cc: gnuradio_swig_py_general.i +guile/gnuradio_swig_py_general.scm gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i +python/gnuradio_swig_py_general.py gnuradio_swig_py_general.py: gnuradio_swig_py_general.i $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_general_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_general_python.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_general_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_general_python.Sd $(DEPDIR)/gnuradio_swig_py_general_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_general_python.Std $(DEPDIR)/gnuradio_swig_py_general_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_general_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_general_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_general_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ - -module gnuradio_swig_py_general -o gnuradio_swig_py_general_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_general_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_general_guile.Sd $(DEPDIR)/gnuradio_swig_py_general_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.d - cp $(DEPDIR)/gnuradio_swig_py_general_guile.Std $(DEPDIR)/gnuradio_swig_py_general_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_general_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_general_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i # -*- Makefile -*- # @@ -758,9 +372,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc +swig_built_sources += gnuradio_swig_py_gengen.py #gnuradio_swig_py_gengen.cc if GUILE -swig_built_sources += gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen_guile.cc +swig_built_sources += gnuradio_swig_py_gengen.scm #gnuradio_swig_py_gengen.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -772,245 +386,52 @@ gnuradio_swig_py_gengen_swiginclude_HEADERS = \ $(gnuradio_swig_py_gengen_swiginclude_headers) gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_gengen_python.la + _gnuradio_swig_py_gengen.la -_gnuradio_swig_py_gengen_python_la_SOURCES = \ - gnuradio_swig_py_gengen_python.cc \ +_gnuradio_swig_py_gengen_la_SOURCES = \ + python/gnuradio_swig_py_gengen.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) -_gnuradio_swig_py_gengen_python_la_LIBADD = \ +_gnuradio_swig_py_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_gengen_la_swig_libadd) -_gnuradio_swig_py_gengen_python_la_LDFLAGS = \ +_gnuradio_swig_py_gengen_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_gengen_la_swig_ldflags) -_gnuradio_swig_py_gengen_python_la_CXXFLAGS = \ +_gnuradio_swig_py_gengen_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_gengen_la_swig_cxxflags) gnuradio_swig_py_gengen_python_PYTHON = \ - gnuradio_swig_py_gengen.py \ - $(gnuradio_swig_py_gengen_python) + python/gnuradio_swig_py_gengen.py \ + $(gnuradio_swig_py_gengen) if GUILE -gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = _gnuradio_swig_py_gengen_guile.la -_gnuradio_swig_py_gengen_guile_la_SOURCES = \ - gnuradio_swig_py_gengen_guile.cc \ +gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = gnuradio_swig_py_gengen_guile.la +gnuradio_swig_py_gengen_guile_la_SOURCES = \ + guile/gnuradio_swig_py_gengen.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) gnuradio_swig_py_gengen_scm_DATA = gnuradio_swig_py_gengen.scm # Guile can use the same flags as python does -_gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_python_la_LIBADD) -_gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_python_la_LDFLAGS) -_gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_python_la_CXXFLAGS) +gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_la_LIBADD) +gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS) +gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_gengen.i -gnuradio_swig_py_gengen_python.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen_python.cc: gnuradio_swig_py_gengen.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_gengen-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_gengen-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_gengen_guile.h gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen_guile.cc: gnuradio_swig_py_gengen.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_gengen-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: gnuradio_swig_py_gengen.i +guile/gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i +python/gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_python.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_python.Sd $(DEPDIR)/gnuradio_swig_py_gengen_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_gengen_python.Std $(DEPDIR)/gnuradio_swig_py_gengen_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_gengen_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ - -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Sd $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - cp $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_gengen_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i # -*- Makefile -*- # @@ -1096,9 +517,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc +swig_built_sources += gnuradio_swig_py_filter.py #gnuradio_swig_py_filter.cc if GUILE -swig_built_sources += gnuradio_swig_py_filter.scm gnuradio_swig_py_filter_guile.cc +swig_built_sources += gnuradio_swig_py_filter.scm #gnuradio_swig_py_filter.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -1110,245 +531,52 @@ gnuradio_swig_py_filter_swiginclude_HEADERS = \ $(gnuradio_swig_py_filter_swiginclude_headers) gnuradio_swig_py_filter_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_filter_python.la + _gnuradio_swig_py_filter.la -_gnuradio_swig_py_filter_python_la_SOURCES = \ - gnuradio_swig_py_filter_python.cc \ +_gnuradio_swig_py_filter_la_SOURCES = \ + python/gnuradio_swig_py_filter.cc \ $(gnuradio_swig_py_filter_la_swig_sources) -_gnuradio_swig_py_filter_python_la_LIBADD = \ +_gnuradio_swig_py_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_filter_la_swig_libadd) -_gnuradio_swig_py_filter_python_la_LDFLAGS = \ +_gnuradio_swig_py_filter_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_filter_la_swig_ldflags) -_gnuradio_swig_py_filter_python_la_CXXFLAGS = \ +_gnuradio_swig_py_filter_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_filter_la_swig_cxxflags) gnuradio_swig_py_filter_python_PYTHON = \ - gnuradio_swig_py_filter.py \ - $(gnuradio_swig_py_filter_python) + python/gnuradio_swig_py_filter.py \ + $(gnuradio_swig_py_filter) if GUILE -gnuradio_swig_py_filter_scmlib_LTLIBRARIES = _gnuradio_swig_py_filter_guile.la -_gnuradio_swig_py_filter_guile_la_SOURCES = \ - gnuradio_swig_py_filter_guile.cc \ +gnuradio_swig_py_filter_scmlib_LTLIBRARIES = gnuradio_swig_py_filter_guile.la +gnuradio_swig_py_filter_guile_la_SOURCES = \ + guile/gnuradio_swig_py_filter.cc \ $(gnuradio_swig_py_filter_la_swig_sources) gnuradio_swig_py_filter_scm_DATA = gnuradio_swig_py_filter.scm # Guile can use the same flags as python does -_gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_python_la_LIBADD) -_gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_python_la_LDFLAGS) -_gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_python_la_CXXFLAGS) +gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_la_LIBADD) +gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS) +gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_filter.i -gnuradio_swig_py_filter_python.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter_python.cc: gnuradio_swig_py_filter.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_filter-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_filter-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_filter_guile.h gnuradio_swig_py_filter.scm gnuradio_swig_py_filter_guile.cc: gnuradio_swig_py_filter.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_filter-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: gnuradio_swig_py_filter.i +guile/gnuradio_swig_py_filter.scm gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i +python/gnuradio_swig_py_filter.py gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_filter_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_python.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_filter_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_filter_python.Sd $(DEPDIR)/gnuradio_swig_py_filter_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_filter_python.Std $(DEPDIR)/gnuradio_swig_py_filter_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_filter_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ - -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_filter_guile.Sd $(DEPDIR)/gnuradio_swig_py_filter_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.d - cp $(DEPDIR)/gnuradio_swig_py_filter_guile.Std $(DEPDIR)/gnuradio_swig_py_filter_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_filter_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i # -*- Makefile -*- # @@ -1434,9 +662,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc +swig_built_sources += gnuradio_swig_py_io.py #gnuradio_swig_py_io.cc if GUILE -swig_built_sources += gnuradio_swig_py_io.scm gnuradio_swig_py_io_guile.cc +swig_built_sources += gnuradio_swig_py_io.scm #gnuradio_swig_py_io.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -1448,245 +676,52 @@ gnuradio_swig_py_io_swiginclude_HEADERS = \ $(gnuradio_swig_py_io_swiginclude_headers) gnuradio_swig_py_io_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_io_python.la + _gnuradio_swig_py_io.la -_gnuradio_swig_py_io_python_la_SOURCES = \ - gnuradio_swig_py_io_python.cc \ +_gnuradio_swig_py_io_la_SOURCES = \ + python/gnuradio_swig_py_io.cc \ $(gnuradio_swig_py_io_la_swig_sources) -_gnuradio_swig_py_io_python_la_LIBADD = \ +_gnuradio_swig_py_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_io_la_swig_libadd) -_gnuradio_swig_py_io_python_la_LDFLAGS = \ +_gnuradio_swig_py_io_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_io_la_swig_ldflags) -_gnuradio_swig_py_io_python_la_CXXFLAGS = \ +_gnuradio_swig_py_io_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_io_la_swig_cxxflags) gnuradio_swig_py_io_python_PYTHON = \ - gnuradio_swig_py_io.py \ - $(gnuradio_swig_py_io_python) + python/gnuradio_swig_py_io.py \ + $(gnuradio_swig_py_io) if GUILE -gnuradio_swig_py_io_scmlib_LTLIBRARIES = _gnuradio_swig_py_io_guile.la -_gnuradio_swig_py_io_guile_la_SOURCES = \ - gnuradio_swig_py_io_guile.cc \ +gnuradio_swig_py_io_scmlib_LTLIBRARIES = gnuradio_swig_py_io_guile.la +gnuradio_swig_py_io_guile_la_SOURCES = \ + guile/gnuradio_swig_py_io.cc \ $(gnuradio_swig_py_io_la_swig_sources) gnuradio_swig_py_io_scm_DATA = gnuradio_swig_py_io.scm # Guile can use the same flags as python does -_gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_python_la_LIBADD) -_gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_python_la_LDFLAGS) -_gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_python_la_CXXFLAGS) +gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_la_LIBADD) +gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) +gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_io.i -gnuradio_swig_py_io_python.h gnuradio_swig_py_io.py gnuradio_swig_py_io_python.cc: gnuradio_swig_py_io.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_io-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_io-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_io-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_io_guile.h gnuradio_swig_py_io.scm gnuradio_swig_py_io_guile.cc: gnuradio_swig_py_io.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_io-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_io-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_swig_py_io.i +guile/gnuradio_swig_py_io.scm gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i +python/gnuradio_swig_py_io.py gnuradio_swig_py_io.py: gnuradio_swig_py_io.i $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_io_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_io_python.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_io_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_io_python.Sd $(DEPDIR)/gnuradio_swig_py_io_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_io_python.Std $(DEPDIR)/gnuradio_swig_py_io_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_io_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_io_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_io_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ - -module gnuradio_swig_py_io -o gnuradio_swig_py_io_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_io_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_io_guile.Sd $(DEPDIR)/gnuradio_swig_py_io_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.d - cp $(DEPDIR)/gnuradio_swig_py_io_guile.Std $(DEPDIR)/gnuradio_swig_py_io_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_io_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_io_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i # -*- Makefile -*- # @@ -1772,9 +807,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc +swig_built_sources += gnuradio_swig_py_hier.py #gnuradio_swig_py_hier.cc if GUILE -swig_built_sources += gnuradio_swig_py_hier.scm gnuradio_swig_py_hier_guile.cc +swig_built_sources += gnuradio_swig_py_hier.scm #gnuradio_swig_py_hier.cc endif ## Various SWIG variables. These can be overloaded in the including @@ -1786,243 +821,50 @@ gnuradio_swig_py_hier_swiginclude_HEADERS = \ $(gnuradio_swig_py_hier_swiginclude_headers) gnuradio_swig_py_hier_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_hier_python.la + _gnuradio_swig_py_hier.la -_gnuradio_swig_py_hier_python_la_SOURCES = \ - gnuradio_swig_py_hier_python.cc \ +_gnuradio_swig_py_hier_la_SOURCES = \ + python/gnuradio_swig_py_hier.cc \ $(gnuradio_swig_py_hier_la_swig_sources) -_gnuradio_swig_py_hier_python_la_LIBADD = \ +_gnuradio_swig_py_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_hier_la_swig_libadd) -_gnuradio_swig_py_hier_python_la_LDFLAGS = \ +_gnuradio_swig_py_hier_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_hier_la_swig_ldflags) -_gnuradio_swig_py_hier_python_la_CXXFLAGS = \ +_gnuradio_swig_py_hier_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(gnuradio_swig_py_hier_la_swig_cxxflags) gnuradio_swig_py_hier_python_PYTHON = \ - gnuradio_swig_py_hier.py \ - $(gnuradio_swig_py_hier_python) + python/gnuradio_swig_py_hier.py \ + $(gnuradio_swig_py_hier) if GUILE -gnuradio_swig_py_hier_scmlib_LTLIBRARIES = _gnuradio_swig_py_hier_guile.la -_gnuradio_swig_py_hier_guile_la_SOURCES = \ - gnuradio_swig_py_hier_guile.cc \ +gnuradio_swig_py_hier_scmlib_LTLIBRARIES = gnuradio_swig_py_hier_guile.la +gnuradio_swig_py_hier_guile_la_SOURCES = \ + guile/gnuradio_swig_py_hier.cc \ $(gnuradio_swig_py_hier_la_swig_sources) gnuradio_swig_py_hier_scm_DATA = gnuradio_swig_py_hier.scm # Guile can use the same flags as python does -_gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_python_la_LIBADD) -_gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_python_la_LDFLAGS) -_gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_python_la_CXXFLAGS) +gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_la_LIBADD) +gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) +gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) endif # end of GUILE ## Entry rule for running SWIG # $(python_deps) $(guile_deps): gnuradio_swig_py_hier.i -gnuradio_swig_py_hier_python.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier_python.cc: gnuradio_swig_py_hier.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/gnuradio_swig_py_hier-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_hier-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp; \ - exit $$?; \ - fi; - -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -gnuradio_swig_py_hier_guile.h gnuradio_swig_py_hier.scm gnuradio_swig_py_hier_guile.cc: gnuradio_swig_py_hier.i -if GUILE - trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_hier-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; \ - else \ - while test -d $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp; \ - exit $$?; \ - fi; -endif # end of GUILE +# gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnuradio_swig_py_hier.i +guile/gnuradio_swig_py_hier.scm gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i +python/gnuradio_swig_py_hier.py gnuradio_swig_py_hier.py: gnuradio_swig_py_hier.i $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_hier_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_python.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_python.Std \ - > $(DEPDIR)/gnuradio_swig_py_hier_python.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_hier_python.Sd $(DEPDIR)/gnuradio_swig_py_hier_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/gnuradio_swig_py_hier_python.Std $(DEPDIR)/gnuradio_swig_py_hier_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_python.d@am__quote@ $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: -if GUILE -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(gnuradio_swig_py_hier_swig_args) \ - -MD -MF $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ - -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std \ - > $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd; \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ - $(MV) $(DEPDIR)/gnuradio_swig_py_hier_guile.Sd $(DEPDIR)/gnuradio_swig_py_hier_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.d - cp $(DEPDIR)/gnuradio_swig_py_hier_guile.Std $(DEPDIR)/gnuradio_swig_py_hier_guile.d - echo "" >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier_guile.d - $(RM) $(DEPDIR)/gnuradio_swig_py_hier_guile.Std - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp -else - touch $(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier_guile.d@am__quote@ - -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i -- cgit From 5650ee3c123dcd819542fbba1719e89a09ece399 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 21 Oct 2010 11:32:40 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 174 +++++++++++++++------------ 1 file changed, 96 insertions(+), 78 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 77127e462..54938187a 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -82,9 +82,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_runtime.py #gnuradio_swig_py_runtime.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_runtime.py if GUILE -swig_built_sources += gnuradio_swig_py_runtime.scm #gnuradio_swig_py_runtime.cc +swig_built_sources += gnuradio_swig_py_runtime.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -106,22 +108,25 @@ _gnuradio_swig_py_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_runtime_la_swig_libadd) +# _gnuradio_swig_py_runtime_la_DEPENDENCIES = python/gnuradio_swig_py_runtime.lo + _gnuradio_swig_py_runtime_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_runtime_la_swig_ldflags) _gnuradio_swig_py_runtime_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_runtime_la_swig_cxxflags) gnuradio_swig_py_runtime_python_PYTHON = \ - python/gnuradio_swig_py_runtime.py \ + gnuradio_swig_py_runtime.py \ $(gnuradio_swig_py_runtime) if GUILE gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = gnuradio_swig_py_runtime_guile.la gnuradio_swig_py_runtime_guile_la_SOURCES = \ - guile/gnuradio_swig_py_runtime.cc \ + guile/gnuradio_swig_py_runtime.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) gnuradio_swig_py_runtime_scm_DATA = gnuradio_swig_py_runtime.scm @@ -130,18 +135,16 @@ gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_la_LIBADD gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLAGS) gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.lo +#gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.scm +gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_runtime.i -# gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc: gnuradio_swig_py_runtime.i -guile/gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i -python/gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_runtime-generate-python-stamp: +python/gnuradio_swig_py_runtime.lo: +gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.scm +gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i -$(DEPDIR)/gnuradio_swig_py_runtime-generate-guile-stamp: # -*- Makefile -*- # @@ -227,9 +230,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_general.py #gnuradio_swig_py_general.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_general.py if GUILE -swig_built_sources += gnuradio_swig_py_general.scm #gnuradio_swig_py_general.cc +swig_built_sources += gnuradio_swig_py_general.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -251,22 +256,25 @@ _gnuradio_swig_py_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_general_la_swig_libadd) +# _gnuradio_swig_py_general_la_DEPENDENCIES = python/gnuradio_swig_py_general.lo + _gnuradio_swig_py_general_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_general_la_swig_ldflags) _gnuradio_swig_py_general_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_general_la_swig_cxxflags) gnuradio_swig_py_general_python_PYTHON = \ - python/gnuradio_swig_py_general.py \ + gnuradio_swig_py_general.py \ $(gnuradio_swig_py_general) if GUILE gnuradio_swig_py_general_scmlib_LTLIBRARIES = gnuradio_swig_py_general_guile.la gnuradio_swig_py_general_guile_la_SOURCES = \ - guile/gnuradio_swig_py_general.cc \ + guile/gnuradio_swig_py_general.cc \ $(gnuradio_swig_py_general_la_swig_sources) gnuradio_swig_py_general_scm_DATA = gnuradio_swig_py_general.scm @@ -275,18 +283,16 @@ gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_la_LIBADD gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLAGS) gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_general.lo: gnuradio_swig_py_general.lo +#gnuradio_swig_py_general.lo: gnuradio_swig_py_general.scm +gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_general.i -# gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general.cc: gnuradio_swig_py_general.i -guile/gnuradio_swig_py_general.scm gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i -python/gnuradio_swig_py_general.py gnuradio_swig_py_general.py: gnuradio_swig_py_general.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_general-generate-python-stamp: +python/gnuradio_swig_py_general.lo: +gnuradio_swig_py_general.lo: gnuradio_swig_py_general.py gnuradio_swig_py_general.scm +gnuradio_swig_py_general.py: gnuradio_swig_py_general.i -$(DEPDIR)/gnuradio_swig_py_general-generate-guile-stamp: # -*- Makefile -*- # @@ -372,9 +378,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_gengen.py #gnuradio_swig_py_gengen.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_gengen.py if GUILE -swig_built_sources += gnuradio_swig_py_gengen.scm #gnuradio_swig_py_gengen.cc +swig_built_sources += gnuradio_swig_py_gengen.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -396,22 +404,25 @@ _gnuradio_swig_py_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_gengen_la_swig_libadd) +# _gnuradio_swig_py_gengen_la_DEPENDENCIES = python/gnuradio_swig_py_gengen.lo + _gnuradio_swig_py_gengen_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_gengen_la_swig_ldflags) _gnuradio_swig_py_gengen_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_gengen_la_swig_cxxflags) gnuradio_swig_py_gengen_python_PYTHON = \ - python/gnuradio_swig_py_gengen.py \ + gnuradio_swig_py_gengen.py \ $(gnuradio_swig_py_gengen) if GUILE gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = gnuradio_swig_py_gengen_guile.la gnuradio_swig_py_gengen_guile_la_SOURCES = \ - guile/gnuradio_swig_py_gengen.cc \ + guile/gnuradio_swig_py_gengen.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) gnuradio_swig_py_gengen_scm_DATA = gnuradio_swig_py_gengen.scm @@ -420,18 +431,16 @@ gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_la_LIBADD) gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS) gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.lo +#gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.scm +gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_gengen.i -# gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: gnuradio_swig_py_gengen.i -guile/gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i -python/gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_gengen-generate-python-stamp: +python/gnuradio_swig_py_gengen.lo: +gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.scm +gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i -$(DEPDIR)/gnuradio_swig_py_gengen-generate-guile-stamp: # -*- Makefile -*- # @@ -517,9 +526,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_filter.py #gnuradio_swig_py_filter.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_filter.py if GUILE -swig_built_sources += gnuradio_swig_py_filter.scm #gnuradio_swig_py_filter.cc +swig_built_sources += gnuradio_swig_py_filter.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -541,22 +552,25 @@ _gnuradio_swig_py_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_filter_la_swig_libadd) +# _gnuradio_swig_py_filter_la_DEPENDENCIES = python/gnuradio_swig_py_filter.lo + _gnuradio_swig_py_filter_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_filter_la_swig_ldflags) _gnuradio_swig_py_filter_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_filter_la_swig_cxxflags) gnuradio_swig_py_filter_python_PYTHON = \ - python/gnuradio_swig_py_filter.py \ + gnuradio_swig_py_filter.py \ $(gnuradio_swig_py_filter) if GUILE gnuradio_swig_py_filter_scmlib_LTLIBRARIES = gnuradio_swig_py_filter_guile.la gnuradio_swig_py_filter_guile_la_SOURCES = \ - guile/gnuradio_swig_py_filter.cc \ + guile/gnuradio_swig_py_filter.cc \ $(gnuradio_swig_py_filter_la_swig_sources) gnuradio_swig_py_filter_scm_DATA = gnuradio_swig_py_filter.scm @@ -565,18 +579,16 @@ gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_la_LIBADD) gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS) gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.lo +#gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.scm +gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_filter.i -# gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: gnuradio_swig_py_filter.i -guile/gnuradio_swig_py_filter.scm gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i -python/gnuradio_swig_py_filter.py gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_filter-generate-python-stamp: +python/gnuradio_swig_py_filter.lo: +gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.py gnuradio_swig_py_filter.scm +gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i -$(DEPDIR)/gnuradio_swig_py_filter-generate-guile-stamp: # -*- Makefile -*- # @@ -662,9 +674,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_io.py #gnuradio_swig_py_io.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_io.py if GUILE -swig_built_sources += gnuradio_swig_py_io.scm #gnuradio_swig_py_io.cc +swig_built_sources += gnuradio_swig_py_io.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -686,22 +700,25 @@ _gnuradio_swig_py_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_io_la_swig_libadd) +# _gnuradio_swig_py_io_la_DEPENDENCIES = python/gnuradio_swig_py_io.lo + _gnuradio_swig_py_io_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_io_la_swig_ldflags) _gnuradio_swig_py_io_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_io_la_swig_cxxflags) gnuradio_swig_py_io_python_PYTHON = \ - python/gnuradio_swig_py_io.py \ + gnuradio_swig_py_io.py \ $(gnuradio_swig_py_io) if GUILE gnuradio_swig_py_io_scmlib_LTLIBRARIES = gnuradio_swig_py_io_guile.la gnuradio_swig_py_io_guile_la_SOURCES = \ - guile/gnuradio_swig_py_io.cc \ + guile/gnuradio_swig_py_io.cc \ $(gnuradio_swig_py_io_la_swig_sources) gnuradio_swig_py_io_scm_DATA = gnuradio_swig_py_io.scm @@ -710,18 +727,16 @@ gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_la_LIBADD) gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_io.lo: gnuradio_swig_py_io.lo +#gnuradio_swig_py_io.lo: gnuradio_swig_py_io.scm +gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_io.i -# gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_swig_py_io.i -guile/gnuradio_swig_py_io.scm gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i -python/gnuradio_swig_py_io.py gnuradio_swig_py_io.py: gnuradio_swig_py_io.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_io-generate-python-stamp: +python/gnuradio_swig_py_io.lo: +gnuradio_swig_py_io.lo: gnuradio_swig_py_io.py gnuradio_swig_py_io.scm +gnuradio_swig_py_io.py: gnuradio_swig_py_io.i -$(DEPDIR)/gnuradio_swig_py_io-generate-guile-stamp: # -*- Makefile -*- # @@ -807,9 +822,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += gnuradio_swig_py_hier.py #gnuradio_swig_py_hier.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += gnuradio_swig_py_hier.py if GUILE -swig_built_sources += gnuradio_swig_py_hier.scm #gnuradio_swig_py_hier.cc +swig_built_sources += gnuradio_swig_py_hier.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -831,22 +848,25 @@ _gnuradio_swig_py_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_swig_py_hier_la_swig_libadd) +# _gnuradio_swig_py_hier_la_DEPENDENCIES = python/gnuradio_swig_py_hier.lo + _gnuradio_swig_py_hier_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_swig_py_hier_la_swig_ldflags) _gnuradio_swig_py_hier_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(gnuradio_swig_py_hier_la_swig_cxxflags) gnuradio_swig_py_hier_python_PYTHON = \ - python/gnuradio_swig_py_hier.py \ + gnuradio_swig_py_hier.py \ $(gnuradio_swig_py_hier) if GUILE gnuradio_swig_py_hier_scmlib_LTLIBRARIES = gnuradio_swig_py_hier_guile.la gnuradio_swig_py_hier_guile_la_SOURCES = \ - guile/gnuradio_swig_py_hier.cc \ + guile/gnuradio_swig_py_hier.cc \ $(gnuradio_swig_py_hier_la_swig_sources) gnuradio_swig_py_hier_scm_DATA = gnuradio_swig_py_hier.scm @@ -855,16 +875,14 @@ gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_la_LIBADD) gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) -endif # end of GUILE - -## Entry rule for running SWIG +guile/gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.lo +#gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.scm +gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i -# $(python_deps) $(guile_deps): gnuradio_swig_py_hier.i -# gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnuradio_swig_py_hier.i -guile/gnuradio_swig_py_hier.scm gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i -python/gnuradio_swig_py_hier.py gnuradio_swig_py_hier.py: gnuradio_swig_py_hier.i +endif # end of GUILE -$(DEPDIR)/gnuradio_swig_py_hier-generate-python-stamp: +python/gnuradio_swig_py_hier.lo: +gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.py gnuradio_swig_py_hier.scm +gnuradio_swig_py_hier.py: gnuradio_swig_py_hier.i -$(DEPDIR)/gnuradio_swig_py_hier-generate-guile-stamp: -- cgit From 75aed9281e0f918fe11a3c040e6b46387dd676c5 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 21 Oct 2010 11:33:04 -0600 Subject: add comments --- gnuradio-core/src/lib/swig/Makefile.am | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 5f55e63b5..21bfe6761 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -22,8 +22,6 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -# VPATH += python guile - BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) CLEANFILES = python/gnuradio* if GUILE @@ -114,16 +112,25 @@ endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -# Compile a .i to what guile needs +# Compile a .i to what guile needs. We use -o to set the output file name, +# or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a +# gnuradio_swig_py_*_wrap.cxx in the source directory. + +## SWIG suffixes for automake to know about +SUFFIXES = .i .scm .pyvi + +if GUILE .i.scm: + @echo "Compile .i to .scm" @test -d "guile" || $(mkinstalldirs) "guile" $(SWIG) $(STD_SWIG_GUILE_ARGS) $($*_swig_args) \ -module $* -o guile/$*.cc $< +# -MD -MF guile/$(DEPDIR)/$*.Std +endif # Compile a .i file to what python needs .i.py: + @echo "Compile .i to .py" @test -d "python" || $(mkinstalldirs) "python" $(SWIG) $(STD_SWIG_PYTHON_ARGS) $($*_swig_args) \ - -MD -MF python/$(DEPDIR)/$*.Std \ -module $* -o python/$*.cc -oh python/$*.h $< - -- cgit From cf8f2a00c886b7c6980f7d1e3eac25eb37a12d3a Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 21 Oct 2010 12:13:48 -0600 Subject: move new suffix rules to common Makefile so everything can use them. --- gnuradio-core/src/lib/swig/Makefile.am | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 21bfe6761..5f5a12eb2 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -116,21 +116,3 @@ no_dist_files = $(swig_built_sources) # or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a # gnuradio_swig_py_*_wrap.cxx in the source directory. -## SWIG suffixes for automake to know about -SUFFIXES = .i .scm .pyvi - -if GUILE -.i.scm: - @echo "Compile .i to .scm" - @test -d "guile" || $(mkinstalldirs) "guile" - $(SWIG) $(STD_SWIG_GUILE_ARGS) $($*_swig_args) \ - -module $* -o guile/$*.cc $< -# -MD -MF guile/$(DEPDIR)/$*.Std -endif - -# Compile a .i file to what python needs -.i.py: - @echo "Compile .i to .py" - @test -d "python" || $(mkinstalldirs) "python" - $(SWIG) $(STD_SWIG_PYTHON_ARGS) $($*_swig_args) \ - -module $* -o python/$*.cc -oh python/$*.h $< -- cgit From aa162012cc25cf080ee744a2cb795a6154fcca86 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 21 Oct 2010 13:16:05 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 6 ------ 1 file changed, 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 54938187a..5846134a9 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -136,7 +136,6 @@ gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLA gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) guile/gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.lo -#gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i endif # end of GUILE @@ -284,7 +283,6 @@ gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLA gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) guile/gnuradio_swig_py_general.lo: gnuradio_swig_py_general.lo -#gnuradio_swig_py_general.lo: gnuradio_swig_py_general.scm gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i endif # end of GUILE @@ -432,7 +430,6 @@ gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) guile/gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.lo -#gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i endif # end of GUILE @@ -580,7 +577,6 @@ gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) guile/gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.lo -#gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.scm gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i endif # end of GUILE @@ -728,7 +724,6 @@ gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) guile/gnuradio_swig_py_io.lo: gnuradio_swig_py_io.lo -#gnuradio_swig_py_io.lo: gnuradio_swig_py_io.scm gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i endif # end of GUILE @@ -876,7 +871,6 @@ gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) guile/gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.lo -#gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.scm gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i endif # end of GUILE -- cgit From cba092c9daa285236cc2b5c4f61898f15ef0a589 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 21 Oct 2010 16:14:58 -0600 Subject: correct typo in script name --- gnuradio-core/src/lib/swig/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 5f5a12eb2..83d733f3e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -43,7 +43,7 @@ swiginclude_HEADERS = \ # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr -ourpython_PYTHON = gnuradio_swig.py +ourpython_PYTHON = gnuradio_swig_python.py # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the -- cgit From 827f95ce49fadfaeec1ee09185d1502074eb0bbb Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 13:56:05 -0700 Subject: Add stub for gnuradio_swig.scm to get make to work --- gnuradio-core/src/lib/swig/gnuradio_swig.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig.scm b/gnuradio-core/src/lib/swig/gnuradio_swig.scm new file mode 100644 index 000000000..961564d68 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_swig.scm @@ -0,0 +1,13 @@ +;;; +;;; Not sure that we need this for guile or not. +;;; We'll need to assemble the (gnuradio gr) module somewhere... +;;; + +;; # This file implements the old gnuradio_swig_python namespace +;; +;; from gnuradio_swig_py_runtime import * +;; from gnuradio_swig_py_general import * +;; from gnuradio_swig_py_gengen import * +;; from gnuradio_swig_py_filter import * +;; from gnuradio_swig_py_io import * +;; from gnuradio_swig_py_hier import * -- cgit From e3ea18ee8732f17151bb00896f982f7859c0e228 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 14:01:49 -0700 Subject: Move TOP_SWIG_IFILES outside of if PYTHON --- gnuradio-core/src/lib/swig/Makefile.am | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 83d733f3e..4c15b7e61 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -28,6 +28,22 @@ if GUILE CLEANFILES += guile/gnuradio* endif +# ---------------------------------------------------------------- +# We've split the previously monstrous gnuradio_swig_python into 6 +# smaller pieces. This reduces compile time coupling and creates +# smaller pieces for the compiler to digest. prior to this change, on +# X86_64, g++'s resident set size was 650MB! +# ---------------------------------------------------------------- + +TOP_SWIG_IFILES = \ + gnuradio_swig_py_runtime.i \ + gnuradio_swig_py_general.i \ + gnuradio_swig_py_gengen.i \ + gnuradio_swig_py_filter.i \ + gnuradio_swig_py_io.i \ + gnuradio_swig_py_hier.i + + if PYTHON AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) @@ -60,21 +76,6 @@ gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.py $(srcdir)/gen-swig- # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = gnuradio_swig_bug_workaround.h -# ---------------------------------------------------------------- -# We've split the previously monstrous gnuradio_swig_python into 6 -# smaller pieces. This reduces compile time coupling and creates -# smaller pieces for the compiler to digest. prior to this change, on -# X86_64, g++'s resident set size was 650MB! -# ---------------------------------------------------------------- - -TOP_SWIG_IFILES = \ - gnuradio_swig_py_runtime.i \ - gnuradio_swig_py_general.i \ - gnuradio_swig_py_gengen.i \ - gnuradio_swig_py_filter.i \ - gnuradio_swig_py_io.i \ - gnuradio_swig_py_hier.i - # Install so that they end up available as: # import gnuradio.gr # This ends up at: -- cgit From b61a156d4d3125882bfa3563ebd4a992ba00a6f7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 15:14:44 -0700 Subject: Move common stuff outside of if PYTHON --- gnuradio-core/src/lib/swig/Makefile.am | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 4c15b7e61..f96352d1a 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -44,28 +44,32 @@ TOP_SWIG_IFILES = \ gnuradio_swig_py_hier.i -if PYTHON -AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ - $(WITH_INCLUDES) - -EXTRA_DIST = gen-swig-bug-fix - # SWIG headers get installed in ${prefix}/include/gnuradio/swig swiginclude_HEADERS = \ gnuradio.i \ gr_swig_block_magic.i \ gr_shared_ptr.i -# special install for this top-level Python script which includes all -# of the split Python libraries. -ourpythondir = $(grpythondir)/gr -ourpython_PYTHON = gnuradio_swig_python.py +if GUILE # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the # default search path. guiledir = @GUILE_PKDATADIR@ guile_DATA = gnuradio_swig.scm +endif + + +if PYTHON +AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ + $(WITH_INCLUDES) + +EXTRA_DIST = gen-swig-bug-fix + +# special install for this top-level Python script which includes all +# of the split Python libraries. +ourpythondir = $(grpythondir)/gr +ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -- cgit From 00ba420478fb0e328fa93e795ea0c80e7de63534 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 15:14:57 -0700 Subject: Move #ifdef SWIGPYTHON outside of %define There's apparently a time-of-evaluation issue here. The docs say they reevaluate the contents of %define at expansion time. Apparently SWIGPYTHON et al. aren't defined in whatever scope that may be. --- gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index 99e01b0ef..e2ddaeedd 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -24,22 +24,27 @@ _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, PKG ## _ ## BASE_NAME, BASE_NAME) %enddef -%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) +%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) class NAME; typedef boost::shared_ptr NAME ## _sptr; %template(NAME ## _sptr) boost::shared_ptr; %rename(BASE_NAME) PKG ## _make_ ## BASE_NAME; +%ignore NAME; +%enddef #ifdef SWIGPYTHON +%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) +_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) %pythoncode %{ NAME ## _sptr.block = lambda self: NAME ## _block (self) NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} -#endif - -%ignore NAME; %enddef +#endif #ifdef SWIGGUILE +%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) +_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) #warning "gr_block_sptr needs to be implemented!" +%enddef #endif -- cgit From 0b80f3a41fa4ef358d0294f4b9fcae411611ec12 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 15:16:46 -0700 Subject: Remove dead and broken code from GR_SWIG_BLOCK_MAGIC. Looks like this hasn't been used since we converted the hier_block stuff to C++, and it's been broken since then. --- gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 1 - 1 file changed, 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index e2ddaeedd..7adccf28a 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -36,7 +36,6 @@ typedef boost::shared_ptr NAME ## _sptr; %define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) %pythoncode %{ -NAME ## _sptr.block = lambda self: NAME ## _block (self) NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} %enddef -- cgit From 1b95d66c179048b086ee8aa6a75a23d1edc006dc Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 21:56:51 -0700 Subject: Set new install locations for guile scm code and libraries. I think we may want to rename the guile .so's and install them into libdir instead... --- gnuradio-core/src/lib/swig/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index f96352d1a..67d188957 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -55,8 +55,7 @@ if GUILE # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the # default search path. -guiledir = @GUILE_PKDATADIR@ -guile_DATA = gnuradio_swig.scm +grguile_DATA = gnuradio_swig.scm endif -- cgit From 98c246e264092c306c276b639d8c839b83fd64ec Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 21:59:45 -0700 Subject: Remove leading _ from guile library names coded into .i files --- gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i index 42e46d444..cb9eb35a7 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_filter_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_filter_guile" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i index dcf284ab3..05ed69d31 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_general_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_general_guile" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i index ee18abc18..64b9c804d 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_gengen_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_gengen_guile" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i index 36ee3c40d..c3bf32d6a 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_heir_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_heir_guile" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i index cb8509b10..c3ed7c6ba 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_io_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_io_guile" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i index a3ab8d012..f8eff1189 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i @@ -34,6 +34,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "_gnuradio_swig_py_runtime_guile" "SWIG_init") +(load-extension "gnuradio_swig_py_runtime_guile" "SWIG_init") %} #endif -- cgit From 1e34972f4433cbfef3500fc73a285c7c436cfd6b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 22:00:09 -0700 Subject: Rengenerate Makefile.swig.gen's --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 5846134a9..032d13857 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -41,12 +41,12 @@ gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pyli # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_runtime_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_runtime_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_runtime # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_runtime_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_runtime_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -144,6 +144,7 @@ python/gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.scm gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i +-include python/gnuradio_swig_py_runtime.d # -*- Makefile -*- # @@ -188,12 +189,12 @@ gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pyli # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_general_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_general_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_general # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_general_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_general_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -291,6 +292,7 @@ python/gnuradio_swig_py_general.lo: gnuradio_swig_py_general.lo: gnuradio_swig_py_general.py gnuradio_swig_py_general.scm gnuradio_swig_py_general.py: gnuradio_swig_py_general.i +-include python/gnuradio_swig_py_general.d # -*- Makefile -*- # @@ -335,12 +337,12 @@ gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibd # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_gengen_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_gengen_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_gengen # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_gengen_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_gengen_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -438,6 +440,7 @@ python/gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.scm gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i +-include python/gnuradio_swig_py_gengen.d # -*- Makefile -*- # @@ -482,12 +485,12 @@ gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibd # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_filter_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_filter_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_filter # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_filter_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_filter_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -585,6 +588,7 @@ python/gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.py gnuradio_swig_py_filter.scm gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i +-include python/gnuradio_swig_py_filter.d # -*- Makefile -*- # @@ -629,12 +633,12 @@ gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_categ # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_io_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_io_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_io # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_io_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_io_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -732,6 +736,7 @@ python/gnuradio_swig_py_io.lo: gnuradio_swig_py_io.lo: gnuradio_swig_py_io.py gnuradio_swig_py_io.scm gnuradio_swig_py_io.py: gnuradio_swig_py_io.i +-include python/gnuradio_swig_py_io.d # -*- Makefile -*- # @@ -776,12 +781,12 @@ gnuradio_swig_py_hier_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_hier_pylibdir_c # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_hier_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +gnuradio_swig_py_hier_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_hier # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_hier_scmdir = @GUILE_PKDATADIR@/gnuradio +gnuradio_swig_py_hier_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -879,4 +884,5 @@ python/gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.py gnuradio_swig_py_hier.scm gnuradio_swig_py_hier.py: gnuradio_swig_py_hier.i +-include python/gnuradio_swig_py_hier.d -- cgit From 6b5c73eb36bb45fc214616104c0a6c675dbce538 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 22:20:26 -0700 Subject: Remove #warning from gr_swig_block_magic.i --- gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index 7adccf28a..ea6368fd4 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -44,6 +44,6 @@ NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self. #ifdef SWIGGUILE %define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) -#warning "gr_block_sptr needs to be implemented!" +/* FIXME May want to add something here to get a friendlier printed representation */ %enddef #endif -- cgit From fba8a45e81a718280e9364d30d4224d589ff171d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 23:25:21 -0700 Subject: Rename guile libs to libguile-* and install them in $(libdir). This follows the Guile recommendations and should remove the need for adding an additional directory to LD_LIBRARY_PATH. --- gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i index cb9eb35a7..e40af08ca 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_filter_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_filter" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i index 05ed69d31..c4e9c070d 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_general_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_general" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i index 64b9c804d..54e1b0944 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_gengen_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_gengen" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i index c3bf32d6a..61029b120 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_heir_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_heir" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i index c3ed7c6ba..d7d206ef8 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_io_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_io" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i index f8eff1189..088ae4cf8 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i @@ -34,6 +34,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "gnuradio_swig_py_runtime_guile" "SWIG_init") +(load-extension "libguile-gnuradio_swig_py_runtime" "SWIG_init") %} #endif -- cgit From 6421d47062f4bf5abbdf26142616a5965f1edfa0 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 23:28:06 -0700 Subject: regenerate --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 72 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 032d13857..39afc8973 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -41,7 +41,7 @@ gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pyli # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_runtime_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_runtime_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_runtime @@ -124,16 +124,16 @@ gnuradio_swig_py_runtime_python_PYTHON = \ $(gnuradio_swig_py_runtime) if GUILE -gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = gnuradio_swig_py_runtime_guile.la -gnuradio_swig_py_runtime_guile_la_SOURCES = \ +gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_runtime.la +libguile_gnuradio_swig_py_runtime_la_SOURCES = \ guile/gnuradio_swig_py_runtime.cc \ $(gnuradio_swig_py_runtime_la_swig_sources) gnuradio_swig_py_runtime_scm_DATA = gnuradio_swig_py_runtime.scm # Guile can use the same flags as python does -gnuradio_swig_py_runtime_guile_la_LIBADD = $(_gnuradio_swig_py_runtime_la_LIBADD) -gnuradio_swig_py_runtime_guile_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLAGS) -gnuradio_swig_py_runtime_guile_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) +libguile_gnuradio_swig_py_runtime_la_LIBADD = $(_gnuradio_swig_py_runtime_la_LIBADD) +libguile_gnuradio_swig_py_runtime_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLAGS) +libguile_gnuradio_swig_py_runtime_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) guile/gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.lo gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i @@ -189,7 +189,7 @@ gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pyli # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_general_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_general_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_general @@ -272,16 +272,16 @@ gnuradio_swig_py_general_python_PYTHON = \ $(gnuradio_swig_py_general) if GUILE -gnuradio_swig_py_general_scmlib_LTLIBRARIES = gnuradio_swig_py_general_guile.la -gnuradio_swig_py_general_guile_la_SOURCES = \ +gnuradio_swig_py_general_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_general.la +libguile_gnuradio_swig_py_general_la_SOURCES = \ guile/gnuradio_swig_py_general.cc \ $(gnuradio_swig_py_general_la_swig_sources) gnuradio_swig_py_general_scm_DATA = gnuradio_swig_py_general.scm # Guile can use the same flags as python does -gnuradio_swig_py_general_guile_la_LIBADD = $(_gnuradio_swig_py_general_la_LIBADD) -gnuradio_swig_py_general_guile_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLAGS) -gnuradio_swig_py_general_guile_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) +libguile_gnuradio_swig_py_general_la_LIBADD = $(_gnuradio_swig_py_general_la_LIBADD) +libguile_gnuradio_swig_py_general_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLAGS) +libguile_gnuradio_swig_py_general_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) guile/gnuradio_swig_py_general.lo: gnuradio_swig_py_general.lo gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i @@ -337,7 +337,7 @@ gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibd # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_gengen_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_gengen_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_gengen @@ -420,16 +420,16 @@ gnuradio_swig_py_gengen_python_PYTHON = \ $(gnuradio_swig_py_gengen) if GUILE -gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = gnuradio_swig_py_gengen_guile.la -gnuradio_swig_py_gengen_guile_la_SOURCES = \ +gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_gengen.la +libguile_gnuradio_swig_py_gengen_la_SOURCES = \ guile/gnuradio_swig_py_gengen.cc \ $(gnuradio_swig_py_gengen_la_swig_sources) gnuradio_swig_py_gengen_scm_DATA = gnuradio_swig_py_gengen.scm # Guile can use the same flags as python does -gnuradio_swig_py_gengen_guile_la_LIBADD = $(_gnuradio_swig_py_gengen_la_LIBADD) -gnuradio_swig_py_gengen_guile_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS) -gnuradio_swig_py_gengen_guile_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) +libguile_gnuradio_swig_py_gengen_la_LIBADD = $(_gnuradio_swig_py_gengen_la_LIBADD) +libguile_gnuradio_swig_py_gengen_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS) +libguile_gnuradio_swig_py_gengen_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) guile/gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.lo gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i @@ -485,7 +485,7 @@ gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibd # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_filter_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_filter_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_filter @@ -568,16 +568,16 @@ gnuradio_swig_py_filter_python_PYTHON = \ $(gnuradio_swig_py_filter) if GUILE -gnuradio_swig_py_filter_scmlib_LTLIBRARIES = gnuradio_swig_py_filter_guile.la -gnuradio_swig_py_filter_guile_la_SOURCES = \ +gnuradio_swig_py_filter_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_filter.la +libguile_gnuradio_swig_py_filter_la_SOURCES = \ guile/gnuradio_swig_py_filter.cc \ $(gnuradio_swig_py_filter_la_swig_sources) gnuradio_swig_py_filter_scm_DATA = gnuradio_swig_py_filter.scm # Guile can use the same flags as python does -gnuradio_swig_py_filter_guile_la_LIBADD = $(_gnuradio_swig_py_filter_la_LIBADD) -gnuradio_swig_py_filter_guile_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS) -gnuradio_swig_py_filter_guile_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) +libguile_gnuradio_swig_py_filter_la_LIBADD = $(_gnuradio_swig_py_filter_la_LIBADD) +libguile_gnuradio_swig_py_filter_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS) +libguile_gnuradio_swig_py_filter_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) guile/gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.lo gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i @@ -633,7 +633,7 @@ gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_categ # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_io_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_io_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_io @@ -716,16 +716,16 @@ gnuradio_swig_py_io_python_PYTHON = \ $(gnuradio_swig_py_io) if GUILE -gnuradio_swig_py_io_scmlib_LTLIBRARIES = gnuradio_swig_py_io_guile.la -gnuradio_swig_py_io_guile_la_SOURCES = \ +gnuradio_swig_py_io_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_io.la +libguile_gnuradio_swig_py_io_la_SOURCES = \ guile/gnuradio_swig_py_io.cc \ $(gnuradio_swig_py_io_la_swig_sources) gnuradio_swig_py_io_scm_DATA = gnuradio_swig_py_io.scm # Guile can use the same flags as python does -gnuradio_swig_py_io_guile_la_LIBADD = $(_gnuradio_swig_py_io_la_LIBADD) -gnuradio_swig_py_io_guile_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) -gnuradio_swig_py_io_guile_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) +libguile_gnuradio_swig_py_io_la_LIBADD = $(_gnuradio_swig_py_io_la_LIBADD) +libguile_gnuradio_swig_py_io_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) +libguile_gnuradio_swig_py_io_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) guile/gnuradio_swig_py_io.lo: gnuradio_swig_py_io.lo gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i @@ -781,7 +781,7 @@ gnuradio_swig_py_hier_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_hier_pylibdir_c # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_hier_scmlibdir = $(libdir)/guile/gnuradio +gnuradio_swig_py_hier_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_swig_py_hier @@ -864,16 +864,16 @@ gnuradio_swig_py_hier_python_PYTHON = \ $(gnuradio_swig_py_hier) if GUILE -gnuradio_swig_py_hier_scmlib_LTLIBRARIES = gnuradio_swig_py_hier_guile.la -gnuradio_swig_py_hier_guile_la_SOURCES = \ +gnuradio_swig_py_hier_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_hier.la +libguile_gnuradio_swig_py_hier_la_SOURCES = \ guile/gnuradio_swig_py_hier.cc \ $(gnuradio_swig_py_hier_la_swig_sources) gnuradio_swig_py_hier_scm_DATA = gnuradio_swig_py_hier.scm # Guile can use the same flags as python does -gnuradio_swig_py_hier_guile_la_LIBADD = $(_gnuradio_swig_py_hier_la_LIBADD) -gnuradio_swig_py_hier_guile_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) -gnuradio_swig_py_hier_guile_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) +libguile_gnuradio_swig_py_hier_la_LIBADD = $(_gnuradio_swig_py_hier_la_LIBADD) +libguile_gnuradio_swig_py_hier_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) +libguile_gnuradio_swig_py_hier_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) guile/gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.lo gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i -- cgit From c8e09b545e84194867e971163c899ab0992430fb Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 11:02:01 -0700 Subject: s/_swig_py_/_core_/g --- gnuradio-core/src/lib/swig/.gitignore | 94 +++++++++++----------- gnuradio-core/src/lib/swig/Makefile.am | 44 +++++----- gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 36 +++++++++ gnuradio-core/src/lib/swig/gnuradio_core_general.i | 36 +++++++++ gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 36 +++++++++ gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 36 +++++++++ gnuradio-core/src/lib/swig/gnuradio_core_io.i | 36 +++++++++ gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 39 +++++++++ .../src/lib/swig/gnuradio_swig_py_filter.i | 36 --------- .../src/lib/swig/gnuradio_swig_py_general.i | 36 --------- .../src/lib/swig/gnuradio_swig_py_gengen.i | 36 --------- gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i | 36 --------- gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i | 36 --------- .../src/lib/swig/gnuradio_swig_py_runtime.i | 39 --------- gnuradio-core/src/lib/swig/gnuradio_swig_python.py | 14 ++-- 15 files changed, 295 insertions(+), 295 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_filter.i create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_general.i create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_gengen.i create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_hier.i create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_io.i create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core_runtime.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 5c514650d..0018a2a54 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -10,51 +10,51 @@ /swigrun.py /swigrun_wrap.c /Makefile.swigdeps.new -/gnuradio_swig_py_runtime.d -/gnuradio_swig_py_general.d -/gnuradio_swig_py_gengen.d -/gnuradio_swig_py_filter.d -/gnuradio_swig_py_io.d +/gnuradio_core_runtime.d +/gnuradio_core_general.d +/gnuradio_core_gengen.d +/gnuradio_core_filter.d +/gnuradio_core_io.d /gnuradio_swig_bug_workaround.h -/gnuradio_swig_py_runtime.cc -/gnuradio_swig_py_runtime.h -/gnuradio_swig_py_runtime.py -/gnuradio_swig_py_general.cc -/gnuradio_swig_py_general.h -/gnuradio_swig_py_general.py -/gnuradio_swig_py_gengen.cc -/gnuradio_swig_py_gengen.h -/gnuradio_swig_py_gengen.py -/gnuradio_swig_py_filter.cc -/gnuradio_swig_py_filter.h -/gnuradio_swig_py_filter.py -/gnuradio_swig_py_io.cc -/gnuradio_swig_py_io.h -/gnuradio_swig_py_io.py -/gnuradio_swig_py_hier.cc -/gnuradio_swig_py_hier.h -/gnuradio_swig_py_hier.py -/gnuradio_swig_py_filter_python.cc -/gnuradio_swig_py_filter_python.h -/gnuradio_swig_py_general_python.cc -/gnuradio_swig_py_general_python.h -/gnuradio_swig_py_gengen_python.cc -/gnuradio_swig_py_gengen_python.h -/gnuradio_swig_py_hier_python.cc -/gnuradio_swig_py_hier_python.h -/gnuradio_swig_py_io_python.cc -/gnuradio_swig_py_io_python.h -/gnuradio_swig_py_runtime_python.cc -/gnuradio_swig_py_runtime_python.h -/gnuradio_swig_py_filter.scm -/gnuradio_swig_py_filter_guile.cc -/gnuradio_swig_py_general.scm -/gnuradio_swig_py_general_guile.cc -/gnuradio_swig_py_gengen.scm -/gnuradio_swig_py_gengen_guile.cc -/gnuradio_swig_py_hier.scm -/gnuradio_swig_py_hier_guile.cc -/gnuradio_swig_py_io.scm -/gnuradio_swig_py_io_guile.cc -/gnuradio_swig_py_runtime.scm -/gnuradio_swig_py_runtime_guile.cc +/gnuradio_core_runtime.cc +/gnuradio_core_runtime.h +/gnuradio_core_runtime.py +/gnuradio_core_general.cc +/gnuradio_core_general.h +/gnuradio_core_general.py +/gnuradio_core_gengen.cc +/gnuradio_core_gengen.h +/gnuradio_core_gengen.py +/gnuradio_core_filter.cc +/gnuradio_core_filter.h +/gnuradio_core_filter.py +/gnuradio_core_io.cc +/gnuradio_core_io.h +/gnuradio_core_io.py +/gnuradio_core_hier.cc +/gnuradio_core_hier.h +/gnuradio_core_hier.py +/gnuradio_core_filter_python.cc +/gnuradio_core_filter_python.h +/gnuradio_core_general_python.cc +/gnuradio_core_general_python.h +/gnuradio_core_gengen_python.cc +/gnuradio_core_gengen_python.h +/gnuradio_core_hier_python.cc +/gnuradio_core_hier_python.h +/gnuradio_core_io_python.cc +/gnuradio_core_io_python.h +/gnuradio_core_runtime_python.cc +/gnuradio_core_runtime_python.h +/gnuradio_core_filter.scm +/gnuradio_core_filter_guile.cc +/gnuradio_core_general.scm +/gnuradio_core_general_guile.cc +/gnuradio_core_gengen.scm +/gnuradio_core_gengen_guile.cc +/gnuradio_core_hier.scm +/gnuradio_core_hier_guile.cc +/gnuradio_core_io.scm +/gnuradio_core_io_guile.cc +/gnuradio_core_runtime.scm +/gnuradio_core_runtime_guile.cc diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 67d188957..f354efe0b 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -35,13 +35,13 @@ endif # X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- -TOP_SWIG_IFILES = \ - gnuradio_swig_py_runtime.i \ - gnuradio_swig_py_general.i \ - gnuradio_swig_py_gengen.i \ - gnuradio_swig_py_filter.i \ - gnuradio_swig_py_io.i \ - gnuradio_swig_py_hier.i +TOP_SWIG_IFILES = \ + gnuradio_core_runtime.i \ + gnuradio_core_general.i \ + gnuradio_core_gengen.i \ + gnuradio_core_filter.i \ + gnuradio_core_io.i \ + gnuradio_core_hier.i # SWIG headers get installed in ${prefix}/include/gnuradio/swig @@ -73,8 +73,8 @@ ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.py $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_swig_py_runtime.cc $@ +gnuradio_swig_bug_workaround.h : gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix + $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = gnuradio_swig_bug_workaround.h @@ -83,20 +83,20 @@ grinclude_HEADERS = gnuradio_swig_bug_workaround.h # import gnuradio.gr # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/gnuradio/gr -gnuradio_swig_py_runtime_pythondir_category = gnuradio/gr -gnuradio_swig_py_general_pythondir_category = gnuradio/gr -gnuradio_swig_py_gengen_pythondir_category = gnuradio/gr -gnuradio_swig_py_filter_pythondir_category = gnuradio/gr -gnuradio_swig_py_io_pythondir_category = gnuradio/gr -gnuradio_swig_py_hier_pythondir_category = gnuradio/gr +gnuradio_core_runtime_pythondir_category = gnuradio/gr +gnuradio_core_general_pythondir_category = gnuradio/gr +gnuradio_core_gengen_pythondir_category = gnuradio/gr +gnuradio_core_filter_pythondir_category = gnuradio/gr +gnuradio_core_io_pythondir_category = gnuradio/gr +gnuradio_core_hier_pythondir_category = gnuradio/gr # additional libraries for linking with each SWIG-generated library -gnuradio_swig_py_runtime_la_swig_libadd = $(GNURADIO_CORE_LA) -gnuradio_swig_py_general_la_swig_libadd = $(GNURADIO_CORE_LA) -gnuradio_swig_py_gengen_la_swig_libadd = $(GNURADIO_CORE_LA) -gnuradio_swig_py_filter_la_swig_libadd = $(GNURADIO_CORE_LA) -gnuradio_swig_py_io_la_swig_libadd = $(GNURADIO_CORE_LA) -gnuradio_swig_py_hier_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_runtime_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_general_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_gengen_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_filter_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_io_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) # add some of the variables generated inside the Makefile.swig @@ -118,5 +118,5 @@ no_dist_files = $(swig_built_sources) # Compile a .i to what guile needs. We use -o to set the output file name, # or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a -# gnuradio_swig_py_*_wrap.cxx in the source directory. +# gnuradio_core_*_wrap.cxx in the source directory. diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i new file mode 100644 index 000000000..d9751d0f1 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_filter +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +%include "gnuradio.i" // the common stuff + +%include "filter.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_filter" "SWIG_init") +%} + #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i new file mode 100644 index 000000000..07ef90e34 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_general +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +%include "gnuradio.i" // the common stuff + +%include "general.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_general" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i new file mode 100644 index 000000000..ea78d8af6 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_gengen +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +%include "gnuradio.i" // the common stuff + +%include "gengen.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_gengen" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i new file mode 100644 index 000000000..f69b80334 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_hier +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +%include "gnuradio.i" // the common stuff + +%include "hier.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_heir" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i new file mode 100644 index 000000000..82acae747 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_io +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +%include "gnuradio.i" // the common stuff + +%include "io.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_io" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i new file mode 100644 index 000000000..3cc0a053d --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -0,0 +1,39 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009,2010 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. + */ + +#ifndef SWIGIMPORTED +%module(directors="1") gnuradio_swig_py_runtime +#endif + + //%feature("autodoc", "1"); // generate python docstrings + +#define SW_RUNTIME +%include "gnuradio.i" // the common stuff + +%include "runtime.i" + + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio_core_runtime" "SWIG_init") +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i deleted file mode 100644 index e40af08ca..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_filter -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "filter.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_filter" "SWIG_init") -%} - #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i deleted file mode 100644 index c4e9c070d..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_general -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "general.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_general" "SWIG_init") -%} -#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i deleted file mode 100644 index 54e1b0944..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_gengen -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "gengen.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_gengen" "SWIG_init") -%} -#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i deleted file mode 100644 index 61029b120..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_hier -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "hier.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_heir" "SWIG_init") -%} -#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i deleted file mode 100644 index d7d206ef8..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_io -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "io.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_io" "SWIG_init") -%} -#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i deleted file mode 100644 index 088ae4cf8..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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. - */ - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_runtime -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -#define SW_RUNTIME -%include "gnuradio.i" // the common stuff - -%include "runtime.i" - - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio_swig_py_runtime" "SWIG_init") -%} -#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py b/gnuradio-core/src/lib/swig/gnuradio_swig_python.py index 5324b2309..8f9fffd5c 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_python.py @@ -1,5 +1,5 @@ # -# Copyright 2006,2009 Free Software Foundation, Inc. +# Copyright 2006,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,9 +20,9 @@ # This file implements the old gnuradio_swig_python namespace -from gnuradio_swig_py_runtime import * -from gnuradio_swig_py_general import * -from gnuradio_swig_py_gengen import * -from gnuradio_swig_py_filter import * -from gnuradio_swig_py_io import * -from gnuradio_swig_py_hier import * +from gnuradio_core_runtime import * +from gnuradio_core_general import * +from gnuradio_core_gengen import * +from gnuradio_core_filter import * +from gnuradio_core_io import * +from gnuradio_core_hier import * -- cgit From 412a00434139ffa53469545bd878e24eec5bb61d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 11:02:13 -0700 Subject: regenerate --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 552 +++++++++++++-------------- 1 file changed, 276 insertions(+), 276 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 39afc8973..f6e3fa1b1 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_runtime.i +# Makefile.swig.gen for gnuradio_core_runtime.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_runtime ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_runtime ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_runtime_pythondir_category ?= gnuradio/gnuradio_swig_py_runtime -gnuradio_swig_py_runtime_pylibdir_category ?= $(gnuradio_swig_py_runtime_pythondir_category) -gnuradio_swig_py_runtime_pythondir = $(pythondir)/$(gnuradio_swig_py_runtime_pythondir_category) -gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pylibdir_category) +gnuradio_core_runtime_pythondir_category ?= gnuradio/gnuradio_core_runtime +gnuradio_core_runtime_pylibdir_category ?= $(gnuradio_core_runtime_pythondir_category) +gnuradio_core_runtime_pythondir = $(pythondir)/$(gnuradio_core_runtime_pythondir_category) +gnuradio_core_runtime_pylibdir = $(pyexecdir)/$(gnuradio_core_runtime_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_runtime_scmlibdir = $(libdir) +gnuradio_core_runtime_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_runtime +# is installed, usually /usr/share/guile/site/gnuradio_core_runtime # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_runtime_scmdir = $(guiledir)/gnuradio +gnuradio_core_runtime_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir) +gnuradio_core_runtime_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -72,7 +72,7 @@ gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_runtime-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_runtime-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -84,67 +84,67 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_runtime.py +swig_built_sources += gnuradio_core_runtime.py if GUILE -swig_built_sources += gnuradio_swig_py_runtime.scm +swig_built_sources += gnuradio_core_runtime.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_runtime_swiginclude_HEADERS = \ - gnuradio_swig_py_runtime.i \ - $(gnuradio_swig_py_runtime_swiginclude_headers) +gnuradio_core_runtime_swiginclude_HEADERS = \ + gnuradio_core_runtime.i \ + $(gnuradio_core_runtime_swiginclude_headers) -gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_runtime.la +gnuradio_core_runtime_pylib_LTLIBRARIES = \ + _gnuradio_core_runtime.la -_gnuradio_swig_py_runtime_la_SOURCES = \ - python/gnuradio_swig_py_runtime.cc \ - $(gnuradio_swig_py_runtime_la_swig_sources) +_gnuradio_core_runtime_la_SOURCES = \ + python/gnuradio_core_runtime.cc \ + $(gnuradio_core_runtime_la_swig_sources) -_gnuradio_swig_py_runtime_la_LIBADD = \ +_gnuradio_core_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_runtime_la_swig_libadd) + $(gnuradio_core_runtime_la_swig_libadd) -# _gnuradio_swig_py_runtime_la_DEPENDENCIES = python/gnuradio_swig_py_runtime.lo +# _gnuradio_core_runtime_la_DEPENDENCIES = python/gnuradio_core_runtime.lo -_gnuradio_swig_py_runtime_la_LDFLAGS = \ +_gnuradio_core_runtime_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_runtime_la_swig_ldflags) + $(gnuradio_core_runtime_la_swig_ldflags) -_gnuradio_swig_py_runtime_la_CXXFLAGS = \ +_gnuradio_core_runtime_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_runtime_la_swig_cxxflags) + $(gnuradio_core_runtime_la_swig_cxxflags) -gnuradio_swig_py_runtime_python_PYTHON = \ - gnuradio_swig_py_runtime.py \ - $(gnuradio_swig_py_runtime) +gnuradio_core_runtime_python_PYTHON = \ + gnuradio_core_runtime.py \ + $(gnuradio_core_runtime) if GUILE -gnuradio_swig_py_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_runtime.la -libguile_gnuradio_swig_py_runtime_la_SOURCES = \ - guile/gnuradio_swig_py_runtime.cc \ - $(gnuradio_swig_py_runtime_la_swig_sources) -gnuradio_swig_py_runtime_scm_DATA = gnuradio_swig_py_runtime.scm +gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la +libguile_gnuradio_core_runtime_la_SOURCES = \ + guile/gnuradio_core_runtime.cc \ + $(gnuradio_core_runtime_la_swig_sources) +gnuradio_core_runtime_scm_DATA = gnuradio_core_runtime.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_runtime_la_LIBADD = $(_gnuradio_swig_py_runtime_la_LIBADD) -libguile_gnuradio_swig_py_runtime_la_LDFLAGS = $(_gnuradio_swig_py_runtime_la_LDFLAGS) -libguile_gnuradio_swig_py_runtime_la_CXXFLAGS = $(_gnuradio_swig_py_runtime_la_CXXFLAGS) +libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) +libguile_gnuradio_core_runtime_la_LDFLAGS = $(_gnuradio_core_runtime_la_LDFLAGS) +libguile_gnuradio_core_runtime_la_CXXFLAGS = $(_gnuradio_core_runtime_la_CXXFLAGS) -guile/gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.lo -gnuradio_swig_py_runtime.scm: gnuradio_swig_py_runtime.i +guile/gnuradio_core_runtime.lo: gnuradio_core_runtime.lo +gnuradio_core_runtime.scm: gnuradio_core_runtime.i endif # end of GUILE -python/gnuradio_swig_py_runtime.lo: -gnuradio_swig_py_runtime.lo: gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.scm -gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i +python/gnuradio_core_runtime.lo: +gnuradio_core_runtime.lo: gnuradio_core_runtime.py gnuradio_core_runtime.scm +gnuradio_core_runtime.py: gnuradio_core_runtime.i --include python/gnuradio_swig_py_runtime.d +-include python/gnuradio_core_runtime.d # -*- Makefile -*- # @@ -168,37 +168,37 @@ gnuradio_swig_py_runtime.py: gnuradio_swig_py_runtime.i # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_general.i +# Makefile.swig.gen for gnuradio_core_general.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_general ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_general ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_general_pythondir_category ?= gnuradio/gnuradio_swig_py_general -gnuradio_swig_py_general_pylibdir_category ?= $(gnuradio_swig_py_general_pythondir_category) -gnuradio_swig_py_general_pythondir = $(pythondir)/$(gnuradio_swig_py_general_pythondir_category) -gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pylibdir_category) +gnuradio_core_general_pythondir_category ?= gnuradio/gnuradio_core_general +gnuradio_core_general_pylibdir_category ?= $(gnuradio_core_general_pythondir_category) +gnuradio_core_general_pythondir = $(pythondir)/$(gnuradio_core_general_pythondir_category) +gnuradio_core_general_pylibdir = $(pyexecdir)/$(gnuradio_core_general_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_general_scmlibdir = $(libdir) +gnuradio_core_general_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_general +# is installed, usually /usr/share/guile/site/gnuradio_core_general # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_general_scmdir = $(guiledir)/gnuradio +gnuradio_core_general_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_general_swigincludedir = $(swigincludedir) +gnuradio_core_general_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -220,7 +220,7 @@ gnuradio_swig_py_general_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_general-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_general-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -232,67 +232,67 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_general.py +swig_built_sources += gnuradio_core_general.py if GUILE -swig_built_sources += gnuradio_swig_py_general.scm +swig_built_sources += gnuradio_core_general.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_general_swiginclude_HEADERS = \ - gnuradio_swig_py_general.i \ - $(gnuradio_swig_py_general_swiginclude_headers) +gnuradio_core_general_swiginclude_HEADERS = \ + gnuradio_core_general.i \ + $(gnuradio_core_general_swiginclude_headers) -gnuradio_swig_py_general_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_general.la +gnuradio_core_general_pylib_LTLIBRARIES = \ + _gnuradio_core_general.la -_gnuradio_swig_py_general_la_SOURCES = \ - python/gnuradio_swig_py_general.cc \ - $(gnuradio_swig_py_general_la_swig_sources) +_gnuradio_core_general_la_SOURCES = \ + python/gnuradio_core_general.cc \ + $(gnuradio_core_general_la_swig_sources) -_gnuradio_swig_py_general_la_LIBADD = \ +_gnuradio_core_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_general_la_swig_libadd) + $(gnuradio_core_general_la_swig_libadd) -# _gnuradio_swig_py_general_la_DEPENDENCIES = python/gnuradio_swig_py_general.lo +# _gnuradio_core_general_la_DEPENDENCIES = python/gnuradio_core_general.lo -_gnuradio_swig_py_general_la_LDFLAGS = \ +_gnuradio_core_general_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_general_la_swig_ldflags) + $(gnuradio_core_general_la_swig_ldflags) -_gnuradio_swig_py_general_la_CXXFLAGS = \ +_gnuradio_core_general_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_general_la_swig_cxxflags) + $(gnuradio_core_general_la_swig_cxxflags) -gnuradio_swig_py_general_python_PYTHON = \ - gnuradio_swig_py_general.py \ - $(gnuradio_swig_py_general) +gnuradio_core_general_python_PYTHON = \ + gnuradio_core_general.py \ + $(gnuradio_core_general) if GUILE -gnuradio_swig_py_general_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_general.la -libguile_gnuradio_swig_py_general_la_SOURCES = \ - guile/gnuradio_swig_py_general.cc \ - $(gnuradio_swig_py_general_la_swig_sources) -gnuradio_swig_py_general_scm_DATA = gnuradio_swig_py_general.scm +gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la +libguile_gnuradio_core_general_la_SOURCES = \ + guile/gnuradio_core_general.cc \ + $(gnuradio_core_general_la_swig_sources) +gnuradio_core_general_scm_DATA = gnuradio_core_general.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_general_la_LIBADD = $(_gnuradio_swig_py_general_la_LIBADD) -libguile_gnuradio_swig_py_general_la_LDFLAGS = $(_gnuradio_swig_py_general_la_LDFLAGS) -libguile_gnuradio_swig_py_general_la_CXXFLAGS = $(_gnuradio_swig_py_general_la_CXXFLAGS) +libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) +libguile_gnuradio_core_general_la_LDFLAGS = $(_gnuradio_core_general_la_LDFLAGS) +libguile_gnuradio_core_general_la_CXXFLAGS = $(_gnuradio_core_general_la_CXXFLAGS) -guile/gnuradio_swig_py_general.lo: gnuradio_swig_py_general.lo -gnuradio_swig_py_general.scm: gnuradio_swig_py_general.i +guile/gnuradio_core_general.lo: gnuradio_core_general.lo +gnuradio_core_general.scm: gnuradio_core_general.i endif # end of GUILE -python/gnuradio_swig_py_general.lo: -gnuradio_swig_py_general.lo: gnuradio_swig_py_general.py gnuradio_swig_py_general.scm -gnuradio_swig_py_general.py: gnuradio_swig_py_general.i +python/gnuradio_core_general.lo: +gnuradio_core_general.lo: gnuradio_core_general.py gnuradio_core_general.scm +gnuradio_core_general.py: gnuradio_core_general.i --include python/gnuradio_swig_py_general.d +-include python/gnuradio_core_general.d # -*- Makefile -*- # @@ -316,37 +316,37 @@ gnuradio_swig_py_general.py: gnuradio_swig_py_general.i # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_gengen.i +# Makefile.swig.gen for gnuradio_core_gengen.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_gengen ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_gengen ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_gengen_pythondir_category ?= gnuradio/gnuradio_swig_py_gengen -gnuradio_swig_py_gengen_pylibdir_category ?= $(gnuradio_swig_py_gengen_pythondir_category) -gnuradio_swig_py_gengen_pythondir = $(pythondir)/$(gnuradio_swig_py_gengen_pythondir_category) -gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibdir_category) +gnuradio_core_gengen_pythondir_category ?= gnuradio/gnuradio_core_gengen +gnuradio_core_gengen_pylibdir_category ?= $(gnuradio_core_gengen_pythondir_category) +gnuradio_core_gengen_pythondir = $(pythondir)/$(gnuradio_core_gengen_pythondir_category) +gnuradio_core_gengen_pylibdir = $(pyexecdir)/$(gnuradio_core_gengen_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_gengen_scmlibdir = $(libdir) +gnuradio_core_gengen_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_gengen +# is installed, usually /usr/share/guile/site/gnuradio_core_gengen # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_gengen_scmdir = $(guiledir)/gnuradio +gnuradio_core_gengen_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir) +gnuradio_core_gengen_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -368,7 +368,7 @@ gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_gengen-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_gengen-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -380,67 +380,67 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_gengen.py +swig_built_sources += gnuradio_core_gengen.py if GUILE -swig_built_sources += gnuradio_swig_py_gengen.scm +swig_built_sources += gnuradio_core_gengen.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_gengen_swiginclude_HEADERS = \ - gnuradio_swig_py_gengen.i \ - $(gnuradio_swig_py_gengen_swiginclude_headers) +gnuradio_core_gengen_swiginclude_HEADERS = \ + gnuradio_core_gengen.i \ + $(gnuradio_core_gengen_swiginclude_headers) -gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_gengen.la +gnuradio_core_gengen_pylib_LTLIBRARIES = \ + _gnuradio_core_gengen.la -_gnuradio_swig_py_gengen_la_SOURCES = \ - python/gnuradio_swig_py_gengen.cc \ - $(gnuradio_swig_py_gengen_la_swig_sources) +_gnuradio_core_gengen_la_SOURCES = \ + python/gnuradio_core_gengen.cc \ + $(gnuradio_core_gengen_la_swig_sources) -_gnuradio_swig_py_gengen_la_LIBADD = \ +_gnuradio_core_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_gengen_la_swig_libadd) + $(gnuradio_core_gengen_la_swig_libadd) -# _gnuradio_swig_py_gengen_la_DEPENDENCIES = python/gnuradio_swig_py_gengen.lo +# _gnuradio_core_gengen_la_DEPENDENCIES = python/gnuradio_core_gengen.lo -_gnuradio_swig_py_gengen_la_LDFLAGS = \ +_gnuradio_core_gengen_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_gengen_la_swig_ldflags) + $(gnuradio_core_gengen_la_swig_ldflags) -_gnuradio_swig_py_gengen_la_CXXFLAGS = \ +_gnuradio_core_gengen_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_gengen_la_swig_cxxflags) + $(gnuradio_core_gengen_la_swig_cxxflags) -gnuradio_swig_py_gengen_python_PYTHON = \ - gnuradio_swig_py_gengen.py \ - $(gnuradio_swig_py_gengen) +gnuradio_core_gengen_python_PYTHON = \ + gnuradio_core_gengen.py \ + $(gnuradio_core_gengen) if GUILE -gnuradio_swig_py_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_gengen.la -libguile_gnuradio_swig_py_gengen_la_SOURCES = \ - guile/gnuradio_swig_py_gengen.cc \ - $(gnuradio_swig_py_gengen_la_swig_sources) -gnuradio_swig_py_gengen_scm_DATA = gnuradio_swig_py_gengen.scm +gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la +libguile_gnuradio_core_gengen_la_SOURCES = \ + guile/gnuradio_core_gengen.cc \ + $(gnuradio_core_gengen_la_swig_sources) +gnuradio_core_gengen_scm_DATA = gnuradio_core_gengen.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_gengen_la_LIBADD = $(_gnuradio_swig_py_gengen_la_LIBADD) -libguile_gnuradio_swig_py_gengen_la_LDFLAGS = $(_gnuradio_swig_py_gengen_la_LDFLAGS) -libguile_gnuradio_swig_py_gengen_la_CXXFLAGS = $(_gnuradio_swig_py_gengen_la_CXXFLAGS) +libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) +libguile_gnuradio_core_gengen_la_LDFLAGS = $(_gnuradio_core_gengen_la_LDFLAGS) +libguile_gnuradio_core_gengen_la_CXXFLAGS = $(_gnuradio_core_gengen_la_CXXFLAGS) -guile/gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.lo -gnuradio_swig_py_gengen.scm: gnuradio_swig_py_gengen.i +guile/gnuradio_core_gengen.lo: gnuradio_core_gengen.lo +gnuradio_core_gengen.scm: gnuradio_core_gengen.i endif # end of GUILE -python/gnuradio_swig_py_gengen.lo: -gnuradio_swig_py_gengen.lo: gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.scm -gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i +python/gnuradio_core_gengen.lo: +gnuradio_core_gengen.lo: gnuradio_core_gengen.py gnuradio_core_gengen.scm +gnuradio_core_gengen.py: gnuradio_core_gengen.i --include python/gnuradio_swig_py_gengen.d +-include python/gnuradio_core_gengen.d # -*- Makefile -*- # @@ -464,37 +464,37 @@ gnuradio_swig_py_gengen.py: gnuradio_swig_py_gengen.i # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_filter.i +# Makefile.swig.gen for gnuradio_core_filter.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_filter ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_filter ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_filter_pythondir_category ?= gnuradio/gnuradio_swig_py_filter -gnuradio_swig_py_filter_pylibdir_category ?= $(gnuradio_swig_py_filter_pythondir_category) -gnuradio_swig_py_filter_pythondir = $(pythondir)/$(gnuradio_swig_py_filter_pythondir_category) -gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibdir_category) +gnuradio_core_filter_pythondir_category ?= gnuradio/gnuradio_core_filter +gnuradio_core_filter_pylibdir_category ?= $(gnuradio_core_filter_pythondir_category) +gnuradio_core_filter_pythondir = $(pythondir)/$(gnuradio_core_filter_pythondir_category) +gnuradio_core_filter_pylibdir = $(pyexecdir)/$(gnuradio_core_filter_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_filter_scmlibdir = $(libdir) +gnuradio_core_filter_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_filter +# is installed, usually /usr/share/guile/site/gnuradio_core_filter # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_filter_scmdir = $(guiledir)/gnuradio +gnuradio_core_filter_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_filter_swigincludedir = $(swigincludedir) +gnuradio_core_filter_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -516,7 +516,7 @@ gnuradio_swig_py_filter_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_filter-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_filter-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -528,67 +528,67 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_filter.py +swig_built_sources += gnuradio_core_filter.py if GUILE -swig_built_sources += gnuradio_swig_py_filter.scm +swig_built_sources += gnuradio_core_filter.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_filter_swiginclude_HEADERS = \ - gnuradio_swig_py_filter.i \ - $(gnuradio_swig_py_filter_swiginclude_headers) +gnuradio_core_filter_swiginclude_HEADERS = \ + gnuradio_core_filter.i \ + $(gnuradio_core_filter_swiginclude_headers) -gnuradio_swig_py_filter_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_filter.la +gnuradio_core_filter_pylib_LTLIBRARIES = \ + _gnuradio_core_filter.la -_gnuradio_swig_py_filter_la_SOURCES = \ - python/gnuradio_swig_py_filter.cc \ - $(gnuradio_swig_py_filter_la_swig_sources) +_gnuradio_core_filter_la_SOURCES = \ + python/gnuradio_core_filter.cc \ + $(gnuradio_core_filter_la_swig_sources) -_gnuradio_swig_py_filter_la_LIBADD = \ +_gnuradio_core_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_filter_la_swig_libadd) + $(gnuradio_core_filter_la_swig_libadd) -# _gnuradio_swig_py_filter_la_DEPENDENCIES = python/gnuradio_swig_py_filter.lo +# _gnuradio_core_filter_la_DEPENDENCIES = python/gnuradio_core_filter.lo -_gnuradio_swig_py_filter_la_LDFLAGS = \ +_gnuradio_core_filter_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_filter_la_swig_ldflags) + $(gnuradio_core_filter_la_swig_ldflags) -_gnuradio_swig_py_filter_la_CXXFLAGS = \ +_gnuradio_core_filter_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_filter_la_swig_cxxflags) + $(gnuradio_core_filter_la_swig_cxxflags) -gnuradio_swig_py_filter_python_PYTHON = \ - gnuradio_swig_py_filter.py \ - $(gnuradio_swig_py_filter) +gnuradio_core_filter_python_PYTHON = \ + gnuradio_core_filter.py \ + $(gnuradio_core_filter) if GUILE -gnuradio_swig_py_filter_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_filter.la -libguile_gnuradio_swig_py_filter_la_SOURCES = \ - guile/gnuradio_swig_py_filter.cc \ - $(gnuradio_swig_py_filter_la_swig_sources) -gnuradio_swig_py_filter_scm_DATA = gnuradio_swig_py_filter.scm +gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la +libguile_gnuradio_core_filter_la_SOURCES = \ + guile/gnuradio_core_filter.cc \ + $(gnuradio_core_filter_la_swig_sources) +gnuradio_core_filter_scm_DATA = gnuradio_core_filter.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_filter_la_LIBADD = $(_gnuradio_swig_py_filter_la_LIBADD) -libguile_gnuradio_swig_py_filter_la_LDFLAGS = $(_gnuradio_swig_py_filter_la_LDFLAGS) -libguile_gnuradio_swig_py_filter_la_CXXFLAGS = $(_gnuradio_swig_py_filter_la_CXXFLAGS) +libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) +libguile_gnuradio_core_filter_la_LDFLAGS = $(_gnuradio_core_filter_la_LDFLAGS) +libguile_gnuradio_core_filter_la_CXXFLAGS = $(_gnuradio_core_filter_la_CXXFLAGS) -guile/gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.lo -gnuradio_swig_py_filter.scm: gnuradio_swig_py_filter.i +guile/gnuradio_core_filter.lo: gnuradio_core_filter.lo +gnuradio_core_filter.scm: gnuradio_core_filter.i endif # end of GUILE -python/gnuradio_swig_py_filter.lo: -gnuradio_swig_py_filter.lo: gnuradio_swig_py_filter.py gnuradio_swig_py_filter.scm -gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i +python/gnuradio_core_filter.lo: +gnuradio_core_filter.lo: gnuradio_core_filter.py gnuradio_core_filter.scm +gnuradio_core_filter.py: gnuradio_core_filter.i --include python/gnuradio_swig_py_filter.d +-include python/gnuradio_core_filter.d # -*- Makefile -*- # @@ -612,37 +612,37 @@ gnuradio_swig_py_filter.py: gnuradio_swig_py_filter.i # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_io.i +# Makefile.swig.gen for gnuradio_core_io.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_io ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_io ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_io_pythondir_category ?= gnuradio/gnuradio_swig_py_io -gnuradio_swig_py_io_pylibdir_category ?= $(gnuradio_swig_py_io_pythondir_category) -gnuradio_swig_py_io_pythondir = $(pythondir)/$(gnuradio_swig_py_io_pythondir_category) -gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_category) +gnuradio_core_io_pythondir_category ?= gnuradio/gnuradio_core_io +gnuradio_core_io_pylibdir_category ?= $(gnuradio_core_io_pythondir_category) +gnuradio_core_io_pythondir = $(pythondir)/$(gnuradio_core_io_pythondir_category) +gnuradio_core_io_pylibdir = $(pyexecdir)/$(gnuradio_core_io_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_io_scmlibdir = $(libdir) +gnuradio_core_io_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_io +# is installed, usually /usr/share/guile/site/gnuradio_core_io # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_io_scmdir = $(guiledir)/gnuradio +gnuradio_core_io_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_io_swigincludedir = $(swigincludedir) +gnuradio_core_io_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -664,7 +664,7 @@ gnuradio_swig_py_io_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_io-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_io-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -676,67 +676,67 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_io.py +swig_built_sources += gnuradio_core_io.py if GUILE -swig_built_sources += gnuradio_swig_py_io.scm +swig_built_sources += gnuradio_core_io.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_io_swiginclude_HEADERS = \ - gnuradio_swig_py_io.i \ - $(gnuradio_swig_py_io_swiginclude_headers) +gnuradio_core_io_swiginclude_HEADERS = \ + gnuradio_core_io.i \ + $(gnuradio_core_io_swiginclude_headers) -gnuradio_swig_py_io_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_io.la +gnuradio_core_io_pylib_LTLIBRARIES = \ + _gnuradio_core_io.la -_gnuradio_swig_py_io_la_SOURCES = \ - python/gnuradio_swig_py_io.cc \ - $(gnuradio_swig_py_io_la_swig_sources) +_gnuradio_core_io_la_SOURCES = \ + python/gnuradio_core_io.cc \ + $(gnuradio_core_io_la_swig_sources) -_gnuradio_swig_py_io_la_LIBADD = \ +_gnuradio_core_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_io_la_swig_libadd) + $(gnuradio_core_io_la_swig_libadd) -# _gnuradio_swig_py_io_la_DEPENDENCIES = python/gnuradio_swig_py_io.lo +# _gnuradio_core_io_la_DEPENDENCIES = python/gnuradio_core_io.lo -_gnuradio_swig_py_io_la_LDFLAGS = \ +_gnuradio_core_io_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_io_la_swig_ldflags) + $(gnuradio_core_io_la_swig_ldflags) -_gnuradio_swig_py_io_la_CXXFLAGS = \ +_gnuradio_core_io_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_io_la_swig_cxxflags) + $(gnuradio_core_io_la_swig_cxxflags) -gnuradio_swig_py_io_python_PYTHON = \ - gnuradio_swig_py_io.py \ - $(gnuradio_swig_py_io) +gnuradio_core_io_python_PYTHON = \ + gnuradio_core_io.py \ + $(gnuradio_core_io) if GUILE -gnuradio_swig_py_io_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_io.la -libguile_gnuradio_swig_py_io_la_SOURCES = \ - guile/gnuradio_swig_py_io.cc \ - $(gnuradio_swig_py_io_la_swig_sources) -gnuradio_swig_py_io_scm_DATA = gnuradio_swig_py_io.scm +gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la +libguile_gnuradio_core_io_la_SOURCES = \ + guile/gnuradio_core_io.cc \ + $(gnuradio_core_io_la_swig_sources) +gnuradio_core_io_scm_DATA = gnuradio_core_io.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_io_la_LIBADD = $(_gnuradio_swig_py_io_la_LIBADD) -libguile_gnuradio_swig_py_io_la_LDFLAGS = $(_gnuradio_swig_py_io_la_LDFLAGS) -libguile_gnuradio_swig_py_io_la_CXXFLAGS = $(_gnuradio_swig_py_io_la_CXXFLAGS) +libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) +libguile_gnuradio_core_io_la_LDFLAGS = $(_gnuradio_core_io_la_LDFLAGS) +libguile_gnuradio_core_io_la_CXXFLAGS = $(_gnuradio_core_io_la_CXXFLAGS) -guile/gnuradio_swig_py_io.lo: gnuradio_swig_py_io.lo -gnuradio_swig_py_io.scm: gnuradio_swig_py_io.i +guile/gnuradio_core_io.lo: gnuradio_core_io.lo +gnuradio_core_io.scm: gnuradio_core_io.i endif # end of GUILE -python/gnuradio_swig_py_io.lo: -gnuradio_swig_py_io.lo: gnuradio_swig_py_io.py gnuradio_swig_py_io.scm -gnuradio_swig_py_io.py: gnuradio_swig_py_io.i +python/gnuradio_core_io.lo: +gnuradio_core_io.lo: gnuradio_core_io.py gnuradio_core_io.scm +gnuradio_core_io.py: gnuradio_core_io.i --include python/gnuradio_swig_py_io.d +-include python/gnuradio_core_io.d # -*- Makefile -*- # @@ -760,37 +760,37 @@ gnuradio_swig_py_io.py: gnuradio_swig_py_io.i # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for gnuradio_swig_py_hier.i +# Makefile.swig.gen for gnuradio_core_hier.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_hier +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_hier ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_hier +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_hier ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -gnuradio_swig_py_hier_pythondir_category ?= gnuradio/gnuradio_swig_py_hier -gnuradio_swig_py_hier_pylibdir_category ?= $(gnuradio_swig_py_hier_pythondir_category) -gnuradio_swig_py_hier_pythondir = $(pythondir)/$(gnuradio_swig_py_hier_pythondir_category) -gnuradio_swig_py_hier_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_hier_pylibdir_category) +gnuradio_core_hier_pythondir_category ?= gnuradio/gnuradio_core_hier +gnuradio_core_hier_pylibdir_category ?= $(gnuradio_core_hier_pythondir_category) +gnuradio_core_hier_pythondir = $(pythondir)/$(gnuradio_core_hier_pythondir_category) +gnuradio_core_hier_pylibdir = $(pyexecdir)/$(gnuradio_core_hier_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_hier_scmlibdir = $(libdir) +gnuradio_core_hier_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/gnuradio_swig_py_hier +# is installed, usually /usr/share/guile/site/gnuradio_core_hier # FIXME: determince whether these should be installed with gnuradio. -gnuradio_swig_py_hier_scmdir = $(guiledir)/gnuradio +gnuradio_core_hier_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. -gnuradio_swig_py_hier_swigincludedir = $(swigincludedir) +gnuradio_core_hier_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -812,7 +812,7 @@ gnuradio_swig_py_hier_swigincludedir = $(swigincludedir) ## parallel built. These will not be included in a tarball, because ## the SWIG-generated files will be removed from the distribution. -STAMPS += $(DEPDIR)/gnuradio_swig_py_hier-generate-* +STAMPS += $(DEPDIR)/gnuradio_core_hier-generate-* ## Other cleaned files: dependency files generated by SWIG or this Makefile @@ -824,65 +824,65 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_swig_py_hier.py +swig_built_sources += gnuradio_core_hier.py if GUILE -swig_built_sources += gnuradio_swig_py_hier.scm +swig_built_sources += gnuradio_core_hier.scm endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -gnuradio_swig_py_hier_swiginclude_HEADERS = \ - gnuradio_swig_py_hier.i \ - $(gnuradio_swig_py_hier_swiginclude_headers) +gnuradio_core_hier_swiginclude_HEADERS = \ + gnuradio_core_hier.i \ + $(gnuradio_core_hier_swiginclude_headers) -gnuradio_swig_py_hier_pylib_LTLIBRARIES = \ - _gnuradio_swig_py_hier.la +gnuradio_core_hier_pylib_LTLIBRARIES = \ + _gnuradio_core_hier.la -_gnuradio_swig_py_hier_la_SOURCES = \ - python/gnuradio_swig_py_hier.cc \ - $(gnuradio_swig_py_hier_la_swig_sources) +_gnuradio_core_hier_la_SOURCES = \ + python/gnuradio_core_hier.cc \ + $(gnuradio_core_hier_la_swig_sources) -_gnuradio_swig_py_hier_la_LIBADD = \ +_gnuradio_core_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(gnuradio_swig_py_hier_la_swig_libadd) + $(gnuradio_core_hier_la_swig_libadd) -# _gnuradio_swig_py_hier_la_DEPENDENCIES = python/gnuradio_swig_py_hier.lo +# _gnuradio_core_hier_la_DEPENDENCIES = python/gnuradio_core_hier.lo -_gnuradio_swig_py_hier_la_LDFLAGS = \ +_gnuradio_core_hier_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(gnuradio_swig_py_hier_la_swig_ldflags) + $(gnuradio_core_hier_la_swig_ldflags) -_gnuradio_swig_py_hier_la_CXXFLAGS = \ +_gnuradio_core_hier_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(gnuradio_swig_py_hier_la_swig_cxxflags) + $(gnuradio_core_hier_la_swig_cxxflags) -gnuradio_swig_py_hier_python_PYTHON = \ - gnuradio_swig_py_hier.py \ - $(gnuradio_swig_py_hier) +gnuradio_core_hier_python_PYTHON = \ + gnuradio_core_hier.py \ + $(gnuradio_core_hier) if GUILE -gnuradio_swig_py_hier_scmlib_LTLIBRARIES = libguile-gnuradio_swig_py_hier.la -libguile_gnuradio_swig_py_hier_la_SOURCES = \ - guile/gnuradio_swig_py_hier.cc \ - $(gnuradio_swig_py_hier_la_swig_sources) -gnuradio_swig_py_hier_scm_DATA = gnuradio_swig_py_hier.scm +gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la +libguile_gnuradio_core_hier_la_SOURCES = \ + guile/gnuradio_core_hier.cc \ + $(gnuradio_core_hier_la_swig_sources) +gnuradio_core_hier_scm_DATA = gnuradio_core_hier.scm # Guile can use the same flags as python does -libguile_gnuradio_swig_py_hier_la_LIBADD = $(_gnuradio_swig_py_hier_la_LIBADD) -libguile_gnuradio_swig_py_hier_la_LDFLAGS = $(_gnuradio_swig_py_hier_la_LDFLAGS) -libguile_gnuradio_swig_py_hier_la_CXXFLAGS = $(_gnuradio_swig_py_hier_la_CXXFLAGS) +libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) +libguile_gnuradio_core_hier_la_LDFLAGS = $(_gnuradio_core_hier_la_LDFLAGS) +libguile_gnuradio_core_hier_la_CXXFLAGS = $(_gnuradio_core_hier_la_CXXFLAGS) -guile/gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.lo -gnuradio_swig_py_hier.scm: gnuradio_swig_py_hier.i +guile/gnuradio_core_hier.lo: gnuradio_core_hier.lo +gnuradio_core_hier.scm: gnuradio_core_hier.i endif # end of GUILE -python/gnuradio_swig_py_hier.lo: -gnuradio_swig_py_hier.lo: gnuradio_swig_py_hier.py gnuradio_swig_py_hier.scm -gnuradio_swig_py_hier.py: gnuradio_swig_py_hier.i +python/gnuradio_core_hier.lo: +gnuradio_core_hier.lo: gnuradio_core_hier.py gnuradio_core_hier.scm +gnuradio_core_hier.py: gnuradio_core_hier.i --include python/gnuradio_swig_py_hier.d +-include python/gnuradio_core_hier.d -- cgit From 70dd1dc6610135a1967de554189be38af8f3b080 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 11:20:09 -0700 Subject: rename s/gnuradio_swig_python/gnuradio_core/g --- gnuradio-core/src/lib/swig/Makefile.am | 4 ++-- gnuradio-core/src/lib/swig/gnuradio_core.py | 28 ++++++++++++++++++++++ gnuradio-core/src/lib/swig/gnuradio_swig.scm | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_python.py | 28 ---------------------- gnuradio-core/src/python/gnuradio/gr/__init__.py | 4 ++-- .../src/python/gnuradio/gr/hier_block2.py | 2 +- gnuradio-core/src/python/gnuradio/gr/prefs.py | 2 +- gnuradio-core/src/python/gnuradio/gr/scheduler.py | 2 +- gnuradio-core/src/python/gnuradio/gr/top_block.py | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core.py delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_python.py (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index f354efe0b..9e0d2f69e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES += guile/gnuradio* endif # ---------------------------------------------------------------- -# We've split the previously monstrous gnuradio_swig_python into 6 +# We've split the previously monstrous gnuradio_core into 6 # smaller pieces. This reduces compile time coupling and creates # smaller pieces for the compiler to digest. prior to this change, on # X86_64, g++'s resident set size was 650MB! @@ -68,7 +68,7 @@ EXTRA_DIST = gen-swig-bug-fix # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr -ourpython_PYTHON = gnuradio_swig_python.py +ourpython_PYTHON = gnuradio_core.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py new file mode 100644 index 000000000..172051013 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core.py @@ -0,0 +1,28 @@ +# +# Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +# This file implements the old gnuradio_core namespace + +from gnuradio_core_runtime import * +from gnuradio_core_general import * +from gnuradio_core_gengen import * +from gnuradio_core_filter import * +from gnuradio_core_io import * +from gnuradio_core_hier import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig.scm b/gnuradio-core/src/lib/swig/gnuradio_swig.scm index 961564d68..c07d46a64 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_swig.scm +++ b/gnuradio-core/src/lib/swig/gnuradio_swig.scm @@ -3,7 +3,7 @@ ;;; We'll need to assemble the (gnuradio gr) module somewhere... ;;; -;; # This file implements the old gnuradio_swig_python namespace +;; # This file implements the old gnuradio_core namespace ;; ;; from gnuradio_swig_py_runtime import * ;; from gnuradio_swig_py_general import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py b/gnuradio-core/src/lib/swig/gnuradio_swig_python.py deleted file mode 100644 index 8f9fffd5c..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -# This file implements the old gnuradio_swig_python namespace - -from gnuradio_core_runtime import * -from gnuradio_core_general import * -from gnuradio_core_gengen import * -from gnuradio_core_filter import * -from gnuradio_core_io import * -from gnuradio_core_hier import * diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index 6f939c470..73ca8e08f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2006,2008,2009 Free Software Foundation, Inc. +# Copyright 2003,2004,2006,2008,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -40,7 +40,7 @@ if _RTLD_GLOBAL != 0: _dlopenflags = sys.getdlopenflags() sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) -from gnuradio_swig_python import * +from gnuradio_core import * from exceptions import * from hier_block2 import * from top_block import * diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index b43c5feda..f2256da1b 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio_swig_python import hier_block2_swig +from gnuradio_core import hier_block2_swig # # This hack forces a 'has-a' relationship to look like an 'is-a' one. diff --git a/gnuradio-core/src/python/gnuradio/gr/prefs.py b/gnuradio-core/src/python/gnuradio/gr/prefs.py index 9b31b772b..40347a2f4 100644 --- a/gnuradio-core/src/python/gnuradio/gr/prefs.py +++ b/gnuradio-core/src/python/gnuradio/gr/prefs.py @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -import gnuradio_swig_python as gsp +import gnuradio_core as gsp _prefs_base = gsp.gr_prefs diff --git a/gnuradio-core/src/python/gnuradio/gr/scheduler.py b/gnuradio-core/src/python/gnuradio/gr/scheduler.py index 4694d48b2..67f79ab77 100644 --- a/gnuradio-core/src/python/gnuradio/gr/scheduler.py +++ b/gnuradio-core/src/python/gnuradio/gr/scheduler.py @@ -20,7 +20,7 @@ # from gnuradio.gr.exceptions import * -from gnuradio_swig_python import single_threaded_scheduler, sts_pyrun +from gnuradio_core import single_threaded_scheduler, sts_pyrun import gr_threading as _threading #import threading as _threading diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index 71e401424..59bb0438f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio_swig_python import top_block_swig, \ +from gnuradio_core import top_block_swig, \ top_block_wait_unlocked, top_block_run_unlocked #import gnuradio.gr.gr_threading as _threading -- cgit From 52da23e0c42298a1cba07546259037c92db8c588 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 11:47:36 -0700 Subject: Remove dead code --- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 1 - gnuradio-core/src/python/gnuradio/gr/scheduler.py | 70 ----------------------- 2 files changed, 71 deletions(-) delete mode 100644 gnuradio-core/src/python/gnuradio/gr/scheduler.py (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am index 341f58812..c3017adcc 100644 --- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am @@ -39,7 +39,6 @@ grgrpython_PYTHON = \ gr_threading_24.py \ hier_block2.py \ prefs.py \ - scheduler.py \ top_block.py \ pubsub.py diff --git a/gnuradio-core/src/python/gnuradio/gr/scheduler.py b/gnuradio-core/src/python/gnuradio/gr/scheduler.py deleted file mode 100644 index 67f79ab77..000000000 --- a/gnuradio-core/src/python/gnuradio/gr/scheduler.py +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright 2004 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. -# - -from gnuradio.gr.exceptions import * -from gnuradio_core import single_threaded_scheduler, sts_pyrun -import gr_threading as _threading -#import threading as _threading - -class scheduler_thread(_threading.Thread): - def __init__(self, sts): - _threading.Thread.__init__(self) - self.sts = sts - def run(self): - # Invoke the single threaded scheduler's run method - # - # Note that we're in a new thread, and that sts_pyrun - # releases the global interpreter lock. This has the - # effect of evaluating the graph in parallel to the - # main line control code. - sts_pyrun(self.sts) - self.sts = None - -class scheduler(object): - def __init__(self, fg): - graphs = fg.partition_graph(fg.blocks) - # print "@@@ # graphs = %d" % (len(graphs)) - - self.state = [] - - for g in graphs: - list_of_blocks = [x.block() for x in g] - sts = single_threaded_scheduler(list_of_blocks) - thread = scheduler_thread(sts) - thread.setDaemon(1) - self.state.append((sts, thread)) - - def start(self): - for (sts, thread) in self.state: - thread.start() - - def stop(self): - for (sts, thread) in self.state: - sts.stop() - self.wait() - - def wait(self): - for (sts, thread) in self.state: - timeout = 0.100 - while True: - thread.join(timeout) - if not thread.isAlive(): - break -- cgit From d1685679788103a280f4c7b373051b9e1779571f Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 11:49:35 -0700 Subject: Missed a few: s/_swig_py_/_/ --- gnuradio-core/src/lib/swig/Makefile.am | 2 +- gnuradio-core/src/lib/swig/gnuradio_core.scm | 32 ++++++++++++++++++++ gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 4 +-- gnuradio-core/src/lib/swig/gnuradio_core_io.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm | 34 ---------------------- 9 files changed, 40 insertions(+), 42 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_core.scm delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 9e0d2f69e..fb8577f72 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -55,7 +55,7 @@ if GUILE # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the # default search path. -grguile_DATA = gnuradio_swig.scm +grguile_DATA = gnuradio_core.scm endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.scm b/gnuradio-core/src/lib/swig/gnuradio_core.scm new file mode 100644 index 000000000..2aae2d1d8 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_core.scm @@ -0,0 +1,32 @@ +;;; +;;; Copyright 2010 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 this program; if not, write to the Free Software Foundation, Inc., +;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +;;; + +;; Only use these if load-* fails to find a .scm or .so. If you can't +;; find a .so, try running ldconfig. guile seems to only load modules +;; that are in the ldconfig paths. +;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) +;; (set! %load-path (append %load-path '("/usr/share/gnuradio"))) + +(load "gnuradio/gnuradio_core_filter.scm") +(load "gnuradio/gnuradio_core_io.scm") +(load "gnuradio/gnuradio_core_runtime.scm") +(load "gnuradio/gnuradio_core_general.scm") +(load "gnuradio/gnuradio_core_gengen.scm") +(load "gnuradio/gnuradio_core_hier.scm") diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i index d9751d0f1..b03996b76 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i @@ -20,7 +20,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_filter +%module(directors="1") gnuradio_core_filter #endif //%feature("autodoc", "1"); // generate python docstrings diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index 07ef90e34..a82f1f5b3 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -20,7 +20,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_general +%module(directors="1") gnuradio_core_general #endif //%feature("autodoc", "1"); // generate python docstrings diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i index ea78d8af6..e6f9ebcf4 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i @@ -20,7 +20,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_gengen +%module(directors="1") gnuradio_core_gengen #endif //%feature("autodoc", "1"); // generate python docstrings diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i index f69b80334..0da432ce0 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i @@ -20,7 +20,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_hier +%module(directors="1") gnuradio_hier_hier #endif //%feature("autodoc", "1"); // generate python docstrings @@ -31,6 +31,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_heir" "SWIG_init") +(load-extension "libguile-gnuradio_core_hier" "SWIG_init") %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i index 82acae747..b1dcfaf21 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i @@ -20,7 +20,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_io +%module(directors="1") gnuradio_core_io #endif //%feature("autodoc", "1"); // generate python docstrings diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i index 3cc0a053d..4372b993d 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -21,7 +21,7 @@ */ #ifndef SWIGIMPORTED -%module(directors="1") gnuradio_swig_py_runtime +%module(directors="1") gnuradio_core_runtime #endif //%feature("autodoc", "1"); // generate python docstrings diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm b/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm deleted file mode 100644 index d08840071..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig_guile.scm +++ /dev/null @@ -1,34 +0,0 @@ -;;; -;;; Copyright 2010 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 this program; if not, write to the Free Software Foundation, Inc., -;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -;;; - -;; Only use these if load-* fails to find a .scm or .so. If you can't -;; find a .so, try running ldconfig. guile seems to only load modules -;; that are in the ldconfig paths. -;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) -;; (set! %load-path (append %load-path '("/usr/share/gnuradio"))) - -(load "gnuradio/gnuradio_swig_py_filter.scm") -(load "gnuradio/gnuradio_swig_py_io.scm") -(load "gnuradio/gnuradio_swig_py_runtime.scm") -(load "gnuradio/gnuradio_swig_py_general.scm") -(load "gnuradio/gnuradio_swig_py_gengen.scm") - -;; FIXME: this don't load for some reason cause of issues with the .so files -;; (load "gnuradio/gnuradio_swig_py_heir.scm") -- cgit From 0a81b7d48de58cd83f7076fb9bd45cf30595c9ec Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 12:04:42 -0700 Subject: rm gnuradio_swig.scm. Got turned into gnuradio_core.scm --- gnuradio-core/src/lib/swig/gnuradio_swig.scm | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig.scm b/gnuradio-core/src/lib/swig/gnuradio_swig.scm deleted file mode 100644 index c07d46a64..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_swig.scm +++ /dev/null @@ -1,13 +0,0 @@ -;;; -;;; Not sure that we need this for guile or not. -;;; We'll need to assemble the (gnuradio gr) module somewhere... -;;; - -;; # This file implements the old gnuradio_core namespace -;; -;; from gnuradio_swig_py_runtime import * -;; from gnuradio_swig_py_general import * -;; from gnuradio_swig_py_gengen import * -;; from gnuradio_swig_py_filter import * -;; from gnuradio_swig_py_io import * -;; from gnuradio_swig_py_hier import * -- cgit From 5939ce6971607b83b33c2ac0ede627a83670113a Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 19:53:03 -0700 Subject: Move std_complex.i to gnuradio-core/src/lib/swig/guile. Seems to basically work. There's some simple test code inline in gnuradio_core_general.i. --- gnuradio-core/src/lib/swig/.gitignore | 77 +++++++++------------- gnuradio-core/src/lib/swig/Makefile.am | 4 ++ gnuradio-core/src/lib/swig/gnuradio.i | 6 +- gnuradio-core/src/lib/swig/gnuradio_core_general.i | 20 ++++++ gnuradio-core/src/lib/swig/guile/std_complex.i | 30 +++++++++ 5 files changed, 89 insertions(+), 48 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/guile/std_complex.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 0018a2a54..75d6ce5b7 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -10,51 +10,34 @@ /swigrun.py /swigrun_wrap.c /Makefile.swigdeps.new -/gnuradio_core_runtime.d -/gnuradio_core_general.d -/gnuradio_core_gengen.d -/gnuradio_core_filter.d -/gnuradio_core_io.d /gnuradio_swig_bug_workaround.h -/gnuradio_core_runtime.cc -/gnuradio_core_runtime.h -/gnuradio_core_runtime.py -/gnuradio_core_general.cc -/gnuradio_core_general.h -/gnuradio_core_general.py -/gnuradio_core_gengen.cc -/gnuradio_core_gengen.h -/gnuradio_core_gengen.py -/gnuradio_core_filter.cc -/gnuradio_core_filter.h -/gnuradio_core_filter.py -/gnuradio_core_io.cc -/gnuradio_core_io.h -/gnuradio_core_io.py -/gnuradio_core_hier.cc -/gnuradio_core_hier.h -/gnuradio_core_hier.py -/gnuradio_core_filter_python.cc -/gnuradio_core_filter_python.h -/gnuradio_core_general_python.cc -/gnuradio_core_general_python.h -/gnuradio_core_gengen_python.cc -/gnuradio_core_gengen_python.h -/gnuradio_core_hier_python.cc -/gnuradio_core_hier_python.h -/gnuradio_core_io_python.cc -/gnuradio_core_io_python.h -/gnuradio_core_runtime_python.cc -/gnuradio_core_runtime_python.h -/gnuradio_core_filter.scm -/gnuradio_core_filter_guile.cc -/gnuradio_core_general.scm -/gnuradio_core_general_guile.cc -/gnuradio_core_gengen.scm -/gnuradio_core_gengen_guile.cc -/gnuradio_core_hier.scm -/gnuradio_core_hier_guile.cc -/gnuradio_core_io.scm -/gnuradio_core_io_guile.cc -/gnuradio_core_runtime.scm -/gnuradio_core_runtime_guile.cc +gnuradio_core_filter.cc +gnuradio_core_filter.d +gnuradio_core_filter.h +gnuradio_core_filter.py +gnuradio_core_filter.scm +gnuradio_core_general.cc +gnuradio_core_general.d +gnuradio_core_general.h +gnuradio_core_general.py +gnuradio_core_general.scm +gnuradio_core_gengen.cc +gnuradio_core_gengen.d +gnuradio_core_gengen.h +gnuradio_core_gengen.py +gnuradio_core_gengen.scm +gnuradio_core_hier.cc +gnuradio_core_hier.d +gnuradio_core_hier.h +gnuradio_core_hier.py +gnuradio_core_hier.scm +gnuradio_core_io.cc +gnuradio_core_io.d +gnuradio_core_io.h +gnuradio_core_io.py +gnuradio_core_io.scm +gnuradio_core_runtime.cc +gnuradio_core_runtime.d +gnuradio_core_runtime.h +gnuradio_core_runtime.py +gnuradio_core_runtime.scm diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index fb8577f72..f30b877a1 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -50,6 +50,10 @@ swiginclude_HEADERS = \ gr_swig_block_magic.i \ gr_shared_ptr.i +# SWIG headers that get installed in ${prefix}/include/gnuradio/swig/... +nobase_swiginclude_HEADERS = \ + guile/std_complex.i + if GUILE # This is the top level guile file, which loads all the other scm files diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index ec0264107..a30655f45 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -42,8 +42,12 @@ // non-local SWIG files %include -%include %include +#ifdef SWIGGUILE +%include +#else +%include +#endif typedef std::complex gr_complex; typedef std::complex gr_complexd; diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index a82f1f5b3..3edca69ef 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -29,6 +29,26 @@ %include "general.i" + // Simple test case for complex input and output +%inline +%{ + std::complex complexf_add_2j(std::complex x) + { + return std::complex(x.real(), x.imag() + 2); + } + + std::complex complexd_add_2j(std::complex x) + { + return std::complex(x.real(), x.imag() + 2); + } + + std::complex complexf_add_x_2j(float x, std::complex y) + { + return std::complex(x + y.real(), y.imag() + 2); + } + +%} + #if SWIGGUILE %scheme %{ (load-extension "libguile-gnuradio_core_general" "SWIG_init") diff --git a/gnuradio-core/src/lib/swig/guile/std_complex.i b/gnuradio-core/src/lib/swig/guile/std_complex.i new file mode 100644 index 000000000..cafcfeae3 --- /dev/null +++ b/gnuradio-core/src/lib/swig/guile/std_complex.i @@ -0,0 +1,30 @@ +%{ +#include +%} + +// To the target language, complex number conversion +%typemap(out) complex, complex, std::complex { + $result = scm_make_rectangular( gh_double2scm ($1.real ()), + gh_double2scm ($1.imag ()) ); +} + +// To the target language, complex number conversion +%typemap(out) complex, complex, std::complex { + $result = scm_make_rectangular( gh_double2scm ($1.real ()), + gh_double2scm ($1.imag ()) ); +} + +// From the target language, complex number conversion +%typemap(in) complex, complex, std::complex { + $1 = std::complex( gh_scm2double (scm_real_part ($input)), + gh_scm2double (scm_imag_part ($input)) ); +} + +// From the target language, complex number conversion +%typemap(in) complex, complex, std::complex { + $1 = std::complex( gh_scm2double (scm_real_part ($input)), + gh_scm2double (scm_imag_part ($input)) ); +} + +%typemaps_primitive(%checkcode(CPLXDBL), std::complex); +%typemaps_primitive(%checkcode(CPLXFLT), std::complex); -- cgit From 27d1af7c7511addac638856bc2ffd3cda5e7ab0c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 23 Oct 2010 20:59:54 -0700 Subject: Add %typecheck for complex. Fixes problem with moving-average-cc. --- gnuradio-core/src/lib/swig/guile/std_complex.i | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/guile/std_complex.i b/gnuradio-core/src/lib/swig/guile/std_complex.i index cafcfeae3..2a5c72aa2 100644 --- a/gnuradio-core/src/lib/swig/guile/std_complex.i +++ b/gnuradio-core/src/lib/swig/guile/std_complex.i @@ -28,3 +28,10 @@ %typemaps_primitive(%checkcode(CPLXDBL), std::complex); %typemaps_primitive(%checkcode(CPLXFLT), std::complex); + +%typecheck(SWIG_TYPECHECK_COMPLEX) + std::complex, std::complex, + const std::complex &, const std::complex & +{ + $1 = scm_is_complex($input) ? 1 : 0; +} -- cgit From 299aba578b76e1f07cb3e4e5ff59ee6b306afb5a Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 28 Oct 2010 15:05:52 -0700 Subject: Version that builds guile goops bindings, but dependencies are hosed. Doesn't compile cleanly, but does enough to allow experimentation with goops wrappers. We're currently seeing the nasty interaction between the package system, the "export" syntax, and generic-functions. See thread here: http://lists.gnu.org/archive/html/guile-user/2006-05/msg00007.html for background. --- gnuradio-core/src/lib/swig/Makefile.am | 7 +- gnuradio-core/src/lib/swig/Makefile.swig.gen | 24 +++---- gnuradio-core/src/lib/swig/Swig/common.scm | 76 ++++++++++++++++++++++ gnuradio-core/src/lib/swig/gnuradio/.gitignore | 12 ++++ gnuradio-core/src/lib/swig/gnuradio/core.scm | 11 ++++ gnuradio-core/src/lib/swig/gnuradio_core.scm | 32 --------- gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 8 ++- gnuradio-core/src/lib/swig/gnuradio_core_general.i | 6 +- gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 6 +- gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 6 +- gnuradio-core/src/lib/swig/gnuradio_core_io.i | 6 +- gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 2 +- 12 files changed, 143 insertions(+), 53 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/Swig/common.scm create mode 100644 gnuradio-core/src/lib/swig/gnuradio/.gitignore create mode 100644 gnuradio-core/src/lib/swig/gnuradio/core.scm delete mode 100644 gnuradio-core/src/lib/swig/gnuradio_core.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index f30b877a1..60a1d952e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -59,7 +59,9 @@ if GUILE # This is the top level guile file, which loads all the other scm files # for gnuradio. This has to be installed top level to be found in the # default search path. -grguile_DATA = gnuradio_core.scm +nobase_guile_DATA = \ + gnuradio/core.scm \ + Swig/common.scm endif @@ -112,7 +114,8 @@ BUILT_SOURCES += $(PYTHON_GEN) endif # end of if python if GUILE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.scm,$(HFILE))) +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE))) +#GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) # BUILT_SOURCES += $(foreach HFILE,$(GUILE_GEN), $(subst gnuradio,guile/gnuradio,$(HFILE))) BUILT_SOURCES += $(GUILE_GEN) endif diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index f6e3fa1b1..67cefe7d0 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -46,7 +46,7 @@ gnuradio_core_runtime_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_runtime # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_runtime_scmdir = $(guiledir)/gnuradio +gnuradio_core_runtime_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -128,7 +128,7 @@ gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la libguile_gnuradio_core_runtime_la_SOURCES = \ guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) -gnuradio_core_runtime_scm_DATA = gnuradio_core_runtime.scm +nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) @@ -194,7 +194,7 @@ gnuradio_core_general_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_general # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_general_scmdir = $(guiledir)/gnuradio +gnuradio_core_general_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -276,7 +276,7 @@ gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la libguile_gnuradio_core_general_la_SOURCES = \ guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) -gnuradio_core_general_scm_DATA = gnuradio_core_general.scm +nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) @@ -342,7 +342,7 @@ gnuradio_core_gengen_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_gengen # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_gengen_scmdir = $(guiledir)/gnuradio +gnuradio_core_gengen_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -424,7 +424,7 @@ gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la libguile_gnuradio_core_gengen_la_SOURCES = \ guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) -gnuradio_core_gengen_scm_DATA = gnuradio_core_gengen.scm +nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) @@ -490,7 +490,7 @@ gnuradio_core_filter_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_filter # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_filter_scmdir = $(guiledir)/gnuradio +gnuradio_core_filter_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -572,7 +572,7 @@ gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la libguile_gnuradio_core_filter_la_SOURCES = \ guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) -gnuradio_core_filter_scm_DATA = gnuradio_core_filter.scm +nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) @@ -638,7 +638,7 @@ gnuradio_core_io_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_io # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_io_scmdir = $(guiledir)/gnuradio +gnuradio_core_io_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -720,7 +720,7 @@ gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la libguile_gnuradio_core_io_la_SOURCES = \ guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) -gnuradio_core_io_scm_DATA = gnuradio_core_io.scm +nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) @@ -786,7 +786,7 @@ gnuradio_core_hier_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/gnuradio_core_hier # FIXME: determince whether these should be installed with gnuradio. -gnuradio_core_hier_scmdir = $(guiledir)/gnuradio +gnuradio_core_hier_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -868,7 +868,7 @@ gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la libguile_gnuradio_core_hier_la_SOURCES = \ guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) -gnuradio_core_hier_scm_DATA = gnuradio_core_hier.scm +nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primtive.scm # Guile can use the same flags as python does libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) diff --git a/gnuradio-core/src/lib/swig/Swig/common.scm b/gnuradio-core/src/lib/swig/Swig/common.scm new file mode 100644 index 000000000..a51d3a71d --- /dev/null +++ b/gnuradio-core/src/lib/swig/Swig/common.scm @@ -0,0 +1,76 @@ +;;;************************************************************************ +;;;*common.scm +;;;* +;;;* This file contains generic SWIG GOOPS classes for generated +;;;* GOOPS file support +;;;* +;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu) +;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) +;;;* +;;;* This file may be freely redistributed without license or fee provided +;;;* this copyright message remains intact. +;;;************************************************************************ + +(define-module (Swig swigrun)) + +(define-module (Swig common) + #:use-module (oop goops) + #:use-module (Swig swigrun)) + +(define-class () + (new-function #:init-value #f)) + +(define-method (initialize (class ) initargs) + (slot-set! class 'new-function (get-keyword #:new-function initargs #f)) + (next-method)) + +(define-class () + (swig-smob #:init-value #f) + #:metaclass +) + +(define-method (initialize (obj ) initargs) + (next-method) + (slot-set! obj 'swig-smob + (let ((arg (get-keyword #:init-smob initargs #f))) + (if arg + arg + (let ((ret (apply (slot-ref (class-of obj) 'new-function) (get-keyword #:args initargs '())))) + ;; if the class is registered with runtime environment, + ;; new-Function will return a goops class. In that case, extract the smob + ;; from that goops class and set it as the current smob. + (if (slot-exists? ret 'swig-smob) + (slot-ref ret 'swig-smob) + ret)))))) + +(define (display-address o file) + (display (number->string (object-address o) 16) file)) + +(define (display-pointer-address o file) + ;; Don't fail if the function SWIG-PointerAddress is not present. + (let ((address (false-if-exception (SWIG-PointerAddress o)))) + (if address + (begin + (display " @ " file) + (display (number->string address 16) file))))) + +(define-method (write (o ) file) + ;; We display _two_ addresses to show the object's identity: + ;; * first the address of the GOOPS proxy object, + ;; * second the pointer address. + ;; The reason is that proxy objects are created and discarded on the + ;; fly, so different proxy objects for the same C object will appear. + (let ((class (class-of o))) + (if (slot-bound? class 'name) + (begin + (display "#<" file) + (display (class-name class) file) + (display #\space file) + (display-address o file) + (display-pointer-address o file) + (display ">" file)) + (next-method)))) + +(export ) + +;;; common.scm ends here diff --git a/gnuradio-core/src/lib/swig/gnuradio/.gitignore b/gnuradio-core/src/lib/swig/gnuradio/.gitignore new file mode 100644 index 000000000..20ce65795 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio/.gitignore @@ -0,0 +1,12 @@ +/gnuradio_core_filter.scm +/gnuradio_core_filter-primitive.scm +/gnuradio_core_general.scm +/gnuradio_core_general-primitive.scm +/gnuradio_core_gengen.scm +/gnuradio_core_gengen-primitive.scm +/gnuradio_core_hier.scm +/gnuradio_core_hier-primitive.scm +/gnuradio_core_io.scm +/gnuradio_core_io-primitive.scm +/gnuradio_core_runtime.scm +/gnuradio_core_runtime-primitive.scm diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm new file mode 100644 index 000000000..3b12d4025 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm @@ -0,0 +1,11 @@ +(define-module (gnuradio core) + #:use-module (gnuradio gnuradio_core_runtime) + #:use-module (gnuradio gnuradio_core_filter) + #:use-module (gnuradio gnuradio_core_io) + #:use-module (gnuradio gnuradio_core_general) + #:use-module (gnuradio gnuradio_core_gengen) + #:use-module (gnuradio gnuradio_core_hier) + #:duplicates (merge-generics replace warn-override-core warn last)) + +;; re-export everything... + diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.scm b/gnuradio-core/src/lib/swig/gnuradio_core.scm deleted file mode 100644 index 2aae2d1d8..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_core.scm +++ /dev/null @@ -1,32 +0,0 @@ -;;; -;;; Copyright 2010 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 this program; if not, write to the Free Software Foundation, Inc., -;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -;;; - -;; Only use these if load-* fails to find a .scm or .so. If you can't -;; find a .so, try running ldconfig. guile seems to only load modules -;; that are in the ldconfig paths. -;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio"))) -;; (set! %load-path (append %load-path '("/usr/share/gnuradio"))) - -(load "gnuradio/gnuradio_core_filter.scm") -(load "gnuradio/gnuradio_core_io.scm") -(load "gnuradio/gnuradio_core_runtime.scm") -(load "gnuradio/gnuradio_core_general.scm") -(load "gnuradio/gnuradio_core_gengen.scm") -(load "gnuradio/gnuradio_core_hier.scm") diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i index b03996b76..0acbfa3a6 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i @@ -31,6 +31,10 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_filter" "SWIG_init") +(load-extension "libguile-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module") %} - #endif + +%goops %{ + (use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index 3edca69ef..8b3bf971b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -51,6 +51,10 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_general" "SWIG_init") +(load-extension "libguile-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module") +%} + +%goops %{ + (use-modules (gnuradio gnuradio_core_runtime)) %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i index e6f9ebcf4..c08109173 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i @@ -31,6 +31,10 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_gengen" "SWIG_init") +(load-extension "libguile-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module") +%} + +%goops %{ + (use-modules (gnuradio gnuradio_core_runtime)) %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i index 0da432ce0..6d7a38321 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i @@ -31,6 +31,10 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_hier" "SWIG_init") +(load-extension "libguile-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module") +%} + +%goops %{ + (use-modules (gnuradio gnuradio_core_runtime)) %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i index b1dcfaf21..936522ada 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i @@ -31,6 +31,10 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_io" "SWIG_init") +(load-extension "libguile-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module") +%} + +%goops %{ + (use-modules (gnuradio gnuradio_core_runtime)) %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i index 4372b993d..2f6ca8227 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -34,6 +34,6 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_runtime" "SWIG_init") +(load-extension "libguile-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") %} #endif -- cgit From cbfffe4100daff91746db0b6ea66cec9f7b2ceed Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 29 Oct 2010 02:20:32 -0700 Subject: Move sizeof_* from gnuradio.i to runtime.i to avoid multiple definitions --- gnuradio-core/src/lib/runtime/runtime.i | 7 +++++++ gnuradio-core/src/lib/swig/gnuradio.i | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index 20cf68a03..ca89b8fbd 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -40,6 +40,13 @@ #include %} +%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 %include %include diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index a30655f45..6eb44cbe9 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -76,15 +76,6 @@ namespace std { //////////////////////////////////////////////////////////////////////// -%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); - -//////////////////////////////////////////////////////////////////////// - #ifndef SW_RUNTIME // import runtime.i for all but sw_runtime, since it needs to %include %import -- cgit From da69e1c1f910cf6ab4fd54dea25255e266b2918e Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 29 Oct 2010 03:54:07 -0700 Subject: gnuradio-core modules are almost loading cleanly. --- gnuradio-core/src/lib/swig/Makefile.am | 1 + gnuradio-core/src/lib/swig/gnuradio/core.scm | 6 ++- .../src/lib/swig/gnuradio/export-safely.scm | 45 ++++++++++++++++++++++ gnuradio-core/src/lib/swig/gnuradio_core_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 7 ++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/gnuradio/export-safely.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 60a1d952e..b9bc75348 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -60,6 +60,7 @@ if GUILE # for gnuradio. This has to be installed top level to be found in the # default search path. nobase_guile_DATA = \ + gnuradio/export-safely.scm \ gnuradio/core.scm \ Swig/common.scm endif diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm index 3b12d4025..294881146 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/core.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm @@ -1,3 +1,5 @@ +;;; Glue the separate pieces of gnuradio-core into a single module + (define-module (gnuradio core) #:use-module (gnuradio gnuradio_core_runtime) #:use-module (gnuradio gnuradio_core_filter) @@ -5,7 +7,7 @@ #:use-module (gnuradio gnuradio_core_general) #:use-module (gnuradio gnuradio_core_gengen) #:use-module (gnuradio gnuradio_core_hier) - #:duplicates (merge-generics replace warn-override-core warn last)) + #:duplicates (merge-generics check)) ;; re-export everything... - +(re-export-all (current-module)) diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm new file mode 100644 index 000000000..52530abc9 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm @@ -0,0 +1,45 @@ +(define-module (gnuradio export-safely) + #:use-module (oop goops) + #:use-module (srfi srfi-1) + #:export-syntax (export-safely)) + +(define-public (generics-in-module module) + (let ((lst '())) + (module-for-each (lambda (sym var) + (if (variable-bound? var) + (let ((v (variable-ref var))) + (cond ((is-a? v ) + (set! lst (cons v lst))))))) + module) + lst)) + +(define-public (generic-function-names-in-module module) + (map generic-function-name (generics-in-module module))) + +(define-public (generic-function-names-in-imported-modules module) + (concatenate (map generic-function-names-in-module (module-uses module)))) + +(define-public (export-syms-if-not-imported-gf list-of-syms) + (let ((gf-names (generic-function-names-in-imported-modules (current-module)))) + (let ((to-export (filter (lambda (sym) + (not (memq sym gf-names))) + list-of-syms))) + (module-export! (current-module) to-export)))) + +(defmacro export-safely names + `(export-syms-if-not-imported-gf ',names)) + + +(define-public (names-in-module module) + (let ((lst '())) + (module-for-each (lambda (sym var) + (if (variable-bound? var) + (set! lst (cons sym lst)))) + module) + lst)) + +(define-public (names-in-imported-modules module) + (concatenate (map names-in-module (module-uses module)))) + +(define-public (re-export-all module) + (module-re-export! module (names-in-imported-modules module))) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index 8b3bf971b..759a65459 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -55,6 +55,6 @@ %} %goops %{ - (use-modules (gnuradio gnuradio_core_runtime)) +(use-modules (gnuradio gnuradio_core_runtime)) %} #endif diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i index 2f6ca8227..bb10b36b2 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -36,4 +36,11 @@ %scheme %{ (load-extension "libguile-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") %} + +%goops %{ +(use-modules (gnuradio export-safely)) +(re-export export-syms-if-not-imported-gf) +(re-export-syntax export-safely) +(re-export re-export-all) +%} #endif -- cgit From 8579841a28eb07fdfc72cb9bb594f76e71465902 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 29 Oct 2010 03:56:17 -0700 Subject: Remove duplicate include of gr_endianness.i from general.i --- gnuradio-core/src/lib/general/general.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 68cafce2e..3ad40b218 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -53,7 +53,7 @@ #include #include #include -#include +//#include #include #include #include @@ -173,7 +173,7 @@ %include "gr_align_on_samplenumbers_ss.i" %include "gr_complex_to_xxx.i" %include "gr_complex_to_interleaved_short.i" -%include "gr_endianness.i" +//%include "gr_endianness.i" %include "gr_interleaved_short_to_complex.i" %include "gr_firdes.i" %include "gr_interleave.i" -- cgit From 2a6649f9eafd467dbb5467e2a4d46affffc1afbd Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 29 Oct 2010 03:56:48 -0700 Subject: Disable gr_message_source until later... --- gnuradio-core/src/lib/io/gr_message_source.i | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i index 8a9c762d0..3566ee5a7 100644 --- a/gnuradio-core/src/lib/io/gr_message_source.i +++ b/gnuradio-core/src/lib/io/gr_message_source.i @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef SWIGGUILE +#warning "gr_message_source.i: FIXME being ignored by swig/guile for now" +#else + GR_SWIG_BLOCK_MAGIC(gr,message_source); gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); @@ -36,3 +40,4 @@ class gr_message_source : public gr_sync_block gr_msg_queue_sptr msgq() const; }; +#endif -- cgit From 589f7bfacff26a373c88a11b507d9d58ce2cf55b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 29 Oct 2010 04:50:13 -0700 Subject: Modules now load cleanly! --- .../src/lib/swig/gnuradio/export-safely.scm | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm index 52530abc9..2da7e633e 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm @@ -1,3 +1,37 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; This module implements a macro, export-safely, that avoids +;;; exporting symbols that are actually generic-functions imported +;;; (explicity or implicitly) from elsewhere. +;;; +;;; This hackery is required so that the swig generated goops wrappers +;;; don't stomp on each other. For background on what this is about +;;; see this thread: +;;; +;;; http://lists.gnu.org/archive/html/guile-user/2006-05/msg00007.html +;;; +;;; Don't expect to understand what's going on here without looking at +;;; the guts of the module system (implemented in ice-9/boot-9.scm) and +;;; having a pretty good understanding of goops and generic-functions. + + (define-module (gnuradio export-safely) #:use-module (oop goops) #:use-module (srfi srfi-1) @@ -23,7 +57,7 @@ (let ((gf-names (generic-function-names-in-imported-modules (current-module)))) (let ((to-export (filter (lambda (sym) (not (memq sym gf-names))) - list-of-syms))) + (delete-duplicates list-of-syms)))) (module-export! (current-module) to-export)))) (defmacro export-safely names @@ -39,7 +73,15 @@ lst)) (define-public (names-in-imported-modules module) - (concatenate (map names-in-module (module-uses module)))) + (delete-duplicates (concatenate (map names-in-module (module-uses module))))) (define-public (re-export-all module) - (module-re-export! module (names-in-imported-modules module))) + (define (ok-to-re-export? name) + (let ((var (module-variable module name))) + (cond ((not var) #f) ; Undefined var + ((eq? var (module-local-variable module name)) #f) ; local var + (else #t)))) ; OK + + (module-re-export! module + (filter ok-to-re-export? + (names-in-imported-modules module)))) -- cgit From 40fac3c4a2f5f1f6dde79e96be8f40535e11343b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 30 Oct 2010 12:14:16 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 30 ++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 67cefe7d0..69042f84e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -128,7 +128,7 @@ gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la libguile_gnuradio_core_runtime_la_SOURCES = \ guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) -nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primtive.scm +nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) @@ -137,6 +137,9 @@ libguile_gnuradio_core_runtime_la_CXXFLAGS = $(_gnuradio_core_runtime_la_CXXFLAG guile/gnuradio_core_runtime.lo: gnuradio_core_runtime.lo gnuradio_core_runtime.scm: gnuradio_core_runtime.i +gnuradio/gnuradio_core_runtime-primitive.scm: gnuradio_core_runtime.scm + +-include guile/gnuradio_core_runtime.d endif # end of GUILE @@ -276,7 +279,7 @@ gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la libguile_gnuradio_core_general_la_SOURCES = \ guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) -nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primtive.scm +nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) @@ -285,6 +288,9 @@ libguile_gnuradio_core_general_la_CXXFLAGS = $(_gnuradio_core_general_la_CXXFLAG guile/gnuradio_core_general.lo: gnuradio_core_general.lo gnuradio_core_general.scm: gnuradio_core_general.i +gnuradio/gnuradio_core_general-primitive.scm: gnuradio_core_general.scm + +-include guile/gnuradio_core_general.d endif # end of GUILE @@ -424,7 +430,7 @@ gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la libguile_gnuradio_core_gengen_la_SOURCES = \ guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) -nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primtive.scm +nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) @@ -433,6 +439,9 @@ libguile_gnuradio_core_gengen_la_CXXFLAGS = $(_gnuradio_core_gengen_la_CXXFLAGS) guile/gnuradio_core_gengen.lo: gnuradio_core_gengen.lo gnuradio_core_gengen.scm: gnuradio_core_gengen.i +gnuradio/gnuradio_core_gengen-primitive.scm: gnuradio_core_gengen.scm + +-include guile/gnuradio_core_gengen.d endif # end of GUILE @@ -572,7 +581,7 @@ gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la libguile_gnuradio_core_filter_la_SOURCES = \ guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) -nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primtive.scm +nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) @@ -581,6 +590,9 @@ libguile_gnuradio_core_filter_la_CXXFLAGS = $(_gnuradio_core_filter_la_CXXFLAGS) guile/gnuradio_core_filter.lo: gnuradio_core_filter.lo gnuradio_core_filter.scm: gnuradio_core_filter.i +gnuradio/gnuradio_core_filter-primitive.scm: gnuradio_core_filter.scm + +-include guile/gnuradio_core_filter.d endif # end of GUILE @@ -720,7 +732,7 @@ gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la libguile_gnuradio_core_io_la_SOURCES = \ guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) -nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primtive.scm +nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) @@ -729,6 +741,9 @@ libguile_gnuradio_core_io_la_CXXFLAGS = $(_gnuradio_core_io_la_CXXFLAGS) guile/gnuradio_core_io.lo: gnuradio_core_io.lo gnuradio_core_io.scm: gnuradio_core_io.i +gnuradio/gnuradio_core_io-primitive.scm: gnuradio_core_io.scm + +-include guile/gnuradio_core_io.d endif # end of GUILE @@ -868,7 +883,7 @@ gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la libguile_gnuradio_core_hier_la_SOURCES = \ guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) -nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primtive.scm +nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primitive.scm # Guile can use the same flags as python does libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) @@ -877,6 +892,9 @@ libguile_gnuradio_core_hier_la_CXXFLAGS = $(_gnuradio_core_hier_la_CXXFLAGS) guile/gnuradio_core_hier.lo: gnuradio_core_hier.lo gnuradio_core_hier.scm: gnuradio_core_hier.i +gnuradio/gnuradio_core_hier-primitive.scm: gnuradio_core_hier.scm + +-include guile/gnuradio_core_hier.d endif # end of GUILE -- cgit From f7d9be06a59c30e3e964456d2f6c95e64d8ec05f Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 30 Oct 2010 12:15:49 -0600 Subject: move good comment to here where it belongs --- gnuradio-core/src/lib/swig/Makefile.am | 4 ---- 1 file changed, 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index b9bc75348..2b763d94c 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -124,7 +124,3 @@ endif # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -# Compile a .i to what guile needs. We use -o to set the output file name, -# or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a -# gnuradio_core_*_wrap.cxx in the source directory. - -- cgit From c34cf20f501dea19385cb42bf31e92ad889e7040 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 30 Oct 2010 18:17:12 -0700 Subject: Rename basic_block coersion method to to_basic_block. Add to_hier_block2 and to_top_block. basic_block was renamed because the number of guile generic methods on basic_block was getting large and confusing. to_hier_block2 and to_top_block were added to support coercion to those types in guile (and python). This change simplifies the handling of "connect" in guile. --- gnuradio-core/src/lib/runtime/gr_basic_block.cc | 2 +- gnuradio-core/src/lib/runtime/gr_basic_block.h | 2 +- gnuradio-core/src/lib/runtime/gr_basic_block.i | 2 +- gnuradio-core/src/lib/runtime/gr_hier_block2.cc | 5 +++++ gnuradio-core/src/lib/runtime/gr_hier_block2.h | 2 ++ gnuradio-core/src/lib/runtime/gr_hier_block2.i | 2 ++ gnuradio-core/src/lib/runtime/gr_top_block.cc | 6 ++++++ gnuradio-core/src/lib/runtime/gr_top_block.h | 7 +++++++ gnuradio-core/src/lib/runtime/gr_top_block.i | 2 ++ gnuradio-core/src/python/gnuradio/gr/hier_block2.py | 14 +++++++------- gnuradio-core/src/python/gnuradio/gr/top_block.py | 14 +++++++------- 11 files changed, 41 insertions(+), 17 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc index 2fa1066cb..0e0dad16b 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc @@ -56,7 +56,7 @@ gr_basic_block::~gr_basic_block() } gr_basic_block_sptr -gr_basic_block::basic_block() +gr_basic_block::to_basic_block() { return shared_from_this(); } diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index b8797fdc6..d059a4bd3 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -81,7 +81,7 @@ public: std::string name() const { return d_name; } gr_io_signature_sptr input_signature() const { return d_input_signature; } gr_io_signature_sptr output_signature() const { return d_output_signature; } - gr_basic_block_sptr basic_block(); // Needed for Python type coercion + gr_basic_block_sptr to_basic_block(); // Needed for Python/Guile type coercion /*! * \brief Confirm that ninputs and noutputs is an acceptable combination. diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i index f1de9e08a..9b360e5ab 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.i +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i @@ -40,7 +40,7 @@ public: gr_io_signature_sptr input_signature() const; gr_io_signature_sptr output_signature() const; long unique_id() const; - gr_basic_block_sptr basic_block(); + gr_basic_block_sptr to_basic_block(); bool check_topology (int ninputs, int noutputs); }; diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc index e3a25e1a8..d6e317136 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc @@ -61,6 +61,11 @@ gr_hier_block2::self() return shared_from_this(); } +gr_hier_block2_sptr +gr_hier_block2::to_hier_block2() +{ + return cast_to_hier_block2_sptr(shared_from_this()); +} void gr_hier_block2::connect(gr_basic_block_sptr block) diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index f50b1cb94..0a40c36b7 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -147,6 +147,8 @@ public: // This is a public method for ease of code organization, but should be // ignored by the user. gr_flat_flowgraph_sptr flatten() const; + + gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion }; inline gr_hier_block2_sptr cast_to_hier_block2_sptr(gr_basic_block_sptr block) { diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.i b/gnuradio-core/src/lib/runtime/gr_hier_block2.i index a62f50e84..1b974fd6b 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.i +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.i @@ -57,4 +57,6 @@ public: void disconnect_all(); void lock(); void unlock(); + + gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion }; diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc index 09e46dfbb..f341525c0 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc @@ -95,3 +95,9 @@ gr_top_block::dump() { d_impl->dump(); } + +gr_top_block_sptr +gr_top_block::to_top_block() +{ + return cast_to_top_block_sptr(shared_from_this()); +} diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 8052954e3..ed244cb7c 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -105,6 +105,13 @@ public: * Displays flattened flowgraph edges and block connectivity */ void dump(); + + gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion }; +inline gr_top_block_sptr cast_to_top_block_sptr(gr_basic_block_sptr block) { + return boost::dynamic_pointer_cast(block); +} + + #endif /* INCLUDED_GR_TOP_BLOCK_H */ diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index 579ef8f70..d9adf1e18 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -47,6 +47,8 @@ public: void lock(); void unlock() throw (std::runtime_error); void dump(); + + gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion }; #ifdef SWIGPYTHON diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index f2256da1b..370f8a9d9 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -66,7 +66,7 @@ class hier_block2(object): raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: - self._hb.connect(points[0].basic_block()) + self._hb.connect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._connect(points[i-1], points[i]) @@ -74,11 +74,11 @@ class hier_block2(object): def _connect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._hb.connect(src_block.basic_block(), src_port, - dst_block.basic_block(), dst_port) + self._hb.connect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) def _coerce_endpoint(self, endp): - if hasattr(endp, 'basic_block'): + if hasattr(endp, 'to_basic_block'): return (endp, 0) else: if hasattr(endp, "__getitem__") and len(endp) == 2: @@ -100,7 +100,7 @@ class hier_block2(object): raise ValueError, ("disconnect requires at least two endpoints; %d provided." % (len (points),)) else: if len (points) == 1: - self._hb.disconnect(points[0].basic_block()) + self._hb.disconnect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._disconnect(points[i-1], points[i]) @@ -108,6 +108,6 @@ class hier_block2(object): def _disconnect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._hb.disconnect(src_block.basic_block(), src_port, - dst_block.basic_block(), dst_port) + self._hb.disconnect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index 59bb0438f..8fe5303c8 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -118,7 +118,7 @@ class top_block(object): raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: - self._tb.connect(points[0].basic_block()) + self._tb.connect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._connect(points[i-1], points[i]) @@ -126,11 +126,11 @@ class top_block(object): def _connect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._tb.connect(src_block.basic_block(), src_port, - dst_block.basic_block(), dst_port) + self._tb.connect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) def _coerce_endpoint(self, endp): - if hasattr(endp, 'basic_block'): + if hasattr(endp, 'to_basic_block'): return (endp, 0) else: if hasattr(endp, "__getitem__") and len(endp) == 2: @@ -146,7 +146,7 @@ class top_block(object): raise ValueError, ("disconnect requires at least two endpoints; %d provided." % (len (points),)) else: if len(points) == 1: - self._tb.disconnect(points[0].basic_block()) + self._tb.disconnect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._disconnect(points[i-1], points[i]) @@ -154,6 +154,6 @@ class top_block(object): def _disconnect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._tb.disconnect(src_block.basic_block(), src_port, - dst_block.basic_block(), dst_port) + self._tb.disconnect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) -- cgit From df6f365b6b703971efc9f29471e0cf1660938fbf Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 30 Oct 2010 20:22:54 -0700 Subject: Routines to coerce blocks and connect them --- gnuradio-core/src/lib/swig/gnuradio/coerce.scm | 88 ++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 gnuradio-core/src/lib/swig/gnuradio/coerce.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm new file mode 100644 index 000000000..2c508c6a4 --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm @@ -0,0 +1,88 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(define-class () + (block #:accessor block #:init-keyword #:block) + (port #:init-value 0 #:accessor port #:init-keyword #:port)) + +(define (gr:ep block port) + (make + #:block (coerce-to-basic-block block) #:port port)) + +(define (coerce-to-endpoint ep) + (cond ((is-a? ep ) ep) + ((false-if-exception (gr:to-basic-block ep)) + => (lambda (x) (gr:ep x 0))) + ((and (pair? ep) (= 2 (length ep)) + (false-if-exception (gr:to-basic-block (car ep)))) + => (lambda (x) (gr:ep x (cadr ep)))) + (else (error "Cannot coerce to an endpoint: " ep)))) + +(define (coerce-to-basic-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-basic-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_basic_block: " block)))) + +(define (coerce-to-top-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-top-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_top_block: " block)))) + +(define (coerce-to-hier-block2 block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_hier_block2: " block)))) + +;;; The gr:connect variants +;;; These work for anything derived from gr_hier_block2 +(define-method (gr:connect hb block) + (let ((hb (coerce-to-hier-block2 hb)) + (bb (coerce-to-basic-block block))) + (gr:connect hb bb))) + +(define-method (gr:connect hb (src ) (dst )) + (let ((hb (coerce-to-hier-block2 hb))) + (gr:connect hb (block src) (port src) (block dst) (port dst)))) + +(define-method (gr:connect hb src dst) + (let ((hb (coerce-to-hier-block2 hb)) + (src (coerce-to-endpoint src)) + (dst (coerce-to-endpoint dst))) + (gr:connect hb src dst))) + +;;; The gr:disconnect variants +;;; These work for anything derived from gr_hier_block2 +(define-method (gr:disconnect-all hb) + (let ((hb (coerce-to-hier-block2 hb))) + (gr:disconnect-all hb))) + +(define-method (gr:disconnect hb block) + (let ((hb (coerce-to-hier-block2 hb)) + (bb (coerce-to-basic-block block))) + (gr:disconnect hb bb))) + +(define-method (gr:disconnect hb (src ) (dst )) + (let ((hb (coerce-to-hier-block2 hb))) + (gr:disconnect hb (block src) (port src) (block dst) (port dst)))) + +(define-method (gr:disconnect hb src dst) + (let ((hb (coerce-to-hier-block2 hb)) + (src (coerce-to-endpoint src)) + (dst (coerce-to-endpoint dst))) + (gr:disconnect hb src dst))) -- cgit From 8fe7f0fe5fe89f6ec32732dd802608060e973f0d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 31 Oct 2010 20:03:35 -0700 Subject: Cleanup gr:connect and gr:disconnect for Guile. Rename {dis,}connect to {dis,}primitive_connect in .i file. Update python code to reflect change. --- gnuradio-core/src/lib/runtime/gr_hier_block2.i | 5 ++ gnuradio-core/src/lib/swig/gnuradio/coerce.scm | 56 ++++++++++------------ .../src/python/gnuradio/gr/hier_block2.py | 14 +++--- gnuradio-core/src/python/gnuradio/gr/top_block.py | 16 +++---- 4 files changed, 46 insertions(+), 45 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.i b/gnuradio-core/src/lib/runtime/gr_hier_block2.i index 1b974fd6b..32b656e24 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.i +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.i @@ -34,6 +34,11 @@ gr_hier_block2_sptr gr_make_hier_block2(const std::string name, gr_io_signature_sptr output_signature) throw (std::runtime_error); +// 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; + class gr_hier_block2 : public gr_basic_block { private: diff --git a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm index 2c508c6a4..81bc187a6 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm @@ -49,40 +49,36 @@ ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) (else (error "Cannot coerce to a gr_hier_block2: " block)))) -;;; The gr:connect variants -;;; These work for anything derived from gr_hier_block2 -(define-method (gr:connect hb block) - (let ((hb (coerce-to-hier-block2 hb)) - (bb (coerce-to-basic-block block))) - (gr:connect hb bb))) -(define-method (gr:connect hb (src ) (dst )) - (let ((hb (coerce-to-hier-block2 hb))) - (gr:connect hb (block src) (port src) (block dst) (port dst)))) +;;; Connect one or more block endpoints. An endpoint is either a , +;;; a 2-list (block port), or a block instance. In the latter case, the port number +;;; is assumed to be zero. +;;; +;;; If multiple arguments are provided, connect will attempt to wire them in series, +;;; interpreting the endpoints as inputs or outputs as appropriate. +(define-method (gr:connect hb . points) + (dis/connect "connect" gr:primitive-connect hb points)) + +;;; Disconnect one or more block endpoints... +(define-method (gr:disconnect hb . points) + (dis/connect "disconnect" gr:primitive-disconnect hb points)) -(define-method (gr:connect hb src dst) +(define (dis/connect name gf hb points) (let ((hb (coerce-to-hier-block2 hb)) - (src (coerce-to-endpoint src)) - (dst (coerce-to-endpoint dst))) - (gr:connect hb src dst))) + (points (list->vector (map coerce-to-endpoint points)))) -;;; The gr:disconnect variants -;;; These work for anything derived from gr_hier_block2 -(define-method (gr:disconnect-all hb) - (let ((hb (coerce-to-hier-block2 hb))) - (gr:disconnect-all hb))) + (define (op2 p0 p1) + (gf hb (block p0) (port p0) (block p1) (port p1))) -(define-method (gr:disconnect hb block) - (let ((hb (coerce-to-hier-block2 hb)) - (bb (coerce-to-basic-block block))) - (gr:disconnect hb bb))) + (let ((len (vector-length points))) + (case len + ((0) (error (string-append name " requires at least 1 endpoint; None provided."))) + ((1) (gf hb (vector-ref points 0))) + (else + (let loop ((n 1)) + (cond ((< n len) + (op2 (vector-ref points (1- n)) (vector-ref points n)) + (loop (1+ n)))))))))) -(define-method (gr:disconnect hb (src ) (dst )) - (let ((hb (coerce-to-hier-block2 hb))) - (gr:disconnect hb (block src) (port src) (block dst) (port dst)))) -(define-method (gr:disconnect hb src dst) - (let ((hb (coerce-to-hier-block2 hb)) - (src (coerce-to-endpoint src)) - (dst (coerce-to-endpoint dst))) - (gr:disconnect hb src dst))) +(export-safely gr:connect gr:disconnect) diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index 370f8a9d9..debb65d91 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -66,7 +66,7 @@ class hier_block2(object): raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: - self._hb.connect(points[0].to_basic_block()) + self._hb.primitive_connect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._connect(points[i-1], points[i]) @@ -74,8 +74,8 @@ class hier_block2(object): def _connect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._hb.connect(src_block.to_basic_block(), src_port, - dst_block.to_basic_block(), dst_port) + self._hb.primitive_connect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) def _coerce_endpoint(self, endp): if hasattr(endp, 'to_basic_block'): @@ -97,10 +97,10 @@ class hier_block2(object): """ if len (points) < 1: - raise ValueError, ("disconnect requires at least two endpoints; %d provided." % (len (points),)) + raise ValueError, ("disconnect requires at least one endpoint; %d provided." % (len (points),)) else: if len (points) == 1: - self._hb.disconnect(points[0].to_basic_block()) + self._hb.primitive_disconnect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._disconnect(points[i-1], points[i]) @@ -108,6 +108,6 @@ class hier_block2(object): def _disconnect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._hb.disconnect(src_block.to_basic_block(), src_port, - dst_block.to_basic_block(), dst_port) + self._hb.primitive_disconnect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index 8fe5303c8..1e36d3b48 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -118,7 +118,7 @@ class top_block(object): raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: - self._tb.connect(points[0].to_basic_block()) + self._tb.primitive_connect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._connect(points[i-1], points[i]) @@ -126,8 +126,8 @@ class top_block(object): def _connect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._tb.connect(src_block.to_basic_block(), src_port, - dst_block.to_basic_block(), dst_port) + self._tb.primitive_connect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) def _coerce_endpoint(self, endp): if hasattr(endp, 'to_basic_block'): @@ -139,14 +139,14 @@ class top_block(object): raise ValueError("unable to coerce endpoint") def disconnect(self, *points): - '''connect requires one or more arguments that can be coerced to endpoints. + '''disconnect requires one or more arguments that can be coerced to endpoints. If more than two arguments are provided, they are disconnected successively. ''' if len (points) < 1: - raise ValueError, ("disconnect requires at least two endpoints; %d provided." % (len (points),)) + raise ValueError, ("disconnect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: - self._tb.disconnect(points[0].to_basic_block()) + self._tb.primitive_disconnect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._disconnect(points[i-1], points[i]) @@ -154,6 +154,6 @@ class top_block(object): def _disconnect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) - self._tb.disconnect(src_block.to_basic_block(), src_port, - dst_block.to_basic_block(), dst_port) + self._tb.primitive_disconnect(src_block.to_basic_block(), src_port, + dst_block.to_basic_block(), dst_port) -- cgit From 76c90f91c5bf06f61f927e002053e397b8f4a706 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 31 Oct 2010 20:06:52 -0700 Subject: Export a few more items --- gnuradio-core/src/lib/swig/gnuradio/coerce.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm index 81bc187a6..4654ad6f8 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm @@ -81,4 +81,4 @@ (loop (1+ n)))))))))) -(export-safely gr:connect gr:disconnect) +(export-safely gr:ep gr:connect gr:disconnect) -- cgit From f2f013ecb94c5e5781952c67496fec09aff7da2c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 31 Oct 2010 20:51:24 -0700 Subject: Rename coerce.scm to runtime-shim.scm. Modify core.scm to use runtime-shim. --- gnuradio-core/src/lib/swig/Makefile.am | 3 +- gnuradio-core/src/lib/swig/gnuradio/coerce.scm | 84 -------------------- gnuradio-core/src/lib/swig/gnuradio/core.scm | 1 + .../src/lib/swig/gnuradio/runtime-shim.scm | 89 ++++++++++++++++++++++ 4 files changed, 92 insertions(+), 85 deletions(-) delete mode 100644 gnuradio-core/src/lib/swig/gnuradio/coerce.scm create mode 100644 gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 2b763d94c..01a5318ec 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -60,8 +60,9 @@ if GUILE # for gnuradio. This has to be installed top level to be found in the # default search path. nobase_guile_DATA = \ - gnuradio/export-safely.scm \ gnuradio/core.scm \ + gnuradio/export-safely.scm \ + gnuradio/runtime-shim.scm \ Swig/common.scm endif diff --git a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm b/gnuradio-core/src/lib/swig/gnuradio/coerce.scm deleted file mode 100644 index 4654ad6f8..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio/coerce.scm +++ /dev/null @@ -1,84 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(define-class () - (block #:accessor block #:init-keyword #:block) - (port #:init-value 0 #:accessor port #:init-keyword #:port)) - -(define (gr:ep block port) - (make - #:block (coerce-to-basic-block block) #:port port)) - -(define (coerce-to-endpoint ep) - (cond ((is-a? ep ) ep) - ((false-if-exception (gr:to-basic-block ep)) - => (lambda (x) (gr:ep x 0))) - ((and (pair? ep) (= 2 (length ep)) - (false-if-exception (gr:to-basic-block (car ep)))) - => (lambda (x) (gr:ep x (cadr ep)))) - (else (error "Cannot coerce to an endpoint: " ep)))) - -(define (coerce-to-basic-block block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-basic-block block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_basic_block: " block)))) - -(define (coerce-to-top-block block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-top-block block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_top_block: " block)))) - -(define (coerce-to-hier-block2 block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_hier_block2: " block)))) - - -;;; Connect one or more block endpoints. An endpoint is either a , -;;; a 2-list (block port), or a block instance. In the latter case, the port number -;;; is assumed to be zero. -;;; -;;; If multiple arguments are provided, connect will attempt to wire them in series, -;;; interpreting the endpoints as inputs or outputs as appropriate. -(define-method (gr:connect hb . points) - (dis/connect "connect" gr:primitive-connect hb points)) - -;;; Disconnect one or more block endpoints... -(define-method (gr:disconnect hb . points) - (dis/connect "disconnect" gr:primitive-disconnect hb points)) - -(define (dis/connect name gf hb points) - (let ((hb (coerce-to-hier-block2 hb)) - (points (list->vector (map coerce-to-endpoint points)))) - - (define (op2 p0 p1) - (gf hb (block p0) (port p0) (block p1) (port p1))) - - (let ((len (vector-length points))) - (case len - ((0) (error (string-append name " requires at least 1 endpoint; None provided."))) - ((1) (gf hb (vector-ref points 0))) - (else - (let loop ((n 1)) - (cond ((< n len) - (op2 (vector-ref points (1- n)) (vector-ref points n)) - (loop (1+ n)))))))))) - - -(export-safely gr:ep gr:connect gr:disconnect) diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm index 294881146..08daeeb34 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/core.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm @@ -2,6 +2,7 @@ (define-module (gnuradio core) #:use-module (gnuradio gnuradio_core_runtime) + #:use-module (gnuradio runtime-shim) #:use-module (gnuradio gnuradio_core_filter) #:use-module (gnuradio gnuradio_core_io) #:use-module (gnuradio gnuradio_core_general) diff --git a/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm b/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm new file mode 100644 index 000000000..c08d3947c --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm @@ -0,0 +1,89 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(define-module (gnuradio runtime-shim) + #:use-module (oop goops) + #:use-module (gnuradio gnuradio_core_runtime) + #:duplicates (merge-generics replace check)) + +(define-class () + (block #:accessor block #:init-keyword #:block) + (port #:init-value 0 #:accessor port #:init-keyword #:port)) + +(define (gr:ep block port) + (make + #:block (coerce-to-basic-block block) #:port port)) + +(define (coerce-to-endpoint ep) + (cond ((is-a? ep ) ep) + ((false-if-exception (gr:to-basic-block ep)) + => (lambda (x) (gr:ep x 0))) + ((and (pair? ep) (= 2 (length ep)) + (false-if-exception (gr:to-basic-block (car ep)))) + => (lambda (x) (gr:ep x (cadr ep)))) + (else (error "Cannot coerce to an endpoint: " ep)))) + +(define (coerce-to-basic-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-basic-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_basic_block: " block)))) + +(define (coerce-to-top-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-top-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_top_block: " block)))) + +(define (coerce-to-hier-block2 block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_hier_block2: " block)))) + + +;;; Connect one or more block endpoints. An endpoint is either a , +;;; a 2-list (block port), or a block instance. In the latter case, the port number +;;; is assumed to be zero. +;;; +;;; If multiple arguments are provided, connect will attempt to wire them in series, +;;; interpreting the endpoints as inputs or outputs as appropriate. +(define-method (gr:connect hb . points) + (dis/connect "connect" gr:primitive-connect hb points)) + +;;; Disconnect one or more block endpoints... +(define-method (gr:disconnect hb . points) + (dis/connect "disconnect" gr:primitive-disconnect hb points)) + +(define (dis/connect name gf hb points) + (let ((hb (coerce-to-hier-block2 hb)) + (points (list->vector (map coerce-to-endpoint points)))) + + (define (op2 p0 p1) + (gf hb (block p0) (port p0) (block p1) (port p1))) + + (let ((len (vector-length points))) + (case len + ((0) (error (string-append name " requires at least 1 endpoint; None provided."))) + ((1) (gf hb (vector-ref points 0))) + (else + (let loop ((n 1)) + (cond ((< n len) + (op2 (vector-ref points (1- n)) (vector-ref points n)) + (loop (1+ n)))))))))) + + +(export-safely gr:ep gr:connect gr:disconnect) -- cgit From f81c5677a40cc538ee7631d02aa24602d571ffb8 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 1 Nov 2010 16:05:08 -0600 Subject: add script names to swig_built_sources, not BUILT_SOURCES. Clean the generated files than now live in subdirectories. --- gnuradio-core/src/lib/swig/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 01a5318ec..54cbebeb1 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -23,9 +23,10 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) -CLEANFILES = python/gnuradio* + +CLEANFILES = python/*.cc python/*.h if GUILE -CLEANFILES += guile/gnuradio* +CLEANFILES += guile/*.cc gnuradio/*.scm endif # ---------------------------------------------------------------- @@ -111,15 +112,14 @@ gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) # include the SWIG-generated .h files in the BUILT SOURCES, since they # aren't by default when using Makefile.swig; order doesn't matter. PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) -#BUILT_SOURCES += $(foreach HFILE,$(PYTHON_GEN), $(subst gnuradio,python/gnuradio,$(HFILE))) -BUILT_SOURCES += $(PYTHON_GEN) +swig_built_sources += $(PYTHON_GEN) endif # end of if python if GUILE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE))) -#GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) -# BUILT_SOURCES += $(foreach HFILE,$(GUILE_GEN), $(subst gnuradio,guile/gnuradio,$(HFILE))) -BUILT_SOURCES += $(GUILE_GEN) +#GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE))) +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) +# GUILE_GEN_STAMPS = $(filter %.scm,$(TOP_SWIG_IFILES)) +swig_built_sources += $(GUILE_GEN) endif # Do not distribute the output of SWIG -- cgit From 2b11c904da6799b6a7240d64d2ba37ddcaf1e479 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 1 Nov 2010 16:06:37 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 90 +++++++++++++--------------- 1 file changed, 42 insertions(+), 48 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 69042f84e..a92ff2231 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -84,10 +84,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_runtime.py -if GUILE -swig_built_sources += gnuradio_core_runtime.scm -endif +# swig_built_sources += gnuradio_core_runtime.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_runtime.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -135,15 +135,14 @@ libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) libguile_gnuradio_core_runtime_la_LDFLAGS = $(_gnuradio_core_runtime_la_LDFLAGS) libguile_gnuradio_core_runtime_la_CXXFLAGS = $(_gnuradio_core_runtime_la_CXXFLAGS) -guile/gnuradio_core_runtime.lo: gnuradio_core_runtime.lo -gnuradio_core_runtime.scm: gnuradio_core_runtime.i -gnuradio/gnuradio_core_runtime-primitive.scm: gnuradio_core_runtime.scm +guile/gnuradio_core_runtime.cc: gnuradio/gnuradio_core_runtime.scm +gnuradio/gnuradio_core_runtime.scm: gnuradio_core_runtime.i +gnuradio/gnuradio_core_runtime-primitive.scm: gnuradio/gnuradio_core_runtime.scm -include guile/gnuradio_core_runtime.d endif # end of GUILE -python/gnuradio_core_runtime.lo: gnuradio_core_runtime.lo: gnuradio_core_runtime.py gnuradio_core_runtime.scm gnuradio_core_runtime.py: gnuradio_core_runtime.i @@ -235,10 +234,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_general.py -if GUILE -swig_built_sources += gnuradio_core_general.scm -endif +# swig_built_sources += gnuradio_core_general.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_general.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -286,15 +285,14 @@ libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) libguile_gnuradio_core_general_la_LDFLAGS = $(_gnuradio_core_general_la_LDFLAGS) libguile_gnuradio_core_general_la_CXXFLAGS = $(_gnuradio_core_general_la_CXXFLAGS) -guile/gnuradio_core_general.lo: gnuradio_core_general.lo -gnuradio_core_general.scm: gnuradio_core_general.i -gnuradio/gnuradio_core_general-primitive.scm: gnuradio_core_general.scm +guile/gnuradio_core_general.cc: gnuradio/gnuradio_core_general.scm +gnuradio/gnuradio_core_general.scm: gnuradio_core_general.i +gnuradio/gnuradio_core_general-primitive.scm: gnuradio/gnuradio_core_general.scm -include guile/gnuradio_core_general.d endif # end of GUILE -python/gnuradio_core_general.lo: gnuradio_core_general.lo: gnuradio_core_general.py gnuradio_core_general.scm gnuradio_core_general.py: gnuradio_core_general.i @@ -386,10 +384,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_gengen.py -if GUILE -swig_built_sources += gnuradio_core_gengen.scm -endif +# swig_built_sources += gnuradio_core_gengen.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_gengen.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -437,15 +435,14 @@ libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) libguile_gnuradio_core_gengen_la_LDFLAGS = $(_gnuradio_core_gengen_la_LDFLAGS) libguile_gnuradio_core_gengen_la_CXXFLAGS = $(_gnuradio_core_gengen_la_CXXFLAGS) -guile/gnuradio_core_gengen.lo: gnuradio_core_gengen.lo -gnuradio_core_gengen.scm: gnuradio_core_gengen.i -gnuradio/gnuradio_core_gengen-primitive.scm: gnuradio_core_gengen.scm +guile/gnuradio_core_gengen.cc: gnuradio/gnuradio_core_gengen.scm +gnuradio/gnuradio_core_gengen.scm: gnuradio_core_gengen.i +gnuradio/gnuradio_core_gengen-primitive.scm: gnuradio/gnuradio_core_gengen.scm -include guile/gnuradio_core_gengen.d endif # end of GUILE -python/gnuradio_core_gengen.lo: gnuradio_core_gengen.lo: gnuradio_core_gengen.py gnuradio_core_gengen.scm gnuradio_core_gengen.py: gnuradio_core_gengen.i @@ -537,10 +534,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_filter.py -if GUILE -swig_built_sources += gnuradio_core_filter.scm -endif +# swig_built_sources += gnuradio_core_filter.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_filter.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -588,15 +585,14 @@ libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) libguile_gnuradio_core_filter_la_LDFLAGS = $(_gnuradio_core_filter_la_LDFLAGS) libguile_gnuradio_core_filter_la_CXXFLAGS = $(_gnuradio_core_filter_la_CXXFLAGS) -guile/gnuradio_core_filter.lo: gnuradio_core_filter.lo -gnuradio_core_filter.scm: gnuradio_core_filter.i -gnuradio/gnuradio_core_filter-primitive.scm: gnuradio_core_filter.scm +guile/gnuradio_core_filter.cc: gnuradio/gnuradio_core_filter.scm +gnuradio/gnuradio_core_filter.scm: gnuradio_core_filter.i +gnuradio/gnuradio_core_filter-primitive.scm: gnuradio/gnuradio_core_filter.scm -include guile/gnuradio_core_filter.d endif # end of GUILE -python/gnuradio_core_filter.lo: gnuradio_core_filter.lo: gnuradio_core_filter.py gnuradio_core_filter.scm gnuradio_core_filter.py: gnuradio_core_filter.i @@ -688,10 +684,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_io.py -if GUILE -swig_built_sources += gnuradio_core_io.scm -endif +# swig_built_sources += gnuradio_core_io.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_io.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -739,15 +735,14 @@ libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) libguile_gnuradio_core_io_la_LDFLAGS = $(_gnuradio_core_io_la_LDFLAGS) libguile_gnuradio_core_io_la_CXXFLAGS = $(_gnuradio_core_io_la_CXXFLAGS) -guile/gnuradio_core_io.lo: gnuradio_core_io.lo -gnuradio_core_io.scm: gnuradio_core_io.i -gnuradio/gnuradio_core_io-primitive.scm: gnuradio_core_io.scm +guile/gnuradio_core_io.cc: gnuradio/gnuradio_core_io.scm +gnuradio/gnuradio_core_io.scm: gnuradio_core_io.i +gnuradio/gnuradio_core_io-primitive.scm: gnuradio/gnuradio_core_io.scm -include guile/gnuradio_core_io.d endif # end of GUILE -python/gnuradio_core_io.lo: gnuradio_core_io.lo: gnuradio_core_io.py gnuradio_core_io.scm gnuradio_core_io.py: gnuradio_core_io.i @@ -839,10 +834,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += gnuradio_core_hier.py -if GUILE -swig_built_sources += gnuradio_core_hier.scm -endif +# swig_built_sources += gnuradio_core_hier.py +# if GUILE +# swig_built_sources += gnuradio/gnuradio_core_hier.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -890,15 +885,14 @@ libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) libguile_gnuradio_core_hier_la_LDFLAGS = $(_gnuradio_core_hier_la_LDFLAGS) libguile_gnuradio_core_hier_la_CXXFLAGS = $(_gnuradio_core_hier_la_CXXFLAGS) -guile/gnuradio_core_hier.lo: gnuradio_core_hier.lo -gnuradio_core_hier.scm: gnuradio_core_hier.i -gnuradio/gnuradio_core_hier-primitive.scm: gnuradio_core_hier.scm +guile/gnuradio_core_hier.cc: gnuradio/gnuradio_core_hier.scm +gnuradio/gnuradio_core_hier.scm: gnuradio_core_hier.i +gnuradio/gnuradio_core_hier-primitive.scm: gnuradio/gnuradio_core_hier.scm -include guile/gnuradio_core_hier.d endif # end of GUILE -python/gnuradio_core_hier.lo: gnuradio_core_hier.lo: gnuradio_core_hier.py gnuradio_core_hier.scm gnuradio_core_hier.py: gnuradio_core_hier.i -- cgit From 0939607d0b4a3ae047ceff60fab300000c7d2069 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 1 Nov 2010 19:02:55 -0600 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 222 ++++++++------------------- 1 file changed, 60 insertions(+), 162 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index a92ff2231..0803cbfee 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -67,28 +67,10 @@ gnuradio_core_runtime_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_runtime-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_runtime.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_runtime.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -108,8 +90,6 @@ _gnuradio_core_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_runtime_la_swig_libadd) -# _gnuradio_core_runtime_la_DEPENDENCIES = python/gnuradio_core_runtime.lo - _gnuradio_core_runtime_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_runtime_la_swig_ldflags) @@ -123,14 +103,20 @@ gnuradio_core_runtime_python_PYTHON = \ gnuradio_core_runtime.py \ $(gnuradio_core_runtime) +python/gnuradio_core_runtime.cc: gnuradio_core_runtime.py +gnuradio_core_runtime.py: gnuradio_core_runtime.i + +# Include the python dependencies for this file +-include python/gnuradio_core_runtime.d +# end of PYTHON + if GUILE gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la -libguile_gnuradio_core_runtime_la_SOURCES = \ - guile/gnuradio_core_runtime.cc \ +libguile_gnuradio_core_runtime_la_SOURCES = \ + guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) libguile_gnuradio_core_runtime_la_LDFLAGS = $(_gnuradio_core_runtime_la_LDFLAGS) libguile_gnuradio_core_runtime_la_CXXFLAGS = $(_gnuradio_core_runtime_la_CXXFLAGS) @@ -139,14 +125,11 @@ guile/gnuradio_core_runtime.cc: gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime.scm: gnuradio_core_runtime.i gnuradio/gnuradio_core_runtime-primitive.scm: gnuradio/gnuradio_core_runtime.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_runtime.d endif # end of GUILE -gnuradio_core_runtime.lo: gnuradio_core_runtime.py gnuradio_core_runtime.scm -gnuradio_core_runtime.py: gnuradio_core_runtime.i - --include python/gnuradio_core_runtime.d # -*- Makefile -*- # @@ -217,28 +200,10 @@ gnuradio_core_general_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_general-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_general.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_general.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -258,8 +223,6 @@ _gnuradio_core_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_general_la_swig_libadd) -# _gnuradio_core_general_la_DEPENDENCIES = python/gnuradio_core_general.lo - _gnuradio_core_general_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_general_la_swig_ldflags) @@ -273,14 +236,20 @@ gnuradio_core_general_python_PYTHON = \ gnuradio_core_general.py \ $(gnuradio_core_general) +python/gnuradio_core_general.cc: gnuradio_core_general.py +gnuradio_core_general.py: gnuradio_core_general.i + +# Include the python dependencies for this file +-include python/gnuradio_core_general.d +# end of PYTHON + if GUILE gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la -libguile_gnuradio_core_general_la_SOURCES = \ - guile/gnuradio_core_general.cc \ +libguile_gnuradio_core_general_la_SOURCES = \ + guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) libguile_gnuradio_core_general_la_LDFLAGS = $(_gnuradio_core_general_la_LDFLAGS) libguile_gnuradio_core_general_la_CXXFLAGS = $(_gnuradio_core_general_la_CXXFLAGS) @@ -289,14 +258,11 @@ guile/gnuradio_core_general.cc: gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general.scm: gnuradio_core_general.i gnuradio/gnuradio_core_general-primitive.scm: gnuradio/gnuradio_core_general.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_general.d endif # end of GUILE -gnuradio_core_general.lo: gnuradio_core_general.py gnuradio_core_general.scm -gnuradio_core_general.py: gnuradio_core_general.i - --include python/gnuradio_core_general.d # -*- Makefile -*- # @@ -367,28 +333,10 @@ gnuradio_core_gengen_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_gengen-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_gengen.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_gengen.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -408,8 +356,6 @@ _gnuradio_core_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_gengen_la_swig_libadd) -# _gnuradio_core_gengen_la_DEPENDENCIES = python/gnuradio_core_gengen.lo - _gnuradio_core_gengen_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_gengen_la_swig_ldflags) @@ -423,14 +369,20 @@ gnuradio_core_gengen_python_PYTHON = \ gnuradio_core_gengen.py \ $(gnuradio_core_gengen) +python/gnuradio_core_gengen.cc: gnuradio_core_gengen.py +gnuradio_core_gengen.py: gnuradio_core_gengen.i + +# Include the python dependencies for this file +-include python/gnuradio_core_gengen.d +# end of PYTHON + if GUILE gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la -libguile_gnuradio_core_gengen_la_SOURCES = \ - guile/gnuradio_core_gengen.cc \ +libguile_gnuradio_core_gengen_la_SOURCES = \ + guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) libguile_gnuradio_core_gengen_la_LDFLAGS = $(_gnuradio_core_gengen_la_LDFLAGS) libguile_gnuradio_core_gengen_la_CXXFLAGS = $(_gnuradio_core_gengen_la_CXXFLAGS) @@ -439,14 +391,11 @@ guile/gnuradio_core_gengen.cc: gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen.scm: gnuradio_core_gengen.i gnuradio/gnuradio_core_gengen-primitive.scm: gnuradio/gnuradio_core_gengen.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_gengen.d endif # end of GUILE -gnuradio_core_gengen.lo: gnuradio_core_gengen.py gnuradio_core_gengen.scm -gnuradio_core_gengen.py: gnuradio_core_gengen.i - --include python/gnuradio_core_gengen.d # -*- Makefile -*- # @@ -517,28 +466,10 @@ gnuradio_core_filter_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_filter-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_filter.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_filter.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -558,8 +489,6 @@ _gnuradio_core_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_filter_la_swig_libadd) -# _gnuradio_core_filter_la_DEPENDENCIES = python/gnuradio_core_filter.lo - _gnuradio_core_filter_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_filter_la_swig_ldflags) @@ -573,14 +502,20 @@ gnuradio_core_filter_python_PYTHON = \ gnuradio_core_filter.py \ $(gnuradio_core_filter) +python/gnuradio_core_filter.cc: gnuradio_core_filter.py +gnuradio_core_filter.py: gnuradio_core_filter.i + +# Include the python dependencies for this file +-include python/gnuradio_core_filter.d +# end of PYTHON + if GUILE gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la -libguile_gnuradio_core_filter_la_SOURCES = \ - guile/gnuradio_core_filter.cc \ +libguile_gnuradio_core_filter_la_SOURCES = \ + guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) libguile_gnuradio_core_filter_la_LDFLAGS = $(_gnuradio_core_filter_la_LDFLAGS) libguile_gnuradio_core_filter_la_CXXFLAGS = $(_gnuradio_core_filter_la_CXXFLAGS) @@ -589,14 +524,11 @@ guile/gnuradio_core_filter.cc: gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter.scm: gnuradio_core_filter.i gnuradio/gnuradio_core_filter-primitive.scm: gnuradio/gnuradio_core_filter.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_filter.d endif # end of GUILE -gnuradio_core_filter.lo: gnuradio_core_filter.py gnuradio_core_filter.scm -gnuradio_core_filter.py: gnuradio_core_filter.i - --include python/gnuradio_core_filter.d # -*- Makefile -*- # @@ -667,28 +599,10 @@ gnuradio_core_io_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_io-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_io.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_io.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -708,8 +622,6 @@ _gnuradio_core_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_io_la_swig_libadd) -# _gnuradio_core_io_la_DEPENDENCIES = python/gnuradio_core_io.lo - _gnuradio_core_io_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_io_la_swig_ldflags) @@ -723,14 +635,20 @@ gnuradio_core_io_python_PYTHON = \ gnuradio_core_io.py \ $(gnuradio_core_io) +python/gnuradio_core_io.cc: gnuradio_core_io.py +gnuradio_core_io.py: gnuradio_core_io.i + +# Include the python dependencies for this file +-include python/gnuradio_core_io.d +# end of PYTHON + if GUILE gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la -libguile_gnuradio_core_io_la_SOURCES = \ - guile/gnuradio_core_io.cc \ +libguile_gnuradio_core_io_la_SOURCES = \ + guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) libguile_gnuradio_core_io_la_LDFLAGS = $(_gnuradio_core_io_la_LDFLAGS) libguile_gnuradio_core_io_la_CXXFLAGS = $(_gnuradio_core_io_la_CXXFLAGS) @@ -739,14 +657,11 @@ guile/gnuradio_core_io.cc: gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io.scm: gnuradio_core_io.i gnuradio/gnuradio_core_io-primitive.scm: gnuradio/gnuradio_core_io.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_io.d endif # end of GUILE -gnuradio_core_io.lo: gnuradio_core_io.py gnuradio_core_io.scm -gnuradio_core_io.py: gnuradio_core_io.i - --include python/gnuradio_core_io.d # -*- Makefile -*- # @@ -817,28 +732,10 @@ gnuradio_core_hier_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/gnuradio_core_hier-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += gnuradio_core_hier.py -# if GUILE -# swig_built_sources += gnuradio/gnuradio_core_hier.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -858,8 +755,6 @@ _gnuradio_core_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_hier_la_swig_libadd) -# _gnuradio_core_hier_la_DEPENDENCIES = python/gnuradio_core_hier.lo - _gnuradio_core_hier_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_hier_la_swig_ldflags) @@ -873,14 +768,20 @@ gnuradio_core_hier_python_PYTHON = \ gnuradio_core_hier.py \ $(gnuradio_core_hier) +python/gnuradio_core_hier.cc: gnuradio_core_hier.py +gnuradio_core_hier.py: gnuradio_core_hier.i + +# Include the python dependencies for this file +-include python/gnuradio_core_hier.d +# end of PYTHON + if GUILE gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la -libguile_gnuradio_core_hier_la_SOURCES = \ - guile/gnuradio_core_hier.cc \ +libguile_gnuradio_core_hier_la_SOURCES = \ + guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primitive.scm -# Guile can use the same flags as python does libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) libguile_gnuradio_core_hier_la_LDFLAGS = $(_gnuradio_core_hier_la_LDFLAGS) libguile_gnuradio_core_hier_la_CXXFLAGS = $(_gnuradio_core_hier_la_CXXFLAGS) @@ -889,12 +790,9 @@ guile/gnuradio_core_hier.cc: gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier.scm: gnuradio_core_hier.i gnuradio/gnuradio_core_hier-primitive.scm: gnuradio/gnuradio_core_hier.scm +# Include the guile dependencies for this file -include guile/gnuradio_core_hier.d endif # end of GUILE -gnuradio_core_hier.lo: gnuradio_core_hier.py gnuradio_core_hier.scm -gnuradio_core_hier.py: gnuradio_core_hier.i - --include python/gnuradio_core_hier.d -- cgit From 406bd9d6725b58736959eb705235bb50fe48d48d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 1 Nov 2010 21:20:05 -0700 Subject: Reduce guile load time from 4.5 to 1.2 seconds. Rewrite re-export-all to only export symbols from the module name supplied. --- gnuradio-core/src/lib/swig/gnuradio/core.scm | 9 +++++++-- .../src/lib/swig/gnuradio/export-safely.scm | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm index 08daeeb34..f13a8fb60 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/core.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm @@ -10,5 +10,10 @@ #:use-module (gnuradio gnuradio_core_hier) #:duplicates (merge-generics check)) -;; re-export everything... -(re-export-all (current-module)) +(re-export-all '(gnuradio gnuradio_core_runtime)) +(re-export-all '(gnuradio runtime-shim)) +(re-export-all '(gnuradio gnuradio_core_filter)) +(re-export-all '(gnuradio gnuradio_core_io)) +(re-export-all '(gnuradio gnuradio_core_general)) +(re-export-all '(gnuradio gnuradio_core_gengen)) +(re-export-all '(gnuradio gnuradio_core_hier)) diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm index 2da7e633e..664292d2b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm @@ -75,13 +75,16 @@ (define-public (names-in-imported-modules module) (delete-duplicates (concatenate (map names-in-module (module-uses module))))) -(define-public (re-export-all module) - (define (ok-to-re-export? name) - (let ((var (module-variable module name))) - (cond ((not var) #f) ; Undefined var - ((eq? var (module-local-variable module name)) #f) ; local var - (else #t)))) ; OK +(define-public (re-export-all src-module-name) + (let ((current (current-module)) + (src-module (resolve-interface src-module-name))) - (module-re-export! module - (filter ok-to-re-export? - (names-in-imported-modules module)))) + (define (ok-to-re-export? name) + (let ((var (module-variable current name))) + (cond ((not var) #f) ; Undefined var + ((eq? var (module-local-variable current name)) #f) ; local var + (else #t)))) ; OK + + (module-re-export! current + (filter ok-to-re-export? + (names-in-module src-module))))) -- cgit From 81867e5dfd939d8afdacbe22c6e2d41d4bc4b37e Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 19:43:33 -0700 Subject: Create guile QA framework. Also moves hand coded files out of gnuradio-core/src/lib/swig/gnuradio that were getting nuked by make clean. --- gnuradio-core/src/Makefile.am | 7 +- gnuradio-core/src/guile/.gitignore | 3 + gnuradio-core/src/guile/Makefile.am | 38 +++++++++ gnuradio-core/src/guile/Swig/common.scm | 76 ++++++++++++++++++ gnuradio-core/src/guile/gnuradio/core.scm | 19 +++++ gnuradio-core/src/guile/gnuradio/export-safely.scm | 90 ++++++++++++++++++++++ gnuradio-core/src/guile/gnuradio/runtime-shim.scm | 89 +++++++++++++++++++++ gnuradio-core/src/guile/qa_stub.scm | 0 gnuradio-core/src/guile/run_guile_tests.in | 12 +++ gnuradio-core/src/lib/swig/Makefile.am | 12 --- gnuradio-core/src/lib/swig/Swig/common.scm | 76 ------------------ gnuradio-core/src/lib/swig/gnuradio/core.scm | 19 ----- .../src/lib/swig/gnuradio/export-safely.scm | 90 ---------------------- .../src/lib/swig/gnuradio/runtime-shim.scm | 89 --------------------- 14 files changed, 332 insertions(+), 288 deletions(-) create mode 100644 gnuradio-core/src/guile/.gitignore create mode 100644 gnuradio-core/src/guile/Makefile.am create mode 100644 gnuradio-core/src/guile/Swig/common.scm create mode 100644 gnuradio-core/src/guile/gnuradio/core.scm create mode 100644 gnuradio-core/src/guile/gnuradio/export-safely.scm create mode 100644 gnuradio-core/src/guile/gnuradio/runtime-shim.scm create mode 100644 gnuradio-core/src/guile/qa_stub.scm create mode 100644 gnuradio-core/src/guile/run_guile_tests.in delete mode 100644 gnuradio-core/src/lib/swig/Swig/common.scm delete mode 100644 gnuradio-core/src/lib/swig/gnuradio/core.scm delete mode 100644 gnuradio-core/src/lib/swig/gnuradio/export-safely.scm delete mode 100644 gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/Makefile.am b/gnuradio-core/src/Makefile.am index eb979fe58..648fe299e 100644 --- a/gnuradio-core/src/Makefile.am +++ b/gnuradio-core/src/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001,2004,2009 Free Software Foundation, Inc. +# Copyright 2001,2004,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,5 +25,8 @@ SUBDIRS = gen_interpolator_taps lib tests if PYTHON SUBDIRS += python endif +if GUILE +SUBDIRS += guile +endif -DIST_SUBDIRS = gen_interpolator_taps lib tests python utils +DIST_SUBDIRS = gen_interpolator_taps lib tests python guile utils diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore new file mode 100644 index 000000000..6a0410b79 --- /dev/null +++ b/gnuradio-core/src/guile/.gitignore @@ -0,0 +1,3 @@ +/Makefile +/Makefile.in +/run_guile_tests diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am new file mode 100644 index 000000000..3c21373af --- /dev/null +++ b/gnuradio-core/src/guile/Makefile.am @@ -0,0 +1,38 @@ +# +# Copyright 2010 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 this program. If not, see . +# + +include $(top_srcdir)/Makefile.common + +TESTS = run_guile_tests + +EXTRA_DIST = run_guile_tests.in + +# These are the hand-code guile files for gnuradio-core. +# +# Swig/common.scm is glue that's required for the goops wrappers. +# gnuradio/export-safely.scm works around some problems in the goops generated wrappers. +# gnuradio/core.scm glues the 5 pieces of gnuradio_core_* into a single module. +# gnuradio/runtime-shim implements "guile friendly" versions of connect & disconnect. + +nobase_guile_DATA = \ + Swig/common.scm \ + gnuradio/core.scm \ + gnuradio/export-safely.scm \ + gnuradio/runtime-shim.scm + diff --git a/gnuradio-core/src/guile/Swig/common.scm b/gnuradio-core/src/guile/Swig/common.scm new file mode 100644 index 000000000..a51d3a71d --- /dev/null +++ b/gnuradio-core/src/guile/Swig/common.scm @@ -0,0 +1,76 @@ +;;;************************************************************************ +;;;*common.scm +;;;* +;;;* This file contains generic SWIG GOOPS classes for generated +;;;* GOOPS file support +;;;* +;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu) +;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) +;;;* +;;;* This file may be freely redistributed without license or fee provided +;;;* this copyright message remains intact. +;;;************************************************************************ + +(define-module (Swig swigrun)) + +(define-module (Swig common) + #:use-module (oop goops) + #:use-module (Swig swigrun)) + +(define-class () + (new-function #:init-value #f)) + +(define-method (initialize (class ) initargs) + (slot-set! class 'new-function (get-keyword #:new-function initargs #f)) + (next-method)) + +(define-class () + (swig-smob #:init-value #f) + #:metaclass +) + +(define-method (initialize (obj ) initargs) + (next-method) + (slot-set! obj 'swig-smob + (let ((arg (get-keyword #:init-smob initargs #f))) + (if arg + arg + (let ((ret (apply (slot-ref (class-of obj) 'new-function) (get-keyword #:args initargs '())))) + ;; if the class is registered with runtime environment, + ;; new-Function will return a goops class. In that case, extract the smob + ;; from that goops class and set it as the current smob. + (if (slot-exists? ret 'swig-smob) + (slot-ref ret 'swig-smob) + ret)))))) + +(define (display-address o file) + (display (number->string (object-address o) 16) file)) + +(define (display-pointer-address o file) + ;; Don't fail if the function SWIG-PointerAddress is not present. + (let ((address (false-if-exception (SWIG-PointerAddress o)))) + (if address + (begin + (display " @ " file) + (display (number->string address 16) file))))) + +(define-method (write (o ) file) + ;; We display _two_ addresses to show the object's identity: + ;; * first the address of the GOOPS proxy object, + ;; * second the pointer address. + ;; The reason is that proxy objects are created and discarded on the + ;; fly, so different proxy objects for the same C object will appear. + (let ((class (class-of o))) + (if (slot-bound? class 'name) + (begin + (display "#<" file) + (display (class-name class) file) + (display #\space file) + (display-address o file) + (display-pointer-address o file) + (display ">" file)) + (next-method)))) + +(export ) + +;;; common.scm ends here diff --git a/gnuradio-core/src/guile/gnuradio/core.scm b/gnuradio-core/src/guile/gnuradio/core.scm new file mode 100644 index 000000000..f13a8fb60 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/core.scm @@ -0,0 +1,19 @@ +;;; Glue the separate pieces of gnuradio-core into a single module + +(define-module (gnuradio core) + #:use-module (gnuradio gnuradio_core_runtime) + #:use-module (gnuradio runtime-shim) + #:use-module (gnuradio gnuradio_core_filter) + #:use-module (gnuradio gnuradio_core_io) + #:use-module (gnuradio gnuradio_core_general) + #:use-module (gnuradio gnuradio_core_gengen) + #:use-module (gnuradio gnuradio_core_hier) + #:duplicates (merge-generics check)) + +(re-export-all '(gnuradio gnuradio_core_runtime)) +(re-export-all '(gnuradio runtime-shim)) +(re-export-all '(gnuradio gnuradio_core_filter)) +(re-export-all '(gnuradio gnuradio_core_io)) +(re-export-all '(gnuradio gnuradio_core_general)) +(re-export-all '(gnuradio gnuradio_core_gengen)) +(re-export-all '(gnuradio gnuradio_core_hier)) diff --git a/gnuradio-core/src/guile/gnuradio/export-safely.scm b/gnuradio-core/src/guile/gnuradio/export-safely.scm new file mode 100644 index 000000000..664292d2b --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/export-safely.scm @@ -0,0 +1,90 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; This module implements a macro, export-safely, that avoids +;;; exporting symbols that are actually generic-functions imported +;;; (explicity or implicitly) from elsewhere. +;;; +;;; This hackery is required so that the swig generated goops wrappers +;;; don't stomp on each other. For background on what this is about +;;; see this thread: +;;; +;;; http://lists.gnu.org/archive/html/guile-user/2006-05/msg00007.html +;;; +;;; Don't expect to understand what's going on here without looking at +;;; the guts of the module system (implemented in ice-9/boot-9.scm) and +;;; having a pretty good understanding of goops and generic-functions. + + +(define-module (gnuradio export-safely) + #:use-module (oop goops) + #:use-module (srfi srfi-1) + #:export-syntax (export-safely)) + +(define-public (generics-in-module module) + (let ((lst '())) + (module-for-each (lambda (sym var) + (if (variable-bound? var) + (let ((v (variable-ref var))) + (cond ((is-a? v ) + (set! lst (cons v lst))))))) + module) + lst)) + +(define-public (generic-function-names-in-module module) + (map generic-function-name (generics-in-module module))) + +(define-public (generic-function-names-in-imported-modules module) + (concatenate (map generic-function-names-in-module (module-uses module)))) + +(define-public (export-syms-if-not-imported-gf list-of-syms) + (let ((gf-names (generic-function-names-in-imported-modules (current-module)))) + (let ((to-export (filter (lambda (sym) + (not (memq sym gf-names))) + (delete-duplicates list-of-syms)))) + (module-export! (current-module) to-export)))) + +(defmacro export-safely names + `(export-syms-if-not-imported-gf ',names)) + + +(define-public (names-in-module module) + (let ((lst '())) + (module-for-each (lambda (sym var) + (if (variable-bound? var) + (set! lst (cons sym lst)))) + module) + lst)) + +(define-public (names-in-imported-modules module) + (delete-duplicates (concatenate (map names-in-module (module-uses module))))) + +(define-public (re-export-all src-module-name) + (let ((current (current-module)) + (src-module (resolve-interface src-module-name))) + + (define (ok-to-re-export? name) + (let ((var (module-variable current name))) + (cond ((not var) #f) ; Undefined var + ((eq? var (module-local-variable current name)) #f) ; local var + (else #t)))) ; OK + + (module-re-export! current + (filter ok-to-re-export? + (names-in-module src-module))))) diff --git a/gnuradio-core/src/guile/gnuradio/runtime-shim.scm b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm new file mode 100644 index 000000000..c08d3947c --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm @@ -0,0 +1,89 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(define-module (gnuradio runtime-shim) + #:use-module (oop goops) + #:use-module (gnuradio gnuradio_core_runtime) + #:duplicates (merge-generics replace check)) + +(define-class () + (block #:accessor block #:init-keyword #:block) + (port #:init-value 0 #:accessor port #:init-keyword #:port)) + +(define (gr:ep block port) + (make + #:block (coerce-to-basic-block block) #:port port)) + +(define (coerce-to-endpoint ep) + (cond ((is-a? ep ) ep) + ((false-if-exception (gr:to-basic-block ep)) + => (lambda (x) (gr:ep x 0))) + ((and (pair? ep) (= 2 (length ep)) + (false-if-exception (gr:to-basic-block (car ep)))) + => (lambda (x) (gr:ep x (cadr ep)))) + (else (error "Cannot coerce to an endpoint: " ep)))) + +(define (coerce-to-basic-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-basic-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_basic_block: " block)))) + +(define (coerce-to-top-block block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-top-block block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_top_block: " block)))) + +(define (coerce-to-hier-block2 block) + (cond ((is-a? block ) block) + ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) + (else (error "Cannot coerce to a gr_hier_block2: " block)))) + + +;;; Connect one or more block endpoints. An endpoint is either a , +;;; a 2-list (block port), or a block instance. In the latter case, the port number +;;; is assumed to be zero. +;;; +;;; If multiple arguments are provided, connect will attempt to wire them in series, +;;; interpreting the endpoints as inputs or outputs as appropriate. +(define-method (gr:connect hb . points) + (dis/connect "connect" gr:primitive-connect hb points)) + +;;; Disconnect one or more block endpoints... +(define-method (gr:disconnect hb . points) + (dis/connect "disconnect" gr:primitive-disconnect hb points)) + +(define (dis/connect name gf hb points) + (let ((hb (coerce-to-hier-block2 hb)) + (points (list->vector (map coerce-to-endpoint points)))) + + (define (op2 p0 p1) + (gf hb (block p0) (port p0) (block p1) (port p1))) + + (let ((len (vector-length points))) + (case len + ((0) (error (string-append name " requires at least 1 endpoint; None provided."))) + ((1) (gf hb (vector-ref points 0))) + (else + (let loop ((n 1)) + (cond ((< n len) + (op2 (vector-ref points (1- n)) (vector-ref points n)) + (loop (1+ n)))))))))) + + +(export-safely gr:ep gr:connect gr:disconnect) diff --git a/gnuradio-core/src/guile/qa_stub.scm b/gnuradio-core/src/guile/qa_stub.scm new file mode 100644 index 000000000..e69de29bb diff --git a/gnuradio-core/src/guile/run_guile_tests.in b/gnuradio-core/src/guile/run_guile_tests.in new file mode 100644 index 000000000..2ef160397 --- /dev/null +++ b/gnuradio-core/src/guile/run_guile_tests.in @@ -0,0 +1,12 @@ +#!/bin/sh + +# 1st argument is absolute path to component C++ shared library build directory +# 2nd argument is absolute path to hand coded guile source directory +# 3nd argument is absolute path to component SWIG build directory +# 4rd argument is absolute path to component Guile QA test directory + +@top_builddir@/run_guile_tests.sh \ + "" \ + "" \ + "" \ + @abs_top_srcdir@/gnuradio-core/src/guile diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 54cbebeb1..5e003bdf2 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -56,18 +56,6 @@ nobase_swiginclude_HEADERS = \ guile/std_complex.i -if GUILE -# This is the top level guile file, which loads all the other scm files -# for gnuradio. This has to be installed top level to be found in the -# default search path. -nobase_guile_DATA = \ - gnuradio/core.scm \ - gnuradio/export-safely.scm \ - gnuradio/runtime-shim.scm \ - Swig/common.scm -endif - - if PYTHON AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) diff --git a/gnuradio-core/src/lib/swig/Swig/common.scm b/gnuradio-core/src/lib/swig/Swig/common.scm deleted file mode 100644 index a51d3a71d..000000000 --- a/gnuradio-core/src/lib/swig/Swig/common.scm +++ /dev/null @@ -1,76 +0,0 @@ -;;;************************************************************************ -;;;*common.scm -;;;* -;;;* This file contains generic SWIG GOOPS classes for generated -;;;* GOOPS file support -;;;* -;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu) -;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) -;;;* -;;;* This file may be freely redistributed without license or fee provided -;;;* this copyright message remains intact. -;;;************************************************************************ - -(define-module (Swig swigrun)) - -(define-module (Swig common) - #:use-module (oop goops) - #:use-module (Swig swigrun)) - -(define-class () - (new-function #:init-value #f)) - -(define-method (initialize (class ) initargs) - (slot-set! class 'new-function (get-keyword #:new-function initargs #f)) - (next-method)) - -(define-class () - (swig-smob #:init-value #f) - #:metaclass -) - -(define-method (initialize (obj ) initargs) - (next-method) - (slot-set! obj 'swig-smob - (let ((arg (get-keyword #:init-smob initargs #f))) - (if arg - arg - (let ((ret (apply (slot-ref (class-of obj) 'new-function) (get-keyword #:args initargs '())))) - ;; if the class is registered with runtime environment, - ;; new-Function will return a goops class. In that case, extract the smob - ;; from that goops class and set it as the current smob. - (if (slot-exists? ret 'swig-smob) - (slot-ref ret 'swig-smob) - ret)))))) - -(define (display-address o file) - (display (number->string (object-address o) 16) file)) - -(define (display-pointer-address o file) - ;; Don't fail if the function SWIG-PointerAddress is not present. - (let ((address (false-if-exception (SWIG-PointerAddress o)))) - (if address - (begin - (display " @ " file) - (display (number->string address 16) file))))) - -(define-method (write (o ) file) - ;; We display _two_ addresses to show the object's identity: - ;; * first the address of the GOOPS proxy object, - ;; * second the pointer address. - ;; The reason is that proxy objects are created and discarded on the - ;; fly, so different proxy objects for the same C object will appear. - (let ((class (class-of o))) - (if (slot-bound? class 'name) - (begin - (display "#<" file) - (display (class-name class) file) - (display #\space file) - (display-address o file) - (display-pointer-address o file) - (display ">" file)) - (next-method)))) - -(export ) - -;;; common.scm ends here diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm deleted file mode 100644 index f13a8fb60..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio/core.scm +++ /dev/null @@ -1,19 +0,0 @@ -;;; Glue the separate pieces of gnuradio-core into a single module - -(define-module (gnuradio core) - #:use-module (gnuradio gnuradio_core_runtime) - #:use-module (gnuradio runtime-shim) - #:use-module (gnuradio gnuradio_core_filter) - #:use-module (gnuradio gnuradio_core_io) - #:use-module (gnuradio gnuradio_core_general) - #:use-module (gnuradio gnuradio_core_gengen) - #:use-module (gnuradio gnuradio_core_hier) - #:duplicates (merge-generics check)) - -(re-export-all '(gnuradio gnuradio_core_runtime)) -(re-export-all '(gnuradio runtime-shim)) -(re-export-all '(gnuradio gnuradio_core_filter)) -(re-export-all '(gnuradio gnuradio_core_io)) -(re-export-all '(gnuradio gnuradio_core_general)) -(re-export-all '(gnuradio gnuradio_core_gengen)) -(re-export-all '(gnuradio gnuradio_core_hier)) diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm deleted file mode 100644 index 664292d2b..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm +++ /dev/null @@ -1,90 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; This module implements a macro, export-safely, that avoids -;;; exporting symbols that are actually generic-functions imported -;;; (explicity or implicitly) from elsewhere. -;;; -;;; This hackery is required so that the swig generated goops wrappers -;;; don't stomp on each other. For background on what this is about -;;; see this thread: -;;; -;;; http://lists.gnu.org/archive/html/guile-user/2006-05/msg00007.html -;;; -;;; Don't expect to understand what's going on here without looking at -;;; the guts of the module system (implemented in ice-9/boot-9.scm) and -;;; having a pretty good understanding of goops and generic-functions. - - -(define-module (gnuradio export-safely) - #:use-module (oop goops) - #:use-module (srfi srfi-1) - #:export-syntax (export-safely)) - -(define-public (generics-in-module module) - (let ((lst '())) - (module-for-each (lambda (sym var) - (if (variable-bound? var) - (let ((v (variable-ref var))) - (cond ((is-a? v ) - (set! lst (cons v lst))))))) - module) - lst)) - -(define-public (generic-function-names-in-module module) - (map generic-function-name (generics-in-module module))) - -(define-public (generic-function-names-in-imported-modules module) - (concatenate (map generic-function-names-in-module (module-uses module)))) - -(define-public (export-syms-if-not-imported-gf list-of-syms) - (let ((gf-names (generic-function-names-in-imported-modules (current-module)))) - (let ((to-export (filter (lambda (sym) - (not (memq sym gf-names))) - (delete-duplicates list-of-syms)))) - (module-export! (current-module) to-export)))) - -(defmacro export-safely names - `(export-syms-if-not-imported-gf ',names)) - - -(define-public (names-in-module module) - (let ((lst '())) - (module-for-each (lambda (sym var) - (if (variable-bound? var) - (set! lst (cons sym lst)))) - module) - lst)) - -(define-public (names-in-imported-modules module) - (delete-duplicates (concatenate (map names-in-module (module-uses module))))) - -(define-public (re-export-all src-module-name) - (let ((current (current-module)) - (src-module (resolve-interface src-module-name))) - - (define (ok-to-re-export? name) - (let ((var (module-variable current name))) - (cond ((not var) #f) ; Undefined var - ((eq? var (module-local-variable current name)) #f) ; local var - (else #t)))) ; OK - - (module-re-export! current - (filter ok-to-re-export? - (names-in-module src-module))))) diff --git a/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm b/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm deleted file mode 100644 index c08d3947c..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio/runtime-shim.scm +++ /dev/null @@ -1,89 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(define-module (gnuradio runtime-shim) - #:use-module (oop goops) - #:use-module (gnuradio gnuradio_core_runtime) - #:duplicates (merge-generics replace check)) - -(define-class () - (block #:accessor block #:init-keyword #:block) - (port #:init-value 0 #:accessor port #:init-keyword #:port)) - -(define (gr:ep block port) - (make - #:block (coerce-to-basic-block block) #:port port)) - -(define (coerce-to-endpoint ep) - (cond ((is-a? ep ) ep) - ((false-if-exception (gr:to-basic-block ep)) - => (lambda (x) (gr:ep x 0))) - ((and (pair? ep) (= 2 (length ep)) - (false-if-exception (gr:to-basic-block (car ep)))) - => (lambda (x) (gr:ep x (cadr ep)))) - (else (error "Cannot coerce to an endpoint: " ep)))) - -(define (coerce-to-basic-block block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-basic-block block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_basic_block: " block)))) - -(define (coerce-to-top-block block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-top-block block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_top_block: " block)))) - -(define (coerce-to-hier-block2 block) - (cond ((is-a? block ) block) - ((false-if-exception (gr:to-hier-block2 block)) => (lambda (x) x)) - (else (error "Cannot coerce to a gr_hier_block2: " block)))) - - -;;; Connect one or more block endpoints. An endpoint is either a , -;;; a 2-list (block port), or a block instance. In the latter case, the port number -;;; is assumed to be zero. -;;; -;;; If multiple arguments are provided, connect will attempt to wire them in series, -;;; interpreting the endpoints as inputs or outputs as appropriate. -(define-method (gr:connect hb . points) - (dis/connect "connect" gr:primitive-connect hb points)) - -;;; Disconnect one or more block endpoints... -(define-method (gr:disconnect hb . points) - (dis/connect "disconnect" gr:primitive-disconnect hb points)) - -(define (dis/connect name gf hb points) - (let ((hb (coerce-to-hier-block2 hb)) - (points (list->vector (map coerce-to-endpoint points)))) - - (define (op2 p0 p1) - (gf hb (block p0) (port p0) (block p1) (port p1))) - - (let ((len (vector-length points))) - (case len - ((0) (error (string-append name " requires at least 1 endpoint; None provided."))) - ((1) (gf hb (vector-ref points 0))) - (else - (let loop ((n 1)) - (cond ((< n len) - (op2 (vector-ref points (1- n)) (vector-ref points n)) - (loop (1+ n)))))))))) - - -(export-safely gr:ep gr:connect gr:disconnect) -- cgit From 5c81f275a32f969cefd20287a44bdeb1aeef436f Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 19:48:27 -0700 Subject: Remove .gitignore from empty directory --- gnuradio-core/src/lib/swig/gnuradio/.gitignore | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 gnuradio-core/src/lib/swig/gnuradio/.gitignore (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio/.gitignore b/gnuradio-core/src/lib/swig/gnuradio/.gitignore deleted file mode 100644 index 20ce65795..000000000 --- a/gnuradio-core/src/lib/swig/gnuradio/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -/gnuradio_core_filter.scm -/gnuradio_core_filter-primitive.scm -/gnuradio_core_general.scm -/gnuradio_core_general-primitive.scm -/gnuradio_core_gengen.scm -/gnuradio_core_gengen-primitive.scm -/gnuradio_core_hier.scm -/gnuradio_core_hier-primitive.scm -/gnuradio_core_io.scm -/gnuradio_core_io-primitive.scm -/gnuradio_core_runtime.scm -/gnuradio_core_runtime-primitive.scm -- cgit From 53c6be5b6bdca4fe93b9034cb0b34eaa274af9d9 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 19:57:18 -0700 Subject: update .gitignore --- gnuradio-core/src/lib/swig/.gitignore | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 75d6ce5b7..35e974948 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -16,28 +16,35 @@ gnuradio_core_filter.d gnuradio_core_filter.h gnuradio_core_filter.py gnuradio_core_filter.scm +gnuradio_core_filter-primitive.scm gnuradio_core_general.cc gnuradio_core_general.d gnuradio_core_general.h gnuradio_core_general.py gnuradio_core_general.scm +gnuradio_core_general-primitive.scm gnuradio_core_gengen.cc gnuradio_core_gengen.d gnuradio_core_gengen.h gnuradio_core_gengen.py gnuradio_core_gengen.scm +gnuradio_core_gengen-primitive.scm gnuradio_core_hier.cc gnuradio_core_hier.d gnuradio_core_hier.h gnuradio_core_hier.py gnuradio_core_hier.scm +gnuradio_core_hier-primitive.scm gnuradio_core_io.cc gnuradio_core_io.d gnuradio_core_io.h gnuradio_core_io.py gnuradio_core_io.scm +gnuradio_core_io-primitive.scm gnuradio_core_runtime.cc gnuradio_core_runtime.d gnuradio_core_runtime.h gnuradio_core_runtime.py gnuradio_core_runtime.scm +gnuradio_core_runtime-primitive.scm + -- cgit From a79986e0a88632029daf2dad5d05518d33bb1866 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 21:58:58 -0700 Subject: First real guile QA code --- gnuradio-core/src/guile/Makefile.am | 4 +- gnuradio-core/src/guile/qa_0000_basics.scm | 82 +++ gnuradio-core/src/guile/qa_stub.scm | 0 gnuradio-core/src/guile/srfi/srfi-64.scm | 970 +++++++++++++++++++++++++++++ 4 files changed, 1054 insertions(+), 2 deletions(-) create mode 100644 gnuradio-core/src/guile/qa_0000_basics.scm delete mode 100644 gnuradio-core/src/guile/qa_stub.scm create mode 100644 gnuradio-core/src/guile/srfi/srfi-64.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 3c21373af..ef6ab0b7e 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -34,5 +34,5 @@ nobase_guile_DATA = \ Swig/common.scm \ gnuradio/core.scm \ gnuradio/export-safely.scm \ - gnuradio/runtime-shim.scm - + gnuradio/runtime-shim.scm \ + srfi/srfi-64.scm diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm new file mode 100644 index 000000000..19bde0589 --- /dev/null +++ b/gnuradio-core/src/guile/qa_0000_basics.scm @@ -0,0 +1,82 @@ +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") +(use-modules (ice-9 format)) +(use-modules (ice-9 pretty-print)) + +;; (write "Hello QA world!\n") + +(define (vector-map f v) + (list->vector (map f (vector->list v)))) + +(define (test-1) + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "my top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using gr:ep to create endpoints + (gr:connect tb (gr:ep src 0) (gr:ep op 0)) + (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) + + (gr:run tb) + (let ((actual-result (gr:data dst))) + (test-equal expected-result actual-result)))) + +(define (test-2) + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "my top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using just blocks + (gr:connect tb src op) + (gr:connect tb op dst) + + (gr:run tb) + (let ((actual-result (gr:data dst))) + (test-equal expected-result actual-result)))) + +(define (test-3) + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "my top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using lists to represent endpoints + (gr:connect tb `(,src 0) `(,op 0)) + (gr:connect tb `(,op 0) `(,dst 0)) + + (gr:run tb) + (let ((actual-result (gr:data dst))) + (test-equal expected-result actual-result)))) + +(define (test-4) + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "my top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using multiple endpoints + (gr:connect tb src op dst) + + (gr:run tb) + (let ((actual-result (gr:data dst))) + (test-equal expected-result actual-result)))) + + +(test-begin "qa_0000_basics") +(test-1) +(test-2) +(test-3) +(test-4) +(test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/qa_stub.scm b/gnuradio-core/src/guile/qa_stub.scm deleted file mode 100644 index e69de29bb..000000000 diff --git a/gnuradio-core/src/guile/srfi/srfi-64.scm b/gnuradio-core/src/guile/srfi/srfi-64.scm new file mode 100644 index 000000000..25833b3f7 --- /dev/null +++ b/gnuradio-core/src/guile/srfi/srfi-64.scm @@ -0,0 +1,970 @@ +;; Copyright (c) 2005, 2006 Per Bothner +;; +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +(cond-expand + (chicken + (require-extension syntax-case)) + (guile + (use-modules (ice-9 syncase) (srfi srfi-9) + ;;(srfi srfi-34) (srfi srfi-35) - not in Guile 1.6.7 + (srfi srfi-39))) + (sisc + (require-extension (srfi 9 34 35 39))) + (kawa + (module-compile-options warn-undefined-variable: #t + warn-invoke-unknown-method: #t) + (provide 'srfi-64) + (provide 'testing) + (require 'srfi-34) + (require 'srfi-35)) + (else () + )) + +(cond-expand + (kawa + (define-syntax %test-export + (syntax-rules () + ((%test-export test-begin . other-names) + (module-export %test-begin . other-names))))) + (else + (define-syntax %test-export + (syntax-rules () + ((%test-export . names) (if #f #f)))))) + +;; List of exported names +(%test-export + test-begin ;; must be listed first, since in Kawa (at least) it is "magic". + test-end test-assert test-eqv test-eq test-equal + test-approximate test-assert test-error test-apply test-with-runner + test-match-nth test-match-all test-match-any test-match-name + test-skip test-expect-fail test-read-eval-string + test-runner-group-path test-group-with-cleanup + test-result-ref test-result-set! test-result-clear test-result-remove + test-result-kind test-passed? + test-log-to-file + ; Misc test-runner functions + test-runner? test-runner-reset test-runner-null + test-runner-simple test-runner-current test-runner-factory test-runner-get + test-runner-create test-runner-test-name + ;; test-runner field setter and getter functions - see %test-record-define: + test-runner-pass-count test-runner-pass-count! + test-runner-fail-count test-runner-fail-count! + test-runner-xpass-count test-runner-xpass-count! + test-runner-xfail-count test-runner-xfail-count! + test-runner-skip-count test-runner-skip-count! + test-runner-group-stack test-runner-group-stack! + test-runner-on-test-begin test-runner-on-test-begin! + test-runner-on-test-end test-runner-on-test-end! + test-runner-on-group-begin test-runner-on-group-begin! + test-runner-on-group-end test-runner-on-group-end! + test-runner-on-final test-runner-on-final! + test-runner-on-bad-count test-runner-on-bad-count! + test-runner-on-bad-end-name test-runner-on-bad-end-name! + test-result-alist test-result-alist! + test-runner-aux-value test-runner-aux-value! + ;; default/simple call-back functions, used in default test-runner, + ;; but can be called to construct more complex ones. + test-on-group-begin-simple test-on-group-end-simple + test-on-bad-count-simple test-on-bad-end-name-simple + test-on-final-simple test-on-test-end-simple + test-on-final-simple) + +(cond-expand + (srfi-9 + (define-syntax %test-record-define + (syntax-rules () + ((%test-record-define alloc runner? (name index setter getter) ...) + (define-record-type test-runner + (alloc) + runner? + (name setter getter) ...))))) + (else + (define %test-runner-cookie (list "test-runner")) + (define-syntax %test-record-define + (syntax-rules () + ((%test-record-define alloc runner? (name index getter setter) ...) + (begin + (define (runner? obj) + (and (vector? obj) + (> (vector-length obj) 1) + (eq (vector-ref obj 0) %test-runner-cookie))) + (define (alloc) + (let ((runner (make-vector 22))) + (vector-set! runner 0 %test-runner-cookie) + runner)) + (begin + (define (getter runner) + (vector-ref runner index)) ...) + (begin + (define (setter runner value) + (vector-set! runner index value)) ...))))))) + +(%test-record-define + %test-runner-alloc test-runner? + ;; Cumulate count of all tests that have passed and were expected to. + (pass-count 1 test-runner-pass-count test-runner-pass-count!) + (fail-count 2 test-runner-fail-count test-runner-fail-count!) + (xpass-count 3 test-runner-xpass-count test-runner-xpass-count!) + (xfail-count 4 test-runner-xfail-count test-runner-xfail-count!) + (skip-count 5 test-runner-skip-count test-runner-skip-count!) + (skip-list 6 %test-runner-skip-list %test-runner-skip-list!) + (fail-list 7 %test-runner-fail-list %test-runner-fail-list!) + ;; Normally #t, except when in a test-apply. + (run-list 8 %test-runner-run-list %test-runner-run-list!) + (skip-save 9 %test-runner-skip-save %test-runner-skip-save!) + (fail-save 10 %test-runner-fail-save %test-runner-fail-save!) + (group-stack 11 test-runner-group-stack test-runner-group-stack!) + (on-test-begin 12 test-runner-on-test-begin test-runner-on-test-begin!) + (on-test-end 13 test-runner-on-test-end test-runner-on-test-end!) + ;; Call-back when entering a group. Takes (runner suite-name count). + (on-group-begin 14 test-runner-on-group-begin test-runner-on-group-begin!) + ;; Call-back when leaving a group. + (on-group-end 15 test-runner-on-group-end test-runner-on-group-end!) + ;; Call-back when leaving the outermost group. + (on-final 16 test-runner-on-final test-runner-on-final!) + ;; Call-back when expected number of tests was wrong. + (on-bad-count 17 test-runner-on-bad-count test-runner-on-bad-count!) + ;; Call-back when name in test=end doesn't match test-begin. + (on-bad-end-name 18 test-runner-on-bad-end-name test-runner-on-bad-end-name!) + ;; Cumulate count of all tests that have been done. + (total-count 19 %test-runner-total-count %test-runner-total-count!) + ;; Stack (list) of (count-at-start . expected-count): + (count-list 20 %test-runner-count-list %test-runner-count-list!) + (result-alist 21 test-result-alist test-result-alist!) + ;; Field can be used by test-runner for any purpose. + ;; test-runner-simple uses it for a log file. + (aux-value 22 test-runner-aux-value test-runner-aux-value!) +) + +(define (test-runner-reset runner) + (test-runner-pass-count! runner 0) + (test-runner-fail-count! runner 0) + (test-runner-xpass-count! runner 0) + (test-runner-xfail-count! runner 0) + (test-runner-skip-count! runner 0) + (%test-runner-total-count! runner 0) + (%test-runner-count-list! runner '()) + (%test-runner-run-list! runner #t) + (%test-runner-skip-list! runner '()) + (%test-runner-fail-list! runner '()) + (%test-runner-skip-save! runner '()) + (%test-runner-fail-save! runner '()) + (test-runner-group-stack! runner '())) + +(define (test-runner-group-path runner) + (reverse (test-runner-group-stack runner))) + +(define (%test-null-callback runner) #f) + +(define (test-runner-null) + (let ((runner (%test-runner-alloc))) + (test-runner-reset runner) + (test-runner-on-group-begin! runner (lambda (runner name count) #f)) + (test-runner-on-group-end! runner %test-null-callback) + (test-runner-on-final! runner %test-null-callback) + (test-runner-on-test-begin! runner %test-null-callback) + (test-runner-on-test-end! runner %test-null-callback) + (test-runner-on-bad-count! runner (lambda (runner count expected) #f)) + (test-runner-on-bad-end-name! runner (lambda (runner begin end) #f)) + runner)) + +;; Not part of the specification. FIXME +;; Controls whether a log file is generated. +(define test-log-to-file #f) + +(define (test-runner-simple) + (let ((runner (%test-runner-alloc))) + (test-runner-reset runner) + (test-runner-on-group-begin! runner test-on-group-begin-simple) + (test-runner-on-group-end! runner test-on-group-end-simple) + (test-runner-on-final! runner test-on-final-simple) + (test-runner-on-test-begin! runner test-on-test-begin-simple) + (test-runner-on-test-end! runner test-on-test-end-simple) + (test-runner-on-bad-count! runner test-on-bad-count-simple) + (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) + runner)) + +(cond-expand + (srfi-39 + (define test-runner-current (make-parameter #f)) + (define test-runner-factory (make-parameter test-runner-simple))) + (else + (define %test-runner-current #f) + (define-syntax test-runner-current + (syntax-rules () + ((test-runner-current) + %test-runner-current) + ((test-runner-current runner) + (set! %test-runner-current runner)))) + (define %test-runner-factory test-runner-simple) + (define-syntax test-runner-factory + (syntax-rules () + ((test-runner-factory) + %test-runner-factory) + ((test-runner-factory runner) + (set! %test-runner-factory runner)))))) + +;; A safer wrapper to test-runner-current. +(define (test-runner-get) + (let ((r (test-runner-current))) + (if (not r) + (cond-expand + (srfi-23 (error "test-runner not initialized - test-begin missing?")) + (else #t))) + r)) + +(define (%test-specificier-matches spec runner) + (spec runner)) + +(define (test-runner-create) + ((test-runner-factory))) + +(define (%test-any-specifier-matches list runner) + (let ((result #f)) + (let loop ((l list)) + (cond ((null? l) result) + (else + (if (%test-specificier-matches (car l) runner) + (set! result #t)) + (loop (cdr l))))))) + +;; Returns #f, #t, or 'xfail. +(define (%test-should-execute runner) + (let ((run (%test-runner-run-list runner))) + (cond ((or + (not (or (eqv? run #t) + (%test-any-specifier-matches run runner))) + (%test-any-specifier-matches + (%test-runner-skip-list runner) + runner)) + (test-result-set! runner 'result-kind 'skip) + #f) + ((%test-any-specifier-matches + (%test-runner-fail-list runner) + runner) + (test-result-set! runner 'result-kind 'xfail) + 'xfail) + (else #t)))) + +(define (%test-begin suite-name count) + (if (not (test-runner-current)) + (test-runner-current (test-runner-create))) + (let ((runner (test-runner-current))) + ((test-runner-on-group-begin runner) runner suite-name count) + (%test-runner-skip-save! runner + (cons (%test-runner-skip-list runner) + (%test-runner-skip-save runner))) + (%test-runner-fail-save! runner + (cons (%test-runner-fail-list runner) + (%test-runner-fail-save runner))) + (%test-runner-count-list! runner + (cons (cons (%test-runner-total-count runner) + count) + (%test-runner-count-list runner))) + (test-runner-group-stack! runner (cons suite-name + (test-runner-group-stack runner))))) +(cond-expand + (kawa + ;; Kawa has test-begin built in, implemented as: + ;; (begin + ;; (cond-expand (srfi-64 #!void) (else (require 'srfi-64))) + ;; (%test-begin suite-name [count])) + ;; This puts test-begin but only test-begin in the default environment., + ;; which makes normal test suites loadable without non-portable commands. + ) + (else + (define-syntax test-begin + (syntax-rules () + ((test-begin suite-name) + (%test-begin suite-name #f)) + ((test-begin suite-name count) + (%test-begin suite-name count)))))) + +(define (test-on-group-begin-simple runner suite-name count) + (if (null? (test-runner-group-stack runner)) + (begin + (display "%%%% Starting test ") + (display suite-name) + (if test-log-to-file + (let* ((log-file-name + (if (string? test-log-to-file) test-log-to-file + (string-append suite-name ".log"))) + (log-file + (cond-expand (mzscheme + (open-output-file log-file-name 'truncate/replace)) + (else (open-output-file log-file-name))))) + (display "%%%% Starting test " log-file) + (display suite-name log-file) + (newline log-file) + (test-runner-aux-value! runner log-file) + (display " (Writing full log to \"") + (display log-file-name) + (display "\")"))) + (newline))) + (let ((log (test-runner-aux-value runner))) + (if (output-port? log) + (begin + (display "Group begin: " log) + (display suite-name log) + (newline log)))) + #f) + +(define (test-on-group-end-simple runner) + (let ((log (test-runner-aux-value runner))) + (if (output-port? log) + (begin + (display "Group end: " log) + (display (car (test-runner-group-stack runner)) log) + (newline log)))) + #f) + +(define (%test-on-bad-count-write runner count expected-count port) + (display "*** Total number of tests was " port) + (display count port) + (display " but should be " port) + (display expected-count port) + (display ". ***" port) + (newline port) + (display "*** Discrepancy indicates testsuite error or exceptions. ***" port) + (newline port)) + +(define (test-on-bad-count-simple runner count expected-count) + (%test-on-bad-count-write runner count expected-count (current-output-port)) + (let ((log (test-runner-aux-value runner))) + (if (output-port? log) + (%test-on-bad-count-write runner count expected-count log)))) + +(define (test-on-bad-end-name-simple runner begin-name end-name) + (let ((msg (string-append (%test-format-line runner) "test-end " begin-name + " does not match test-begin " end-name))) + (cond-expand + (srfi-23 (error msg)) + (else (display msg) (newline))))) + + +(define (%test-final-report1 value label port) + (if (> value 0) + (begin + (display label port) + (display value port) + (newline port)))) + +(define (%test-final-report-simple runner port) + (%test-final-report1 (test-runner-pass-count runner) + "# of expected passes " port) + (%test-final-report1 (test-runner-xfail-count runner) + "# of expected failures " port) + (%test-final-report1 (test-runner-xpass-count runner) + "# of unexpected successes " port) + (%test-final-report1 (test-runner-fail-count runner) + "# of unexpected failures " port) + (%test-final-report1 (test-runner-skip-count runner) + "# of skipped tests " port)) + +(define (test-on-final-simple runner) + (%test-final-report-simple runner (current-output-port)) + (let ((log (test-runner-aux-value runner))) + (if (output-port? log) + (%test-final-report-simple runner log)))) + +(define (%test-format-line runner) + (let* ((line-info (test-result-alist runner)) + (source-file (assq 'source-file line-info)) + (source-line (assq 'source-line line-info)) + (file (if source-file (cdr source-file) ""))) + (if source-line + (string-append file ":" + (number->string (cdr source-line)) ": ") + ""))) + +(define (%test-end suite-name line-info) + (let* ((r (test-runner-get)) + (groups (test-runner-group-stack r)) + (line (%test-format-line r))) + (test-result-alist! r line-info) + (if (null? groups) + (let ((msg (string-append line "test-end not in a group"))) + (cond-expand + (srfi-23 (error msg)) + (else (display msg) (newline))))) + (if (and suite-name (not (equal? suite-name (car groups)))) + ((test-runner-on-bad-end-name r) r suite-name (car groups))) + (let* ((count-list (%test-runner-count-list r)) + (expected-count (cdar count-list)) + (saved-count (caar count-list)) + (group-count (- (%test-runner-total-count r) saved-count))) + (if (and expected-count + (not (= expected-count group-count))) + ((test-runner-on-bad-count r) r group-count expected-count)) + ((test-runner-on-group-end r) r) + (test-runner-group-stack! r (cdr (test-runner-group-stack r))) + (%test-runner-skip-list! r (car (%test-runner-skip-save r))) + (%test-runner-skip-save! r (cdr (%test-runner-skip-save r))) + (%test-runner-fail-list! r (car (%test-runner-fail-save r))) + (%test-runner-fail-save! r (cdr (%test-runner-fail-save r))) + (%test-runner-count-list! r (cdr count-list)) + (if (null? (test-runner-group-stack r)) + ((test-runner-on-final r) r))))) + +(define-syntax test-group + (syntax-rules () + ((test-group suite-name . body) + (let ((r (test-runner-current))) + ;; Ideally should also set line-number, if available. + (test-result-alist! r (list (cons 'test-name suite-name))) + (if (%test-should-execute r) + (dynamic-wind + (lambda () (test-begin suite-name)) + (lambda () . body) + (lambda () (test-end suite-name)))))))) + +(define-syntax test-group-with-cleanup + (syntax-rules () + ((test-group-with-cleanup suite-name form cleanup-form) + (test-group suite-name + (dynamic-wind + (lambda () #f) + (lambda () form) + (lambda () cleanup-form)))) + ((test-group-with-cleanup suite-name cleanup-form) + (test-group-with-cleanup suite-name #f cleanup-form)) + ((test-group-with-cleanup suite-name form1 form2 form3 . rest) + (test-group-with-cleanup suite-name (begin form1 form2) form3 . rest)))) + +(define (test-on-test-begin-simple runner) + (let ((log (test-runner-aux-value runner))) + (if (output-port? log) + (let* ((results (test-result-alist runner)) + (source-file (assq 'source-file results)) + (source-line (assq 'source-line results)) + (source-form (assq 'source-form results)) + (test-name (assq 'test-name results))) + (display "Test begin:" log) + (newline log) + (if test-name (%test-write-result1 test-name log)) + (if source-file (%test-write-result1 source-file log)) + (if source-line (%test-write-result1 source-line log)) + (if source-file (%test-write-result1 source-form log)))))) + +(define-syntax test-result-ref + (syntax-rules () + ((test-result-ref runner pname) + (test-result-ref runner pname #f)) + ((test-result-ref runner pname default) + (let ((p (assq pname (test-result-alist runner)))) + (if p (cdr p) default))))) + +(define (test-on-test-end-simple runner) + (let ((log (test-runner-aux-value runner)) + (kind (test-result-ref runner 'result-kind))) + (if (memq kind '(fail xpass)) + (let* ((results (test-result-alist runner)) + (source-file (assq 'source-file results)) + (source-line (assq 'source-line results)) + (test-name (assq 'test-name results))) + (if (or source-file source-line) + (begin + (if source-file (display (cdr source-file))) + (display ":") + (if source-line (display (cdr source-line))) + (display ": "))) + (display (if (eq? kind 'xpass) "XPASS" "FAIL")) + (if test-name + (begin + (display " ") + (display (cdr test-name)))) + (newline))) + (if (output-port? log) + (begin + (display "Test end:" log) + (newline log) + (let loop ((list (test-result-alist runner))) + (if (pair? list) + (let ((pair (car list))) + ;; Write out properties not written out by on-test-begin. + (if (not (memq (car pair) + '(test-name source-file source-line source-form))) + (%test-write-result1 pair log)) + (loop (cdr list))))))))) + +(define (%test-write-result1 pair port) + (display " " port) + (display (car pair) port) + (display ": " port) + (write (cdr pair) port) + (newline port)) + +(define (test-result-set! runner pname value) + (let* ((alist (test-result-alist runner)) + (p (assq pname alist))) + (if p + (set-cdr! p value) + (test-result-alist! runner (cons (cons pname value) alist))))) + +(define (test-result-clear runner) + (test-result-alist! runner '())) + +(define (test-result-remove runner pname) + (let* ((alist (test-result-alist runner)) + (p (assq pname alist))) + (if p + (test-result-alist! runner + (let loop ((r alist)) + (if (eq? r p) (cdr r) + (cons (car r) (loop (cdr r))))))))) + +(define (test-result-kind . rest) + (let ((runner (if (pair? rest) (car rest) (test-runner-current)))) + (test-result-ref runner 'result-kind))) + +(define (test-passed? . rest) + (let ((runner (if (pair? rest) (car rest) (test-runner-get)))) + (memq (test-result-ref runner 'result-kind) '(pass xpass)))) + +(define (%test-report-result) + (let* ((r (test-runner-get)) + (result-kind (test-result-kind r))) + (case result-kind + ((pass) + (test-runner-pass-count! r (+ 1 (test-runner-pass-count r)))) + ((fail) + (test-runner-fail-count! r (+ 1 (test-runner-fail-count r)))) + ((xpass) + (test-runner-xpass-count! r (+ 1 (test-runner-xpass-count r)))) + ((xfail) + (test-runner-xfail-count! r (+ 1 (test-runner-xfail-count r)))) + (else + (test-runner-skip-count! r (+ 1 (test-runner-skip-count r))))) + (%test-runner-total-count! r (+ 1 (%test-runner-total-count r))) + ((test-runner-on-test-end r) r))) + +(cond-expand + (guile + (define-syntax %test-evaluate-with-catch + (syntax-rules () + ((%test-evaluate-with-catch test-expression) + (catch #t (lambda () test-expression) (lambda (key . args) #f)))))) + (kawa + (define-syntax %test-evaluate-with-catch + (syntax-rules () + ((%test-evaluate-with-catch test-expression) + (try-catch test-expression + (ex + (test-result-set! (test-runner-current) 'actual-error ex) + #f)))))) + (srfi-34 + (define-syntax %test-evaluate-with-catch + (syntax-rules () + ((%test-evaluate-with-catch test-expression) + (guard (err (else #f)) test-expression))))) + (chicken + (define-syntax %test-evaluate-with-catch + (syntax-rules () + ((%test-evaluate-with-catch test-expression) + (condition-case test-expression (ex () #f)))))) + (else + (define-syntax %test-evaluate-with-catch + (syntax-rules () + ((%test-evaluate-with-catch test-expression) + test-expression))))) + +(cond-expand + ((or kawa mzscheme) + (cond-expand + (mzscheme + (define-for-syntax (%test-syntax-file form) + (let ((source (syntax-source form))) + (cond ((string? source) file) + ((path? source) (path->string source)) + (else #f))))) + (kawa + (define (%test-syntax-file form) + (syntax-source form)))) + (define-for-syntax (%test-source-line2 form) + (let* ((line (syntax-line form)) + (file (%test-syntax-file form)) + (line-pair (if line (list (cons 'source-line line)) '()))) + (cons (cons 'source-form (syntax-object->datum form)) + (if file (cons (cons 'source-file file) line-pair) line-pair))))) + (else + (define (%test-source-line2 form) + '()))) + +(define (%test-on-test-begin r) + (%test-should-execute r) + ((test-runner-on-test-begin r) r) + (not (eq? 'skip (test-result-ref r 'result-kind)))) + +(define (%test-on-test-end r result) + (test-result-set! r 'result-kind + (if (eq? (test-result-ref r 'result-kind) 'xfail) + (if result 'xpass 'xfail) + (if result 'pass 'fail)))) + +(define (test-runner-test-name runner) + (test-result-ref runner 'test-name "")) + +(define-syntax %test-comp2body + (syntax-rules () + ((%test-comp2body r comp expected expr) + (let () + (if (%test-on-test-begin r) + (let ((exp expected)) + (test-result-set! r 'expected-value exp) + (let ((res (%test-evaluate-with-catch expr))) + (test-result-set! r 'actual-value res) + (%test-on-test-end r (comp exp res))))) + (%test-report-result))))) + +(define (%test-approximimate= error) + (lambda (value expected) + (and (>= value (- expected error)) + (<= value (+ expected error))))) + +(define-syntax %test-comp1body + (syntax-rules () + ((%test-comp1body r expr) + (let () + (if (%test-on-test-begin r) + (let () + (let ((res (%test-evaluate-with-catch expr))) + (test-result-set! r 'actual-value res) + (%test-on-test-end r res)))) + (%test-report-result))))) + +(cond-expand + ((or kawa mzscheme) + ;; Should be made to work for any Scheme with syntax-case + ;; However, I haven't gotten the quoting working. FIXME. + (define-syntax test-end + (lambda (x) + (syntax-case (list x (list 'quote (%test-source-line2 x))) () + (((mac suite-name) line) + (syntax + (%test-end suite-name line))) + (((mac) line) + (syntax + (%test-end #f line)))))) + (define-syntax test-assert + (lambda (x) + (syntax-case (list x (list 'quote (%test-source-line2 x))) () + (((mac tname expr) line) + (syntax + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r (cons (cons 'test-name tname) line)) + (%test-comp1body r expr)))) + (((mac expr) line) + (syntax + (let* ((r (test-runner-get))) + (test-result-alist! r line) + (%test-comp1body r expr))))))) + (define-for-syntax (%test-comp2 comp x) + (syntax-case (list x (list 'quote (%test-source-line2 x)) comp) () + (((mac tname expected expr) line comp) + (syntax + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r (cons (cons 'test-name tname) line)) + (%test-comp2body r comp expected expr)))) + (((mac expected expr) line comp) + (syntax + (let* ((r (test-runner-get))) + (test-result-alist! r line) + (%test-comp2body r comp expected expr)))))) + (define-syntax test-eqv + (lambda (x) (%test-comp2 (syntax eqv?) x))) + (define-syntax test-eq + (lambda (x) (%test-comp2 (syntax eq?) x))) + (define-syntax test-equal + (lambda (x) (%test-comp2 (syntax equal?) x))) + (define-syntax test-approximate ;; FIXME - needed for non-Kawa + (lambda (x) + (syntax-case (list x (list 'quote (%test-source-line2 x))) () + (((mac tname expected expr error) line) + (syntax + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r (cons (cons 'test-name tname) line)) + (%test-comp2body r (%test-approximimate= error) expected expr)))) + (((mac expected expr error) line) + (syntax + (let* ((r (test-runner-get))) + (test-result-alist! r line) + (%test-comp2body r (%test-approximimate= error) expected expr)))))))) + (else + (define-syntax test-end + (syntax-rules () + ((test-end) + (%test-end #f '())) + ((test-end suite-name) + (%test-end suite-name '())))) + (define-syntax test-assert + (syntax-rules () + ((test-assert tname test-expression) + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r '((test-name . tname))) + (%test-comp1body r test-expression))) + ((test-assert test-expression) + (let* ((r (test-runner-get))) + (test-result-alist! r '()) + (%test-comp1body r test-expression))))) + (define-syntax %test-comp2 + (syntax-rules () + ((%test-comp2 comp tname expected expr) + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r (list (cons 'test-name tname))) + (%test-comp2body r comp expected expr))) + ((%test-comp2 comp expected expr) + (let* ((r (test-runner-get))) + (test-result-alist! r '()) + (%test-comp2body r comp expected expr))))) + (define-syntax test-equal + (syntax-rules () + ((test-equal . rest) + (%test-comp2 equal? . rest)))) + (define-syntax test-eqv + (syntax-rules () + ((test-eqv . rest) + (%test-comp2 eqv? . rest)))) + (define-syntax test-eq + (syntax-rules () + ((test-eq . rest) + (%test-comp2 eq? . rest)))) + (define-syntax test-approximate + (syntax-rules () + ((test-approximate tname expected expr error) + (%test-comp2 (%test-approximimate= error) tname expected expr)) + ((test-approximate expected expr error) + (%test-comp2 (%test-approximimate= error) expected expr)))))) + +(cond-expand + (guile + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (%test-comp1body r (catch #t (lambda () expr) (lambda (key . args) #t))))))) + (mzscheme + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (%test-comp1body r (with-handlers (((lambda (h) #t) (lambda (h) #t))) + (let () + (test-result-set! r 'actual-value expr) + #f))))))) + (chicken + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (%test-comp1body r (condition-case expr (ex () #t))))))) + (kawa + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (let () + (if (%test-on-test-begin r) + (let ((et etype)) + (test-result-set! r 'expected-error et) + (%test-on-test-end r + (try-catch + (let () + (test-result-set! r 'actual-value expr) + #f) + (ex + (test-result-set! r 'actual-error ex) + (cond ((and (instance? et ) + (gnu.bytecode.ClassType:isSubclass et )) + (instance? ex et)) + (else #t))))) + (%test-report-result)))))))) + ((and srfi-34 srfi-35) + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (%test-comp1body r (guard (ex ((condition-type? etype) + (and (condition? ex) (condition-has-type? ex etype))) + ((procedure? etype) + (etype ex)) + ((equal? type #t) + #t) + (else #t)) + expr)))))) + (srfi-34 + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (%test-comp1body r (guard (ex (else #t)) expr)))))) + (else + (define-syntax %test-error + (syntax-rules () + ((%test-error r etype expr) + (begin + ((test-runner-on-test-begin r) r) + (test-result-set! r 'result-kind 'skip) + (%test-report-result))))))) + +(cond-expand + ((or kawa mzscheme) + + (define-syntax test-error + (lambda (x) + (syntax-case (list x (list 'quote (%test-source-line2 x))) () + (((mac tname etype expr) line) + (syntax + (let* ((r (test-runner-get)) + (name tname)) + (test-result-alist! r (cons (cons 'test-name tname) line)) + (%test-error r etype expr)))) + (((mac etype expr) line) + (syntax + (let* ((r (test-runner-get))) + (test-result-alist! r line) + (%test-error r etype expr)))) + (((mac expr) line) + (syntax + (let* ((r (test-runner-get))) + (test-result-alist! r line) + (%test-error r #t expr)))))))) + (else + (define-syntax test-error + (syntax-rules () + ((test-error name etype expr) + (test-assert name (%test-error etype expr))) + ((test-error etype expr) + (test-assert (%test-error etype expr))) + ((test-error expr) + (test-assert (%test-error #t expr))))))) + +(define (test-apply first . rest) + (if (test-runner? first) + (test-with-runner first (apply test-apply rest)) + (let ((r (test-runner-current))) + (if r + (let ((run-list (%test-runner-run-list r))) + (cond ((null? rest) + (%test-runner-run-list! r (reverse! run-list)) + (first)) ;; actually apply procedure thunk + (else + (%test-runner-run-list! + r + (if (eq? run-list #t) (list first) (cons first run-list))) + (apply test-apply rest) + (%test-runner-run-list! r run-list)))) + (let ((r (test-runner-create))) + (test-with-runner r (apply test-apply first rest)) + ((test-runner-on-final r) r)))))) + +(define-syntax test-with-runner + (syntax-rules () + ((test-with-runner runner form ...) + (let ((saved-runner (test-runner-current))) + (dynamic-wind + (lambda () (test-runner-current runner)) + (lambda () form ...) + (lambda () (test-runner-current saved-runner))))))) + +;;; Predicates + +(define (%test-match-nth n count) + (let ((i 0)) + (lambda (runner) + (set! i (+ i 1)) + (and (>= i n) (< i (+ n count)))))) + +(define-syntax test-match-nth + (syntax-rules () + ((test-match-nth n) + (test-match-nth n 1)) + ((test-match-nth n count) + (%test-match-nth n count)))) + +(define (%test-match-all . pred-list) + (lambda (runner) + (let ((result #t)) + (let loop ((l pred-list)) + (if (null? l) + result + (begin + (if (not ((car l) runner)) + (set! result #f)) + (loop (cdr l)))))))) + +(define-syntax test-match-all + (syntax-rules () + ((test-match-all pred ...) + (%test-match-all (%test-as-specifier pred) ...)))) + +(define (%test-match-any . pred-list) + (lambda (runner) + (let ((result #f)) + (let loop ((l pred-list)) + (if (null? l) + result + (begin + (if ((car l) runner) + (set! result #t)) + (loop (cdr l)))))))) + +(define-syntax test-match-any + (syntax-rules () + ((test-match-any pred ...) + (%test-match-any (%test-as-specifier pred) ...)))) + +;; Coerce to a predicate function: +(define (%test-as-specifier specifier) + (cond ((procedure? specifier) specifier) + ((integer? specifier) (test-match-nth 1 specifier)) + ((string? specifier) (test-match-name specifier)) + (else + (error "not a valid test specifier")))) + +(define-syntax test-skip + (syntax-rules () + ((test-skip pred ...) + (let ((runner (test-runner-get))) + (%test-runner-skip-list! runner + (cons (test-match-all (%test-as-specifier pred) ...) + (%test-runner-skip-list runner))))))) + +(define-syntax test-expect-fail + (syntax-rules () + ((test-expect-fail pred ...) + (let ((runner (test-runner-get))) + (%test-runner-fail-list! runner + (cons (test-match-all (%test-as-specifier pred) ...) + (%test-runner-fail-list runner))))))) + +(define (test-match-name name) + (lambda (runner) + (equal? name (test-runner-test-name runner)))) + +(define (test-read-eval-string string) + (let* ((port (open-input-string string)) + (form (read port))) + (if (eof-object? (read-char port)) + (eval form) + (cond-expand + (srfi-23 (error "(not at eof)")) + (else "error"))))) + -- cgit From b316cb06d0c6aa7be9942e48c71324fb8d637de8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 22:32:35 -0700 Subject: More guile QA code --- gnuradio-core/src/guile/.gitignore | 1 + gnuradio-core/src/guile/Makefile.am | 2 + gnuradio-core/src/guile/qa_0000_basics.scm | 66 ++++++++++++++++++++++-------- gnuradio-core/src/guile/srfi/srfi-64.scm | 2 +- 4 files changed, 53 insertions(+), 18 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index 6a0410b79..c76800aac 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -1,3 +1,4 @@ /Makefile /Makefile.in /run_guile_tests +/qa_*.log diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index ef6ab0b7e..5a9721b64 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -36,3 +36,5 @@ nobase_guile_DATA = \ gnuradio/export-safely.scm \ gnuradio/runtime-shim.scm \ srfi/srfi-64.scm + +CLEANFILES = qa_*.log diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm index 19bde0589..5d3a53d24 100644 --- a/gnuradio-core/src/guile/qa_0000_basics.scm +++ b/gnuradio-core/src/guile/qa_0000_basics.scm @@ -1,19 +1,17 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) +;;(use-modules (ice-9 format)) +;;(use-modules (ice-9 pretty-print)) -(load-from-path "srfi/srfi-64") -(use-modules (ice-9 format)) -(use-modules (ice-9 pretty-print)) - -;; (write "Hello QA world!\n") +(load-from-path "srfi/srfi-64") ; unit test library (define (vector-map f v) (list->vector (map f (vector->list v)))) -(define (test-1) +(define (test-connect-1) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -26,10 +24,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-2) +(define (test-connect-2) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -42,10 +40,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-3) +(define (test-connect-3) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -58,10 +56,10 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) -(define (test-4) +(define (test-connect-4) (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "my top block")) + (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) @@ -73,10 +71,44 @@ (let ((actual-result (gr:data dst))) (test-equal expected-result actual-result)))) +(define (test-io-signature-1) + (let ((ios1 (gr:io-signature 1 2 8)) + (ios2 (gr:io-signature2 1 2 16 32)) + (ios3 (gr:io-signature3 1 -1 14 32 48)) + (iosv (gr:io-signaturev 1 4 '(1 2 3)))) + + (test-equal 1 (gr:min-streams ios1)) + (test-equal 2 (gr:max-streams ios1)) + (test-equal 8 (gr:sizeof-stream-item ios1 0)) + (test-equal 8 (gr:sizeof-stream-item ios1 1)) + + (test-equal 1 (gr:min-streams ios2)) + (test-equal 2 (gr:max-streams ios2)) + (test-equal 16 (gr:sizeof-stream-item ios2 0)) + (test-equal 32 (gr:sizeof-stream-item ios2 1)) + + (test-equal 1 (gr:min-streams ios3)) + (test-equal -1 (gr:max-streams ios3)) + (test-equal 14 (gr:sizeof-stream-item ios3 0)) + (test-equal 32 (gr:sizeof-stream-item ios3 1)) + (test-equal 48 (gr:sizeof-stream-item ios3 2)) + (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) + + (test-equal 1 (gr:min-streams iosv)) + (test-equal 4 (gr:max-streams iosv)) + (test-equal 1 (gr:sizeof-stream-item iosv 0)) + (test-equal 2 (gr:sizeof-stream-item iosv 1)) + (test-equal 3 (gr:sizeof-stream-item iosv 2)) + (test-equal 3 (gr:sizeof-stream-item iosv 3)) + (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) + )) + + (test-begin "qa_0000_basics") -(test-1) -(test-2) -(test-3) -(test-4) +(test-connect-1) +(test-connect-2) +(test-connect-3) +(test-connect-4) +(test-io-signature-1) (test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/srfi/srfi-64.scm b/gnuradio-core/src/guile/srfi/srfi-64.scm index 25833b3f7..4ad9ccbab 100644 --- a/gnuradio-core/src/guile/srfi/srfi-64.scm +++ b/gnuradio-core/src/guile/srfi/srfi-64.scm @@ -189,7 +189,7 @@ ;; Not part of the specification. FIXME ;; Controls whether a log file is generated. -(define test-log-to-file #f) +(define test-log-to-file #t) (define (test-runner-simple) (let ((runner (%test-runner-alloc))) -- cgit From aa86e6975ee71a3e654cb87dd5a6bae5b06b8d16 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 23:13:22 -0700 Subject: Add QA stub files for all gnuradio-core constructors --- gnuradio-core/src/guile/qa_0010_ctor_filter.scm | 92 +++++++++++++++ gnuradio-core/src/guile/qa_0010_ctor_general.scm | 143 +++++++++++++++++++++++ gnuradio-core/src/guile/qa_0010_ctor_gengen.scm | 129 ++++++++++++++++++++ gnuradio-core/src/guile/qa_0010_ctor_hier.scm | 27 +++++ gnuradio-core/src/guile/qa_0010_ctor_io.scm | 39 +++++++ gnuradio-core/src/guile/qa_0010_ctor_runtime.scm | 28 +++++ 6 files changed, 458 insertions(+) create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_filter.scm create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_general.scm create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_gengen.scm create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_hier.scm create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_io.scm create mode 100644 gnuradio-core/src/guile/qa_0010_ctor_runtime.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/qa_0010_ctor_filter.scm b/gnuradio-core/src/guile/qa_0010_ctor_filter.scm new file mode 100644 index 000000000..0dd539a8e --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_filter.scm @@ -0,0 +1,92 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./filter/gr_adaptive_fir_ccf.h +;;; ./filter/gr_cma_equalizer_cc.h +;;; ./filter/gr_fft_filter_ccc.h +;;; ./filter/gr_fft_filter_fff.h +;;; ./filter/gr_filter_delay_fc.h +;;; ./filter/gr_fir_ccc_generic.h +;;; ./filter/gr_fir_ccc_simd.h +;;; ./filter/gr_fir_ccc_x86.h +;;; ./filter/gr_fir_ccf_generic.h +;;; ./filter/gr_fir_ccf_simd.h +;;; ./filter/gr_fir_ccf_x86.h +;;; ./filter/gr_fir_fcc_generic.h +;;; ./filter/gr_fir_fcc_simd.h +;;; ./filter/gr_fir_fcc_x86.h +;;; ./filter/gr_fir_fff_altivec.h +;;; ./filter/gr_fir_fff_armv7_a.h +;;; ./filter/gr_fir_fff_generic.h +;;; ./filter/gr_fir_fff_simd.h +;;; ./filter/gr_fir_fff_x86.h +;;; ./filter/gr_fir_filter_ccc.h +;;; ./filter/gr_fir_filter_ccf.h +;;; ./filter/gr_fir_filter_fcc.h +;;; ./filter/gr_fir_filter_fff.h +;;; ./filter/gr_fir_filter_fsf.h +;;; ./filter/gr_fir_filter_scc.h +;;; ./filter/gr_fir_fsf_generic.h +;;; ./filter/gr_fir_fsf_simd.h +;;; ./filter/gr_fir_fsf_x86.h +;;; ./filter/gr_fir_scc_generic.h +;;; ./filter/gr_fir_scc_simd.h +;;; ./filter/gr_fir_scc_x86.h +;;; ./filter/gr_fir_sysconfig_armv7_a.h +;;; ./filter/gr_fir_sysconfig_generic.h +;;; ./filter/gr_fir_sysconfig_powerpc.h +;;; ./filter/gr_fir_sysconfig_x86.h +;;; ./filter/gr_fractional_interpolator_cc.h +;;; ./filter/gr_fractional_interpolator_ff.h +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h +;;; ./filter/gr_freq_xlating_fir_filter_scc.h +;;; ./filter/gr_freq_xlating_fir_filter_scf.h +;;; ./filter/gr_goertzel_fc.h +;;; ./filter/gr_hilbert_fc.h +;;; ./filter/gr_iir_filter_ffd.h +;;; ./filter/gr_interp_fir_filter_ccc.h +;;; ./filter/gr_interp_fir_filter_ccf.h +;;; ./filter/gr_interp_fir_filter_fcc.h +;;; ./filter/gr_interp_fir_filter_fff.h +;;; ./filter/gr_interp_fir_filter_fsf.h +;;; ./filter/gr_interp_fir_filter_scc.h +;;; ./filter/gr_pfb_arb_resampler_ccf.h +;;; ./filter/gr_pfb_channelizer_ccf.h +;;; ./filter/gr_pfb_clock_sync_ccf.h +;;; ./filter/gr_pfb_clock_sync_fff.h +;;; ./filter/gr_pfb_decimator_ccf.h +;;; ./filter/gr_pfb_interpolator_ccf.h +;;; ./filter/gr_rational_resampler_base_ccc.h +;;; ./filter/gr_rational_resampler_base_ccf.h +;;; ./filter/gr_rational_resampler_base_fcc.h +;;; ./filter/gr_rational_resampler_base_fff.h +;;; ./filter/gr_rational_resampler_base_fsf.h +;;; ./filter/gr_rational_resampler_base_scc.h +;;; ./filter/gr_single_pole_iir_filter_cc.h +;;; ./filter/gr_single_pole_iir_filter_ff.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_general.scm b/gnuradio-core/src/guile/qa_0010_ctor_general.scm new file mode 100644 index 000000000..1531a59de --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_general.scm @@ -0,0 +1,143 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./general/gr_additive_scrambler_bb.h +;;; ./general/gr_agc2_cc.h +;;; ./general/gr_agc2_ff.h +;;; ./general/gr_agc_cc.h +;;; ./general/gr_agc_ff.h +;;; ./general/gr_align_on_samplenumbers_ss.h +;;; ./general/gr_bin_statistics_f.h +;;; ./general/gr_binary_slicer_fb.h +;;; ./general/gr_bytes_to_syms.h +;;; ./general/gr_char_to_float.h +;;; ./general/gr_check_counting_s.h +;;; ./general/gr_check_lfsr_32k_s.h +;;; ./general/gr_clock_recovery_mm_cc.h +;;; ./general/gr_clock_recovery_mm_ff.h +;;; ./general/gr_complex_to_interleaved_short.h +;;; ./general/gr_complex_to_xxx.h +;;; ./general/gr_conjugate_cc.h +;;; ./general/gr_constellation_decoder_cb.h +;;; ./general/gr_copy.h +;;; ./general/gr_correlate_access_code_bb.h +;;; ./general/gr_costas_loop_cc.h +;;; ./general/gr_cpfsk_bc.h +;;; ./general/gr_ctcss_squelch_ff.h +;;; ./general/gr_decode_ccsds_27_fb.h +;;; ./general/gr_deinterleave.h +;;; ./general/gr_delay.h +;;; ./general/gr_descrambler_bb.h +;;; ./general/gr_diff_decoder_bb.h +;;; ./general/gr_diff_encoder_bb.h +;;; ./general/gr_diff_phasor_cc.h +;;; ./general/gr_dpll_bb.h +;;; ./general/gr_encode_ccsds_27_bb.h +;;; ./general/gr_fake_channel_coder_pp.h +;;; ./general/gr_feedforward_agc_cc.h +;;; ./general/gr_fft_vcc.h +;;; ./general/gr_fft_vcc_fftw.h +;;; ./general/gr_fft_vfc.h +;;; ./general/gr_fll_band_edge_cc.h +;;; ./general/gr_float_to_char.h +;;; ./general/gr_float_to_complex.h +;;; ./general/gr_float_to_short.h +;;; ./general/gr_float_to_uchar.h +;;; ./general/gr_fmdet_cf.h +;;; ./general/gr_framer_sink_1.h +;;; ./general/gr_frequency_modulator_fc.h +;;; ./general/gr_glfsr_source_b.h +;;; ./general/gr_glfsr_source_f.h +;;; ./general/gr_head.h +;;; ./general/gr_interleave.h +;;; ./general/gr_interleaved_short_to_complex.h +;;; ./general/gr_iqcomp_cc.h +;;; ./general/gr_keep_one_in_n.h +;;; ./general/gr_kludge_copy.h +;;; ./general/gr_lfsr_32k_source_s.h +;;; ./general/gr_lms_dfe_cc.h +;;; ./general/gr_lms_dfe_ff.h +;;; ./general/gr_map_bb.h +;;; ./general/gr_mpsk_receiver_cc.h +;;; ./general/gr_nlog10_ff.h +;;; ./general/gr_nop.h +;;; ./general/gr_null_sink.h +;;; ./general/gr_null_source.h +;;; ./general/gr_ofdm_bpsk_demapper.h +;;; ./general/gr_ofdm_cyclic_prefixer.h +;;; ./general/gr_ofdm_demapper_vcb.h +;;; ./general/gr_ofdm_frame_acquisition.h +;;; ./general/gr_ofdm_frame_sink.h +;;; ./general/gr_ofdm_insert_preamble.h +;;; ./general/gr_ofdm_mapper_bcv.h +;;; ./general/gr_ofdm_sampler.h +;;; ./general/gr_pa_2x2_phase_combiner.h +;;; ./general/gr_packet_sink.h +;;; ./general/gr_peak_detector2_fb.h +;;; ./general/gr_phase_modulator_fc.h +;;; ./general/gr_pll_carriertracking_cc.h +;;; ./general/gr_pll_freqdet_cf.h +;;; ./general/gr_pll_refout_cc.h +;;; ./general/gr_pn_correlator_cc.h +;;; ./general/gr_probe_avg_mag_sqrd_c.h +;;; ./general/gr_probe_avg_mag_sqrd_cf.h +;;; ./general/gr_probe_avg_mag_sqrd_f.h +;;; ./general/gr_probe_density_b.h +;;; ./general/gr_probe_mpsk_snr_c.h +;;; ./general/gr_probe_signal_f.h +;;; ./general/gr_pwr_squelch_cc.h +;;; ./general/gr_pwr_squelch_ff.h +;;; ./general/gr_quadrature_demod_cf.h +;;; ./general/gr_rail_ff.h +;;; ./general/gr_regenerate_bb.h +;;; ./general/gr_repeat.h +;;; ./general/gr_rms_cf.h +;;; ./general/gr_rms_ff.h +;;; ./general/gr_scrambler_bb.h +;;; ./general/gr_short_to_float.h +;;; ./general/gr_simple_correlator.h +;;; ./general/gr_simple_framer.h +;;; ./general/gr_simple_squelch_cc.h +;;; ./general/gr_skiphead.h +;;; ./general/gr_squash_ff.h +;;; ./general/gr_squelch_base_cc.h +;;; ./general/gr_squelch_base_ff.h +;;; ./general/gr_stream_mux.h +;;; ./general/gr_stream_to_streams.h +;;; ./general/gr_stream_to_vector.h +;;; ./general/gr_streams_to_stream.h +;;; ./general/gr_streams_to_vector.h +;;; ./general/gr_stretch_ff.h +;;; ./general/gr_test.h +;;; ./general/gr_threshold_ff.h +;;; ./general/gr_throttle.h +;;; ./general/gr_uchar_to_float.h +;;; ./general/gr_unpack_k_bits_bb.h +;;; ./general/gr_vco_f.h +;;; ./general/gr_vector_to_stream.h +;;; ./general/gr_vector_to_streams.h +;;; ./general/gr_wavelet_ff.h +;;; ./general/gr_wvps_ff.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm b/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm new file mode 100644 index 000000000..8e9c509e8 --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm @@ -0,0 +1,129 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./gengen/gr_add_cc.h +;;; ./gengen/gr_add_const_cc.h +;;; ./gengen/gr_add_const_ff.h +;;; ./gengen/gr_add_const_ii.h +;;; ./gengen/gr_add_const_sf.h +;;; ./gengen/gr_add_const_ss.h +;;; ./gengen/gr_add_const_vcc.h +;;; ./gengen/gr_add_const_vff.h +;;; ./gengen/gr_add_const_vii.h +;;; ./gengen/gr_add_const_vss.h +;;; ./gengen/gr_add_ff.h +;;; ./gengen/gr_add_ii.h +;;; ./gengen/gr_add_ss.h +;;; ./gengen/gr_and_bb.h +;;; ./gengen/gr_and_const_bb.h +;;; ./gengen/gr_and_const_ii.h +;;; ./gengen/gr_and_const_ss.h +;;; ./gengen/gr_and_ii.h +;;; ./gengen/gr_and_ss.h +;;; ./gengen/gr_argmax_fs.h +;;; ./gengen/gr_argmax_is.h +;;; ./gengen/gr_argmax_ss.h +;;; ./gengen/gr_chunks_to_symbols_bc.h +;;; ./gengen/gr_chunks_to_symbols_bf.h +;;; ./gengen/gr_chunks_to_symbols_ic.h +;;; ./gengen/gr_chunks_to_symbols_if.h +;;; ./gengen/gr_chunks_to_symbols_sc.h +;;; ./gengen/gr_chunks_to_symbols_sf.h +;;; ./gengen/gr_divide_cc.h +;;; ./gengen/gr_divide_ff.h +;;; ./gengen/gr_divide_ii.h +;;; ./gengen/gr_divide_ss.h +;;; ./gengen/gr_integrate_cc.h +;;; ./gengen/gr_integrate_ff.h +;;; ./gengen/gr_integrate_ii.h +;;; ./gengen/gr_integrate_ss.h +;;; ./gengen/gr_max_ff.h +;;; ./gengen/gr_max_ii.h +;;; ./gengen/gr_max_ss.h +;;; ./gengen/gr_moving_average_cc.h +;;; ./gengen/gr_moving_average_ff.h +;;; ./gengen/gr_moving_average_ii.h +;;; ./gengen/gr_moving_average_ss.h +;;; ./gengen/gr_multiply_cc.h +;;; ./gengen/gr_multiply_const_cc.h +;;; ./gengen/gr_multiply_const_ff.h +;;; ./gengen/gr_multiply_const_ii.h +;;; ./gengen/gr_multiply_const_ss.h +;;; ./gengen/gr_multiply_const_vcc.h +;;; ./gengen/gr_multiply_const_vff.h +;;; ./gengen/gr_multiply_const_vii.h +;;; ./gengen/gr_multiply_const_vss.h +;;; ./gengen/gr_multiply_ff.h +;;; ./gengen/gr_multiply_ii.h +;;; ./gengen/gr_multiply_ss.h +;;; ./gengen/gr_mute_cc.h +;;; ./gengen/gr_mute_ff.h +;;; ./gengen/gr_mute_ii.h +;;; ./gengen/gr_mute_ss.h +;;; ./gengen/gr_noise_source_c.h +;;; ./gengen/gr_noise_source_f.h +;;; ./gengen/gr_noise_source_i.h +;;; ./gengen/gr_noise_source_s.h +;;; ./gengen/gr_not_bb.h +;;; ./gengen/gr_not_ii.h +;;; ./gengen/gr_not_ss.h +;;; ./gengen/gr_or_bb.h +;;; ./gengen/gr_or_ii.h +;;; ./gengen/gr_or_ss.h +;;; ./gengen/gr_packed_to_unpacked_bb.h +;;; ./gengen/gr_packed_to_unpacked_ii.h +;;; ./gengen/gr_packed_to_unpacked_ss.h +;;; ./gengen/gr_peak_detector_fb.h +;;; ./gengen/gr_peak_detector_ib.h +;;; ./gengen/gr_peak_detector_sb.h +;;; ./gengen/gr_sample_and_hold_bb.h +;;; ./gengen/gr_sample_and_hold_ff.h +;;; ./gengen/gr_sample_and_hold_ii.h +;;; ./gengen/gr_sample_and_hold_ss.h +;;; ./gengen/gr_sig_source_c.h +;;; ./gengen/gr_sig_source_f.h +;;; ./gengen/gr_sig_source_i.h +;;; ./gengen/gr_sig_source_s.h +;;; ./gengen/gr_sub_cc.h +;;; ./gengen/gr_sub_ff.h +;;; ./gengen/gr_sub_ii.h +;;; ./gengen/gr_sub_ss.h +;;; ./gengen/gr_unpacked_to_packed_bb.h +;;; ./gengen/gr_unpacked_to_packed_ii.h +;;; ./gengen/gr_unpacked_to_packed_ss.h +;;; ./gengen/gr_vector_sink_b.h +;;; ./gengen/gr_vector_sink_c.h +;;; ./gengen/gr_vector_sink_f.h +;;; ./gengen/gr_vector_sink_i.h +;;; ./gengen/gr_vector_sink_s.h +;;; ./gengen/gr_vector_source_b.h +;;; ./gengen/gr_vector_source_c.h +;;; ./gengen/gr_vector_source_f.h +;;; ./gengen/gr_vector_source_i.h +;;; ./gengen/gr_vector_source_s.h +;;; ./gengen/gr_xor_bb.h +;;; ./gengen/gr_xor_ii.h +;;; ./gengen/gr_xor_ss.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_hier.scm b/gnuradio-core/src/guile/qa_0010_ctor_hier.scm new file mode 100644 index 000000000..14d3f4119 --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_hier.scm @@ -0,0 +1,27 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_io.scm b/gnuradio-core/src/guile/qa_0010_ctor_io.scm new file mode 100644 index 000000000..95f231091 --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_io.scm @@ -0,0 +1,39 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./io/gr_file_descriptor_sink.h +;;; ./io/gr_file_descriptor_source.h +;;; ./io/gr_file_sink.h +;;; ./io/gr_file_source.h +;;; ./io/gr_histo_sink_f.h +;;; ./io/gr_message_sink.h +;;; ./io/gr_message_source.h +;;; ./io/gr_oscope_sink_f.h +;;; ./io/gr_oscope_sink_x.h +;;; ./io/gr_udp_sink.h +;;; ./io/gr_udp_source.h +;;; ./io/gr_wavfile_sink.h +;;; ./io/gr_wavfile_source.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm b/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm new file mode 100644 index 000000000..339601bf1 --- /dev/null +++ b/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm @@ -0,0 +1,28 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./runtime/gr_hier_block2.h +;;; ./runtime/gr_msg_queue.h -- cgit From f07057eb3a78378799baec89e4f97916ea5e5ba9 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 23:14:09 -0700 Subject: Add copyright and license header --- gnuradio-core/src/guile/qa_0000_basics.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm index 5d3a53d24..aa4dc37ff 100644 --- a/gnuradio-core/src/guile/qa_0000_basics.scm +++ b/gnuradio-core/src/guile/qa_0000_basics.scm @@ -1,3 +1,22 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + (use-modules (gnuradio core)) (use-modules (oop goops)) ;;(use-modules (ice-9 format)) -- cgit From 45a88c35386e7ea0d93651cd528bc7c1261d3197 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 5 Nov 2010 23:25:54 -0700 Subject: Add qa_*.scm files to Makefile as noinst_DATA --- gnuradio-core/src/guile/Makefile.am | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 5a9721b64..4db679cff 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -21,7 +21,8 @@ include $(top_srcdir)/Makefile.common TESTS = run_guile_tests -EXTRA_DIST = run_guile_tests.in +EXTRA_DIST = \ + run_guile_tests.in # These are the hand-code guile files for gnuradio-core. # @@ -37,4 +38,14 @@ nobase_guile_DATA = \ gnuradio/runtime-shim.scm \ srfi/srfi-64.scm +noinst_DATA = \ + qa_0000_basics.scm \ + qa_0010_ctor_filter.scm \ + qa_0010_ctor_general.scm \ + qa_0010_ctor_gengen.scm \ + qa_0010_ctor_hier.scm \ + qa_0010_ctor_io.scm \ + qa_0010_ctor_runtime.scm + + CLEANFILES = qa_*.log -- cgit From 2f865632e7208dc748fe7f2b8003297730fc133d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 6 Nov 2010 00:38:20 -0700 Subject: Refactor guile QA code to use test-group. --- gnuradio-core/src/guile/qa_0000_basics.scm | 41 ++++++++++++++---------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm index aa4dc37ff..423a49478 100644 --- a/gnuradio-core/src/guile/qa_0000_basics.scm +++ b/gnuradio-core/src/guile/qa_0000_basics.scm @@ -27,8 +27,12 @@ (define (vector-map f v) (list->vector (map f (vector->list v)))) -(define (test-connect-1) - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + +;; Must precede all tests +(test-begin "qa_0000_basics") + +(test-group "test-connect-1" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) (src (gr:vector-source-i src-data #f)) @@ -40,10 +44,10 @@ (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) (gr:run tb) - (let ((actual-result (gr:data dst))) - (test-equal expected-result actual-result)))) + (test-equal expected-result (gr:data dst)))) + -(define (test-connect-2) +(test-group "test-connect-2" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -56,10 +60,10 @@ (gr:connect tb op dst) (gr:run tb) - (let ((actual-result (gr:data dst))) - (test-equal expected-result actual-result)))) + (test-equal expected-result (gr:data dst)))) + -(define (test-connect-3) +(test-group "test-connect-3" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -72,10 +76,10 @@ (gr:connect tb `(,op 0) `(,dst 0)) (gr:run tb) - (let ((actual-result (gr:data dst))) - (test-equal expected-result actual-result)))) + (test-equal expected-result (gr:data dst)))) -(define (test-connect-4) + +(test-group "test-connect-4" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -87,10 +91,10 @@ (gr:connect tb src op dst) (gr:run tb) - (let ((actual-result (gr:data dst))) - (test-equal expected-result actual-result)))) + (test-equal expected-result (gr:data dst)))) + -(define (test-io-signature-1) +(test-group "test-io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) (ios2 (gr:io-signature2 1 2 16 32)) (ios3 (gr:io-signature3 1 -1 14 32 48)) @@ -122,12 +126,5 @@ (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) )) - - -(test-begin "qa_0000_basics") -(test-connect-1) -(test-connect-2) -(test-connect-3) -(test-connect-4) -(test-io-signature-1) +;; Must follow all tests (test-end "qa_0000_basics") -- cgit From 5a908ea900ac5f5f418eef71a7647ae540755df7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 13:33:16 -0800 Subject: fix syntax problem in test-assert --- gnuradio-core/src/guile/srfi/srfi-64.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/srfi/srfi-64.scm b/gnuradio-core/src/guile/srfi/srfi-64.scm index 4ad9ccbab..8d61b14a8 100644 --- a/gnuradio-core/src/guile/srfi/srfi-64.scm +++ b/gnuradio-core/src/guile/srfi/srfi-64.scm @@ -850,11 +850,11 @@ (define-syntax test-error (syntax-rules () ((test-error name etype expr) - (test-assert name (%test-error etype expr))) + (test-assert name (%test-error (test-runner-get) etype expr))) ((test-error etype expr) - (test-assert (%test-error etype expr))) + (test-assert (%test-error (test-runner-get) etype expr))) ((test-error expr) - (test-assert (%test-error #t expr))))))) + (test-assert (%test-error (test-runner-get) #t expr))))))) (define (test-apply first . rest) (if (test-runner? first) -- cgit From d3ef5a72bacedfc04bd22448e75be2daf23dd677 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 13:37:05 -0800 Subject: Import guile's own testing framework --- gnuradio-core/src/guile/test-suite/guile-test | 241 +++++++++++ gnuradio-core/src/guile/test-suite/lib.scm | 559 ++++++++++++++++++++++++++ 2 files changed, 800 insertions(+) create mode 100755 gnuradio-core/src/guile/test-suite/guile-test create mode 100644 gnuradio-core/src/guile/test-suite/lib.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/test-suite/guile-test b/gnuradio-core/src/guile/test-suite/guile-test new file mode 100755 index 000000000..1e1c70a77 --- /dev/null +++ b/gnuradio-core/src/guile/test-suite/guile-test @@ -0,0 +1,241 @@ +#!../libguile/guile \ +-e main -s +!# + +;;;; guile-test --- run the Guile test suite +;;;; Jim Blandy --- May 1999 +;;;; +;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This program 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 2, or (at your option) +;;;; any later version. +;;;; +;;;; This program 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 this software; see the file COPYING. If not, write to +;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;;;; Boston, MA 02110-1301 USA + + +;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] +;;;; +;;;; Run tests from the Guile test suite. Report failures and +;;;; unexpected passes to the standard output, along with a summary of +;;;; all the results. Record each reported test outcome in the log +;;;; file, `guile.log'. The exit status is #f if any of the tests +;;;; fail or pass unexpectedly. +;;;; +;;;; Normally, guile-test scans the test directory, and executes all +;;;; files whose names end in `.test'. (It assumes they contain +;;;; Scheme code.) However, you can have it execute specific tests by +;;;; listing their filenames on the command line. +;;;; +;;;; The option `--test-suite' can be given to specify the test +;;;; directory. If no such option is given, the test directory is +;;;; taken from the environment variable TEST_SUITE_DIR (if defined), +;;;; otherwise a default directory that is hardcoded in this file is +;;;; used (see "Installation" below). +;;;; +;;;; If present, the `--log-file LOG' option tells `guile-test' to put +;;;; the log output in a file named LOG. +;;;; +;;;; If present, the `--debug' option will enable a debugging mode. +;;;; +;;;; If present, the `--flag-unresolved' option will cause guile-test +;;;; to exit with failure status if any tests are UNRESOLVED. +;;;; +;;;; +;;;; Installation: +;;;; +;;;; If you change the #! line at the top of this script to point at +;;;; the Guile interpreter you want to test, you can call this script +;;;; as an executable instead of having to pass it as a parameter to +;;;; guile via "guile -e main -s guile-test". Further, you can edit +;;;; the definition of default-test-suite to point to the parent +;;;; directory of the `tests' tree, which makes it unnecessary to set +;;;; the environment variable `TEST_SUITE_DIR'. +;;;; +;;;; +;;;; Shortcomings: +;;;; +;;;; At the moment, due to a simple-minded implementation, test files +;;;; must live in the test directory, and you must specify their names +;;;; relative to the top of the test directory. If you want to send +;;;; me a patch that fixes this, but still leaves sane test names in +;;;; the log file, that would be great. At the moment, all the tests +;;;; I care about are in the test directory, though. +;;;; +;;;; It would be nice if you could specify the Guile interpreter you +;;;; want to test on the command line. As it stands, if you want to +;;;; change which Guile interpreter you're testing, you need to edit +;;;; the #! line at the top of this file, which is stupid. + +(define (main . args) + (let ((module (resolve-module '(test-suite guile-test)))) + (apply (module-ref module 'main) args))) + +(define-module (test-suite guile-test) + :use-module (test-suite lib) + :use-module (ice-9 getopt-long) + :use-module (ice-9 and-let-star) + :use-module (ice-9 rdelim) + :export (main data-file-name test-file-name)) + + +;;; User configurable settings: +(define default-test-suite + (string-append (getenv "HOME") "/bogus-path/test-suite")) + + +;;; Variables that will receive their actual values later. +(define test-suite default-test-suite) + +(define tmp-dir #f) + + +;;; General utilities, that probably should be in a library somewhere. + +;;; Enable debugging +(define (enable-debug-mode) + (write-line %load-path) + (set! %load-verbosely #t) + (debug-enable 'backtrace 'debug)) + +;;; Traverse the directory tree at ROOT, applying F to the name of +;;; each file in the tree, including ROOT itself. For a subdirectory +;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow +;;; symlinks. +(define (for-each-file f root) + + ;; A "hard directory" is a path that denotes a directory and is not a + ;; symlink. + (define (file-is-hard-directory? filename) + (eq? (stat:type (lstat filename)) 'directory)) + + (let visit ((root root)) + (let ((should-recur (f root))) + (if (and should-recur (file-is-hard-directory? root)) + (let ((dir (opendir root))) + (let loop () + (let ((entry (readdir dir))) + (cond + ((eof-object? entry) #f) + ((or (string=? entry ".") + (string=? entry "..") + (string=? entry "CVS") + (string=? entry "RCS")) + (loop)) + (else + (visit (string-append root "/" entry)) + (loop)))))))))) + + +;;; The test driver. + + +;;; Localizing test files and temporary data files. + +(define (data-file-name filename) + (in-vicinity tmp-dir filename)) + +(define (test-file-name test) + (in-vicinity test-suite test)) + +;;; Return a list of all the test files in the test tree. +(define (enumerate-tests test-dir) + (let ((root-len (+ 1 (string-length test-dir))) + (tests '())) + (for-each-file (lambda (file) + (if (has-suffix? file ".test") + (let ((short-name + (substring file root-len))) + (set! tests (cons short-name tests)))) + #t) + test-dir) + + ;; for-each-file presents the files in whatever order it finds + ;; them in the directory. We sort them here, so they'll always + ;; appear in the same order. This makes it easier to compare test + ;; log files mechanically. + (sort tests string. +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) +;;(use-modules (ice-9 format)) +;;(use-modules (ice-9 pretty-print)) + +(load-from-path "srfi/srfi-64") ; unit test library + +(define (vector-map f v) + (list->vector (map f (vector->list v)))) + + +;; Must precede all tests +(test-begin "qa_0000_basics") + +(test-group "test-connect-1" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using gr:ep to create endpoints + (gr:connect tb (gr:ep src 0) (gr:ep op 0)) + (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(test-group "test-connect-2" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using just blocks + (gr:connect tb src op) + (gr:connect tb op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(test-group "test-connect-3" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using lists to represent endpoints + (gr:connect tb `(,src 0) `(,op 0)) + (gr:connect tb `(,op 0) `(,dst 0)) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(test-group "test-connect-4" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using multiple endpoints + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(test-group "test-io-signature-1" + (let ((ios1 (gr:io-signature 1 2 8)) + (ios2 (gr:io-signature2 1 2 16 32)) + (ios3 (gr:io-signature3 1 -1 14 32 48)) + (iosv (gr:io-signaturev 1 4 '(1 2 3)))) + + (test-equal 1 (gr:min-streams ios1)) + (test-equal 2 (gr:max-streams ios1)) + (test-equal 8 (gr:sizeof-stream-item ios1 0)) + (test-equal 8 (gr:sizeof-stream-item ios1 1)) + + (test-equal 1 (gr:min-streams ios2)) + (test-equal 2 (gr:max-streams ios2)) + (test-equal 16 (gr:sizeof-stream-item ios2 0)) + (test-equal 32 (gr:sizeof-stream-item ios2 1)) + + (test-equal 1 (gr:min-streams ios3)) + (test-equal -1 (gr:max-streams ios3)) + (test-equal 14 (gr:sizeof-stream-item ios3 0)) + (test-equal 32 (gr:sizeof-stream-item ios3 1)) + (test-equal 48 (gr:sizeof-stream-item ios3 2)) + (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) + + (test-equal 1 (gr:min-streams iosv)) + (test-equal 4 (gr:max-streams iosv)) + (test-equal 1 (gr:sizeof-stream-item iosv 0)) + (test-equal 2 (gr:sizeof-stream-item iosv 1)) + (test-equal 3 (gr:sizeof-stream-item iosv 2)) + (test-equal 3 (gr:sizeof-stream-item iosv 3)) + (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) + )) + +;; Must follow all tests +(test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/00_runtime_ctors.test b/gnuradio-core/src/guile/00_runtime_ctors.test new file mode 100644 index 000000000..339601bf1 --- /dev/null +++ b/gnuradio-core/src/guile/00_runtime_ctors.test @@ -0,0 +1,28 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./runtime/gr_hier_block2.h +;;; ./runtime/gr_msg_queue.h diff --git a/gnuradio-core/src/guile/filter_ctors.test b/gnuradio-core/src/guile/filter_ctors.test new file mode 100644 index 000000000..0dd539a8e --- /dev/null +++ b/gnuradio-core/src/guile/filter_ctors.test @@ -0,0 +1,92 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./filter/gr_adaptive_fir_ccf.h +;;; ./filter/gr_cma_equalizer_cc.h +;;; ./filter/gr_fft_filter_ccc.h +;;; ./filter/gr_fft_filter_fff.h +;;; ./filter/gr_filter_delay_fc.h +;;; ./filter/gr_fir_ccc_generic.h +;;; ./filter/gr_fir_ccc_simd.h +;;; ./filter/gr_fir_ccc_x86.h +;;; ./filter/gr_fir_ccf_generic.h +;;; ./filter/gr_fir_ccf_simd.h +;;; ./filter/gr_fir_ccf_x86.h +;;; ./filter/gr_fir_fcc_generic.h +;;; ./filter/gr_fir_fcc_simd.h +;;; ./filter/gr_fir_fcc_x86.h +;;; ./filter/gr_fir_fff_altivec.h +;;; ./filter/gr_fir_fff_armv7_a.h +;;; ./filter/gr_fir_fff_generic.h +;;; ./filter/gr_fir_fff_simd.h +;;; ./filter/gr_fir_fff_x86.h +;;; ./filter/gr_fir_filter_ccc.h +;;; ./filter/gr_fir_filter_ccf.h +;;; ./filter/gr_fir_filter_fcc.h +;;; ./filter/gr_fir_filter_fff.h +;;; ./filter/gr_fir_filter_fsf.h +;;; ./filter/gr_fir_filter_scc.h +;;; ./filter/gr_fir_fsf_generic.h +;;; ./filter/gr_fir_fsf_simd.h +;;; ./filter/gr_fir_fsf_x86.h +;;; ./filter/gr_fir_scc_generic.h +;;; ./filter/gr_fir_scc_simd.h +;;; ./filter/gr_fir_scc_x86.h +;;; ./filter/gr_fir_sysconfig_armv7_a.h +;;; ./filter/gr_fir_sysconfig_generic.h +;;; ./filter/gr_fir_sysconfig_powerpc.h +;;; ./filter/gr_fir_sysconfig_x86.h +;;; ./filter/gr_fractional_interpolator_cc.h +;;; ./filter/gr_fractional_interpolator_ff.h +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h +;;; ./filter/gr_freq_xlating_fir_filter_scc.h +;;; ./filter/gr_freq_xlating_fir_filter_scf.h +;;; ./filter/gr_goertzel_fc.h +;;; ./filter/gr_hilbert_fc.h +;;; ./filter/gr_iir_filter_ffd.h +;;; ./filter/gr_interp_fir_filter_ccc.h +;;; ./filter/gr_interp_fir_filter_ccf.h +;;; ./filter/gr_interp_fir_filter_fcc.h +;;; ./filter/gr_interp_fir_filter_fff.h +;;; ./filter/gr_interp_fir_filter_fsf.h +;;; ./filter/gr_interp_fir_filter_scc.h +;;; ./filter/gr_pfb_arb_resampler_ccf.h +;;; ./filter/gr_pfb_channelizer_ccf.h +;;; ./filter/gr_pfb_clock_sync_ccf.h +;;; ./filter/gr_pfb_clock_sync_fff.h +;;; ./filter/gr_pfb_decimator_ccf.h +;;; ./filter/gr_pfb_interpolator_ccf.h +;;; ./filter/gr_rational_resampler_base_ccc.h +;;; ./filter/gr_rational_resampler_base_ccf.h +;;; ./filter/gr_rational_resampler_base_fcc.h +;;; ./filter/gr_rational_resampler_base_fff.h +;;; ./filter/gr_rational_resampler_base_fsf.h +;;; ./filter/gr_rational_resampler_base_scc.h +;;; ./filter/gr_single_pole_iir_filter_cc.h +;;; ./filter/gr_single_pole_iir_filter_ff.h diff --git a/gnuradio-core/src/guile/general_ctors.test b/gnuradio-core/src/guile/general_ctors.test new file mode 100644 index 000000000..1531a59de --- /dev/null +++ b/gnuradio-core/src/guile/general_ctors.test @@ -0,0 +1,143 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./general/gr_additive_scrambler_bb.h +;;; ./general/gr_agc2_cc.h +;;; ./general/gr_agc2_ff.h +;;; ./general/gr_agc_cc.h +;;; ./general/gr_agc_ff.h +;;; ./general/gr_align_on_samplenumbers_ss.h +;;; ./general/gr_bin_statistics_f.h +;;; ./general/gr_binary_slicer_fb.h +;;; ./general/gr_bytes_to_syms.h +;;; ./general/gr_char_to_float.h +;;; ./general/gr_check_counting_s.h +;;; ./general/gr_check_lfsr_32k_s.h +;;; ./general/gr_clock_recovery_mm_cc.h +;;; ./general/gr_clock_recovery_mm_ff.h +;;; ./general/gr_complex_to_interleaved_short.h +;;; ./general/gr_complex_to_xxx.h +;;; ./general/gr_conjugate_cc.h +;;; ./general/gr_constellation_decoder_cb.h +;;; ./general/gr_copy.h +;;; ./general/gr_correlate_access_code_bb.h +;;; ./general/gr_costas_loop_cc.h +;;; ./general/gr_cpfsk_bc.h +;;; ./general/gr_ctcss_squelch_ff.h +;;; ./general/gr_decode_ccsds_27_fb.h +;;; ./general/gr_deinterleave.h +;;; ./general/gr_delay.h +;;; ./general/gr_descrambler_bb.h +;;; ./general/gr_diff_decoder_bb.h +;;; ./general/gr_diff_encoder_bb.h +;;; ./general/gr_diff_phasor_cc.h +;;; ./general/gr_dpll_bb.h +;;; ./general/gr_encode_ccsds_27_bb.h +;;; ./general/gr_fake_channel_coder_pp.h +;;; ./general/gr_feedforward_agc_cc.h +;;; ./general/gr_fft_vcc.h +;;; ./general/gr_fft_vcc_fftw.h +;;; ./general/gr_fft_vfc.h +;;; ./general/gr_fll_band_edge_cc.h +;;; ./general/gr_float_to_char.h +;;; ./general/gr_float_to_complex.h +;;; ./general/gr_float_to_short.h +;;; ./general/gr_float_to_uchar.h +;;; ./general/gr_fmdet_cf.h +;;; ./general/gr_framer_sink_1.h +;;; ./general/gr_frequency_modulator_fc.h +;;; ./general/gr_glfsr_source_b.h +;;; ./general/gr_glfsr_source_f.h +;;; ./general/gr_head.h +;;; ./general/gr_interleave.h +;;; ./general/gr_interleaved_short_to_complex.h +;;; ./general/gr_iqcomp_cc.h +;;; ./general/gr_keep_one_in_n.h +;;; ./general/gr_kludge_copy.h +;;; ./general/gr_lfsr_32k_source_s.h +;;; ./general/gr_lms_dfe_cc.h +;;; ./general/gr_lms_dfe_ff.h +;;; ./general/gr_map_bb.h +;;; ./general/gr_mpsk_receiver_cc.h +;;; ./general/gr_nlog10_ff.h +;;; ./general/gr_nop.h +;;; ./general/gr_null_sink.h +;;; ./general/gr_null_source.h +;;; ./general/gr_ofdm_bpsk_demapper.h +;;; ./general/gr_ofdm_cyclic_prefixer.h +;;; ./general/gr_ofdm_demapper_vcb.h +;;; ./general/gr_ofdm_frame_acquisition.h +;;; ./general/gr_ofdm_frame_sink.h +;;; ./general/gr_ofdm_insert_preamble.h +;;; ./general/gr_ofdm_mapper_bcv.h +;;; ./general/gr_ofdm_sampler.h +;;; ./general/gr_pa_2x2_phase_combiner.h +;;; ./general/gr_packet_sink.h +;;; ./general/gr_peak_detector2_fb.h +;;; ./general/gr_phase_modulator_fc.h +;;; ./general/gr_pll_carriertracking_cc.h +;;; ./general/gr_pll_freqdet_cf.h +;;; ./general/gr_pll_refout_cc.h +;;; ./general/gr_pn_correlator_cc.h +;;; ./general/gr_probe_avg_mag_sqrd_c.h +;;; ./general/gr_probe_avg_mag_sqrd_cf.h +;;; ./general/gr_probe_avg_mag_sqrd_f.h +;;; ./general/gr_probe_density_b.h +;;; ./general/gr_probe_mpsk_snr_c.h +;;; ./general/gr_probe_signal_f.h +;;; ./general/gr_pwr_squelch_cc.h +;;; ./general/gr_pwr_squelch_ff.h +;;; ./general/gr_quadrature_demod_cf.h +;;; ./general/gr_rail_ff.h +;;; ./general/gr_regenerate_bb.h +;;; ./general/gr_repeat.h +;;; ./general/gr_rms_cf.h +;;; ./general/gr_rms_ff.h +;;; ./general/gr_scrambler_bb.h +;;; ./general/gr_short_to_float.h +;;; ./general/gr_simple_correlator.h +;;; ./general/gr_simple_framer.h +;;; ./general/gr_simple_squelch_cc.h +;;; ./general/gr_skiphead.h +;;; ./general/gr_squash_ff.h +;;; ./general/gr_squelch_base_cc.h +;;; ./general/gr_squelch_base_ff.h +;;; ./general/gr_stream_mux.h +;;; ./general/gr_stream_to_streams.h +;;; ./general/gr_stream_to_vector.h +;;; ./general/gr_streams_to_stream.h +;;; ./general/gr_streams_to_vector.h +;;; ./general/gr_stretch_ff.h +;;; ./general/gr_test.h +;;; ./general/gr_threshold_ff.h +;;; ./general/gr_throttle.h +;;; ./general/gr_uchar_to_float.h +;;; ./general/gr_unpack_k_bits_bb.h +;;; ./general/gr_vco_f.h +;;; ./general/gr_vector_to_stream.h +;;; ./general/gr_vector_to_streams.h +;;; ./general/gr_wavelet_ff.h +;;; ./general/gr_wvps_ff.h diff --git a/gnuradio-core/src/guile/gengen_ctors.test b/gnuradio-core/src/guile/gengen_ctors.test new file mode 100644 index 000000000..8e9c509e8 --- /dev/null +++ b/gnuradio-core/src/guile/gengen_ctors.test @@ -0,0 +1,129 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./gengen/gr_add_cc.h +;;; ./gengen/gr_add_const_cc.h +;;; ./gengen/gr_add_const_ff.h +;;; ./gengen/gr_add_const_ii.h +;;; ./gengen/gr_add_const_sf.h +;;; ./gengen/gr_add_const_ss.h +;;; ./gengen/gr_add_const_vcc.h +;;; ./gengen/gr_add_const_vff.h +;;; ./gengen/gr_add_const_vii.h +;;; ./gengen/gr_add_const_vss.h +;;; ./gengen/gr_add_ff.h +;;; ./gengen/gr_add_ii.h +;;; ./gengen/gr_add_ss.h +;;; ./gengen/gr_and_bb.h +;;; ./gengen/gr_and_const_bb.h +;;; ./gengen/gr_and_const_ii.h +;;; ./gengen/gr_and_const_ss.h +;;; ./gengen/gr_and_ii.h +;;; ./gengen/gr_and_ss.h +;;; ./gengen/gr_argmax_fs.h +;;; ./gengen/gr_argmax_is.h +;;; ./gengen/gr_argmax_ss.h +;;; ./gengen/gr_chunks_to_symbols_bc.h +;;; ./gengen/gr_chunks_to_symbols_bf.h +;;; ./gengen/gr_chunks_to_symbols_ic.h +;;; ./gengen/gr_chunks_to_symbols_if.h +;;; ./gengen/gr_chunks_to_symbols_sc.h +;;; ./gengen/gr_chunks_to_symbols_sf.h +;;; ./gengen/gr_divide_cc.h +;;; ./gengen/gr_divide_ff.h +;;; ./gengen/gr_divide_ii.h +;;; ./gengen/gr_divide_ss.h +;;; ./gengen/gr_integrate_cc.h +;;; ./gengen/gr_integrate_ff.h +;;; ./gengen/gr_integrate_ii.h +;;; ./gengen/gr_integrate_ss.h +;;; ./gengen/gr_max_ff.h +;;; ./gengen/gr_max_ii.h +;;; ./gengen/gr_max_ss.h +;;; ./gengen/gr_moving_average_cc.h +;;; ./gengen/gr_moving_average_ff.h +;;; ./gengen/gr_moving_average_ii.h +;;; ./gengen/gr_moving_average_ss.h +;;; ./gengen/gr_multiply_cc.h +;;; ./gengen/gr_multiply_const_cc.h +;;; ./gengen/gr_multiply_const_ff.h +;;; ./gengen/gr_multiply_const_ii.h +;;; ./gengen/gr_multiply_const_ss.h +;;; ./gengen/gr_multiply_const_vcc.h +;;; ./gengen/gr_multiply_const_vff.h +;;; ./gengen/gr_multiply_const_vii.h +;;; ./gengen/gr_multiply_const_vss.h +;;; ./gengen/gr_multiply_ff.h +;;; ./gengen/gr_multiply_ii.h +;;; ./gengen/gr_multiply_ss.h +;;; ./gengen/gr_mute_cc.h +;;; ./gengen/gr_mute_ff.h +;;; ./gengen/gr_mute_ii.h +;;; ./gengen/gr_mute_ss.h +;;; ./gengen/gr_noise_source_c.h +;;; ./gengen/gr_noise_source_f.h +;;; ./gengen/gr_noise_source_i.h +;;; ./gengen/gr_noise_source_s.h +;;; ./gengen/gr_not_bb.h +;;; ./gengen/gr_not_ii.h +;;; ./gengen/gr_not_ss.h +;;; ./gengen/gr_or_bb.h +;;; ./gengen/gr_or_ii.h +;;; ./gengen/gr_or_ss.h +;;; ./gengen/gr_packed_to_unpacked_bb.h +;;; ./gengen/gr_packed_to_unpacked_ii.h +;;; ./gengen/gr_packed_to_unpacked_ss.h +;;; ./gengen/gr_peak_detector_fb.h +;;; ./gengen/gr_peak_detector_ib.h +;;; ./gengen/gr_peak_detector_sb.h +;;; ./gengen/gr_sample_and_hold_bb.h +;;; ./gengen/gr_sample_and_hold_ff.h +;;; ./gengen/gr_sample_and_hold_ii.h +;;; ./gengen/gr_sample_and_hold_ss.h +;;; ./gengen/gr_sig_source_c.h +;;; ./gengen/gr_sig_source_f.h +;;; ./gengen/gr_sig_source_i.h +;;; ./gengen/gr_sig_source_s.h +;;; ./gengen/gr_sub_cc.h +;;; ./gengen/gr_sub_ff.h +;;; ./gengen/gr_sub_ii.h +;;; ./gengen/gr_sub_ss.h +;;; ./gengen/gr_unpacked_to_packed_bb.h +;;; ./gengen/gr_unpacked_to_packed_ii.h +;;; ./gengen/gr_unpacked_to_packed_ss.h +;;; ./gengen/gr_vector_sink_b.h +;;; ./gengen/gr_vector_sink_c.h +;;; ./gengen/gr_vector_sink_f.h +;;; ./gengen/gr_vector_sink_i.h +;;; ./gengen/gr_vector_sink_s.h +;;; ./gengen/gr_vector_source_b.h +;;; ./gengen/gr_vector_source_c.h +;;; ./gengen/gr_vector_source_f.h +;;; ./gengen/gr_vector_source_i.h +;;; ./gengen/gr_vector_source_s.h +;;; ./gengen/gr_xor_bb.h +;;; ./gengen/gr_xor_ii.h +;;; ./gengen/gr_xor_ss.h diff --git a/gnuradio-core/src/guile/hier_ctors.test b/gnuradio-core/src/guile/hier_ctors.test new file mode 100644 index 000000000..14d3f4119 --- /dev/null +++ b/gnuradio-core/src/guile/hier_ctors.test @@ -0,0 +1,27 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/io_ctors.test b/gnuradio-core/src/guile/io_ctors.test new file mode 100644 index 000000000..95f231091 --- /dev/null +++ b/gnuradio-core/src/guile/io_ctors.test @@ -0,0 +1,39 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(load-from-path "srfi/srfi-64") ; unit test library + +;;; Add test code for all constructors in these files +;;; +;;; ./io/gr_file_descriptor_sink.h +;;; ./io/gr_file_descriptor_source.h +;;; ./io/gr_file_sink.h +;;; ./io/gr_file_source.h +;;; ./io/gr_histo_sink_f.h +;;; ./io/gr_message_sink.h +;;; ./io/gr_message_source.h +;;; ./io/gr_oscope_sink_f.h +;;; ./io/gr_oscope_sink_x.h +;;; ./io/gr_udp_sink.h +;;; ./io/gr_udp_source.h +;;; ./io/gr_wavfile_sink.h +;;; ./io/gr_wavfile_source.h diff --git a/gnuradio-core/src/guile/qa_0000_basics.scm b/gnuradio-core/src/guile/qa_0000_basics.scm deleted file mode 100644 index 423a49478..000000000 --- a/gnuradio-core/src/guile/qa_0000_basics.scm +++ /dev/null @@ -1,130 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) -;;(use-modules (ice-9 format)) -;;(use-modules (ice-9 pretty-print)) - -(load-from-path "srfi/srfi-64") ; unit test library - -(define (vector-map f v) - (list->vector (map f (vector->list v)))) - - -;; Must precede all tests -(test-begin "qa_0000_basics") - -(test-group "test-connect-1" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using gr:ep to create endpoints - (gr:connect tb (gr:ep src 0) (gr:ep op 0)) - (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(test-group "test-connect-2" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using just blocks - (gr:connect tb src op) - (gr:connect tb op dst) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(test-group "test-connect-3" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using lists to represent endpoints - (gr:connect tb `(,src 0) `(,op 0)) - (gr:connect tb `(,op 0) `(,dst 0)) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(test-group "test-connect-4" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using multiple endpoints - (gr:connect tb src op dst) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(test-group "test-io-signature-1" - (let ((ios1 (gr:io-signature 1 2 8)) - (ios2 (gr:io-signature2 1 2 16 32)) - (ios3 (gr:io-signature3 1 -1 14 32 48)) - (iosv (gr:io-signaturev 1 4 '(1 2 3)))) - - (test-equal 1 (gr:min-streams ios1)) - (test-equal 2 (gr:max-streams ios1)) - (test-equal 8 (gr:sizeof-stream-item ios1 0)) - (test-equal 8 (gr:sizeof-stream-item ios1 1)) - - (test-equal 1 (gr:min-streams ios2)) - (test-equal 2 (gr:max-streams ios2)) - (test-equal 16 (gr:sizeof-stream-item ios2 0)) - (test-equal 32 (gr:sizeof-stream-item ios2 1)) - - (test-equal 1 (gr:min-streams ios3)) - (test-equal -1 (gr:max-streams ios3)) - (test-equal 14 (gr:sizeof-stream-item ios3 0)) - (test-equal 32 (gr:sizeof-stream-item ios3 1)) - (test-equal 48 (gr:sizeof-stream-item ios3 2)) - (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) - - (test-equal 1 (gr:min-streams iosv)) - (test-equal 4 (gr:max-streams iosv)) - (test-equal 1 (gr:sizeof-stream-item iosv 0)) - (test-equal 2 (gr:sizeof-stream-item iosv 1)) - (test-equal 3 (gr:sizeof-stream-item iosv 2)) - (test-equal 3 (gr:sizeof-stream-item iosv 3)) - (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) - )) - -;; Must follow all tests -(test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/qa_0010_ctor_filter.scm b/gnuradio-core/src/guile/qa_0010_ctor_filter.scm deleted file mode 100644 index 0dd539a8e..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_filter.scm +++ /dev/null @@ -1,92 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./filter/gr_adaptive_fir_ccf.h -;;; ./filter/gr_cma_equalizer_cc.h -;;; ./filter/gr_fft_filter_ccc.h -;;; ./filter/gr_fft_filter_fff.h -;;; ./filter/gr_filter_delay_fc.h -;;; ./filter/gr_fir_ccc_generic.h -;;; ./filter/gr_fir_ccc_simd.h -;;; ./filter/gr_fir_ccc_x86.h -;;; ./filter/gr_fir_ccf_generic.h -;;; ./filter/gr_fir_ccf_simd.h -;;; ./filter/gr_fir_ccf_x86.h -;;; ./filter/gr_fir_fcc_generic.h -;;; ./filter/gr_fir_fcc_simd.h -;;; ./filter/gr_fir_fcc_x86.h -;;; ./filter/gr_fir_fff_altivec.h -;;; ./filter/gr_fir_fff_armv7_a.h -;;; ./filter/gr_fir_fff_generic.h -;;; ./filter/gr_fir_fff_simd.h -;;; ./filter/gr_fir_fff_x86.h -;;; ./filter/gr_fir_filter_ccc.h -;;; ./filter/gr_fir_filter_ccf.h -;;; ./filter/gr_fir_filter_fcc.h -;;; ./filter/gr_fir_filter_fff.h -;;; ./filter/gr_fir_filter_fsf.h -;;; ./filter/gr_fir_filter_scc.h -;;; ./filter/gr_fir_fsf_generic.h -;;; ./filter/gr_fir_fsf_simd.h -;;; ./filter/gr_fir_fsf_x86.h -;;; ./filter/gr_fir_scc_generic.h -;;; ./filter/gr_fir_scc_simd.h -;;; ./filter/gr_fir_scc_x86.h -;;; ./filter/gr_fir_sysconfig_armv7_a.h -;;; ./filter/gr_fir_sysconfig_generic.h -;;; ./filter/gr_fir_sysconfig_powerpc.h -;;; ./filter/gr_fir_sysconfig_x86.h -;;; ./filter/gr_fractional_interpolator_cc.h -;;; ./filter/gr_fractional_interpolator_ff.h -;;; ./filter/gr_freq_xlating_fir_filter_ccc.h -;;; ./filter/gr_freq_xlating_fir_filter_ccf.h -;;; ./filter/gr_freq_xlating_fir_filter_fcc.h -;;; ./filter/gr_freq_xlating_fir_filter_fcf.h -;;; ./filter/gr_freq_xlating_fir_filter_scc.h -;;; ./filter/gr_freq_xlating_fir_filter_scf.h -;;; ./filter/gr_goertzel_fc.h -;;; ./filter/gr_hilbert_fc.h -;;; ./filter/gr_iir_filter_ffd.h -;;; ./filter/gr_interp_fir_filter_ccc.h -;;; ./filter/gr_interp_fir_filter_ccf.h -;;; ./filter/gr_interp_fir_filter_fcc.h -;;; ./filter/gr_interp_fir_filter_fff.h -;;; ./filter/gr_interp_fir_filter_fsf.h -;;; ./filter/gr_interp_fir_filter_scc.h -;;; ./filter/gr_pfb_arb_resampler_ccf.h -;;; ./filter/gr_pfb_channelizer_ccf.h -;;; ./filter/gr_pfb_clock_sync_ccf.h -;;; ./filter/gr_pfb_clock_sync_fff.h -;;; ./filter/gr_pfb_decimator_ccf.h -;;; ./filter/gr_pfb_interpolator_ccf.h -;;; ./filter/gr_rational_resampler_base_ccc.h -;;; ./filter/gr_rational_resampler_base_ccf.h -;;; ./filter/gr_rational_resampler_base_fcc.h -;;; ./filter/gr_rational_resampler_base_fff.h -;;; ./filter/gr_rational_resampler_base_fsf.h -;;; ./filter/gr_rational_resampler_base_scc.h -;;; ./filter/gr_single_pole_iir_filter_cc.h -;;; ./filter/gr_single_pole_iir_filter_ff.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_general.scm b/gnuradio-core/src/guile/qa_0010_ctor_general.scm deleted file mode 100644 index 1531a59de..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_general.scm +++ /dev/null @@ -1,143 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./general/gr_additive_scrambler_bb.h -;;; ./general/gr_agc2_cc.h -;;; ./general/gr_agc2_ff.h -;;; ./general/gr_agc_cc.h -;;; ./general/gr_agc_ff.h -;;; ./general/gr_align_on_samplenumbers_ss.h -;;; ./general/gr_bin_statistics_f.h -;;; ./general/gr_binary_slicer_fb.h -;;; ./general/gr_bytes_to_syms.h -;;; ./general/gr_char_to_float.h -;;; ./general/gr_check_counting_s.h -;;; ./general/gr_check_lfsr_32k_s.h -;;; ./general/gr_clock_recovery_mm_cc.h -;;; ./general/gr_clock_recovery_mm_ff.h -;;; ./general/gr_complex_to_interleaved_short.h -;;; ./general/gr_complex_to_xxx.h -;;; ./general/gr_conjugate_cc.h -;;; ./general/gr_constellation_decoder_cb.h -;;; ./general/gr_copy.h -;;; ./general/gr_correlate_access_code_bb.h -;;; ./general/gr_costas_loop_cc.h -;;; ./general/gr_cpfsk_bc.h -;;; ./general/gr_ctcss_squelch_ff.h -;;; ./general/gr_decode_ccsds_27_fb.h -;;; ./general/gr_deinterleave.h -;;; ./general/gr_delay.h -;;; ./general/gr_descrambler_bb.h -;;; ./general/gr_diff_decoder_bb.h -;;; ./general/gr_diff_encoder_bb.h -;;; ./general/gr_diff_phasor_cc.h -;;; ./general/gr_dpll_bb.h -;;; ./general/gr_encode_ccsds_27_bb.h -;;; ./general/gr_fake_channel_coder_pp.h -;;; ./general/gr_feedforward_agc_cc.h -;;; ./general/gr_fft_vcc.h -;;; ./general/gr_fft_vcc_fftw.h -;;; ./general/gr_fft_vfc.h -;;; ./general/gr_fll_band_edge_cc.h -;;; ./general/gr_float_to_char.h -;;; ./general/gr_float_to_complex.h -;;; ./general/gr_float_to_short.h -;;; ./general/gr_float_to_uchar.h -;;; ./general/gr_fmdet_cf.h -;;; ./general/gr_framer_sink_1.h -;;; ./general/gr_frequency_modulator_fc.h -;;; ./general/gr_glfsr_source_b.h -;;; ./general/gr_glfsr_source_f.h -;;; ./general/gr_head.h -;;; ./general/gr_interleave.h -;;; ./general/gr_interleaved_short_to_complex.h -;;; ./general/gr_iqcomp_cc.h -;;; ./general/gr_keep_one_in_n.h -;;; ./general/gr_kludge_copy.h -;;; ./general/gr_lfsr_32k_source_s.h -;;; ./general/gr_lms_dfe_cc.h -;;; ./general/gr_lms_dfe_ff.h -;;; ./general/gr_map_bb.h -;;; ./general/gr_mpsk_receiver_cc.h -;;; ./general/gr_nlog10_ff.h -;;; ./general/gr_nop.h -;;; ./general/gr_null_sink.h -;;; ./general/gr_null_source.h -;;; ./general/gr_ofdm_bpsk_demapper.h -;;; ./general/gr_ofdm_cyclic_prefixer.h -;;; ./general/gr_ofdm_demapper_vcb.h -;;; ./general/gr_ofdm_frame_acquisition.h -;;; ./general/gr_ofdm_frame_sink.h -;;; ./general/gr_ofdm_insert_preamble.h -;;; ./general/gr_ofdm_mapper_bcv.h -;;; ./general/gr_ofdm_sampler.h -;;; ./general/gr_pa_2x2_phase_combiner.h -;;; ./general/gr_packet_sink.h -;;; ./general/gr_peak_detector2_fb.h -;;; ./general/gr_phase_modulator_fc.h -;;; ./general/gr_pll_carriertracking_cc.h -;;; ./general/gr_pll_freqdet_cf.h -;;; ./general/gr_pll_refout_cc.h -;;; ./general/gr_pn_correlator_cc.h -;;; ./general/gr_probe_avg_mag_sqrd_c.h -;;; ./general/gr_probe_avg_mag_sqrd_cf.h -;;; ./general/gr_probe_avg_mag_sqrd_f.h -;;; ./general/gr_probe_density_b.h -;;; ./general/gr_probe_mpsk_snr_c.h -;;; ./general/gr_probe_signal_f.h -;;; ./general/gr_pwr_squelch_cc.h -;;; ./general/gr_pwr_squelch_ff.h -;;; ./general/gr_quadrature_demod_cf.h -;;; ./general/gr_rail_ff.h -;;; ./general/gr_regenerate_bb.h -;;; ./general/gr_repeat.h -;;; ./general/gr_rms_cf.h -;;; ./general/gr_rms_ff.h -;;; ./general/gr_scrambler_bb.h -;;; ./general/gr_short_to_float.h -;;; ./general/gr_simple_correlator.h -;;; ./general/gr_simple_framer.h -;;; ./general/gr_simple_squelch_cc.h -;;; ./general/gr_skiphead.h -;;; ./general/gr_squash_ff.h -;;; ./general/gr_squelch_base_cc.h -;;; ./general/gr_squelch_base_ff.h -;;; ./general/gr_stream_mux.h -;;; ./general/gr_stream_to_streams.h -;;; ./general/gr_stream_to_vector.h -;;; ./general/gr_streams_to_stream.h -;;; ./general/gr_streams_to_vector.h -;;; ./general/gr_stretch_ff.h -;;; ./general/gr_test.h -;;; ./general/gr_threshold_ff.h -;;; ./general/gr_throttle.h -;;; ./general/gr_uchar_to_float.h -;;; ./general/gr_unpack_k_bits_bb.h -;;; ./general/gr_vco_f.h -;;; ./general/gr_vector_to_stream.h -;;; ./general/gr_vector_to_streams.h -;;; ./general/gr_wavelet_ff.h -;;; ./general/gr_wvps_ff.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm b/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm deleted file mode 100644 index 8e9c509e8..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_gengen.scm +++ /dev/null @@ -1,129 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./gengen/gr_add_cc.h -;;; ./gengen/gr_add_const_cc.h -;;; ./gengen/gr_add_const_ff.h -;;; ./gengen/gr_add_const_ii.h -;;; ./gengen/gr_add_const_sf.h -;;; ./gengen/gr_add_const_ss.h -;;; ./gengen/gr_add_const_vcc.h -;;; ./gengen/gr_add_const_vff.h -;;; ./gengen/gr_add_const_vii.h -;;; ./gengen/gr_add_const_vss.h -;;; ./gengen/gr_add_ff.h -;;; ./gengen/gr_add_ii.h -;;; ./gengen/gr_add_ss.h -;;; ./gengen/gr_and_bb.h -;;; ./gengen/gr_and_const_bb.h -;;; ./gengen/gr_and_const_ii.h -;;; ./gengen/gr_and_const_ss.h -;;; ./gengen/gr_and_ii.h -;;; ./gengen/gr_and_ss.h -;;; ./gengen/gr_argmax_fs.h -;;; ./gengen/gr_argmax_is.h -;;; ./gengen/gr_argmax_ss.h -;;; ./gengen/gr_chunks_to_symbols_bc.h -;;; ./gengen/gr_chunks_to_symbols_bf.h -;;; ./gengen/gr_chunks_to_symbols_ic.h -;;; ./gengen/gr_chunks_to_symbols_if.h -;;; ./gengen/gr_chunks_to_symbols_sc.h -;;; ./gengen/gr_chunks_to_symbols_sf.h -;;; ./gengen/gr_divide_cc.h -;;; ./gengen/gr_divide_ff.h -;;; ./gengen/gr_divide_ii.h -;;; ./gengen/gr_divide_ss.h -;;; ./gengen/gr_integrate_cc.h -;;; ./gengen/gr_integrate_ff.h -;;; ./gengen/gr_integrate_ii.h -;;; ./gengen/gr_integrate_ss.h -;;; ./gengen/gr_max_ff.h -;;; ./gengen/gr_max_ii.h -;;; ./gengen/gr_max_ss.h -;;; ./gengen/gr_moving_average_cc.h -;;; ./gengen/gr_moving_average_ff.h -;;; ./gengen/gr_moving_average_ii.h -;;; ./gengen/gr_moving_average_ss.h -;;; ./gengen/gr_multiply_cc.h -;;; ./gengen/gr_multiply_const_cc.h -;;; ./gengen/gr_multiply_const_ff.h -;;; ./gengen/gr_multiply_const_ii.h -;;; ./gengen/gr_multiply_const_ss.h -;;; ./gengen/gr_multiply_const_vcc.h -;;; ./gengen/gr_multiply_const_vff.h -;;; ./gengen/gr_multiply_const_vii.h -;;; ./gengen/gr_multiply_const_vss.h -;;; ./gengen/gr_multiply_ff.h -;;; ./gengen/gr_multiply_ii.h -;;; ./gengen/gr_multiply_ss.h -;;; ./gengen/gr_mute_cc.h -;;; ./gengen/gr_mute_ff.h -;;; ./gengen/gr_mute_ii.h -;;; ./gengen/gr_mute_ss.h -;;; ./gengen/gr_noise_source_c.h -;;; ./gengen/gr_noise_source_f.h -;;; ./gengen/gr_noise_source_i.h -;;; ./gengen/gr_noise_source_s.h -;;; ./gengen/gr_not_bb.h -;;; ./gengen/gr_not_ii.h -;;; ./gengen/gr_not_ss.h -;;; ./gengen/gr_or_bb.h -;;; ./gengen/gr_or_ii.h -;;; ./gengen/gr_or_ss.h -;;; ./gengen/gr_packed_to_unpacked_bb.h -;;; ./gengen/gr_packed_to_unpacked_ii.h -;;; ./gengen/gr_packed_to_unpacked_ss.h -;;; ./gengen/gr_peak_detector_fb.h -;;; ./gengen/gr_peak_detector_ib.h -;;; ./gengen/gr_peak_detector_sb.h -;;; ./gengen/gr_sample_and_hold_bb.h -;;; ./gengen/gr_sample_and_hold_ff.h -;;; ./gengen/gr_sample_and_hold_ii.h -;;; ./gengen/gr_sample_and_hold_ss.h -;;; ./gengen/gr_sig_source_c.h -;;; ./gengen/gr_sig_source_f.h -;;; ./gengen/gr_sig_source_i.h -;;; ./gengen/gr_sig_source_s.h -;;; ./gengen/gr_sub_cc.h -;;; ./gengen/gr_sub_ff.h -;;; ./gengen/gr_sub_ii.h -;;; ./gengen/gr_sub_ss.h -;;; ./gengen/gr_unpacked_to_packed_bb.h -;;; ./gengen/gr_unpacked_to_packed_ii.h -;;; ./gengen/gr_unpacked_to_packed_ss.h -;;; ./gengen/gr_vector_sink_b.h -;;; ./gengen/gr_vector_sink_c.h -;;; ./gengen/gr_vector_sink_f.h -;;; ./gengen/gr_vector_sink_i.h -;;; ./gengen/gr_vector_sink_s.h -;;; ./gengen/gr_vector_source_b.h -;;; ./gengen/gr_vector_source_c.h -;;; ./gengen/gr_vector_source_f.h -;;; ./gengen/gr_vector_source_i.h -;;; ./gengen/gr_vector_source_s.h -;;; ./gengen/gr_xor_bb.h -;;; ./gengen/gr_xor_ii.h -;;; ./gengen/gr_xor_ss.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_hier.scm b/gnuradio-core/src/guile/qa_0010_ctor_hier.scm deleted file mode 100644 index 14d3f4119..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_hier.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_io.scm b/gnuradio-core/src/guile/qa_0010_ctor_io.scm deleted file mode 100644 index 95f231091..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_io.scm +++ /dev/null @@ -1,39 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./io/gr_file_descriptor_sink.h -;;; ./io/gr_file_descriptor_source.h -;;; ./io/gr_file_sink.h -;;; ./io/gr_file_source.h -;;; ./io/gr_histo_sink_f.h -;;; ./io/gr_message_sink.h -;;; ./io/gr_message_source.h -;;; ./io/gr_oscope_sink_f.h -;;; ./io/gr_oscope_sink_x.h -;;; ./io/gr_udp_sink.h -;;; ./io/gr_udp_source.h -;;; ./io/gr_wavfile_sink.h -;;; ./io/gr_wavfile_source.h diff --git a/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm b/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm deleted file mode 100644 index 339601bf1..000000000 --- a/gnuradio-core/src/guile/qa_0010_ctor_runtime.scm +++ /dev/null @@ -1,28 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(load-from-path "srfi/srfi-64") ; unit test library - -;;; Add test code for all constructors in these files -;;; -;;; ./runtime/gr_hier_block2.h -;;; ./runtime/gr_msg_queue.h -- cgit From e02be919a1abe9bde91aa32ad70f8a7133ce29e3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 15:09:27 -0800 Subject: new QA code work-in-progress --- .../src/guile/gnuradio/test-suite/guile-test | 241 +++++++++ .../src/guile/gnuradio/test-suite/lib.scm | 559 +++++++++++++++++++++ gnuradio-core/src/guile/test-suite/guile-test | 241 --------- gnuradio-core/src/guile/test-suite/lib.scm | 559 --------------------- 4 files changed, 800 insertions(+), 800 deletions(-) create mode 100755 gnuradio-core/src/guile/gnuradio/test-suite/guile-test create mode 100644 gnuradio-core/src/guile/gnuradio/test-suite/lib.scm delete mode 100755 gnuradio-core/src/guile/test-suite/guile-test delete mode 100644 gnuradio-core/src/guile/test-suite/lib.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test new file mode 100755 index 000000000..1e1c70a77 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test @@ -0,0 +1,241 @@ +#!../libguile/guile \ +-e main -s +!# + +;;;; guile-test --- run the Guile test suite +;;;; Jim Blandy --- May 1999 +;;;; +;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This program 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 2, or (at your option) +;;;; any later version. +;;;; +;;;; This program 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 this software; see the file COPYING. If not, write to +;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;;;; Boston, MA 02110-1301 USA + + +;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] +;;;; +;;;; Run tests from the Guile test suite. Report failures and +;;;; unexpected passes to the standard output, along with a summary of +;;;; all the results. Record each reported test outcome in the log +;;;; file, `guile.log'. The exit status is #f if any of the tests +;;;; fail or pass unexpectedly. +;;;; +;;;; Normally, guile-test scans the test directory, and executes all +;;;; files whose names end in `.test'. (It assumes they contain +;;;; Scheme code.) However, you can have it execute specific tests by +;;;; listing their filenames on the command line. +;;;; +;;;; The option `--test-suite' can be given to specify the test +;;;; directory. If no such option is given, the test directory is +;;;; taken from the environment variable TEST_SUITE_DIR (if defined), +;;;; otherwise a default directory that is hardcoded in this file is +;;;; used (see "Installation" below). +;;;; +;;;; If present, the `--log-file LOG' option tells `guile-test' to put +;;;; the log output in a file named LOG. +;;;; +;;;; If present, the `--debug' option will enable a debugging mode. +;;;; +;;;; If present, the `--flag-unresolved' option will cause guile-test +;;;; to exit with failure status if any tests are UNRESOLVED. +;;;; +;;;; +;;;; Installation: +;;;; +;;;; If you change the #! line at the top of this script to point at +;;;; the Guile interpreter you want to test, you can call this script +;;;; as an executable instead of having to pass it as a parameter to +;;;; guile via "guile -e main -s guile-test". Further, you can edit +;;;; the definition of default-test-suite to point to the parent +;;;; directory of the `tests' tree, which makes it unnecessary to set +;;;; the environment variable `TEST_SUITE_DIR'. +;;;; +;;;; +;;;; Shortcomings: +;;;; +;;;; At the moment, due to a simple-minded implementation, test files +;;;; must live in the test directory, and you must specify their names +;;;; relative to the top of the test directory. If you want to send +;;;; me a patch that fixes this, but still leaves sane test names in +;;;; the log file, that would be great. At the moment, all the tests +;;;; I care about are in the test directory, though. +;;;; +;;;; It would be nice if you could specify the Guile interpreter you +;;;; want to test on the command line. As it stands, if you want to +;;;; change which Guile interpreter you're testing, you need to edit +;;;; the #! line at the top of this file, which is stupid. + +(define (main . args) + (let ((module (resolve-module '(test-suite guile-test)))) + (apply (module-ref module 'main) args))) + +(define-module (test-suite guile-test) + :use-module (test-suite lib) + :use-module (ice-9 getopt-long) + :use-module (ice-9 and-let-star) + :use-module (ice-9 rdelim) + :export (main data-file-name test-file-name)) + + +;;; User configurable settings: +(define default-test-suite + (string-append (getenv "HOME") "/bogus-path/test-suite")) + + +;;; Variables that will receive their actual values later. +(define test-suite default-test-suite) + +(define tmp-dir #f) + + +;;; General utilities, that probably should be in a library somewhere. + +;;; Enable debugging +(define (enable-debug-mode) + (write-line %load-path) + (set! %load-verbosely #t) + (debug-enable 'backtrace 'debug)) + +;;; Traverse the directory tree at ROOT, applying F to the name of +;;; each file in the tree, including ROOT itself. For a subdirectory +;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow +;;; symlinks. +(define (for-each-file f root) + + ;; A "hard directory" is a path that denotes a directory and is not a + ;; symlink. + (define (file-is-hard-directory? filename) + (eq? (stat:type (lstat filename)) 'directory)) + + (let visit ((root root)) + (let ((should-recur (f root))) + (if (and should-recur (file-is-hard-directory? root)) + (let ((dir (opendir root))) + (let loop () + (let ((entry (readdir dir))) + (cond + ((eof-object? entry) #f) + ((or (string=? entry ".") + (string=? entry "..") + (string=? entry "CVS") + (string=? entry "RCS")) + (loop)) + (else + (visit (string-append root "/" entry)) + (loop)))))))))) + + +;;; The test driver. + + +;;; Localizing test files and temporary data files. + +(define (data-file-name filename) + (in-vicinity tmp-dir filename)) + +(define (test-file-name test) + (in-vicinity test-suite test)) + +;;; Return a list of all the test files in the test tree. +(define (enumerate-tests test-dir) + (let ((root-len (+ 1 (string-length test-dir))) + (tests '())) + (for-each-file (lambda (file) + (if (has-suffix? file ".test") + (let ((short-name + (substring file root-len))) + (set! tests (cons short-name tests)))) + #t) + test-dir) + + ;; for-each-file presents the files in whatever order it finds + ;; them in the directory. We sort them here, so they'll always + ;; appear in the same order. This makes it easier to compare test + ;; log files mechanically. + (sort tests string --- May 1999 -;;;; -;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. -;;;; -;;;; This program 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 2, or (at your option) -;;;; any later version. -;;;; -;;;; This program 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 this software; see the file COPYING. If not, write to -;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;;;; Boston, MA 02110-1301 USA - - -;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] -;;;; -;;;; Run tests from the Guile test suite. Report failures and -;;;; unexpected passes to the standard output, along with a summary of -;;;; all the results. Record each reported test outcome in the log -;;;; file, `guile.log'. The exit status is #f if any of the tests -;;;; fail or pass unexpectedly. -;;;; -;;;; Normally, guile-test scans the test directory, and executes all -;;;; files whose names end in `.test'. (It assumes they contain -;;;; Scheme code.) However, you can have it execute specific tests by -;;;; listing their filenames on the command line. -;;;; -;;;; The option `--test-suite' can be given to specify the test -;;;; directory. If no such option is given, the test directory is -;;;; taken from the environment variable TEST_SUITE_DIR (if defined), -;;;; otherwise a default directory that is hardcoded in this file is -;;;; used (see "Installation" below). -;;;; -;;;; If present, the `--log-file LOG' option tells `guile-test' to put -;;;; the log output in a file named LOG. -;;;; -;;;; If present, the `--debug' option will enable a debugging mode. -;;;; -;;;; If present, the `--flag-unresolved' option will cause guile-test -;;;; to exit with failure status if any tests are UNRESOLVED. -;;;; -;;;; -;;;; Installation: -;;;; -;;;; If you change the #! line at the top of this script to point at -;;;; the Guile interpreter you want to test, you can call this script -;;;; as an executable instead of having to pass it as a parameter to -;;;; guile via "guile -e main -s guile-test". Further, you can edit -;;;; the definition of default-test-suite to point to the parent -;;;; directory of the `tests' tree, which makes it unnecessary to set -;;;; the environment variable `TEST_SUITE_DIR'. -;;;; -;;;; -;;;; Shortcomings: -;;;; -;;;; At the moment, due to a simple-minded implementation, test files -;;;; must live in the test directory, and you must specify their names -;;;; relative to the top of the test directory. If you want to send -;;;; me a patch that fixes this, but still leaves sane test names in -;;;; the log file, that would be great. At the moment, all the tests -;;;; I care about are in the test directory, though. -;;;; -;;;; It would be nice if you could specify the Guile interpreter you -;;;; want to test on the command line. As it stands, if you want to -;;;; change which Guile interpreter you're testing, you need to edit -;;;; the #! line at the top of this file, which is stupid. - -(define (main . args) - (let ((module (resolve-module '(test-suite guile-test)))) - (apply (module-ref module 'main) args))) - -(define-module (test-suite guile-test) - :use-module (test-suite lib) - :use-module (ice-9 getopt-long) - :use-module (ice-9 and-let-star) - :use-module (ice-9 rdelim) - :export (main data-file-name test-file-name)) - - -;;; User configurable settings: -(define default-test-suite - (string-append (getenv "HOME") "/bogus-path/test-suite")) - - -;;; Variables that will receive their actual values later. -(define test-suite default-test-suite) - -(define tmp-dir #f) - - -;;; General utilities, that probably should be in a library somewhere. - -;;; Enable debugging -(define (enable-debug-mode) - (write-line %load-path) - (set! %load-verbosely #t) - (debug-enable 'backtrace 'debug)) - -;;; Traverse the directory tree at ROOT, applying F to the name of -;;; each file in the tree, including ROOT itself. For a subdirectory -;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow -;;; symlinks. -(define (for-each-file f root) - - ;; A "hard directory" is a path that denotes a directory and is not a - ;; symlink. - (define (file-is-hard-directory? filename) - (eq? (stat:type (lstat filename)) 'directory)) - - (let visit ((root root)) - (let ((should-recur (f root))) - (if (and should-recur (file-is-hard-directory? root)) - (let ((dir (opendir root))) - (let loop () - (let ((entry (readdir dir))) - (cond - ((eof-object? entry) #f) - ((or (string=? entry ".") - (string=? entry "..") - (string=? entry "CVS") - (string=? entry "RCS")) - (loop)) - (else - (visit (string-append root "/" entry)) - (loop)))))))))) - - -;;; The test driver. - - -;;; Localizing test files and temporary data files. - -(define (data-file-name filename) - (in-vicinity tmp-dir filename)) - -(define (test-file-name test) - (in-vicinity test-suite test)) - -;;; Return a list of all the test files in the test tree. -(define (enumerate-tests test-dir) - (let ((root-len (+ 1 (string-length test-dir))) - (tests '())) - (for-each-file (lambda (file) - (if (has-suffix? file ".test") - (let ((short-name - (substring file root-len))) - (set! tests (cons short-name tests)))) - #t) - test-dir) - - ;; for-each-file presents the files in whatever order it finds - ;; them in the directory. We sort them here, so they'll always - ;; appear in the same order. This makes it easier to compare test - ;; log files mechanically. - (sort tests string. ;;; +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) +(use-modules (ice-9 syncase)) ;;(use-modules (ice-9 format)) ;;(use-modules (ice-9 pretty-print)) -(load-from-path "srfi/srfi-64") ; unit test library +;; (test-equal [name] expected test-expr) +(define-syntax test-equal + (syntax-rules () + ((_ expected test-expr) + (pass-if (equal? expected test-expr))) + ((_ name expected test-exprt) + (pass-if name (equal? expected test-expr))))) + (define (vector-map f v) (list->vector (map f (vector->list v)))) -;; Must precede all tests -(test-begin "qa_0000_basics") - -(test-group "test-connect-1" +(with-test-prefix "test-connect-1" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -44,10 +51,11 @@ (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) (gr:run tb) - (test-equal expected-result (gr:data dst)))) - + ;;(pass-if (equal? expected-result (gr:data dst))) + (test-equal expected-result (gr:data dst)) + )) -(test-group "test-connect-2" +(with-test-prefix "test-connect-2" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -63,7 +71,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-connect-3" +(with-test-prefix "test-connect-3" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -79,7 +87,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-connect-4" +(with-test-prefix "test-connect-4" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -94,7 +102,7 @@ (test-equal expected-result (gr:data dst)))) -(test-group "test-io-signature-1" +(with-test-prefix "test-io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) (ios2 (gr:io-signature2 1 2 16 32)) (ios3 (gr:io-signature3 1 -1 14 32 48)) @@ -126,5 +134,3 @@ (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) )) -;; Must follow all tests -(test-end "qa_0000_basics") diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 4db679cff..bbb36794e 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -38,14 +38,14 @@ nobase_guile_DATA = \ gnuradio/runtime-shim.scm \ srfi/srfi-64.scm -noinst_DATA = \ - qa_0000_basics.scm \ - qa_0010_ctor_filter.scm \ - qa_0010_ctor_general.scm \ - qa_0010_ctor_gengen.scm \ - qa_0010_ctor_hier.scm \ - qa_0010_ctor_io.scm \ - qa_0010_ctor_runtime.scm - +# noinst_DATA = \ +# qa_0000_basics.scm \ +# qa_0010_ctor_filter.scm \ +# qa_0010_ctor_general.scm \ +# qa_0010_ctor_gengen.scm \ +# qa_0010_ctor_hier.scm \ +# qa_0010_ctor_io.scm \ +# qa_0010_ctor_runtime.scm +# CLEANFILES = qa_*.log diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test index 1e1c70a77..6dc1a9658 100755 --- a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test +++ b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test @@ -1,4 +1,4 @@ -#!../libguile/guile \ +#!/usr/bin/guile \ -e main -s !# @@ -77,11 +77,11 @@ ;;;; the #! line at the top of this file, which is stupid. (define (main . args) - (let ((module (resolve-module '(test-suite guile-test)))) + (let ((module (resolve-module '(gnuradio test-suite guile-test)))) (apply (module-ref module 'main) args))) -(define-module (test-suite guile-test) - :use-module (test-suite lib) +(define-module (gnuradio test-suite guile-test) + :use-module (gnuradio test-suite lib) :use-module (ice-9 getopt-long) :use-module (ice-9 and-let-star) :use-module (ice-9 rdelim) diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm index c4ddf9e7c..272fe2f10 100644 --- a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm +++ b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm @@ -16,7 +16,7 @@ ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;;;; Boston, MA 02110-1301 USA -(define-module (test-suite lib) +(define-module (gnuradio test-suite lib) :use-module (ice-9 stack-catch) :use-module (ice-9 regex) :export ( -- cgit From 8a4a74414804f1ccc1ce748b14f82acff3078806 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 15:37:04 -0800 Subject: Modify *.test to import correct modules --- gnuradio-core/src/guile/.gitignore | 2 +- gnuradio-core/src/guile/00_runtime_basics.test | 12 -------- gnuradio-core/src/guile/00_runtime_ctors.test | 6 +++- gnuradio-core/src/guile/Makefile.am | 22 +++++++------- gnuradio-core/src/guile/filter_ctors.test | 7 +++-- gnuradio-core/src/guile/general_ctors.test | 7 +++-- gnuradio-core/src/guile/gengen_ctors.test | 7 +++-- .../src/guile/gnuradio/test-suite/lib.scm | 35 +++++++++++++++++++++- gnuradio-core/src/guile/hier_ctors.test | 7 +++-- gnuradio-core/src/guile/io_ctors.test | 7 +++-- 10 files changed, 76 insertions(+), 36 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index c76800aac..82a29a907 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -1,4 +1,4 @@ /Makefile /Makefile.in /run_guile_tests -/qa_*.log +/guile.log diff --git a/gnuradio-core/src/guile/00_runtime_basics.test b/gnuradio-core/src/guile/00_runtime_basics.test index a8fcf263b..c9d251268 100644 --- a/gnuradio-core/src/guile/00_runtime_basics.test +++ b/gnuradio-core/src/guile/00_runtime_basics.test @@ -21,18 +21,6 @@ (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(use-modules (ice-9 syncase)) -;;(use-modules (ice-9 format)) -;;(use-modules (ice-9 pretty-print)) - -;; (test-equal [name] expected test-expr) -(define-syntax test-equal - (syntax-rules () - ((_ expected test-expr) - (pass-if (equal? expected test-expr))) - ((_ name expected test-exprt) - (pass-if name (equal? expected test-expr))))) - (define (vector-map f v) (list->vector (map f (vector->list v)))) diff --git a/gnuradio-core/src/guile/00_runtime_ctors.test b/gnuradio-core/src/guile/00_runtime_ctors.test index 339601bf1..e0a946ab9 100644 --- a/gnuradio-core/src/guile/00_runtime_ctors.test +++ b/gnuradio-core/src/guile/00_runtime_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,10 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library ;;; Add test code for all constructors in these files ;;; diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index bbb36794e..71ce29067 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -36,16 +36,16 @@ nobase_guile_DATA = \ gnuradio/core.scm \ gnuradio/export-safely.scm \ gnuradio/runtime-shim.scm \ - srfi/srfi-64.scm + gnuradio/test-suite/guile-test \ + gnuradio/test-suite/lib.scm -# noinst_DATA = \ -# qa_0000_basics.scm \ -# qa_0010_ctor_filter.scm \ -# qa_0010_ctor_general.scm \ -# qa_0010_ctor_gengen.scm \ -# qa_0010_ctor_hier.scm \ -# qa_0010_ctor_io.scm \ -# qa_0010_ctor_runtime.scm -# +noinst_DATA = \ + 00_runtime_basics.test \ + 00_runtime_ctors.test \ + filter_ctors.test \ + general_ctors.test \ + gengen_ctors.test \ + hier_ctors.test \ + io_ctors.test -CLEANFILES = qa_*.log +CLEANFILES = guile.log diff --git a/gnuradio-core/src/guile/filter_ctors.test b/gnuradio-core/src/guile/filter_ctors.test index 0dd539a8e..040b8ba10 100644 --- a/gnuradio-core/src/guile/filter_ctors.test +++ b/gnuradio-core/src/guile/filter_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,11 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library - ;;; Add test code for all constructors in these files ;;; ;;; ./filter/gr_adaptive_fir_ccf.h diff --git a/gnuradio-core/src/guile/general_ctors.test b/gnuradio-core/src/guile/general_ctors.test index 1531a59de..8d272f768 100644 --- a/gnuradio-core/src/guile/general_ctors.test +++ b/gnuradio-core/src/guile/general_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,11 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library - ;;; Add test code for all constructors in these files ;;; ;;; ./general/gr_additive_scrambler_bb.h diff --git a/gnuradio-core/src/guile/gengen_ctors.test b/gnuradio-core/src/guile/gengen_ctors.test index 8e9c509e8..652556d3f 100644 --- a/gnuradio-core/src/guile/gengen_ctors.test +++ b/gnuradio-core/src/guile/gengen_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,11 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library - ;;; Add test code for all constructors in these files ;;; ;;; ./gengen/gr_add_cc.h diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm index 272fe2f10..b7046a8b0 100644 --- a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm +++ b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm @@ -19,6 +19,7 @@ (define-module (gnuradio test-suite lib) :use-module (ice-9 stack-catch) :use-module (ice-9 regex) + :use-module (ice-9 syncase) :export ( ;; Exceptions which are commonly being tested for. @@ -50,7 +51,13 @@ make-count-reporter print-counts make-log-reporter full-reporter - user-reporter)) + user-reporter + + ;; srfi-64 compatibility macros + test-equal + test-eqv + test-eq +)) ;;;; If you're using Emacs's Scheme mode: @@ -557,3 +564,29 @@ (apply full-reporter result name args))) (set! default-reporter full-reporter) + + +;;; Macros for a bit of compatibility with srfi-64 +;;; (test-equal [name] expected test-expr) +(define-syntax test-equal + (syntax-rules () + ((_ expected test-expr) + (pass-if (equal? expected test-expr))) + ((_ name expected test-exprt) + (pass-if name (equal? expected test-expr))))) + +;;; (test-eqv [name] expected test-expr) +(define-syntax test-eqv + (syntax-rules () + ((_ expected test-expr) + (pass-if (eqv? expected test-expr))) + ((_ name expected test-exprt) + (pass-if name (eqv? expected test-expr))))) + +;;; (test-eq [name] expected test-expr) +(define-syntax test-eq + (syntax-rules () + ((_ expected test-expr) + (pass-if (eq? expected test-expr))) + ((_ name expected test-exprt) + (pass-if name (eq? expected test-expr))))) diff --git a/gnuradio-core/src/guile/hier_ctors.test b/gnuradio-core/src/guile/hier_ctors.test index 14d3f4119..c297fb9dd 100644 --- a/gnuradio-core/src/guile/hier_ctors.test +++ b/gnuradio-core/src/guile/hier_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,11 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library - ;;; Add test code for all constructors in these files ;;; ;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/io_ctors.test b/gnuradio-core/src/guile/io_ctors.test index 95f231091..2001e5fa5 100644 --- a/gnuradio-core/src/guile/io_ctors.test +++ b/gnuradio-core/src/guile/io_ctors.test @@ -1,3 +1,4 @@ +;;; -*- Scheme -*- ;;; ;;; Copyright 2010 Free Software Foundation, Inc. ;;; @@ -17,11 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -(load-from-path "srfi/srfi-64") ; unit test library - ;;; Add test code for all constructors in these files ;;; ;;; ./io/gr_file_descriptor_sink.h -- cgit From f4959dce1e5ec6b61c10df489c2421d56963beb3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 16:02:24 -0800 Subject: guile-test -> guile-test.in so we can use @GUILE@ --- gnuradio-core/src/guile/.gitignore | 1 + gnuradio-core/src/guile/Makefile.am | 4 +- .../src/guile/gnuradio/test-suite/guile-test | 241 --------------------- .../src/guile/gnuradio/test-suite/guile-test.in | 241 +++++++++++++++++++++ 4 files changed, 245 insertions(+), 242 deletions(-) delete mode 100755 gnuradio-core/src/guile/gnuradio/test-suite/guile-test create mode 100755 gnuradio-core/src/guile/gnuradio/test-suite/guile-test.in (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index 82a29a907..bc212f566 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -2,3 +2,4 @@ /Makefile.in /run_guile_tests /guile.log +/gnuradio/test-suite/guile-test diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 71ce29067..d7fdbce60 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -22,7 +22,9 @@ include $(top_srcdir)/Makefile.common TESTS = run_guile_tests EXTRA_DIST = \ - run_guile_tests.in + run_guile_tests.in \ + gnuradio/test-suite/guile-test.in + # These are the hand-code guile files for gnuradio-core. # diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test deleted file mode 100755 index 6dc1a9658..000000000 --- a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/guile \ --e main -s -!# - -;;;; guile-test --- run the Guile test suite -;;;; Jim Blandy --- May 1999 -;;;; -;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. -;;;; -;;;; This program 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 2, or (at your option) -;;;; any later version. -;;;; -;;;; This program 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 this software; see the file COPYING. If not, write to -;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;;;; Boston, MA 02110-1301 USA - - -;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] -;;;; -;;;; Run tests from the Guile test suite. Report failures and -;;;; unexpected passes to the standard output, along with a summary of -;;;; all the results. Record each reported test outcome in the log -;;;; file, `guile.log'. The exit status is #f if any of the tests -;;;; fail or pass unexpectedly. -;;;; -;;;; Normally, guile-test scans the test directory, and executes all -;;;; files whose names end in `.test'. (It assumes they contain -;;;; Scheme code.) However, you can have it execute specific tests by -;;;; listing their filenames on the command line. -;;;; -;;;; The option `--test-suite' can be given to specify the test -;;;; directory. If no such option is given, the test directory is -;;;; taken from the environment variable TEST_SUITE_DIR (if defined), -;;;; otherwise a default directory that is hardcoded in this file is -;;;; used (see "Installation" below). -;;;; -;;;; If present, the `--log-file LOG' option tells `guile-test' to put -;;;; the log output in a file named LOG. -;;;; -;;;; If present, the `--debug' option will enable a debugging mode. -;;;; -;;;; If present, the `--flag-unresolved' option will cause guile-test -;;;; to exit with failure status if any tests are UNRESOLVED. -;;;; -;;;; -;;;; Installation: -;;;; -;;;; If you change the #! line at the top of this script to point at -;;;; the Guile interpreter you want to test, you can call this script -;;;; as an executable instead of having to pass it as a parameter to -;;;; guile via "guile -e main -s guile-test". Further, you can edit -;;;; the definition of default-test-suite to point to the parent -;;;; directory of the `tests' tree, which makes it unnecessary to set -;;;; the environment variable `TEST_SUITE_DIR'. -;;;; -;;;; -;;;; Shortcomings: -;;;; -;;;; At the moment, due to a simple-minded implementation, test files -;;;; must live in the test directory, and you must specify their names -;;;; relative to the top of the test directory. If you want to send -;;;; me a patch that fixes this, but still leaves sane test names in -;;;; the log file, that would be great. At the moment, all the tests -;;;; I care about are in the test directory, though. -;;;; -;;;; It would be nice if you could specify the Guile interpreter you -;;;; want to test on the command line. As it stands, if you want to -;;;; change which Guile interpreter you're testing, you need to edit -;;;; the #! line at the top of this file, which is stupid. - -(define (main . args) - (let ((module (resolve-module '(gnuradio test-suite guile-test)))) - (apply (module-ref module 'main) args))) - -(define-module (gnuradio test-suite guile-test) - :use-module (gnuradio test-suite lib) - :use-module (ice-9 getopt-long) - :use-module (ice-9 and-let-star) - :use-module (ice-9 rdelim) - :export (main data-file-name test-file-name)) - - -;;; User configurable settings: -(define default-test-suite - (string-append (getenv "HOME") "/bogus-path/test-suite")) - - -;;; Variables that will receive their actual values later. -(define test-suite default-test-suite) - -(define tmp-dir #f) - - -;;; General utilities, that probably should be in a library somewhere. - -;;; Enable debugging -(define (enable-debug-mode) - (write-line %load-path) - (set! %load-verbosely #t) - (debug-enable 'backtrace 'debug)) - -;;; Traverse the directory tree at ROOT, applying F to the name of -;;; each file in the tree, including ROOT itself. For a subdirectory -;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow -;;; symlinks. -(define (for-each-file f root) - - ;; A "hard directory" is a path that denotes a directory and is not a - ;; symlink. - (define (file-is-hard-directory? filename) - (eq? (stat:type (lstat filename)) 'directory)) - - (let visit ((root root)) - (let ((should-recur (f root))) - (if (and should-recur (file-is-hard-directory? root)) - (let ((dir (opendir root))) - (let loop () - (let ((entry (readdir dir))) - (cond - ((eof-object? entry) #f) - ((or (string=? entry ".") - (string=? entry "..") - (string=? entry "CVS") - (string=? entry "RCS")) - (loop)) - (else - (visit (string-append root "/" entry)) - (loop)))))))))) - - -;;; The test driver. - - -;;; Localizing test files and temporary data files. - -(define (data-file-name filename) - (in-vicinity tmp-dir filename)) - -(define (test-file-name test) - (in-vicinity test-suite test)) - -;;; Return a list of all the test files in the test tree. -(define (enumerate-tests test-dir) - (let ((root-len (+ 1 (string-length test-dir))) - (tests '())) - (for-each-file (lambda (file) - (if (has-suffix? file ".test") - (let ((short-name - (substring file root-len))) - (set! tests (cons short-name tests)))) - #t) - test-dir) - - ;; for-each-file presents the files in whatever order it finds - ;; them in the directory. We sort them here, so they'll always - ;; appear in the same order. This makes it easier to compare test - ;; log files mechanically. - (sort tests string --- May 1999 +;;;; +;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This program 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 2, or (at your option) +;;;; any later version. +;;;; +;;;; This program 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 this software; see the file COPYING. If not, write to +;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;;;; Boston, MA 02110-1301 USA + + +;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] +;;;; +;;;; Run tests from the Guile test suite. Report failures and +;;;; unexpected passes to the standard output, along with a summary of +;;;; all the results. Record each reported test outcome in the log +;;;; file, `guile.log'. The exit status is #f if any of the tests +;;;; fail or pass unexpectedly. +;;;; +;;;; Normally, guile-test scans the test directory, and executes all +;;;; files whose names end in `.test'. (It assumes they contain +;;;; Scheme code.) However, you can have it execute specific tests by +;;;; listing their filenames on the command line. +;;;; +;;;; The option `--test-suite' can be given to specify the test +;;;; directory. If no such option is given, the test directory is +;;;; taken from the environment variable TEST_SUITE_DIR (if defined), +;;;; otherwise a default directory that is hardcoded in this file is +;;;; used (see "Installation" below). +;;;; +;;;; If present, the `--log-file LOG' option tells `guile-test' to put +;;;; the log output in a file named LOG. +;;;; +;;;; If present, the `--debug' option will enable a debugging mode. +;;;; +;;;; If present, the `--flag-unresolved' option will cause guile-test +;;;; to exit with failure status if any tests are UNRESOLVED. +;;;; +;;;; +;;;; Installation: +;;;; +;;;; If you change the #! line at the top of this script to point at +;;;; the Guile interpreter you want to test, you can call this script +;;;; as an executable instead of having to pass it as a parameter to +;;;; guile via "guile -e main -s guile-test". Further, you can edit +;;;; the definition of default-test-suite to point to the parent +;;;; directory of the `tests' tree, which makes it unnecessary to set +;;;; the environment variable `TEST_SUITE_DIR'. +;;;; +;;;; +;;;; Shortcomings: +;;;; +;;;; At the moment, due to a simple-minded implementation, test files +;;;; must live in the test directory, and you must specify their names +;;;; relative to the top of the test directory. If you want to send +;;;; me a patch that fixes this, but still leaves sane test names in +;;;; the log file, that would be great. At the moment, all the tests +;;;; I care about are in the test directory, though. +;;;; +;;;; It would be nice if you could specify the Guile interpreter you +;;;; want to test on the command line. As it stands, if you want to +;;;; change which Guile interpreter you're testing, you need to edit +;;;; the #! line at the top of this file, which is stupid. + +(define (main . args) + (let ((module (resolve-module '(gnuradio test-suite guile-test)))) + (apply (module-ref module 'main) args))) + +(define-module (gnuradio test-suite guile-test) + :use-module (gnuradio test-suite lib) + :use-module (ice-9 getopt-long) + :use-module (ice-9 and-let-star) + :use-module (ice-9 rdelim) + :export (main data-file-name test-file-name)) + + +;;; User configurable settings: +(define default-test-suite + (string-append (getenv "HOME") "/bogus-path/test-suite")) + + +;;; Variables that will receive their actual values later. +(define test-suite default-test-suite) + +(define tmp-dir #f) + + +;;; General utilities, that probably should be in a library somewhere. + +;;; Enable debugging +(define (enable-debug-mode) + (write-line %load-path) + (set! %load-verbosely #t) + (debug-enable 'backtrace 'debug)) + +;;; Traverse the directory tree at ROOT, applying F to the name of +;;; each file in the tree, including ROOT itself. For a subdirectory +;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow +;;; symlinks. +(define (for-each-file f root) + + ;; A "hard directory" is a path that denotes a directory and is not a + ;; symlink. + (define (file-is-hard-directory? filename) + (eq? (stat:type (lstat filename)) 'directory)) + + (let visit ((root root)) + (let ((should-recur (f root))) + (if (and should-recur (file-is-hard-directory? root)) + (let ((dir (opendir root))) + (let loop () + (let ((entry (readdir dir))) + (cond + ((eof-object? entry) #f) + ((or (string=? entry ".") + (string=? entry "..") + (string=? entry "CVS") + (string=? entry "RCS")) + (loop)) + (else + (visit (string-append root "/" entry)) + (loop)))))))))) + + +;;; The test driver. + + +;;; Localizing test files and temporary data files. + +(define (data-file-name filename) + (in-vicinity tmp-dir filename)) + +(define (test-file-name test) + (in-vicinity test-suite test)) + +;;; Return a list of all the test files in the test tree. +(define (enumerate-tests test-dir) + (let ((root-len (+ 1 (string-length test-dir))) + (tests '())) + (for-each-file (lambda (file) + (if (has-suffix? file ".test") + (let ((short-name + (substring file root-len))) + (set! tests (cons short-name tests)))) + #t) + test-dir) + + ;; for-each-file presents the files in whatever order it finds + ;; them in the directory. We sort them here, so they'll always + ;; appear in the same order. This makes it easier to compare test + ;; log files mechanically. + (sort tests string. -;;; - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -(define (vector-map f v) - (list->vector (map f (vector->list v)))) - - -(with-test-prefix "test-connect-1" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using gr:ep to create endpoints - (gr:connect tb (gr:ep src 0) (gr:ep op 0)) - (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) - - (gr:run tb) - ;;(pass-if (equal? expected-result (gr:data dst))) - (test-equal expected-result (gr:data dst)) - )) - -(with-test-prefix "test-connect-2" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using just blocks - (gr:connect tb src op) - (gr:connect tb op dst) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(with-test-prefix "test-connect-3" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using lists to represent endpoints - (gr:connect tb `(,src 0) `(,op 0)) - (gr:connect tb `(,op 0) `(,dst 0)) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(with-test-prefix "test-connect-4" - (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) - (expected-result (vector-map (lambda (x) (* x 2)) src-data)) - (tb (gr:top-block-swig "QA top block")) - (src (gr:vector-source-i src-data #f)) - (op (gr:multiply-const-ii 2)) - (dst (gr:vector-sink-i))) - - ;; using multiple endpoints - (gr:connect tb src op dst) - - (gr:run tb) - (test-equal expected-result (gr:data dst)))) - - -(with-test-prefix "test-io-signature-1" - (let ((ios1 (gr:io-signature 1 2 8)) - (ios2 (gr:io-signature2 1 2 16 32)) - (ios3 (gr:io-signature3 1 -1 14 32 48)) - (iosv (gr:io-signaturev 1 4 '(1 2 3)))) - - (test-equal 1 (gr:min-streams ios1)) - (test-equal 2 (gr:max-streams ios1)) - (test-equal 8 (gr:sizeof-stream-item ios1 0)) - (test-equal 8 (gr:sizeof-stream-item ios1 1)) - - (test-equal 1 (gr:min-streams ios2)) - (test-equal 2 (gr:max-streams ios2)) - (test-equal 16 (gr:sizeof-stream-item ios2 0)) - (test-equal 32 (gr:sizeof-stream-item ios2 1)) - - (test-equal 1 (gr:min-streams ios3)) - (test-equal -1 (gr:max-streams ios3)) - (test-equal 14 (gr:sizeof-stream-item ios3 0)) - (test-equal 32 (gr:sizeof-stream-item ios3 1)) - (test-equal 48 (gr:sizeof-stream-item ios3 2)) - (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) - - (test-equal 1 (gr:min-streams iosv)) - (test-equal 4 (gr:max-streams iosv)) - (test-equal 1 (gr:sizeof-stream-item iosv 0)) - (test-equal 2 (gr:sizeof-stream-item iosv 1)) - (test-equal 3 (gr:sizeof-stream-item iosv 2)) - (test-equal 3 (gr:sizeof-stream-item iosv 3)) - (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) - )) - diff --git a/gnuradio-core/src/guile/00_runtime_ctors.test b/gnuradio-core/src/guile/00_runtime_ctors.test deleted file mode 100644 index e0a946ab9..000000000 --- a/gnuradio-core/src/guile/00_runtime_ctors.test +++ /dev/null @@ -1,32 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - - -;;; Add test code for all constructors in these files -;;; -;;; ./runtime/gr_hier_block2.h -;;; ./runtime/gr_msg_queue.h diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index d7fdbce60..f3c02a446 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -42,12 +42,12 @@ nobase_guile_DATA = \ gnuradio/test-suite/lib.scm noinst_DATA = \ - 00_runtime_basics.test \ - 00_runtime_ctors.test \ - filter_ctors.test \ - general_ctors.test \ - gengen_ctors.test \ - hier_ctors.test \ - io_ctors.test + tests/00_runtime_basics.test \ + tests/00_runtime_ctors.test \ + tests/filter_ctors.test \ + tests/general_ctors.test \ + tests/gengen_ctors.test \ + tests/hier_ctors.test \ + tests/io_ctors.test CLEANFILES = guile.log diff --git a/gnuradio-core/src/guile/filter_ctors.test b/gnuradio-core/src/guile/filter_ctors.test deleted file mode 100644 index 040b8ba10..000000000 --- a/gnuradio-core/src/guile/filter_ctors.test +++ /dev/null @@ -1,95 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -;;; Add test code for all constructors in these files -;;; -;;; ./filter/gr_adaptive_fir_ccf.h -;;; ./filter/gr_cma_equalizer_cc.h -;;; ./filter/gr_fft_filter_ccc.h -;;; ./filter/gr_fft_filter_fff.h -;;; ./filter/gr_filter_delay_fc.h -;;; ./filter/gr_fir_ccc_generic.h -;;; ./filter/gr_fir_ccc_simd.h -;;; ./filter/gr_fir_ccc_x86.h -;;; ./filter/gr_fir_ccf_generic.h -;;; ./filter/gr_fir_ccf_simd.h -;;; ./filter/gr_fir_ccf_x86.h -;;; ./filter/gr_fir_fcc_generic.h -;;; ./filter/gr_fir_fcc_simd.h -;;; ./filter/gr_fir_fcc_x86.h -;;; ./filter/gr_fir_fff_altivec.h -;;; ./filter/gr_fir_fff_armv7_a.h -;;; ./filter/gr_fir_fff_generic.h -;;; ./filter/gr_fir_fff_simd.h -;;; ./filter/gr_fir_fff_x86.h -;;; ./filter/gr_fir_filter_ccc.h -;;; ./filter/gr_fir_filter_ccf.h -;;; ./filter/gr_fir_filter_fcc.h -;;; ./filter/gr_fir_filter_fff.h -;;; ./filter/gr_fir_filter_fsf.h -;;; ./filter/gr_fir_filter_scc.h -;;; ./filter/gr_fir_fsf_generic.h -;;; ./filter/gr_fir_fsf_simd.h -;;; ./filter/gr_fir_fsf_x86.h -;;; ./filter/gr_fir_scc_generic.h -;;; ./filter/gr_fir_scc_simd.h -;;; ./filter/gr_fir_scc_x86.h -;;; ./filter/gr_fir_sysconfig_armv7_a.h -;;; ./filter/gr_fir_sysconfig_generic.h -;;; ./filter/gr_fir_sysconfig_powerpc.h -;;; ./filter/gr_fir_sysconfig_x86.h -;;; ./filter/gr_fractional_interpolator_cc.h -;;; ./filter/gr_fractional_interpolator_ff.h -;;; ./filter/gr_freq_xlating_fir_filter_ccc.h -;;; ./filter/gr_freq_xlating_fir_filter_ccf.h -;;; ./filter/gr_freq_xlating_fir_filter_fcc.h -;;; ./filter/gr_freq_xlating_fir_filter_fcf.h -;;; ./filter/gr_freq_xlating_fir_filter_scc.h -;;; ./filter/gr_freq_xlating_fir_filter_scf.h -;;; ./filter/gr_goertzel_fc.h -;;; ./filter/gr_hilbert_fc.h -;;; ./filter/gr_iir_filter_ffd.h -;;; ./filter/gr_interp_fir_filter_ccc.h -;;; ./filter/gr_interp_fir_filter_ccf.h -;;; ./filter/gr_interp_fir_filter_fcc.h -;;; ./filter/gr_interp_fir_filter_fff.h -;;; ./filter/gr_interp_fir_filter_fsf.h -;;; ./filter/gr_interp_fir_filter_scc.h -;;; ./filter/gr_pfb_arb_resampler_ccf.h -;;; ./filter/gr_pfb_channelizer_ccf.h -;;; ./filter/gr_pfb_clock_sync_ccf.h -;;; ./filter/gr_pfb_clock_sync_fff.h -;;; ./filter/gr_pfb_decimator_ccf.h -;;; ./filter/gr_pfb_interpolator_ccf.h -;;; ./filter/gr_rational_resampler_base_ccc.h -;;; ./filter/gr_rational_resampler_base_ccf.h -;;; ./filter/gr_rational_resampler_base_fcc.h -;;; ./filter/gr_rational_resampler_base_fff.h -;;; ./filter/gr_rational_resampler_base_fsf.h -;;; ./filter/gr_rational_resampler_base_scc.h -;;; ./filter/gr_single_pole_iir_filter_cc.h -;;; ./filter/gr_single_pole_iir_filter_ff.h diff --git a/gnuradio-core/src/guile/general_ctors.test b/gnuradio-core/src/guile/general_ctors.test deleted file mode 100644 index 8d272f768..000000000 --- a/gnuradio-core/src/guile/general_ctors.test +++ /dev/null @@ -1,146 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -;;; Add test code for all constructors in these files -;;; -;;; ./general/gr_additive_scrambler_bb.h -;;; ./general/gr_agc2_cc.h -;;; ./general/gr_agc2_ff.h -;;; ./general/gr_agc_cc.h -;;; ./general/gr_agc_ff.h -;;; ./general/gr_align_on_samplenumbers_ss.h -;;; ./general/gr_bin_statistics_f.h -;;; ./general/gr_binary_slicer_fb.h -;;; ./general/gr_bytes_to_syms.h -;;; ./general/gr_char_to_float.h -;;; ./general/gr_check_counting_s.h -;;; ./general/gr_check_lfsr_32k_s.h -;;; ./general/gr_clock_recovery_mm_cc.h -;;; ./general/gr_clock_recovery_mm_ff.h -;;; ./general/gr_complex_to_interleaved_short.h -;;; ./general/gr_complex_to_xxx.h -;;; ./general/gr_conjugate_cc.h -;;; ./general/gr_constellation_decoder_cb.h -;;; ./general/gr_copy.h -;;; ./general/gr_correlate_access_code_bb.h -;;; ./general/gr_costas_loop_cc.h -;;; ./general/gr_cpfsk_bc.h -;;; ./general/gr_ctcss_squelch_ff.h -;;; ./general/gr_decode_ccsds_27_fb.h -;;; ./general/gr_deinterleave.h -;;; ./general/gr_delay.h -;;; ./general/gr_descrambler_bb.h -;;; ./general/gr_diff_decoder_bb.h -;;; ./general/gr_diff_encoder_bb.h -;;; ./general/gr_diff_phasor_cc.h -;;; ./general/gr_dpll_bb.h -;;; ./general/gr_encode_ccsds_27_bb.h -;;; ./general/gr_fake_channel_coder_pp.h -;;; ./general/gr_feedforward_agc_cc.h -;;; ./general/gr_fft_vcc.h -;;; ./general/gr_fft_vcc_fftw.h -;;; ./general/gr_fft_vfc.h -;;; ./general/gr_fll_band_edge_cc.h -;;; ./general/gr_float_to_char.h -;;; ./general/gr_float_to_complex.h -;;; ./general/gr_float_to_short.h -;;; ./general/gr_float_to_uchar.h -;;; ./general/gr_fmdet_cf.h -;;; ./general/gr_framer_sink_1.h -;;; ./general/gr_frequency_modulator_fc.h -;;; ./general/gr_glfsr_source_b.h -;;; ./general/gr_glfsr_source_f.h -;;; ./general/gr_head.h -;;; ./general/gr_interleave.h -;;; ./general/gr_interleaved_short_to_complex.h -;;; ./general/gr_iqcomp_cc.h -;;; ./general/gr_keep_one_in_n.h -;;; ./general/gr_kludge_copy.h -;;; ./general/gr_lfsr_32k_source_s.h -;;; ./general/gr_lms_dfe_cc.h -;;; ./general/gr_lms_dfe_ff.h -;;; ./general/gr_map_bb.h -;;; ./general/gr_mpsk_receiver_cc.h -;;; ./general/gr_nlog10_ff.h -;;; ./general/gr_nop.h -;;; ./general/gr_null_sink.h -;;; ./general/gr_null_source.h -;;; ./general/gr_ofdm_bpsk_demapper.h -;;; ./general/gr_ofdm_cyclic_prefixer.h -;;; ./general/gr_ofdm_demapper_vcb.h -;;; ./general/gr_ofdm_frame_acquisition.h -;;; ./general/gr_ofdm_frame_sink.h -;;; ./general/gr_ofdm_insert_preamble.h -;;; ./general/gr_ofdm_mapper_bcv.h -;;; ./general/gr_ofdm_sampler.h -;;; ./general/gr_pa_2x2_phase_combiner.h -;;; ./general/gr_packet_sink.h -;;; ./general/gr_peak_detector2_fb.h -;;; ./general/gr_phase_modulator_fc.h -;;; ./general/gr_pll_carriertracking_cc.h -;;; ./general/gr_pll_freqdet_cf.h -;;; ./general/gr_pll_refout_cc.h -;;; ./general/gr_pn_correlator_cc.h -;;; ./general/gr_probe_avg_mag_sqrd_c.h -;;; ./general/gr_probe_avg_mag_sqrd_cf.h -;;; ./general/gr_probe_avg_mag_sqrd_f.h -;;; ./general/gr_probe_density_b.h -;;; ./general/gr_probe_mpsk_snr_c.h -;;; ./general/gr_probe_signal_f.h -;;; ./general/gr_pwr_squelch_cc.h -;;; ./general/gr_pwr_squelch_ff.h -;;; ./general/gr_quadrature_demod_cf.h -;;; ./general/gr_rail_ff.h -;;; ./general/gr_regenerate_bb.h -;;; ./general/gr_repeat.h -;;; ./general/gr_rms_cf.h -;;; ./general/gr_rms_ff.h -;;; ./general/gr_scrambler_bb.h -;;; ./general/gr_short_to_float.h -;;; ./general/gr_simple_correlator.h -;;; ./general/gr_simple_framer.h -;;; ./general/gr_simple_squelch_cc.h -;;; ./general/gr_skiphead.h -;;; ./general/gr_squash_ff.h -;;; ./general/gr_squelch_base_cc.h -;;; ./general/gr_squelch_base_ff.h -;;; ./general/gr_stream_mux.h -;;; ./general/gr_stream_to_streams.h -;;; ./general/gr_stream_to_vector.h -;;; ./general/gr_streams_to_stream.h -;;; ./general/gr_streams_to_vector.h -;;; ./general/gr_stretch_ff.h -;;; ./general/gr_test.h -;;; ./general/gr_threshold_ff.h -;;; ./general/gr_throttle.h -;;; ./general/gr_uchar_to_float.h -;;; ./general/gr_unpack_k_bits_bb.h -;;; ./general/gr_vco_f.h -;;; ./general/gr_vector_to_stream.h -;;; ./general/gr_vector_to_streams.h -;;; ./general/gr_wavelet_ff.h -;;; ./general/gr_wvps_ff.h diff --git a/gnuradio-core/src/guile/gengen_ctors.test b/gnuradio-core/src/guile/gengen_ctors.test deleted file mode 100644 index 652556d3f..000000000 --- a/gnuradio-core/src/guile/gengen_ctors.test +++ /dev/null @@ -1,132 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -;;; Add test code for all constructors in these files -;;; -;;; ./gengen/gr_add_cc.h -;;; ./gengen/gr_add_const_cc.h -;;; ./gengen/gr_add_const_ff.h -;;; ./gengen/gr_add_const_ii.h -;;; ./gengen/gr_add_const_sf.h -;;; ./gengen/gr_add_const_ss.h -;;; ./gengen/gr_add_const_vcc.h -;;; ./gengen/gr_add_const_vff.h -;;; ./gengen/gr_add_const_vii.h -;;; ./gengen/gr_add_const_vss.h -;;; ./gengen/gr_add_ff.h -;;; ./gengen/gr_add_ii.h -;;; ./gengen/gr_add_ss.h -;;; ./gengen/gr_and_bb.h -;;; ./gengen/gr_and_const_bb.h -;;; ./gengen/gr_and_const_ii.h -;;; ./gengen/gr_and_const_ss.h -;;; ./gengen/gr_and_ii.h -;;; ./gengen/gr_and_ss.h -;;; ./gengen/gr_argmax_fs.h -;;; ./gengen/gr_argmax_is.h -;;; ./gengen/gr_argmax_ss.h -;;; ./gengen/gr_chunks_to_symbols_bc.h -;;; ./gengen/gr_chunks_to_symbols_bf.h -;;; ./gengen/gr_chunks_to_symbols_ic.h -;;; ./gengen/gr_chunks_to_symbols_if.h -;;; ./gengen/gr_chunks_to_symbols_sc.h -;;; ./gengen/gr_chunks_to_symbols_sf.h -;;; ./gengen/gr_divide_cc.h -;;; ./gengen/gr_divide_ff.h -;;; ./gengen/gr_divide_ii.h -;;; ./gengen/gr_divide_ss.h -;;; ./gengen/gr_integrate_cc.h -;;; ./gengen/gr_integrate_ff.h -;;; ./gengen/gr_integrate_ii.h -;;; ./gengen/gr_integrate_ss.h -;;; ./gengen/gr_max_ff.h -;;; ./gengen/gr_max_ii.h -;;; ./gengen/gr_max_ss.h -;;; ./gengen/gr_moving_average_cc.h -;;; ./gengen/gr_moving_average_ff.h -;;; ./gengen/gr_moving_average_ii.h -;;; ./gengen/gr_moving_average_ss.h -;;; ./gengen/gr_multiply_cc.h -;;; ./gengen/gr_multiply_const_cc.h -;;; ./gengen/gr_multiply_const_ff.h -;;; ./gengen/gr_multiply_const_ii.h -;;; ./gengen/gr_multiply_const_ss.h -;;; ./gengen/gr_multiply_const_vcc.h -;;; ./gengen/gr_multiply_const_vff.h -;;; ./gengen/gr_multiply_const_vii.h -;;; ./gengen/gr_multiply_const_vss.h -;;; ./gengen/gr_multiply_ff.h -;;; ./gengen/gr_multiply_ii.h -;;; ./gengen/gr_multiply_ss.h -;;; ./gengen/gr_mute_cc.h -;;; ./gengen/gr_mute_ff.h -;;; ./gengen/gr_mute_ii.h -;;; ./gengen/gr_mute_ss.h -;;; ./gengen/gr_noise_source_c.h -;;; ./gengen/gr_noise_source_f.h -;;; ./gengen/gr_noise_source_i.h -;;; ./gengen/gr_noise_source_s.h -;;; ./gengen/gr_not_bb.h -;;; ./gengen/gr_not_ii.h -;;; ./gengen/gr_not_ss.h -;;; ./gengen/gr_or_bb.h -;;; ./gengen/gr_or_ii.h -;;; ./gengen/gr_or_ss.h -;;; ./gengen/gr_packed_to_unpacked_bb.h -;;; ./gengen/gr_packed_to_unpacked_ii.h -;;; ./gengen/gr_packed_to_unpacked_ss.h -;;; ./gengen/gr_peak_detector_fb.h -;;; ./gengen/gr_peak_detector_ib.h -;;; ./gengen/gr_peak_detector_sb.h -;;; ./gengen/gr_sample_and_hold_bb.h -;;; ./gengen/gr_sample_and_hold_ff.h -;;; ./gengen/gr_sample_and_hold_ii.h -;;; ./gengen/gr_sample_and_hold_ss.h -;;; ./gengen/gr_sig_source_c.h -;;; ./gengen/gr_sig_source_f.h -;;; ./gengen/gr_sig_source_i.h -;;; ./gengen/gr_sig_source_s.h -;;; ./gengen/gr_sub_cc.h -;;; ./gengen/gr_sub_ff.h -;;; ./gengen/gr_sub_ii.h -;;; ./gengen/gr_sub_ss.h -;;; ./gengen/gr_unpacked_to_packed_bb.h -;;; ./gengen/gr_unpacked_to_packed_ii.h -;;; ./gengen/gr_unpacked_to_packed_ss.h -;;; ./gengen/gr_vector_sink_b.h -;;; ./gengen/gr_vector_sink_c.h -;;; ./gengen/gr_vector_sink_f.h -;;; ./gengen/gr_vector_sink_i.h -;;; ./gengen/gr_vector_sink_s.h -;;; ./gengen/gr_vector_source_b.h -;;; ./gengen/gr_vector_source_c.h -;;; ./gengen/gr_vector_source_f.h -;;; ./gengen/gr_vector_source_i.h -;;; ./gengen/gr_vector_source_s.h -;;; ./gengen/gr_xor_bb.h -;;; ./gengen/gr_xor_ii.h -;;; ./gengen/gr_xor_ss.h diff --git a/gnuradio-core/src/guile/hier_ctors.test b/gnuradio-core/src/guile/hier_ctors.test deleted file mode 100644 index c297fb9dd..000000000 --- a/gnuradio-core/src/guile/hier_ctors.test +++ /dev/null @@ -1,30 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -;;; Add test code for all constructors in these files -;;; -;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/io_ctors.test b/gnuradio-core/src/guile/io_ctors.test deleted file mode 100644 index 2001e5fa5..000000000 --- a/gnuradio-core/src/guile/io_ctors.test +++ /dev/null @@ -1,42 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -(use-modules (gnuradio test-suite lib)) -(use-modules (gnuradio core)) -(use-modules (oop goops)) - -;;; Add test code for all constructors in these files -;;; -;;; ./io/gr_file_descriptor_sink.h -;;; ./io/gr_file_descriptor_source.h -;;; ./io/gr_file_sink.h -;;; ./io/gr_file_source.h -;;; ./io/gr_histo_sink_f.h -;;; ./io/gr_message_sink.h -;;; ./io/gr_message_source.h -;;; ./io/gr_oscope_sink_f.h -;;; ./io/gr_oscope_sink_x.h -;;; ./io/gr_udp_sink.h -;;; ./io/gr_udp_source.h -;;; ./io/gr_wavfile_sink.h -;;; ./io/gr_wavfile_source.h diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test new file mode 100644 index 000000000..c9d251268 --- /dev/null +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -0,0 +1,124 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +(define (vector-map f v) + (list->vector (map f (vector->list v)))) + + +(with-test-prefix "test-connect-1" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using gr:ep to create endpoints + (gr:connect tb (gr:ep src 0) (gr:ep op 0)) + (gr:connect tb (gr:ep op 0) (gr:ep dst 0)) + + (gr:run tb) + ;;(pass-if (equal? expected-result (gr:data dst))) + (test-equal expected-result (gr:data dst)) + )) + +(with-test-prefix "test-connect-2" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using just blocks + (gr:connect tb src op) + (gr:connect tb op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(with-test-prefix "test-connect-3" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using lists to represent endpoints + (gr:connect tb `(,src 0) `(,op 0)) + (gr:connect tb `(,op 0) `(,dst 0)) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(with-test-prefix "test-connect-4" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; using multiple endpoints + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(with-test-prefix "test-io-signature-1" + (let ((ios1 (gr:io-signature 1 2 8)) + (ios2 (gr:io-signature2 1 2 16 32)) + (ios3 (gr:io-signature3 1 -1 14 32 48)) + (iosv (gr:io-signaturev 1 4 '(1 2 3)))) + + (test-equal 1 (gr:min-streams ios1)) + (test-equal 2 (gr:max-streams ios1)) + (test-equal 8 (gr:sizeof-stream-item ios1 0)) + (test-equal 8 (gr:sizeof-stream-item ios1 1)) + + (test-equal 1 (gr:min-streams ios2)) + (test-equal 2 (gr:max-streams ios2)) + (test-equal 16 (gr:sizeof-stream-item ios2 0)) + (test-equal 32 (gr:sizeof-stream-item ios2 1)) + + (test-equal 1 (gr:min-streams ios3)) + (test-equal -1 (gr:max-streams ios3)) + (test-equal 14 (gr:sizeof-stream-item ios3 0)) + (test-equal 32 (gr:sizeof-stream-item ios3 1)) + (test-equal 48 (gr:sizeof-stream-item ios3 2)) + (test-equal '#(14 32 48) (gr:sizeof-stream-items ios3)) + + (test-equal 1 (gr:min-streams iosv)) + (test-equal 4 (gr:max-streams iosv)) + (test-equal 1 (gr:sizeof-stream-item iosv 0)) + (test-equal 2 (gr:sizeof-stream-item iosv 1)) + (test-equal 3 (gr:sizeof-stream-item iosv 2)) + (test-equal 3 (gr:sizeof-stream-item iosv 3)) + (test-equal '#(1 2 3) (gr:sizeof-stream-items iosv)) + )) + diff --git a/gnuradio-core/src/guile/tests/00_runtime_ctors.test b/gnuradio-core/src/guile/tests/00_runtime_ctors.test new file mode 100644 index 000000000..e0a946ab9 --- /dev/null +++ b/gnuradio-core/src/guile/tests/00_runtime_ctors.test @@ -0,0 +1,32 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + + +;;; Add test code for all constructors in these files +;;; +;;; ./runtime/gr_hier_block2.h +;;; ./runtime/gr_msg_queue.h diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test new file mode 100644 index 000000000..040b8ba10 --- /dev/null +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -0,0 +1,95 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +;;; Add test code for all constructors in these files +;;; +;;; ./filter/gr_adaptive_fir_ccf.h +;;; ./filter/gr_cma_equalizer_cc.h +;;; ./filter/gr_fft_filter_ccc.h +;;; ./filter/gr_fft_filter_fff.h +;;; ./filter/gr_filter_delay_fc.h +;;; ./filter/gr_fir_ccc_generic.h +;;; ./filter/gr_fir_ccc_simd.h +;;; ./filter/gr_fir_ccc_x86.h +;;; ./filter/gr_fir_ccf_generic.h +;;; ./filter/gr_fir_ccf_simd.h +;;; ./filter/gr_fir_ccf_x86.h +;;; ./filter/gr_fir_fcc_generic.h +;;; ./filter/gr_fir_fcc_simd.h +;;; ./filter/gr_fir_fcc_x86.h +;;; ./filter/gr_fir_fff_altivec.h +;;; ./filter/gr_fir_fff_armv7_a.h +;;; ./filter/gr_fir_fff_generic.h +;;; ./filter/gr_fir_fff_simd.h +;;; ./filter/gr_fir_fff_x86.h +;;; ./filter/gr_fir_filter_ccc.h +;;; ./filter/gr_fir_filter_ccf.h +;;; ./filter/gr_fir_filter_fcc.h +;;; ./filter/gr_fir_filter_fff.h +;;; ./filter/gr_fir_filter_fsf.h +;;; ./filter/gr_fir_filter_scc.h +;;; ./filter/gr_fir_fsf_generic.h +;;; ./filter/gr_fir_fsf_simd.h +;;; ./filter/gr_fir_fsf_x86.h +;;; ./filter/gr_fir_scc_generic.h +;;; ./filter/gr_fir_scc_simd.h +;;; ./filter/gr_fir_scc_x86.h +;;; ./filter/gr_fir_sysconfig_armv7_a.h +;;; ./filter/gr_fir_sysconfig_generic.h +;;; ./filter/gr_fir_sysconfig_powerpc.h +;;; ./filter/gr_fir_sysconfig_x86.h +;;; ./filter/gr_fractional_interpolator_cc.h +;;; ./filter/gr_fractional_interpolator_ff.h +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h +;;; ./filter/gr_freq_xlating_fir_filter_scc.h +;;; ./filter/gr_freq_xlating_fir_filter_scf.h +;;; ./filter/gr_goertzel_fc.h +;;; ./filter/gr_hilbert_fc.h +;;; ./filter/gr_iir_filter_ffd.h +;;; ./filter/gr_interp_fir_filter_ccc.h +;;; ./filter/gr_interp_fir_filter_ccf.h +;;; ./filter/gr_interp_fir_filter_fcc.h +;;; ./filter/gr_interp_fir_filter_fff.h +;;; ./filter/gr_interp_fir_filter_fsf.h +;;; ./filter/gr_interp_fir_filter_scc.h +;;; ./filter/gr_pfb_arb_resampler_ccf.h +;;; ./filter/gr_pfb_channelizer_ccf.h +;;; ./filter/gr_pfb_clock_sync_ccf.h +;;; ./filter/gr_pfb_clock_sync_fff.h +;;; ./filter/gr_pfb_decimator_ccf.h +;;; ./filter/gr_pfb_interpolator_ccf.h +;;; ./filter/gr_rational_resampler_base_ccc.h +;;; ./filter/gr_rational_resampler_base_ccf.h +;;; ./filter/gr_rational_resampler_base_fcc.h +;;; ./filter/gr_rational_resampler_base_fff.h +;;; ./filter/gr_rational_resampler_base_fsf.h +;;; ./filter/gr_rational_resampler_base_scc.h +;;; ./filter/gr_single_pole_iir_filter_cc.h +;;; ./filter/gr_single_pole_iir_filter_ff.h diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test new file mode 100644 index 000000000..8d272f768 --- /dev/null +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -0,0 +1,146 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +;;; Add test code for all constructors in these files +;;; +;;; ./general/gr_additive_scrambler_bb.h +;;; ./general/gr_agc2_cc.h +;;; ./general/gr_agc2_ff.h +;;; ./general/gr_agc_cc.h +;;; ./general/gr_agc_ff.h +;;; ./general/gr_align_on_samplenumbers_ss.h +;;; ./general/gr_bin_statistics_f.h +;;; ./general/gr_binary_slicer_fb.h +;;; ./general/gr_bytes_to_syms.h +;;; ./general/gr_char_to_float.h +;;; ./general/gr_check_counting_s.h +;;; ./general/gr_check_lfsr_32k_s.h +;;; ./general/gr_clock_recovery_mm_cc.h +;;; ./general/gr_clock_recovery_mm_ff.h +;;; ./general/gr_complex_to_interleaved_short.h +;;; ./general/gr_complex_to_xxx.h +;;; ./general/gr_conjugate_cc.h +;;; ./general/gr_constellation_decoder_cb.h +;;; ./general/gr_copy.h +;;; ./general/gr_correlate_access_code_bb.h +;;; ./general/gr_costas_loop_cc.h +;;; ./general/gr_cpfsk_bc.h +;;; ./general/gr_ctcss_squelch_ff.h +;;; ./general/gr_decode_ccsds_27_fb.h +;;; ./general/gr_deinterleave.h +;;; ./general/gr_delay.h +;;; ./general/gr_descrambler_bb.h +;;; ./general/gr_diff_decoder_bb.h +;;; ./general/gr_diff_encoder_bb.h +;;; ./general/gr_diff_phasor_cc.h +;;; ./general/gr_dpll_bb.h +;;; ./general/gr_encode_ccsds_27_bb.h +;;; ./general/gr_fake_channel_coder_pp.h +;;; ./general/gr_feedforward_agc_cc.h +;;; ./general/gr_fft_vcc.h +;;; ./general/gr_fft_vcc_fftw.h +;;; ./general/gr_fft_vfc.h +;;; ./general/gr_fll_band_edge_cc.h +;;; ./general/gr_float_to_char.h +;;; ./general/gr_float_to_complex.h +;;; ./general/gr_float_to_short.h +;;; ./general/gr_float_to_uchar.h +;;; ./general/gr_fmdet_cf.h +;;; ./general/gr_framer_sink_1.h +;;; ./general/gr_frequency_modulator_fc.h +;;; ./general/gr_glfsr_source_b.h +;;; ./general/gr_glfsr_source_f.h +;;; ./general/gr_head.h +;;; ./general/gr_interleave.h +;;; ./general/gr_interleaved_short_to_complex.h +;;; ./general/gr_iqcomp_cc.h +;;; ./general/gr_keep_one_in_n.h +;;; ./general/gr_kludge_copy.h +;;; ./general/gr_lfsr_32k_source_s.h +;;; ./general/gr_lms_dfe_cc.h +;;; ./general/gr_lms_dfe_ff.h +;;; ./general/gr_map_bb.h +;;; ./general/gr_mpsk_receiver_cc.h +;;; ./general/gr_nlog10_ff.h +;;; ./general/gr_nop.h +;;; ./general/gr_null_sink.h +;;; ./general/gr_null_source.h +;;; ./general/gr_ofdm_bpsk_demapper.h +;;; ./general/gr_ofdm_cyclic_prefixer.h +;;; ./general/gr_ofdm_demapper_vcb.h +;;; ./general/gr_ofdm_frame_acquisition.h +;;; ./general/gr_ofdm_frame_sink.h +;;; ./general/gr_ofdm_insert_preamble.h +;;; ./general/gr_ofdm_mapper_bcv.h +;;; ./general/gr_ofdm_sampler.h +;;; ./general/gr_pa_2x2_phase_combiner.h +;;; ./general/gr_packet_sink.h +;;; ./general/gr_peak_detector2_fb.h +;;; ./general/gr_phase_modulator_fc.h +;;; ./general/gr_pll_carriertracking_cc.h +;;; ./general/gr_pll_freqdet_cf.h +;;; ./general/gr_pll_refout_cc.h +;;; ./general/gr_pn_correlator_cc.h +;;; ./general/gr_probe_avg_mag_sqrd_c.h +;;; ./general/gr_probe_avg_mag_sqrd_cf.h +;;; ./general/gr_probe_avg_mag_sqrd_f.h +;;; ./general/gr_probe_density_b.h +;;; ./general/gr_probe_mpsk_snr_c.h +;;; ./general/gr_probe_signal_f.h +;;; ./general/gr_pwr_squelch_cc.h +;;; ./general/gr_pwr_squelch_ff.h +;;; ./general/gr_quadrature_demod_cf.h +;;; ./general/gr_rail_ff.h +;;; ./general/gr_regenerate_bb.h +;;; ./general/gr_repeat.h +;;; ./general/gr_rms_cf.h +;;; ./general/gr_rms_ff.h +;;; ./general/gr_scrambler_bb.h +;;; ./general/gr_short_to_float.h +;;; ./general/gr_simple_correlator.h +;;; ./general/gr_simple_framer.h +;;; ./general/gr_simple_squelch_cc.h +;;; ./general/gr_skiphead.h +;;; ./general/gr_squash_ff.h +;;; ./general/gr_squelch_base_cc.h +;;; ./general/gr_squelch_base_ff.h +;;; ./general/gr_stream_mux.h +;;; ./general/gr_stream_to_streams.h +;;; ./general/gr_stream_to_vector.h +;;; ./general/gr_streams_to_stream.h +;;; ./general/gr_streams_to_vector.h +;;; ./general/gr_stretch_ff.h +;;; ./general/gr_test.h +;;; ./general/gr_threshold_ff.h +;;; ./general/gr_throttle.h +;;; ./general/gr_uchar_to_float.h +;;; ./general/gr_unpack_k_bits_bb.h +;;; ./general/gr_vco_f.h +;;; ./general/gr_vector_to_stream.h +;;; ./general/gr_vector_to_streams.h +;;; ./general/gr_wavelet_ff.h +;;; ./general/gr_wvps_ff.h diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test new file mode 100644 index 000000000..652556d3f --- /dev/null +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -0,0 +1,132 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +;;; Add test code for all constructors in these files +;;; +;;; ./gengen/gr_add_cc.h +;;; ./gengen/gr_add_const_cc.h +;;; ./gengen/gr_add_const_ff.h +;;; ./gengen/gr_add_const_ii.h +;;; ./gengen/gr_add_const_sf.h +;;; ./gengen/gr_add_const_ss.h +;;; ./gengen/gr_add_const_vcc.h +;;; ./gengen/gr_add_const_vff.h +;;; ./gengen/gr_add_const_vii.h +;;; ./gengen/gr_add_const_vss.h +;;; ./gengen/gr_add_ff.h +;;; ./gengen/gr_add_ii.h +;;; ./gengen/gr_add_ss.h +;;; ./gengen/gr_and_bb.h +;;; ./gengen/gr_and_const_bb.h +;;; ./gengen/gr_and_const_ii.h +;;; ./gengen/gr_and_const_ss.h +;;; ./gengen/gr_and_ii.h +;;; ./gengen/gr_and_ss.h +;;; ./gengen/gr_argmax_fs.h +;;; ./gengen/gr_argmax_is.h +;;; ./gengen/gr_argmax_ss.h +;;; ./gengen/gr_chunks_to_symbols_bc.h +;;; ./gengen/gr_chunks_to_symbols_bf.h +;;; ./gengen/gr_chunks_to_symbols_ic.h +;;; ./gengen/gr_chunks_to_symbols_if.h +;;; ./gengen/gr_chunks_to_symbols_sc.h +;;; ./gengen/gr_chunks_to_symbols_sf.h +;;; ./gengen/gr_divide_cc.h +;;; ./gengen/gr_divide_ff.h +;;; ./gengen/gr_divide_ii.h +;;; ./gengen/gr_divide_ss.h +;;; ./gengen/gr_integrate_cc.h +;;; ./gengen/gr_integrate_ff.h +;;; ./gengen/gr_integrate_ii.h +;;; ./gengen/gr_integrate_ss.h +;;; ./gengen/gr_max_ff.h +;;; ./gengen/gr_max_ii.h +;;; ./gengen/gr_max_ss.h +;;; ./gengen/gr_moving_average_cc.h +;;; ./gengen/gr_moving_average_ff.h +;;; ./gengen/gr_moving_average_ii.h +;;; ./gengen/gr_moving_average_ss.h +;;; ./gengen/gr_multiply_cc.h +;;; ./gengen/gr_multiply_const_cc.h +;;; ./gengen/gr_multiply_const_ff.h +;;; ./gengen/gr_multiply_const_ii.h +;;; ./gengen/gr_multiply_const_ss.h +;;; ./gengen/gr_multiply_const_vcc.h +;;; ./gengen/gr_multiply_const_vff.h +;;; ./gengen/gr_multiply_const_vii.h +;;; ./gengen/gr_multiply_const_vss.h +;;; ./gengen/gr_multiply_ff.h +;;; ./gengen/gr_multiply_ii.h +;;; ./gengen/gr_multiply_ss.h +;;; ./gengen/gr_mute_cc.h +;;; ./gengen/gr_mute_ff.h +;;; ./gengen/gr_mute_ii.h +;;; ./gengen/gr_mute_ss.h +;;; ./gengen/gr_noise_source_c.h +;;; ./gengen/gr_noise_source_f.h +;;; ./gengen/gr_noise_source_i.h +;;; ./gengen/gr_noise_source_s.h +;;; ./gengen/gr_not_bb.h +;;; ./gengen/gr_not_ii.h +;;; ./gengen/gr_not_ss.h +;;; ./gengen/gr_or_bb.h +;;; ./gengen/gr_or_ii.h +;;; ./gengen/gr_or_ss.h +;;; ./gengen/gr_packed_to_unpacked_bb.h +;;; ./gengen/gr_packed_to_unpacked_ii.h +;;; ./gengen/gr_packed_to_unpacked_ss.h +;;; ./gengen/gr_peak_detector_fb.h +;;; ./gengen/gr_peak_detector_ib.h +;;; ./gengen/gr_peak_detector_sb.h +;;; ./gengen/gr_sample_and_hold_bb.h +;;; ./gengen/gr_sample_and_hold_ff.h +;;; ./gengen/gr_sample_and_hold_ii.h +;;; ./gengen/gr_sample_and_hold_ss.h +;;; ./gengen/gr_sig_source_c.h +;;; ./gengen/gr_sig_source_f.h +;;; ./gengen/gr_sig_source_i.h +;;; ./gengen/gr_sig_source_s.h +;;; ./gengen/gr_sub_cc.h +;;; ./gengen/gr_sub_ff.h +;;; ./gengen/gr_sub_ii.h +;;; ./gengen/gr_sub_ss.h +;;; ./gengen/gr_unpacked_to_packed_bb.h +;;; ./gengen/gr_unpacked_to_packed_ii.h +;;; ./gengen/gr_unpacked_to_packed_ss.h +;;; ./gengen/gr_vector_sink_b.h +;;; ./gengen/gr_vector_sink_c.h +;;; ./gengen/gr_vector_sink_f.h +;;; ./gengen/gr_vector_sink_i.h +;;; ./gengen/gr_vector_sink_s.h +;;; ./gengen/gr_vector_source_b.h +;;; ./gengen/gr_vector_source_c.h +;;; ./gengen/gr_vector_source_f.h +;;; ./gengen/gr_vector_source_i.h +;;; ./gengen/gr_vector_source_s.h +;;; ./gengen/gr_xor_bb.h +;;; ./gengen/gr_xor_ii.h +;;; ./gengen/gr_xor_ss.h diff --git a/gnuradio-core/src/guile/tests/hier_ctors.test b/gnuradio-core/src/guile/tests/hier_ctors.test new file mode 100644 index 000000000..c297fb9dd --- /dev/null +++ b/gnuradio-core/src/guile/tests/hier_ctors.test @@ -0,0 +1,30 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +;;; Add test code for all constructors in these files +;;; +;;; ./hier/gr_channel_model.h diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test new file mode 100644 index 000000000..2001e5fa5 --- /dev/null +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -0,0 +1,42 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +(use-modules (gnuradio test-suite lib)) +(use-modules (gnuradio core)) +(use-modules (oop goops)) + +;;; Add test code for all constructors in these files +;;; +;;; ./io/gr_file_descriptor_sink.h +;;; ./io/gr_file_descriptor_source.h +;;; ./io/gr_file_sink.h +;;; ./io/gr_file_source.h +;;; ./io/gr_histo_sink_f.h +;;; ./io/gr_message_sink.h +;;; ./io/gr_message_source.h +;;; ./io/gr_oscope_sink_f.h +;;; ./io/gr_oscope_sink_x.h +;;; ./io/gr_udp_sink.h +;;; ./io/gr_udp_source.h +;;; ./io/gr_wavfile_sink.h +;;; ./io/gr_wavfile_source.h -- cgit From d1d804742ac2cfcc31240c6d74d764e5784831d4 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 17:46:36 -0800 Subject: Make check works again, now using guile's native test-suite code. The srfi-64 code wouldn't pass it's own test code under guile... --- gnuradio-core/src/guile/.gitignore | 1 - .../src/guile/gnuradio/test-suite/guile-test | 241 +++++++++++++++++++++ .../src/guile/gnuradio/test-suite/guile-test.in | 241 --------------------- gnuradio-core/src/guile/run_guile_tests.in | 15 +- 4 files changed, 250 insertions(+), 248 deletions(-) create mode 100644 gnuradio-core/src/guile/gnuradio/test-suite/guile-test delete mode 100755 gnuradio-core/src/guile/gnuradio/test-suite/guile-test.in (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index bc212f566..82a29a907 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -2,4 +2,3 @@ /Makefile.in /run_guile_tests /guile.log -/gnuradio/test-suite/guile-test diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/guile-test b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test new file mode 100644 index 000000000..6dc1a9658 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/test-suite/guile-test @@ -0,0 +1,241 @@ +#!/usr/bin/guile \ +-e main -s +!# + +;;;; guile-test --- run the Guile test suite +;;;; Jim Blandy --- May 1999 +;;;; +;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This program 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 2, or (at your option) +;;;; any later version. +;;;; +;;;; This program 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 this software; see the file COPYING. If not, write to +;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;;;; Boston, MA 02110-1301 USA + + +;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] +;;;; +;;;; Run tests from the Guile test suite. Report failures and +;;;; unexpected passes to the standard output, along with a summary of +;;;; all the results. Record each reported test outcome in the log +;;;; file, `guile.log'. The exit status is #f if any of the tests +;;;; fail or pass unexpectedly. +;;;; +;;;; Normally, guile-test scans the test directory, and executes all +;;;; files whose names end in `.test'. (It assumes they contain +;;;; Scheme code.) However, you can have it execute specific tests by +;;;; listing their filenames on the command line. +;;;; +;;;; The option `--test-suite' can be given to specify the test +;;;; directory. If no such option is given, the test directory is +;;;; taken from the environment variable TEST_SUITE_DIR (if defined), +;;;; otherwise a default directory that is hardcoded in this file is +;;;; used (see "Installation" below). +;;;; +;;;; If present, the `--log-file LOG' option tells `guile-test' to put +;;;; the log output in a file named LOG. +;;;; +;;;; If present, the `--debug' option will enable a debugging mode. +;;;; +;;;; If present, the `--flag-unresolved' option will cause guile-test +;;;; to exit with failure status if any tests are UNRESOLVED. +;;;; +;;;; +;;;; Installation: +;;;; +;;;; If you change the #! line at the top of this script to point at +;;;; the Guile interpreter you want to test, you can call this script +;;;; as an executable instead of having to pass it as a parameter to +;;;; guile via "guile -e main -s guile-test". Further, you can edit +;;;; the definition of default-test-suite to point to the parent +;;;; directory of the `tests' tree, which makes it unnecessary to set +;;;; the environment variable `TEST_SUITE_DIR'. +;;;; +;;;; +;;;; Shortcomings: +;;;; +;;;; At the moment, due to a simple-minded implementation, test files +;;;; must live in the test directory, and you must specify their names +;;;; relative to the top of the test directory. If you want to send +;;;; me a patch that fixes this, but still leaves sane test names in +;;;; the log file, that would be great. At the moment, all the tests +;;;; I care about are in the test directory, though. +;;;; +;;;; It would be nice if you could specify the Guile interpreter you +;;;; want to test on the command line. As it stands, if you want to +;;;; change which Guile interpreter you're testing, you need to edit +;;;; the #! line at the top of this file, which is stupid. + +(define (main . args) + (let ((module (resolve-module '(gnuradio test-suite guile-test)))) + (apply (module-ref module 'main) args))) + +(define-module (gnuradio test-suite guile-test) + :use-module (gnuradio test-suite lib) + :use-module (ice-9 getopt-long) + :use-module (ice-9 and-let-star) + :use-module (ice-9 rdelim) + :export (main data-file-name test-file-name)) + + +;;; User configurable settings: +(define default-test-suite + (string-append (getenv "HOME") "/bogus-path/test-suite")) + + +;;; Variables that will receive their actual values later. +(define test-suite default-test-suite) + +(define tmp-dir #f) + + +;;; General utilities, that probably should be in a library somewhere. + +;;; Enable debugging +(define (enable-debug-mode) + (write-line %load-path) + (set! %load-verbosely #t) + (debug-enable 'backtrace 'debug)) + +;;; Traverse the directory tree at ROOT, applying F to the name of +;;; each file in the tree, including ROOT itself. For a subdirectory +;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow +;;; symlinks. +(define (for-each-file f root) + + ;; A "hard directory" is a path that denotes a directory and is not a + ;; symlink. + (define (file-is-hard-directory? filename) + (eq? (stat:type (lstat filename)) 'directory)) + + (let visit ((root root)) + (let ((should-recur (f root))) + (if (and should-recur (file-is-hard-directory? root)) + (let ((dir (opendir root))) + (let loop () + (let ((entry (readdir dir))) + (cond + ((eof-object? entry) #f) + ((or (string=? entry ".") + (string=? entry "..") + (string=? entry "CVS") + (string=? entry "RCS")) + (loop)) + (else + (visit (string-append root "/" entry)) + (loop)))))))))) + + +;;; The test driver. + + +;;; Localizing test files and temporary data files. + +(define (data-file-name filename) + (in-vicinity tmp-dir filename)) + +(define (test-file-name test) + (in-vicinity test-suite test)) + +;;; Return a list of all the test files in the test tree. +(define (enumerate-tests test-dir) + (let ((root-len (+ 1 (string-length test-dir))) + (tests '())) + (for-each-file (lambda (file) + (if (has-suffix? file ".test") + (let ((short-name + (substring file root-len))) + (set! tests (cons short-name tests)))) + #t) + test-dir) + + ;; for-each-file presents the files in whatever order it finds + ;; them in the directory. We sort them here, so they'll always + ;; appear in the same order. This makes it easier to compare test + ;; log files mechanically. + (sort tests string --- May 1999 -;;;; -;;;; Copyright (C) 1999, 2001, 2006 Free Software Foundation, Inc. -;;;; -;;;; This program 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 2, or (at your option) -;;;; any later version. -;;;; -;;;; This program 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 this software; see the file COPYING. If not, write to -;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;;;; Boston, MA 02110-1301 USA - - -;;;; Usage: [guile -e main -s] guile-test [OPTIONS] [TEST ...] -;;;; -;;;; Run tests from the Guile test suite. Report failures and -;;;; unexpected passes to the standard output, along with a summary of -;;;; all the results. Record each reported test outcome in the log -;;;; file, `guile.log'. The exit status is #f if any of the tests -;;;; fail or pass unexpectedly. -;;;; -;;;; Normally, guile-test scans the test directory, and executes all -;;;; files whose names end in `.test'. (It assumes they contain -;;;; Scheme code.) However, you can have it execute specific tests by -;;;; listing their filenames on the command line. -;;;; -;;;; The option `--test-suite' can be given to specify the test -;;;; directory. If no such option is given, the test directory is -;;;; taken from the environment variable TEST_SUITE_DIR (if defined), -;;;; otherwise a default directory that is hardcoded in this file is -;;;; used (see "Installation" below). -;;;; -;;;; If present, the `--log-file LOG' option tells `guile-test' to put -;;;; the log output in a file named LOG. -;;;; -;;;; If present, the `--debug' option will enable a debugging mode. -;;;; -;;;; If present, the `--flag-unresolved' option will cause guile-test -;;;; to exit with failure status if any tests are UNRESOLVED. -;;;; -;;;; -;;;; Installation: -;;;; -;;;; If you change the #! line at the top of this script to point at -;;;; the Guile interpreter you want to test, you can call this script -;;;; as an executable instead of having to pass it as a parameter to -;;;; guile via "guile -e main -s guile-test". Further, you can edit -;;;; the definition of default-test-suite to point to the parent -;;;; directory of the `tests' tree, which makes it unnecessary to set -;;;; the environment variable `TEST_SUITE_DIR'. -;;;; -;;;; -;;;; Shortcomings: -;;;; -;;;; At the moment, due to a simple-minded implementation, test files -;;;; must live in the test directory, and you must specify their names -;;;; relative to the top of the test directory. If you want to send -;;;; me a patch that fixes this, but still leaves sane test names in -;;;; the log file, that would be great. At the moment, all the tests -;;;; I care about are in the test directory, though. -;;;; -;;;; It would be nice if you could specify the Guile interpreter you -;;;; want to test on the command line. As it stands, if you want to -;;;; change which Guile interpreter you're testing, you need to edit -;;;; the #! line at the top of this file, which is stupid. - -(define (main . args) - (let ((module (resolve-module '(gnuradio test-suite guile-test)))) - (apply (module-ref module 'main) args))) - -(define-module (gnuradio test-suite guile-test) - :use-module (gnuradio test-suite lib) - :use-module (ice-9 getopt-long) - :use-module (ice-9 and-let-star) - :use-module (ice-9 rdelim) - :export (main data-file-name test-file-name)) - - -;;; User configurable settings: -(define default-test-suite - (string-append (getenv "HOME") "/bogus-path/test-suite")) - - -;;; Variables that will receive their actual values later. -(define test-suite default-test-suite) - -(define tmp-dir #f) - - -;;; General utilities, that probably should be in a library somewhere. - -;;; Enable debugging -(define (enable-debug-mode) - (write-line %load-path) - (set! %load-verbosely #t) - (debug-enable 'backtrace 'debug)) - -;;; Traverse the directory tree at ROOT, applying F to the name of -;;; each file in the tree, including ROOT itself. For a subdirectory -;;; SUB, if (F SUB) is true, we recurse into SUB. Do not follow -;;; symlinks. -(define (for-each-file f root) - - ;; A "hard directory" is a path that denotes a directory and is not a - ;; symlink. - (define (file-is-hard-directory? filename) - (eq? (stat:type (lstat filename)) 'directory)) - - (let visit ((root root)) - (let ((should-recur (f root))) - (if (and should-recur (file-is-hard-directory? root)) - (let ((dir (opendir root))) - (let loop () - (let ((entry (readdir dir))) - (cond - ((eof-object? entry) #f) - ((or (string=? entry ".") - (string=? entry "..") - (string=? entry "CVS") - (string=? entry "RCS")) - (loop)) - (else - (visit (string-append root "/" entry)) - (loop)))))))))) - - -;;; The test driver. - - -;;; Localizing test files and temporary data files. - -(define (data-file-name filename) - (in-vicinity tmp-dir filename)) - -(define (test-file-name test) - (in-vicinity test-suite test)) - -;;; Return a list of all the test files in the test tree. -(define (enumerate-tests test-dir) - (let ((root-len (+ 1 (string-length test-dir))) - (tests '())) - (for-each-file (lambda (file) - (if (has-suffix? file ".test") - (let ((short-name - (substring file root-len))) - (set! tests (cons short-name tests)))) - #t) - test-dir) - - ;; for-each-file presents the files in whatever order it finds - ;; them in the directory. We sort them here, so they'll always - ;; appear in the same order. This makes it easier to compare test - ;; log files mechanically. - (sort tests string (vector-length obj) 1) - (eq (vector-ref obj 0) %test-runner-cookie))) - (define (alloc) - (let ((runner (make-vector 22))) - (vector-set! runner 0 %test-runner-cookie) - runner)) - (begin - (define (getter runner) - (vector-ref runner index)) ...) - (begin - (define (setter runner value) - (vector-set! runner index value)) ...))))))) - -(%test-record-define - %test-runner-alloc test-runner? - ;; Cumulate count of all tests that have passed and were expected to. - (pass-count 1 test-runner-pass-count test-runner-pass-count!) - (fail-count 2 test-runner-fail-count test-runner-fail-count!) - (xpass-count 3 test-runner-xpass-count test-runner-xpass-count!) - (xfail-count 4 test-runner-xfail-count test-runner-xfail-count!) - (skip-count 5 test-runner-skip-count test-runner-skip-count!) - (skip-list 6 %test-runner-skip-list %test-runner-skip-list!) - (fail-list 7 %test-runner-fail-list %test-runner-fail-list!) - ;; Normally #t, except when in a test-apply. - (run-list 8 %test-runner-run-list %test-runner-run-list!) - (skip-save 9 %test-runner-skip-save %test-runner-skip-save!) - (fail-save 10 %test-runner-fail-save %test-runner-fail-save!) - (group-stack 11 test-runner-group-stack test-runner-group-stack!) - (on-test-begin 12 test-runner-on-test-begin test-runner-on-test-begin!) - (on-test-end 13 test-runner-on-test-end test-runner-on-test-end!) - ;; Call-back when entering a group. Takes (runner suite-name count). - (on-group-begin 14 test-runner-on-group-begin test-runner-on-group-begin!) - ;; Call-back when leaving a group. - (on-group-end 15 test-runner-on-group-end test-runner-on-group-end!) - ;; Call-back when leaving the outermost group. - (on-final 16 test-runner-on-final test-runner-on-final!) - ;; Call-back when expected number of tests was wrong. - (on-bad-count 17 test-runner-on-bad-count test-runner-on-bad-count!) - ;; Call-back when name in test=end doesn't match test-begin. - (on-bad-end-name 18 test-runner-on-bad-end-name test-runner-on-bad-end-name!) - ;; Cumulate count of all tests that have been done. - (total-count 19 %test-runner-total-count %test-runner-total-count!) - ;; Stack (list) of (count-at-start . expected-count): - (count-list 20 %test-runner-count-list %test-runner-count-list!) - (result-alist 21 test-result-alist test-result-alist!) - ;; Field can be used by test-runner for any purpose. - ;; test-runner-simple uses it for a log file. - (aux-value 22 test-runner-aux-value test-runner-aux-value!) -) - -(define (test-runner-reset runner) - (test-runner-pass-count! runner 0) - (test-runner-fail-count! runner 0) - (test-runner-xpass-count! runner 0) - (test-runner-xfail-count! runner 0) - (test-runner-skip-count! runner 0) - (%test-runner-total-count! runner 0) - (%test-runner-count-list! runner '()) - (%test-runner-run-list! runner #t) - (%test-runner-skip-list! runner '()) - (%test-runner-fail-list! runner '()) - (%test-runner-skip-save! runner '()) - (%test-runner-fail-save! runner '()) - (test-runner-group-stack! runner '())) - -(define (test-runner-group-path runner) - (reverse (test-runner-group-stack runner))) - -(define (%test-null-callback runner) #f) - -(define (test-runner-null) - (let ((runner (%test-runner-alloc))) - (test-runner-reset runner) - (test-runner-on-group-begin! runner (lambda (runner name count) #f)) - (test-runner-on-group-end! runner %test-null-callback) - (test-runner-on-final! runner %test-null-callback) - (test-runner-on-test-begin! runner %test-null-callback) - (test-runner-on-test-end! runner %test-null-callback) - (test-runner-on-bad-count! runner (lambda (runner count expected) #f)) - (test-runner-on-bad-end-name! runner (lambda (runner begin end) #f)) - runner)) - -;; Not part of the specification. FIXME -;; Controls whether a log file is generated. -(define test-log-to-file #t) - -(define (test-runner-simple) - (let ((runner (%test-runner-alloc))) - (test-runner-reset runner) - (test-runner-on-group-begin! runner test-on-group-begin-simple) - (test-runner-on-group-end! runner test-on-group-end-simple) - (test-runner-on-final! runner test-on-final-simple) - (test-runner-on-test-begin! runner test-on-test-begin-simple) - (test-runner-on-test-end! runner test-on-test-end-simple) - (test-runner-on-bad-count! runner test-on-bad-count-simple) - (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) - runner)) - -(cond-expand - (srfi-39 - (define test-runner-current (make-parameter #f)) - (define test-runner-factory (make-parameter test-runner-simple))) - (else - (define %test-runner-current #f) - (define-syntax test-runner-current - (syntax-rules () - ((test-runner-current) - %test-runner-current) - ((test-runner-current runner) - (set! %test-runner-current runner)))) - (define %test-runner-factory test-runner-simple) - (define-syntax test-runner-factory - (syntax-rules () - ((test-runner-factory) - %test-runner-factory) - ((test-runner-factory runner) - (set! %test-runner-factory runner)))))) - -;; A safer wrapper to test-runner-current. -(define (test-runner-get) - (let ((r (test-runner-current))) - (if (not r) - (cond-expand - (srfi-23 (error "test-runner not initialized - test-begin missing?")) - (else #t))) - r)) - -(define (%test-specificier-matches spec runner) - (spec runner)) - -(define (test-runner-create) - ((test-runner-factory))) - -(define (%test-any-specifier-matches list runner) - (let ((result #f)) - (let loop ((l list)) - (cond ((null? l) result) - (else - (if (%test-specificier-matches (car l) runner) - (set! result #t)) - (loop (cdr l))))))) - -;; Returns #f, #t, or 'xfail. -(define (%test-should-execute runner) - (let ((run (%test-runner-run-list runner))) - (cond ((or - (not (or (eqv? run #t) - (%test-any-specifier-matches run runner))) - (%test-any-specifier-matches - (%test-runner-skip-list runner) - runner)) - (test-result-set! runner 'result-kind 'skip) - #f) - ((%test-any-specifier-matches - (%test-runner-fail-list runner) - runner) - (test-result-set! runner 'result-kind 'xfail) - 'xfail) - (else #t)))) - -(define (%test-begin suite-name count) - (if (not (test-runner-current)) - (test-runner-current (test-runner-create))) - (let ((runner (test-runner-current))) - ((test-runner-on-group-begin runner) runner suite-name count) - (%test-runner-skip-save! runner - (cons (%test-runner-skip-list runner) - (%test-runner-skip-save runner))) - (%test-runner-fail-save! runner - (cons (%test-runner-fail-list runner) - (%test-runner-fail-save runner))) - (%test-runner-count-list! runner - (cons (cons (%test-runner-total-count runner) - count) - (%test-runner-count-list runner))) - (test-runner-group-stack! runner (cons suite-name - (test-runner-group-stack runner))))) -(cond-expand - (kawa - ;; Kawa has test-begin built in, implemented as: - ;; (begin - ;; (cond-expand (srfi-64 #!void) (else (require 'srfi-64))) - ;; (%test-begin suite-name [count])) - ;; This puts test-begin but only test-begin in the default environment., - ;; which makes normal test suites loadable without non-portable commands. - ) - (else - (define-syntax test-begin - (syntax-rules () - ((test-begin suite-name) - (%test-begin suite-name #f)) - ((test-begin suite-name count) - (%test-begin suite-name count)))))) - -(define (test-on-group-begin-simple runner suite-name count) - (if (null? (test-runner-group-stack runner)) - (begin - (display "%%%% Starting test ") - (display suite-name) - (if test-log-to-file - (let* ((log-file-name - (if (string? test-log-to-file) test-log-to-file - (string-append suite-name ".log"))) - (log-file - (cond-expand (mzscheme - (open-output-file log-file-name 'truncate/replace)) - (else (open-output-file log-file-name))))) - (display "%%%% Starting test " log-file) - (display suite-name log-file) - (newline log-file) - (test-runner-aux-value! runner log-file) - (display " (Writing full log to \"") - (display log-file-name) - (display "\")"))) - (newline))) - (let ((log (test-runner-aux-value runner))) - (if (output-port? log) - (begin - (display "Group begin: " log) - (display suite-name log) - (newline log)))) - #f) - -(define (test-on-group-end-simple runner) - (let ((log (test-runner-aux-value runner))) - (if (output-port? log) - (begin - (display "Group end: " log) - (display (car (test-runner-group-stack runner)) log) - (newline log)))) - #f) - -(define (%test-on-bad-count-write runner count expected-count port) - (display "*** Total number of tests was " port) - (display count port) - (display " but should be " port) - (display expected-count port) - (display ". ***" port) - (newline port) - (display "*** Discrepancy indicates testsuite error or exceptions. ***" port) - (newline port)) - -(define (test-on-bad-count-simple runner count expected-count) - (%test-on-bad-count-write runner count expected-count (current-output-port)) - (let ((log (test-runner-aux-value runner))) - (if (output-port? log) - (%test-on-bad-count-write runner count expected-count log)))) - -(define (test-on-bad-end-name-simple runner begin-name end-name) - (let ((msg (string-append (%test-format-line runner) "test-end " begin-name - " does not match test-begin " end-name))) - (cond-expand - (srfi-23 (error msg)) - (else (display msg) (newline))))) - - -(define (%test-final-report1 value label port) - (if (> value 0) - (begin - (display label port) - (display value port) - (newline port)))) - -(define (%test-final-report-simple runner port) - (%test-final-report1 (test-runner-pass-count runner) - "# of expected passes " port) - (%test-final-report1 (test-runner-xfail-count runner) - "# of expected failures " port) - (%test-final-report1 (test-runner-xpass-count runner) - "# of unexpected successes " port) - (%test-final-report1 (test-runner-fail-count runner) - "# of unexpected failures " port) - (%test-final-report1 (test-runner-skip-count runner) - "# of skipped tests " port)) - -(define (test-on-final-simple runner) - (%test-final-report-simple runner (current-output-port)) - (let ((log (test-runner-aux-value runner))) - (if (output-port? log) - (%test-final-report-simple runner log)))) - -(define (%test-format-line runner) - (let* ((line-info (test-result-alist runner)) - (source-file (assq 'source-file line-info)) - (source-line (assq 'source-line line-info)) - (file (if source-file (cdr source-file) ""))) - (if source-line - (string-append file ":" - (number->string (cdr source-line)) ": ") - ""))) - -(define (%test-end suite-name line-info) - (let* ((r (test-runner-get)) - (groups (test-runner-group-stack r)) - (line (%test-format-line r))) - (test-result-alist! r line-info) - (if (null? groups) - (let ((msg (string-append line "test-end not in a group"))) - (cond-expand - (srfi-23 (error msg)) - (else (display msg) (newline))))) - (if (and suite-name (not (equal? suite-name (car groups)))) - ((test-runner-on-bad-end-name r) r suite-name (car groups))) - (let* ((count-list (%test-runner-count-list r)) - (expected-count (cdar count-list)) - (saved-count (caar count-list)) - (group-count (- (%test-runner-total-count r) saved-count))) - (if (and expected-count - (not (= expected-count group-count))) - ((test-runner-on-bad-count r) r group-count expected-count)) - ((test-runner-on-group-end r) r) - (test-runner-group-stack! r (cdr (test-runner-group-stack r))) - (%test-runner-skip-list! r (car (%test-runner-skip-save r))) - (%test-runner-skip-save! r (cdr (%test-runner-skip-save r))) - (%test-runner-fail-list! r (car (%test-runner-fail-save r))) - (%test-runner-fail-save! r (cdr (%test-runner-fail-save r))) - (%test-runner-count-list! r (cdr count-list)) - (if (null? (test-runner-group-stack r)) - ((test-runner-on-final r) r))))) - -(define-syntax test-group - (syntax-rules () - ((test-group suite-name . body) - (let ((r (test-runner-current))) - ;; Ideally should also set line-number, if available. - (test-result-alist! r (list (cons 'test-name suite-name))) - (if (%test-should-execute r) - (dynamic-wind - (lambda () (test-begin suite-name)) - (lambda () . body) - (lambda () (test-end suite-name)))))))) - -(define-syntax test-group-with-cleanup - (syntax-rules () - ((test-group-with-cleanup suite-name form cleanup-form) - (test-group suite-name - (dynamic-wind - (lambda () #f) - (lambda () form) - (lambda () cleanup-form)))) - ((test-group-with-cleanup suite-name cleanup-form) - (test-group-with-cleanup suite-name #f cleanup-form)) - ((test-group-with-cleanup suite-name form1 form2 form3 . rest) - (test-group-with-cleanup suite-name (begin form1 form2) form3 . rest)))) - -(define (test-on-test-begin-simple runner) - (let ((log (test-runner-aux-value runner))) - (if (output-port? log) - (let* ((results (test-result-alist runner)) - (source-file (assq 'source-file results)) - (source-line (assq 'source-line results)) - (source-form (assq 'source-form results)) - (test-name (assq 'test-name results))) - (display "Test begin:" log) - (newline log) - (if test-name (%test-write-result1 test-name log)) - (if source-file (%test-write-result1 source-file log)) - (if source-line (%test-write-result1 source-line log)) - (if source-file (%test-write-result1 source-form log)))))) - -(define-syntax test-result-ref - (syntax-rules () - ((test-result-ref runner pname) - (test-result-ref runner pname #f)) - ((test-result-ref runner pname default) - (let ((p (assq pname (test-result-alist runner)))) - (if p (cdr p) default))))) - -(define (test-on-test-end-simple runner) - (let ((log (test-runner-aux-value runner)) - (kind (test-result-ref runner 'result-kind))) - (if (memq kind '(fail xpass)) - (let* ((results (test-result-alist runner)) - (source-file (assq 'source-file results)) - (source-line (assq 'source-line results)) - (test-name (assq 'test-name results))) - (if (or source-file source-line) - (begin - (if source-file (display (cdr source-file))) - (display ":") - (if source-line (display (cdr source-line))) - (display ": "))) - (display (if (eq? kind 'xpass) "XPASS" "FAIL")) - (if test-name - (begin - (display " ") - (display (cdr test-name)))) - (newline))) - (if (output-port? log) - (begin - (display "Test end:" log) - (newline log) - (let loop ((list (test-result-alist runner))) - (if (pair? list) - (let ((pair (car list))) - ;; Write out properties not written out by on-test-begin. - (if (not (memq (car pair) - '(test-name source-file source-line source-form))) - (%test-write-result1 pair log)) - (loop (cdr list))))))))) - -(define (%test-write-result1 pair port) - (display " " port) - (display (car pair) port) - (display ": " port) - (write (cdr pair) port) - (newline port)) - -(define (test-result-set! runner pname value) - (let* ((alist (test-result-alist runner)) - (p (assq pname alist))) - (if p - (set-cdr! p value) - (test-result-alist! runner (cons (cons pname value) alist))))) - -(define (test-result-clear runner) - (test-result-alist! runner '())) - -(define (test-result-remove runner pname) - (let* ((alist (test-result-alist runner)) - (p (assq pname alist))) - (if p - (test-result-alist! runner - (let loop ((r alist)) - (if (eq? r p) (cdr r) - (cons (car r) (loop (cdr r))))))))) - -(define (test-result-kind . rest) - (let ((runner (if (pair? rest) (car rest) (test-runner-current)))) - (test-result-ref runner 'result-kind))) - -(define (test-passed? . rest) - (let ((runner (if (pair? rest) (car rest) (test-runner-get)))) - (memq (test-result-ref runner 'result-kind) '(pass xpass)))) - -(define (%test-report-result) - (let* ((r (test-runner-get)) - (result-kind (test-result-kind r))) - (case result-kind - ((pass) - (test-runner-pass-count! r (+ 1 (test-runner-pass-count r)))) - ((fail) - (test-runner-fail-count! r (+ 1 (test-runner-fail-count r)))) - ((xpass) - (test-runner-xpass-count! r (+ 1 (test-runner-xpass-count r)))) - ((xfail) - (test-runner-xfail-count! r (+ 1 (test-runner-xfail-count r)))) - (else - (test-runner-skip-count! r (+ 1 (test-runner-skip-count r))))) - (%test-runner-total-count! r (+ 1 (%test-runner-total-count r))) - ((test-runner-on-test-end r) r))) - -(cond-expand - (guile - (define-syntax %test-evaluate-with-catch - (syntax-rules () - ((%test-evaluate-with-catch test-expression) - (catch #t (lambda () test-expression) (lambda (key . args) #f)))))) - (kawa - (define-syntax %test-evaluate-with-catch - (syntax-rules () - ((%test-evaluate-with-catch test-expression) - (try-catch test-expression - (ex - (test-result-set! (test-runner-current) 'actual-error ex) - #f)))))) - (srfi-34 - (define-syntax %test-evaluate-with-catch - (syntax-rules () - ((%test-evaluate-with-catch test-expression) - (guard (err (else #f)) test-expression))))) - (chicken - (define-syntax %test-evaluate-with-catch - (syntax-rules () - ((%test-evaluate-with-catch test-expression) - (condition-case test-expression (ex () #f)))))) - (else - (define-syntax %test-evaluate-with-catch - (syntax-rules () - ((%test-evaluate-with-catch test-expression) - test-expression))))) - -(cond-expand - ((or kawa mzscheme) - (cond-expand - (mzscheme - (define-for-syntax (%test-syntax-file form) - (let ((source (syntax-source form))) - (cond ((string? source) file) - ((path? source) (path->string source)) - (else #f))))) - (kawa - (define (%test-syntax-file form) - (syntax-source form)))) - (define-for-syntax (%test-source-line2 form) - (let* ((line (syntax-line form)) - (file (%test-syntax-file form)) - (line-pair (if line (list (cons 'source-line line)) '()))) - (cons (cons 'source-form (syntax-object->datum form)) - (if file (cons (cons 'source-file file) line-pair) line-pair))))) - (else - (define (%test-source-line2 form) - '()))) - -(define (%test-on-test-begin r) - (%test-should-execute r) - ((test-runner-on-test-begin r) r) - (not (eq? 'skip (test-result-ref r 'result-kind)))) - -(define (%test-on-test-end r result) - (test-result-set! r 'result-kind - (if (eq? (test-result-ref r 'result-kind) 'xfail) - (if result 'xpass 'xfail) - (if result 'pass 'fail)))) - -(define (test-runner-test-name runner) - (test-result-ref runner 'test-name "")) - -(define-syntax %test-comp2body - (syntax-rules () - ((%test-comp2body r comp expected expr) - (let () - (if (%test-on-test-begin r) - (let ((exp expected)) - (test-result-set! r 'expected-value exp) - (let ((res (%test-evaluate-with-catch expr))) - (test-result-set! r 'actual-value res) - (%test-on-test-end r (comp exp res))))) - (%test-report-result))))) - -(define (%test-approximimate= error) - (lambda (value expected) - (and (>= value (- expected error)) - (<= value (+ expected error))))) - -(define-syntax %test-comp1body - (syntax-rules () - ((%test-comp1body r expr) - (let () - (if (%test-on-test-begin r) - (let () - (let ((res (%test-evaluate-with-catch expr))) - (test-result-set! r 'actual-value res) - (%test-on-test-end r res)))) - (%test-report-result))))) - -(cond-expand - ((or kawa mzscheme) - ;; Should be made to work for any Scheme with syntax-case - ;; However, I haven't gotten the quoting working. FIXME. - (define-syntax test-end - (lambda (x) - (syntax-case (list x (list 'quote (%test-source-line2 x))) () - (((mac suite-name) line) - (syntax - (%test-end suite-name line))) - (((mac) line) - (syntax - (%test-end #f line)))))) - (define-syntax test-assert - (lambda (x) - (syntax-case (list x (list 'quote (%test-source-line2 x))) () - (((mac tname expr) line) - (syntax - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r (cons (cons 'test-name tname) line)) - (%test-comp1body r expr)))) - (((mac expr) line) - (syntax - (let* ((r (test-runner-get))) - (test-result-alist! r line) - (%test-comp1body r expr))))))) - (define-for-syntax (%test-comp2 comp x) - (syntax-case (list x (list 'quote (%test-source-line2 x)) comp) () - (((mac tname expected expr) line comp) - (syntax - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r (cons (cons 'test-name tname) line)) - (%test-comp2body r comp expected expr)))) - (((mac expected expr) line comp) - (syntax - (let* ((r (test-runner-get))) - (test-result-alist! r line) - (%test-comp2body r comp expected expr)))))) - (define-syntax test-eqv - (lambda (x) (%test-comp2 (syntax eqv?) x))) - (define-syntax test-eq - (lambda (x) (%test-comp2 (syntax eq?) x))) - (define-syntax test-equal - (lambda (x) (%test-comp2 (syntax equal?) x))) - (define-syntax test-approximate ;; FIXME - needed for non-Kawa - (lambda (x) - (syntax-case (list x (list 'quote (%test-source-line2 x))) () - (((mac tname expected expr error) line) - (syntax - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r (cons (cons 'test-name tname) line)) - (%test-comp2body r (%test-approximimate= error) expected expr)))) - (((mac expected expr error) line) - (syntax - (let* ((r (test-runner-get))) - (test-result-alist! r line) - (%test-comp2body r (%test-approximimate= error) expected expr)))))))) - (else - (define-syntax test-end - (syntax-rules () - ((test-end) - (%test-end #f '())) - ((test-end suite-name) - (%test-end suite-name '())))) - (define-syntax test-assert - (syntax-rules () - ((test-assert tname test-expression) - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r '((test-name . tname))) - (%test-comp1body r test-expression))) - ((test-assert test-expression) - (let* ((r (test-runner-get))) - (test-result-alist! r '()) - (%test-comp1body r test-expression))))) - (define-syntax %test-comp2 - (syntax-rules () - ((%test-comp2 comp tname expected expr) - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r (list (cons 'test-name tname))) - (%test-comp2body r comp expected expr))) - ((%test-comp2 comp expected expr) - (let* ((r (test-runner-get))) - (test-result-alist! r '()) - (%test-comp2body r comp expected expr))))) - (define-syntax test-equal - (syntax-rules () - ((test-equal . rest) - (%test-comp2 equal? . rest)))) - (define-syntax test-eqv - (syntax-rules () - ((test-eqv . rest) - (%test-comp2 eqv? . rest)))) - (define-syntax test-eq - (syntax-rules () - ((test-eq . rest) - (%test-comp2 eq? . rest)))) - (define-syntax test-approximate - (syntax-rules () - ((test-approximate tname expected expr error) - (%test-comp2 (%test-approximimate= error) tname expected expr)) - ((test-approximate expected expr error) - (%test-comp2 (%test-approximimate= error) expected expr)))))) - -(cond-expand - (guile - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (%test-comp1body r (catch #t (lambda () expr) (lambda (key . args) #t))))))) - (mzscheme - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (%test-comp1body r (with-handlers (((lambda (h) #t) (lambda (h) #t))) - (let () - (test-result-set! r 'actual-value expr) - #f))))))) - (chicken - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (%test-comp1body r (condition-case expr (ex () #t))))))) - (kawa - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (let () - (if (%test-on-test-begin r) - (let ((et etype)) - (test-result-set! r 'expected-error et) - (%test-on-test-end r - (try-catch - (let () - (test-result-set! r 'actual-value expr) - #f) - (ex - (test-result-set! r 'actual-error ex) - (cond ((and (instance? et ) - (gnu.bytecode.ClassType:isSubclass et )) - (instance? ex et)) - (else #t))))) - (%test-report-result)))))))) - ((and srfi-34 srfi-35) - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (%test-comp1body r (guard (ex ((condition-type? etype) - (and (condition? ex) (condition-has-type? ex etype))) - ((procedure? etype) - (etype ex)) - ((equal? type #t) - #t) - (else #t)) - expr)))))) - (srfi-34 - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (%test-comp1body r (guard (ex (else #t)) expr)))))) - (else - (define-syntax %test-error - (syntax-rules () - ((%test-error r etype expr) - (begin - ((test-runner-on-test-begin r) r) - (test-result-set! r 'result-kind 'skip) - (%test-report-result))))))) - -(cond-expand - ((or kawa mzscheme) - - (define-syntax test-error - (lambda (x) - (syntax-case (list x (list 'quote (%test-source-line2 x))) () - (((mac tname etype expr) line) - (syntax - (let* ((r (test-runner-get)) - (name tname)) - (test-result-alist! r (cons (cons 'test-name tname) line)) - (%test-error r etype expr)))) - (((mac etype expr) line) - (syntax - (let* ((r (test-runner-get))) - (test-result-alist! r line) - (%test-error r etype expr)))) - (((mac expr) line) - (syntax - (let* ((r (test-runner-get))) - (test-result-alist! r line) - (%test-error r #t expr)))))))) - (else - (define-syntax test-error - (syntax-rules () - ((test-error name etype expr) - (test-assert name (%test-error (test-runner-get) etype expr))) - ((test-error etype expr) - (test-assert (%test-error (test-runner-get) etype expr))) - ((test-error expr) - (test-assert (%test-error (test-runner-get) #t expr))))))) - -(define (test-apply first . rest) - (if (test-runner? first) - (test-with-runner first (apply test-apply rest)) - (let ((r (test-runner-current))) - (if r - (let ((run-list (%test-runner-run-list r))) - (cond ((null? rest) - (%test-runner-run-list! r (reverse! run-list)) - (first)) ;; actually apply procedure thunk - (else - (%test-runner-run-list! - r - (if (eq? run-list #t) (list first) (cons first run-list))) - (apply test-apply rest) - (%test-runner-run-list! r run-list)))) - (let ((r (test-runner-create))) - (test-with-runner r (apply test-apply first rest)) - ((test-runner-on-final r) r)))))) - -(define-syntax test-with-runner - (syntax-rules () - ((test-with-runner runner form ...) - (let ((saved-runner (test-runner-current))) - (dynamic-wind - (lambda () (test-runner-current runner)) - (lambda () form ...) - (lambda () (test-runner-current saved-runner))))))) - -;;; Predicates - -(define (%test-match-nth n count) - (let ((i 0)) - (lambda (runner) - (set! i (+ i 1)) - (and (>= i n) (< i (+ n count)))))) - -(define-syntax test-match-nth - (syntax-rules () - ((test-match-nth n) - (test-match-nth n 1)) - ((test-match-nth n count) - (%test-match-nth n count)))) - -(define (%test-match-all . pred-list) - (lambda (runner) - (let ((result #t)) - (let loop ((l pred-list)) - (if (null? l) - result - (begin - (if (not ((car l) runner)) - (set! result #f)) - (loop (cdr l)))))))) - -(define-syntax test-match-all - (syntax-rules () - ((test-match-all pred ...) - (%test-match-all (%test-as-specifier pred) ...)))) - -(define (%test-match-any . pred-list) - (lambda (runner) - (let ((result #f)) - (let loop ((l pred-list)) - (if (null? l) - result - (begin - (if ((car l) runner) - (set! result #t)) - (loop (cdr l)))))))) - -(define-syntax test-match-any - (syntax-rules () - ((test-match-any pred ...) - (%test-match-any (%test-as-specifier pred) ...)))) - -;; Coerce to a predicate function: -(define (%test-as-specifier specifier) - (cond ((procedure? specifier) specifier) - ((integer? specifier) (test-match-nth 1 specifier)) - ((string? specifier) (test-match-name specifier)) - (else - (error "not a valid test specifier")))) - -(define-syntax test-skip - (syntax-rules () - ((test-skip pred ...) - (let ((runner (test-runner-get))) - (%test-runner-skip-list! runner - (cons (test-match-all (%test-as-specifier pred) ...) - (%test-runner-skip-list runner))))))) - -(define-syntax test-expect-fail - (syntax-rules () - ((test-expect-fail pred ...) - (let ((runner (test-runner-get))) - (%test-runner-fail-list! runner - (cons (test-match-all (%test-as-specifier pred) ...) - (%test-runner-fail-list runner))))))) - -(define (test-match-name name) - (lambda (runner) - (equal? name (test-runner-test-name runner)))) - -(define (test-read-eval-string string) - (let* ((port (open-input-string string)) - (form (read port))) - (if (eof-object? (read-char port)) - (eval form) - (cond-expand - (srfi-23 (error "(not at eof)")) - (else "error"))))) - -- cgit From 4645f4105f480f6643f3749013c4eabc3f831124 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 18:31:01 -0800 Subject: Add comments pointing to info on how to write test cases. --- gnuradio-core/src/guile/tests/00_runtime_basics.test | 7 +++++++ gnuradio-core/src/guile/tests/00_runtime_ctors.test | 5 ++++- gnuradio-core/src/guile/tests/filter_ctors.test | 4 ++++ gnuradio-core/src/guile/tests/general_ctors.test | 4 ++++ gnuradio-core/src/guile/tests/gengen_ctors.test | 4 ++++ gnuradio-core/src/guile/tests/hier_ctors.test | 4 ++++ gnuradio-core/src/guile/tests/io_ctors.test | 4 ++++ 7 files changed, 31 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index c9d251268..90949c8f8 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -18,6 +18,13 @@ ;;; along with this program. If not, see . ;;; +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) diff --git a/gnuradio-core/src/guile/tests/00_runtime_ctors.test b/gnuradio-core/src/guile/tests/00_runtime_ctors.test index e0a946ab9..0c131f5bd 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_ctors.test +++ b/gnuradio-core/src/guile/tests/00_runtime_ctors.test @@ -21,11 +21,14 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) - ;;; Add test code for all constructors in these files ;;; ;;; ./runtime/gr_hier_block2.h diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test index 040b8ba10..9ff251a55 100644 --- a/gnuradio-core/src/guile/tests/filter_ctors.test +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -21,6 +21,10 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 8d272f768..ef2a3e729 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -21,6 +21,10 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index 652556d3f..de4ecb35e 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -21,6 +21,10 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) diff --git a/gnuradio-core/src/guile/tests/hier_ctors.test b/gnuradio-core/src/guile/tests/hier_ctors.test index c297fb9dd..48d2bfa2d 100644 --- a/gnuradio-core/src/guile/tests/hier_ctors.test +++ b/gnuradio-core/src/guile/tests/hier_ctors.test @@ -21,6 +21,10 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 2001e5fa5..8bb0bc34f 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -21,6 +21,10 @@ ;;; If you're using Emacs's Scheme mode: ;;; (put 'with-test-prefix 'scheme-indent-function 1) +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) -- cgit From 66d6c1b983e48f426b1169be3302407d5116d752 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 7 Nov 2010 23:13:09 -0800 Subject: Add not-yet-working test that should confirm exception raised --- gnuradio-core/src/guile/tests/00_runtime_basics.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index 90949c8f8..989ae423c 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -96,6 +96,24 @@ (gr:run tb) (test-equal expected-result (gr:data dst)))) +#! +;;; FIXME pass-if-exception is broken if the underlying code throws +;;; (like ours does). Need to write our own test utility for +;;; exceptions. +(with-test-prefix "test-connect-5" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; FIXME This isn't working... + (pass-if-exception "bad port" exception:swig-exception + (gr:connect tb src op (gr:ep dst 1))) + + )) +!# (with-test-prefix "test-io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) -- cgit From 10e3659b0cba48e834d577600392edbcfbff3b4b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 8 Nov 2010 13:48:44 -0800 Subject: New macros pass-if-throw & expect-fail-throw that test exceptions. Confirmed with "connect-5" test in 00_runtime_basics.test. --- .../src/guile/gnuradio/test-suite/lib.scm | 26 ++++++++++++++++++++++ .../src/guile/tests/00_runtime_basics.test | 21 ++++++----------- 2 files changed, 33 insertions(+), 14 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm index b7046a8b0..458e627de 100644 --- a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm +++ b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm @@ -38,6 +38,7 @@ run-test pass-if expect-fail pass-if-exception expect-fail-exception + pass-if-throw expect-fail-throw ;; Naming groups of tests in a regular fashion. with-test-prefix with-test-prefix* current-test-prefix @@ -340,6 +341,13 @@ `(run-test ,name #f (lambda () ,@rest)))) ;;; A helper function to implement the macros that test for exceptions. +;;; +;;; This doesn't work for all exceptions, just those that were +;;; raised by scm-error or error. This doesn't include those +;;; raised by throw in the general case, or SWIG in particular. +;;; +;;; See also run-raise-exception, pass-if-throw and expect-fail-throw +;;; for alternatives that work with all exceptions. (define (run-test-exception name exception expect-pass thunk) (run-test name expect-pass (lambda () @@ -376,6 +384,24 @@ (defmacro expect-fail-exception (name exception body . rest) `(,run-test-exception ,name ,exception #f (lambda () ,body ,@rest))) + +;;; Helper for macros below +(define (run-test-throw name exception-key expect-pass thunk) + (run-test name expect-pass + (lambda () + (stack-catch exception-key + (lambda () (thunk) #f) + (lambda (key . rest) #t))))) + +;;; A short form for tests that expect a certain exception to be thrown, +;;; where the exception is specified only by the exception-key symbol. +(defmacro pass-if-throw (name exception-key body . rest) + `(,run-test-throw ,name ,exception-key #t (lambda () ,body ,@rest))) + +;;; A short form for tests that expect a certain exception to be thrown, +;;; where the exception is specified only by the exception-key symbol. +(defmacro expect-fail-throw (name exception-key body . rest) + `(,run-test-throw ,name ,exception-key #f (lambda () ,body ,@rest))) ;;;; TEST NAMES ;;;; diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index 989ae423c..93dcff4d7 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -33,7 +33,7 @@ (list->vector (map f (vector->list v)))) -(with-test-prefix "test-connect-1" +(with-test-prefix "connect-1" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -50,7 +50,7 @@ (test-equal expected-result (gr:data dst)) )) -(with-test-prefix "test-connect-2" +(with-test-prefix "connect-2" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -66,7 +66,7 @@ (test-equal expected-result (gr:data dst)))) -(with-test-prefix "test-connect-3" +(with-test-prefix "connect-3" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -82,7 +82,7 @@ (test-equal expected-result (gr:data dst)))) -(with-test-prefix "test-connect-4" +(with-test-prefix "connect-4" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -96,11 +96,7 @@ (gr:run tb) (test-equal expected-result (gr:data dst)))) -#! -;;; FIXME pass-if-exception is broken if the underlying code throws -;;; (like ours does). Need to write our own test utility for -;;; exceptions. -(with-test-prefix "test-connect-5" +(with-test-prefix "connect-5" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) (tb (gr:top-block-swig "QA top block")) @@ -108,14 +104,11 @@ (op (gr:multiply-const-ii 2)) (dst (gr:vector-sink-i))) - ;; FIXME This isn't working... - (pass-if-exception "bad port" exception:swig-exception + (pass-if-throw "bad port exception" 'swig-exception (gr:connect tb src op (gr:ep dst 1))) - )) -!# -(with-test-prefix "test-io-signature-1" +(with-test-prefix "io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) (ios2 (gr:io-signature2 1 2 16 32)) (ios3 (gr:io-signature3 1 -1 14 32 48)) -- cgit From 95a575c177be15b7d4a8634a071ee11f3fb403f4 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 8 Nov 2010 13:50:54 -0800 Subject: Add test case. --- .../src/guile/tests/00_runtime_basics.test | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index 93dcff4d7..15bf9cb3f 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -108,6 +108,32 @@ (gr:connect tb src op (gr:ep dst 1))) )) +#! +;;; FIXME currently triggers core dump. +;;; The problem is that swig isn't paying attention to +;;; this throw declaration: +;;; +;;; gr_top_block.i: +;;; void start() throw (std::runtime_error); +;;; +(with-test-prefix "gr_top_block::start throw" + (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) + (expected-result (vector-map (lambda (x) (* x 2)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-i src-data #f)) + (op (gr:multiply-const-ii 2)) + (dst (gr:vector-sink-i))) + + ;; We deliberately don't connect op's output + (gr:connect tb src op) + + ;; Which should lead to an exception here... + ;; but currently triggers a core dump. + (pass-if-throw "throws std::runtime_error" #t + (gr:run tb)) + )) +!# + (with-test-prefix "io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) (ios2 (gr:io-signature2 1 2 16 32)) -- cgit From 941c9a792f103c48de6157026d08d7b0a6bae227 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 8 Nov 2010 14:03:19 -0800 Subject: Enable test case & fix (missing throw (std::runtime_error) declaration). --- gnuradio-core/src/guile/tests/00_runtime_basics.test | 14 ++------------ gnuradio-core/src/lib/runtime/gr_top_block.i | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index 15bf9cb3f..18b298f22 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -108,14 +108,6 @@ (gr:connect tb src op (gr:ep dst 1))) )) -#! -;;; FIXME currently triggers core dump. -;;; The problem is that swig isn't paying attention to -;;; this throw declaration: -;;; -;;; gr_top_block.i: -;;; void start() throw (std::runtime_error); -;;; (with-test-prefix "gr_top_block::start throw" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) (expected-result (vector-map (lambda (x) (* x 2)) src-data)) @@ -127,12 +119,10 @@ ;; We deliberately don't connect op's output (gr:connect tb src op) - ;; Which should lead to an exception here... - ;; but currently triggers a core dump. - (pass-if-throw "throws std::runtime_error" #t + ;; Which will lead to an exception here... + (pass-if-throw "throws std::runtime_error" 'swig-exception (gr:run tb)) )) -!# (with-test-prefix "io-signature-1" (let ((ios1 (gr:io-signature 1 2 8)) diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index d9adf1e18..f18d8890b 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -43,7 +43,7 @@ public: void start() throw (std::runtime_error); void stop(); void wait(); - void run(); + void run() throw (std::runtime_error); void lock(); void unlock() throw (std::runtime_error); void dump(); -- cgit From 0eb9f4f3217dc9a68befab7f205aa2cdc67653f6 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 8 Nov 2010 14:47:27 -0800 Subject: new test case and fix for problem --- gnuradio-core/src/guile/tests/general_ctors.test | 14 ++++++++++++-- gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index ef2a3e729..a706c827c 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -29,9 +29,20 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) + +;;; Return #t if x is not #f +(define (true? x) + (and x #t)) + ;;; Add test code for all constructors in these files -;;; + ;;; ./general/gr_additive_scrambler_bb.h +(pass-if (true? (gr:additive-scrambler-bb 0 0 0 0))) + +;; Here's one that will throw if its arg is 0 +(pass-if (true? (gr:unpack-k-bits-bb 10))) +(pass-if-throw "confirm throw" #t (true? (gr:unpack-k-bits-bb 0))) + ;;; ./general/gr_agc2_cc.h ;;; ./general/gr_agc2_ff.h ;;; ./general/gr_agc_cc.h @@ -142,7 +153,6 @@ ;;; ./general/gr_threshold_ff.h ;;; ./general/gr_throttle.h ;;; ./general/gr_uchar_to_float.h -;;; ./general/gr_unpack_k_bits_bb.h ;;; ./general/gr_vco_f.h ;;; ./general/gr_vector_to_stream.h ;;; ./general/gr_vector_to_streams.h diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i index 5f9a8f134..2e9aa406b 100644 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i +++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(gr,unpack_k_bits_bb) -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k); +gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception); class gr_unpack_k_bits_bb : public gr_sync_interpolator { -- cgit From b87c20de46e52c4cac66dc80b74db48d60a43095 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 9 Nov 2010 09:14:34 -0700 Subject: make the tests directory before trying to run any tests --- gnuradio-core/src/guile/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index f3c02a446..c8d05ecfa 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -25,7 +25,6 @@ EXTRA_DIST = \ run_guile_tests.in \ gnuradio/test-suite/guile-test.in - # These are the hand-code guile files for gnuradio-core. # # Swig/common.scm is glue that's required for the goops wrappers. @@ -51,3 +50,7 @@ noinst_DATA = \ tests/io_ctors.test CLEANFILES = guile.log + +check-am: all-am + @test -d "tests" || $(mkinstalldirs) "tests" + $(MAKE) $(AM_MAKEFLAGS) check-TESTS -- cgit From 5f89cc658099916aad49dcff0ebef296eaa09135 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 9 Nov 2010 09:20:36 -0800 Subject: Remove guile-test.in. We're not rewriting the header anymore --- gnuradio-core/src/guile/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index c8d05ecfa..5eb9444af 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -22,8 +22,7 @@ include $(top_srcdir)/Makefile.common TESTS = run_guile_tests EXTRA_DIST = \ - run_guile_tests.in \ - gnuradio/test-suite/guile-test.in + run_guile_tests.in # These are the hand-code guile files for gnuradio-core. # -- cgit From 5a9a440109ef950ac8b749a55644528204520131 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 9 Nov 2010 18:41:27 -0700 Subject: add tests for all the constructors, failing ones commented out for now --- gnuradio-core/src/guile/tests/general_ctors.test | 279 ++++++++++++++++++++++- 1 file changed, 274 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index a706c827c..10ee9e9e8 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -29,7 +29,6 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) - ;;; Return #t if x is not #f (define (true? x) (and x #t)) @@ -41,120 +40,390 @@ ;; Here's one that will throw if its arg is 0 (pass-if (true? (gr:unpack-k-bits-bb 10))) -(pass-if-throw "confirm throw" #t (true? (gr:unpack-k-bits-bb 0))) +(pass-if-throw "confirm throw gr:unpack-k-bits-bb" #t (true? (gr:unpack-k-bits-bb 0))) ;;; ./general/gr_agc2_cc.h +(pass-if (true? (gr:agc2-cc 1e-1 1e-2 1.0 1.0 0.0))) + ;;; ./general/gr_agc2_ff.h +(pass-if (true? (gr:agc2-ff 0 0 0 0 0))) + ;;; ./general/gr_agc_cc.h +(pass-if (true? (gr:agc-cc 0 0 0 0))) + ;;; ./general/gr_agc_ff.h +(pass-if (true? (gr:agc-ff 0 0 0 0))) + ;;; ./general/gr_align_on_samplenumbers_ss.h +;; (pass-if (true? (gr:align-on-samplenumbers-ss 0 0))) FIXME: throws + ;;; ./general/gr_bin_statistics_f.h +;; (pass-if (true? (gr:bin-statistics-f 0 0 0 0 0))) FIXME: not found + ;;; ./general/gr_binary_slicer_fb.h +(pass-if (true? (gr:binary-slicer-fb))) + ;;; ./general/gr_bytes_to_syms.h +(pass-if (true? (gr:bytes-to-syms))) + ;;; ./general/gr_char_to_float.h +(pass-if (true? (gr:char-to-float))) + ;;; ./general/gr_check_counting_s.h +;; (pass-if (true? (gr:check-counting-s false))) FIXME: not found + ;;; ./general/gr_check_lfsr_32k_s.h +;; (pass-if (true? (gr:check-lfsr-2k-s))) FIXME: not found + ;;; ./general/gr_clock_recovery_mm_cc.h +(pass-if (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) +;; (pass-if-throw "confirm throw gr:clock-recovery-mm-cc" #t (true? (gr:clock-recovery-mm-cc 0 0 0 0 0))) FIXME: segfault + ;;; ./general/gr_clock_recovery_mm_ff.h +(pass-if (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) +;; (pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 0 0 0 0 0))) ;; FIXME: segfault + ;;; ./general/gr_complex_to_interleaved_short.h -;;; ./general/gr_complex_to_xxx.h +(pass-if (true? (gr:complex-to-interleaved-short))) + +;;; ./general/gr_complex_to_xxx.h FIXME: all throw +;; (pass-if (true? (gr:complex-to-float 0))) +;; (pass-if (true? (gr:complex-to-real 0))) +;; (pass-if (true? (gr:complex-to-imag 0))) +;; (pass-if (true? (gr:complex-to-mag 0))) +;; (pass-if (true? (gr:complex-to-mag-squared 0))) +;; (pass-if (true? (gr:complex-to-arg 0))) + ;;; ./general/gr_conjugate_cc.h +(pass-if (true? (gr:conjugate-cc))) + ;;; ./general/gr_constellation_decoder_cb.h +;gr_constellation_decoder_cb (const std::vector &sym_position, +; const std::vector &sym_value_out); +;; (pass-if (true? (gr:constellation_decoder_cb ))) + ;;; ./general/gr_copy.h +;; (pass-if (true? (gr:copy 0))) FIXME: throws + ;;; ./general/gr_correlate_access_code_bb.h +(pass-if (true? (gr:correlate-access-code-bb "foo" 0))) +;; (pass-if-throw "confirm throw correlate-access-code-bb" #t (true? (gr:correlate-access-code-bb "foo" -1))) FIXME: throws + ;;; ./general/gr_costas_loop_cc.h +(pass-if (true? (gr:costas-loop-cc 0 0 0 0 2))) +(pass-if-throw "confirm throw gr:costas-loop-cc" #t (true? (gr:costas-loop-cc 0 0 0 0 3))) + ;;; ./general/gr_cpfsk_bc.h +;; (pass-if (true? (gr:cpfsk-bc 0 0 0))) FIXME: throws + ;;; ./general/gr_ctcss_squelch_ff.h +;; (pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 true))) FIXME: not found + ;;; ./general/gr_decode_ccsds_27_fb.h +(pass-if (true? (gr:decode-ccsds-27-fb))) + ;;; ./general/gr_deinterleave.h +;; (pass-if (true? (gr:deinterleave 0))) FIXME: throws + ;;; ./general/gr_delay.h +;; (pass-if (true? (gr:delay 0 0))) FIXME: throws + ;;; ./general/gr_descrambler_bb.h +(pass-if (true? (gr:descrambler-bb 0 0 0))) + ;;; ./general/gr_diff_decoder_bb.h +(pass-if (true? (gr:diff-decoder-bb 0))) + ;;; ./general/gr_diff_encoder_bb.h +(pass-if (true? (gr:diff-encoder-bb 0))) + ;;; ./general/gr_diff_phasor_cc.h +(pass-if (true? (gr:diff-phasor-cc))) + ;;; ./general/gr_dpll_bb.h +(pass-if (true? (gr:dpll-bb 0 0))) + ;;; ./general/gr_encode_ccsds_27_bb.h +(pass-if (true? (gr:encode-ccsds-27-bb))) + ;;; ./general/gr_fake_channel_coder_pp.h +;; (pass-if (true? (gr:fake-channel-coder-pp 1 1))) FIXME: not found +;; (pass-if-throw "confirm throw" #t (true? (gr:fake-channel-coder-pp -1 1))) + ;;; ./general/gr_feedforward_agc_cc.h +;; (pass-if (true? (gr:feedforward-agc-cc 0 0))) FIXME: throws + ;;; ./general/gr_fft_vcc.h +;; gr_fft_vcc (int fft_size, bool forward, const std::vector &window, bool shift); +;; (pass-if (true? (gr:fft-vcc ))) + ;;; ./general/gr_fft_vcc_fftw.h +;; gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector &window, bool shift); +;; (pass-if (true? (gr:fft-vcc-fftw ))) + ;;; ./general/gr_fft_vfc.h +;; bool set_window(const std::vector &window); +;; (pass-if (true? (gr:fft_vfc ))) + ;;; ./general/gr_fll_band_edge_cc.h -;;; ./general/gr_float_to_char.h -;;; ./general/gr_float_to_complex.h +(pass-if (true? (gr:fll-band-edge-cc 0 0 0 0 0))) + +;; ;;; ./general/gr_float_to_char.h +(pass-if (true? (gr:float-to-char))) + +;; ;;; ./general/gr_float_to_complex.h +;; (pass-if (true? (gr:float-to-complex 0))) FIXME: throws + ;;; ./general/gr_float_to_short.h +(pass-if (true? (gr:float-to-short))) + ;;; ./general/gr_float_to_uchar.h +(pass-if (true? (gr:float-to-uchar))) + ;;; ./general/gr_fmdet_cf.h +(pass-if (true? (gr:fmdet-cf 0 0 0 0))) + ;;; ./general/gr_framer_sink_1.h +;; (pass-if (true? (gr:framer-sink-1))) FIXME: not found + ;;; ./general/gr_frequency_modulator_fc.h +(pass-if (true? (gr:frequency-modulator-fc 0))) + ;;; ./general/gr_glfsr_source_b.h +;; (pass-if (true? (gr: glfsr-source-b 0 true 0 0))) FIXME: not found +;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_b 33 true 0 0))) + ;;; ./general/gr_glfsr_source_f.h +;; (pass-if (true? (gr:glfsr-source-f 0 true 0 0))) FIXME: not found +;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_f 33 true 0 0))) + ;;; ./general/gr_head.h +;; (pass-if (true? (gr:head 0 0))) FIXME: throws + ;;; ./general/gr_interleave.h +;; (pass-if (true? (gr:interleave 0))) FIXME: throws + ;;; ./general/gr_interleaved_short_to_complex.h +(pass-if (true? (gr:interleaved-short-to-complex))) + ;;; ./general/gr_iqcomp_cc.h +;; (pass-if (true? (gr:iqcomp-cc 0 0))) FIXME: not found + ;;; ./general/gr_keep_one_in_n.h +;; (pass-if (true? (gr:keep-one-in-n 0 0))) FIXME: throws + ;;; ./general/gr_kludge_copy.h +;; (pass-if (true? (gr:kludge-copy 0))) FIXME: throws + ;;; ./general/gr_lfsr_32k_source_s.h +(pass-if (true? (gr:lfsr-32k-source-s))) + ;;; ./general/gr_lms_dfe_cc.h +;; (pass-if (true? (gr:lms-dfe-ff 0 0 0 0))) FIXME: hangs + ;;; ./general/gr_lms_dfe_ff.h +;; (pass-if (true? (gr:lms-dfe-ff 0 0 0 0))) FIXME: hangs + ;;; ./general/gr_map_bb.h +;; gr_map_bb (const std::vector &map); +;; (pass-if (true? (gr:map-bb xx))) + ;;; ./general/gr_mpsk_receiver_cc.h +;; (pass-if (true? (gr:mpsk-receiver-cc 0 0 0 0 0 0 0 0 0 0 0))) FIXME: throws + ;;; ./general/gr_nlog10_ff.h +;; (pass-if (true? (gr:nlog10-ff 0 0 0))) FIXME: throws + ;;; ./general/gr_nop.h +;; (pass-if (true? (gr:nop 0))) FIXME: throws + ;;; ./general/gr_null_sink.h +;; (pass-if (true? (gr:null-sink 0))) FIXME: throws + ;;; ./general/gr_null_source.h +;; (pass-if (true? (gr:null-source 0)))v FIXME: throws + ;;; ./general/gr_ofdm_bpsk_demapper.h +;; (pass-if (true? (gr:ofdm-bpsk-demapper))) FIXME: not found + ;;; ./general/gr_ofdm_cyclic_prefixer.h +;; (pass-if (true? (gr:ofdm-cyclic-prefixer 0 0))) FIXME: throws + ;;; ./general/gr_ofdm_demapper_vcb.h +;; (pass-if (true? (gr:ofdm-mapper-bcv 0 0))) FIXME: throws + ;;; ./general/gr_ofdm_frame_acquisition.h +;; gr_ofdm_frame_acquisition (unsigned int occupied_carriers, +;; unsigned int fft_length, +;; unsigned int cplen, +;; const std::vector &known_symbol, +;; unsigned int max_fft_shift_len); +;; (pass-if (true? (gr:ofdm-frame-acquisition 0 0 0 (0 0) 0))) + ;;; ./general/gr_ofdm_frame_sink.h +;; gr_ofdm_frame_sink(const std::vector &sym_position, +;; const std::vector &sym_value_out, +;; gr_msg_queue_sptr target_queue, unsigned int occupied_tones, +;; float phase_gain, float freq_gain); +;; (pass-if (true? (gr:ofdm_frame_sink ))) + ;;; ./general/gr_ofdm_insert_preamble.h +;; gr_ofdm_insert_preamble(int fft_length, +;; const std::vector > &preamble); +;; (pass-if (true? (gr:ofdm-insert-preamble ))) + ;;; ./general/gr_ofdm_mapper_bcv.h +;; gr_ofdm_mapper_bcv (const std::vector &constellation, +;; unsigned int msgq_limit, +;; unsigned int bits_per_symbol, +;; unsigned int fft_length); +;; (pass-if (true? (gr:ofdm-mapper-bcv ))) + ;;; ./general/gr_ofdm_sampler.h +;; (pass-if (true? (gr:ofdm-sampler 0 0 0))) FIXME: throws + ;;; ./general/gr_pa_2x2_phase_combiner.h +(pass-if (true? (gr:pa-2x2-phase-combiner))) + ;;; ./general/gr_packet_sink.h +;; (pass-if (true? gr_make_packet_sink (const std::vector& sync_vector, +;; gr_msg_queue_sptr target_queue, +;; int threshold = -1 // -1 -> use default +;; ); +;; (gr:packet-sink ))) + ;;; ./general/gr_peak_detector2_fb.h +(pass-if (true? (gr:peak-detector2-fb 0 0 0))) + ;;; ./general/gr_phase_modulator_fc.h +(pass-if (true? (gr:phase-modulator-fc 0))) + ;;; ./general/gr_pll_carriertracking_cc.h +(pass-if (true? (gr:pll-carriertracking-cc 0 0 0 0))) + ;;; ./general/gr_pll_freqdet_cf.h +(pass-if (true? (gr:pll-freqdet-cf 0 0 0 0))) + ;;; ./general/gr_pll_refout_cc.h +(pass-if (true? (gr:pll-refout-cc 0 0 0 0))) + ;;; ./general/gr_pn_correlator_cc.h +;; (pass-if (true? (gr:pn-correlator-cc 0 0 0))) FIXME: throws + ;;; ./general/gr_probe_avg_mag_sqrd_c.h +(pass-if (true? (gr:probe-avg-mag-sqrd-c 0 0))) + ;;; ./general/gr_probe_avg_mag_sqrd_cf.h +(pass-if (true? (gr:probe-avg-mag-sqrd-cf 0 0))) + ;;; ./general/gr_probe_avg_mag_sqrd_f.h +(pass-if (true? (gr:probe-avg-mag-sqrd-f 0 0))) + ;;; ./general/gr_probe_density_b.h +(pass-if (true? (gr:probe-density-b 0))) + ;;; ./general/gr_probe_mpsk_snr_c.h +(pass-if (true? (gr:probe-mpsk-snr-c 0))) + ;;; ./general/gr_probe_signal_f.h +(pass-if (true? (gr:probe-signal-f))) + ;;; ./general/gr_pwr_squelch_cc.h +;; (pass-if (true? (gr:pwr-squelch-cc 0 0 0 0))) FIXME: not found + ;;; ./general/gr_pwr_squelch_ff.h +;; (pass-if (true? (gr:pwr-squelch-ff 0.0 0.0 0 false))) FIXME: not found + ;;; ./general/gr_quadrature_demod_cf.h +(pass-if (true? (gr:quadrature-demod-cf 0))) + ;;; ./general/gr_rail_ff.h +(pass-if (true? (gr:rail-ff 0 0))) + ;;; ./general/gr_regenerate_bb.h +(pass-if (true? (gr:regenerate-bb 0 0))) + ;;; ./general/gr_repeat.h +;; (pass-if (true? (gr:repeat 0 0))) FIXME: throws + ;;; ./general/gr_rms_cf.h +(pass-if (true? (gr:rms-cf 0))) + ;;; ./general/gr_rms_ff.h +(pass-if (true? (gr:rms-ff 0))) + ;;; ./general/gr_scrambler_bb.h +(pass-if (true? (gr:scrambler-bb 0 0 0))) + ;;; ./general/gr_short_to_float.h +(pass-if (true? (gr:short-to-float))) + ;;; ./general/gr_simple_correlator.h +(pass-if (true? (gr:simple-correlator 0))) + ;;; ./general/gr_simple_framer.h +(pass-if (true? (gr:simple-framer 0))) + ;;; ./general/gr_simple_squelch_cc.h +(pass-if (true? (gr:simple-squelch-cc 0 0))) + ;;; ./general/gr_skiphead.h +;; (pass-if (true? (gr:skiphead 0 0))) FIXME: throws + ;;; ./general/gr_squash_ff.h +;; gr_squash_ff_sptr gr_make_squash_ff(const std::vector &igrid, +;; const std::vector &ogrid); +;; (pass-if (true? (gr:squash_ff ))) + ;;; ./general/gr_squelch_base_cc.h +;; (pass-if (true? (gr:squelch-base-cc "foo" 0 false))) FIXME: not found + ;;; ./general/gr_squelch_base_ff.h +;; (pass-if (true? (gr:squelch-base-ff "foo" 0 false))) FIXME: not found + ;;; ./general/gr_stream_mux.h +;; gr_make_stream_mux (size_t itemsize, +;; const std::vector &lengths); +;; (pass-if (true? (gr:stream_mux ))) + ;;; ./general/gr_stream_to_streams.h +;; (pass-if (true? (gr:stream-to-streams 0 0))) FIXME: throws + ;;; ./general/gr_stream_to_vector.h +;; (pass-if (true? (gr:stream-to-vector 0 0))) FIXME: throws + ;;; ./general/gr_streams_to_stream.h +;; (pass-if (true? (gr:streams-to-stream 0 0))) FIXME: throws + ;;; ./general/gr_streams_to_vector.h +;; (pass-if (true? (gr:streams-to-vector 0 0))) FIXME: throws + ;;; ./general/gr_stretch_ff.h +;; (pass-if (true? (gr:stretch-ff 0 0))) FIXME: throws + ;;; ./general/gr_test.h +(pass-if (true? (gr:test "foo" 1 1 1 1 1 1 1 1))) + ;;; ./general/gr_threshold_ff.h +(pass-if (true? (gr:threshold-ff 0 0))) + ;;; ./general/gr_throttle.h +;; (pass-if (true? (gr:throttle 0 0))) FIXME: throws + ;;; ./general/gr_uchar_to_float.h +(pass-if (true? (gr:uchar-to-float))) + ;;; ./general/gr_vco_f.h +(pass-if (true? (gr:vco-f 0 0 0))) + ;;; ./general/gr_vector_to_stream.h +;; (pass-if (true? (gr:vector-to-stream 0 0))) FIXME: throws + ;;; ./general/gr_vector_to_streams.h +;; (pass-if (true? (gr:vector-to-streams 0 0))) FIXME: throws + ;;; ./general/gr_wavelet_ff.h +;; (pass-if (true? (gr:wavelet-ff 0 0))) FIXME: throws + ;;; ./general/gr_wvps_ff.h +;; (pass-if (true? (gr:wvps_ff 0))) FIXME: throws -- cgit From 5228dd1ba5de72642208404b29f8b876fe59f388 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 9 Nov 2010 18:42:48 -0800 Subject: First pass at waveform-spec --- gnuradio-core/src/guile/gnuradio/waveform-spec.scm | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gnuradio-core/src/guile/gnuradio/waveform-spec.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/waveform-spec.scm b/gnuradio-core/src/guile/gnuradio/waveform-spec.scm new file mode 100644 index 000000000..956a36106 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/waveform-spec.scm @@ -0,0 +1,36 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(define-module (gnuradio waveform-spec) + #:use-module (ice-9 syncase) + #:export-syntax waveform-spec) + +(define-syntax waveform-spec + (syntax-rules (vars blocks connections) + ((_ (args ...) + (vars (v-name v-val) ...) + (blocks (b-name b-val) ...) + (connections (endpoint1 endpoint2 ...) ...)) + (lambda (args ...) + (let* ((v-name v-val) ... + (b-name b-val) ... + (tb (gr:top-block-swig "waveform-top-block"))) + (gr:connect tb endpoint1 endpoint2 ...) ... + tb))))) + -- cgit From 15987345134793d3f6f0618bdf6b45ffc6609c0c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 9 Nov 2010 19:26:40 -0800 Subject: Example of how to fix throw crashes --- gnuradio-core/src/guile/tests/general_ctors.test | 3 ++- gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 10ee9e9e8..0580d6382 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -55,7 +55,8 @@ (pass-if (true? (gr:agc-ff 0 0 0 0))) ;;; ./general/gr_align_on_samplenumbers_ss.h -;; (pass-if (true? (gr:align-on-samplenumbers-ss 0 0))) FIXME: throws +(pass-if (true? (gr:align-on-samplenumbers-ss 2 128))) +(pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0))) ;;; ./general/gr_bin_statistics_f.h ;; (pass-if (true? (gr:bin-statistics-f 0 0 0 0 0))) FIXME: not found diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i index 841613ca6..ea73dd46d 100644 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i +++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i @@ -22,7 +22,8 @@ GR_SWIG_BLOCK_MAGIC(gr,align_on_samplenumbers_ss); -gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128); +gr_align_on_samplenumbers_ss_sptr +gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128) throw (std::exception); class gr_align_on_samplenumbers_ss : public gr_block { -- cgit From 1c2355390190f67762a39d77424b5e48563cfe9a Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 9 Nov 2010 21:51:45 -0700 Subject: stub out all the tests, but they depend on the next branch. :-( --- gnuradio-core/src/guile/tests/io_ctors.test | 37 +++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 8bb0bc34f..6516ef7fe 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -31,16 +31,49 @@ ;;; Add test code for all constructors in these files ;;; + ;;; ./io/gr_file_descriptor_sink.h +;;(pass-if (true? (gr:file-descriptor-sink 0 0))) FIXME: throws gr_io_signature(3) + ;;; ./io/gr_file_descriptor_source.h +;; (pass-if (true? (gr:file-descriptor-source 1 1 false))) FIXME: not found + ;;; ./io/gr_file_sink.h +(pass-if (true? (gr:file-sink 1 "foo"))) + ;;; ./io/gr_file_source.h -;;; ./io/gr_histo_sink_f.h +;; (pass-if (true? (gr:file-source 1 "foo" false))) FIXME: not found + +;;; ./io/gr_histo_sink_f.h FIXME: needs gr_msg_queue_sptr +;; gr_make_histo_sink_f (gr_msg_queue_sptr msgq); +;; (pass-if (true? (gr:histo-sink-f ))) + ;;; ./io/gr_message_sink.h +;; (pass-if (true? (gr:message-sink ))) + ;;; ./io/gr_message_source.h -;;; ./io/gr_oscope_sink_f.h +;; (pass-if (true? (gr:message-source ))) + +;;; ./io/gr_oscope_sink_f.h FIXME: needs gr_io_signature_sptr +;; _oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, +;; double sample_rate); +;; (pass-if (true? (gr:oscope-sink-f ))) + ;;; ./io/gr_oscope_sink_x.h + +;; gr_oscope_sink_x (const std::string name, +;; gr_io_signature_sptr input_sig, +;; double sampling_rate); +;; (pass-if (true? (gr:oscope_sink_x ))) + ;;; ./io/gr_udp_sink.h + ;;; ./io/gr_udp_source.h +;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 true true))) FIXME: not found + ;;; ./io/gr_wavfile_sink.h +;; (pass-if (true? (gr:message-source "foo" 1 1 1))) FIXME: not found + ;;; ./io/gr_wavfile_source.h +;; (pass-if (true? (gr:message-source "foo" false))) FIXME: not found + -- cgit From ab0d7d5b428fdf39d38f335a0ea6fc9be4924ca5 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 9 Nov 2010 21:56:08 -0700 Subject: add tests for the stuff that works, stubs for the rest --- gnuradio-core/src/guile/tests/gengen_ctors.test | 84 ++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index de4ecb35e..ead12a729 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -31,34 +31,98 @@ ;;; Add test code for all constructors in these files ;;; + ;;; ./gengen/gr_add_cc.h +;; (pass-if (true? (gr:add-cc 0))) FIXME: throws gr_io_signature(3) + ;;; ./gengen/gr_add_const_cc.h +(pass-if (true? (gr:add-const-cc 0))) + ;;; ./gengen/gr_add_const_ff.h +(pass-if (true? (gr:add-const-ff 0))) + ;;; ./gengen/gr_add_const_ii.h +(pass-if (true? (gr:add-const-ii 0))) + ;;; ./gengen/gr_add_const_sf.h +(pass-if (true? (gr:add-const-sf 0))) + ;;; ./gengen/gr_add_const_ss.h -;;; ./gengen/gr_add_const_vcc.h -;;; ./gengen/gr_add_const_vff.h -;;; ./gengen/gr_add_const_vii.h -;;; ./gengen/gr_add_const_vss.h +(pass-if (true? (gr:add-const-ss 0))) + +;;; ./gengen/gr_add_const_vcc.h FIXME: needs complex +;; gr_make_add_const_vcc (const std::vector &k); +;; (pass-if (true? (gr:add-const-vcc 0))) + +;;; ./gengen/gr_add_const_vff.h FIXME: needs vector +;; gr_make_add_const_vff (const std::vector &k); +;; (pass-if (true? (gr:add-const-vff ))) + +;;; ./gengen/gr_add_const_vii.h FIXME: needs vector +;; gr_make_add_const_vii (const std::vector &k); +;; (pass-if (true? (gr:add-const-vii ))) + +;;; ./gengen/gr_add_const_vss.h FIXME: needs vector +;; (pass-if (true? (gr:add-const-vss ))) + ;;; ./gengen/gr_add_ff.h +;; (pass-if (true? (gr:add-ff 0))) FIXME: throws gr_io_signature(3) + ;;; ./gengen/gr_add_ii.h +;; (pass-if (true? (gr:add-ii 0))) FIXME: throws gr_io_signature(3) + ;;; ./gengen/gr_add_ss.h +;; (pass-if (true? (gr:add-ss 0 ))) FIXME: throws gr_io_signature(3) + ;;; ./gengen/gr_and_bb.h +(pass-if (true? (gr:and-bb))) + ;;; ./gengen/gr_and_const_bb.h +(pass-if (true? (gr:and-const-bb 0))) + ;;; ./gengen/gr_and_const_ii.h +(pass-if (true? (gr:and-const-ii 0))) + ;;; ./gengen/gr_and_const_ss.h +(pass-if (true? (gr:and-const-ss 0))) + ;;; ./gengen/gr_and_ii.h +(pass-if (true? (gr:and-ii))) + ;;; ./gengen/gr_and_ss.h +(pass-if (true? (gr:and-ss))) + ;;; ./gengen/gr_argmax_fs.h +(pass-if (true? (gr:argmax-fs 1))) + ;;; ./gengen/gr_argmax_is.h +(pass-if (true? (gr:argmax-is 1))) + ;;; ./gengen/gr_argmax_ss.h -;;; ./gengen/gr_chunks_to_symbols_bc.h -;;; ./gengen/gr_chunks_to_symbols_bf.h -;;; ./gengen/gr_chunks_to_symbols_ic.h -;;; ./gengen/gr_chunks_to_symbols_if.h -;;; ./gengen/gr_chunks_to_symbols_sc.h -;;; ./gengen/gr_chunks_to_symbols_sf.h +(pass-if (true? (gr:argmax-ss 1))) + +;;; ./gengen/gr_chunks_to_symbols_bc.h FIXME: needs vector +;; gr_make_chunks_to_symbols_bc (const std::vector &symbol_table, const int D = 1); +;; (pass-if (true? (gr:chunks-to-symbols-bc ))) + +;;; ./gengen/gr_chunks_to_symbols_bf.h FIXME: needs vector +;; gr_make_chunks_to_symbols_bf (const std::vector &symbol_table, const int D = 1); +;; (pass-if (true? (gr:chunks-to-symbols-bf ))) + +;;; ./gengen/gr_chunks_to_symbols_ic.h FIXME: needs vector +;; gr_make_chunks_to_symbols_ic (const std::vector &symbol_table, const int D = 1); +;; (pass-if (true? (gr:chunks-to-symbols-ic ))) + +;;; ./gengen/gr_chunks_to_symbols_if.h FIXME: needs vector +;; gr_make_chunks_to_symbols_if (const std::vector &symbol_table, const int D = 1); +;; (pass-if (true? (gr:chunks_to_symbols_if ))) + +;;; ./gengen/gr_chunks_to_symbols_sc.h FIXME: needs vector +;; (pass-if (true? (gr:chunks_to_symbols_sc ))) + +;;; ./gengen/gr_chunks_to_symbols_sf.h FIXME: needs vector +;; (pass-if (true? (gr:chunks_to_symbols_sf ))) + ;;; ./gengen/gr_divide_cc.h ;;; ./gengen/gr_divide_ff.h ;;; ./gengen/gr_divide_ii.h -- cgit From b580c7b327028fc5cfd48cdebe8cab819c17fa75 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 9 Nov 2010 21:56:45 -0700 Subject: add stub for the only test --- gnuradio-core/src/guile/tests/hier_ctors.test | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/hier_ctors.test b/gnuradio-core/src/guile/tests/hier_ctors.test index 48d2bfa2d..8a83c86d5 100644 --- a/gnuradio-core/src/guile/tests/hier_ctors.test +++ b/gnuradio-core/src/guile/tests/hier_ctors.test @@ -31,4 +31,10 @@ ;;; Add test code for all constructors in these files ;;; + ;;; ./hier/gr_channel_model.h +;; gr_make_channel_model(double noise_voltage=0.0, double frequency_offset=0.0, +;; double epsilon=1.0, +;; const std::vector &taps=std::vector(1, 1), +;; double noise_seed=3021); +;; (pass-if (true? (gr:channel_model ))) -- cgit From b4f491386b9cb67cd35cee8032f559442822ddab Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 09:36:27 -0700 Subject: initial blast through gengen tests --- gnuradio-core/src/guile/tests/gengen_ctors.test | 232 +++++++++++++++++++++--- 1 file changed, 204 insertions(+), 28 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index ead12a729..5bdd207f9 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -124,77 +124,253 @@ ;; (pass-if (true? (gr:chunks_to_symbols_sf ))) ;;; ./gengen/gr_divide_cc.h +(pass-if (true? (gr:divide-cc 1))) + ;;; ./gengen/gr_divide_ff.h +(pass-if (true? (gr:divide-ff 1))) + ;;; ./gengen/gr_divide_ii.h +(pass-if (true? (gr:divide-ii 1))) + ;;; ./gengen/gr_divide_ss.h +(pass-if (true? (gr:divide-ss 1))) + ;;; ./gengen/gr_integrate_cc.h +(pass-if (true? (gr:integrate-cc 0))) + ;;; ./gengen/gr_integrate_ff.h +(pass-if (true? (gr:integrate-ff 0))) + ;;; ./gengen/gr_integrate_ii.h +(pass-if (true? (gr:integrate-ii 0))) + ;;; ./gengen/gr_integrate_ss.h +(pass-if (true? (gr:integrate-ss 0))) + ;;; ./gengen/gr_max_ff.h +(pass-if (true? (gr:max-ff 1))) + ;;; ./gengen/gr_max_ii.h +(pass-if (true? (gr:max-ii 1))) + ;;; ./gengen/gr_max_ss.h -;;; ./gengen/gr_moving_average_cc.h +(pass-if (true? (gr:max-ss 1))) + +;;; ./gengen/gr_moving_average_cc.h FIXME: needs gr_complex +;; gr_make_moving_average_cc (int length, gr_complex scale, int max_iter=4096); +;; (pass-if (true? (gr:moving-average-cc ))) + ;;; ./gengen/gr_moving_average_ff.h +(pass-if (true? (gr:moving-average-ff 1 0 4096))) + ;;; ./gengen/gr_moving_average_ii.h +(pass-if (true? (gr:moving-average-ii 1 0 4096))) + ;;; ./gengen/gr_moving_average_ss.h +(pass-if (true? (gr:moving-average-ss 1 0 4096))) + ;;; ./gengen/gr_multiply_cc.h +(pass-if (true? (gr:multiply-cc 1))) + ;;; ./gengen/gr_multiply_const_cc.h +(pass-if (true? (gr:multiply-const-cc 1))) + ;;; ./gengen/gr_multiply_const_ff.h +(pass-if (true? (gr:multiply-const-ff 1))) + ;;; ./gengen/gr_multiply_const_ii.h +(pass-if (true? (gr:multiply-const-ii 1))) + ;;; ./gengen/gr_multiply_const_ss.h -;;; ./gengen/gr_multiply_const_vcc.h -;;; ./gengen/gr_multiply_const_vff.h -;;; ./gengen/gr_multiply_const_vii.h -;;; ./gengen/gr_multiply_const_vss.h +(pass-if (true? (gr:multiply-const-ss 1))) + +;;; ./gengen/gr_multiply_const_vcc.h FIXME: needs vector +;; gr_make_multiply_const_vcc (const std::vector &k); +;; (pass-if (true? (gr:multiply-const-vcc 1))) + +;;; ./gengen/gr_multiply_const_vff.h FIXME: needs vector +;; gr_make_multiply_const_vff (const std::vector &k); +;; (pass-if (true? (gr:multiply-const-vff ))) + +;;; ./gengen/gr_multiply_const_vii.h FIXME: needs vector +;; gr_make_multiply_const_vii (const std::vector &k); +;; (pass-if (true? (gr:multiply-const-vii ))) + +;;; ./gengen/gr_multiply_const_vss.h FIXME: needs vector +;; gr_make_multiply_const_vss (const std::vector &k); +;; (pass-if (true? (gr:multiply-const-vss ))) + ;;; ./gengen/gr_multiply_ff.h +(pass-if (true? (gr:multiply-ff 1))) + ;;; ./gengen/gr_multiply_ii.h +(pass-if (true? (gr:multiply-ii 1))) + ;;; ./gengen/gr_multiply_ss.h -;;; ./gengen/gr_mute_cc.h -;;; ./gengen/gr_mute_ff.h -;;; ./gengen/gr_mute_ii.h -;;; ./gengen/gr_mute_ss.h -;;; ./gengen/gr_noise_source_c.h -;;; ./gengen/gr_noise_source_f.h -;;; ./gengen/gr_noise_source_i.h -;;; ./gengen/gr_noise_source_s.h +(pass-if (true? (gr:multiply-ss 1))) + +;;; ./gengen/gr_mute_cc.h FIXME: not found +;; (pass-if (true? (gr:mute-cc false))) + +;;; ./gengen/gr_mute_ff.h FIXME: not found +;;(pass-if (true? (gr:mute-ff false))) + +;;; ./gengen/gr_mute_ii.h FIXME: not found +;; (pass-if (true? (gr:mute-ii false))) + +;;; ./gengen/gr_mute_ss.h FIXME: not found +;; (pass-if (true? (gr:mute-ss false))) + +;;; ./gengen/gr_noise_source_c.h FIXME: needs gr_noise_type_t +;; gr_make_noise_source_c (gr_noise_type_t type, float ampl, long seed = 3021); +;; (pass-if (true? (gr:noise-source-c ))) + +;;; ./gengen/gr_noise_source_f.h FIXME: needs gr_noise_type_t +;; gr_make_noise_source_f (gr_noise_type_t type, float ampl, long seed = 3021); +;; (pass-if (true? (gr:noise-source-f ))) + +;;; ./gengen/gr_noise_source_i.h FIXME: needs gr_noise_type_t +;; gr_make_noise_source_i (gr_noise_type_t type, float ampl, long seed = 3021); +;; (pass-if (true? (gr:noise-source-i ))) + +;;; ./gengen/gr_noise_source_s.h FIXME: needs gr_noise_type_t +;; gr_make_noise_source_s (gr_noise_type_t type, float ampl, long seed = 3021); +;; (pass-if (true? (gr:noise-source-s ))) + ;;; ./gengen/gr_not_bb.h +(pass-if (true? (gr:not-bb))) + ;;; ./gengen/gr_not_ii.h +(pass-if (true? (gr:not-ii))) + ;;; ./gengen/gr_not_ss.h +(pass-if (true? (gr:not-ss))) + ;;; ./gengen/gr_or_bb.h +(pass-if (true? (gr:or-bb))) + ;;; ./gengen/gr_or_ii.h +(pass-if (true? (gr:or-ii))) + ;;; ./gengen/gr_or_ss.h -;;; ./gengen/gr_packed_to_unpacked_bb.h -;;; ./gengen/gr_packed_to_unpacked_ii.h -;;; ./gengen/gr_packed_to_unpacked_ss.h +(pass-if (true? (gr:or-ss))) + +;;; ./gengen/gr_packed_to_unpacked_bb.h FIXME: needs gr_endianness_t +;; gr_make_packed_to_unpacked_bb (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:packed-to-unpacked-bb ))) + +;;; ./gengen/gr_packed_to_unpacked_ii.h FIXME: needs gr_endianness_t +;; gr_make_packed_to_unpacked_ii (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:packed-to-unpacked-ii ))) + +;;; ./gengen/gr_packed_to_unpacked_ss.h FIXME: needs gr_endianness_t +;; gr_make_packed_to_unpacked_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:packed-to-unpacked-ss ))) + ;;; ./gengen/gr_peak_detector_fb.h +(pass-if (true? (gr:peak-detector-fb 0.25 0.40 10 0.001))) + ;;; ./gengen/gr_peak_detector_ib.h +(pass-if (true? (gr:peak-detector-ib 0.25 0.40 10 0.001))) + ;;; ./gengen/gr_peak_detector_sb.h +(pass-if (true? (gr:peak-detector-sb 0.25 0.40 10 0.001))) + ;;; ./gengen/gr_sample_and_hold_bb.h +(pass-if (true? (gr:sample-and-hold-bb))) + ;;; ./gengen/gr_sample_and_hold_ff.h +(pass-if (true? (gr:sample-and-hold-ff))) + ;;; ./gengen/gr_sample_and_hold_ii.h +(pass-if (true? (gr:sample-and-hold-ii))) + ;;; ./gengen/gr_sample_and_hold_ss.h -;;; ./gengen/gr_sig_source_c.h -;;; ./gengen/gr_sig_source_f.h -;;; ./gengen/gr_sig_source_i.h -;;; ./gengen/gr_sig_source_s.h +(pass-if (true? (gr:sample-and-hold-ss))) + +;;; ./gengen/gr_sig_source_c.h FIXME: needs gr_waveform_t +;; gr_make_sig_source_c (double sampling_freq, gr_waveform_t waveform, +;; double wave_freq, double ampl, gr_complex offset = 0); +;; (pass-if (true? (gr:sig-source-c ))) + +;;; ./gengen/gr_sig_source_f.h FIXME: needs gr_waveform_t +;; gr_make_sig_source_f (double sampling_freq, gr_waveform_t waveform, +;; double wave_freq, double ampl, float offset = 0); +;; (pass-if (true? (gr:sig-source-f ))) + +;;; ./gengen/gr_sig_source_i.h FIXME: needs gr_waveform_t +;; gr_make_sig_source_i (double sampling_freq, gr_waveform_t waveform, +;; double wave_freq, double ampl, int offset = 0); +;; (pass-if (true? (gr:sig-source-i ))) + +;;; ./gengen/gr_sig_source_s.h FIXME: needs gr_waveform_t +;; gr_make_sig_source_s (double sampling_freq, gr_waveform_t waveform, +;; double wave_freq, double ampl, short offset = 0); +;; (pass-if (true? (gr:sig-source-s ))) + ;;; ./gengen/gr_sub_cc.h +(pass-if (true? (gr:sub-cc 1))) + ;;; ./gengen/gr_sub_ff.h +(pass-if (true? (gr:sub-ff 1))) + ;;; ./gengen/gr_sub_ii.h +(pass-if (true? (gr:sub-ii 1))) + ;;; ./gengen/gr_sub_ss.h -;;; ./gengen/gr_unpacked_to_packed_bb.h -;;; ./gengen/gr_unpacked_to_packed_ii.h -;;; ./gengen/gr_unpacked_to_packed_ss.h +(pass-if (true? (gr:sub-ss 1))) + +;;; ./gengen/gr_unpacked_to_packed_bb.h FIXME: needs gr_endianness_t +;; gr_make_unpacked_to_packed_bb (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:unpacked-to-packed-bb ))) + +;;; ./gengen/gr_unpacked_to_packed_ii.h FIXME: needs gr_endianness_t +;; gr_make_unpacked_to_packed_ii (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:unpacked-to-packed-ii ))) + +;;; ./gengen/gr_unpacked_to_packed_ss.h FIXME: needs gr_endianness_t +;; gr_make_unpacked_to_packed_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); +;; (pass-if (true? (gr:unpacked-to-packed-ss ))) + ;;; ./gengen/gr_vector_sink_b.h +(pass-if (true? (gr:vector-sink-b 1))) + ;;; ./gengen/gr_vector_sink_c.h +(pass-if (true? (gr:vector-sink-c 1))) + ;;; ./gengen/gr_vector_sink_f.h +(pass-if (true? (gr:vector-sink-f 1))) + ;;; ./gengen/gr_vector_sink_i.h +(pass-if (true? (gr:vector-sink-i 1))) + ;;; ./gengen/gr_vector_sink_s.h -;;; ./gengen/gr_vector_source_b.h -;;; ./gengen/gr_vector_source_c.h -;;; ./gengen/gr_vector_source_f.h -;;; ./gengen/gr_vector_source_i.h -;;; ./gengen/gr_vector_source_s.h +(pass-if (true? (gr:vector-sink-s 1))) + +;;; ./gengen/gr_vector_source_b.h FIXME: needs vector, may throw +;; gr_make_vector_source_b (const std::vector &data, bool repeat = false, int vlen = 1) +;; (pass-if (true? (gr:vector-source-b ))) + +;;; ./gengen/gr_vector_source_c.h FIXME: needs vector, may throw +;; gr_make_vector_source_c (const std::vector &data, bool repeat = false, int vlen = 1) +;; (pass-if (true? (gr:vector-source-c ))) + +;;; ./gengen/gr_vector_source_f.h FIXME: needs vector, may throw +;; gr_make_vector_source_f (const std::vector &data, bool repeat = false, int vlen = 1) +;; (pass-if (true? (gr:vector-source-f ))) + +;;; ./gengen/gr_vector_source_i.h FIXME: needs vector, may throw +;; gr_make_vector_source_i (const std::vector &data, bool repeat = false, int vlen = 1) +;; (pass-if (true? (gr:vector-source-i ))) + +;;; ./gengen/gr_vector_source_s.h FIXME: needs vector, may throw +;; (pass-if (true? (gr:vector-source-s ))) + ;;; ./gengen/gr_xor_bb.h +(pass-if (true? (gr:xor-bb))) + ;;; ./gengen/gr_xor_ii.h +(pass-if (true? (gr:xor-ii))) + ;;; ./gengen/gr_xor_ss.h +(pass-if (true? (gr:xor-ss))) -- cgit From 2567c81d0236437034b0ab02de8e5cc657064249 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 10:14:14 -0700 Subject: fix most of the tests to work. --- gnuradio-core/src/guile/tests/gengen_ctors.test | 173 ++++++++++-------------- 1 file changed, 73 insertions(+), 100 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index 5bdd207f9..f05feceb6 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -50,29 +50,27 @@ ;;; ./gengen/gr_add_const_ss.h (pass-if (true? (gr:add-const-ss 0))) -;;; ./gengen/gr_add_const_vcc.h FIXME: needs complex +;;; ./gengen/gr_add_const_vcc.h FIXME: Wrong type argument in position ~A: ;; gr_make_add_const_vcc (const std::vector &k); -;; (pass-if (true? (gr:add-const-vcc 0))) +;; (pass-if (true? (gr:add-const-vcc #(1+3i 23+5i)))) -;;; ./gengen/gr_add_const_vff.h FIXME: needs vector -;; gr_make_add_const_vff (const std::vector &k); -;; (pass-if (true? (gr:add-const-vff ))) +;;; ./gengen/gr_add_const_vff.h +(pass-if (true? (gr:add-const-vff #(1.0 2.0)))) -;;; ./gengen/gr_add_const_vii.h FIXME: needs vector -;; gr_make_add_const_vii (const std::vector &k); -;; (pass-if (true? (gr:add-const-vii ))) +;;; ./gengen/gr_add_const_vii.h +(pass-if (true? (gr:add-const-vii #(1 2)))) -;;; ./gengen/gr_add_const_vss.h FIXME: needs vector -;; (pass-if (true? (gr:add-const-vss ))) +;;; ./gengen/gr_add_const_vss.h +(pass-if (true? (gr:add-const-vss #(1 2)))) ;;; ./gengen/gr_add_ff.h -;; (pass-if (true? (gr:add-ff 0))) FIXME: throws gr_io_signature(3) +(pass-if (true? (gr:add-ff 1))) ;;; ./gengen/gr_add_ii.h -;; (pass-if (true? (gr:add-ii 0))) FIXME: throws gr_io_signature(3) +(pass-if (true? (gr:add-ii 1))) ;;; ./gengen/gr_add_ss.h -;; (pass-if (true? (gr:add-ss 0 ))) FIXME: throws gr_io_signature(3) +(pass-if (true? (gr:add-ss 1))) ;;; ./gengen/gr_and_bb.h (pass-if (true? (gr:and-bb))) @@ -101,27 +99,25 @@ ;;; ./gengen/gr_argmax_ss.h (pass-if (true? (gr:argmax-ss 1))) -;;; ./gengen/gr_chunks_to_symbols_bc.h FIXME: needs vector -;; gr_make_chunks_to_symbols_bc (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks-to-symbols-bc ))) +;;; ./gengen/gr_chunks_to_symbols_bc.h FIXME: not found +;; (pass-if (true? (gr:chunks-to-symbols-bc #(1+3i 23+5i) 1))) -;;; ./gengen/gr_chunks_to_symbols_bf.h FIXME: needs vector -;; gr_make_chunks_to_symbols_bf (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks-to-symbols-bf ))) +;;; ./gengen/gr_chunks_to_symbols_bf.h +(pass-if (true? (gr:chunks-to-symbols-bf #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_ic.h FIXME: needs vector +;;; ./gengen/gr_chunks_to_symbols_ic.h FIXME: not found ;; gr_make_chunks_to_symbols_ic (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks-to-symbols-ic ))) +;; (pass-if (true? (gr:chunks-to-symbols-ic #(1+3i 23+5i) 1))) -;;; ./gengen/gr_chunks_to_symbols_if.h FIXME: needs vector +;;; ./gengen/gr_chunks_to_symbols_if.h FIXME: not found ;; gr_make_chunks_to_symbols_if (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks_to_symbols_if ))) +;; (pass-if (true? (gr:chunks_to_symbols_if #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_sc.h FIXME: needs vector -;; (pass-if (true? (gr:chunks_to_symbols_sc ))) +;;; ./gengen/gr_chunks_to_symbols_sc.h FIXME: not found +;; (pass-if (true? (gr:chunks_to_symbols_sc #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_sf.h FIXME: needs vector -;; (pass-if (true? (gr:chunks_to_symbols_sf ))) +;;; ./gengen/gr_chunks_to_symbols_sf.h FIXME: not found +;; (pass-if (true? (gr:chunks_to_symbols_sf #(1.0 2.0) 1))) ;;; ./gengen/gr_divide_cc.h (pass-if (true? (gr:divide-cc 1))) @@ -156,9 +152,8 @@ ;;; ./gengen/gr_max_ss.h (pass-if (true? (gr:max-ss 1))) -;;; ./gengen/gr_moving_average_cc.h FIXME: needs gr_complex -;; gr_make_moving_average_cc (int length, gr_complex scale, int max_iter=4096); -;; (pass-if (true? (gr:moving-average-cc ))) +;;; ./gengen/gr_moving_average_cc.h +(pass-if (true? (gr:moving-average-cc 1 1+3i 4096))) ;;; ./gengen/gr_moving_average_ff.h (pass-if (true? (gr:moving-average-ff 1 0 4096))) @@ -184,21 +179,18 @@ ;;; ./gengen/gr_multiply_const_ss.h (pass-if (true? (gr:multiply-const-ss 1))) -;;; ./gengen/gr_multiply_const_vcc.h FIXME: needs vector +;;; ./gengen/gr_multiply_const_vcc.h FIXME: wrong type argument in position ~A: ;; gr_make_multiply_const_vcc (const std::vector &k); -;; (pass-if (true? (gr:multiply-const-vcc 1))) +;; (pass-if (true? (gr:multiply-const-vcc #(1+3i 23+5i)))) -;;; ./gengen/gr_multiply_const_vff.h FIXME: needs vector -;; gr_make_multiply_const_vff (const std::vector &k); -;; (pass-if (true? (gr:multiply-const-vff ))) +;;; ./gengen/gr_multiply_const_vff.h +(pass-if (true? (gr:multiply-const-vff #(1.0 2.0)))) -;;; ./gengen/gr_multiply_const_vii.h FIXME: needs vector -;; gr_make_multiply_const_vii (const std::vector &k); -;; (pass-if (true? (gr:multiply-const-vii ))) +;;; ./gengen/gr_multiply_const_vii.h +(pass-if (true? (gr:multiply-const-vii #(1 2)))) -;;; ./gengen/gr_multiply_const_vss.h FIXME: needs vector -;; gr_make_multiply_const_vss (const std::vector &k); -;; (pass-if (true? (gr:multiply-const-vss ))) +;;; ./gengen/gr_multiply_const_vss.h +(pass-if (true? (gr:multiply-const-vss #(1 2)))) ;;; ./gengen/gr_multiply_ff.h (pass-if (true? (gr:multiply-ff 1))) @@ -221,21 +213,17 @@ ;;; ./gengen/gr_mute_ss.h FIXME: not found ;; (pass-if (true? (gr:mute-ss false))) -;;; ./gengen/gr_noise_source_c.h FIXME: needs gr_noise_type_t -;; gr_make_noise_source_c (gr_noise_type_t type, float ampl, long seed = 3021); -;; (pass-if (true? (gr:noise-source-c ))) +;;; ./gengen/gr_noise_source_c.h +(pass-if (true? (gr:noise-source-c 1 0 3021))) -;;; ./gengen/gr_noise_source_f.h FIXME: needs gr_noise_type_t -;; gr_make_noise_source_f (gr_noise_type_t type, float ampl, long seed = 3021); -;; (pass-if (true? (gr:noise-source-f ))) +;;; ./gengen/gr_noise_source_f.h +(pass-if (true? (gr:noise-source-f 1 0 3021))) -;;; ./gengen/gr_noise_source_i.h FIXME: needs gr_noise_type_t -;; gr_make_noise_source_i (gr_noise_type_t type, float ampl, long seed = 3021); -;; (pass-if (true? (gr:noise-source-i ))) +;;; ./gengen/gr_noise_source_i.h +(pass-if (true? (gr:noise-source-i 1 0 3021))) -;;; ./gengen/gr_noise_source_s.h FIXME: needs gr_noise_type_t -;; gr_make_noise_source_s (gr_noise_type_t type, float ampl, long seed = 3021); -;; (pass-if (true? (gr:noise-source-s ))) +;;; ./gengen/gr_noise_source_s.h +(pass-if (true? (gr:noise-source-s 1 0 3021))) ;;; ./gengen/gr_not_bb.h (pass-if (true? (gr:not-bb))) @@ -255,26 +243,23 @@ ;;; ./gengen/gr_or_ss.h (pass-if (true? (gr:or-ss))) -;;; ./gengen/gr_packed_to_unpacked_bb.h FIXME: needs gr_endianness_t -;; gr_make_packed_to_unpacked_bb (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:packed-to-unpacked-bb ))) +;;; ./gengen/gr_packed_to_unpacked_bb.h +(pass-if (true? (gr:packed-to-unpacked-bb 1 1))) -;;; ./gengen/gr_packed_to_unpacked_ii.h FIXME: needs gr_endianness_t -;; gr_make_packed_to_unpacked_ii (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:packed-to-unpacked-ii ))) +;;; ./gengen/gr_packed_to_unpacked_ii.h +(pass-if (true? (gr:packed-to-unpacked-ii 1 1))) -;;; ./gengen/gr_packed_to_unpacked_ss.h FIXME: needs gr_endianness_t -;; gr_make_packed_to_unpacked_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:packed-to-unpacked-ss ))) +;;; ./gengen/gr_packed_to_unpacked_ss.h +(pass-if (true? (gr:packed-to-unpacked-ss 1 1))) ;;; ./gengen/gr_peak_detector_fb.h (pass-if (true? (gr:peak-detector-fb 0.25 0.40 10 0.001))) ;;; ./gengen/gr_peak_detector_ib.h -(pass-if (true? (gr:peak-detector-ib 0.25 0.40 10 0.001))) +(pass-if (true? (gr:peak-detector-ib 0.25 0.40 10 0.001))) ;;; ./gengen/gr_peak_detector_sb.h -(pass-if (true? (gr:peak-detector-sb 0.25 0.40 10 0.001))) +(pass-if (true? (gr:peak-detector-sb 0.25 0.40 10 0.001))) ;;; ./gengen/gr_sample_and_hold_bb.h (pass-if (true? (gr:sample-and-hold-bb))) @@ -288,25 +273,17 @@ ;;; ./gengen/gr_sample_and_hold_ss.h (pass-if (true? (gr:sample-and-hold-ss))) -;;; ./gengen/gr_sig_source_c.h FIXME: needs gr_waveform_t -;; gr_make_sig_source_c (double sampling_freq, gr_waveform_t waveform, -;; double wave_freq, double ampl, gr_complex offset = 0); -;; (pass-if (true? (gr:sig-source-c ))) +;;; ./gengen/gr_sig_source_c.h +(pass-if (true? (gr:sig-source-c 0 0 0 0 0))) -;;; ./gengen/gr_sig_source_f.h FIXME: needs gr_waveform_t -;; gr_make_sig_source_f (double sampling_freq, gr_waveform_t waveform, -;; double wave_freq, double ampl, float offset = 0); -;; (pass-if (true? (gr:sig-source-f ))) +;;; ./gengen/gr_sig_source_f.h +(pass-if (true? (gr:sig-source-f 0 0 0 0 0))) -;;; ./gengen/gr_sig_source_i.h FIXME: needs gr_waveform_t -;; gr_make_sig_source_i (double sampling_freq, gr_waveform_t waveform, -;; double wave_freq, double ampl, int offset = 0); -;; (pass-if (true? (gr:sig-source-i ))) +;;; ./gengen/gr_sig_source_i.h +(pass-if (true? (gr:sig-source-i 0 0 0 0 0))) -;;; ./gengen/gr_sig_source_s.h FIXME: needs gr_waveform_t -;; gr_make_sig_source_s (double sampling_freq, gr_waveform_t waveform, -;; double wave_freq, double ampl, short offset = 0); -;; (pass-if (true? (gr:sig-source-s ))) +;;; ./gengen/gr_sig_source_s.h +(pass-if (true? (gr:sig-source-s 0 0 0 0 0))) ;;; ./gengen/gr_sub_cc.h (pass-if (true? (gr:sub-cc 1))) @@ -320,17 +297,14 @@ ;;; ./gengen/gr_sub_ss.h (pass-if (true? (gr:sub-ss 1))) -;;; ./gengen/gr_unpacked_to_packed_bb.h FIXME: needs gr_endianness_t -;; gr_make_unpacked_to_packed_bb (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:unpacked-to-packed-bb ))) +;;; ./gengen/gr_unpacked_to_packed_bb.h +(pass-if (true? (gr:unpacked-to-packed-bb 1 1))) -;;; ./gengen/gr_unpacked_to_packed_ii.h FIXME: needs gr_endianness_t -;; gr_make_unpacked_to_packed_ii (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:unpacked-to-packed-ii ))) +;;; ./gengen/gr_unpacked_to_packed_ii.h +(pass-if (true? (gr:unpacked-to-packed-ii 1 1))) -;;; ./gengen/gr_unpacked_to_packed_ss.h FIXME: needs gr_endianness_t -;; gr_make_unpacked_to_packed_ss (unsigned int bits_per_chunk, gr_endianness_t endianness); -;; (pass-if (true? (gr:unpacked-to-packed-ss ))) +;;; ./gengen/gr_unpacked_to_packed_ss.h +(pass-if (true? (gr:unpacked-to-packed-ss 1 1))) ;;; ./gengen/gr_vector_sink_b.h (pass-if (true? (gr:vector-sink-b 1))) @@ -347,24 +321,23 @@ ;;; ./gengen/gr_vector_sink_s.h (pass-if (true? (gr:vector-sink-s 1))) -;;; ./gengen/gr_vector_source_b.h FIXME: needs vector, may throw -;; gr_make_vector_source_b (const std::vector &data, bool repeat = false, int vlen = 1) -;; (pass-if (true? (gr:vector-source-b ))) +;;; ./gengen/gr_vector_source_b.h FIXME: not found +;; (pass-if (true? (gr:vector-source-b #(1 2) false 1))) -;;; ./gengen/gr_vector_source_c.h FIXME: needs vector, may throw +;;; ./gengen/gr_vector_source_c.h FIXME: not found ;; gr_make_vector_source_c (const std::vector &data, bool repeat = false, int vlen = 1) -;; (pass-if (true? (gr:vector-source-c ))) +;; (pass-if (true? (gr:vector-source-c #(1+3i 23+5i) false 1))) -;;; ./gengen/gr_vector_source_f.h FIXME: needs vector, may throw +;;; ./gengen/gr_vector_source_f.h FIXME: not found ;; gr_make_vector_source_f (const std::vector &data, bool repeat = false, int vlen = 1) -;; (pass-if (true? (gr:vector-source-f ))) +;; (pass-if (true? (gr:vector-source-f #(1.0 2.0) false 1))) -;;; ./gengen/gr_vector_source_i.h FIXME: needs vector, may throw +;;; ./gengen/gr_vector_source_i.h FIXME: not found ;; gr_make_vector_source_i (const std::vector &data, bool repeat = false, int vlen = 1) -;; (pass-if (true? (gr:vector-source-i ))) +;; (pass-if (true? (gr:vector-source-i #(1 2) false 1))) -;;; ./gengen/gr_vector_source_s.h FIXME: needs vector, may throw -;; (pass-if (true? (gr:vector-source-s ))) +;;; ./gengen/gr_vector_source_s.h FIXME: not found +;; (pass-if (true? (gr:vector-source-s #(1 2) false 1))) ;;; ./gengen/gr_xor_bb.h (pass-if (true? (gr:xor-bb))) -- cgit From 8c2c60e6777a41a202a6e387384b1b536eb33c8b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 10:35:05 -0700 Subject: fix one test --- gnuradio-core/src/guile/tests/gengen_ctors.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index f05feceb6..10eb1d9e0 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -33,7 +33,7 @@ ;;; ;;; ./gengen/gr_add_cc.h -;; (pass-if (true? (gr:add-cc 0))) FIXME: throws gr_io_signature(3) +(pass-if (true? (gr:add-cc 1))) ;;; ./gengen/gr_add_const_cc.h (pass-if (true? (gr:add-const-cc 0))) -- cgit From 649cf353deb00fcfce7da7e748dee77c3444e0e3 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 10:40:50 -0700 Subject: stub out the rest of the not found tests --- gnuradio-core/src/guile/tests/io_ctors.test | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 6516ef7fe..80fb2d3f2 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -41,39 +41,38 @@ ;;; ./io/gr_file_sink.h (pass-if (true? (gr:file-sink 1 "foo"))) -;;; ./io/gr_file_source.h -;; (pass-if (true? (gr:file-source 1 "foo" false))) FIXME: not found +;;; ./io/gr_file_source.h FIXME: not found +;; (pass-if (true? (gr:file-source 1 "foo" false))) -;;; ./io/gr_histo_sink_f.h FIXME: needs gr_msg_queue_sptr +;;; ./io/gr_histo_sink_f.h FIXME: not found ;; gr_make_histo_sink_f (gr_msg_queue_sptr msgq); -;; (pass-if (true? (gr:histo-sink-f ))) +;; (pass-if (true? (gr:histo-sink-f 1))) -;;; ./io/gr_message_sink.h -;; (pass-if (true? (gr:message-sink ))) +;;; ./io/gr_message_sink.h FIXME: not found +;; (pass-if (true? (gr:message-sink 1 1 false))) ;;; ./io/gr_message_source.h ;; (pass-if (true? (gr:message-source ))) -;;; ./io/gr_oscope_sink_f.h FIXME: needs gr_io_signature_sptr +;;; ./io/gr_oscope_sink_f.h FIXME: not found ;; _oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, ;; double sample_rate); -;; (pass-if (true? (gr:oscope-sink-f ))) +;; (pass-if (true? (gr:oscope-sink-f "foo" 1 1))) -;;; ./io/gr_oscope_sink_x.h - -;; gr_oscope_sink_x (const std::string name, -;; gr_io_signature_sptr input_sig, +;;; ./io/gr_oscope_sink_x.h FIXME: not found +;; gr_oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, ;; double sampling_rate); -;; (pass-if (true? (gr:oscope_sink_x ))) +;; (pass-if (true? (gr:oscope_sink_x "foo" 1 1))) -;;; ./io/gr_udp_sink.h +;;; ./io/gr_udp_sink.h FIXME: not found +;; (pass-if (true? (gr:udp-sink 1 "foo" 1472 true))) -;;; ./io/gr_udp_source.h -;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 true true))) FIXME: not found +;;; ./io/gr_udp_source.h FIXME: not found +;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 true true))) -;;; ./io/gr_wavfile_sink.h -;; (pass-if (true? (gr:message-source "foo" 1 1 1))) FIXME: not found +;;; ./io/gr_wavfile_sink.h FIXME: not found +;; (pass-if (true? (gr:message-source "foo" 1 1 1))) -;;; ./io/gr_wavfile_source.h -;; (pass-if (true? (gr:message-source "foo" false))) FIXME: not found +;;; ./io/gr_wavfile_source.h FIXME: not found +;; (pass-if (true? (gr:message-source "foo" false))) -- cgit From a740d3fbda03e2b718bd10ea78c0eeb1ce178586 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 11:29:36 -0700 Subject: fix bogus throws and vectors --- gnuradio-core/src/guile/tests/general_ctors.test | 184 +++++++++++------------ 1 file changed, 87 insertions(+), 97 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 0580d6382..6153ce795 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -54,12 +54,12 @@ ;;; ./general/gr_agc_ff.h (pass-if (true? (gr:agc-ff 0 0 0 0))) -;;; ./general/gr_align_on_samplenumbers_ss.h +;;; ./general/gr_align_on_samplenumbers_ss.h FIXME: throws (pass-if (true? (gr:align-on-samplenumbers-ss 2 128))) -(pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0))) +;; (pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0))) -;;; ./general/gr_bin_statistics_f.h -;; (pass-if (true? (gr:bin-statistics-f 0 0 0 0 0))) FIXME: not found +;;; ./general/gr_bin_statistics_f.h FIXME: not found +;; (pass-if (true? (gr:bin-statistics-f 0 0 0 0 0))) ;;; ./general/gr_binary_slicer_fb.h (pass-if (true? (gr:binary-slicer-fb))) @@ -70,11 +70,11 @@ ;;; ./general/gr_char_to_float.h (pass-if (true? (gr:char-to-float))) -;;; ./general/gr_check_counting_s.h -;; (pass-if (true? (gr:check-counting-s false))) FIXME: not found +;;; ./general/gr_check_counting_s.h FIXME: not found +;; (pass-if (true? (gr:check-counting-s false))) -;;; ./general/gr_check_lfsr_32k_s.h -;; (pass-if (true? (gr:check-lfsr-2k-s))) FIXME: not found +;;; ./general/gr_check_lfsr_32k_s.h FIXME: not found +;; (pass-if (true? (gr:check-lfsr-2k-s))) ;;; ./general/gr_clock_recovery_mm_cc.h (pass-if (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) @@ -82,29 +82,29 @@ ;;; ./general/gr_clock_recovery_mm_ff.h (pass-if (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) -;; (pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 0 0 0 0 0))) ;; FIXME: segfault +(pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) ;;; ./general/gr_complex_to_interleaved_short.h (pass-if (true? (gr:complex-to-interleaved-short))) -;;; ./general/gr_complex_to_xxx.h FIXME: all throw -;; (pass-if (true? (gr:complex-to-float 0))) -;; (pass-if (true? (gr:complex-to-real 0))) -;; (pass-if (true? (gr:complex-to-imag 0))) -;; (pass-if (true? (gr:complex-to-mag 0))) -;; (pass-if (true? (gr:complex-to-mag-squared 0))) -;; (pass-if (true? (gr:complex-to-arg 0))) +;;; ./general/gr_complex_to_xxx.h +(pass-if (true? (gr:complex-to-float 1))) +(pass-if (true? (gr:complex-to-real 1))) +(pass-if (true? (gr:complex-to-imag 1))) +(pass-if (true? (gr:complex-to-mag 1))) +(pass-if (true? (gr:complex-to-mag-squared 1))) +(pass-if (true? (gr:complex-to-arg 1))) ;;; ./general/gr_conjugate_cc.h (pass-if (true? (gr:conjugate-cc))) -;;; ./general/gr_constellation_decoder_cb.h +;;; ./general/gr_constellation_decoder_cb.h FIXME: not found ;gr_constellation_decoder_cb (const std::vector &sym_position, ; const std::vector &sym_value_out); -;; (pass-if (true? (gr:constellation_decoder_cb ))) +;; (pass-if (true? (gr:constellation_decoder_cb #(1+3i 23+5i) #(1 2)))) ;;; ./general/gr_copy.h -;; (pass-if (true? (gr:copy 0))) FIXME: throws +(pass-if (true? (gr:copy 1))) ;;; ./general/gr_correlate_access_code_bb.h (pass-if (true? (gr:correlate-access-code-bb "foo" 0))) @@ -115,19 +115,19 @@ (pass-if-throw "confirm throw gr:costas-loop-cc" #t (true? (gr:costas-loop-cc 0 0 0 0 3))) ;;; ./general/gr_cpfsk_bc.h -;; (pass-if (true? (gr:cpfsk-bc 0 0 0))) FIXME: throws +(pass-if (true? (gr:cpfsk-bc 1 1 1))) -;;; ./general/gr_ctcss_squelch_ff.h -;; (pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 true))) FIXME: not found +;;; ./general/gr_ctcss_squelch_ff.h FIXME: not found +;; (pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 true))) ;;; ./general/gr_decode_ccsds_27_fb.h (pass-if (true? (gr:decode-ccsds-27-fb))) ;;; ./general/gr_deinterleave.h -;; (pass-if (true? (gr:deinterleave 0))) FIXME: throws +(pass-if (true? (gr:deinterleave 1))) ;;; ./general/gr_delay.h -;; (pass-if (true? (gr:delay 0 0))) FIXME: throws +(pass-if (true? (gr:delay 1 1))) ;;; ./general/gr_descrambler_bb.h (pass-if (true? (gr:descrambler-bb 0 0 0))) @@ -147,24 +147,22 @@ ;;; ./general/gr_encode_ccsds_27_bb.h (pass-if (true? (gr:encode-ccsds-27-bb))) -;;; ./general/gr_fake_channel_coder_pp.h -;; (pass-if (true? (gr:fake-channel-coder-pp 1 1))) FIXME: not found +;;; ./general/gr_fake_channel_coder_pp.h FIXME: not found +;; (pass-if (true? (gr:fake-channel-coder-pp 1 1))) ;; (pass-if-throw "confirm throw" #t (true? (gr:fake-channel-coder-pp -1 1))) ;;; ./general/gr_feedforward_agc_cc.h -;; (pass-if (true? (gr:feedforward-agc-cc 0 0))) FIXME: throws +(pass-if (true? (gr:feedforward-agc-cc 1 1))) -;;; ./general/gr_fft_vcc.h -;; gr_fft_vcc (int fft_size, bool forward, const std::vector &window, bool shift); -;; (pass-if (true? (gr:fft-vcc ))) +;;; ./general/gr_fft_vcc.h FIXME: not found +;; (pass-if (true? (gr:fft-vcc 1 false #(1.0 2.0) true))) -;;; ./general/gr_fft_vcc_fftw.h -;; gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector &window, bool shift); -;; (pass-if (true? (gr:fft-vcc-fftw ))) +;;; ./general/gr_fft_vcc_fftw.h FIXME: not found +;; (pass-if (true? (gr:fft-vcc-fftw 1 #(1.0 2.0) false))) -;;; ./general/gr_fft_vfc.h +;;; ./general/gr_fft_vfc.h FIXME: not found ;; bool set_window(const std::vector &window); -;; (pass-if (true? (gr:fft_vfc ))) +;; (pass-if (true? (gr:fft_vfc #(1.0 2.0)))) ;;; ./general/gr_fll_band_edge_cc.h (pass-if (true? (gr:fll-band-edge-cc 0 0 0 0 0))) @@ -173,7 +171,7 @@ (pass-if (true? (gr:float-to-char))) ;; ;;; ./general/gr_float_to_complex.h -;; (pass-if (true? (gr:float-to-complex 0))) FIXME: throws +(pass-if (true? (gr:float-to-complex 1))) ;;; ./general/gr_float_to_short.h (pass-if (true? (gr:float-to-short))) @@ -184,114 +182,110 @@ ;;; ./general/gr_fmdet_cf.h (pass-if (true? (gr:fmdet-cf 0 0 0 0))) -;;; ./general/gr_framer_sink_1.h -;; (pass-if (true? (gr:framer-sink-1))) FIXME: not found +;;; ./general/gr_framer_sink_1.h FIXME: not found +;; (pass-if (true? (gr:framer-sink-1))) ;;; ./general/gr_frequency_modulator_fc.h (pass-if (true? (gr:frequency-modulator-fc 0))) -;;; ./general/gr_glfsr_source_b.h -;; (pass-if (true? (gr: glfsr-source-b 0 true 0 0))) FIXME: not found +;;; ./general/gr_glfsr_source_b.h FIXME: not found +;; (pass-if (true? (gr: glfsr-source-b 0 true 0 0))) ;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_b 33 true 0 0))) -;;; ./general/gr_glfsr_source_f.h -;; (pass-if (true? (gr:glfsr-source-f 0 true 0 0))) FIXME: not found +;;; ./general/gr_glfsr_source_f.h FIXME: not found +;; (pass-if (true? (gr:glfsr-source-f 1 true 1 1))) ;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_f 33 true 0 0))) ;;; ./general/gr_head.h -;; (pass-if (true? (gr:head 0 0))) FIXME: throws +(pass-if (true? (gr:head 1 1))) ;;; ./general/gr_interleave.h -;; (pass-if (true? (gr:interleave 0))) FIXME: throws +(pass-if (true? (gr:interleave 1))) ;;; ./general/gr_interleaved_short_to_complex.h (pass-if (true? (gr:interleaved-short-to-complex))) -;;; ./general/gr_iqcomp_cc.h -;; (pass-if (true? (gr:iqcomp-cc 0 0))) FIXME: not found +;;; ./general/gr_iqcomp_cc.h FIXME: not found +;; (pass-if (true? (gr:iqcomp-cc 1 1))) ;;; ./general/gr_keep_one_in_n.h -;; (pass-if (true? (gr:keep-one-in-n 0 0))) FIXME: throws +(pass-if (true? (gr:keep-one-in-n 1 1))) ;;; ./general/gr_kludge_copy.h -;; (pass-if (true? (gr:kludge-copy 0))) FIXME: throws +(pass-if (true? (gr:kludge-copy 1))) ;;; ./general/gr_lfsr_32k_source_s.h (pass-if (true? (gr:lfsr-32k-source-s))) ;;; ./general/gr_lms_dfe_cc.h -;; (pass-if (true? (gr:lms-dfe-ff 0 0 0 0))) FIXME: hangs +(pass-if (true? (gr:lms-dfe-ff 1 1 1 1))) ;;; ./general/gr_lms_dfe_ff.h -;; (pass-if (true? (gr:lms-dfe-ff 0 0 0 0))) FIXME: hangs +(pass-if (true? (gr:lms-dfe-ff 1 1 1 1))) ;;; ./general/gr_map_bb.h ;; gr_map_bb (const std::vector &map); -;; (pass-if (true? (gr:map-bb xx))) +(pass-if (true? (gr:map-bb #(1 2)))) ;;; ./general/gr_mpsk_receiver_cc.h -;; (pass-if (true? (gr:mpsk-receiver-cc 0 0 0 0 0 0 0 0 0 0 0))) FIXME: throws +(pass-if (true? (gr:mpsk-receiver-cc 1 1 1 1 1 1 1 1 1 1 1))) ;;; ./general/gr_nlog10_ff.h -;; (pass-if (true? (gr:nlog10-ff 0 0 0))) FIXME: throws +(pass-if (true? (gr:nlog10-ff 1 1 1))) ;;; ./general/gr_nop.h -;; (pass-if (true? (gr:nop 0))) FIXME: throws +(pass-if (true? (gr:nop 1))) ;;; ./general/gr_null_sink.h -;; (pass-if (true? (gr:null-sink 0))) FIXME: throws +(pass-if (true? (gr:null-sink 1))) ;;; ./general/gr_null_source.h -;; (pass-if (true? (gr:null-source 0)))v FIXME: throws +(pass-if (true? (gr:null-source 1))) -;;; ./general/gr_ofdm_bpsk_demapper.h -;; (pass-if (true? (gr:ofdm-bpsk-demapper))) FIXME: not found +;;; ./general/gr_ofdm_bpsk_demapper.h FIXME: not found +;; (pass-if (true? (gr:ofdm-bpsk-demapper 1))) ;;; ./general/gr_ofdm_cyclic_prefixer.h -;; (pass-if (true? (gr:ofdm-cyclic-prefixer 0 0))) FIXME: throws +(pass-if (true? (gr:ofdm-cyclic-prefixer 1 1))) -;;; ./general/gr_ofdm_demapper_vcb.h -;; (pass-if (true? (gr:ofdm-mapper-bcv 0 0))) FIXME: throws +;;; ./general/gr_ofdm_demapper_vcb.h FIXME: not found +;; (pass-if (true? (gr:ofdm-mapper-bcv 1 1))) -;;; ./general/gr_ofdm_frame_acquisition.h +;;; ./general/gr_ofdm_frame_acquisition.h FIXME: not found ;; gr_ofdm_frame_acquisition (unsigned int occupied_carriers, ;; unsigned int fft_length, ;; unsigned int cplen, ;; const std::vector &known_symbol, ;; unsigned int max_fft_shift_len); -;; (pass-if (true? (gr:ofdm-frame-acquisition 0 0 0 (0 0) 0))) +;; (pass-if (true? (gr:ofdm-frame-acquisition 0 0 0 #(1+3i 23+5i) 0))) -;;; ./general/gr_ofdm_frame_sink.h +;;; ./general/gr_ofdm_frame_sink.h FIXME: not found ;; gr_ofdm_frame_sink(const std::vector &sym_position, ;; const std::vector &sym_value_out, ;; gr_msg_queue_sptr target_queue, unsigned int occupied_tones, ;; float phase_gain, float freq_gain); -;; (pass-if (true? (gr:ofdm_frame_sink ))) +;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) 1 1 0.25 0))) -;;; ./general/gr_ofdm_insert_preamble.h +;;; ./general/gr_ofdm_insert_preamble.h FIXME: Wrong type argument in position ~A: ;; gr_ofdm_insert_preamble(int fft_length, ;; const std::vector > &preamble); -;; (pass-if (true? (gr:ofdm-insert-preamble ))) +;; (pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i) #(1+3i 23+5i))))) -;;; ./general/gr_ofdm_mapper_bcv.h +;;; ./general/gr_ofdm_mapper_bcv.h FIXME: Wrong type argument in position ~A: ;; gr_ofdm_mapper_bcv (const std::vector &constellation, ;; unsigned int msgq_limit, ;; unsigned int bits_per_symbol, ;; unsigned int fft_length); -;; (pass-if (true? (gr:ofdm-mapper-bcv ))) +;; (pass-if (true? (gr:ofdm-mapper-bcv #(1+3i 23+5i) 1 1 1))) ;;; ./general/gr_ofdm_sampler.h -;; (pass-if (true? (gr:ofdm-sampler 0 0 0))) FIXME: throws +(pass-if (true? (gr:ofdm-sampler 1 1 1))) ;;; ./general/gr_pa_2x2_phase_combiner.h (pass-if (true? (gr:pa-2x2-phase-combiner))) -;;; ./general/gr_packet_sink.h -;; (pass-if (true? gr_make_packet_sink (const std::vector& sync_vector, -;; gr_msg_queue_sptr target_queue, -;; int threshold = -1 // -1 -> use default -;; ); -;; (gr:packet-sink ))) +;;; ./general/gr_packet_sink.h FIXME: not found +;; (pass-if (true? (gr:packet-sink #(1 2) 1 -1))) ;;; ./general/gr_peak_detector2_fb.h (pass-if (true? (gr:peak-detector2-fb 0 0 0))) @@ -309,7 +303,7 @@ (pass-if (true? (gr:pll-refout-cc 0 0 0 0))) ;;; ./general/gr_pn_correlator_cc.h -;; (pass-if (true? (gr:pn-correlator-cc 0 0 0))) FIXME: throws +(pass-if (true? (gr:pn-correlator-cc 1 1 1))) ;;; ./general/gr_probe_avg_mag_sqrd_c.h (pass-if (true? (gr:probe-avg-mag-sqrd-c 0 0))) @@ -345,7 +339,7 @@ (pass-if (true? (gr:regenerate-bb 0 0))) ;;; ./general/gr_repeat.h -;; (pass-if (true? (gr:repeat 0 0))) FIXME: throws +(pass-if (true? (gr:repeat 1 1))) ;;; ./general/gr_rms_cf.h (pass-if (true? (gr:rms-cf 0))) @@ -369,12 +363,10 @@ (pass-if (true? (gr:simple-squelch-cc 0 0))) ;;; ./general/gr_skiphead.h -;; (pass-if (true? (gr:skiphead 0 0))) FIXME: throws +(pass-if (true? (gr:skiphead 1 1))) -;;; ./general/gr_squash_ff.h -;; gr_squash_ff_sptr gr_make_squash_ff(const std::vector &igrid, -;; const std::vector &ogrid); -;; (pass-if (true? (gr:squash_ff ))) +;;; ./general/gr_squash_ff.h FIXME: not found +;; (pass-if (true? (gr:squash_ff #(1.0 2.0) #(1.0 2.0)))) ;;; ./general/gr_squelch_base_cc.h ;; (pass-if (true? (gr:squelch-base-cc "foo" 0 false))) FIXME: not found @@ -383,24 +375,22 @@ ;; (pass-if (true? (gr:squelch-base-ff "foo" 0 false))) FIXME: not found ;;; ./general/gr_stream_mux.h -;; gr_make_stream_mux (size_t itemsize, -;; const std::vector &lengths); -;; (pass-if (true? (gr:stream_mux ))) +(pass-if (true? (gr:stream-mux 1 #(1 2)))) ;;; ./general/gr_stream_to_streams.h -;; (pass-if (true? (gr:stream-to-streams 0 0))) FIXME: throws +(pass-if (true? (gr:stream-to-streams 1 1))) ;;; ./general/gr_stream_to_vector.h -;; (pass-if (true? (gr:stream-to-vector 0 0))) FIXME: throws +(pass-if (true? (gr:stream-to-vector 1 1))) ;;; ./general/gr_streams_to_stream.h -;; (pass-if (true? (gr:streams-to-stream 0 0))) FIXME: throws +(pass-if (true? (gr:streams-to-stream 1 1))) ;;; ./general/gr_streams_to_vector.h -;; (pass-if (true? (gr:streams-to-vector 0 0))) FIXME: throws +(pass-if (true? (gr:streams-to-vector 1 1))) ;;; ./general/gr_stretch_ff.h -;; (pass-if (true? (gr:stretch-ff 0 0))) FIXME: throws +(pass-if (true? (gr:stretch-ff 1 1))) ;;; ./general/gr_test.h (pass-if (true? (gr:test "foo" 1 1 1 1 1 1 1 1))) @@ -409,7 +399,7 @@ (pass-if (true? (gr:threshold-ff 0 0))) ;;; ./general/gr_throttle.h -;; (pass-if (true? (gr:throttle 0 0))) FIXME: throws +(pass-if (true? (gr:throttle 1 1))) ;;; ./general/gr_uchar_to_float.h (pass-if (true? (gr:uchar-to-float))) @@ -418,13 +408,13 @@ (pass-if (true? (gr:vco-f 0 0 0))) ;;; ./general/gr_vector_to_stream.h -;; (pass-if (true? (gr:vector-to-stream 0 0))) FIXME: throws +(pass-if (true? (gr:vector-to-stream 1 1))) ;;; ./general/gr_vector_to_streams.h -;; (pass-if (true? (gr:vector-to-streams 0 0))) FIXME: throws +(pass-if (true? (gr:vector-to-streams 1 1))) -;;; ./general/gr_wavelet_ff.h -;; (pass-if (true? (gr:wavelet-ff 0 0))) FIXME: throws +;;; ./general/gr_wavelet_ff.h FIXME: not found +;; (pass-if (true? (gr:wavelet-ff 1024 20 true))) ;;; ./general/gr_wvps_ff.h -;; (pass-if (true? (gr:wvps_ff 0))) FIXME: throws +(pass-if (true? (gr:wvps-ff 2))) -- cgit From ec44d0c5ad93dcbb145bbd77a4deff99af9d49bc Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 11:29:53 -0700 Subject: add stubs, nothing seems to exist --- gnuradio-core/src/guile/tests/filter_ctors.test | 251 +++++++++++++++++++----- 1 file changed, 200 insertions(+), 51 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test index 9ff251a55..8618890fa 100644 --- a/gnuradio-core/src/guile/tests/filter_ctors.test +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -31,69 +31,218 @@ ;;; Add test code for all constructors in these files ;;; -;;; ./filter/gr_adaptive_fir_ccf.h -;;; ./filter/gr_cma_equalizer_cc.h -;;; ./filter/gr_fft_filter_ccc.h -;;; ./filter/gr_fft_filter_fff.h -;;; ./filter/gr_filter_delay_fc.h -;;; ./filter/gr_fir_ccc_generic.h -;;; ./filter/gr_fir_ccc_simd.h -;;; ./filter/gr_fir_ccc_x86.h -;;; ./filter/gr_fir_ccf_generic.h -;;; ./filter/gr_fir_ccf_simd.h -;;; ./filter/gr_fir_ccf_x86.h -;;; ./filter/gr_fir_fcc_generic.h -;;; ./filter/gr_fir_fcc_simd.h -;;; ./filter/gr_fir_fcc_x86.h -;;; ./filter/gr_fir_fff_altivec.h -;;; ./filter/gr_fir_fff_armv7_a.h -;;; ./filter/gr_fir_fff_generic.h -;;; ./filter/gr_fir_fff_simd.h -;;; ./filter/gr_fir_fff_x86.h -;;; ./filter/gr_fir_filter_ccc.h -;;; ./filter/gr_fir_filter_ccf.h -;;; ./filter/gr_fir_filter_fcc.h -;;; ./filter/gr_fir_filter_fff.h -;;; ./filter/gr_fir_filter_fsf.h -;;; ./filter/gr_fir_filter_scc.h -;;; ./filter/gr_fir_fsf_generic.h -;;; ./filter/gr_fir_fsf_simd.h -;;; ./filter/gr_fir_fsf_x86.h -;;; ./filter/gr_fir_scc_generic.h -;;; ./filter/gr_fir_scc_simd.h -;;; ./filter/gr_fir_scc_x86.h -;;; ./filter/gr_fir_sysconfig_armv7_a.h -;;; ./filter/gr_fir_sysconfig_generic.h -;;; ./filter/gr_fir_sysconfig_powerpc.h -;;; ./filter/gr_fir_sysconfig_x86.h -;;; ./filter/gr_fractional_interpolator_cc.h -;;; ./filter/gr_fractional_interpolator_ff.h -;;; ./filter/gr_freq_xlating_fir_filter_ccc.h -;;; ./filter/gr_freq_xlating_fir_filter_ccf.h -;;; ./filter/gr_freq_xlating_fir_filter_fcc.h -;;; ./filter/gr_freq_xlating_fir_filter_fcf.h -;;; ./filter/gr_freq_xlating_fir_filter_scc.h -;;; ./filter/gr_freq_xlating_fir_filter_scf.h -;;; ./filter/gr_goertzel_fc.h -;;; ./filter/gr_hilbert_fc.h -;;; ./filter/gr_iir_filter_ffd.h -;;; ./filter/gr_interp_fir_filter_ccc.h -;;; ./filter/gr_interp_fir_filter_ccf.h -;;; ./filter/gr_interp_fir_filter_fcc.h -;;; ./filter/gr_interp_fir_filter_fff.h -;;; ./filter/gr_interp_fir_filter_fsf.h + +;;; ./filter/gr_adaptive_fir_ccf.h FIXME: not found +;; gr_adaptive_fir_ccf(char *name, int decimation, const std::vector &taps); +;; (pass-if (true? (gr:adaptive-fir-ccf "foo" 0 #(1.0 2.0 3.0 4.0)))) + +;;; ./filter/gr_cma_equalizer_cc.h FIXME: not found +;; (pass-if (true? (gr:cma-equalizer-cc 0 0 0))) + +;;; ./filter/gr_fft_filter_ccc.h FIXME: not found +;; (pass-if (true? (gr:fft-filter-ccc 0 #(1+3i 23+5i)))) + +;;; ./filter/gr_fft_filter_fff.h FIXME: not found +;; (pass-if (true? (gr:fft-filter-fff 0 #(1.0 2.0)))) + +;;; ./filter/gr_filter_delay_fc.h FIXME: not found +;; (pass-if (true? (gr:filter-delay-fc #(1.0 2.0)))) + +;;; ./filter/gr_fir_ccc_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-ccc-generic))) +;; (pass-if (true? (gr:fir-ccc-generic #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_ccc_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-ccc-simd))) +;; (pass-if (true? (gr:fir-ccc-simd #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_ccc_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-ccc-x86))) +;; (pass-if (true? (gr:fir-ccc-x86 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_ccf_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-ccf-generic))) +;; (pass-if (true? (gr:fir-ccf-generic #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_ccf_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-ccf-simd 0 0 0 0))) + +;;; ./filter/gr_fir_ccf_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-ccf-x86))) +;; (pass-if (true? (gr:fir-ccf-x86 #(1.0 2.0)))) + +;;; ./filter/gr_fir_fcc_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-fcc-generic))) +;; (pass-if (true? (gr:fir-fcc-generic #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_fcc_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-fcc-simd 0 0 0 0))) + +;;; ./filter/gr_fir_fcc_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-fcc-x86))) +;; (pass-if (true? (gr:fir-fcc-x86 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_fff_altivec.h FIXME: not found +;; (pass-if (true? (gr:fir-fff-altivec))) +;; (pass-if (true? (gr:fir-fff-altivec #(1.0 2.0)))) + +;;; ./filter/gr_fir_fff_armv7_a.h FIXME: not found +;; (pass-if (true? (gr:fir-fff-armv7-a))) +;; (pass-if (true? (gr:fir-fff-armv7-a #(1.0 2.0)))) + +;;; ./filter/gr_fir_fff_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-fff-generic))) +;; (pass-if (true? (gr:fir-fff-generic #(1.0 2.0)))) + +;;; ./filter/gr_fir_fff_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-fff-simd 0 0 0))) + +;;; ./filter/gr_fir_fff_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-fff-x86))) +;; (pass-if (true? (gr:fir-fff-x86 #(1.0 2.0)))) + +;;; ./filter/gr_fir_filter_ccc.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-ccc 1 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_filter_ccf.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-ccf 1 #(1.0 2.0)))) + +;;; ./filter/gr_fir_filter_fcc.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-fcc 1 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_filter_fff.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-fff 1 #(1.0 2.0)))) + +;;; ./filter/gr_fir_filter_fsf.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-fsf 1 #(1.0 2.0)))) + +;;; ./filter/gr_fir_filter_scc.h FIXME: not found +;; (pass-if (true? (gr:fir-filter-scc 1 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_fsf_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-fsf-generic))) +;; (pass-if (true? (gr:fir-fsf-generic #(1.0 2.0)))) + +;;; ./filter/gr_fir_fsf_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-fsf-simd 0 0 0))) + +;;; ./filter/gr_fir_fsf_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-fsf-x86))) +;; (pass-if (true? (gr:fir-fsf-x86 #(1.0 2.0)))) + +;;; ./filter/gr_fir_scc_generic.h FIXME: not found +;; (pass-if (true? (gr:fir-scc-generic))) +;; (pass-if (true? (gr:fir-scc-generic #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_scc_simd.h FIXME: not found +;; (pass-if (true? (gr:fir-scc-simd))) +;; (pass-if (true? (gr:fir-scc-simd #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_scc_x86.h FIXME: not found +;; (pass-if (true? (gr:fir-scc-x86))) +;; (pass-if (true? (gr:fir-scc-x86 #(1+3i 23+5i)))) + +;;; ./filter/gr_fir_sysconfig_armv7_a.h FIXME: virtual methods +;; (pass-if (true? (gr:fir-sysconfig-armv7-a ))) + +;;; ./filter/gr_fir_sysconfig_generic.h FIXME: virtual methods +;; (pass-if (true? (gr:fir-sysconfig-generic ))) + +;;; ./filter/gr_fir_sysconfig_powerpc.h FIXME: virtual methods +;; (pass-if (true? (gr:fir-sysconfig-powerpc ))) + +;;; ./filter/gr_fir_sysconfig_x86.h FIXME: virtual methods +;; (pass-if (true? (gr:fir-sysconfig-x86 ))) + +;;; ./filter/gr_fractional_interpolator_cc.h FIXME: not found +;; (pass-if (true? (gr:fractional-interpolator-cc 1.0 1.0))) + +;;; ./filter/gr_fractional_interpolator_ff.h FIXME: not found +;; (pass-if (true? (gr:fractional-interpolator-ff 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-ccc 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-ccf 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-fcc 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-fcf 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_scc.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-scc 1.0 1.0))) + +;;; ./filter/gr_freq_xlating_fir_filter_scf.h FIXME: not found +;; (pass-if (true? (gr:freq-xlating-fir-filter-scf 1.0 1.0))) + +;;; ./filter/gr_goertzel_fc.h FIXME: not found +;; (pass-if (true? (gr:goertzel-fc 1 1 1))) + +;;; ./filter/gr_hilbert_fc.h FIXME: not found +;; (pass-if (true? (gr:hilbert-fc ))) + +;;; ./filter/gr_iir_filter_ffd.h FIXME: not found +;; (pass-if (true? (gr:iir-filter-ffd ))) + +;;; ./filter/gr_interp_fir_filter_ccc.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-ccc ))) + +;;; ./filter/gr_interp_fir_filter_ccf.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-ccf ))) + +;;; ./filter/gr_interp_fir_filter_fcc.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-fcc ))) + +;;; ./filter/gr_interp_fir_filter_fff.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-fff ))) + +;;; ./filter/gr_interp_fir_filter_fsf.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-fsf ))) + ;;; ./filter/gr_interp_fir_filter_scc.h +;; (pass-if (true? (gr:interp-fir-filter-scc ))) + ;;; ./filter/gr_pfb_arb_resampler_ccf.h +;; (pass-if (true? (gr:pfb-arb-resampler-ccf ))) + ;;; ./filter/gr_pfb_channelizer_ccf.h +;; (pass-if (true? (gr:pfb-channelizer-ccf ))) + ;;; ./filter/gr_pfb_clock_sync_ccf.h +;; (pass-if (true? (gr:pfb-clock-sync-ccf ))) + ;;; ./filter/gr_pfb_clock_sync_fff.h +;; (pass-if (true? (gr:pfb-clock-sync-fff ))) + ;;; ./filter/gr_pfb_decimator_ccf.h +;; (pass-if (true? (gr:pfb-decimator-ccf ))) + ;;; ./filter/gr_pfb_interpolator_ccf.h +;; (pass-if (true? (gr:pfb-interpolator-ccf ))) + ;;; ./filter/gr_rational_resampler_base_ccc.h +;; (pass-if (true? (gr:rational-resampler-base-ccc ))) + ;;; ./filter/gr_rational_resampler_base_ccf.h +;; (pass-if (true? (gr:rational-resampler-base-ccf ))) + ;;; ./filter/gr_rational_resampler_base_fcc.h +;; (pass-if (true? (gr:rational-resampler-base-fcc ))) + ;;; ./filter/gr_rational_resampler_base_fff.h +;; (pass-if (true? (gr:rational-resampler-base-fff ))) + ;;; ./filter/gr_rational_resampler_base_fsf.h +;; (pass-if (true? (gr:rational-resampler-base-fsf ))) + ;;; ./filter/gr_rational_resampler_base_scc.h +;; (pass-if (true? (gr:rational-resampler-base-scc ))) + ;;; ./filter/gr_single_pole_iir_filter_cc.h +;; (pass-if (true? (gr:single-pole-iir-filter-cc ))) + ;;; ./filter/gr_single_pole_iir_filter_ff.h +;; (pass-if (true? (gr:single-pole-iir-filter-ff ))) -- cgit From c4b880a4d6fcd21da17191a7a4f6f0db7dff95e3 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 11:32:34 -0700 Subject: comment out the two failures --- gnuradio-core/src/guile/tests/general_ctors.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 6153ce795..d9f44a12d 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -76,13 +76,13 @@ ;;; ./general/gr_check_lfsr_32k_s.h FIXME: not found ;; (pass-if (true? (gr:check-lfsr-2k-s))) -;;; ./general/gr_clock_recovery_mm_cc.h +;;; ./general/gr_clock_recovery_mm_cc.h FIXME: throw test fails (pass-if (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) -;; (pass-if-throw "confirm throw gr:clock-recovery-mm-cc" #t (true? (gr:clock-recovery-mm-cc 0 0 0 0 0))) FIXME: segfault +;; (pass-if-throw "confirm throw gr:clock-recovery-mm-cc" #t (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) -;;; ./general/gr_clock_recovery_mm_ff.h +;;; ./general/gr_clock_recovery_mm_ff.h FIXME: throw test fails (pass-if (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) -(pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) +;; (pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) ;;; ./general/gr_complex_to_interleaved_short.h (pass-if (true? (gr:complex-to-interleaved-short))) -- cgit From df92b7c6315c567e58e0d9c293d7c9c2699023d3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 10 Nov 2010 13:01:38 -0800 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 0803cbfee..7da681a26 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -112,8 +112,8 @@ gnuradio_core_runtime.py: gnuradio_core_runtime.i if GUILE gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la -libguile_gnuradio_core_runtime_la_SOURCES = \ - guile/gnuradio_core_runtime.cc \ +libguile_gnuradio_core_runtime_la_SOURCES = \ + guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primitive.scm @@ -245,8 +245,8 @@ gnuradio_core_general.py: gnuradio_core_general.i if GUILE gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la -libguile_gnuradio_core_general_la_SOURCES = \ - guile/gnuradio_core_general.cc \ +libguile_gnuradio_core_general_la_SOURCES = \ + guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primitive.scm @@ -378,8 +378,8 @@ gnuradio_core_gengen.py: gnuradio_core_gengen.i if GUILE gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la -libguile_gnuradio_core_gengen_la_SOURCES = \ - guile/gnuradio_core_gengen.cc \ +libguile_gnuradio_core_gengen_la_SOURCES = \ + guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primitive.scm @@ -511,8 +511,8 @@ gnuradio_core_filter.py: gnuradio_core_filter.i if GUILE gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la -libguile_gnuradio_core_filter_la_SOURCES = \ - guile/gnuradio_core_filter.cc \ +libguile_gnuradio_core_filter_la_SOURCES = \ + guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primitive.scm @@ -644,8 +644,8 @@ gnuradio_core_io.py: gnuradio_core_io.i if GUILE gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la -libguile_gnuradio_core_io_la_SOURCES = \ - guile/gnuradio_core_io.cc \ +libguile_gnuradio_core_io_la_SOURCES = \ + guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primitive.scm @@ -777,8 +777,8 @@ gnuradio_core_hier.py: gnuradio_core_hier.i if GUILE gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la -libguile_gnuradio_core_hier_la_SOURCES = \ - guile/gnuradio_core_hier.cc \ +libguile_gnuradio_core_hier_la_SOURCES = \ + guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primitive.scm -- cgit From f43d2a4759e0ecd6519c0ac0aa4afbc54e70ea65 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 10 Nov 2010 17:57:11 -0700 Subject: add the .i files as dependencies --- gnuradio-core/src/lib/filter/Makefile.am | 14 ++++++++++++++ gnuradio-core/src/lib/general/Makefile.am | 14 ++++++++++++++ gnuradio-core/src/lib/gengen/Makefile.am | 14 ++++++++++++++ gnuradio-core/src/lib/hier/Makefile.am | 16 +++++++++++++++- gnuradio-core/src/lib/io/Makefile.am | 14 ++++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 6d2ec1c7e..be220425f 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -387,3 +387,17 @@ gen_sources = $(BUILT_SOURCES) gen_sources_deps = $(core_generator) par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py include $(top_srcdir)/Makefile.par.gen + +# Produce a list of the file names with the .cc stripped off +files = $(foreach HFILE,$(libfilter_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) + +# All .lo files depend on the .i file of the same name +define template +-include $(DEPDIR)/$(1).d +$(DEPDIR)/$(1).d: + @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d + @cat ../swig/guile/gnuradio_core_filter.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d +endef + +# Generate all the dependencies at runtime +$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3d8a42805..4a25df00a 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -486,3 +486,17 @@ swiginclude_HEADERS = \ gr_probe_mpsk_snr_c.i \ gr_probe_density_b.i endif + +# Produce a list of the file names with the .cc stripped off +files = $(foreach HFILE,$(libgeneral_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) + +# All .lo files depend on the .i file of the same name +define template +-include $(DEPDIR)/$(1).d +$(DEPDIR)/$(1).d: + @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d + @cat ../swig/guile/gnuradio_core_general.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d +endef + +# Generate all the dependencies at runtime +$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index 4978ad1c5..83a4003af 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -159,3 +159,17 @@ gen_sources = $(BUILT_SOURCES) gen_sources_deps = $(core_generator) par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py include $(top_srcdir)/Makefile.par.gen + +# Produce a list of the file names with the .cc stripped off +files = $(foreach HFILE,$(libgengen_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) + +# All .lo files depend on the .i file of the same name +define template +-include $(DEPDIR)/$(1).d +$(DEPDIR)/$(1).d: + @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d + @cat ../swig/guile/gnuradio_core_gengen.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d +endef + +# Generate all the dependencies at runtime +$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/hier/Makefile.am b/gnuradio-core/src/lib/hier/Makefile.am index e2e7fe886..86639c660 100644 --- a/gnuradio-core/src/lib/hier/Makefile.am +++ b/gnuradio-core/src/lib/hier/Makefile.am @@ -20,7 +20,7 @@ # include $(top_srcdir)/Makefile.common - +#-include $(top_builddir)/gnuradio-core/src/lib/swig/guile/gnuradio_core_hier.d AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(WITH_INCLUDES) @@ -37,3 +37,17 @@ swiginclude_HEADERS = \ hier.i \ gr_channel_model.i endif + +# Produce a list of the file names with the .cc stripped off +files = $(foreach HFILE,$(libhier_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) + +# All .lo files depend on the .i file of the same name +define template +-include $(DEPDIR)/$(1).d +$(DEPDIR)/$(1).d: + @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d + @cat ../swig/guile/gnuradio_core_hier.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d +endef + +# Generate all the dependencies at runtime +$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am index c52554645..0ab9ac135 100644 --- a/gnuradio-core/src/lib/io/Makefile.am +++ b/gnuradio-core/src/lib/io/Makefile.am @@ -113,3 +113,17 @@ swiginclude_HEADERS = \ gr_wavfile_source.i \ gr_wavfile_sink.i endif + +# Produce a list of the file names with the .cc stripped off +files = $(foreach HFILE,$(libio_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) + +# All .lo files depend on the .i file of the same name +define template +-include $(DEPDIR)/$(1).d +$(DEPDIR)/$(1).d: + @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d + @cat ../swig/guile/gnuradio_core_io.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d +endef + +# Generate all the dependencies at runtime +$(foreach prog,$(files),$(eval $(call template,$(prog)))) -- cgit From 95ccbf4791363ab7c07a1b647976a3be1873722d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 10 Nov 2010 18:09:11 -0800 Subject: Remove generated file from repo --- .../lib/filter/gri_fir_filter_with_buffer_ccf.h | 131 --------------------- 1 file changed, 131 deletions(-) delete mode 100644 gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h deleted file mode 100644 index bd7fa33cf..000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -/* - * WARNING: This file is automatically generated by generate_gri_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H -#define INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H - -#include -#include -#include -#include -#include - -/*! - * \brief FIR with internal buffer for gr_complex input, - gr_complex output and float taps - * \ingroup filter - * - */ - -class gri_fir_filter_with_buffer_ccf { - -protected: - std::vector d_taps; // reversed taps - gr_complex *d_buffer; - unsigned int d_idx; - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - gri_fir_filter_with_buffer_ccf (const std::vector &taps); - - ~gri_fir_filter_with_buffer_ccf (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input is a single input value of the filter type - * - * \returns the filtered input value. - */ - gr_complex filter (gr_complex input); - - - /*! - * \brief compute a single output value; designed for decimating filters. - * - * \p input is a single input value of the filter type. The value of dec is the - * decimating value of the filter, so input[] must have dec valid values. - * The filter pushes dec number of items onto the circ. buffer before computing - * a single output. - * - * \returns the filtered input value. - */ - gr_complex filter (const gr_complex input[], unsigned long dec); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - void filterN (gr_complex output[], const gr_complex input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - void filterNdec (gr_complex output[], const gr_complex input[], - unsigned long n, unsigned long decimate); - - /*! - * \brief install \p new_taps as the current taps. - */ - void set_taps (const std::vector &taps); - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - const std::vector get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H */ -- cgit From fa9eeb2aab040a3c74da639233ba8f9a585b0455 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 10 Nov 2010 18:12:02 -0800 Subject: Add @srcdir@ to test directory specifier --- gnuradio-core/src/guile/Makefile.am | 4 ---- gnuradio-core/src/guile/run_guile_tests.in | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 5eb9444af..f4cc14175 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -49,7 +49,3 @@ noinst_DATA = \ tests/io_ctors.test CLEANFILES = guile.log - -check-am: all-am - @test -d "tests" || $(mkinstalldirs) "tests" - $(MAKE) $(AM_MAKEFLAGS) check-TESTS diff --git a/gnuradio-core/src/guile/run_guile_tests.in b/gnuradio-core/src/guile/run_guile_tests.in index e52497332..ceaa84108 100644 --- a/gnuradio-core/src/guile/run_guile_tests.in +++ b/gnuradio-core/src/guile/run_guile_tests.in @@ -12,4 +12,4 @@ # "" \ # "" -@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t tests +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@/tests -- cgit From 5783b693279b6c64ef800f6e8294ec68a2869b29 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 10 Nov 2010 18:21:50 -0800 Subject: Revert "add the .i files as dependencies" This reverts commit f43d2a4759e0ecd6519c0ac0aa4afbc54e70ea65. The dependencies doesn't make any sense. There's an attempt to run sed on files that haven't been generated yet. --- gnuradio-core/src/lib/filter/Makefile.am | 14 -------------- gnuradio-core/src/lib/general/Makefile.am | 14 -------------- gnuradio-core/src/lib/gengen/Makefile.am | 14 -------------- gnuradio-core/src/lib/hier/Makefile.am | 16 +--------------- gnuradio-core/src/lib/io/Makefile.am | 14 -------------- 5 files changed, 1 insertion(+), 71 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index be220425f..6d2ec1c7e 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -387,17 +387,3 @@ gen_sources = $(BUILT_SOURCES) gen_sources_deps = $(core_generator) par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py include $(top_srcdir)/Makefile.par.gen - -# Produce a list of the file names with the .cc stripped off -files = $(foreach HFILE,$(libfilter_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) - -# All .lo files depend on the .i file of the same name -define template --include $(DEPDIR)/$(1).d -$(DEPDIR)/$(1).d: - @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d - @cat ../swig/guile/gnuradio_core_filter.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d -endef - -# Generate all the dependencies at runtime -$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 4a25df00a..3d8a42805 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -486,17 +486,3 @@ swiginclude_HEADERS = \ gr_probe_mpsk_snr_c.i \ gr_probe_density_b.i endif - -# Produce a list of the file names with the .cc stripped off -files = $(foreach HFILE,$(libgeneral_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) - -# All .lo files depend on the .i file of the same name -define template --include $(DEPDIR)/$(1).d -$(DEPDIR)/$(1).d: - @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d - @cat ../swig/guile/gnuradio_core_general.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d -endef - -# Generate all the dependencies at runtime -$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index 83a4003af..4978ad1c5 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -159,17 +159,3 @@ gen_sources = $(BUILT_SOURCES) gen_sources_deps = $(core_generator) par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py include $(top_srcdir)/Makefile.par.gen - -# Produce a list of the file names with the .cc stripped off -files = $(foreach HFILE,$(libgengen_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) - -# All .lo files depend on the .i file of the same name -define template --include $(DEPDIR)/$(1).d -$(DEPDIR)/$(1).d: - @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d - @cat ../swig/guile/gnuradio_core_gengen.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d -endef - -# Generate all the dependencies at runtime -$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/hier/Makefile.am b/gnuradio-core/src/lib/hier/Makefile.am index 86639c660..e2e7fe886 100644 --- a/gnuradio-core/src/lib/hier/Makefile.am +++ b/gnuradio-core/src/lib/hier/Makefile.am @@ -20,7 +20,7 @@ # include $(top_srcdir)/Makefile.common -#-include $(top_builddir)/gnuradio-core/src/lib/swig/guile/gnuradio_core_hier.d + AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(WITH_INCLUDES) @@ -37,17 +37,3 @@ swiginclude_HEADERS = \ hier.i \ gr_channel_model.i endif - -# Produce a list of the file names with the .cc stripped off -files = $(foreach HFILE,$(libhier_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) - -# All .lo files depend on the .i file of the same name -define template --include $(DEPDIR)/$(1).d -$(DEPDIR)/$(1).d: - @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d - @cat ../swig/guile/gnuradio_core_hier.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d -endef - -# Generate all the dependencies at runtime -$(foreach prog,$(files),$(eval $(call template,$(prog)))) diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am index 0ab9ac135..c52554645 100644 --- a/gnuradio-core/src/lib/io/Makefile.am +++ b/gnuradio-core/src/lib/io/Makefile.am @@ -113,17 +113,3 @@ swiginclude_HEADERS = \ gr_wavfile_source.i \ gr_wavfile_sink.i endif - -# Produce a list of the file names with the .cc stripped off -files = $(foreach HFILE,$(libio_la_SOURCES), $(patsubst %.cc,%,$(HFILE))) - -# All .lo files depend on the .i file of the same name -define template --include $(DEPDIR)/$(1).d -$(DEPDIR)/$(1).d: - @echo "$(1).lo: \\" > $(DEPDIR)/$(1).d - @cat ../swig/guile/gnuradio_core_io.Std | sed -e '1d;' >> $(DEPDIR)/$(1).d -endef - -# Generate all the dependencies at runtime -$(foreach prog,$(files),$(eval $(call template,$(prog)))) -- cgit From c204913321f0618ac131738088dab23065bdfa80 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 14:19:02 -0500 Subject: Fixed small bug in how tags are propagated downstream. Also using seq. numbers in annotator test block to better keep track. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 4 ++-- gnuradio-core/src/lib/runtime/gr_random_annotator.cc | 7 ++++++- gnuradio-core/src/lib/runtime/gr_random_annotator.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 804c9e197..840cf8e5c 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -343,9 +343,9 @@ gr_block_executor::run_one_iteration() for (int i = 0; i < d->noutputs (); i++) d_output_items[i] = d->output(i)->write_pointer(); - // store number of items consumed so far on in stream + // determine where to start looking for new tags as 1 past nitems read for (int i = 0; i < d->ninputs(); i++) - d_start_nitems_read[i] = d->nitems_read(i); + d_start_nitems_read[i] = d->nitems_read(i)+1; // Do the actual work of the block int n = m->general_work (noutput_items, d_ninput_items, diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc index 08589984e..366130984 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc @@ -42,6 +42,11 @@ gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) gr_make_io_signature (1, -1, sizeof_stream_item)), d_itemsize(sizeof_stream_item) { + //set_tag_propagation_policy(TPP_DONT); + set_tag_propagation_policy(TPP_ALL_TO_ALL); + //set_tag_propagation_policy(TPP_ONE_TO_ONE); + + d_tag_counter = 0; } gr_random_annotator::~gr_random_annotator () @@ -86,7 +91,7 @@ gr_random_annotator::work (int noutput_items, } // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t cur_N = pmt::pmt_from_uint64(random()); + pmt::pmt_t cur_N = pmt::pmt_from_uint64(d_tag_counter++); pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items"); add_item_tag(0, abs_N, key, cur_N, srcid); diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h index 3f21b71ad..5fca53830 100644 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h +++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h @@ -46,6 +46,7 @@ protected: private: size_t d_itemsize; std::stringstream d_sout; + uint64_t d_tag_counter; friend gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); -- cgit From 9aaf98cff5e03ec2821da492f3857780a767258f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 15:55:04 -0500 Subject: Renaming random_annotator to annotator_1toall that moves tags from single input to all outputs. --- gnuradio-core/src/lib/general/Makefile.am | 11 ++- gnuradio-core/src/lib/general/general.i | 4 + .../src/lib/general/gr_annotator_1toall.cc | 99 ++++++++++++++++++++ .../src/lib/general/gr_annotator_1toall.h | 55 ++++++++++++ .../src/lib/general/gr_annotator_1toall.i | 32 +++++++ gnuradio-core/src/lib/runtime/Makefile.am | 3 - .../src/lib/runtime/gr_random_annotator.cc | 100 --------------------- .../src/lib/runtime/gr_random_annotator.h | 55 ------------ .../src/lib/runtime/gr_random_annotator.i | 32 ------- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 23 +++-- gnuradio-core/src/lib/runtime/runtime.i | 2 - 11 files changed, 213 insertions(+), 203 deletions(-) create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.cc create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.h create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.i delete mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.cc delete mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.h delete mode 100644 gnuradio-core/src/lib/runtime/gr_random_annotator.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3d8a42805..a58461165 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -175,7 +175,9 @@ libgeneral_la_SOURCES = \ gr_descrambler_bb.cc \ gr_scrambler_bb.cc \ gr_probe_mpsk_snr_c.cc \ - gr_probe_density_b.cc + gr_probe_density_b.cc \ + gr_annotator_1toall.cc \ + gr_annotator_1to1.cc libgeneral_qa_la_SOURCES = \ qa_general.cc \ @@ -344,7 +346,8 @@ grinclude_HEADERS = \ gr_descrambler_bb.h \ gr_scrambler_bb.h \ gr_probe_mpsk_snr_c.h \ - gr_probe_density_b.h + gr_probe_density_b.h \ + gr_annotator_1toall.h noinst_HEADERS = \ qa_general.h \ @@ -484,5 +487,7 @@ swiginclude_HEADERS = \ gr_descrambler_bb.i \ gr_scrambler_bb.i \ gr_probe_mpsk_snr_c.i \ - gr_probe_density_b.i + gr_probe_density_b.i \ + gr_annotator_1toall.i \ + gr_annotator_1to1.i endif diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 68cafce2e..0dce5f68d 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -141,6 +141,8 @@ #include #include #include +#include +#include %} %include "gr_nop.i" @@ -262,3 +264,5 @@ %include "gr_copy.i" %include "gr_fll_band_edge_cc.i" %include "gr_additive_scrambler_bb.i" +%include "gr_annotator_1toall.i" +%include "gr_annotator_1to1.i" diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc new file mode 100644 index 000000000..34574c9e5 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc @@ -0,0 +1,99 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +gr_annotator_1toall_sptr +gr_make_annotator_1toall (size_t sizeof_stream_item) +{ + return gnuradio::get_initial_sptr (new gr_annotator_1toall (sizeof_stream_item)); +} + +gr_annotator_1toall::gr_annotator_1toall (size_t sizeof_stream_item) + : gr_sync_block ("annotator_1toall", + gr_make_io_signature (1, 1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item) +{ + set_tag_propagation_policy(TPP_ALL_TO_ALL); + + d_tag_counter = 0; +} + +gr_annotator_1toall::~gr_annotator_1toall () +{ + std::cout << d_sout.str(); +} + +int +gr_annotator_1toall::work (int noutput_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]; + + std::stringstream str; + str << name() << unique_id(); + + uint64_t abs_N = nitems_read(0) + noutput_items; + std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); + std::vector::iterator itr; + + d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; + d_sout.setf(std::ios::left); + d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" + << std::setw(10) << "nitem" << std::setw(20) << "key" + << std::setw(10) << "value" << std::endl; + + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_sout << std::setw(25) << str.str() + << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) + << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) + << std::endl; + } + + + // Storing the current noutput_items as the value to the "noutput_items" key + pmt::pmt_t cur_N = pmt::pmt_from_uint64(d_tag_counter++); + pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); + pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); + + // Work does nothing to the data stream; just copy all inputs to outputs + int noutputs = output_items.size(); + for (int i = 0; i < noutputs; i++) { + memcpy(out[i], in[0], noutput_items * d_itemsize); + add_item_tag(i, abs_N, key, cur_N, srcid); + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.h b/gnuradio-core/src/lib/general/gr_annotator_1toall.h new file mode 100644 index 000000000..4417e8c54 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TOALL_H +#define INCLUDED_GR_ANNOTATOR_1TOALL_H + +#include + +class gr_annotator_1toall; +typedef boost::shared_ptr gr_annotator_1toall_sptr; + +// public constructor +gr_annotator_1toall_sptr +gr_make_annotator_1toall (size_t sizeof_stream_item); + +class gr_annotator_1toall : public gr_sync_block +{ + public: + ~gr_annotator_1toall (); + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +protected: + gr_annotator_1toall (size_t sizeof_stream_item); + + private: + size_t d_itemsize; + std::stringstream d_sout; + uint64_t d_tag_counter; + + friend gr_annotator_1toall_sptr + gr_make_annotator_1toall (size_t sizeof_stream_item); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.i b/gnuradio-core/src/lib/general/gr_annotator_1toall.i new file mode 100644 index 000000000..a8f1de3e0 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,annotator_1toall); + +gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item); + +class gr_annotator_1toall : public gr_sync_block +{ +private: + gr_annotator_1toall (size_t sizeof_stream_item); +}; + diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 1af91d80d..4c52f3ab0 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -49,7 +49,6 @@ libruntime_la_SOURCES = \ gr_msg_queue.cc \ gr_pagesize.cc \ gr_preferences.cc \ - gr_random_annotator.cc \ gr_realtime.cc \ gr_scheduler.cc \ gr_scheduler_sts.cc \ @@ -104,7 +103,6 @@ grinclude_HEADERS = \ gr_msg_queue.h \ gr_pagesize.h \ gr_preferences.h \ - gr_random_annotator.h \ gr_realtime.h \ gr_runtime_types.h \ gr_scheduler.h \ @@ -155,7 +153,6 @@ swiginclude_HEADERS = \ gr_message.i \ gr_msg_handler.i \ gr_msg_queue.i \ - gr_random_annotator.i \ gr_realtime.i \ gr_single_threaded_scheduler.i \ gr_sync_block.i \ diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc deleted file mode 100644 index 366130984..000000000 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -gr_random_annotator_sptr -gr_make_random_annotator (size_t sizeof_stream_item) -{ - return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item)); -} - -gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item) - : gr_sync_block ("random_annotator", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item) -{ - //set_tag_propagation_policy(TPP_DONT); - set_tag_propagation_policy(TPP_ALL_TO_ALL); - //set_tag_propagation_policy(TPP_ONE_TO_ONE); - - d_tag_counter = 0; -} - -gr_random_annotator::~gr_random_annotator () -{ - std::cout << d_sout.str(); -} - -int -gr_random_annotator::work (int noutput_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]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = nitems_read(0) + noutput_items; - std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); - std::vector::iterator itr; - - d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; - d_sout.setf(std::ios::left); - d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" - << std::setw(10) << "nitem" << std::setw(20) << "key" - << std::setw(10) << "value" << std::endl; - - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_sout << std::setw(25) << str.str() - << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) - << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) - << std::endl; - } - - // Work does nothing to the data stream; just copy all inputs to outputs - int ninputs = input_items.size(); - for (int i = 0; i < ninputs; i++){ - memcpy(out[i], in[i], noutput_items * d_itemsize); - } - - // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t cur_N = pmt::pmt_from_uint64(d_tag_counter++); - pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); - pmt::pmt_t key = pmt::pmt_string_to_symbol("noutput_items"); - add_item_tag(0, abs_N, key, cur_N, srcid); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h deleted file mode 100644 index 5fca53830..000000000 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -#ifndef INCLUDED_GR_RANDOM_ANNOTATOR_H -#define INCLUDED_GR_RANDOM_ANNOTATOR_H - -#include - -class gr_random_annotator; -typedef boost::shared_ptr gr_random_annotator_sptr; - -// public constructor -gr_random_annotator_sptr -gr_make_random_annotator (size_t sizeof_stream_item); - -class gr_random_annotator : public gr_sync_block -{ - public: - ~gr_random_annotator (); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -protected: - gr_random_annotator (size_t sizeof_stream_item); - - private: - size_t d_itemsize; - std::stringstream d_sout; - uint64_t d_tag_counter; - - friend gr_random_annotator_sptr - gr_make_random_annotator (size_t sizeof_stream_item); -}; - -#endif diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.i b/gnuradio-core/src/lib/runtime/gr_random_annotator.i deleted file mode 100644 index f8765a294..000000000 --- a/gnuradio-core/src/lib/runtime/gr_random_annotator.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,random_annotator); - -gr_random_annotator_sptr gr_make_random_annotator (size_t sizeof_stream_item); - -class gr_random_annotator : public gr_sync_block -{ -private: - gr_random_annotator (size_t sizeof_stream_item); -}; - diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 2fedb28fd..a845f70dc 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include @@ -73,17 +73,24 @@ qa_block_tags::t1 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr ann0 (gr_make_random_annotator(sizeof(int))); - gr_block_sptr ann1 (gr_make_random_annotator(sizeof(int))); - gr_block_sptr ann2 (gr_make_random_annotator(sizeof(int))); - gr_block_sptr snk (gr_make_null_sink(sizeof(int))); + gr_block_sptr ann0 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr ann3 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr ann4 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); + gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); + tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, ann2, 0); - tb->connect(ann2, 0, snk, 0); - tb->run(); + tb->connect(ann0, 1, ann2, 0); + tb->connect(ann1, 0, ann3, 0); + tb->connect(ann2, 0, ann4, 0); + tb->connect(ann1, 0, snk0, 0); + tb->connect(ann2, 0, snk1, 0); + tb->run(); } diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index 51b32de17..20cf68a03 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +53,6 @@ %include %include %include -%include %include %include %include -- cgit From 0952d5a28a898309f3b7a11a27fff27b52731b53 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 15:55:58 -0500 Subject: Adding an annotator block that moves tags using 1-to-1 policy. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 101 +++++++++++++++++++++ gnuradio-core/src/lib/general/gr_annotator_1to1.h | 55 +++++++++++ gnuradio-core/src/lib/general/gr_annotator_1to1.i | 32 +++++++ gnuradio-core/src/lib/runtime/qa_block_tags.cc | 5 +- 4 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1to1.cc create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1to1.h create mode 100644 gnuradio-core/src/lib/general/gr_annotator_1to1.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc new file mode 100644 index 000000000..315285e41 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -0,0 +1,101 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +gr_annotator_1to1_sptr +gr_make_annotator_1to1 (size_t sizeof_stream_item) +{ + return gnuradio::get_initial_sptr (new gr_annotator_1to1 (sizeof_stream_item)); +} + +gr_annotator_1to1::gr_annotator_1to1 (size_t sizeof_stream_item) + : gr_sync_block ("annotator_1to1", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item) +{ + set_tag_propagation_policy(TPP_ONE_TO_ONE); + + d_tag_counter = 0; +} + +gr_annotator_1to1::~gr_annotator_1to1 () +{ + std::cout << d_sout.str(); +} + +int +gr_annotator_1to1::work (int noutput_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]; + + std::stringstream str; + str << name() << unique_id(); + + uint64_t abs_N = nitems_read(0) + noutput_items; + std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); + std::vector::iterator itr; + + d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; + d_sout.setf(std::ios::left); + d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" + << std::setw(10) << "nitem" << std::setw(20) << "key" + << std::setw(10) << "value" << std::endl; + + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_sout << std::setw(25) << str.str() + << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) + << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) + << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) + << std::endl; + } + + + // Storing the current noutput_items as the value to the "noutput_items" key + pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); + pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); + pmt::pmt_t value; + + // Work does nothing to the data stream; just copy all inputs to outputs + int noutputs = output_items.size(); + int ninputs = input_items.size(); + for (int i = 0; i < noutputs; i++) { + value = pmt::pmt_from_uint64(d_tag_counter++); + memcpy(out[i], in[i], noutput_items * d_itemsize); + add_item_tag(i, abs_N, key, value, srcid); + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h new file mode 100644 index 000000000..d40135be7 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H +#define INCLUDED_GR_ANNOTATOR_1TO1_H + +#include + +class gr_annotator_1to1; +typedef boost::shared_ptr gr_annotator_1to1_sptr; + +// public constructor +gr_annotator_1to1_sptr +gr_make_annotator_1to1 (size_t sizeof_stream_item); + +class gr_annotator_1to1 : public gr_sync_block +{ + public: + ~gr_annotator_1to1 (); + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +protected: + gr_annotator_1to1 (size_t sizeof_stream_item); + + private: + size_t d_itemsize; + std::stringstream d_sout; + uint64_t d_tag_counter; + + friend gr_annotator_1to1_sptr + gr_make_annotator_1to1 (size_t sizeof_stream_item); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i new file mode 100644 index 000000000..9fba558b7 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); + +gr_annotator_1to1_sptr gr_make_annotator_1to1 (size_t sizeof_stream_item); + +class gr_annotator_1to1 : public gr_sync_block +{ +private: + gr_annotator_1to1 (size_t sizeof_stream_item); +}; + diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index a845f70dc..0c96052e3 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -89,8 +89,9 @@ qa_block_tags::t1 () tb->connect(ann1, 0, ann3, 0); tb->connect(ann2, 0, ann4, 0); - tb->connect(ann1, 0, snk0, 0); - tb->connect(ann2, 0, snk1, 0); + tb->connect(ann3, 0, snk0, 0); + tb->connect(ann4, 0, snk1, 0); + tb->run(); } -- cgit From 3f6ebc2be1636a4727b6df9f336b3cb024031c67 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 19:40:06 -0500 Subject: Modifying the all-to-all stream annotator for better use in testing. It now add tags at pre-determined points in the stream and also grabs all tags that flow past and stores them locally. These tags are to be used for testing that the correct tags are coming through. --- .../src/lib/general/gr_annotator_1toall.cc | 66 +++++++++++----------- .../src/lib/general/gr_annotator_1toall.h | 42 +++++++++++--- .../src/lib/general/gr_annotator_1toall.i | 11 +++- 3 files changed, 74 insertions(+), 45 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc index 34574c9e5..1410b8b94 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc @@ -31,69 +31,69 @@ #include gr_annotator_1toall_sptr -gr_make_annotator_1toall (size_t sizeof_stream_item) +gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate) { - return gnuradio::get_initial_sptr (new gr_annotator_1toall (sizeof_stream_item)); + return gnuradio::get_initial_sptr (new gr_annotator_1toall (sizeof_stream_item, rel_rate)); } -gr_annotator_1toall::gr_annotator_1toall (size_t sizeof_stream_item) - : gr_sync_block ("annotator_1toall", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item) +gr_annotator_1toall::gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate) + : gr_block ("annotator_1toall", + gr_make_io_signature (1, 1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) { set_tag_propagation_policy(TPP_ALL_TO_ALL); d_tag_counter = 0; + set_relative_rate(d_rel_rate); } gr_annotator_1toall::~gr_annotator_1toall () { - std::cout << d_sout.str(); } int -gr_annotator_1toall::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +gr_annotator_1toall::general_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]; + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = nitems_read(0) + noutput_items; - std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); + uint64_t abs_N = nitems_read(0); + std::vector all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); std::vector::iterator itr; - d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; - d_sout.setf(std::ios::left); - d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" - << std::setw(10) << "nitem" << std::setw(20) << "key" - << std::setw(10) << "value" << std::endl; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_sout << std::setw(25) << str.str() - << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) - << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) - << std::endl; + d_stored_tags.push_back(*itr); } - - // Storing the current noutput_items as the value to the "noutput_items" key - pmt::pmt_t cur_N = pmt::pmt_from_uint64(d_tag_counter++); + // Source ID and key for any tag that might get applied from this block pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); // Work does nothing to the data stream; just copy all inputs to outputs + // Adds a new tag when the number of items read is a multiple of N + uint64_t N = 10000; int noutputs = output_items.size(); - for (int i = 0; i < noutputs; i++) { - memcpy(out[i], in[0], noutput_items * d_itemsize); - add_item_tag(i, abs_N, key, cur_N, srcid); + for(int j = 0; j < noutput_items; j++) { + abs_N++; + + for(int i = 0; i < noutputs; i++) { + if(abs_N % N == 0) { + pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); + add_item_tag(i, abs_N, key, value, srcid); + } + + out = (float*)output_items[i]; + out[j] = in[j]; + } } + consume_each(noutput_items); return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.h b/gnuradio-core/src/lib/general/gr_annotator_1toall.h index 4417e8c54..e118fd7a0 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.h @@ -23,33 +23,57 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TOALL_H #define INCLUDED_GR_ANNOTATOR_1TOALL_H -#include +#include class gr_annotator_1toall; typedef boost::shared_ptr gr_annotator_1toall_sptr; // public constructor gr_annotator_1toall_sptr -gr_make_annotator_1toall (size_t sizeof_stream_item); +gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate=1.0); -class gr_annotator_1toall : public gr_sync_block +/*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 items it sees. The + * tags contain the name and ID of the instantiated block, use "seq" as a key, + * and have a counter that increments by 1 for every tag produced that is used + * as the tag's value. The tags are propagated using the all-to-all policy. + * + * It also stores a copy of all tags it sees flow past it. These tags can be + * recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ +class gr_annotator_1toall : public gr_block { public: ~gr_annotator_1toall (); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + float rel_rate() { return d_rel_rate; } + + + std::vector data() const + { + return d_stored_tags; + } protected: - gr_annotator_1toall (size_t sizeof_stream_item); + gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate); private: size_t d_itemsize; - std::stringstream d_sout; + float d_rel_rate; uint64_t d_tag_counter; + std::vector d_stored_tags; friend gr_annotator_1toall_sptr - gr_make_annotator_1toall (size_t sizeof_stream_item); + gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.i b/gnuradio-core/src/lib/general/gr_annotator_1toall.i index a8f1de3e0..02f79bf7e 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.i @@ -22,11 +22,16 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1toall); -gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item); +gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate); -class gr_annotator_1toall : public gr_sync_block +class gr_annotator_1toall : public gr_block { +public: + void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + float rel_rate() { return d_rel_rate; } + std::vector data() const; + private: - gr_annotator_1toall (size_t sizeof_stream_item); + gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate); }; -- cgit From 54b396764a9fad91cbfd10f618e4faed1c8bafa2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 19:41:46 -0500 Subject: Switches to using the new annotator block with a known graph structure to run tests against the all-to-all tag propagation policy to make sure the tags are flowing downstream properly. Adding stub for testing the 1-to-1 tag propagation policy. --- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 83 +++++++++++++++++++++++++- gnuradio-core/src/lib/runtime/qa_block_tags.h | 2 + 2 files changed, 84 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 0c96052e3..4dc096f27 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -30,11 +30,13 @@ #include #include #include +#include #include // ---------------------------------------------------------------- +using namespace pmt; void qa_block_tags::t0 () @@ -73,7 +75,85 @@ qa_block_tags::t1 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr ann0 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann0 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann3 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann4 (gr_make_annotator_1toall(sizeof(int))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); + gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + + tb->connect(src, 0, head, 0); + tb->connect(head, 0, ann0, 0); + + tb->connect(ann0, 0, ann1, 0); + tb->connect(ann0, 1, ann2, 0); + tb->connect(ann1, 0, ann3, 0); + tb->connect(ann2, 0, ann4, 0); + + tb->connect(ann3, 0, snk0, 0); + tb->connect(ann4, 0, snk1, 0); + + tb->run(); + + // Kludge together the tags that we know should result from the above graph + std::stringstream str0, str1, str2; + str0 << ann0->name() << ann0->unique_id(); + str1 << ann1->name() << ann1->unique_id(); + str2 << ann2->name() << ann2->unique_id(); + + pmt_t expected_tags3[8]; + expected_tags3[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + + pmt_t expected_tags4[8]; + expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt_from_uint64(40000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + + std::vector tags0 = ann0->data(); + std::vector tags3 = ann3->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + + // For annotator 3, we know it gets tags from ann0 and ann1, test this + for(size_t i = 0; i < tags3.size(); i++) { + std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; + //pmt_equal(tags3[i], expected_tags3[i]) + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + } + + // For annotator 4, we know it gets tags from ann0 and ann2, test this + for(size_t i = 0; i < tags4.size(); i++) { + std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + } +} + + +void +qa_block_tags::t2 () +{ + printf("\nqa_block_tags::t2\n"); + + int N = 40000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_block_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); gr_block_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); gr_block_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); gr_block_sptr ann3 (gr_make_annotator_1toall(sizeof(int))); @@ -83,6 +163,7 @@ qa_block_tags::t1 () tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); + tb->connect(head, 0, ann0, 1); tb->connect(ann0, 0, ann1, 0); tb->connect(ann0, 1, ann2, 0); diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index b7388885f..69bc0480c 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -32,11 +32,13 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST_SUITE (qa_block_tags); CPPUNIT_TEST (t0); CPPUNIT_TEST (t1); + //CPPUNIT_TEST (t2); CPPUNIT_TEST_SUITE_END (); private: void t0 (); void t1 (); + void t2 (); }; -- cgit From 4a63bc91ddceaa8ce9d14a3f714bd0cdc3e85128 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 11 Nov 2010 20:04:44 -0500 Subject: Reworked 1-to-1 annotator block to better testing purposes. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 69 +++++++++++----------- gnuradio-core/src/lib/general/gr_annotator_1to1.h | 42 ++++++++++--- gnuradio-core/src/lib/general/gr_annotator_1to1.i | 11 +++- .../src/lib/general/gr_annotator_1toall.cc | 2 +- .../src/lib/general/gr_annotator_1toall.i | 4 +- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 58 ++++++++++++++++-- gnuradio-core/src/lib/runtime/qa_block_tags.h | 2 +- 7 files changed, 132 insertions(+), 56 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 315285e41..7ecadcd2c 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -31,71 +31,70 @@ #include gr_annotator_1to1_sptr -gr_make_annotator_1to1 (size_t sizeof_stream_item) +gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate) { - return gnuradio::get_initial_sptr (new gr_annotator_1to1 (sizeof_stream_item)); + return gnuradio::get_initial_sptr (new gr_annotator_1to1 (sizeof_stream_item, rel_rate)); } -gr_annotator_1to1::gr_annotator_1to1 (size_t sizeof_stream_item) - : gr_sync_block ("annotator_1to1", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item) +gr_annotator_1to1::gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate) + : gr_block ("annotator_1to1", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) { set_tag_propagation_policy(TPP_ONE_TO_ONE); d_tag_counter = 0; + set_relative_rate(d_rel_rate); } gr_annotator_1to1::~gr_annotator_1to1 () { - std::cout << d_sout.str(); } int -gr_annotator_1to1::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +gr_annotator_1to1::general_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]; + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = nitems_read(0) + noutput_items; - std::vector all_tags = get_tags_in_range(0, (uint64_t)0, abs_N); - std::vector::iterator itr; - - d_sout << std::endl << "Found " << all_tags.size() << " tags." << std::endl; - d_sout.setf(std::ios::left); - d_sout << std::setw(25) << "Receiver" << std::setw(25) << "Sender" - << std::setw(10) << "nitem" << std::setw(20) << "key" - << std::setw(10) << "value" << std::endl; + uint64_t abs_N = nitems_read(0); + std::vector all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); + std::vector::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_sout << std::setw(25) << str.str() - << std::setw(25) << pmt::pmt_tuple_ref(*itr, 1) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 0) - << std::setw(20) << pmt::pmt_tuple_ref(*itr, 2) - << std::setw(10) << pmt::pmt_tuple_ref(*itr, 3) - << std::endl; + d_stored_tags.push_back(*itr); } - // Storing the current noutput_items as the value to the "noutput_items" key pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); - pmt::pmt_t value; // Work does nothing to the data stream; just copy all inputs to outputs + // Adds a new tag when the number of items read is a multiple of N + uint64_t N = 10000; int noutputs = output_items.size(); - int ninputs = input_items.size(); - for (int i = 0; i < noutputs; i++) { - value = pmt::pmt_from_uint64(d_tag_counter++); - memcpy(out[i], in[i], noutput_items * d_itemsize); - add_item_tag(i, abs_N, key, value, srcid); + for(int j = 0; j < noutput_items; j++) { + abs_N++; + + for(int i = 0; i < noutputs; i++) { + if(abs_N % N == 0) { + pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); + add_item_tag(i, abs_N, key, value, srcid); + } + + in = (const float*)input_items[i]; + out = (float*)output_items[i]; + out[j] = in[j]; + } } + consume_each(noutput_items); return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index d40135be7..99a4e98c7 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -23,33 +23,57 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H #define INCLUDED_GR_ANNOTATOR_1TO1_H -#include +#include class gr_annotator_1to1; typedef boost::shared_ptr gr_annotator_1to1_sptr; // public constructor gr_annotator_1to1_sptr -gr_make_annotator_1to1 (size_t sizeof_stream_item); +gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate=1.0); -class gr_annotator_1to1 : public gr_sync_block +/*! + * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 items it sees. The + * tags contain the name and ID of the instantiated block, use "seq" as a key, + * and have a counter that increments by 1 for every tag produced that is used + * as the tag's value. The tags are propagated using the 1-to-1 policy. + * + * It also stores a copy of all tags it sees flow past it. These tags can be + * recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ +class gr_annotator_1to1 : public gr_block { public: ~gr_annotator_1to1 (); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + float rel_rate() { return d_rel_rate; } + + + std::vector data() const + { + return d_stored_tags; + } protected: - gr_annotator_1to1 (size_t sizeof_stream_item); + gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); private: size_t d_itemsize; - std::stringstream d_sout; + float d_rel_rate; uint64_t d_tag_counter; + std::vector d_stored_tags; friend gr_annotator_1to1_sptr - gr_make_annotator_1to1 (size_t sizeof_stream_item); + gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i index 9fba558b7..f2342af55 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -22,11 +22,16 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); -gr_annotator_1to1_sptr gr_make_annotator_1to1 (size_t sizeof_stream_item); +gr_annotator_1to1_sptr gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); -class gr_annotator_1to1 : public gr_sync_block +class gr_annotator_1to1 : public gr_block { +public: + void set_rel_rate(float rrate); + float rel_rate(); + std::vector data() const; + private: - gr_annotator_1to1 (size_t sizeof_stream_item); + gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc index 1410b8b94..47002e3c9 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc @@ -66,8 +66,8 @@ gr_annotator_1toall::general_work (int noutput_items, uint64_t abs_N = nitems_read(0); std::vector all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); - std::vector::iterator itr; + std::vector::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { d_stored_tags.push_back(*itr); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.i b/gnuradio-core/src/lib/general/gr_annotator_1toall.i index 02f79bf7e..a6bd01017 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1toall.i @@ -27,8 +27,8 @@ gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item, fl class gr_annotator_1toall : public gr_block { public: - void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } - float rel_rate() { return d_rel_rate; } + void set_rel_rate(float rrate); + float rel_rate(); std::vector data() const; private: diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 4dc096f27..ee16ec108 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -137,6 +137,7 @@ qa_block_tags::t1 () } // For annotator 4, we know it gets tags from ann0 and ann2, test this + std::cout << std::endl; for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); @@ -153,11 +154,11 @@ qa_block_tags::t2 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); - gr_block_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); - gr_block_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); - gr_block_sptr ann3 (gr_make_annotator_1toall(sizeof(int))); - gr_block_sptr ann4 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1toall_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1toall_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); @@ -174,5 +175,52 @@ qa_block_tags::t2 () tb->connect(ann4, 0, snk1, 0); tb->run(); + + // Kludge together the tags that we know should result from the above graph + std::stringstream str0, str1, str2; + str0 << ann0->name() << ann0->unique_id(); + str1 << ann1->name() << ann1->unique_id(); + str2 << ann2->name() << ann2->unique_id(); + + pmt_t expected_tags3[8]; + expected_tags3[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + + pmt_t expected_tags4[8]; + expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt_from_uint64(40000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + + std::vector tags0 = ann0->data(); + std::vector tags3 = ann3->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + + // For annotator 3, we know it gets tags from ann0 and ann1, test this + for(size_t i = 0; i < tags3.size(); i++) { + std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; + //pmt_equal(tags3[i], expected_tags3[i]) + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + } + + // For annotator 4, we know it gets tags from ann0 and ann2, test this + std::cout << std::endl; + for(size_t i = 0; i < tags4.size(); i++) { + std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + } } diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index 69bc0480c..44bef9fac 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -32,7 +32,7 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST_SUITE (qa_block_tags); CPPUNIT_TEST (t0); CPPUNIT_TEST (t1); - //CPPUNIT_TEST (t2); + CPPUNIT_TEST (t2); CPPUNIT_TEST_SUITE_END (); private: -- cgit From 76e2fa796a42df7951f05f73428e178c84879b79 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 12 Nov 2010 15:04:10 -0800 Subject: make check in gr-audio-alsa now confirms ability to load guile bindings. --- gnuradio-core/src/guile/run_guile_tests.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/run_guile_tests.in b/gnuradio-core/src/guile/run_guile_tests.in index ceaa84108..3aca7bdb0 100644 --- a/gnuradio-core/src/guile/run_guile_tests.in +++ b/gnuradio-core/src/guile/run_guile_tests.in @@ -2,11 +2,11 @@ . @top_builddir@/setup_guile_test_env -# 1st argument is absolute path to component C++ shared library build directory -# 2nd argument is absolute path to hand coded guile source directory +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory # 3nd argument is absolute path to component SWIG build directory -# We're in gnuradio-core, we don't need this +# We're in gnuradio-core, we don't need these # add_local_paths \ # "" \ # "" \ -- cgit From 7ca96ad8b48b3426b470e87042c8e982664f3b9b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 13 Nov 2010 14:26:39 -0500 Subject: Renamed annotator block that goes all-to-all now so that it can take in arbitrary number of inputs and pass tags on that way. --- gnuradio-core/src/lib/general/Makefile.am | 7 +- gnuradio-core/src/lib/general/general.i | 4 +- .../src/lib/general/gr_annotator_alltoall.cc | 108 +++++++++++++++++++++ .../src/lib/general/gr_annotator_alltoall.h | 79 +++++++++++++++ .../src/lib/general/gr_annotator_alltoall.i | 38 ++++++++ 5 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 gnuradio-core/src/lib/general/gr_annotator_alltoall.cc create mode 100644 gnuradio-core/src/lib/general/gr_annotator_alltoall.h create mode 100644 gnuradio-core/src/lib/general/gr_annotator_alltoall.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index a58461165..2e52d88f3 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -176,7 +176,7 @@ libgeneral_la_SOURCES = \ gr_scrambler_bb.cc \ gr_probe_mpsk_snr_c.cc \ gr_probe_density_b.cc \ - gr_annotator_1toall.cc \ + gr_annotator_alltoall.cc \ gr_annotator_1to1.cc libgeneral_qa_la_SOURCES = \ @@ -347,7 +347,8 @@ grinclude_HEADERS = \ gr_scrambler_bb.h \ gr_probe_mpsk_snr_c.h \ gr_probe_density_b.h \ - gr_annotator_1toall.h + gr_annotator_alltoall.h \ + gr_annotator_1to1.h noinst_HEADERS = \ qa_general.h \ @@ -488,6 +489,6 @@ swiginclude_HEADERS = \ gr_scrambler_bb.i \ gr_probe_mpsk_snr_c.i \ gr_probe_density_b.i \ - gr_annotator_1toall.i \ + gr_annotator_alltoall.i \ gr_annotator_1to1.i endif diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 0dce5f68d..400f0b9b6 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -141,7 +141,7 @@ #include #include #include -#include +#include #include %} @@ -264,5 +264,5 @@ %include "gr_copy.i" %include "gr_fll_band_edge_cc.i" %include "gr_additive_scrambler_bb.i" -%include "gr_annotator_1toall.i" +%include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc new file mode 100644 index 000000000..f1fb8bc31 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -0,0 +1,108 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +gr_annotator_alltoall_sptr +gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate) +{ + return gnuradio::get_initial_sptr (new gr_annotator_alltoall (sizeof_stream_item, rel_rate)); +} + +gr_annotator_alltoall::gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate) + : gr_block ("annotator_alltoall", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) +{ + set_tag_propagation_policy(TPP_ALL_TO_ALL); + + d_tag_counter = 0; + set_relative_rate(d_rel_rate); +} + +gr_annotator_alltoall::~gr_annotator_alltoall () +{ +} + +int +gr_annotator_alltoall::general_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]; + + std::stringstream str; + str << name() << unique_id(); + + uint64_t abs_N = 0; + int ninputs = input_items.size(); + for(int i = 0; i < ninputs; i++) { + abs_N = nitems_read(i); + std::vector all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); + + std::vector::iterator itr; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_stored_tags.push_back(*itr); + } + } + + // Source ID and key for any tag that might get applied from this block + pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); + pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); + + // Work does nothing to the data stream; just copy all inputs to outputs + // Adds a new tag when the number of items read is a multiple of N + uint64_t N = 10000; + int noutputs = output_items.size(); + for(int j = 0; j < noutput_items; j++) { + abs_N++; + + for(int i = 0; i < noutputs; i++) { + if(abs_N % N == 0) { + pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); + add_item_tag(i, abs_N, key, value, srcid); + } + + // Sum all of the inputs together for each output. Just 'cause. + out = (float*)output_items[i]; + out[j] = 0; + for(int ins = 0; ins < ninputs; ins++) { + in = (const float*)input_items[ins]; + out[j] += in[j]; + } + } + } + + consume_each(noutput_items); + return noutput_items; +} diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h new file mode 100644 index 000000000..30480e1ef --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H + +#include + +class gr_annotator_alltoall; +typedef boost::shared_ptr gr_annotator_alltoall_sptr; + +// public constructor +gr_annotator_alltoall_sptr +gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate=1.0); + +/*! + * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. + * + * This block creates tags to be sent downstream every 10,000 items it sees. The + * tags contain the name and ID of the instantiated block, use "seq" as a key, + * and have a counter that increments by 1 for every tag produced that is used + * as the tag's value. The tags are propagated using the all-to-all policy. + * + * It also stores a copy of all tags it sees flow past it. These tags can be + * recalled externally with the data() member. + * + * This block is only meant for testing and showing how to use the tags. + */ +class gr_annotator_alltoall : public gr_block +{ + public: + ~gr_annotator_alltoall (); + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + float rel_rate() { return d_rel_rate; } + + + std::vector data() const + { + return d_stored_tags; + } + +protected: + gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); + + private: + size_t d_itemsize; + float d_rel_rate; + uint64_t d_tag_counter; + std::vector d_stored_tags; + + friend gr_annotator_alltoall_sptr + gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i new file mode 100644 index 000000000..e7ae0b204 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i @@ -0,0 +1,38 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); + +gr_annotator_alltoall_sptr gr_make_annotator_alltoall (size_t sizeof_stream_item, + float rel_rate); + +class gr_annotator_alltoall : public gr_block +{ +public: + void set_rel_rate(float rrate); + float rel_rate(); + std::vector data() const; + +private: + gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); +}; + -- cgit From 74d17ff495c97fbb9eb3bd3cacf08a8dcdf677b6 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 13 Nov 2010 14:27:54 -0500 Subject: Fixing how 1-to-1 annotator handles inputs to better test propagataion method. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 7ecadcd2c..273f684ed 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -64,12 +64,16 @@ gr_annotator_1to1::general_work (int noutput_items, std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = nitems_read(0); - std::vector all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); + uint64_t abs_N = 0; + int ninputs = ninput_items.size(); + for(int i = 0; i < ninputs; i++) { + abs_N = nitems_read(i); + std::vector all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); - std::vector::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); + std::vector::iterator itr; + for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { + d_stored_tags.push_back(*itr); + } } // Storing the current noutput_items as the value to the "noutput_items" key @@ -78,12 +82,16 @@ gr_annotator_1to1::general_work (int noutput_items, // Work does nothing to the data stream; just copy all inputs to outputs // Adds a new tag when the number of items read is a multiple of N + abs_N = nitems_read(0); uint64_t N = 10000; int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { abs_N++; - for(int i = 0; i < noutputs; i++) { + // the min() is a hack to make sure this doesn't segfault if there are a + // different number of ins and outs. This is specifically designed to test + // the 1-to-1 propagation policy. + for(int i = 0; i < std::min(noutputs, ninputs); i++) { if(abs_N % N == 0) { pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); -- cgit From 3fb01df05227913c2cc8cde6cb651dc1c9a81ff9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 13 Nov 2010 14:28:37 -0500 Subject: Block executor propagation method returns an error indicator to stop the flowgraph in an error instead of throwing. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 840cf8e5c..86d10f81b 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -87,7 +87,7 @@ min_available_space (gr_block_detail *d, int output_multiple) return min_space; } -static void +static int propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, const std::vector &start_nitems_read) { @@ -95,17 +95,18 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute if(d->sink_p()) { - return; + return 0; } switch(policy) { case(gr_block::TPP_DONT): - return; + return 0; break; case(gr_block::TPP_ALL_TO_ALL): // every tag on every input propogates to everyone downstream for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], d->nitems_read(i)); + std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], + d->nitems_read(i)); std::vector::iterator t; for(t = tuple.begin(); t != tuple.end(); t++ ) { for(int o = 0; o < d->noutputs(); o++) @@ -119,20 +120,24 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, // type of tag-propagation system is selected in gr_block_detail if(d->ninputs() == d->noutputs()) { for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], d->nitems_read(i)); + std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], + d->nitems_read(i)); std::vector::iterator t; for(t = tuple.begin(); t != tuple.end(); t++ ) { d->output(i)->add_item_tag(*t); } } } - else - throw std::invalid_argument ("propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs"); + else { + std::cerr << "Error: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl; + return -1; + } break; default: - return; + return 0; } + return 0; } gr_block_executor::gr_block_executor (gr_block_sptr block) @@ -353,7 +358,8 @@ gr_block_executor::run_one_iteration() LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); - propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read); + if(propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read) == -1) + goto were_done; if (n == gr_block::WORK_DONE) goto were_done; -- cgit From 77d778896b72379676d2b00e591f9bbb5f6fcc44 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 13 Nov 2010 14:29:11 -0500 Subject: More test methods. Better testing of the all-to-all policy and more tests for the 1-to-1. --- .../src/lib/general/gr_annotator_1toall.cc | 99 --------------- .../src/lib/general/gr_annotator_1toall.h | 79 ------------ .../src/lib/general/gr_annotator_1toall.i | 37 ------ gnuradio-core/src/lib/runtime/qa_block_tags.cc | 139 +++++++++++++++++++-- gnuradio-core/src/lib/runtime/qa_block_tags.h | 4 + 5 files changed, 134 insertions(+), 224 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.cc delete mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.h delete mode 100644 gnuradio-core/src/lib/general/gr_annotator_1toall.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc b/gnuradio-core/src/lib/general/gr_annotator_1toall.cc deleted file mode 100644 index 47002e3c9..000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -gr_annotator_1toall_sptr -gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate) -{ - return gnuradio::get_initial_sptr (new gr_annotator_1toall (sizeof_stream_item, rel_rate)); -} - -gr_annotator_1toall::gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate) - : gr_block ("annotator_1toall", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) -{ - set_tag_propagation_policy(TPP_ALL_TO_ALL); - - d_tag_counter = 0; - set_relative_rate(d_rel_rate); -} - -gr_annotator_1toall::~gr_annotator_1toall () -{ -} - -int -gr_annotator_1toall::general_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]; - - std::stringstream str; - str << name() << unique_id(); - - uint64_t abs_N = nitems_read(0); - std::vector all_tags = get_tags_in_range(0, abs_N, abs_N + noutput_items); - - std::vector::iterator itr; - for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } - - // Source ID and key for any tag that might get applied from this block - pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str()); - pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); - - // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of N - uint64_t N = 10000; - int noutputs = output_items.size(); - for(int j = 0; j < noutput_items; j++) { - abs_N++; - - for(int i = 0; i < noutputs; i++) { - if(abs_N % N == 0) { - pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); - add_item_tag(i, abs_N, key, value, srcid); - } - - out = (float*)output_items[i]; - out[j] = in[j]; - } - } - - consume_each(noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.h b/gnuradio-core/src/lib/general/gr_annotator_1toall.h deleted file mode 100644 index e118fd7a0..000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -#ifndef INCLUDED_GR_ANNOTATOR_1TOALL_H -#define INCLUDED_GR_ANNOTATOR_1TOALL_H - -#include - -class gr_annotator_1toall; -typedef boost::shared_ptr gr_annotator_1toall_sptr; - -// public constructor -gr_annotator_1toall_sptr -gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate=1.0); - -/*! - * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. - * - * This block creates tags to be sent downstream every 10,000 items it sees. The - * tags contain the name and ID of the instantiated block, use "seq" as a key, - * and have a counter that increments by 1 for every tag produced that is used - * as the tag's value. The tags are propagated using the all-to-all policy. - * - * It also stores a copy of all tags it sees flow past it. These tags can be - * recalled externally with the data() member. - * - * This block is only meant for testing and showing how to use the tags. - */ -class gr_annotator_1toall : public gr_block -{ - public: - ~gr_annotator_1toall (); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } - float rel_rate() { return d_rel_rate; } - - - std::vector data() const - { - return d_stored_tags; - } - -protected: - gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate); - - private: - size_t d_itemsize; - float d_rel_rate; - uint64_t d_tag_counter; - std::vector d_stored_tags; - - friend gr_annotator_1toall_sptr - gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1toall.i b/gnuradio-core/src/lib/general/gr_annotator_1toall.i deleted file mode 100644 index a6bd01017..000000000 --- a/gnuradio-core/src/lib/general/gr_annotator_1toall.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,annotator_1toall); - -gr_annotator_1toall_sptr gr_make_annotator_1toall (size_t sizeof_stream_item, float rel_rate); - -class gr_annotator_1toall : public gr_block -{ -public: - void set_rel_rate(float rrate); - float rel_rate(); - std::vector data() const; - -private: - gr_annotator_1toall (size_t sizeof_stream_item, float rel_rate); -}; - diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index ee16ec108..2560b7860 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -75,11 +75,11 @@ qa_block_tags::t1 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1toall_sptr ann0 (gr_make_annotator_1toall(sizeof(int))); - gr_annotator_1toall_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); - gr_annotator_1toall_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); - gr_annotator_1toall_sptr ann3 (gr_make_annotator_1toall(sizeof(int))); - gr_annotator_1toall_sptr ann4 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); @@ -144,19 +144,112 @@ qa_block_tags::t1 () } } - void qa_block_tags::t2 () { printf("\nqa_block_tags::t2\n"); + int N = 40000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(sizeof(int))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); + gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + gr_block_sptr snk2 (gr_make_null_sink(sizeof(int))); + + tb->connect(src, 0, head, 0); + tb->connect(head, 0, ann0, 0); + + tb->connect(ann0, 0, ann1, 0); + tb->connect(ann0, 1, ann1, 1); + tb->connect(ann1, 0, ann2, 0); + tb->connect(ann1, 1, ann3, 0); + tb->connect(ann1, 2, ann4, 0); + + tb->connect(ann2, 0, snk0, 0); + tb->connect(ann3, 0, snk1, 0); + tb->connect(ann4, 0, snk2, 0); + + tb->run(); + + // Kludge together the tags that we know should result from the above graph + std::stringstream str0, str1; + str0 << ann0->name() << ann0->unique_id(); + str1 << ann1->name() << ann1->unique_id(); + + pmt_t expected_tags2[12]; + expected_tags2[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); + expected_tags2[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); + expected_tags2[2] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags2[3] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags2[4] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags2[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags2[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(6)); + expected_tags2[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags2[8] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags2[9] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(9)); + expected_tags2[10] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags2[11] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + + pmt_t expected_tags4[12]; + expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); + expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(5)); + expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(8)); + expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags4[8] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[9] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(11)); + expected_tags4[10] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags4[11] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + + std::vector tags0 = ann0->data(); + std::vector tags1 = ann1->data(); + std::vector tags2 = ann2->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); + + // For annotator[2-4], we know it gets tags from ann0 and ann1 + // but the tags from the different outputs of ann1 are different for each. + // Just testing ann2 and ann4; if they are correct it would be + // inconceivable for ann3 to have it wrong. + for(size_t i = 0; i < tags2.size(); i++) { + std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; + //pmt_equal(tags2[i], expected_tags2[i]) + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); + } + + std::cout << std::endl; + for(size_t i = 0; i < tags4.size(); i++) { + std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; + //pmt_equal(tags4[i], expected_tags4[i]) + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); + } +} + + +void +qa_block_tags::t3 () +{ + printf("\nqa_block_tags::t3\n"); + int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); - gr_annotator_1toall_sptr ann1 (gr_make_annotator_1toall(sizeof(int))); - gr_annotator_1toall_sptr ann2 (gr_make_annotator_1toall(sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(sizeof(int))); gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); @@ -224,3 +317,31 @@ qa_block_tags::t2 () } } + +void +qa_block_tags::t4 () +{ + printf("\nqa_block_tags::t4\n"); + + int N = 40000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(sizeof(int))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); + gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); + + // using 1-to-1 tag propagation without having equal number of + // ins and outs. Make sure this works; will just exit run early. + tb->connect(src, 0, head, 0); + tb->connect(head, 0, ann0, 0); + tb->connect(ann0, 0, ann1, 0); + tb->connect(ann0, 1, ann2, 0); + tb->connect(ann1, 0, snk0, 0); + tb->connect(ann2, 0, snk1, 0); + + tb->run(); +} + diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index 44bef9fac..2bf134d96 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -33,12 +33,16 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST (t0); CPPUNIT_TEST (t1); CPPUNIT_TEST (t2); + CPPUNIT_TEST (t3); + CPPUNIT_TEST (t4); CPPUNIT_TEST_SUITE_END (); private: void t0 (); void t1 (); void t2 (); + void t3 (); + void t4 (); }; -- cgit From abde5affda1533c518cce06d5edcffa4eda52340 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 13 Nov 2010 16:19:48 -0800 Subject: dail-tone.wfd example waveform can be loaded and run by gr-run-waveform. Write new app, gr-run-waveform, that reads waveforms and runs them. We'll need to turn this into a small piece of C/C++ code that embeds guile, but the guts of it is working. --- gnuradio-core/src/guile/Makefile.am | 6 ++- gnuradio-core/src/guile/gnuradio/waveform-spec.scm | 36 --------------- gnuradio-core/src/guile/gnuradio/waveform.scm | 54 ++++++++++++++++++++++ gnuradio-core/src/lib/.gitignore | 2 - 4 files changed, 58 insertions(+), 40 deletions(-) delete mode 100644 gnuradio-core/src/guile/gnuradio/waveform-spec.scm create mode 100644 gnuradio-core/src/guile/gnuradio/waveform.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index f4cc14175..0c0becbc1 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -22,7 +22,8 @@ include $(top_srcdir)/Makefile.common TESTS = run_guile_tests EXTRA_DIST = \ - run_guile_tests.in + run_guile_tests.in \ + $(GUILE_TESTS) # These are the hand-code guile files for gnuradio-core. # @@ -36,10 +37,11 @@ nobase_guile_DATA = \ gnuradio/core.scm \ gnuradio/export-safely.scm \ gnuradio/runtime-shim.scm \ + gnuradio/waveform.scm \ gnuradio/test-suite/guile-test \ gnuradio/test-suite/lib.scm -noinst_DATA = \ +GUILE_TESTS = \ tests/00_runtime_basics.test \ tests/00_runtime_ctors.test \ tests/filter_ctors.test \ diff --git a/gnuradio-core/src/guile/gnuradio/waveform-spec.scm b/gnuradio-core/src/guile/gnuradio/waveform-spec.scm deleted file mode 100644 index 956a36106..000000000 --- a/gnuradio-core/src/guile/gnuradio/waveform-spec.scm +++ /dev/null @@ -1,36 +0,0 @@ -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -(define-module (gnuradio waveform-spec) - #:use-module (ice-9 syncase) - #:export-syntax waveform-spec) - -(define-syntax waveform-spec - (syntax-rules (vars blocks connections) - ((_ (args ...) - (vars (v-name v-val) ...) - (blocks (b-name b-val) ...) - (connections (endpoint1 endpoint2 ...) ...)) - (lambda (args ...) - (let* ((v-name v-val) ... - (b-name b-val) ... - (tb (gr:top-block-swig "waveform-top-block"))) - (gr:connect tb endpoint1 endpoint2 ...) ... - tb))))) - diff --git a/gnuradio-core/src/guile/gnuradio/waveform.scm b/gnuradio-core/src/guile/gnuradio/waveform.scm new file mode 100644 index 000000000..0031be931 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/waveform.scm @@ -0,0 +1,54 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +(define-module (gnuradio waveform) + #:use-module (ice-9 syncase) + #:export-syntax (define-waveform)) + + +(define *registry* '()) ; alist +(define *last-registered* #f) + + +(define-syntax define-waveform + (syntax-rules (vars blocks connections) + ((_ (name cmd-line-args) + (vars (v-name v-val) ...) + (blocks (b-name b-val) ...) + (connections (endpoint1 endpoint2 ...) ...)) + (waveform-register 'name + (lambda (cmd-line-args) + (let* ((v-name v-val) ... + (b-name b-val) ... + (tb (gr:top-block-swig "waveform-top-block"))) + (gr:connect tb endpoint1 endpoint2 ...) ... + tb)))))) + + +(define-public (waveform-register name thunk) + (set! *registry* (assoc-set! *registry* name thunk)) + (set! *last-registered* thunk) + #t) + +(define-public (waveform-lookup name) + (let ((r (assoc name *registry*))) + (and r (cdr r)))) + +(define-public (waveform-last-registered) + *last-registered*) diff --git a/gnuradio-core/src/lib/.gitignore b/gnuradio-core/src/lib/.gitignore index e3bc1ee6a..0d5077da5 100644 --- a/gnuradio-core/src/lib/.gitignore +++ b/gnuradio-core/src/lib/.gitignore @@ -1,7 +1,5 @@ /Makefile /Makefile.in -/.la -/.lo /.deps /.libs /*.la -- cgit From 222c6c5be69575c00d6396b95d523e0dfa19f2c3 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 14 Nov 2010 00:04:11 -0500 Subject: Fixing some bugs. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 3 +- .../src/lib/general/gr_annotator_alltoall.cc | 3 +- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 18 +-- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 122 +++++++++++---------- 4 files changed, 77 insertions(+), 69 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 273f684ed..8b1da5778 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -86,8 +86,6 @@ gr_annotator_1to1::general_work (int noutput_items, uint64_t N = 10000; int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { - abs_N++; - // the min() is a hack to make sure this doesn't segfault if there are a // different number of ins and outs. This is specifically designed to test // the 1-to-1 propagation policy. @@ -101,6 +99,7 @@ gr_annotator_1to1::general_work (int noutput_items, out = (float*)output_items[i]; out[j] = in[j]; } + abs_N++; } consume_each(noutput_items); diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index f1fb8bc31..699d5a256 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -85,8 +85,6 @@ gr_annotator_alltoall::general_work (int noutput_items, uint64_t N = 10000; int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { - abs_N++; - for(int i = 0; i < noutputs; i++) { if(abs_N % N == 0) { pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); @@ -101,6 +99,7 @@ gr_annotator_alltoall::general_work (int noutput_items, out[j] += in[j]; } } + abs_N++; } consume_each(noutput_items); diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 86d10f81b..dd0993ec7 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -87,7 +87,7 @@ min_available_space (gr_block_detail *d, int output_multiple) return min_space; } -static int +static bool propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, const std::vector &start_nitems_read) { @@ -95,12 +95,12 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, // if a sink, we don't need to move downstream; // and do not bother if block uses TAGS_NONE attribute if(d->sink_p()) { - return 0; + return true; } switch(policy) { case(gr_block::TPP_DONT): - return 0; + return true; break; case(gr_block::TPP_ALL_TO_ALL): // every tag on every input propogates to everyone downstream @@ -129,15 +129,15 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, } } else { - std::cerr << "Error: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl; - return -1; + std::cerr << "Error: gr_block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl; + return false; } break; default: - return 0; + return true; } - return 0; + return true; } gr_block_executor::gr_block_executor (gr_block_sptr block) @@ -350,7 +350,7 @@ gr_block_executor::run_one_iteration() // determine where to start looking for new tags as 1 past nitems read for (int i = 0; i < d->ninputs(); i++) - d_start_nitems_read[i] = d->nitems_read(i)+1; + d_start_nitems_read[i] = d->nitems_read(i); // Do the actual work of the block int n = m->general_work (noutput_items, d_ninput_items, @@ -358,7 +358,7 @@ gr_block_executor::run_one_iteration() LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); - if(propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read) == -1) + if(!propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read)) goto were_done; if (n == gr_block::WORK_DONE) diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 2560b7860..8612a1067 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -103,24 +103,24 @@ qa_block_tags::t1 () str2 << ann2->name() << ann2->unique_id(); pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt_from_uint64(40000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::vector tags0 = ann0->data(); std::vector tags3 = ann3->data(); @@ -130,6 +130,7 @@ qa_block_tags::t1 () CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); // For annotator 3, we know it gets tags from ann0 and ann1, test this + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; //pmt_equal(tags3[i], expected_tags3[i]) @@ -138,6 +139,7 @@ qa_block_tags::t1 () // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); @@ -183,42 +185,48 @@ qa_block_tags::t2 () str1 << ann1->name() << ann1->unique_id(); pmt_t expected_tags2[12]; - expected_tags2[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[4] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(6)); - expected_tags2[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags2[8] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags2[9] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(9)); - expected_tags2[10] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags2[11] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags2[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags2[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags2[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags2[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags2[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(6)); + expected_tags2[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags2[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags2[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(9)); + expected_tags2[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags2[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); pmt_t expected_tags4[12]; - expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); - expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(5)); - expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(8)); - expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags4[8] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[9] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(11)); - expected_tags4[10] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags4[11] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + expected_tags4[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); + expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags4[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(5)); + expected_tags4[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(8)); + expected_tags4[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags4[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(11)); + expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::vector tags0 = ann0->data(); std::vector tags1 = ann1->data(); std::vector tags2 = ann2->data(); + std::vector tags3 = ann4->data(); std::vector tags4 = ann4->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); + // Make sure the rest all have 12 tags + CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12); + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12); + // For annotator[2-4], we know it gets tags from ann0 and ann1 // but the tags from the different outputs of ann1 are different for each. // Just testing ann2 and ann4; if they are correct it would be @@ -276,24 +284,24 @@ qa_block_tags::t3 () str2 << ann2->name() << ann2->unique_id(); pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt_from_uint64(40000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(6)); + expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); + expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt_from_uint64(40000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(7)); + expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); + expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); + expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); + expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); std::vector tags0 = ann0->data(); std::vector tags3 = ann3->data(); @@ -303,6 +311,7 @@ qa_block_tags::t3 () CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); // For annotator 3, we know it gets tags from ann0 and ann1, test this + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; //pmt_equal(tags3[i], expected_tags3[i]) @@ -311,6 +320,7 @@ qa_block_tags::t3 () // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); -- cgit From 11b2b7c40048bee5201bd10dd753a9471cd6345d Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 14 Nov 2010 01:20:44 -0500 Subject: Adds argument to annotator test blocks to determine when they add a new tag. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 16 +++++----- gnuradio-core/src/lib/general/gr_annotator_1to1.h | 15 ++++++--- gnuradio-core/src/lib/general/gr_annotator_1to1.i | 7 +++-- .../src/lib/general/gr_annotator_alltoall.cc | 17 +++++----- .../src/lib/general/gr_annotator_alltoall.h | 15 ++++++--- .../src/lib/general/gr_annotator_alltoall.i | 5 +-- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 36 +++++++++++----------- 7 files changed, 67 insertions(+), 44 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 8b1da5778..d2d2599d3 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -31,16 +31,19 @@ #include gr_annotator_1to1_sptr -gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate) +gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate) { - return gnuradio::get_initial_sptr (new gr_annotator_1to1 (sizeof_stream_item, rel_rate)); + return gnuradio::get_initial_sptr (new gr_annotator_1to1 + (when, sizeof_stream_item, rel_rate)); } -gr_annotator_1to1::gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate) +gr_annotator_1to1::gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate) : gr_block ("annotator_1to1", gr_make_io_signature (1, -1, sizeof_stream_item), gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when(when) { set_tag_propagation_policy(TPP_ONE_TO_ONE); @@ -81,16 +84,15 @@ gr_annotator_1to1::general_work (int noutput_items, pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of N + // Adds a new tag when the number of items read is a multiple of d_when abs_N = nitems_read(0); - uint64_t N = 10000; int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { // the min() is a hack to make sure this doesn't segfault if there are a // different number of ins and outs. This is specifically designed to test // the 1-to-1 propagation policy. for(int i = 0; i < std::min(noutputs, ninputs); i++) { - if(abs_N % N == 0) { + if(abs_N % d_when == 0) { pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index 99a4e98c7..ef14f9b52 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -30,7 +30,8 @@ typedef boost::shared_ptr gr_annotator_1to1_sptr; // public constructor gr_annotator_1to1_sptr -gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate=1.0); +gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate=1.0); /*! * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. @@ -54,7 +55,10 @@ class gr_annotator_1to1 : public gr_block gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + void set_rel_rate(float rrate) { + d_rel_rate = rrate; + set_relative_rate(d_rel_rate); + } float rel_rate() { return d_rel_rate; } @@ -64,16 +68,19 @@ class gr_annotator_1to1 : public gr_block } protected: - gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); + gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate); private: size_t d_itemsize; float d_rel_rate; + uint64_t d_when; uint64_t d_tag_counter; std::vector d_stored_tags; friend gr_annotator_1to1_sptr - gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); + gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i index f2342af55..d8f10b44f 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -22,7 +22,9 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); -gr_annotator_1to1_sptr gr_make_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); +gr_annotator_1to1_sptr gr_make_annotator_1to1 (uint64_t when, + size_t sizeof_stream_item, + float rel_rate); class gr_annotator_1to1 : public gr_block { @@ -32,6 +34,7 @@ public: std::vector data() const; private: - gr_annotator_1to1 (size_t sizeof_stream_item, float rel_rate); + gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + float rel_rate); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index 699d5a256..88419fe0d 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -31,16 +31,20 @@ #include gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate) +gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + float rel_rate) { - return gnuradio::get_initial_sptr (new gr_annotator_alltoall (sizeof_stream_item, rel_rate)); + return gnuradio::get_initial_sptr (new gr_annotator_alltoall + (when, sizeof_stream_item, rel_rate)); } -gr_annotator_alltoall::gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate) +gr_annotator_alltoall::gr_annotator_alltoall (uint64_t when, + size_t sizeof_stream_item, + float rel_rate) : gr_block ("annotator_alltoall", gr_make_io_signature (1, -1, sizeof_stream_item), gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate) + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when(when) { set_tag_propagation_policy(TPP_ALL_TO_ALL); @@ -81,12 +85,11 @@ gr_annotator_alltoall::general_work (int noutput_items, pmt::pmt_t key = pmt::pmt_string_to_symbol("seq"); // Work does nothing to the data stream; just copy all inputs to outputs - // Adds a new tag when the number of items read is a multiple of N - uint64_t N = 10000; + // Adds a new tag when the number of items read is a multiple of d_when int noutputs = output_items.size(); for(int j = 0; j < noutput_items; j++) { for(int i = 0; i < noutputs; i++) { - if(abs_N % N == 0) { + if(abs_N % d_when == 0) { pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++); add_item_tag(i, abs_N, key, value, srcid); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h index 30480e1ef..d6d2f1503 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -30,7 +30,8 @@ typedef boost::shared_ptr gr_annotator_alltoall_sptr; // public constructor gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate=1.0); +gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + float rel_rate=1.0); /*! * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. @@ -54,7 +55,10 @@ class gr_annotator_alltoall : public gr_block gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - void set_rel_rate(float rrate) { d_rel_rate = rrate; set_relative_rate(d_rel_rate); } + void set_rel_rate(float rrate) { + d_rel_rate = rrate; + set_relative_rate(d_rel_rate); + } float rel_rate() { return d_rel_rate; } @@ -64,16 +68,19 @@ class gr_annotator_alltoall : public gr_block } protected: - gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); + gr_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + float rel_rate); private: size_t d_itemsize; float d_rel_rate; + uint64_t d_when; uint64_t d_tag_counter; std::vector d_stored_tags; friend gr_annotator_alltoall_sptr - gr_make_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); + gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + float rel_rate); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i index e7ae0b204..c6abb1b5e 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i @@ -22,7 +22,8 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); -gr_annotator_alltoall_sptr gr_make_annotator_alltoall (size_t sizeof_stream_item, +gr_annotator_alltoall_sptr gr_make_annotator_alltoall (uint64_t when, + size_t sizeof_stream_item, float rel_rate); class gr_annotator_alltoall : public gr_block @@ -33,6 +34,6 @@ public: std::vector data() const; private: - gr_annotator_alltoall (size_t sizeof_stream_item, float rel_rate); + gr_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, float rel_rate); }; diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 8612a1067..9c4dac698 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -75,11 +75,11 @@ qa_block_tags::t1 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); @@ -155,11 +155,11 @@ qa_block_tags::t2 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(sizeof(int))); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk2 (gr_make_null_sink(sizeof(int))); @@ -255,11 +255,11 @@ qa_block_tags::t3 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(sizeof(int))); - gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(sizeof(int))); - gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int))); + gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); @@ -337,9 +337,9 @@ qa_block_tags::t4 () gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(sizeof(int))); - gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(sizeof(int))); - gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(sizeof(int))); + gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); + gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int))); + gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); -- cgit From b7667afd81b8303a542204ac05ffa969519702af Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 09:05:16 -0800 Subject: Fixed as many problems in general_ctors.test as I could quickly. --- gnuradio-core/src/guile/tests/general_ctors.test | 111 ++++++++++----------- .../src/lib/general/gr_clock_recovery_mm_cc.i | 7 +- .../src/lib/general/gr_clock_recovery_mm_ff.i | 7 +- gnuradio-core/src/lib/general/gr_fft_vfc.i | 3 +- 4 files changed, 61 insertions(+), 67 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index d9f44a12d..5cdff5c3f 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -54,12 +54,12 @@ ;;; ./general/gr_agc_ff.h (pass-if (true? (gr:agc-ff 0 0 0 0))) -;;; ./general/gr_align_on_samplenumbers_ss.h FIXME: throws +;;; ./general/gr_align_on_samplenumbers_ss.h (pass-if (true? (gr:align-on-samplenumbers-ss 2 128))) -;; (pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0))) +(pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0))) -;;; ./general/gr_bin_statistics_f.h FIXME: not found -;; (pass-if (true? (gr:bin-statistics-f 0 0 0 0 0))) +;;; ./general/gr_bin_statistics_f.h WONTFIX: requires gr_feval_dd & swig directors +;;;(pass-if (true? (gr:bin-statistics-f 1 (gr:msg-queue) 0 0 0))) ;;; ./general/gr_binary_slicer_fb.h (pass-if (true? (gr:binary-slicer-fb))) @@ -70,19 +70,19 @@ ;;; ./general/gr_char_to_float.h (pass-if (true? (gr:char-to-float))) -;;; ./general/gr_check_counting_s.h FIXME: not found -;; (pass-if (true? (gr:check-counting-s false))) +;;; ./general/gr_check_counting_s.h +(pass-if (true? (gr:check-counting-s #f))) -;;; ./general/gr_check_lfsr_32k_s.h FIXME: not found -;; (pass-if (true? (gr:check-lfsr-2k-s))) +;;; ./general/gr_check_lfsr_32k_s.h +(pass-if (true? (gr:check-lfsr-32k-s))) -;;; ./general/gr_clock_recovery_mm_cc.h FIXME: throw test fails +;;; ./general/gr_clock_recovery_mm_cc.h (pass-if (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) -;; (pass-if-throw "confirm throw gr:clock-recovery-mm-cc" #t (true? (gr:clock-recovery-mm-cc 1 1 1 1 1))) +(pass-if-throw "confirm throw gr:clock-recovery-mm-cc" #t (true? (gr:clock-recovery-mm-cc -1 1 1 1 1))) -;;; ./general/gr_clock_recovery_mm_ff.h FIXME: throw test fails +;;; ./general/gr_clock_recovery_mm_ff.h (pass-if (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) -;; (pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff 1 1 1 1 1))) +(pass-if-throw "confirm throw gr:clock-recovery-mm-ff" #t (true? (gr:clock-recovery-mm-ff -1 1 1 1 1))) ;;; ./general/gr_complex_to_interleaved_short.h (pass-if (true? (gr:complex-to-interleaved-short))) @@ -98,17 +98,19 @@ ;;; ./general/gr_conjugate_cc.h (pass-if (true? (gr:conjugate-cc))) -;;; ./general/gr_constellation_decoder_cb.h FIXME: not found +;;; ./general/gr_constellation_decoder_cb.h FIXME: wrong-arg-type (not sure why...) ;gr_constellation_decoder_cb (const std::vector &sym_position, ; const std::vector &sym_value_out); -;; (pass-if (true? (gr:constellation_decoder_cb #(1+3i 23+5i) #(1 2)))) +;; (pass-if (true? (gr:constellation-decoder-cb #(2+3i 23+5i) #(0 1)))) ;;; ./general/gr_copy.h (pass-if (true? (gr:copy 1))) ;;; ./general/gr_correlate_access_code_bb.h (pass-if (true? (gr:correlate-access-code-bb "foo" 0))) -;; (pass-if-throw "confirm throw correlate-access-code-bb" #t (true? (gr:correlate-access-code-bb "foo" -1))) FIXME: throws +(pass-if-throw "confirm throw correlate-access-code-bb" #t + (true? (gr:correlate-access-code-bb + "00000000000000000000000000000000000000000000000000000000000000000" 0))) ;;; ./general/gr_costas_loop_cc.h (pass-if (true? (gr:costas-loop-cc 0 0 0 0 2))) @@ -117,8 +119,8 @@ ;;; ./general/gr_cpfsk_bc.h (pass-if (true? (gr:cpfsk-bc 1 1 1))) -;;; ./general/gr_ctcss_squelch_ff.h FIXME: not found -;; (pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 true))) +;;; ./general/gr_ctcss_squelch_ff.h +(pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 #t))) ;;; ./general/gr_decode_ccsds_27_fb.h (pass-if (true? (gr:decode-ccsds-27-fb))) @@ -147,22 +149,20 @@ ;;; ./general/gr_encode_ccsds_27_bb.h (pass-if (true? (gr:encode-ccsds-27-bb))) -;;; ./general/gr_fake_channel_coder_pp.h FIXME: not found -;; (pass-if (true? (gr:fake-channel-coder-pp 1 1))) -;; (pass-if-throw "confirm throw" #t (true? (gr:fake-channel-coder-pp -1 1))) +;;; ./general/gr_fake_channel_coder_pp.h FIXME: file name doesn't match class name +(pass-if (true? (gr:fake-channel-encoder-pp 1 1))) +(pass-if-throw "confirm throw" #t (true? (gr:fake-channel-encoder-pp -1 1))) ;;; ./general/gr_feedforward_agc_cc.h (pass-if (true? (gr:feedforward-agc-cc 1 1))) -;;; ./general/gr_fft_vcc.h FIXME: not found -;; (pass-if (true? (gr:fft-vcc 1 false #(1.0 2.0) true))) +;;; ./general/gr_fft_vcc.h +(pass-if (true? (gr:fft-vcc 1 #f #(1.0 2.0) #t))) -;;; ./general/gr_fft_vcc_fftw.h FIXME: not found -;; (pass-if (true? (gr:fft-vcc-fftw 1 #(1.0 2.0) false))) - -;;; ./general/gr_fft_vfc.h FIXME: not found +;;; ./general/gr_fft_vfc.h ;; bool set_window(const std::vector &window); -;; (pass-if (true? (gr:fft_vfc #(1.0 2.0)))) +(pass-if (true? (gr:fft-vfc 4 #t #(1.0 2.0 3.0 4.0)))) +(pass-if-throw "confirm throw gr:fft-vfc" #t (true? (gr:fft-vfc 4 #f #(1.0 2.0 3.0 4.0)))) ;;; ./general/gr_fll_band_edge_cc.h (pass-if (true? (gr:fll-band-edge-cc 0 0 0 0 0))) @@ -182,19 +182,19 @@ ;;; ./general/gr_fmdet_cf.h (pass-if (true? (gr:fmdet-cf 0 0 0 0))) -;;; ./general/gr_framer_sink_1.h FIXME: not found -;; (pass-if (true? (gr:framer-sink-1))) +;;; ./general/gr_framer_sink_1.h +(pass-if (true? (gr:framer-sink-1 (gr:msg-queue)))) ;;; ./general/gr_frequency_modulator_fc.h (pass-if (true? (gr:frequency-modulator-fc 0))) -;;; ./general/gr_glfsr_source_b.h FIXME: not found -;; (pass-if (true? (gr: glfsr-source-b 0 true 0 0))) -;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_b 33 true 0 0))) +;;; ./general/gr_glfsr_source_b.h +(pass-if (true? (gr:glfsr-source-b 1 #t 0 1))) +(pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_b 33 #t 0 0))) -;;; ./general/gr_glfsr_source_f.h FIXME: not found -;; (pass-if (true? (gr:glfsr-source-f 1 true 1 1))) -;; (pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_f 33 true 0 0))) +;;; ./general/gr_glfsr_source_f.h +(pass-if (true? (gr:glfsr-source-f 1 #t 1 1))) +(pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_f 33 #t 0 0))) ;;; ./general/gr_head.h (pass-if (true? (gr:head 1 1))) @@ -205,9 +205,6 @@ ;;; ./general/gr_interleaved_short_to_complex.h (pass-if (true? (gr:interleaved-short-to-complex))) -;;; ./general/gr_iqcomp_cc.h FIXME: not found -;; (pass-if (true? (gr:iqcomp-cc 1 1))) - ;;; ./general/gr_keep_one_in_n.h (pass-if (true? (gr:keep-one-in-n 1 1))) @@ -242,16 +239,10 @@ ;;; ./general/gr_null_source.h (pass-if (true? (gr:null-source 1))) -;;; ./general/gr_ofdm_bpsk_demapper.h FIXME: not found -;; (pass-if (true? (gr:ofdm-bpsk-demapper 1))) - ;;; ./general/gr_ofdm_cyclic_prefixer.h (pass-if (true? (gr:ofdm-cyclic-prefixer 1 1))) -;;; ./general/gr_ofdm_demapper_vcb.h FIXME: not found -;; (pass-if (true? (gr:ofdm-mapper-bcv 1 1))) - -;;; ./general/gr_ofdm_frame_acquisition.h FIXME: not found +;;; ./general/gr_ofdm_frame_acquisition.h FIXME: "No matching method for generic function `ofdm_frame_acquisition'" ;; gr_ofdm_frame_acquisition (unsigned int occupied_carriers, ;; unsigned int fft_length, ;; unsigned int cplen, @@ -259,17 +250,17 @@ ;; unsigned int max_fft_shift_len); ;; (pass-if (true? (gr:ofdm-frame-acquisition 0 0 0 #(1+3i 23+5i) 0))) -;;; ./general/gr_ofdm_frame_sink.h FIXME: not found +;;; ./general/gr_ofdm_frame_sink.h FIXME: "No matching method for generic function `ofdm_frame_sink'" ;; gr_ofdm_frame_sink(const std::vector &sym_position, ;; const std::vector &sym_value_out, ;; gr_msg_queue_sptr target_queue, unsigned int occupied_tones, ;; float phase_gain, float freq_gain); -;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) 1 1 0.25 0))) +;;(pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) (gr:msg-queue) 1 0.25 0))) ;;; ./general/gr_ofdm_insert_preamble.h FIXME: Wrong type argument in position ~A: ;; gr_ofdm_insert_preamble(int fft_length, ;; const std::vector > &preamble); -;; (pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i) #(1+3i 23+5i))))) +;;(pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i))))) ;;; ./general/gr_ofdm_mapper_bcv.h FIXME: Wrong type argument in position ~A: ;; gr_ofdm_mapper_bcv (const std::vector &constellation, @@ -284,8 +275,8 @@ ;;; ./general/gr_pa_2x2_phase_combiner.h (pass-if (true? (gr:pa-2x2-phase-combiner))) -;;; ./general/gr_packet_sink.h FIXME: not found -;; (pass-if (true? (gr:packet-sink #(1 2) 1 -1))) +;;; ./general/gr_packet_sink.h +(pass-if (true? (gr:packet-sink #(1 2) (gr:msg-queue) -1))) ;;; ./general/gr_peak_detector2_fb.h (pass-if (true? (gr:peak-detector2-fb 0 0 0))) @@ -324,10 +315,10 @@ (pass-if (true? (gr:probe-signal-f))) ;;; ./general/gr_pwr_squelch_cc.h -;; (pass-if (true? (gr:pwr-squelch-cc 0 0 0 0))) FIXME: not found +(pass-if (true? (gr:pwr-squelch-cc 0 0 0 #f))) ;;; ./general/gr_pwr_squelch_ff.h -;; (pass-if (true? (gr:pwr-squelch-ff 0.0 0.0 0 false))) FIXME: not found +(pass-if (true? (gr:pwr-squelch-ff 0.0 0.0 0 #f))) ;;; ./general/gr_quadrature_demod_cf.h (pass-if (true? (gr:quadrature-demod-cf 0))) @@ -365,14 +356,14 @@ ;;; ./general/gr_skiphead.h (pass-if (true? (gr:skiphead 1 1))) -;;; ./general/gr_squash_ff.h FIXME: not found -;; (pass-if (true? (gr:squash_ff #(1.0 2.0) #(1.0 2.0)))) +;;; ./general/gr_squash_ff.h +(pass-if (true? (gr:squash-ff #(1.0 2.0 3.0 4.0 5.0) #(1.0 2.0 3.0 4.0 5.0)))) -;;; ./general/gr_squelch_base_cc.h -;; (pass-if (true? (gr:squelch-base-cc "foo" 0 false))) FIXME: not found +;;; ./general/gr_squelch_base_cc.h WONTFIX: not wrapped +;;; (pass-if (true? (gr:squelch-base-cc "foo" 0 #f))) -;;; ./general/gr_squelch_base_ff.h -;; (pass-if (true? (gr:squelch-base-ff "foo" 0 false))) FIXME: not found +;;; ./general/gr_squelch_base_ff.h WONTFIX: not wrapped +;; (pass-if (true? (gr:squelch-base-ff "foo" 0 #f))) ;;; ./general/gr_stream_mux.h (pass-if (true? (gr:stream-mux 1 #(1 2)))) @@ -413,8 +404,8 @@ ;;; ./general/gr_vector_to_streams.h (pass-if (true? (gr:vector-to-streams 1 1))) -;;; ./general/gr_wavelet_ff.h FIXME: not found -;; (pass-if (true? (gr:wavelet-ff 1024 20 true))) +;;; ./general/gr_wavelet_ff.h +(pass-if (true? (gr:wavelet-ff 1024 20 #t))) ;;; ./general/gr_wvps_ff.h (pass-if (true? (gr:wvps-ff 2))) diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i index 98d326b28..27eb70b95 100644 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i +++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i @@ -22,9 +22,10 @@ GR_SWIG_BLOCK_MAGIC(gr,clock_recovery_mm_cc); -gr_clock_recovery_mm_cc_sptr gr_make_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit); +gr_clock_recovery_mm_cc_sptr +gr_make_clock_recovery_mm_cc (float omega, float gain_omega, + float mu, float gain_mu, + float omega_relative_limit) throw(std::exception); class gr_clock_recovery_mm_cc : public gr_sync_block { diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i index 4f08aa760..1b2437000 100644 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i +++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i @@ -22,9 +22,10 @@ GR_SWIG_BLOCK_MAGIC(gr,clock_recovery_mm_ff); -gr_clock_recovery_mm_ff_sptr gr_make_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit=0.001); +gr_clock_recovery_mm_ff_sptr +gr_make_clock_recovery_mm_ff (float omega, float gain_omega, + float mu, float gain_mu, + float omega_relative_limit=0.001) throw(std::exception); class gr_clock_recovery_mm_ff : public gr_sync_block { diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.i b/gnuradio-core/src/lib/general/gr_fft_vfc.i index f680c4022..149745b58 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.i +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.i @@ -23,7 +23,8 @@ GR_SWIG_BLOCK_MAGIC(gr, fft_vfc) gr_fft_vfc_sptr -gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window); +gr_make_fft_vfc (int fft_size, bool forward, const std::vector &window) +throw(std::exception); class gr_fft_vfc : public gr_sync_block { -- cgit From ad1eb7fd03b18b76b0799e6c6f3e1e40ff861742 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 14 Nov 2010 13:42:40 -0500 Subject: Fixing constructor interface to work better through python (int instead of uint64_t). --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 6 +++--- gnuradio-core/src/lib/general/gr_annotator_1to1.h | 6 +++--- gnuradio-core/src/lib/general/gr_annotator_1to1.i | 4 ++-- gnuradio-core/src/lib/general/gr_annotator_alltoall.cc | 6 +++--- gnuradio-core/src/lib/general/gr_annotator_alltoall.h | 6 +++--- gnuradio-core/src/lib/general/gr_annotator_alltoall.i | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index d2d2599d3..1a6cadbcf 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -31,19 +31,19 @@ #include gr_annotator_1to1_sptr -gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, +gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate) { return gnuradio::get_initial_sptr (new gr_annotator_1to1 (when, sizeof_stream_item, rel_rate)); } -gr_annotator_1to1::gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, +gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate) : gr_block ("annotator_1to1", gr_make_io_signature (1, -1, sizeof_stream_item), gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when(when) + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ONE_TO_ONE); diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index ef14f9b52..e9167bf39 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -30,7 +30,7 @@ typedef boost::shared_ptr gr_annotator_1to1_sptr; // public constructor gr_annotator_1to1_sptr -gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, +gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate=1.0); /*! @@ -68,7 +68,7 @@ class gr_annotator_1to1 : public gr_block } protected: - gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + gr_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate); private: @@ -79,7 +79,7 @@ protected: std::vector d_stored_tags; friend gr_annotator_1to1_sptr - gr_make_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i index d8f10b44f..99ab4788c 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); -gr_annotator_1to1_sptr gr_make_annotator_1to1 (uint64_t when, +gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate); @@ -34,7 +34,7 @@ public: std::vector data() const; private: - gr_annotator_1to1 (uint64_t when, size_t sizeof_stream_item, + gr_annotator_1to1 (int when, size_t sizeof_stream_item, float rel_rate); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index 88419fe0d..e7bf5d007 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -31,20 +31,20 @@ #include gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, +gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate) { return gnuradio::get_initial_sptr (new gr_annotator_alltoall (when, sizeof_stream_item, rel_rate)); } -gr_annotator_alltoall::gr_annotator_alltoall (uint64_t when, +gr_annotator_alltoall::gr_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate) : gr_block ("annotator_alltoall", gr_make_io_signature (1, -1, sizeof_stream_item), gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when(when) + d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ALL_TO_ALL); diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h index d6d2f1503..38cb53bd6 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -30,7 +30,7 @@ typedef boost::shared_ptr gr_annotator_alltoall_sptr; // public constructor gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, +gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate=1.0); /*! @@ -68,7 +68,7 @@ class gr_annotator_alltoall : public gr_block } protected: - gr_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + gr_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate); private: @@ -79,7 +79,7 @@ protected: std::vector d_stored_tags; friend gr_annotator_alltoall_sptr - gr_make_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, + gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i index c6abb1b5e..7812e80c5 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); -gr_annotator_alltoall_sptr gr_make_annotator_alltoall (uint64_t when, +gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate); @@ -34,6 +34,6 @@ public: std::vector data() const; private: - gr_annotator_alltoall (uint64_t when, size_t sizeof_stream_item, float rel_rate); + gr_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate); }; -- cgit From a6b5781e36ff75adb1e4d39d755d4ab8f5efd9dd Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 14 Nov 2010 13:43:05 -0500 Subject: First hack at pruning tags to keep from growing. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 28 +++++++++++++++++++++++++++- gnuradio-core/src/lib/runtime/gr_buffer.h | 3 +++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 1d67470ec..f6a0a98fb 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -156,8 +156,15 @@ gr_buffer::space_available () // Find out the maximum amount of data available to our readers int most_data = d_readers[0]->items_available (); - for (unsigned int i = 1; i < d_readers.size (); i++) + uint64_t min_items_read = d_readers[0]->nitems_read(); + for (size_t i = 1; i < d_readers.size (); i++) { most_data = std::max (most_data, d_readers[i]->items_available ()); + min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); + } + + for (size_t i = 0; i < d_readers.size (); i++) { + d_readers[i]->prune_tags(min_items_read); + } // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader @@ -287,6 +294,25 @@ gr_buffer_reader::get_tags_in_range(uint64_t abs_start, return found_items; } +void +gr_buffer_reader::prune_tags(uint64_t max_time) +{ + int n = 0; + uint64_t item_time; + std::deque::iterator itr = d_buffer->get_tags_begin(); + + while(itr != d_buffer->get_tags_end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + if(item_time < max_time) { + d_buffer->tags_pop_front(); + n++; + } + else + break; + itr++; + } +} + long gr_buffer_reader_ncurrently_allocated () { diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index d6d5564e8..47ba4cd96 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -101,6 +101,7 @@ class gr_buffer { std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } std::deque::iterator get_tags_end() { return d_item_tags.end(); } + void tags_pop_front() { d_item_tags.pop_front(); } // ------------------------------------------------------------------------- @@ -260,6 +261,8 @@ class gr_buffer_reader { std::vector get_tags_in_range(uint64_t abs_start, uint64_t abs_end); + void prune_tags(uint64_t max_time); + // ------------------------------------------------------------------------- private: -- cgit From ababbe79dba97b1c88e5dec7eb28175c3574d015 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 11:56:18 -0800 Subject: Update gr_nop, gr_null_sink and gr_null_source to modern coding conventions. --- gnuradio-core/src/lib/general/gr_nop.cc | 2 +- gnuradio-core/src/lib/general/gr_nop.h | 14 ++++++++------ gnuradio-core/src/lib/general/gr_nop.i | 11 ++++++----- gnuradio-core/src/lib/general/gr_null_sink.cc | 2 +- gnuradio-core/src/lib/general/gr_null_sink.h | 16 +++++++++------- gnuradio-core/src/lib/general/gr_null_sink.i | 11 ++++++----- gnuradio-core/src/lib/general/gr_null_source.cc | 2 +- gnuradio-core/src/lib/general/gr_null_source.h | 14 ++++++++------ gnuradio-core/src/lib/general/gr_null_source.i | 11 ++++++----- 9 files changed, 46 insertions(+), 37 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc index e69c8b340..950ef878e 100644 --- a/gnuradio-core/src/lib/general/gr_nop.cc +++ b/gnuradio-core/src/lib/general/gr_nop.cc @@ -33,7 +33,7 @@ gr_nop::gr_nop (size_t sizeof_stream_item) { } -gr_block_sptr +gr_nop_sptr gr_make_nop (size_t sizeof_stream_item) { return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item)); diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h index 60b20c5ab..4f18c9183 100644 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ b/gnuradio-core/src/lib/general/gr_nop.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,14 +26,19 @@ #include #include // size_t +class gr_nop; +typedef boost::shared_ptr gr_nop_sptr; + +gr_nop_sptr +gr_make_nop (size_t sizeof_stream_item); + /*! * \brief Does nothing. Used for testing only. * \ingroup misc_blk */ class gr_nop : public gr_block { - friend gr_block_sptr gr_make_nop (size_t sizeof_stream_item); - + friend gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); gr_nop (size_t sizeof_stream_item); public: @@ -43,7 +48,4 @@ class gr_nop : public gr_block gr_vector_void_star &output_items); }; -gr_block_sptr -gr_make_nop (size_t sizeof_stream_item); - #endif /* INCLUDED_GR_NOP_H */ diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i index 8220e5c6c..85354d421 100644 --- a/gnuradio-core/src/lib/general/gr_nop.i +++ b/gnuradio-core/src/lib/general/gr_nop.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,11 +20,12 @@ * Boston, MA 02110-1301, USA. */ -%ignore gr_nop; +GR_SWIG_BLOCK_MAGIC(gr,nop) + +gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); + class gr_nop : public gr_block { - friend gr_block_sptr gr_make_nop (size_t sizeof_stream_item); +private: gr_nop (size_t sizeof_stream_item); }; -%rename(nop) gr_make_nop; -gr_block_sptr gr_make_nop (size_t sizeof_stream_item); diff --git a/gnuradio-core/src/lib/general/gr_null_sink.cc b/gnuradio-core/src/lib/general/gr_null_sink.cc index 0b7f2d9e8..67ef57a46 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.cc +++ b/gnuradio-core/src/lib/general/gr_null_sink.cc @@ -34,7 +34,7 @@ gr_null_sink::gr_null_sink (size_t sizeof_stream_item) { } -gr_block_sptr +gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item) { return gnuradio::get_initial_sptr (new gr_null_sink (sizeof_stream_item)); diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h index 66df5d138..6d00382a5 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.h +++ b/gnuradio-core/src/lib/general/gr_null_sink.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,15 +26,20 @@ #include #include // size_t +class gr_null_sink; +typedef boost::shared_ptr gr_null_sink_sptr; + +gr_null_sink_sptr +gr_make_null_sink (size_t sizeof_stream_item); + + /*! * \brief Bit bucket * \ingroup sink_blk */ - class gr_null_sink : public gr_sync_block { - friend gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item); - + friend gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); gr_null_sink (size_t sizeof_stream_item); public: @@ -45,7 +50,4 @@ class gr_null_sink : public gr_sync_block }; -gr_block_sptr -gr_make_null_sink (size_t sizeof_stream_item); - #endif /* INCLUDED_GR_NULL_SINK_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_sink.i b/gnuradio-core/src/lib/general/gr_null_sink.i index fc4bcffda..e739ce118 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.i +++ b/gnuradio-core/src/lib/general/gr_null_sink.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,11 +20,12 @@ * Boston, MA 02110-1301, USA. */ -%ignore gr_null_sink; +GR_SWIG_BLOCK_MAGIC(gr,null_sink) + +gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); + class gr_null_sink : public gr_sync_block { - friend gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item); +private: gr_null_sink (size_t sizeof_stream_item); }; -%rename(null_sink) gr_make_null_sink; -gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item); diff --git a/gnuradio-core/src/lib/general/gr_null_source.cc b/gnuradio-core/src/lib/general/gr_null_source.cc index b65c39035..85fd2db4b 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.cc +++ b/gnuradio-core/src/lib/general/gr_null_source.cc @@ -35,7 +35,7 @@ gr_null_source::gr_null_source (size_t sizeof_stream_item) { } -gr_block_sptr +gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item) { return gnuradio::get_initial_sptr (new gr_null_source (sizeof_stream_item)); diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h index 63b1939bf..b1a46a195 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.h +++ b/gnuradio-core/src/lib/general/gr_null_source.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,14 +25,19 @@ #include +class gr_null_source; +typedef boost::shared_ptr gr_null_source_sptr; + +gr_null_source_sptr +gr_make_null_source (size_t sizeof_stream_item); + /*! * \brief A source of zeros. * \ingroup source_blk */ - class gr_null_source : public gr_sync_block { - friend gr_block_sptr gr_make_null_source (size_t sizeof_stream_item); + friend gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); gr_null_source (size_t sizeof_stream_item); @@ -43,7 +48,4 @@ class gr_null_source : public gr_sync_block }; -gr_block_sptr -gr_make_null_source (size_t sizeof_stream_item); - #endif /* INCLUDED_GR_NULL_SOURCE_H */ diff --git a/gnuradio-core/src/lib/general/gr_null_source.i b/gnuradio-core/src/lib/general/gr_null_source.i index f9ddef86f..133161d0a 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.i +++ b/gnuradio-core/src/lib/general/gr_null_source.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,11 +20,12 @@ * Boston, MA 02110-1301, USA. */ -%ignore gr_null_source; +GR_SWIG_BLOCK_MAGIC(gr,null_source) + +gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); + class gr_null_source : public gr_sync_block { - friend gr_block_sptr gr_make_null_source (size_t sizeof_stream_item); +private: gr_null_source (size_t sizeof_stream_item); }; -%rename(null_source) gr_make_null_source; -gr_block_sptr gr_make_null_source (size_t sizeof_stream_item); -- cgit From e8d0dbbdfce26f6963dfe0a727faf9c9cc5baf75 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 11:57:19 -0800 Subject: Remove code that's no longer needed. --- gnuradio-core/src/lib/runtime/gr_basic_block.i | 7 +------ gnuradio-core/src/lib/runtime/gr_block.i | 13 +------------ 2 files changed, 2 insertions(+), 18 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i index 9b360e5ab..03d4725d5 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.i +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -52,8 +52,3 @@ long gr_basic_block_ncurrently_allocated(); gr_basic_block_sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} #endif - -#ifdef SWIGGUILE -#warning "gr_basic_block.i: gr_block_sptr needs to be implemented!" -#endif - diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i index d13c268ca..f4ee43477 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.i +++ b/gnuradio-core/src/lib/runtime/gr_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -53,14 +53,3 @@ class gr_block : public gr_basic_block { gr_block_detail_sptr detail () const { return d_detail; } void set_detail (gr_block_detail_sptr detail) { d_detail = detail; } }; - -#ifdef SWIGPYTHON -%pythoncode %{ -gr_block_sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) -gr_block_sptr.block = lambda self: self -%} -#endif - -#ifdef SWIGGUILE -#warning "gr_block.i: gr_block_sptr needs to be implemented!" -#endif -- cgit From 48f6c8b4c398b7ee18ee4292ae20d4f4c1dd3087 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 12:25:23 -0800 Subject: Move true? from general_ctors.test to core.scm --- gnuradio-core/src/guile/gnuradio/core.scm | 4 ++++ gnuradio-core/src/guile/tests/general_ctors.test | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/core.scm b/gnuradio-core/src/guile/gnuradio/core.scm index f13a8fb60..b24d5afa9 100644 --- a/gnuradio-core/src/guile/gnuradio/core.scm +++ b/gnuradio-core/src/guile/gnuradio/core.scm @@ -17,3 +17,7 @@ (re-export-all '(gnuradio gnuradio_core_general)) (re-export-all '(gnuradio gnuradio_core_gengen)) (re-export-all '(gnuradio gnuradio_core_hier)) + +;;; Return #t if x is not #f +(define-public (true? x) + (and x #t)) diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 5cdff5c3f..75c0f0bd4 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -29,10 +29,6 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) -;;; Return #t if x is not #f -(define (true? x) - (and x #t)) - ;;; Add test code for all constructors in these files ;;; ./general/gr_additive_scrambler_bb.h -- cgit From eedcd7145c20403dcd0dcc44d15efb5d82beb7ec Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 13:15:26 -0800 Subject: Make cma-equalizer-cc test work --- gnuradio-core/src/guile/tests/filter_ctors.test | 6 +++--- gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test index 8618890fa..6a35bd296 100644 --- a/gnuradio-core/src/guile/tests/filter_ctors.test +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -32,12 +32,12 @@ ;;; Add test code for all constructors in these files ;;; -;;; ./filter/gr_adaptive_fir_ccf.h FIXME: not found +;;; ./filter/gr_adaptive_fir_ccf.h WONTFIX: not wrapped ;; gr_adaptive_fir_ccf(char *name, int decimation, const std::vector &taps); ;; (pass-if (true? (gr:adaptive-fir-ccf "foo" 0 #(1.0 2.0 3.0 4.0)))) -;;; ./filter/gr_cma_equalizer_cc.h FIXME: not found -;; (pass-if (true? (gr:cma-equalizer-cc 0 0 0))) +;;; ./filter/gr_cma_equalizer_cc.h +(pass-if (true? (gr:cma-equalizer-cc 0 0 0))) ;;; ./filter/gr_fft_filter_ccc.h FIXME: not found ;; (pass-if (true? (gr:fft-filter-ccc 0 #(1+3i 23+5i)))) diff --git a/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc index 8252509bb..f80bfd518 100644 --- a/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc +++ b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc @@ -36,6 +36,7 @@ gr_cma_equalizer_cc::gr_cma_equalizer_cc(int num_taps, float modulus, float mu) : gr_adaptive_fir_ccf("cma_equalizer_cc", 1, std::vector(num_taps)), d_modulus(modulus), d_mu(mu) { - d_taps[0] = 1.0; + if (num_taps > 0) + d_taps[0] = 1.0; } -- cgit From f2d5299a3f7dd5baa795a27c2864b2cfe67edb37 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 14 Nov 2010 13:26:59 -0800 Subject: Add tests that show that vector> is not working... --- gnuradio-core/src/guile/tests/general_ctors.test | 22 ++++++++++++++ gnuradio-core/src/lib/general/Makefile.am | 3 ++ gnuradio-core/src/lib/general/complex_vec_test.cc | 37 +++++++++++++++++++++++ gnuradio-core/src/lib/general/complex_vec_test.h | 15 +++++++++ gnuradio-core/src/lib/general/complex_vec_test.i | 12 ++++++++ gnuradio-core/src/lib/general/general.i | 2 ++ 6 files changed, 91 insertions(+) create mode 100644 gnuradio-core/src/lib/general/complex_vec_test.cc create mode 100644 gnuradio-core/src/lib/general/complex_vec_test.h create mode 100644 gnuradio-core/src/lib/general/complex_vec_test.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 75c0f0bd4..a18766400 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -28,6 +28,28 @@ (use-modules (gnuradio test-suite lib)) (use-modules (gnuradio core)) (use-modules (oop goops)) +(use-modules (ice-9 format)) + + +(define (verbose-equal? expected actual) + (cond ((equal? expected actual) #t) + (else + (format #t "Expected:\n~y\n" expected) + (format #t "Actual:\n~y\n" actual) + #f))) + + +;;; Test complex scalars +(pass-if (equal? 5.0+5.0i (gr:complex-scalar-test0))) +(pass-if (equal? 1.5+0.5i (gr:complex-scalar-test1 1+1i))) + +;;; Test complex vectors +(pass-if (verbose-equal? #(0+0i 1+1i 2+2i 3+3i 4+4i) + (gr:complex-vec-test0))) + +(pass-if (verbose-equal? #(1.5+0.5i 2.5+1.5i 3.5+2.5i) + (gr:complex-vec-test1 #(1+1i 2+2i 3+3i)))) + ;;; Add test code for all constructors in these files diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3d8a42805..735795789 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -34,6 +34,7 @@ EXTRA_DIST = \ gr_constants.cc.in libgeneral_la_SOURCES = \ + complex_vec_test.cc \ gr_additive_scrambler_bb.cc \ gr_agc_cc.cc \ gr_agc_ff.cc \ @@ -188,6 +189,7 @@ libgeneral_qa_la_SOURCES = \ qa_gri_lfsr.cc grinclude_HEADERS = \ + complex_vec_test.h \ gr_additive_scrambler_bb.h \ gr_agc_cc.h \ gr_agc_ff.h \ @@ -359,6 +361,7 @@ noinst_HEADERS = \ if PYTHON swiginclude_HEADERS = \ + complex_vec_test.i \ general.i \ gr_additive_scrambler_bb.i \ gr_agc_cc.i \ diff --git a/gnuradio-core/src/lib/general/complex_vec_test.cc b/gnuradio-core/src/lib/general/complex_vec_test.cc new file mode 100644 index 000000000..21bca1765 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.cc @@ -0,0 +1,37 @@ +#include +#include + +std::vector > +complex_vec_test0() +{ + std::vector > r(5); + + for (size_t i = 0; i < r.size(); i++) + r[i] = std::complex(i, i); + + return r; +} + +std::vector > +complex_vec_test1(const std::vector > &input) +{ + std::vector > r(input.size()); + + for (size_t i = 0; i < input.size(); i++) + r[i] = std::complex(input[i].real()+0.5, input[i].imag()-0.5); + + return r; +} + +std::complex +complex_scalar_test0() +{ + return std::complex(5, 5); +} + +std::complex +complex_scalar_test1(std::complex input) +{ + return std::complex(input.real()+0.5, input.imag()-0.5); +} + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h new file mode 100644 index 000000000..f1a8a14e2 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.h @@ -0,0 +1,15 @@ +#include +#include + +std::vector > +complex_vec_test0(); + +std::vector > +complex_vec_test1(const std::vector > &input); + +std::complex +complex_scalar_test0(); + +std::complex +complex_scalar_test1(std::complex input); + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.i b/gnuradio-core/src/lib/general/complex_vec_test.i new file mode 100644 index 000000000..1c62cfda2 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.i @@ -0,0 +1,12 @@ +std::vector > +complex_vec_test0(); + +std::vector > +complex_vec_test1(const std::vector > &input); + +std::complex +complex_scalar_test0(); + +std::complex +complex_scalar_test1(std::complex input); + diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 3ad40b218..2c86a6240 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -141,6 +141,7 @@ #include #include #include +#include %} %include "gr_nop.i" @@ -262,3 +263,4 @@ %include "gr_copy.i" %include "gr_fll_band_edge_cc.i" %include "gr_additive_scrambler_bb.i" +%include "complex_vec_test.i" -- cgit From c80fdf2897624d10123a35b1a19d150f3a5645c8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 15 Nov 2010 23:49:35 -0800 Subject: Modify GR_SWIG_BLOCK_MAGIC to not strip package prefix when using GUILE outside of gnuradio-core. This avoids the problem with the guile bindings where multiple blocks end up with the name gr:sink (e.g., audio_alsa_sink). With this change, it ends us as gr:audio-alsa-sink. Blocks in gnuradio-core continue to have the leading gr_ removed from their class names. --- gnuradio-core/src/lib/swig/Makefile.am | 1 + gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 35 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 5e003bdf2..8e356bea8 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -104,6 +104,7 @@ swig_built_sources += $(PYTHON_GEN) endif # end of if python if GUILE +SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE #GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE))) GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) # GUILE_GEN_STAMPS = $(filter %.scm,$(TOP_SWIG_IFILES)) diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index ea6368fd4..a080c2b27 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,29 +21,40 @@ */ %define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME) -_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, PKG ## _ ## BASE_NAME, BASE_NAME) +_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME) %enddef -%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) -class NAME; -typedef boost::shared_ptr NAME ## _sptr; -%template(NAME ## _sptr) boost::shared_ptr; +%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME) +class FULL_NAME; +typedef boost::shared_ptr FULL_NAME ## _sptr; +%template(FULL_NAME ## _sptr) boost::shared_ptr; %rename(BASE_NAME) PKG ## _make_ ## BASE_NAME; -%ignore NAME; +%ignore FULL_NAME; %enddef #ifdef SWIGPYTHON -%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) -_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) +%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME) +_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME) %pythoncode %{ -NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) +FULL_NAME ## _sptr.__repr__ = lambda self: "" % (self.name(), self.unique_id ()) %} %enddef #endif #ifdef SWIGGUILE -%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) -_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) +#ifdef IN_GNURADIO_CORE // normal behavior +%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME) +_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME) /* FIXME May want to add something here to get a friendlier printed representation */ %enddef +#else // Don't strip PKG from name +%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME) +class FULL_NAME; +typedef boost::shared_ptr FULL_NAME ## _sptr; +%template(FULL_NAME ## _sptr) boost::shared_ptr; +%ignore FULL_NAME; +%rename(FULL_NAME) PKG ## _make_ ## BASE_NAME; +/* FIXME May want to add something here to get a friendlier printed representation */ +%enddef +#endif #endif -- cgit From 68b06ac6ab9571ac266b663b7f9ab173cf68941e Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 15:01:44 -0800 Subject: Reverting to a sync_block for the annotator functions. Testing different rates can be done using decimating/interpolating fir filters. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 28 ++++++++----------- gnuradio-core/src/lib/general/gr_annotator_1to1.h | 28 ++++++------------- gnuradio-core/src/lib/general/gr_annotator_1to1.i | 10 ++----- .../src/lib/general/gr_annotator_alltoall.cc | 32 ++++++++++------------ .../src/lib/general/gr_annotator_alltoall.h | 29 ++++++-------------- .../src/lib/general/gr_annotator_alltoall.i | 9 ++---- 6 files changed, 50 insertions(+), 86 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 1a6cadbcf..11e2c2b4b 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -31,24 +31,22 @@ #include gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate) +gr_make_annotator_1to1 (int when, size_t sizeof_stream_item) { return gnuradio::get_initial_sptr (new gr_annotator_1to1 - (when, sizeof_stream_item, rel_rate)); + (when, sizeof_stream_item)); } -gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate) - : gr_block ("annotator_1to1", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when) +gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item) + : gr_sync_block ("annotator_1to1", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ONE_TO_ONE); d_tag_counter = 0; - set_relative_rate(d_rel_rate); + set_relative_rate(1.0); } gr_annotator_1to1::~gr_annotator_1to1 () @@ -56,10 +54,9 @@ gr_annotator_1to1::~gr_annotator_1to1 () } int -gr_annotator_1to1::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +gr_annotator_1to1::work (int noutput_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]; @@ -68,7 +65,7 @@ gr_annotator_1to1::general_work (int noutput_items, str << name() << unique_id(); uint64_t abs_N = 0; - int ninputs = ninput_items.size(); + int ninputs = input_items.size(); for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); std::vector all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); @@ -104,6 +101,5 @@ gr_annotator_1to1::general_work (int noutput_items, abs_N++; } - consume_each(noutput_items); return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index e9167bf39..4abc5b051 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -23,15 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H #define INCLUDED_GR_ANNOTATOR_1TO1_H -#include +#include class gr_annotator_1to1; typedef boost::shared_ptr gr_annotator_1to1_sptr; // public constructor gr_annotator_1to1_sptr -gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate=1.0); +gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); /*! * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY. @@ -46,21 +45,13 @@ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_1to1 : public gr_block +class gr_annotator_1to1 : public gr_sync_block { public: ~gr_annotator_1to1 (); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_rel_rate(float rrate) { - d_rel_rate = rrate; - set_relative_rate(d_rel_rate); - } - float rel_rate() { return d_rel_rate; } - + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); std::vector data() const { @@ -68,19 +59,16 @@ class gr_annotator_1to1 : public gr_block } protected: - gr_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate); + gr_annotator_1to1 (int when, size_t sizeof_stream_item); private: size_t d_itemsize; - float d_rel_rate; uint64_t d_when; uint64_t d_tag_counter; std::vector d_stored_tags; friend gr_annotator_1to1_sptr - gr_make_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate); + gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i index 99ab4788c..f29ecbf53 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -23,18 +23,14 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, - size_t sizeof_stream_item, - float rel_rate); + size_t sizeof_stream_item); -class gr_annotator_1to1 : public gr_block +class gr_annotator_1to1 : public gr_sync_block { public: - void set_rel_rate(float rrate); - float rel_rate(); std::vector data() const; private: - gr_annotator_1to1 (int when, size_t sizeof_stream_item, - float rel_rate); + gr_annotator_1to1 (int when, size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index e7bf5d007..9306f9e37 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -31,25 +31,22 @@ #include gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, - float rel_rate) +gr_make_annotator_alltoall (int when, size_t sizeof_stream_item) { return gnuradio::get_initial_sptr (new gr_annotator_alltoall - (when, sizeof_stream_item, rel_rate)); + (when, sizeof_stream_item)); } gr_annotator_alltoall::gr_annotator_alltoall (int when, - size_t sizeof_stream_item, - float rel_rate) - : gr_block ("annotator_alltoall", - gr_make_io_signature (1, -1, sizeof_stream_item), - gr_make_io_signature (1, -1, sizeof_stream_item)), - d_itemsize(sizeof_stream_item), d_rel_rate(rel_rate), d_when((uint64_t)when) + size_t sizeof_stream_item) + : gr_sync_block ("annotator_alltoall", + gr_make_io_signature (1, -1, sizeof_stream_item), + gr_make_io_signature (1, -1, sizeof_stream_item)), + d_itemsize(sizeof_stream_item), d_when((uint64_t)when) { set_tag_propagation_policy(TPP_ALL_TO_ALL); d_tag_counter = 0; - set_relative_rate(d_rel_rate); } gr_annotator_alltoall::~gr_annotator_alltoall () @@ -57,10 +54,9 @@ gr_annotator_alltoall::~gr_annotator_alltoall () } int -gr_annotator_alltoall::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +gr_annotator_alltoall::work (int noutput_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]; @@ -68,11 +64,12 @@ gr_annotator_alltoall::general_work (int noutput_items, std::stringstream str; str << name() << unique_id(); - uint64_t abs_N = 0; + uint64_t abs_N = 0, end_N; int ninputs = input_items.size(); for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); - std::vector all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); + end_N = abs_N + (uint64_t)(noutput_items); + std::vector all_tags = get_tags_in_range(i, abs_N, end_N); std::vector::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { @@ -86,7 +83,9 @@ gr_annotator_alltoall::general_work (int noutput_items, // Work does nothing to the data stream; just copy all inputs to outputs // Adds a new tag when the number of items read is a multiple of d_when + abs_N = nitems_written(0); int noutputs = output_items.size(); + for(int j = 0; j < noutput_items; j++) { for(int i = 0; i < noutputs; i++) { if(abs_N % d_when == 0) { @@ -105,6 +104,5 @@ gr_annotator_alltoall::general_work (int noutput_items, abs_N++; } - consume_each(noutput_items); return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h index 38cb53bd6..e1e51ebf3 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -23,15 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H #define INCLUDED_GR_ANNOTATOR_ALLTOALL_H -#include +#include class gr_annotator_alltoall; typedef boost::shared_ptr gr_annotator_alltoall_sptr; // public constructor gr_annotator_alltoall_sptr -gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, - float rel_rate=1.0); +gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); /*! * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY. @@ -46,41 +45,31 @@ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_alltoall : public gr_block +class gr_annotator_alltoall : public gr_sync_block { public: ~gr_annotator_alltoall (); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_rel_rate(float rrate) { - d_rel_rate = rrate; - set_relative_rate(d_rel_rate); - } - float rel_rate() { return d_rel_rate; } - + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + std::vector data() const { return d_stored_tags; } protected: - gr_annotator_alltoall (int when, size_t sizeof_stream_item, - float rel_rate); + gr_annotator_alltoall (int when, size_t sizeof_stream_item); private: size_t d_itemsize; - float d_rel_rate; uint64_t d_when; uint64_t d_tag_counter; std::vector d_stored_tags; friend gr_annotator_alltoall_sptr - gr_make_annotator_alltoall (int when, size_t sizeof_stream_item, - float rel_rate); + gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i index 7812e80c5..f9bf6dd9a 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i @@ -23,17 +23,14 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, - size_t sizeof_stream_item, - float rel_rate); + size_t sizeof_stream_item); -class gr_annotator_alltoall : public gr_block +class gr_annotator_alltoall : public gr_sync_block { public: - void set_rel_rate(float rrate); - float rel_rate(); std::vector data() const; private: - gr_annotator_alltoall (int when, size_t sizeof_stream_item, float rel_rate); + gr_annotator_alltoall (int when, size_t sizeof_stream_item); }; -- cgit From 8d84a2fc9a804b2248fe43c3d8b230ef99aebaa2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 15:02:55 -0800 Subject: Adding a way for propagate_tags to handle different rates. The tags are rewritten between blocks to adjust their count based on teh block's relative_rate.w --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 14 ++- gnuradio-core/src/lib/runtime/gr_buffer.cc | 4 +- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 99 ++++++++++++++++++++++ gnuradio-core/src/lib/runtime/qa_block_tags.h | 2 + 4 files changed, 114 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index dd0993ec7..9882c2e5d 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -89,7 +89,7 @@ min_available_space (gr_block_detail *d, int output_multiple) static bool propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, - const std::vector &start_nitems_read) + const std::vector &start_nitems_read, double rrate) { // Move tags downstream // if a sink, we don't need to move downstream; @@ -109,8 +109,15 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, d->nitems_read(i)); std::vector::iterator t; for(t = tuple.begin(); t != tuple.end(); t++ ) { + uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); + pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), + pmt::pmt_tuple_ref(*t, 1), + pmt::pmt_tuple_ref(*t, 2), + pmt::pmt_tuple_ref(*t, 3)); + for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(*t); + d->output(o)->add_item_tag(newtup); + //d->output(o)->add_item_tag(*t); } } break; @@ -358,7 +365,8 @@ gr_block_executor::run_one_iteration() LOG(*d_log << " general_work: noutput_items = " << noutput_items << " result = " << n << std::endl); - if(!propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read)) + if(!propagate_tags(m->tag_propagation_policy(), d, + d_start_nitems_read, m->relative_rate())) goto were_done; if (n == gr_block::WORK_DONE) diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index f6a0a98fb..84a65f921 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -307,8 +307,8 @@ gr_buffer_reader::prune_tags(uint64_t max_time) d_buffer->tags_pop_front(); n++; } - else - break; + //else + // break; itr++; } } diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 9c4dac698..e337e3768 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -355,3 +355,102 @@ qa_block_tags::t4 () tb->run(); } + +void +qa_block_tags::t5 () +{ + printf("\nqa_block_tags::t5\n"); + + int N = 40000; + gr_top_block_sptr tb = gr_make_top_block("top"); + gr_block_sptr src (gr_make_null_source(sizeof(int))); + gr_block_sptr head (gr_make_head(sizeof(int), N)); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(1000, sizeof(int))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(int))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(1000, sizeof(int))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); + + tb->connect(src, 0, head, 0); + tb->connect(head, 0, ann0, 0); + tb->connect(ann0, 0, ann1, 0); + tb->connect(ann1, 0, ann2, 0); + tb->connect(ann2, 0, snk0, 0); + + tb->run(); + + // Kludge together the tags that we know should result from the above graph + std::stringstream str0, str1, str2; + str0 << ann0->name() << ann0->unique_id(); + str1 << ann1->name() << ann1->unique_id(); + str2 << ann2->name() << ann2->unique_id(); + + pmt_t expected_tags1[5]; + expected_tags1[0] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags1[4] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(4)); + + pmt_t expected_tags2[10]; + expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags2[2] = mp(pmt_from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags2[3] = mp(pmt_from_uint64(1000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags2[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags2[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags2[6] = mp(pmt_from_uint64(3000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags2[7] = mp(pmt_from_uint64(3000), mp(str0.str()), mp("seq"), mp(3)); + expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); + expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); + + pmt_t expected_tags3[12]; + expected_tags3[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); + expected_tags3[1] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); + expected_tags3[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); + expected_tags3[3] = mp(pmt_from_uint64(1000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags3[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(1)); + expected_tags3[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(1)); + expected_tags3[6] = mp(pmt_from_uint64(2000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags3[7] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(2)); + expected_tags3[8] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(2)); + expected_tags3[9] = mp(pmt_from_uint64(3000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags3[10] = mp(pmt_from_uint64(6000), mp(str1.str()), mp("seq"), mp(3)); + expected_tags3[11] = mp(pmt_from_uint64(6000), mp(str0.str()), mp("seq"), mp(3)); + + std::vector tags0 = ann0->data(); + std::vector tags1 = ann1->data(); + std::vector tags2 = ann2->data(); + std::vector tags3 = ann3->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + + // annotator 1 gets tags from annotator 0 + std::cout << "tags1.size(): " << tags1.size() << std::endl; + //CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); + for(size_t i = 0; i < tags1.size(); i++) { + std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; + //pmt_equal(tags1[i], expected_tags1[i]) + //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i])); + } + + // annotator 2 gets tags from annotators 0 and 1 + std::cout << std::endl; + std::cout << "tags2.size(): " << tags2.size() << std::endl; + //CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); + for(size_t i = 0; i < tags2.size(); i++) { + std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; + //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); + } + + // annotator 3 gets tags from annotators 0, 1, and 2 + std::cout << std::endl; + std::cout << "tags3.size(): " << tags3.size() << std::endl; + //CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); + for(size_t i = 0; i < tags3.size(); i++) { + std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; + //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + } +} + diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index 2bf134d96..661d607b2 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -35,6 +35,7 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST (t2); CPPUNIT_TEST (t3); CPPUNIT_TEST (t4); + //CPPUNIT_TEST (t5); CPPUNIT_TEST_SUITE_END (); private: @@ -43,6 +44,7 @@ class qa_block_tags : public CppUnit::TestCase { void t2 (); void t3 (); void t4 (); + void t5 (); }; -- cgit From 9d6c7400ba39a9d5e3ddab9da294b8b6303d9509 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 15:36:24 -0800 Subject: Adding QA test for testing rate changes. --- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 50 +++++++++++++++----------- gnuradio-core/src/lib/runtime/qa_block_tags.h | 2 +- 2 files changed, 31 insertions(+), 21 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index e337e3768..2092e48ed 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -31,6 +31,9 @@ #include #include #include +#include +#include +#include #include @@ -363,19 +366,27 @@ qa_block_tags::t5 () int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(1000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(1000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - + gr_block_sptr src (gr_make_null_source(sizeof(float))); + gr_block_sptr head (gr_make_head(sizeof(float), N)); + gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); + gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float))); + gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(2000, sizeof(float))); + gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); + + // Rate change blocks + std::vector taps = gr_firdes::low_pass_2(1, 1, 0.4, 0.1, 60); + gr_fir_filter_fff_sptr fir_dec10 (gr_make_fir_filter_fff(10, taps)); + gr_interp_fir_filter_fff_sptr fir_int2 (gr_make_interp_fir_filter_fff(2, taps)); + tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, ann2, 0); - tb->connect(ann2, 0, snk0, 0); + tb->connect(ann1, 0, fir_dec10, 0); + tb->connect(fir_dec10, 0, ann2, 0); + tb->connect(ann2, 0, fir_int2, 0); + tb->connect(fir_int2, 0, ann3, 0); + tb->connect(ann3, 0, snk0, 0); tb->run(); @@ -390,7 +401,6 @@ qa_block_tags::t5 () expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags1[4] = mp(pmt_from_uint64(40000), mp(str0.str()), mp("seq"), mp(4)); pmt_t expected_tags2[10]; expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); @@ -408,13 +418,13 @@ qa_block_tags::t5 () expected_tags3[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); expected_tags3[1] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); expected_tags3[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[3] = mp(pmt_from_uint64(1000), mp(str2.str()), mp("seq"), mp(1)); + expected_tags3[3] = mp(pmt_from_uint64(2000), mp(str2.str()), mp("seq"), mp(1)); expected_tags3[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(1)); expected_tags3[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags3[6] = mp(pmt_from_uint64(2000), mp(str2.str()), mp("seq"), mp(2)); + expected_tags3[6] = mp(pmt_from_uint64(4000), mp(str2.str()), mp("seq"), mp(2)); expected_tags3[7] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(2)); expected_tags3[8] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[9] = mp(pmt_from_uint64(3000), mp(str2.str()), mp("seq"), mp(3)); + expected_tags3[9] = mp(pmt_from_uint64(6000), mp(str2.str()), mp("seq"), mp(3)); expected_tags3[10] = mp(pmt_from_uint64(6000), mp(str1.str()), mp("seq"), mp(3)); expected_tags3[11] = mp(pmt_from_uint64(6000), mp(str0.str()), mp("seq"), mp(3)); @@ -428,29 +438,29 @@ qa_block_tags::t5 () // annotator 1 gets tags from annotator 0 std::cout << "tags1.size(): " << tags1.size() << std::endl; - //CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); + CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); for(size_t i = 0; i < tags1.size(); i++) { std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; //pmt_equal(tags1[i], expected_tags1[i]) - //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i])); + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i])); } // annotator 2 gets tags from annotators 0 and 1 std::cout << std::endl; std::cout << "tags2.size(): " << tags2.size() << std::endl; - //CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); + CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); for(size_t i = 0; i < tags2.size(); i++) { std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); } // annotator 3 gets tags from annotators 0, 1, and 2 std::cout << std::endl; std::cout << "tags3.size(): " << tags3.size() << std::endl; - //CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - //CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); + CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); } } diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h index 661d607b2..b0d211390 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h @@ -35,7 +35,7 @@ class qa_block_tags : public CppUnit::TestCase { CPPUNIT_TEST (t2); CPPUNIT_TEST (t3); CPPUNIT_TEST (t4); - //CPPUNIT_TEST (t5); + CPPUNIT_TEST (t5); CPPUNIT_TEST_SUITE_END (); private: -- cgit From 8180bb1d7020e07c9b0a217820c68d07f0d98a74 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 16 Nov 2010 21:33:50 -0800 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 7da681a26..dc7a7b3bb 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -101,7 +101,7 @@ _gnuradio_core_runtime_la_CXXFLAGS = \ gnuradio_core_runtime_python_PYTHON = \ gnuradio_core_runtime.py \ - $(gnuradio_core_runtime) + $(gnuradio_core_runtime_python) python/gnuradio_core_runtime.cc: gnuradio_core_runtime.py gnuradio_core_runtime.py: gnuradio_core_runtime.i @@ -234,7 +234,7 @@ _gnuradio_core_general_la_CXXFLAGS = \ gnuradio_core_general_python_PYTHON = \ gnuradio_core_general.py \ - $(gnuradio_core_general) + $(gnuradio_core_general_python) python/gnuradio_core_general.cc: gnuradio_core_general.py gnuradio_core_general.py: gnuradio_core_general.i @@ -367,7 +367,7 @@ _gnuradio_core_gengen_la_CXXFLAGS = \ gnuradio_core_gengen_python_PYTHON = \ gnuradio_core_gengen.py \ - $(gnuradio_core_gengen) + $(gnuradio_core_gengen_python) python/gnuradio_core_gengen.cc: gnuradio_core_gengen.py gnuradio_core_gengen.py: gnuradio_core_gengen.i @@ -500,7 +500,7 @@ _gnuradio_core_filter_la_CXXFLAGS = \ gnuradio_core_filter_python_PYTHON = \ gnuradio_core_filter.py \ - $(gnuradio_core_filter) + $(gnuradio_core_filter_python) python/gnuradio_core_filter.cc: gnuradio_core_filter.py gnuradio_core_filter.py: gnuradio_core_filter.i @@ -633,7 +633,7 @@ _gnuradio_core_io_la_CXXFLAGS = \ gnuradio_core_io_python_PYTHON = \ gnuradio_core_io.py \ - $(gnuradio_core_io) + $(gnuradio_core_io_python) python/gnuradio_core_io.cc: gnuradio_core_io.py gnuradio_core_io.py: gnuradio_core_io.i @@ -766,7 +766,7 @@ _gnuradio_core_hier_la_CXXFLAGS = \ gnuradio_core_hier_python_PYTHON = \ gnuradio_core_hier.py \ - $(gnuradio_core_hier) + $(gnuradio_core_hier_python) python/gnuradio_core_hier.cc: gnuradio_core_hier.py gnuradio_core_hier.py: gnuradio_core_hier.i -- cgit From a41e9987f2c9544f38cea7e367bfc81fafea38cc Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 21:40:48 -0800 Subject: New file sink to handle tagged bursts of data. --- gnuradio-core/src/lib/io/Makefile.am | 9 +- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 167 ++++++++++++++++++++++++ gnuradio-core/src/lib/io/gr_tagged_file_sink.h | 65 +++++++++ gnuradio-core/src/lib/io/gr_tagged_file_sink.i | 35 +++++ gnuradio-core/src/lib/io/io.i | 3 +- 5 files changed, 275 insertions(+), 4 deletions(-) create mode 100644 gnuradio-core/src/lib/io/gr_tagged_file_sink.cc create mode 100644 gnuradio-core/src/lib/io/gr_tagged_file_sink.h create mode 100644 gnuradio-core/src/lib/io/gr_tagged_file_sink.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am index c52554645..8ce740afd 100644 --- a/gnuradio-core/src/lib/io/Makefile.am +++ b/gnuradio-core/src/lib/io/Makefile.am @@ -56,7 +56,8 @@ libio_la_SOURCES = \ gr_udp_source.cc \ gr_wavfile_sink.cc \ gr_wavfile_source.cc \ - gri_wavfile.cc + gri_wavfile.cc \ + gr_tagged_file_sink.cc grinclude_HEADERS = \ gr_file_sink.h \ @@ -89,7 +90,8 @@ grinclude_HEADERS = \ gr_udp_source.h \ gr_wavfile_source.h \ gr_wavfile_sink.h \ - gri_wavfile.h + gri_wavfile.h \ + gr_tagged_file_sink.h if PYTHON swiginclude_HEADERS = \ @@ -111,5 +113,6 @@ swiginclude_HEADERS = \ gr_udp_sink.i \ gr_udp_source.i \ gr_wavfile_source.i \ - gr_wavfile_sink.i + gr_wavfile_sink.i \ + gr_tagged_file_sink.i endif diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc new file mode 100644 index 000000000..1cd0a9a4b --- /dev/null +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -0,0 +1,167 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef O_BINARY +#define OUR_O_BINARY O_BINARY +#else +#define OUR_O_BINARY 0 +#endif + +// should be handled via configure +#ifdef O_LARGEFILE +#define OUR_O_LARGEFILE O_LARGEFILE +#else +#define OUR_O_LARGEFILE 0 +#endif + + +gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize) + : gr_sync_block ("tagged_file_sink", + gr_make_io_signature (1, 1, itemsize), + gr_make_io_signature (0, 0, 0)), + d_itemsize (itemsize) +{ + d_state = NOT_IN_BURST; +} + +gr_tagged_file_sink_sptr +gr_make_tagged_file_sink (size_t itemsize) +{ + return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize)); +} + +gr_tagged_file_sink::~gr_tagged_file_sink () +{ +} + +bool pmtcompare(pmt::pmt_t x, pmt::pmt_t y) +{ + uint64_t t_x, t_y; + t_x = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(x, 0)); + t_y = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(y, 0)); + return t_x < t_y; +} + +int +gr_tagged_file_sink::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + char *inbuf = (char *) input_items[0]; + + uint64_t start_N = nitems_read(0); + uint64_t end_N = start_N + (uint64_t)(noutput_items); + pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst"); + pmt::pmt_t tkey = pmt::pmt_string_to_symbol("packet_time_stamp"); + std::vector all_tags = get_tags_in_range(0, start_N, end_N); + std::sort(all_tags.begin(), all_tags.end(), pmtcompare); + + std::vector::iterator vitr = all_tags.begin(); + + int idx = 0, idx_stop = 0; + while(idx < noutput_items) { + if(d_state == NOT_IN_BURST) { + while(vitr != all_tags.end()) { + if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && + pmt::pmt_is_true(pmt::pmt_tuple_ref(*vitr,3))) { + uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; + idx = (int)N; + d_state = IN_BURST; + + std::cout << "Found start of burst: " << N << std::endl; + + std::stringstream filename; + filename << "file" << d_n << ".dat"; + d_n++; + + int fd; + if ((fd = ::open (filename.str().c_str(), + O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY, + 0664)) < 0){ + perror (filename.str().c_str()); + return -1; + } + + // FIXME: + //if ((d_handle = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){ + if ((d_handle = fdopen (fd, "wb")) == NULL){ + perror (filename.str().c_str()); + ::close(fd); // don't leak file descriptor if fdopen fails. + } + + std::cout << "Created new file: " << filename.str() << std::endl; + + break; + } + + vitr++; + } + return noutput_items; + } + else { // In burst + while(vitr != all_tags.end()) { + if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && + pmt::pmt_is_false(pmt::pmt_tuple_ref(*vitr,3))) { + uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; + idx_stop = (int)N; + + std::cout << "Found end of burst: " << N << std::endl; + + int count = fwrite (&inbuf[idx], d_itemsize, idx_stop-idx, d_handle); + if (count == 0) + break; + idx = idx_stop; + d_state = NOT_IN_BURST; + vitr++; + fclose(d_handle); + break; + } else { + vitr++; + } + } + if(d_state == IN_BURST) { + std::cout << "writing part of burst: " << idx << std::endl; + int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle); + if (count == 0) + break; + idx = noutput_items; + } + + } + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h new file mode 100644 index 000000000..c657e6a75 --- /dev/null +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H +#define INCLUDED_GR_TAGGED_FILE_SINK_H + +#include + +class gr_tagged_file_sink; +typedef boost::shared_ptr gr_tagged_file_sink_sptr; + +gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize); + +/*! + * \brief Write stream to file descriptor. + * \ingroup sink_blk + */ + +class gr_tagged_file_sink : public gr_sync_block +{ + friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize); + + private: + enum { + NOT_IN_BURST = 0, + IN_BURST + }; + + size_t d_itemsize; + int d_state; + FILE *d_handle; + int d_n; + + protected: + gr_tagged_file_sink (size_t itemsize); + + public: + ~gr_tagged_file_sink (); + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i new file mode 100644 index 000000000..92248e5dd --- /dev/null +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,tagged_file_sink) + +gr_tagged_file_sink_sptr +gr_make_tagged_file_sink (size_t itemsize); + +class gr_tagged_file_sink : public gr_sync_block +{ + protected: + gr_tagged_file_sink (size_t itemsize); + + public: + ~gr_tagged_file_sink (); +}; diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 3538942ca..365577cd4 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -43,7 +43,7 @@ #include #include #include - +#include %} %include "gr_file_sink_base.i" @@ -64,4 +64,5 @@ %include "gr_udp_source.i" %include "gr_wavfile_sink.i" %include "gr_wavfile_source.i" +%include "gr_tagged_file_sink.i" -- cgit From 5ef9a41c9ddfae56a77c118c1dcf2b0af2973207 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 22:31:52 -0800 Subject: Fixed tagging sink. --- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 1cd0a9a4b..8dfde25cc 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -52,7 +52,7 @@ gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize) : gr_sync_block ("tagged_file_sink", gr_make_io_signature (1, 1, itemsize), gr_make_io_signature (0, 0, 0)), - d_itemsize (itemsize) + d_itemsize (itemsize),d_n(0) { d_state = NOT_IN_BURST; } @@ -88,6 +88,7 @@ gr_tagged_file_sink::work (int noutput_items, pmt::pmt_t tkey = pmt::pmt_string_to_symbol("packet_time_stamp"); std::vector all_tags = get_tags_in_range(0, start_N, end_N); std::sort(all_tags.begin(), all_tags.end(), pmtcompare); + std::cout << "Number of tags: " << all_tags.size() << std::endl; std::vector::iterator vitr = all_tags.begin(); @@ -95,13 +96,15 @@ gr_tagged_file_sink::work (int noutput_items, while(idx < noutput_items) { if(d_state == NOT_IN_BURST) { while(vitr != all_tags.end()) { + //std::cout << "\tNot in burst: " << *vitr << std::endl; + if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && pmt::pmt_is_true(pmt::pmt_tuple_ref(*vitr,3))) { + uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; idx = (int)N; - d_state = IN_BURST; - std::cout << "Found start of burst: " << N << std::endl; + std::cout << std::endl << "Found start of burst: " << N << ", " << N+start_N << std::endl; std::stringstream filename; filename << "file" << d_n << ".dat"; @@ -124,23 +127,27 @@ gr_tagged_file_sink::work (int noutput_items, std::cout << "Created new file: " << filename.str() << std::endl; + d_state = IN_BURST; break; } vitr++; } - return noutput_items; + if(d_state == NOT_IN_BURST) + return noutput_items; } else { // In burst while(vitr != all_tags.end()) { + //std::cout << "\tin burst: " << *vitr << std::endl; + if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && pmt::pmt_is_false(pmt::pmt_tuple_ref(*vitr,3))) { uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; idx_stop = (int)N; - std::cout << "Found end of burst: " << N << std::endl; + std::cout << "Found end of burst: " << N << ", " << N+start_N << std::endl; - int count = fwrite (&inbuf[idx], d_itemsize, idx_stop-idx, d_handle); + int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle); if (count == 0) break; idx = idx_stop; @@ -153,7 +160,7 @@ gr_tagged_file_sink::work (int noutput_items, } } if(d_state == IN_BURST) { - std::cout << "writing part of burst: " << idx << std::endl; + std::cout << "writing part of burst: " << noutput_items-idx << std::endl; int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle); if (count == 0) break; -- cgit From e6751f477ba006923e9f0d2454ff870c52a6f0a5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 16 Nov 2010 22:32:46 -0800 Subject: Adding a burst tagger that creates a tag when a signal is observed on line 1. --- gnuradio-core/src/lib/general/Makefile.am | 9 ++- gnuradio-core/src/lib/general/general.i | 2 + gnuradio-core/src/lib/general/gr_burst_tagger.cc | 83 ++++++++++++++++++++++++ gnuradio-core/src/lib/general/gr_burst_tagger.h | 56 ++++++++++++++++ gnuradio-core/src/lib/general/gr_burst_tagger.i | 31 +++++++++ 5 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 gnuradio-core/src/lib/general/gr_burst_tagger.cc create mode 100644 gnuradio-core/src/lib/general/gr_burst_tagger.h create mode 100644 gnuradio-core/src/lib/general/gr_burst_tagger.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 2e52d88f3..0e9109d6c 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -177,7 +177,8 @@ libgeneral_la_SOURCES = \ gr_probe_mpsk_snr_c.cc \ gr_probe_density_b.cc \ gr_annotator_alltoall.cc \ - gr_annotator_1to1.cc + gr_annotator_1to1.cc \ + gr_burst_tagger.cc libgeneral_qa_la_SOURCES = \ qa_general.cc \ @@ -348,7 +349,8 @@ grinclude_HEADERS = \ gr_probe_mpsk_snr_c.h \ gr_probe_density_b.h \ gr_annotator_alltoall.h \ - gr_annotator_1to1.h + gr_annotator_1to1.h \ + gr_burst_tagger.h noinst_HEADERS = \ qa_general.h \ @@ -490,5 +492,6 @@ swiginclude_HEADERS = \ gr_probe_mpsk_snr_c.i \ gr_probe_density_b.i \ gr_annotator_alltoall.i \ - gr_annotator_1to1.i + gr_annotator_1to1.i \ + gr_burst_tagger.i endif diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 400f0b9b6..0f8b57a44 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -143,6 +143,7 @@ #include #include #include +#include %} %include "gr_nop.i" @@ -266,3 +267,4 @@ %include "gr_additive_scrambler_bb.i" %include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" +%include "gr_burst_tagger.i" diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc new file mode 100644 index 000000000..4b3847b08 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +gr_burst_tagger_sptr +gr_make_burst_tagger(size_t itemsize) +{ + return gnuradio::get_initial_sptr(new gr_burst_tagger(itemsize)); +} + +gr_burst_tagger::gr_burst_tagger(size_t itemsize) + : gr_sync_block ("burst_tagger", + gr_make_io_signature2 (2, 2, itemsize, sizeof(short)), + gr_make_io_signature (1, 1, itemsize)), + d_itemsize(itemsize), d_state(false) +{ + std::stringstream str; + str << name() << unique_id(); + + d_key = pmt::pmt_string_to_symbol("burst"); + d_id = pmt::pmt_string_to_symbol(str.str()); +} + +gr_burst_tagger::~gr_burst_tagger() +{ +} + +int +gr_burst_tagger::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const char *signal = (const char*)input_items[0]; + const short *trigger = (const short*)input_items[1]; + char *out = (char*)output_items[0]; + + memcpy(out, signal, noutput_items * d_itemsize); + + for(int i = 0; i < noutput_items; i++) { + if(trigger[i] > 0) { + if(d_state == false) { + d_state = true; + pmt::pmt_t value = pmt::PMT_T; + add_item_tag(0, nitems_written(0)+i, d_key, value, d_id); + } + } + else { + if(d_state == true) { + d_state = false; + pmt::pmt_t value = pmt::PMT_F; + add_item_tag(0, nitems_written(0)+i, d_key, value, d_id); + } + } + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h new file mode 100644 index 000000000..8f814bea0 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_BURST_TAGGER_H +#define INCLUDED_GR_BURST_TAGGER_H + +#include + +class gr_burst_tagger; +typedef boost::shared_ptr gr_burst_tagger_sptr; + +gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); + +/*! + * \brief output[i] = input[i] + * \ingroup misc_blk + * + */ +class gr_burst_tagger : public gr_sync_block +{ + size_t d_itemsize; + bool d_state; + pmt::pmt_t d_key; + pmt::pmt_t d_id; + + friend gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); + gr_burst_tagger(size_t itemsize); + + public: + ~gr_burst_tagger(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i new file mode 100644 index 000000000..ebf1eea8c --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i @@ -0,0 +1,31 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,burst_tagger) + +gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); + +class gr_burst_tagger : public gr_sync_block +{ + private: + gr_burst_tagger(size_t itemsize); +}; -- cgit From 4eadee57c588940347027c7e7f99ac7e993874fd Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 17 Nov 2010 13:54:04 -0800 Subject: Add support for guile std::vector< std::complex >. --- gnuradio-core/src/lib/swig/Makefile.am | 3 +- gnuradio-core/src/lib/swig/gnuradio.i | 15 +- gnuradio-core/src/lib/swig/guile/std_vector.i | 437 ++++++++++++++++++++++++++ 3 files changed, 451 insertions(+), 4 deletions(-) create mode 100644 gnuradio-core/src/lib/swig/guile/std_vector.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 8e356bea8..16b5d677e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -53,7 +53,8 @@ swiginclude_HEADERS = \ # SWIG headers that get installed in ${prefix}/include/gnuradio/swig/... nobase_swiginclude_HEADERS = \ - guile/std_complex.i + guile/std_complex.i \ + guile/std_vector.i if PYTHON diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 6eb44cbe9..47fd4e330 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -41,13 +41,22 @@ %include // non-local SWIG files -%include -%include -#ifdef SWIGGUILE +#ifdef SWIGGUILE // Local overrides to support complex +// It's kind of screwy, but the target language subdir isn't +// searched automatically except for under ./swig_lib which +// doesn't really help us since we run swig in many directories %include +%include +%include +%include +%include +%include #else %include +%include +%include #endif +%include typedef std::complex gr_complex; typedef std::complex gr_complexd; diff --git a/gnuradio-core/src/lib/swig/guile/std_vector.i b/gnuradio-core/src/lib/swig/guile/std_vector.i new file mode 100644 index 000000000..ef1f20667 --- /dev/null +++ b/gnuradio-core/src/lib/swig/guile/std_vector.i @@ -0,0 +1,437 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * std_vector.i + * + * SWIG typemaps for std::vector + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::vector +// +// The aim of all that follows would be to integrate std::vector with +// Guile as much as possible, namely, to allow the user to pass and +// be returned Guile vectors or lists. +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::vector), f(const std::vector&), f(const std::vector*): +// the parameter being read-only, either a Guile sequence or a +// previously wrapped std::vector can be passed. +// -- f(std::vector&), f(std::vector*): +// the parameter must be modified; therefore, only a wrapped std::vector +// can be passed. +// -- std::vector f(): +// the vector is returned by copy; therefore, a Guile vector of T:s +// is returned which is most easily used in other Guile functions +// -- std::vector& f(), std::vector* f(), const std::vector& f(), +// const std::vector* f(): +// the vector is returned by reference; therefore, a wrapped std::vector +// is returned +// ------------------------------------------------------------------------ + +%{ +#include +#include +#include +#include +%} + +%{ + inline std::complex SWIG_scm2cmplxfloat(SCM x){ + return std::complex(scm_c_real_part(x), scm_c_imag_part(x)); + } + + inline std::complex SWIG_scm2cmplxdouble(SCM x){ + return std::complex(scm_c_real_part(x), scm_c_imag_part(x)); + } + + inline SCM SWIG_cmplxfloat2scm(std::complex x){ + return scm_c_make_rectangular(x.real(), x.imag()); + } + + inline SCM SWIG_cmplxdouble2scm(std::complex x){ + return scm_c_make_rectangular(x.real(), x.imag()); + } +%} + +// exported class + +namespace std { + + template class vector { + %typemap(in) vector { + if (gh_vector_p($input)) { + unsigned long size = gh_vector_length($input); + $1 = std::vector(size); + for (unsigned long i=0; i(); + } else if (gh_pair_p($input)) { + SCM head, tail; + $1 = std::vector(); + tail = $input; + while (!gh_null_p(tail)) { + head = gh_car(tail); + tail = gh_cdr(tail); + $1.push_back(*((T*)SWIG_MustGetPtr(head, + $descriptor(T *), + $argnum, 0))); + } + } else { + $1 = *(($&1_type) + SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); + } + } + %typemap(in) const vector& (std::vector temp), + const vector* (std::vector temp) { + if (gh_vector_p($input)) { + unsigned long size = gh_vector_length($input); + temp = std::vector(size); + $1 = &temp; + for (unsigned long i=0; i(); + $1 = &temp; + } else if (gh_pair_p($input)) { + temp = std::vector(); + $1 = &temp; + SCM head, tail; + tail = $input; + while (!gh_null_p(tail)) { + head = gh_car(tail); + tail = gh_cdr(tail); + temp.push_back(*((T*) SWIG_MustGetPtr(head, + $descriptor(T *), + $argnum, 0))); + } + } else { + $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); + } + } + %typemap(out) vector { + $result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED); + for (unsigned int i=0; i<$1.size(); i++) { + T* x = new T((($1_type &)$1)[i]); + gh_vector_set_x($result,gh_long2scm(i), + SWIG_NewPointerObj(x, $descriptor(T *), 1)); + } + } + %typecheck(SWIG_TYPECHECK_VECTOR) vector { + /* native sequence? */ + if (gh_vector_p($input)) { + unsigned int size = gh_vector_length($input); + if (size == 0) { + /* an empty sequence can be of any type */ + $1 = 1; + } else { + /* check the first element only */ + SCM o = gh_vector_ref($input,gh_ulong2scm(0)); + T* x; + if (SWIG_ConvertPtr(o,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } + } else if (gh_null_p($input)) { + /* again, an empty sequence can be of any type */ + $1 = 1; + } else if (gh_pair_p($input)) { + /* check the first element only */ + T* x; + SCM head = gh_car($input); + if (SWIG_ConvertPtr(head,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } else { + /* wrapped vector? */ + std::vector* v; + if (SWIG_ConvertPtr($input,(void **) &v, + $&1_descriptor, 0) != -1) + $1 = 1; + else + $1 = 0; + } + } + %typecheck(SWIG_TYPECHECK_VECTOR) const vector&, + const vector* { + /* native sequence? */ + if (gh_vector_p($input)) { + unsigned int size = gh_vector_length($input); + if (size == 0) { + /* an empty sequence can be of any type */ + $1 = 1; + } else { + /* check the first element only */ + T* x; + SCM o = gh_vector_ref($input,gh_ulong2scm(0)); + if (SWIG_ConvertPtr(o,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } + } else if (gh_null_p($input)) { + /* again, an empty sequence can be of any type */ + $1 = 1; + } else if (gh_pair_p($input)) { + /* check the first element only */ + T* x; + SCM head = gh_car($input); + if (SWIG_ConvertPtr(head,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } else { + /* wrapped vector? */ + std::vector* v; + if (SWIG_ConvertPtr($input,(void **) &v, + $1_descriptor, 0) != -1) + $1 = 1; + else + $1 = 0; + } + } + public: + vector(unsigned int size = 0); + vector(unsigned int size, const T& value); + vector(const vector&); + %rename(length) size; + unsigned int size() const; + %rename("empty?") empty; + bool empty() const; + %rename("clear!") clear; + void clear(); + %rename("set!") set; + %rename("pop!") pop; + %rename("push!") push_back; + void push_back(const T& x); + %extend { + T pop() throw (std::out_of_range) { + if (self->size() == 0) + throw std::out_of_range("pop from empty vector"); + T x = self->back(); + self->pop_back(); + return x; + } + T& ref(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i class vector { + %typemap(in) vector { + if (gh_vector_p($input)) { + unsigned long size = gh_vector_length($input); + $1 = std::vector(size); + for (unsigned long i=0; i(); + } else if (gh_pair_p($input)) { + SCM v = gh_list_to_vector($input); + unsigned long size = gh_vector_length(v); + $1 = std::vector(size); + for (unsigned long i=0; i& (std::vector temp), + const vector* (std::vector temp) { + if (gh_vector_p($input)) { + unsigned long size = gh_vector_length($input); + temp = std::vector(size); + $1 = &temp; + for (unsigned long i=0; i(); + $1 = &temp; + } else if (gh_pair_p($input)) { + SCM v = gh_list_to_vector($input); + unsigned long size = gh_vector_length(v); + temp = std::vector(size); + $1 = &temp; + for (unsigned long i=0; i { + $result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED); + for (unsigned int i=0; i<$1.size(); i++) { + SCM x = CONVERT_TO((($1_type &)$1)[i]); + gh_vector_set_x($result,gh_long2scm(i),x); + } + } + %typecheck(SWIG_TYPECHECK_VECTOR) vector { + /* native sequence? */ + if (gh_vector_p($input)) { + unsigned int size = gh_vector_length($input); + if (size == 0) { + /* an empty sequence can be of any type */ + $1 = 1; + } else { + /* check the first element only */ + T* x; + SCM o = gh_vector_ref($input,gh_ulong2scm(0)); + $1 = CHECK(o) ? 1 : 0; + } + } else if (gh_null_p($input)) { + /* again, an empty sequence can be of any type */ + $1 = 1; + } else if (gh_pair_p($input)) { + /* check the first element only */ + T* x; + SCM head = gh_car($input); + $1 = CHECK(head) ? 1 : 0; + } else { + /* wrapped vector? */ + std::vector* v; + $1 = (SWIG_ConvertPtr($input,(void **) &v, + $&1_descriptor, 0) != -1) ? 1 : 0; + } + } + %typecheck(SWIG_TYPECHECK_VECTOR) const vector&, + const vector* { + /* native sequence? */ + if (gh_vector_p($input)) { + unsigned int size = gh_vector_length($input); + if (size == 0) { + /* an empty sequence can be of any type */ + $1 = 1; + } else { + /* check the first element only */ + T* x; + SCM o = gh_vector_ref($input,gh_ulong2scm(0)); + $1 = CHECK(o) ? 1 : 0; + } + } else if (gh_null_p($input)) { + /* again, an empty sequence can be of any type */ + $1 = 1; + } else if (gh_pair_p($input)) { + /* check the first element only */ + T* x; + SCM head = gh_car($input); + $1 = CHECK(head) ? 1 : 0; + } else { + /* wrapped vector? */ + std::vector* v; + $1 = (SWIG_ConvertPtr($input,(void **) &v, + $1_descriptor, 0) != -1) ? 1 : 0; + } + } + public: + vector(unsigned int size = 0); + vector(unsigned int size, const T& value); + vector(const vector&); + %rename(length) size; + unsigned int size() const; + %rename("empty?") empty; + bool empty() const; + %rename("clear!") clear; + void clear(); + %rename("set!") set; + %rename("pop!") pop; + %rename("push!") push_back; + void push_back(T x); + %extend { + T pop() throw (std::out_of_range) { + if (self->size() == 0) + throw std::out_of_range("pop from empty vector"); + T x = self->back(); + self->pop_back(); + return x; + } + T ref(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i, scm_is_complex, + SWIG_scm2cmplxfloat, SWIG_cmplxfloat2scm); + specialize_stl_vector(std::complex, scm_is_complex, + SWIG_scm2cmplxdouble,SWIG_cmplxdouble2scm); + +} + -- cgit From 38d1a6be0d4f80a4a5334ddb8bac0aef08d5c794 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 17 Nov 2010 15:56:50 -0800 Subject: Adding information and convinience functions for accessing tag information. --- gnuradio-core/src/lib/runtime/gr_tag_info.cc | 37 ++++++++++++++++ gnuradio-core/src/lib/runtime/gr_tag_info.h | 65 ++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 gnuradio-core/src/lib/runtime/gr_tag_info.cc create mode 100644 gnuradio-core/src/lib/runtime/gr_tag_info.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc new file mode 100644 index 000000000..211f330e9 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.cc @@ -0,0 +1,37 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +namespace gr_tags { + + const pmt::pmt_t s_key_time = pmt::pmt_string_to_symbol("time"); + const pmt::pmt_t s_key_sample_rate = pmt::pmt_string_to_symbol("sample_rate"); + const pmt::pmt_t s_key_frequency = pmt::pmt_string_to_symbol("frequency"); + const pmt::pmt_t s_key_rssi = pmt::pmt_string_to_symbol("rssi"); + const pmt::pmt_t s_key_rx_gain = pmt::pmt_string_to_symbol("gain"); +} diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h new file mode 100644 index 000000000..af51cf6a9 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 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. + */ + +#ifndef INCLUDED_GR_TAG_INFO_H +#define INCLUDED_GR_TAG_INFO_H + +#include + +namespace gr_tags { + + enum { + TAG_NITEM_REF = 0, + TAG_SRCID_REF, + TAG_KEY_REF, + TAG_VALUE_REF + }; + + extern const pmt::pmt_t s_key_time; + extern const pmt::pmt_t s_key_sample_rate; + extern const pmt::pmt_t s_key_frequency; + extern const pmt::pmt_t s_key_rssi; + extern const pmt::pmt_t s_key_gain; + + static inline uint64_t + get_nitems(const pmt::pmt_t &tag) { + return pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tag, TAG_NITEM_REF)); + } + + static inline pmt::pmt_t + get_srcid(const pmt::pmt_t &tag) { + return pmt::pmt_tuple_ref(tag, TAG_SRCID_REF); + } + + static inline pmt::pmt_t + get_key(const pmt::pmt_t &tag) { + return pmt::pmt_tuple_ref(tag, TAG_KEY_REF); + } + + static inline pmt::pmt_t + get_value(const pmt::pmt_t &tag) { + return pmt::pmt_tuple_ref(tag, TAG_VALUE_REF); + } + +}; /* namespace tags */ + +#endif /* GR_TAG_INFO */ -- cgit From 97b1f1aa7d646fbc1250158ec94fe49d0979809c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 17 Nov 2010 15:58:04 -0800 Subject: Makefile changes to work in tag info stuff. --- gnuradio-core/src/lib/runtime/Makefile.am | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index a3aa36a39..dd9a8ea64 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -68,7 +68,8 @@ libruntime_la_SOURCES = \ gr_vmcircbuf_mmap_tmpfile.cc \ gr_vmcircbuf_createfilemapping.cc \ gr_vmcircbuf_sysv_shm.cc \ - gr_select_handler.cc + gr_select_handler.cc \ + gr_tag_info.cc libruntime_qa_la_SOURCES = \ qa_gr_block.cc \ @@ -122,7 +123,8 @@ grinclude_HEADERS = \ gr_tmp_path.h \ gr_types.h \ gr_unittests.h \ - gr_vmcircbuf.h + gr_vmcircbuf.h \ + gr_tag_info.h noinst_HEADERS = \ gr_vmcircbuf_mmap_shm_open.h \ -- cgit From 6d4393613a78417b91e67af33820748ad3483e61 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 17 Nov 2010 15:58:49 -0800 Subject: Changing get_tags API to take in a vector reference instead of returning a vector. --- gnuradio-core/src/lib/runtime/gr_block.cc | 14 ++++++----- gnuradio-core/src/lib/runtime/gr_block.h | 18 ++++++++------ gnuradio-core/src/lib/runtime/gr_block_detail.cc | 22 +++++++++-------- gnuradio-core/src/lib/runtime/gr_block_detail.h | 19 +++++++++------ gnuradio-core/src/lib/runtime/gr_block_executor.cc | 28 ++++++++++++++-------- gnuradio-core/src/lib/runtime/gr_block_executor.h | 2 ++ gnuradio-core/src/lib/runtime/gr_buffer.cc | 11 ++++----- gnuradio-core/src/lib/runtime/gr_buffer.h | 6 +++-- 8 files changed, 72 insertions(+), 48 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 778344769..52be37e3b 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -152,19 +152,21 @@ gr_block::add_item_tag(unsigned int which_output, d_detail->add_item_tag(which_output, offset, key, value, srcid); } -std::vector -gr_block::get_tags_in_range(unsigned int which_output, +void +gr_block::get_tags_in_range(std::vector &v, + unsigned int which_output, uint64_t start, uint64_t end) { - return d_detail->get_tags_in_range(which_output, start, end); + d_detail->get_tags_in_range(v, which_output, start, end); } -std::vector -gr_block::get_tags_in_range(unsigned int which_output, +void +gr_block::get_tags_in_range(std::vector &v, + unsigned int which_output, uint64_t start, uint64_t end, const pmt::pmt_t &key) { - return d_detail->get_tags_in_range(which_output, start, end, key); + d_detail->get_tags_in_range(v, which_output, start, end, key); } gr_block::TAG_PROPAGATION_POLICY diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index a717946d2..7caf3c34a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -268,13 +268,15 @@ class gr_block : public gr_basic_block { * Tags are tuples of: * (item count, source id, key, value) * + * \param v a vector reference to return tags into * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::vector get_tags_in_range(unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end); + void get_tags_in_range(std::vector &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end); /*! * \brief Given a [start,end), returns a vector of all tags in the range @@ -285,15 +287,17 @@ class gr_block : public gr_basic_block { * Tags are tuples of: * (item count, source id, key, value) * + * \param v a vector reference to return tags into * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest * \param key a PMT symbol key to filter only tags of this key */ - std::vector get_tags_in_range(unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key); + void get_tags_in_range(std::vector &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key); // These are really only for internal use, but leaving them public avoids // having to work up an ever-varying list of friends diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc index 4f3ffc8dc..a360240c0 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc @@ -169,25 +169,29 @@ gr_block_detail::add_item_tag(unsigned int which_output, } } -std::vector -gr_block_detail::get_tags_in_range(unsigned int which_input, +void +gr_block_detail::get_tags_in_range(std::vector &v, + unsigned int which_input, uint64_t abs_start, uint64_t abs_end) { // get from gr_buffer_reader's deque of tags - return d_input[which_input]->get_tags_in_range(abs_start, abs_end); + d_input[which_input]->get_tags_in_range(v, abs_start, abs_end); } -std::vector -gr_block_detail::get_tags_in_range(unsigned int which_input, +void +gr_block_detail::get_tags_in_range(std::vector &v, + unsigned int which_input, uint64_t abs_start, uint64_t abs_end, const pmt_t &key) { - std::vector found_items, found_items_by_key; + std::vector found_items; + + v.resize(0); // get from gr_buffer_reader's deque of tags - found_items = d_input[which_input]->get_tags_in_range(abs_start, abs_end); + d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end); // Filter further by key name pmt_t itemkey; @@ -195,9 +199,7 @@ gr_block_detail::get_tags_in_range(unsigned int which_input, for(itr = found_items.begin(); itr != found_items.end(); itr++) { itemkey = pmt_tuple_ref(*itr, 2); if(pmt_eqv(key, itemkey)) { - found_items_by_key.push_back(*itr); + v.push_back(*itr); } } - - return found_items_by_key; } diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 5902d1559..834ef47f5 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -25,6 +25,7 @@ #include #include +#include #include /*! @@ -124,13 +125,15 @@ class gr_block_detail { * Tags are tuples of: * (item count, source id, key, value) * + * \param v a vector reference to return tags into * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::vector get_tags_in_range(unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end); + void get_tags_in_range(std::vector &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end); /*! * \brief Given a [start,end), returns a vector of all tags in the range @@ -143,15 +146,17 @@ class gr_block_detail { * Tags are tuples of: * (item count, source id, key, value) * + * \param v a vector reference to return tags into * \param which_input an integer of which input stream to pull from * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest * \param key a PMT symbol to select only tags of this key */ - std::vector get_tags_in_range(unsigned int which_input, - uint64_t abs_start, - uint64_t abs_end, - const pmt::pmt_t &key); + void get_tags_in_range(std::vector &v, + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key); gr_tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 9882c2e5d..59799069a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -89,7 +89,8 @@ min_available_space (gr_block_detail *d, int output_multiple) static bool propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, - const std::vector &start_nitems_read, double rrate) + const std::vector &start_nitems_read, double rrate, + std::vector &rtags) { // Move tags downstream // if a sink, we don't need to move downstream; @@ -105,10 +106,11 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, case(gr_block::TPP_ALL_TO_ALL): // every tag on every input propogates to everyone downstream for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], - d->nitems_read(i)); + d->get_tags_in_range(rtags, i, start_nitems_read[i], + d->nitems_read(i)); + std::vector::iterator t; - for(t = tuple.begin(); t != tuple.end(); t++ ) { + for(t = rtags.begin(); t != rtags.end(); t++) { uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), pmt::pmt_tuple_ref(*t, 1), @@ -117,7 +119,6 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, for(int o = 0; o < d->noutputs(); o++) d->output(o)->add_item_tag(newtup); - //d->output(o)->add_item_tag(*t); } } break; @@ -127,11 +128,17 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, // type of tag-propagation system is selected in gr_block_detail if(d->ninputs() == d->noutputs()) { for(int i = 0; i < d->ninputs(); i++) { - std::vector tuple = d->get_tags_in_range(i, start_nitems_read[i], - d->nitems_read(i)); + d->get_tags_in_range(rtags, i, start_nitems_read[i], + d->nitems_read(i)); + std::vector::iterator t; - for(t = tuple.begin(); t != tuple.end(); t++ ) { - d->output(i)->add_item_tag(*t); + for(t = rtags.begin(); t != rtags.end(); t++) { + uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); + pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), + pmt::pmt_tuple_ref(*t, 1), + pmt::pmt_tuple_ref(*t, 2), + pmt::pmt_tuple_ref(*t, 3)); + d->output(i)->add_item_tag(newtup); } } } @@ -366,7 +373,8 @@ gr_block_executor::run_one_iteration() << " result = " << n << std::endl); if(!propagate_tags(m->tag_propagation_policy(), d, - d_start_nitems_read, m->relative_rate())) + d_start_nitems_read, m->relative_rate(), + d_returned_tags)) goto were_done; if (n == gr_block::WORK_DONE) diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h index 22b782883..77ace5522 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.h +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h @@ -25,6 +25,7 @@ #include #include +#include //class gr_block_executor; //typedef boost::shared_ptr gr_block_executor_sptr; @@ -48,6 +49,7 @@ protected: std::vector d_input_done; gr_vector_void_star d_output_items; std::vector d_start_nitems_read; //stores where tag counts are before work + std::vector d_returned_tags; public: gr_block_executor(gr_block_sptr block); diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 84a65f921..70d57c094 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -271,13 +271,14 @@ gr_buffer_reader::update_read_pointer (int nitems) d_abs_read_offset += nitems; } -std::vector -gr_buffer_reader::get_tags_in_range(uint64_t abs_start, +void +gr_buffer_reader::get_tags_in_range(std::vector &v, + uint64_t abs_start, uint64_t abs_end) { gruel::scoped_lock guard(*mutex()); - std::vector found_items; + v.resize(0); std::deque::iterator itr = d_buffer->get_tags_begin(); uint64_t item_time; @@ -285,13 +286,11 @@ gr_buffer_reader::get_tags_in_range(uint64_t abs_start, item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); if((item_time >= abs_start) && (item_time <= abs_end)) { - found_items.push_back(*itr); + v.push_back(*itr); } itr++; } - - return found_items; } void diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 47ba4cd96..88a76fdc6 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -255,11 +255,13 @@ class gr_buffer_reader { * Tags are tuples of: * (item count, source id, key, value) * + * \param v a vector reference to return tags into * \param abs_start a uint64 count of the start of the range of interest * \param abs_end a uint64 count of the end of the range of interest */ - std::vector get_tags_in_range(uint64_t abs_start, - uint64_t abs_end); + void get_tags_in_range(std::vector &v, + uint64_t abs_start, + uint64_t abs_end); void prune_tags(uint64_t max_time); -- cgit From b8da2172d0b10f5de04a12b942b48439a7aae8ae Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 17 Nov 2010 15:59:43 -0800 Subject: Changing blocks to use new get_tags api and tag convinience functions. --- gnuradio-core/src/lib/general/gr_annotator_1to1.cc | 4 +++- .../src/lib/general/gr_annotator_alltoall.cc | 4 +++- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 11e2c2b4b..511b356e5 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -68,7 +68,9 @@ gr_annotator_1to1::work (int noutput_items, int ninputs = input_items.size(); for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); - std::vector all_tags = get_tags_in_range(i, abs_N, abs_N + noutput_items); + + std::vector all_tags; + get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); std::vector::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index 9306f9e37..344fd088b 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -69,7 +69,9 @@ gr_annotator_alltoall::work (int noutput_items, for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); end_N = abs_N + (uint64_t)(noutput_items); - std::vector all_tags = get_tags_in_range(i, abs_N, end_N); + + std::vector all_tags; + get_tags_in_range(all_tags, i, abs_N, end_N); std::vector::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 8dfde25cc..9b5ae70a6 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef O_BINARY #define OUR_O_BINARY O_BINARY @@ -85,8 +86,11 @@ gr_tagged_file_sink::work (int noutput_items, uint64_t start_N = nitems_read(0); uint64_t end_N = start_N + (uint64_t)(noutput_items); pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst"); - pmt::pmt_t tkey = pmt::pmt_string_to_symbol("packet_time_stamp"); - std::vector all_tags = get_tags_in_range(0, start_N, end_N); + //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::s_key_time + + std::vector all_tags; + get_tags_in_range(all_tags, 0, start_N, end_N); + std::sort(all_tags.begin(), all_tags.end(), pmtcompare); std::cout << "Number of tags: " << all_tags.size() << std::endl; @@ -98,10 +102,10 @@ gr_tagged_file_sink::work (int noutput_items, while(vitr != all_tags.end()) { //std::cout << "\tNot in burst: " << *vitr << std::endl; - if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && - pmt::pmt_is_true(pmt::pmt_tuple_ref(*vitr,3))) { + if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) && + pmt::pmt_is_true(gr_tags::get_value(*vitr))) { - uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; + uint64_t N = gr_tags::get_nitems(*vitr) - start_N; idx = (int)N; std::cout << std::endl << "Found start of burst: " << N << ", " << N+start_N << std::endl; @@ -140,9 +144,9 @@ gr_tagged_file_sink::work (int noutput_items, while(vitr != all_tags.end()) { //std::cout << "\tin burst: " << *vitr << std::endl; - if((pmt::pmt_eqv(pmt::pmt_tuple_ref(*vitr, 2), bkey)) && - pmt::pmt_is_false(pmt::pmt_tuple_ref(*vitr,3))) { - uint64_t N = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*vitr, 0)) - start_N; + if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) && + pmt::pmt_is_false(gr_tags::get_value(*vitr))) { + uint64_t N = gr_tags::get_nitems(*vitr) - start_N; idx_stop = (int)N; std::cout << "Found end of burst: " << N << ", " << N+start_N << std::endl; -- cgit From 18da1655fe25b7517577a9417c2304edbc3afdca Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 17 Nov 2010 20:41:49 -0700 Subject: enable more tests --- gnuradio-core/src/guile/tests/filter_ctors.test | 116 +++++++++++------------ gnuradio-core/src/guile/tests/general_ctors.test | 33 ++----- gnuradio-core/src/guile/tests/gengen_ctors.test | 43 ++++----- gnuradio-core/src/guile/tests/hier_ctors.test | 4 +- gnuradio-core/src/guile/tests/io_ctors.test | 10 +- 5 files changed, 92 insertions(+), 114 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test index 6a35bd296..ee851b6e0 100644 --- a/gnuradio-core/src/guile/tests/filter_ctors.test +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -39,17 +39,17 @@ ;;; ./filter/gr_cma_equalizer_cc.h (pass-if (true? (gr:cma-equalizer-cc 0 0 0))) -;;; ./filter/gr_fft_filter_ccc.h FIXME: not found -;; (pass-if (true? (gr:fft-filter-ccc 0 #(1+3i 23+5i)))) +;;; ./filter/gr_fft_filter_ccc.h +(pass-if (true? (gr:fft-filter-ccc 0 #(1+3i 23+5i)))) -;;; ./filter/gr_fft_filter_fff.h FIXME: not found -;; (pass-if (true? (gr:fft-filter-fff 0 #(1.0 2.0)))) +;;; ./filter/gr_fft_filter_fff.h +(pass-if (true? (gr:fft-filter-fff 0 #(1.0 2.0)))) -;;; ./filter/gr_filter_delay_fc.h FIXME: not found -;; (pass-if (true? (gr:filter-delay-fc #(1.0 2.0)))) +;;; ./filter/gr_filter_delay_fc.h +(pass-if (true? (gr:filter-delay-fc #(1.0 2.0)))) -;;; ./filter/gr_fir_ccc_generic.h FIXME: not found -;; (pass-if (true? (gr:fir-ccc-generic))) +;;; ./filter/gr_fir_ccc_generic. FIXME: Unbound variable: ~S" (gr:fir-ccc-generic) #f)) +;; (pass-if (true? (gr:fir-ccc-generic))) ;; (pass-if (true? (gr:fir-ccc-generic #(1+3i 23+5i)))) ;;; ./filter/gr_fir_ccc_simd.h FIXME: not found @@ -104,41 +104,41 @@ ;;; ./filter/gr_fir_filter_ccc.h FIXME: not found ;; (pass-if (true? (gr:fir-filter-ccc 1 #(1+3i 23+5i)))) -;;; ./filter/gr_fir_filter_ccf.h FIXME: not found -;; (pass-if (true? (gr:fir-filter-ccf 1 #(1.0 2.0)))) +;;; ./filter/gr_fir_filter_ccf.h +(pass-if (true? (gr:fir-filter-ccf 1 #(1.0 2.0)))) -;;; ./filter/gr_fir_filter_fcc.h FIXME: not found -;; (pass-if (true? (gr:fir-filter-fcc 1 #(1+3i 23+5i)))) +;;; ./filter/gr_fir_filter_fcc.h +(pass-if (true? (gr:fir-filter-fcc 1 #(1+3i 23+5i)))) -;;; ./filter/gr_fir_filter_fff.h FIXME: not found -;; (pass-if (true? (gr:fir-filter-fff 1 #(1.0 2.0)))) +;;; ./filter/gr_fir_filter_fff.h +(pass-if (true? (gr:fir-filter-fff 1 #(1.0 2.0)))) -;;; ./filter/gr_fir_filter_fsf.h FIXME: not found -;; (pass-if (true? (gr:fir-filter-fsf 1 #(1.0 2.0)))) +;;; ./filter/gr_fir_filter_fsf.h +(pass-if (true? (gr:fir-filter-fsf 1 #(1.0 2.0)))) -;;; ./filter/gr_fir_filter_scc.h FIXME: not found -;; (pass-if (true? (gr:fir-filter-scc 1 #(1+3i 23+5i)))) +;;; ./filter/gr_fir_filter_scc.h +(pass-if (true? (gr:fir-filter-scc 1 #(1+3i 23+5i)))) -;;; ./filter/gr_fir_fsf_generic.h FIXME: not found +;;; ./filter/gr_fir_fsf_generic.h FIXME: "Unbound variable: ~S" (gr:fir-fsf-generic) #f)) ;; (pass-if (true? (gr:fir-fsf-generic))) ;; (pass-if (true? (gr:fir-fsf-generic #(1.0 2.0)))) ;;; ./filter/gr_fir_fsf_simd.h FIXME: not found ;; (pass-if (true? (gr:fir-fsf-simd 0 0 0))) -;;; ./filter/gr_fir_fsf_x86.h FIXME: not found +;;; ./filter/gr_fir_fsf_x86.h FIXME: "Unbound variable: ~S" (gr:fir-fsf-x86) #f)) ;; (pass-if (true? (gr:fir-fsf-x86))) ;; (pass-if (true? (gr:fir-fsf-x86 #(1.0 2.0)))) -;;; ./filter/gr_fir_scc_generic.h FIXME: not found +;;; ./filter/gr_fir_scc_generic.h FIXME: file not found ;; (pass-if (true? (gr:fir-scc-generic))) ;; (pass-if (true? (gr:fir-scc-generic #(1+3i 23+5i)))) -;;; ./filter/gr_fir_scc_simd.h FIXME: not found +;;; ./filter/gr_fir_scc_simd.h FIXME: Unbound variable: ~S" (gr:fir-scc-simd) #f)) ;; (pass-if (true? (gr:fir-scc-simd))) ;; (pass-if (true? (gr:fir-scc-simd #(1+3i 23+5i)))) -;;; ./filter/gr_fir_scc_x86.h FIXME: not found +;;; ./filter/gr_fir_scc_x86.h FIXME: "Unbound variable: ~S" (gr:fir-scc-x86) #f)) ;; (pass-if (true? (gr:fir-scc-x86))) ;; (pass-if (true? (gr:fir-scc-x86 #(1+3i 23+5i)))) @@ -152,97 +152,97 @@ ;; (pass-if (true? (gr:fir-sysconfig-powerpc ))) ;;; ./filter/gr_fir_sysconfig_x86.h FIXME: virtual methods -;; (pass-if (true? (gr:fir-sysconfig-x86 ))) +;; (pass-if (true? (gr:fir-sysconfig-x86 #(1+3i 23+5i)))) -;;; ./filter/gr_fractional_interpolator_cc.h FIXME: not found +;;; ./filter/gr_fractional_interpolator_cc.h FIXME: file not found ;; (pass-if (true? (gr:fractional-interpolator-cc 1.0 1.0))) -;;; ./filter/gr_fractional_interpolator_ff.h FIXME: not found +;;; ./filter/gr_fractional_interpolator_ff.h FIXME: file not found ;; (pass-if (true? (gr:fractional-interpolator-ff 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_ccc.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-ccc 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_ccf.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-ccf 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_fcc.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-fcc 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_fcf.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-fcf 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_scc.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_scc.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-scc 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_scf.h FIXME: not found +;;; ./filter/gr_freq_xlating_fir_filter_scf.h FIXME: file not found ;; (pass-if (true? (gr:freq-xlating-fir-filter-scf 1.0 1.0))) -;;; ./filter/gr_goertzel_fc.h FIXME: not found -;; (pass-if (true? (gr:goertzel-fc 1 1 1))) +;;; ./filter/gr_goertzel_fc.h +(pass-if (true? (gr:goertzel-fc 1 1 1))) -;;; ./filter/gr_hilbert_fc.h FIXME: not found -;; (pass-if (true? (gr:hilbert-fc ))) +;;; ./filter/gr_hilbert_fc.h +(pass-if (true? (gr:hilbert-fc 1))) -;;; ./filter/gr_iir_filter_ffd.h FIXME: not found -;; (pass-if (true? (gr:iir-filter-ffd ))) +;;; ./filter/gr_iir_filter_ffd.h +(pass-if (true? (gr:iir-filter-ffd #(1.0 2.0) #(1.0 2.0)))) -;;; ./filter/gr_interp_fir_filter_ccc.h FIXME: not found +;;; ./filter/gr_interp_fir_filter_ccc.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-ccc ))) -;;; ./filter/gr_interp_fir_filter_ccf.h FIXME: not found +;;; ./filter/gr_interp_fir_filter_ccf.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-ccf ))) -;;; ./filter/gr_interp_fir_filter_fcc.h FIXME: not found +;;; ./filter/gr_interp_fir_filter_fcc.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-fcc ))) -;;; ./filter/gr_interp_fir_filter_fff.h FIXME: not found +;;; ./filter/gr_interp_fir_filter_fff.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-fff ))) -;;; ./filter/gr_interp_fir_filter_fsf.h FIXME: not found +;;; ./filter/gr_interp_fir_filter_fsf.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-fsf ))) -;;; ./filter/gr_interp_fir_filter_scc.h +;;; ./filter/gr_interp_fir_filter_scc.h FIXME: file not found ;; (pass-if (true? (gr:interp-fir-filter-scc ))) ;;; ./filter/gr_pfb_arb_resampler_ccf.h -;; (pass-if (true? (gr:pfb-arb-resampler-ccf ))) +(pass-if (true? (gr:pfb-arb-resampler-ccf 1.0 #(1.0 2.0) 32))) ;;; ./filter/gr_pfb_channelizer_ccf.h -;; (pass-if (true? (gr:pfb-channelizer-ccf ))) +(pass-if (true? (gr:pfb-channelizer-ccf 1 #(1.0 2.0) 1))) ;;; ./filter/gr_pfb_clock_sync_ccf.h -;; (pass-if (true? (gr:pfb-clock-sync-ccf ))) +(pass-if (true? (gr:pfb-clock-sync-ccf 1.0 1.0 #(1.0 2.0) 32 0 1.5))) ;;; ./filter/gr_pfb_clock_sync_fff.h -;; (pass-if (true? (gr:pfb-clock-sync-fff ))) +(pass-if (true? (gr:pfb-clock-sync-fff 1.0 1.0 #(1.0 2.0) 32 0 1.5))) ;;; ./filter/gr_pfb_decimator_ccf.h -;; (pass-if (true? (gr:pfb-decimator-ccf ))) +(pass-if (true? (gr:pfb-decimator-ccf 1 #(1.0 2.0) 0))) ;;; ./filter/gr_pfb_interpolator_ccf.h -;; (pass-if (true? (gr:pfb-interpolator-ccf ))) +(pass-if (true? (gr:pfb-interpolator-ccf 1 #(1.0 2.0)))) -;;; ./filter/gr_rational_resampler_base_ccc.h +;;; ./filter/gr_rational_resampler_base_ccc.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-ccc ))) -;;; ./filter/gr_rational_resampler_base_ccf.h +;;; ./filter/gr_rational_resampler_base_ccf.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-ccf ))) -;;; ./filter/gr_rational_resampler_base_fcc.h +;;; ./filter/gr_rational_resampler_base_fcc.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-fcc ))) -;;; ./filter/gr_rational_resampler_base_fff.h +;;; ./filter/gr_rational_resampler_base_fff.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-fff ))) -;;; ./filter/gr_rational_resampler_base_fsf.h +;;; ./filter/gr_rational_resampler_base_fsf.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-fsf ))) -;;; ./filter/gr_rational_resampler_base_scc.h +;;; ./filter/gr_rational_resampler_base_scc.h FIXME: file not found ;; (pass-if (true? (gr:rational-resampler-base-scc ))) ;;; ./filter/gr_single_pole_iir_filter_cc.h -;; (pass-if (true? (gr:single-pole-iir-filter-cc ))) +(pass-if (true? (gr:single-pole-iir-filter-cc 1.0 1))) ;;; ./filter/gr_single_pole_iir_filter_ff.h -;; (pass-if (true? (gr:single-pole-iir-filter-ff ))) +(pass-if (true? (gr:single-pole-iir-filter-ff 1.0 1))) diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index a18766400..6abc08399 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -116,10 +116,8 @@ ;;; ./general/gr_conjugate_cc.h (pass-if (true? (gr:conjugate-cc))) -;;; ./general/gr_constellation_decoder_cb.h FIXME: wrong-arg-type (not sure why...) -;gr_constellation_decoder_cb (const std::vector &sym_position, -; const std::vector &sym_value_out); -;; (pass-if (true? (gr:constellation-decoder-cb #(2+3i 23+5i) #(0 1)))) +;;; ./general/gr_constellation_decoder_cb.h +(pass-if (true? (gr:constellation-decoder-cb #(2+3i 23+5i) #(0 1)))) ;;; ./general/gr_copy.h (pass-if (true? (gr:copy 1))) @@ -167,7 +165,7 @@ ;;; ./general/gr_encode_ccsds_27_bb.h (pass-if (true? (gr:encode-ccsds-27-bb))) -;;; ./general/gr_fake_channel_coder_pp.h FIXME: file name doesn't match class name +;;; ./general/gr_fake_channel_coder_pp.h (pass-if (true? (gr:fake-channel-encoder-pp 1 1))) (pass-if-throw "confirm throw" #t (true? (gr:fake-channel-encoder-pp -1 1))) @@ -178,7 +176,6 @@ (pass-if (true? (gr:fft-vcc 1 #f #(1.0 2.0) #t))) ;;; ./general/gr_fft_vfc.h -;; bool set_window(const std::vector &window); (pass-if (true? (gr:fft-vfc 4 #t #(1.0 2.0 3.0 4.0)))) (pass-if-throw "confirm throw gr:fft-vfc" #t (true? (gr:fft-vfc 4 #f #(1.0 2.0 3.0 4.0)))) @@ -239,7 +236,6 @@ (pass-if (true? (gr:lms-dfe-ff 1 1 1 1))) ;;; ./general/gr_map_bb.h -;; gr_map_bb (const std::vector &map); (pass-if (true? (gr:map-bb #(1 2)))) ;;; ./general/gr_mpsk_receiver_cc.h @@ -260,25 +256,14 @@ ;;; ./general/gr_ofdm_cyclic_prefixer.h (pass-if (true? (gr:ofdm-cyclic-prefixer 1 1))) -;;; ./general/gr_ofdm_frame_acquisition.h FIXME: "No matching method for generic function `ofdm_frame_acquisition'" -;; gr_ofdm_frame_acquisition (unsigned int occupied_carriers, -;; unsigned int fft_length, -;; unsigned int cplen, -;; const std::vector &known_symbol, -;; unsigned int max_fft_shift_len); -;; (pass-if (true? (gr:ofdm-frame-acquisition 0 0 0 #(1+3i 23+5i) 0))) +;;; ./general/gr_ofdm_frame_acquisition.h +(pass-if (true? (gr:ofdm-frame-acquisition 1 1 1 #(1+3i 23+5i) 1))) ;;; ./general/gr_ofdm_frame_sink.h FIXME: "No matching method for generic function `ofdm_frame_sink'" -;; gr_ofdm_frame_sink(const std::vector &sym_position, -;; const std::vector &sym_value_out, -;; gr_msg_queue_sptr target_queue, unsigned int occupied_tones, -;; float phase_gain, float freq_gain); -;;(pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) (gr:msg-queue) 1 0.25 0))) - -;;; ./general/gr_ofdm_insert_preamble.h FIXME: Wrong type argument in position ~A: -;; gr_ofdm_insert_preamble(int fft_length, -;; const std::vector > &preamble); -;;(pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i))))) +;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) (gr:msg-queue) 1 0.25 0))) + +;;; ./general/gr_ofdm_insert_preamble.h FIXME: "Wrong type argument in position ~A: ~S" +;; (pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i))))) ;;; ./general/gr_ofdm_mapper_bcv.h FIXME: Wrong type argument in position ~A: ;; gr_ofdm_mapper_bcv (const std::vector &constellation, diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index 10eb1d9e0..43996c001 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -50,9 +50,8 @@ ;;; ./gengen/gr_add_const_ss.h (pass-if (true? (gr:add-const-ss 0))) -;;; ./gengen/gr_add_const_vcc.h FIXME: Wrong type argument in position ~A: -;; gr_make_add_const_vcc (const std::vector &k); -;; (pass-if (true? (gr:add-const-vcc #(1+3i 23+5i)))) +;;; ./gengen/gr_add_const_vcc.h +(pass-if (true? (gr:add-const-vcc #(1+3i 23+5i)))) ;;; ./gengen/gr_add_const_vff.h (pass-if (true? (gr:add-const-vff #(1.0 2.0)))) @@ -99,25 +98,23 @@ ;;; ./gengen/gr_argmax_ss.h (pass-if (true? (gr:argmax-ss 1))) -;;; ./gengen/gr_chunks_to_symbols_bc.h FIXME: not found -;; (pass-if (true? (gr:chunks-to-symbols-bc #(1+3i 23+5i) 1))) +;;; ./gengen/gr_chunks_to_symbols_bc.h +(pass-if (true? (gr:chunks-to-symbols-bc #(1+3i 23+5i) 1))) ;;; ./gengen/gr_chunks_to_symbols_bf.h (pass-if (true? (gr:chunks-to-symbols-bf #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_ic.h FIXME: not found -;; gr_make_chunks_to_symbols_ic (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks-to-symbols-ic #(1+3i 23+5i) 1))) +;;; ./gengen/gr_chunks_to_symbols_ic.h +(pass-if (true? (gr:chunks-to-symbols-ic #(1+3i 23+5i) 1))) -;;; ./gengen/gr_chunks_to_symbols_if.h FIXME: not found -;; gr_make_chunks_to_symbols_if (const std::vector &symbol_table, const int D = 1); -;; (pass-if (true? (gr:chunks_to_symbols_if #(1.0 2.0) 1))) +;;; ./gengen/gr_chunks_to_symbols_if.h +(pass-if (true? (gr:chunks-to-symbols-if #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_sc.h FIXME: not found -;; (pass-if (true? (gr:chunks_to_symbols_sc #(1.0 2.0) 1))) +;;; ./gengen/gr_chunks_to_symbols_sc.h +(pass-if (true? (gr:chunks-to-symbols-sc #(1.0 2.0) 1))) -;;; ./gengen/gr_chunks_to_symbols_sf.h FIXME: not found -;; (pass-if (true? (gr:chunks_to_symbols_sf #(1.0 2.0) 1))) +;;; ./gengen/gr_chunks_to_symbols_sf.h +(pass-if (true? (gr:chunks-to-symbols-sf #(1.0 2.0) 1))) ;;; ./gengen/gr_divide_cc.h (pass-if (true? (gr:divide-cc 1))) @@ -179,9 +176,8 @@ ;;; ./gengen/gr_multiply_const_ss.h (pass-if (true? (gr:multiply-const-ss 1))) -;;; ./gengen/gr_multiply_const_vcc.h FIXME: wrong type argument in position ~A: -;; gr_make_multiply_const_vcc (const std::vector &k); -;; (pass-if (true? (gr:multiply-const-vcc #(1+3i 23+5i)))) +;;; ./gengen/gr_multiply_const_vcc.h +(pass-if (true? (gr:multiply-const-vcc #(1+3i 23+5i)))) ;;; ./gengen/gr_multiply_const_vff.h (pass-if (true? (gr:multiply-const-vff #(1.0 2.0)))) @@ -321,19 +317,16 @@ ;;; ./gengen/gr_vector_sink_s.h (pass-if (true? (gr:vector-sink-s 1))) -;;; ./gengen/gr_vector_source_b.h FIXME: not found +;;; ./gengen/gr_vector_source_b.h ;; (pass-if (true? (gr:vector-source-b #(1 2) false 1))) -;;; ./gengen/gr_vector_source_c.h FIXME: not found -;; gr_make_vector_source_c (const std::vector &data, bool repeat = false, int vlen = 1) +;; ;;; ./gengen/gr_vector_source_c.h ;; (pass-if (true? (gr:vector-source-c #(1+3i 23+5i) false 1))) -;;; ./gengen/gr_vector_source_f.h FIXME: not found -;; gr_make_vector_source_f (const std::vector &data, bool repeat = false, int vlen = 1) +;; ;;; ./gengen/gr_vector_source_f.h ;; (pass-if (true? (gr:vector-source-f #(1.0 2.0) false 1))) -;;; ./gengen/gr_vector_source_i.h FIXME: not found -;; gr_make_vector_source_i (const std::vector &data, bool repeat = false, int vlen = 1) +;;; ./gengen/gr_vector_source_i.h ;; (pass-if (true? (gr:vector-source-i #(1 2) false 1))) ;;; ./gengen/gr_vector_source_s.h FIXME: not found diff --git a/gnuradio-core/src/guile/tests/hier_ctors.test b/gnuradio-core/src/guile/tests/hier_ctors.test index 8a83c86d5..b79ee0f15 100644 --- a/gnuradio-core/src/guile/tests/hier_ctors.test +++ b/gnuradio-core/src/guile/tests/hier_ctors.test @@ -32,9 +32,9 @@ ;;; Add test code for all constructors in these files ;;; -;;; ./hier/gr_channel_model.h +;;; ./hier/gr_channel_model.h FIXME: Unbound variable: ~S" (gr:channel_model) #f)) ;; gr_make_channel_model(double noise_voltage=0.0, double frequency_offset=0.0, ;; double epsilon=1.0, ;; const std::vector &taps=std::vector(1, 1), ;; double noise_seed=3021); -;; (pass-if (true? (gr:channel_model ))) +;; (pass-if (true? (gr:channel_model 0.0 0.0 1.0 #(1 1) 3021))) diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 80fb2d3f2..b74d66cda 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -33,10 +33,10 @@ ;;; ;;; ./io/gr_file_descriptor_sink.h -;;(pass-if (true? (gr:file-descriptor-sink 0 0))) FIXME: throws gr_io_signature(3) +(pass-if (true? (gr:file-descriptor-sink 1 1))) -;;; ./io/gr_file_descriptor_source.h -;; (pass-if (true? (gr:file-descriptor-source 1 1 false))) FIXME: not found +;;; ./io/gr_file_descriptor_source.h FIXME: not found +;; (pass-if (true? (gr:file-descriptor-source 1 1 false))) ;;; ./io/gr_file_sink.h (pass-if (true? (gr:file-sink 1 "foo"))) @@ -51,8 +51,8 @@ ;;; ./io/gr_message_sink.h FIXME: not found ;; (pass-if (true? (gr:message-sink 1 1 false))) -;;; ./io/gr_message_source.h -;; (pass-if (true? (gr:message-source ))) +;;; ./io/gr_message_source.h FIXME: not found +;; (pass-if (true? (gr:message-source 1.0 0))) ;;; ./io/gr_oscope_sink_f.h FIXME: not found ;; _oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, -- cgit From 2ce754d59c537b0ca395442a94c908f2b8b3dd58 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 17 Nov 2010 19:44:36 -0800 Subject: Moved prune tags to gr_buffer. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 42 ++++++++++++++---------------- gnuradio-core/src/lib/runtime/gr_buffer.h | 5 ++-- 2 files changed, 22 insertions(+), 25 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 70d57c094..1488e92f6 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -162,9 +162,7 @@ gr_buffer::space_available () min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); } - for (size_t i = 0; i < d_readers.size (); i++) { - d_readers[i]->prune_tags(min_items_read); - } + prune_tags(min_items_read); // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader @@ -230,6 +228,25 @@ gr_buffer::add_item_tag(const pmt::pmt_t &tag) d_item_tags.push_back(tag); } +void +gr_buffer::prune_tags(uint64_t max_time) +{ + //gruel::scoped_lock guard(*mutex()); + + int n = 0; + uint64_t item_time; + std::deque::iterator itr = d_item_tags.begin(); + + while(itr != d_item_tags.end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + if(item_time < max_time) { + d_item_tags.pop_front(); + n++; + } + itr++; + } +} + long gr_buffer_ncurrently_allocated () { @@ -293,25 +310,6 @@ gr_buffer_reader::get_tags_in_range(std::vector &v, } } -void -gr_buffer_reader::prune_tags(uint64_t max_time) -{ - int n = 0; - uint64_t item_time; - std::deque::iterator itr = d_buffer->get_tags_begin(); - - while(itr != d_buffer->get_tags_end()) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - if(item_time < max_time) { - d_buffer->tags_pop_front(); - n++; - } - //else - // break; - itr++; - } -} - long gr_buffer_reader_ncurrently_allocated () { diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 88a76fdc6..2d88c1722 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -99,9 +99,10 @@ class gr_buffer { */ void add_item_tag(const pmt::pmt_t &tag); + void prune_tags(uint64_t max_time); + std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } std::deque::iterator get_tags_end() { return d_item_tags.end(); } - void tags_pop_front() { d_item_tags.pop_front(); } // ------------------------------------------------------------------------- @@ -263,8 +264,6 @@ class gr_buffer_reader { uint64_t abs_start, uint64_t abs_end); - void prune_tags(uint64_t max_time); - // ------------------------------------------------------------------------- private: -- cgit From 5331ab1ce1d24e1608f11fc57df5c84ad3c8be9e Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 17 Nov 2010 20:55:47 -0700 Subject: fixe more tests --- gnuradio-core/src/guile/tests/filter_ctors.test | 60 ++++++++++++------------ gnuradio-core/src/guile/tests/general_ctors.test | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/filter_ctors.test b/gnuradio-core/src/guile/tests/filter_ctors.test index ee851b6e0..4dd0bc187 100644 --- a/gnuradio-core/src/guile/tests/filter_ctors.test +++ b/gnuradio-core/src/guile/tests/filter_ctors.test @@ -154,29 +154,29 @@ ;;; ./filter/gr_fir_sysconfig_x86.h FIXME: virtual methods ;; (pass-if (true? (gr:fir-sysconfig-x86 #(1+3i 23+5i)))) -;;; ./filter/gr_fractional_interpolator_cc.h FIXME: file not found -;; (pass-if (true? (gr:fractional-interpolator-cc 1.0 1.0))) +;;; ./filter/gr_fractional_interpolator_cc.h +(pass-if (true? (gr:fractional-interpolator-cc 1.0 1.0))) -;;; ./filter/gr_fractional_interpolator_ff.h FIXME: file not found -;; (pass-if (true? (gr:fractional-interpolator-ff 1.0 1.0))) +;;; ./filter/gr_fractional_interpolator_ff.h +(pass-if (true? (gr:fractional-interpolator-ff 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_ccc.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-ccc 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_ccc.h +(pass-if (true? (gr:freq-xlating-fir-filter-ccc 1 #(1+3i 23+5i) 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_ccf.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-ccf 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_ccf.h +(pass-if (true? (gr:freq-xlating-fir-filter-ccf 1 #(1.0 2.0) 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_fcc.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-fcc 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_fcc.h +(pass-if (true? (gr:freq-xlating-fir-filter-fcc 1 #(1.0 2.0) 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_fcf.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-fcf 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_fcf.h +(pass-if (true? (gr:freq-xlating-fir-filter-fcf 1 #(1.0 2.0) 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_scc.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-scc 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_scc.h +(pass-if (true? (gr:freq-xlating-fir-filter-scc 1 #(1.0 2.0) 1.0 1.0))) -;;; ./filter/gr_freq_xlating_fir_filter_scf.h FIXME: file not found -;; (pass-if (true? (gr:freq-xlating-fir-filter-scf 1.0 1.0))) +;;; ./filter/gr_freq_xlating_fir_filter_scf.h +(pass-if (true? (gr:freq-xlating-fir-filter-scf 1 #(1.0 2.0) 1.0 1.0))) ;;; ./filter/gr_goertzel_fc.h (pass-if (true? (gr:goertzel-fc 1 1 1))) @@ -187,22 +187,22 @@ ;;; ./filter/gr_iir_filter_ffd.h (pass-if (true? (gr:iir-filter-ffd #(1.0 2.0) #(1.0 2.0)))) -;;; ./filter/gr_interp_fir_filter_ccc.h FIXME: file not found -;; (pass-if (true? (gr:interp-fir-filter-ccc ))) +;;; ./filter/gr_interp_fir_filter_ccc.h FIXME: not found +;; (pass-if (true? (gr:interp-fir-filter-ccc #(1+3i 23+5i)))) -;;; ./filter/gr_interp_fir_filter_ccf.h FIXME: file not found +;;; ./filter/gr_interp_fir_filter_ccf.h FIXME: not found ;; (pass-if (true? (gr:interp-fir-filter-ccf ))) -;;; ./filter/gr_interp_fir_filter_fcc.h FIXME: file not found +;;; ./filter/gr_interp_fir_filter_fcc.h FIXME: not found ;; (pass-if (true? (gr:interp-fir-filter-fcc ))) -;;; ./filter/gr_interp_fir_filter_fff.h FIXME: file not found +;;; ./filter/gr_interp_fir_filter_fff.h FIXME: not found ;; (pass-if (true? (gr:interp-fir-filter-fff ))) -;;; ./filter/gr_interp_fir_filter_fsf.h FIXME: file not found +;;; ./filter/gr_interp_fir_filter_fsf.h FIXME: not found ;; (pass-if (true? (gr:interp-fir-filter-fsf ))) -;;; ./filter/gr_interp_fir_filter_scc.h FIXME: file not found +;;; ./filter/gr_interp_fir_filter_scc.h FIXME: not found ;; (pass-if (true? (gr:interp-fir-filter-scc ))) ;;; ./filter/gr_pfb_arb_resampler_ccf.h @@ -223,22 +223,22 @@ ;;; ./filter/gr_pfb_interpolator_ccf.h (pass-if (true? (gr:pfb-interpolator-ccf 1 #(1.0 2.0)))) -;;; ./filter/gr_rational_resampler_base_ccc.h FIXME: file not found -;; (pass-if (true? (gr:rational-resampler-base-ccc ))) +;;; ./filter/gr_rational_resampler_base_ccc.h FIXME: not found +;; (pass-if (true? (gr:rational-resampler-base-ccc 1 1 #(1+3i 23+5i)))) -;;; ./filter/gr_rational_resampler_base_ccf.h FIXME: file not found +;;; ./filter/gr_rational_resampler_base_ccf.h FIXME: not found ;; (pass-if (true? (gr:rational-resampler-base-ccf ))) -;;; ./filter/gr_rational_resampler_base_fcc.h FIXME: file not found +;;; ./filter/gr_rational_resampler_base_fcc.h FIXME: not found ;; (pass-if (true? (gr:rational-resampler-base-fcc ))) -;;; ./filter/gr_rational_resampler_base_fff.h FIXME: file not found +;;; ./filter/gr_rational_resampler_base_fff.h FIXME: not found ;; (pass-if (true? (gr:rational-resampler-base-fff ))) -;;; ./filter/gr_rational_resampler_base_fsf.h FIXME: file not found +;;; ./filter/gr_rational_resampler_base_fsf.h FIXME: not found ;; (pass-if (true? (gr:rational-resampler-base-fsf ))) -;;; ./filter/gr_rational_resampler_base_scc.h FIXME: file not found +;;; ./filter/gr_rational_resampler_base_scc.h FIXME: not found ;; (pass-if (true? (gr:rational-resampler-base-scc ))) ;;; ./filter/gr_single_pole_iir_filter_cc.h diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index 6abc08399..d09766a95 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -260,7 +260,7 @@ (pass-if (true? (gr:ofdm-frame-acquisition 1 1 1 #(1+3i 23+5i) 1))) ;;; ./general/gr_ofdm_frame_sink.h FIXME: "No matching method for generic function `ofdm_frame_sink'" -;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(1 2) (gr:msg-queue) 1 0.25 0))) +;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #('a' 'b') (gr:msg-queue) 1 0.25 0))) ;;; ./general/gr_ofdm_insert_preamble.h FIXME: "Wrong type argument in position ~A: ~S" ;; (pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i))))) -- cgit From f60c4420e1fdef24687ffed6baf4fd7fa5ca5cf8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 18 Nov 2010 17:33:05 -0800 Subject: Fix guile related problems with gr_message_{sink,source}. --- gnuradio-core/src/guile/gnuradio/core.scm | 11 ++++++++++- gnuradio-core/src/guile/tests/io_ctors.test | 23 ++++++++++++++--------- gnuradio-core/src/lib/io/gr_message_source.i | 13 ++++++++----- 3 files changed, 32 insertions(+), 15 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/core.scm b/gnuradio-core/src/guile/gnuradio/core.scm index b24d5afa9..9c69cea42 100644 --- a/gnuradio-core/src/guile/gnuradio/core.scm +++ b/gnuradio-core/src/guile/gnuradio/core.scm @@ -1,6 +1,7 @@ ;;; Glue the separate pieces of gnuradio-core into a single module (define-module (gnuradio core) + #:use-module (oop goops) #:use-module (gnuradio gnuradio_core_runtime) #:use-module (gnuradio runtime-shim) #:use-module (gnuradio gnuradio_core_filter) @@ -8,7 +9,7 @@ #:use-module (gnuradio gnuradio_core_general) #:use-module (gnuradio gnuradio_core_gengen) #:use-module (gnuradio gnuradio_core_hier) - #:duplicates (merge-generics check)) + #:duplicates (merge-generics replace check)) (re-export-all '(gnuradio gnuradio_core_runtime)) (re-export-all '(gnuradio runtime-shim)) @@ -18,6 +19,14 @@ (re-export-all '(gnuradio gnuradio_core_gengen)) (re-export-all '(gnuradio gnuradio_core_hier)) +;; Work around problem with gr:message-source +(define-generic gr:message-source) +(define-method (gr:message-source itemsize (msgq )) + (gr:message-source-msgq-ctor itemsize msgq)) +(define-method (gr:message-source itemsize (limit )) + (gr:message-source-limit-ctor itemsize limit)) +(export gr:message-source) + ;;; Return #t if x is not #f (define-public (true? x) (and x #t)) diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index b74d66cda..99c84ae37 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -29,6 +29,10 @@ (use-modules (gnuradio core)) (use-modules (oop goops)) + +(define (rm-foo) + (false-if-exception (delete-file "foo"))) + ;;; Add test code for all constructors in these files ;;; @@ -36,23 +40,24 @@ (pass-if (true? (gr:file-descriptor-sink 1 1))) ;;; ./io/gr_file_descriptor_source.h FIXME: not found -;; (pass-if (true? (gr:file-descriptor-source 1 1 false))) +;; (pass-if (true? (gr:file-descriptor-source 1 1 #f))) ;;; ./io/gr_file_sink.h (pass-if (true? (gr:file-sink 1 "foo"))) ;;; ./io/gr_file_source.h FIXME: not found -;; (pass-if (true? (gr:file-source 1 "foo" false))) +;; (pass-if (true? (gr:file-source 1 "foo" #f))) ;;; ./io/gr_histo_sink_f.h FIXME: not found ;; gr_make_histo_sink_f (gr_msg_queue_sptr msgq); ;; (pass-if (true? (gr:histo-sink-f 1))) -;;; ./io/gr_message_sink.h FIXME: not found -;; (pass-if (true? (gr:message-sink 1 1 false))) +;;; ./io/gr_message_sink.h +(pass-if (true? (gr:message-sink 1 (gr:msg-queue) #f))) -;;; ./io/gr_message_source.h FIXME: not found -;; (pass-if (true? (gr:message-source 1.0 0))) +;;; ./io/gr_message_source.h +(pass-if (true? (gr:message-source 1 1))) +(pass-if (true? (gr:message-source 1 (gr:msg-queue)))) ;;; ./io/gr_oscope_sink_f.h FIXME: not found ;; _oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, @@ -65,14 +70,14 @@ ;; (pass-if (true? (gr:oscope_sink_x "foo" 1 1))) ;;; ./io/gr_udp_sink.h FIXME: not found -;; (pass-if (true? (gr:udp-sink 1 "foo" 1472 true))) +;; (pass-if (true? (gr:udp-sink 1 "foo" 1472 #t))) ;;; ./io/gr_udp_source.h FIXME: not found -;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 true true))) +;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 #t #t))) ;;; ./io/gr_wavfile_sink.h FIXME: not found ;; (pass-if (true? (gr:message-source "foo" 1 1 1))) ;;; ./io/gr_wavfile_source.h FIXME: not found -;; (pass-if (true? (gr:message-source "foo" false))) +;; (pass-if (true? (gr:message-source "foo" #f))) diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i index 3566ee5a7..e4e2016d0 100644 --- a/gnuradio-core/src/lib/io/gr_message_source.i +++ b/gnuradio-core/src/lib/io/gr_message_source.i @@ -20,12 +20,16 @@ * Boston, MA 02110-1301, USA. */ -#ifdef SWIGGUILE -#warning "gr_message_source.i: FIXME being ignored by swig/guile for now" -#else - GR_SWIG_BLOCK_MAGIC(gr,message_source); +#ifdef SWIGGUILE +// Rename these. Without this, the primitive bindings are OK, but the +// goops bindings try to create a bogus generic-function... +// See core.scm for the second part of the workaround. +%rename(message_source_limit_ctor) gr_make_message_source(size_t itemsize, int msgq_limit); +%rename(message_source_msgq_ctor) gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq); +#endif + gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0); gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq); @@ -40,4 +44,3 @@ class gr_message_source : public gr_sync_block gr_msg_queue_sptr msgq() const; }; -#endif -- cgit From 9631c1fa5f67379218459030d4697ab56720fbfa Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 18 Nov 2010 18:39:14 -0700 Subject: don't generate the list of scripts here, use the version in Makefile.swig --- gnuradio-core/src/lib/swig/Makefile.am | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 16b5d677e..e990d998e 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -56,8 +56,6 @@ nobase_swiginclude_HEADERS = \ guile/std_complex.i \ guile/std_vector.i - -if PYTHON AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) @@ -70,8 +68,8 @@ ourpython_PYTHON = gnuradio_core.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... - -gnuradio_swig_bug_workaround.h : gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix +if PYTHON +gnuradio_swig_bug_workaround.h: gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio @@ -98,19 +96,13 @@ gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) # add some of the variables generated inside the Makefile.swig -# include the SWIG-generated .h files in the BUILT SOURCES, since they -# aren't by default when using Makefile.swig; order doesn't matter. -PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) -swig_built_sources += $(PYTHON_GEN) -endif # end of if python +endif # end of python -if GUILE -SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE -#GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE))) -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) -# GUILE_GEN_STAMPS = $(filter %.scm,$(TOP_SWIG_IFILES)) -swig_built_sources += $(GUILE_GEN) -endif +if PYTHON +else +gnuradio_swig_bug_workaround.h: + @touch gnuradio_swig_bug_workaround.h +endif # end of guile # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -- cgit From f2e0c5b9a703afb919fdcd9a49381bc2160a149e Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 18 Nov 2010 18:39:34 -0700 Subject: regenerated --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 204 ++++++++++++++++++--------- 1 file changed, 138 insertions(+), 66 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index dc7a7b3bb..160fc8fd8 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -79,6 +79,7 @@ gnuradio_core_runtime_swiginclude_HEADERS = \ gnuradio_core_runtime.i \ $(gnuradio_core_runtime_swiginclude_headers) +if PYTHON gnuradio_core_runtime_pylib_LTLIBRARIES = \ _gnuradio_core_runtime.la @@ -86,6 +87,10 @@ _gnuradio_core_runtime_la_SOURCES = \ python/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) +gnuradio_core_runtime_python_PYTHON = \ + gnuradio_core_runtime.py \ + $(gnuradio_core_runtime_python) + _gnuradio_core_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_runtime_la_swig_libadd) @@ -99,27 +104,34 @@ _gnuradio_core_runtime_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_runtime_la_swig_cxxflags) -gnuradio_core_runtime_python_PYTHON = \ - gnuradio_core_runtime.py \ - $(gnuradio_core_runtime_python) - python/gnuradio_core_runtime.cc: gnuradio_core_runtime.py gnuradio_core_runtime.py: gnuradio_core_runtime.i # Include the python dependencies for this file -include python/gnuradio_core_runtime.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la + +gnuradio_core_runtime_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_runtime.la libguile_gnuradio_core_runtime_la_SOURCES = \ guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) -nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primitive.scm - -libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD) -libguile_gnuradio_core_runtime_la_LDFLAGS = $(_gnuradio_core_runtime_la_LDFLAGS) -libguile_gnuradio_core_runtime_la_CXXFLAGS = $(_gnuradio_core_runtime_la_CXXFLAGS) +nobase_gnuradio_core_runtime_scm_DATA = \ + gnuradio/gnuradio_core_runtime.scm \ + gnuradio/gnuradio_core_runtime-primitive.scm +libguile_gnuradio_core_runtime_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_runtime_la_swig_libadd) +libguile_gnuradio_core_runtime_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_runtime_la_swig_ldflags) +libguile_gnuradio_core_runtime_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_runtime_la_swig_cxxflags) guile/gnuradio_core_runtime.cc: gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime.scm: gnuradio_core_runtime.i @@ -212,6 +224,7 @@ gnuradio_core_general_swiginclude_HEADERS = \ gnuradio_core_general.i \ $(gnuradio_core_general_swiginclude_headers) +if PYTHON gnuradio_core_general_pylib_LTLIBRARIES = \ _gnuradio_core_general.la @@ -219,6 +232,10 @@ _gnuradio_core_general_la_SOURCES = \ python/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) +gnuradio_core_general_python_PYTHON = \ + gnuradio_core_general.py \ + $(gnuradio_core_general_python) + _gnuradio_core_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_general_la_swig_libadd) @@ -232,27 +249,34 @@ _gnuradio_core_general_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_general_la_swig_cxxflags) -gnuradio_core_general_python_PYTHON = \ - gnuradio_core_general.py \ - $(gnuradio_core_general_python) - python/gnuradio_core_general.cc: gnuradio_core_general.py gnuradio_core_general.py: gnuradio_core_general.i # Include the python dependencies for this file -include python/gnuradio_core_general.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la + +gnuradio_core_general_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_general.la libguile_gnuradio_core_general_la_SOURCES = \ guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) -nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primitive.scm - -libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD) -libguile_gnuradio_core_general_la_LDFLAGS = $(_gnuradio_core_general_la_LDFLAGS) -libguile_gnuradio_core_general_la_CXXFLAGS = $(_gnuradio_core_general_la_CXXFLAGS) +nobase_gnuradio_core_general_scm_DATA = \ + gnuradio/gnuradio_core_general.scm \ + gnuradio/gnuradio_core_general-primitive.scm +libguile_gnuradio_core_general_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_general_la_swig_libadd) +libguile_gnuradio_core_general_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_general_la_swig_ldflags) +libguile_gnuradio_core_general_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_general_la_swig_cxxflags) guile/gnuradio_core_general.cc: gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general.scm: gnuradio_core_general.i @@ -345,6 +369,7 @@ gnuradio_core_gengen_swiginclude_HEADERS = \ gnuradio_core_gengen.i \ $(gnuradio_core_gengen_swiginclude_headers) +if PYTHON gnuradio_core_gengen_pylib_LTLIBRARIES = \ _gnuradio_core_gengen.la @@ -352,6 +377,10 @@ _gnuradio_core_gengen_la_SOURCES = \ python/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) +gnuradio_core_gengen_python_PYTHON = \ + gnuradio_core_gengen.py \ + $(gnuradio_core_gengen_python) + _gnuradio_core_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_gengen_la_swig_libadd) @@ -365,27 +394,34 @@ _gnuradio_core_gengen_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_gengen_la_swig_cxxflags) -gnuradio_core_gengen_python_PYTHON = \ - gnuradio_core_gengen.py \ - $(gnuradio_core_gengen_python) - python/gnuradio_core_gengen.cc: gnuradio_core_gengen.py gnuradio_core_gengen.py: gnuradio_core_gengen.i # Include the python dependencies for this file -include python/gnuradio_core_gengen.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la + +gnuradio_core_gengen_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_gengen.la libguile_gnuradio_core_gengen_la_SOURCES = \ guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) -nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primitive.scm - -libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD) -libguile_gnuradio_core_gengen_la_LDFLAGS = $(_gnuradio_core_gengen_la_LDFLAGS) -libguile_gnuradio_core_gengen_la_CXXFLAGS = $(_gnuradio_core_gengen_la_CXXFLAGS) +nobase_gnuradio_core_gengen_scm_DATA = \ + gnuradio/gnuradio_core_gengen.scm \ + gnuradio/gnuradio_core_gengen-primitive.scm +libguile_gnuradio_core_gengen_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_gengen_la_swig_libadd) +libguile_gnuradio_core_gengen_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_gengen_la_swig_ldflags) +libguile_gnuradio_core_gengen_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_gengen_la_swig_cxxflags) guile/gnuradio_core_gengen.cc: gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen.scm: gnuradio_core_gengen.i @@ -478,6 +514,7 @@ gnuradio_core_filter_swiginclude_HEADERS = \ gnuradio_core_filter.i \ $(gnuradio_core_filter_swiginclude_headers) +if PYTHON gnuradio_core_filter_pylib_LTLIBRARIES = \ _gnuradio_core_filter.la @@ -485,6 +522,10 @@ _gnuradio_core_filter_la_SOURCES = \ python/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) +gnuradio_core_filter_python_PYTHON = \ + gnuradio_core_filter.py \ + $(gnuradio_core_filter_python) + _gnuradio_core_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_filter_la_swig_libadd) @@ -498,27 +539,34 @@ _gnuradio_core_filter_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_filter_la_swig_cxxflags) -gnuradio_core_filter_python_PYTHON = \ - gnuradio_core_filter.py \ - $(gnuradio_core_filter_python) - python/gnuradio_core_filter.cc: gnuradio_core_filter.py gnuradio_core_filter.py: gnuradio_core_filter.i # Include the python dependencies for this file -include python/gnuradio_core_filter.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la + +gnuradio_core_filter_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_filter.la libguile_gnuradio_core_filter_la_SOURCES = \ guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) -nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primitive.scm - -libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD) -libguile_gnuradio_core_filter_la_LDFLAGS = $(_gnuradio_core_filter_la_LDFLAGS) -libguile_gnuradio_core_filter_la_CXXFLAGS = $(_gnuradio_core_filter_la_CXXFLAGS) +nobase_gnuradio_core_filter_scm_DATA = \ + gnuradio/gnuradio_core_filter.scm \ + gnuradio/gnuradio_core_filter-primitive.scm +libguile_gnuradio_core_filter_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_filter_la_swig_libadd) +libguile_gnuradio_core_filter_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_filter_la_swig_ldflags) +libguile_gnuradio_core_filter_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_filter_la_swig_cxxflags) guile/gnuradio_core_filter.cc: gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter.scm: gnuradio_core_filter.i @@ -611,6 +659,7 @@ gnuradio_core_io_swiginclude_HEADERS = \ gnuradio_core_io.i \ $(gnuradio_core_io_swiginclude_headers) +if PYTHON gnuradio_core_io_pylib_LTLIBRARIES = \ _gnuradio_core_io.la @@ -618,6 +667,10 @@ _gnuradio_core_io_la_SOURCES = \ python/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) +gnuradio_core_io_python_PYTHON = \ + gnuradio_core_io.py \ + $(gnuradio_core_io_python) + _gnuradio_core_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_io_la_swig_libadd) @@ -631,27 +684,34 @@ _gnuradio_core_io_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_io_la_swig_cxxflags) -gnuradio_core_io_python_PYTHON = \ - gnuradio_core_io.py \ - $(gnuradio_core_io_python) - python/gnuradio_core_io.cc: gnuradio_core_io.py gnuradio_core_io.py: gnuradio_core_io.i # Include the python dependencies for this file -include python/gnuradio_core_io.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la + +gnuradio_core_io_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_io.la libguile_gnuradio_core_io_la_SOURCES = \ guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) -nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primitive.scm - -libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD) -libguile_gnuradio_core_io_la_LDFLAGS = $(_gnuradio_core_io_la_LDFLAGS) -libguile_gnuradio_core_io_la_CXXFLAGS = $(_gnuradio_core_io_la_CXXFLAGS) +nobase_gnuradio_core_io_scm_DATA = \ + gnuradio/gnuradio_core_io.scm \ + gnuradio/gnuradio_core_io-primitive.scm +libguile_gnuradio_core_io_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_io_la_swig_libadd) +libguile_gnuradio_core_io_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_io_la_swig_ldflags) +libguile_gnuradio_core_io_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_io_la_swig_cxxflags) guile/gnuradio_core_io.cc: gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io.scm: gnuradio_core_io.i @@ -744,6 +804,7 @@ gnuradio_core_hier_swiginclude_HEADERS = \ gnuradio_core_hier.i \ $(gnuradio_core_hier_swiginclude_headers) +if PYTHON gnuradio_core_hier_pylib_LTLIBRARIES = \ _gnuradio_core_hier.la @@ -751,6 +812,10 @@ _gnuradio_core_hier_la_SOURCES = \ python/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) +gnuradio_core_hier_python_PYTHON = \ + gnuradio_core_hier.py \ + $(gnuradio_core_hier_python) + _gnuradio_core_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_hier_la_swig_libadd) @@ -764,27 +829,34 @@ _gnuradio_core_hier_la_CXXFLAGS = \ -I$(top_builddir) \ $(gnuradio_core_hier_la_swig_cxxflags) -gnuradio_core_hier_python_PYTHON = \ - gnuradio_core_hier.py \ - $(gnuradio_core_hier_python) - python/gnuradio_core_hier.cc: gnuradio_core_hier.py gnuradio_core_hier.py: gnuradio_core_hier.i # Include the python dependencies for this file -include python/gnuradio_core_hier.d -# end of PYTHON + +endif # end of if python if GUILE -gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la + +gnuradio_core_hier_scmlib_LTLIBRARIES = \ + libguile-gnuradio_core_hier.la libguile_gnuradio_core_hier_la_SOURCES = \ guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) -nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primitive.scm - -libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD) -libguile_gnuradio_core_hier_la_LDFLAGS = $(_gnuradio_core_hier_la_LDFLAGS) -libguile_gnuradio_core_hier_la_CXXFLAGS = $(_gnuradio_core_hier_la_CXXFLAGS) +nobase_gnuradio_core_hier_scm_DATA = \ + gnuradio/gnuradio_core_hier.scm \ + gnuradio/gnuradio_core_hier-primitive.scm +libguile_gnuradio_core_hier_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_core_hier_la_swig_libadd) +libguile_gnuradio_core_hier_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_core_hier_la_swig_ldflags) +libguile_gnuradio_core_hier_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(gnuradio_core_hier_la_swig_cxxflags) guile/gnuradio_core_hier.cc: gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier.scm: gnuradio_core_hier.i -- cgit From d1d226abdede58231583369047861cd2216489e9 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 18 Nov 2010 18:00:58 -0800 Subject: Disable items that require swig directors when building guile bindings. --- .../src/lib/general/gr_bin_statistics_f.i | 7 ++++- gnuradio-core/src/lib/general/gr_feval.i | 30 +++++----------------- 2 files changed, 13 insertions(+), 24 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i index 5cec882f0..be98a464b 100644 --- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i +++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,6 +19,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +// Directors are only supported in Python, Java and C#. gr_feval_dd uses directors +#ifdef SWIGPYTHON + GR_SWIG_BLOCK_MAGIC(gr,bin_statistics_f); gr_bin_statistics_f_sptr @@ -40,3 +43,5 @@ private: public: ~gr_bin_statistics_f(); }; + +#endif diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i index 843ca3f2a..c5522805d 100644 --- a/gnuradio-core/src/lib/general/gr_feval.i +++ b/gnuradio-core/src/lib/general/gr_feval.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -43,6 +43,9 @@ */ +// Directors are only supported in Python, Java and C# +#ifdef SWIGPYTHON + // Enable SWIG directors for these classes %feature("director") gr_py_feval_dd; %feature("director") gr_py_feval_cc; @@ -65,8 +68,8 @@ // catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; } //} -#ifdef SWIGPYTHON %{ + // class that ensures we acquire and release the Python GIL class ensure_py_gil_state { @@ -77,19 +80,6 @@ public: }; %} -#endif - -#ifdef SWIGGUILE -#if 0 -// FIXME: this is a bogus stub, just here so things build -class ensure_py_gil_state { -public: - ensure_py_gil_state() { } - ~ensure_py_gil_state() { } -}; -#endif -#warning "class ensure_py_gil_state needs to be implemented!" -#endif /* * These are the real C++ base classes, however we don't want these exposed. @@ -158,9 +148,7 @@ class gr_py_feval_dd : public gr_feval_dd public: double calleval(double x) { -#ifdef PYTHON ensure_py_gil_state _lock; -#endif return eval(x); } }; @@ -170,9 +158,7 @@ class gr_py_feval_cc : public gr_feval_cc public: gr_complex calleval(gr_complex x) { -#ifdef PYTHON ensure_py_gil_state _lock; -#endif return eval(x); } }; @@ -182,9 +168,7 @@ class gr_py_feval_ll : public gr_feval_ll public: long calleval(long x) { -#ifdef PYTHON ensure_py_gil_state _lock; -#endif return eval(x); } }; @@ -194,9 +178,7 @@ class gr_py_feval : public gr_feval public: void calleval() { -#ifdef PYTHON ensure_py_gil_state _lock; -#endif eval(); } }; @@ -218,3 +200,5 @@ long gr_feval_ll_example(gr_feval_ll *f, long x); %rename(feval_example) gr_feval_example; void gr_feval_example(gr_feval *f); + +#endif // SWIGPYTHON -- cgit From 6237fafa53938db53a3e2a82b79e80b524dd05db Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 18 Nov 2010 22:22:23 -0800 Subject: gr_msg_queue now working correctly from within guile. --- .../src/guile/tests/00_runtime_ctors.test | 19 +++++++ gnuradio-core/src/lib/runtime/gr_msg_queue.i | 58 ++++++++++++++++++++-- 2 files changed, 74 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_ctors.test b/gnuradio-core/src/guile/tests/00_runtime_ctors.test index 0c131f5bd..966d8c909 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_ctors.test +++ b/gnuradio-core/src/guile/tests/00_runtime_ctors.test @@ -32,4 +32,23 @@ ;;; Add test code for all constructors in these files ;;; ;;; ./runtime/gr_hier_block2.h + ;;; ./runtime/gr_msg_queue.h + +(define (equal-message? a b) + (equal? (gr:to-string a) (gr:to-string b))) + +(with-test-prefix "gr:message/gr:msg-queue" + (let ((msg1 (gr:message-from-string "Hello")) + (msg2 (gr:message-from-string "World!")) + (q (gr:msg-queue))) + (pass-if (equal? "Hello" (gr:to-string msg1))) + (pass-if (equal? "World!" (gr:to-string msg2))) + (pass-if (gr:empty-p q)) + (gr:insert-tail q msg1) + (pass-if (not (gr:empty-p q))) + (gr:insert-tail q msg2) + (let ((r1 (gr:delete-head q)) + (r2 (gr:delete-head q))) + (pass-if (equal-message? r1 msg1)) + (pass-if (equal-message? r2 msg2))))) diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i index 5b8fea49f..932747688 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i @@ -104,8 +104,60 @@ gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail %} -#endif +#endif // SWIGPYTHON +/* + * Similar trickery as above, only this time for Guile + */ #ifdef SWIGGUILE -#warning "gr_msg_queue.i: gr_msg_queue_sptr needs to be implemented!" -#endif + +%{ + struct arg_holder { + gr_msg_queue_sptr q; + gr_message_sptr msg; + }; + + void *insert_tail_shim(void *arg) + { + arg_holder *a = (arg_holder *)arg; + a->q->insert_tail(a->msg); + return 0; + } + + void *delete_head_shim(void *arg) + { + arg_holder *a = (arg_holder *)arg; + a->msg = a->q->delete_head(); + return 0; + } +%} + +%inline %{ + + // handle and insert_tail are equivalent + static void handle(gr_msg_queue_sptr q, gr_message_sptr msg) + { + arg_holder a; + a.q = q; + a.msg = msg; + scm_without_guile(insert_tail_shim, (void *) &a); + } + + static void insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) + { + arg_holder a; + a.q = q; + a.msg = msg; + scm_without_guile(insert_tail_shim, (void *) &a); + } + + static gr_message_sptr delete_head(gr_msg_queue_sptr q) + { + arg_holder a; + a.q = q; + scm_without_guile(delete_head_shim, (void *) &a); + return a.msg; + } +%} + +#endif // SWIGGUILE -- cgit From 31b5e27fbf72eca257bc4dd548e127ce16eef9ec Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 19 Nov 2010 00:13:28 -0800 Subject: Enable a couple more tests --- gnuradio-core/src/guile/tests/general_ctors.test | 20 ++++++++++---------- gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index d09766a95..ff5ee74fa 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -259,18 +259,18 @@ ;;; ./general/gr_ofdm_frame_acquisition.h (pass-if (true? (gr:ofdm-frame-acquisition 1 1 1 #(1+3i 23+5i) 1))) -;;; ./general/gr_ofdm_frame_sink.h FIXME: "No matching method for generic function `ofdm_frame_sink'" -;; (pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #('a' 'b') (gr:msg-queue) 1 0.25 0))) +;;; ./general/gr_ofdm_frame_sink.h +(pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(0 1) (gr:msg-queue) 128 0.25 0))) ;;; ./general/gr_ofdm_insert_preamble.h FIXME: "Wrong type argument in position ~A: ~S" -;; (pass-if (true? (gr:ofdm-insert-preamble 1 #(#(1+3i 23+5i))))) - -;;; ./general/gr_ofdm_mapper_bcv.h FIXME: Wrong type argument in position ~A: -;; gr_ofdm_mapper_bcv (const std::vector &constellation, -;; unsigned int msgq_limit, -;; unsigned int bits_per_symbol, -;; unsigned int fft_length); -;; (pass-if (true? (gr:ofdm-mapper-bcv #(1+3i 23+5i) 1 1 1))) +;;; WONTFIX: Need vector>> +;;(pass-if (true? (gr:ofdm-insert-preamble 2 #(#(1+3i 23+5i) #(1+3i 23+5i))))) + +;;; ./general/gr_ofdm_mapper_bcv.h +(pass-if (true? (gr:ofdm-mapper-bcv #(0+1i 0-1i) 1 100 128))) +(pass-if-throw "confirm throw gr:ofdm-mapper-bcv" #t + (true? (gr:ofdm-mapper-bcv #(0+1i 0-1i) 1 10 128))) + ;;; ./general/gr_ofdm_sampler.h (pass-if (true? (gr:ofdm-sampler 1 1 1))) diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i index 30c692926..3850220ba 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i +++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i @@ -26,7 +26,7 @@ gr_ofdm_mapper_bcv_sptr gr_make_ofdm_mapper_bcv (const std::vector &constellation, unsigned int msgq_limit, unsigned int bits_per_symbol, - unsigned int fft_length); + unsigned int fft_length) throw(std::exception); class gr_ofdm_mapper_bcv : public gr_sync_block -- cgit From 37a1e931c11f2ba0bdd8ef9ff07c6710e83c6139 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 19 Nov 2010 00:47:07 -0800 Subject: Enable more tests --- gnuradio-core/src/guile/tests/gengen_ctors.test | 18 ++++----- gnuradio-core/src/guile/tests/io_ctors.test | 49 ++++++++++++------------- 2 files changed, 33 insertions(+), 34 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/gengen_ctors.test b/gnuradio-core/src/guile/tests/gengen_ctors.test index 43996c001..6e1213c63 100644 --- a/gnuradio-core/src/guile/tests/gengen_ctors.test +++ b/gnuradio-core/src/guile/tests/gengen_ctors.test @@ -198,16 +198,16 @@ (pass-if (true? (gr:multiply-ss 1))) ;;; ./gengen/gr_mute_cc.h FIXME: not found -;; (pass-if (true? (gr:mute-cc false))) +(pass-if (true? (gr:mute-cc #f))) ;;; ./gengen/gr_mute_ff.h FIXME: not found -;;(pass-if (true? (gr:mute-ff false))) +(pass-if (true? (gr:mute-ff #f))) ;;; ./gengen/gr_mute_ii.h FIXME: not found -;; (pass-if (true? (gr:mute-ii false))) +(pass-if (true? (gr:mute-ii #f))) ;;; ./gengen/gr_mute_ss.h FIXME: not found -;; (pass-if (true? (gr:mute-ss false))) +(pass-if (true? (gr:mute-ss #f))) ;;; ./gengen/gr_noise_source_c.h (pass-if (true? (gr:noise-source-c 1 0 3021))) @@ -318,19 +318,19 @@ (pass-if (true? (gr:vector-sink-s 1))) ;;; ./gengen/gr_vector_source_b.h -;; (pass-if (true? (gr:vector-source-b #(1 2) false 1))) +;; (pass-if (true? (gr:vector-source-b #(1 2) #f 1))) ;; ;;; ./gengen/gr_vector_source_c.h -;; (pass-if (true? (gr:vector-source-c #(1+3i 23+5i) false 1))) +;; (pass-if (true? (gr:vector-source-c #(1+3i 23+5i) #f 1))) ;; ;;; ./gengen/gr_vector_source_f.h -;; (pass-if (true? (gr:vector-source-f #(1.0 2.0) false 1))) +;; (pass-if (true? (gr:vector-source-f #(1.0 2.0) #f 1))) ;;; ./gengen/gr_vector_source_i.h -;; (pass-if (true? (gr:vector-source-i #(1 2) false 1))) +;; (pass-if (true? (gr:vector-source-i #(1 2) #f 1))) ;;; ./gengen/gr_vector_source_s.h FIXME: not found -;; (pass-if (true? (gr:vector-source-s #(1 2) false 1))) +;; (pass-if (true? (gr:vector-source-s #(1 2) #f 1))) ;;; ./gengen/gr_xor_bb.h (pass-if (true? (gr:xor-bb))) diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 99c84ae37..1c5c9a771 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -37,20 +37,21 @@ ;;; ;;; ./io/gr_file_descriptor_sink.h -(pass-if (true? (gr:file-descriptor-sink 1 1))) +(pass-if (true? (gr:file-descriptor-sink 1 (dup 1)))) -;;; ./io/gr_file_descriptor_source.h FIXME: not found -;; (pass-if (true? (gr:file-descriptor-source 1 1 #f))) +;;; ./io/gr_file_descriptor_source.h +(pass-if (true? (gr:file-descriptor-source 1 (dup 0) #f))) ;;; ./io/gr_file_sink.h (pass-if (true? (gr:file-sink 1 "foo"))) -;;; ./io/gr_file_source.h FIXME: not found -;; (pass-if (true? (gr:file-source 1 "foo" #f))) +;;; ./io/gr_file_source.h +(pass-if (true? (gr:file-source 1 "foo" #f))) +(rm-foo) -;;; ./io/gr_histo_sink_f.h FIXME: not found +;;; ./io/gr_histo_sink_f.h ;; gr_make_histo_sink_f (gr_msg_queue_sptr msgq); -;; (pass-if (true? (gr:histo-sink-f 1))) +(pass-if (true? (gr:histo-sink-f (gr:msg-queue)))) ;;; ./io/gr_message_sink.h (pass-if (true? (gr:message-sink 1 (gr:msg-queue) #f))) @@ -59,25 +60,23 @@ (pass-if (true? (gr:message-source 1 1))) (pass-if (true? (gr:message-source 1 (gr:msg-queue)))) -;;; ./io/gr_oscope_sink_f.h FIXME: not found -;; _oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, -;; double sample_rate); -;; (pass-if (true? (gr:oscope-sink-f "foo" 1 1))) +;;; ./io/gr_oscope_sink_f.h +(pass-if (true? (gr:oscope-sink-f 1000 (gr:msg-queue)))) -;;; ./io/gr_oscope_sink_x.h FIXME: not found -;; gr_oscope_sink_x (const std::string name, gr_io_signature_sptr input_sig, -;; double sampling_rate); -;; (pass-if (true? (gr:oscope_sink_x "foo" 1 1))) +;;; ./io/gr_udp_sink.h +(pass-if (true? (gr:udp-sink 4 "localhost" 80 1472 #f))) +(pass-if-throw "confirm throw gr:udp-sink" #t + (true? (gr:udp-sink 4 "localhostx" 80 1472 #f))) -;;; ./io/gr_udp_sink.h FIXME: not found -;; (pass-if (true? (gr:udp-sink 1 "foo" 1472 #t))) +;;; ./io/gr_udp_source.h +(pass-if (true? (gr:udp-source 4 "localhost" 0 1472 #f #t))) +(pass-if-throw "confirm throw gr:udp-sink" #t + (true? (gr:udp-source 4 "localhostx" 0 1472 #f #t))) -;;; ./io/gr_udp_source.h FIXME: not found -;; (pass-if (true? (gr:message-source 0 "foo" 0 1472 #t #t))) - -;;; ./io/gr_wavfile_sink.h FIXME: not found -;; (pass-if (true? (gr:message-source "foo" 1 1 1))) - -;;; ./io/gr_wavfile_source.h FIXME: not found -;; (pass-if (true? (gr:message-source "foo" #f))) +;;; ./io/gr_wavfile_sink.h +(pass-if (true? (gr:wavfile-sink "foo" 2 48000 16))) +;;; ./io/gr_wavfile_source.h WONTFIX: buggy source won't accept file +;;; created immediately above. +;;(pass-if (true? (gr:wavfile-source "foo" #f))) +(rm-foo) -- cgit From 6551f537ed235bbb0ddfadb50744ea3b3fcbc2e6 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 20 Nov 2010 16:30:43 -0800 Subject: Add guile shim to gr_top_block::wait that exits guile mode before blocking. --- gnuradio-core/src/guile/gnuradio/runtime-shim.scm | 13 +++++++- gnuradio-core/src/lib/runtime/gr_top_block.i | 37 ++++++++++++++++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/runtime-shim.scm b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm index c08d3947c..105f4ddb8 100644 --- a/gnuradio-core/src/guile/gnuradio/runtime-shim.scm +++ b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm @@ -86,4 +86,15 @@ (loop (1+ n)))))))))) -(export-safely gr:ep gr:connect gr:disconnect) + + +(define-method (gr:run (self )) + (gr:start self) + (gr:wait self)) + +(define-method (gr:wait (self )) + ;; FIXME Set up SIGINT handling here... + (gr:top-block-wait-unlocked self)) + + +(export-safely gr:ep gr:connect gr:disconnect gr:run gr:wait) diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i index f18d8890b..90fa18b94 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.i +++ b/gnuradio-core/src/lib/runtime/gr_top_block.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008 Free Software Foundation, Inc. + * Copyright 2007,2008,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -42,8 +42,8 @@ public: void start() throw (std::runtime_error); void stop(); - void wait(); - void run() throw (std::runtime_error); + //void wait(); + //void run() throw (std::runtime_error); void lock(); void unlock() throw (std::runtime_error); void dump(); @@ -71,6 +71,33 @@ void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error) #endif -#ifdef SWIG_GUILE -#warning "gr_top_block.i: top_block_run_unlocked needs to be implemented!" +#ifdef SWIGGUILE + +%{ + struct tb_arg_holder { + gr_top_block_sptr tb; + }; + + static void * + tb_wait_shim(void *arg) + { + tb_arg_holder *a = (tb_arg_holder *)arg; + a->tb->wait(); + return 0; + } + +%} + +%inline %{ + + static void + top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error) + { + tb_arg_holder a; + a.tb = r; + scm_without_guile(tb_wait_shim, (void *) &a); + } + +%} + #endif -- cgit From 5c91f873301a6eca0895788b0b03862fc0060a19 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 20 Nov 2010 16:34:04 -0800 Subject: Minor tweaks: comments, static --- gnuradio-core/src/lib/runtime/gr_msg_queue.i | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i index 932747688..c9214bef3 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2009 Free Software Foundation, Inc. + * Copyright 2005,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -117,14 +117,16 @@ gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail gr_message_sptr msg; }; - void *insert_tail_shim(void *arg) + static void * + insert_tail_shim(void *arg) { arg_holder *a = (arg_holder *)arg; a->q->insert_tail(a->msg); return 0; } - void *delete_head_shim(void *arg) + static void * + delete_head_shim(void *arg) { arg_holder *a = (arg_holder *)arg; a->msg = a->q->delete_head(); @@ -135,7 +137,8 @@ gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail %inline %{ // handle and insert_tail are equivalent - static void handle(gr_msg_queue_sptr q, gr_message_sptr msg) + static void + handle(gr_msg_queue_sptr q, gr_message_sptr msg) { arg_holder a; a.q = q; @@ -143,7 +146,8 @@ gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail scm_without_guile(insert_tail_shim, (void *) &a); } - static void insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) + static void + insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) { arg_holder a; a.q = q; @@ -151,7 +155,8 @@ gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail scm_without_guile(insert_tail_shim, (void *) &a); } - static gr_message_sptr delete_head(gr_msg_queue_sptr q) + static gr_message_sptr + delete_head(gr_msg_queue_sptr q) { arg_holder a; a.q = q; -- cgit From da6620e6a3d23b78e7231ba70b914974988d3ae1 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 20 Nov 2010 18:27:04 -0800 Subject: Add guile SIGINT handler to gr:wait. --- gnuradio-core/src/guile/gnuradio/runtime-shim.scm | 35 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/runtime-shim.scm b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm index 105f4ddb8..bba702670 100644 --- a/gnuradio-core/src/guile/gnuradio/runtime-shim.scm +++ b/gnuradio-core/src/guile/gnuradio/runtime-shim.scm @@ -19,6 +19,7 @@ (define-module (gnuradio runtime-shim) #:use-module (oop goops) + #:use-module (ice-9 threads) #:use-module (gnuradio gnuradio_core_runtime) #:duplicates (merge-generics replace check)) @@ -92,9 +93,37 @@ (gr:start self) (gr:wait self)) -(define-method (gr:wait (self )) - ;; FIXME Set up SIGINT handling here... - (gr:top-block-wait-unlocked self)) + +(define-method (gr:wait (tb )) + + (define (sigint-handler sig) + ;;(display "\nSIGINT!\n" (current-error-port)) + ;; tell flow graph to stop + (gr:stop tb)) + + (let ((old-handler #f)) + (dynamic-wind + + ;; Called at entry + (lambda () + ;; Install SIGINT handler + (set! old-handler (sigaction SIGINT sigint-handler))) + + ;; Protected thunk + (lambda () + (let ((waiter (begin-thread (gr:top-block-wait-unlocked tb)))) + (join-thread waiter) + ;;(display "\nAfter join-thread\n" (current-error-port)) + )) + + ;; Called at exit + (lambda () + ;; Restore SIGINT handler + (if (not (car old-handler)) + ;; restore original C handler + (sigaction SIGINT #f) + ;; restore Scheme handler, SIG_IGN or SIG_DFL + (sigaction SIGINT (car old-handler) (cdr old-handler))))))) (export-safely gr:ep gr:connect gr:disconnect gr:run gr:wait) -- cgit From b34360471571ea7346ab1c6cb87700a920ca5798 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 14:33:58 -0500 Subject: Fixing flowgraph dump to clean it up (via patch from eb). Also added note about mutex locking in prune_tags. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 8 ++++++++ gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 1488e92f6..0b2eb52a0 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -231,6 +231,14 @@ gr_buffer::add_item_tag(const pmt::pmt_t &tag) void gr_buffer::prune_tags(uint64_t max_time) { + /* NOTE: this function _should_ lock the mutex before editing + d_item_tags. In practice, this function is only called at + runtime by min_available_space in gr_block_executor.cc, + which locks the mutex itself. + + If this function is used elsewhere, remember to lock the + buffer's mutex al la the scoped_lock line below. + */ //gruel::scoped_lock guard(*mutex()); int n = 0; diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc index 031eb6dfd..5d1057e0f 100644 --- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc +++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc @@ -264,16 +264,13 @@ void gr_flat_flowgraph::dump() int no = detail->noutputs(); for (int i = 0; i < no; i++) { gr_buffer_sptr buffer = detail->output(i); - std::cout << " output " << i << ": " << buffer - << " space=" << buffer->space_available() << std::endl; + std::cout << " output " << i << ": " << buffer << std::endl; } for (int i = 0; i < ni; i++) { gr_buffer_reader_sptr reader = detail->input(i); std::cout << " reader " << i << ": " << reader - << " reading from buffer=" << reader->buffer() - << " avail=" << reader->items_available() << " items" - << std::endl; + << " reading from buffer=" << reader->buffer() << std::endl; } } -- cgit From be71cffac7e1a90a1fdccdeab8bcf3697fd9ca9c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 14:43:06 -0500 Subject: Changing name of static tag keys. --- gnuradio-core/src/lib/runtime/gr_tag_info.cc | 10 +++++----- gnuradio-core/src/lib/runtime/gr_tag_info.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc index 211f330e9..c64cc7eb8 100644 --- a/gnuradio-core/src/lib/runtime/gr_tag_info.cc +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.cc @@ -29,9 +29,9 @@ namespace gr_tags { - const pmt::pmt_t s_key_time = pmt::pmt_string_to_symbol("time"); - const pmt::pmt_t s_key_sample_rate = pmt::pmt_string_to_symbol("sample_rate"); - const pmt::pmt_t s_key_frequency = pmt::pmt_string_to_symbol("frequency"); - const pmt::pmt_t s_key_rssi = pmt::pmt_string_to_symbol("rssi"); - const pmt::pmt_t s_key_rx_gain = pmt::pmt_string_to_symbol("gain"); + const pmt::pmt_t key_time = pmt::pmt_string_to_symbol("time"); + const pmt::pmt_t key_sample_rate = pmt::pmt_string_to_symbol("sample_rate"); + const pmt::pmt_t key_frequency = pmt::pmt_string_to_symbol("frequency"); + const pmt::pmt_t key_rssi = pmt::pmt_string_to_symbol("rssi"); + const pmt::pmt_t key_rx_gain = pmt::pmt_string_to_symbol("gain"); } diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h index af51cf6a9..0ba699a0e 100644 --- a/gnuradio-core/src/lib/runtime/gr_tag_info.h +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h @@ -34,11 +34,11 @@ namespace gr_tags { TAG_VALUE_REF }; - extern const pmt::pmt_t s_key_time; - extern const pmt::pmt_t s_key_sample_rate; - extern const pmt::pmt_t s_key_frequency; - extern const pmt::pmt_t s_key_rssi; - extern const pmt::pmt_t s_key_gain; + extern const pmt::pmt_t key_time; + extern const pmt::pmt_t key_sample_rate; + extern const pmt::pmt_t key_frequency; + extern const pmt::pmt_t key_rssi; + extern const pmt::pmt_t key_gain; static inline uint64_t get_nitems(const pmt::pmt_t &tag) { -- cgit From ff62557a42b6ce89a711f9d0603c0fe52a891ed8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 21 Nov 2010 16:01:48 -0800 Subject: Make Guile bindings work with --with-gnuradio-core et al. --- gnuradio-core/src/guile/run_guile_tests.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/run_guile_tests.in b/gnuradio-core/src/guile/run_guile_tests.in index 3aca7bdb0..61968065e 100644 --- a/gnuradio-core/src/guile/run_guile_tests.in +++ b/gnuradio-core/src/guile/run_guile_tests.in @@ -2,14 +2,16 @@ . @top_builddir@/setup_guile_test_env +# Since we're in gnuradio-core, we don't need to add anything, +# but we do need to call add_local_paths to set everything up + # 1st argument is absolute path to hand coded guile source directory # 2nd argument is absolute path to component C++ shared library build directory # 3nd argument is absolute path to component SWIG build directory -# We're in gnuradio-core, we don't need these -# add_local_paths \ -# "" \ -# "" \ -# "" +add_local_paths \ + "" \ + "" \ + "" @GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@/tests -- cgit From 8f2b07591c404c78c9fc7b9532d3fb6c27165981 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 19:40:35 -0500 Subject: Tagging file source takes in sample rate and uses it to find the last time tag and adjust the time between these tags and the burst start by the sample rate. Also added a function to gr_tag_info that can be used to sort tags based on nitems using std::sort. --- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 77 ++++++++++++++++--------- gnuradio-core/src/lib/io/gr_tagged_file_sink.h | 13 +++-- gnuradio-core/src/lib/io/gr_tagged_file_sink.i | 4 +- gnuradio-core/src/lib/runtime/gr_tag_info.h | 20 +++++++ 4 files changed, 81 insertions(+), 33 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 9b5ae70a6..500a359b3 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -49,33 +49,27 @@ #endif -gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize) +gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize, double samp_rate) : gr_sync_block ("tagged_file_sink", gr_make_io_signature (1, 1, itemsize), gr_make_io_signature (0, 0, 0)), - d_itemsize (itemsize),d_n(0) + d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate) { d_state = NOT_IN_BURST; + d_last_N = 0; + d_timeval = 0; } gr_tagged_file_sink_sptr -gr_make_tagged_file_sink (size_t itemsize) +gr_make_tagged_file_sink (size_t itemsize, double samp_rate) { - return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize)); + return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize, samp_rate)); } gr_tagged_file_sink::~gr_tagged_file_sink () { } -bool pmtcompare(pmt::pmt_t x, pmt::pmt_t y) -{ - uint64_t t_x, t_y; - t_x = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(x, 0)); - t_y = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(y, 0)); - return t_x < t_y; -} - int gr_tagged_file_sink::work (int noutput_items, gr_vector_const_void_star &input_items, @@ -86,13 +80,12 @@ gr_tagged_file_sink::work (int noutput_items, uint64_t start_N = nitems_read(0); uint64_t end_N = start_N + (uint64_t)(noutput_items); pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst"); - //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::s_key_time + //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::key_time std::vector all_tags; get_tags_in_range(all_tags, 0, start_N, end_N); - std::sort(all_tags.begin(), all_tags.end(), pmtcompare); - std::cout << "Number of tags: " << all_tags.size() << std::endl; + std::sort(all_tags.begin(), all_tags.end(), gr_tags::nitems_compare); std::vector::iterator vitr = all_tags.begin(); @@ -100,18 +93,53 @@ gr_tagged_file_sink::work (int noutput_items, while(idx < noutput_items) { if(d_state == NOT_IN_BURST) { while(vitr != all_tags.end()) { - //std::cout << "\tNot in burst: " << *vitr << std::endl; - if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) && pmt::pmt_is_true(gr_tags::get_value(*vitr))) { - uint64_t N = gr_tags::get_nitems(*vitr) - start_N; - idx = (int)N; - - std::cout << std::endl << "Found start of burst: " << N << ", " << N+start_N << std::endl; + uint64_t N = gr_tags::get_nitems(*vitr); + idx = (int)(N - start_N); + + std::cout << std::endl << "Found start of burst: " + << idx << ", " << N << std::endl; + + // Find time burst occurred by getting latest time tag and extrapolating + // to new time based on sample rate of this block. + std::vector time_tags; + get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time); + if(time_tags.size() > 0) { + pmt::pmt_t tag = time_tags[time_tags.size()-1]; + + uint64_t time_nitems = gr_tags::get_nitems(tag); + + // Get time based on last time tag from USRP + pmt::pmt_t time = gr_tags::get_value(tag); + int tsecs = pmt::pmt_to_long(pmt::pmt_tuple_ref(time, 0)); + double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1)); + + // Get new time from last time tag + difference in time to when + // burst tag occured based on the sample rate + double delta = (double)(N - time_nitems) / d_sample_rate; + d_timeval = (double)tsecs + tfrac + delta; + + std::cout.setf(std::ios::fixed, std::ios::floatfield); + std::cout.precision(8); + std::cout << "Time found: " << (double)tsecs + tfrac << std::endl; + std::cout << " time: " << d_timeval << std::endl; + std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl; + } + else { + // if no time tag, use last seen tag and update time based on + // sample rate of the block + d_timeval += (double)(N - d_last_N) / d_sample_rate; + std::cout << "Time not found" << std::endl; + std::cout << " time: " << d_timeval << std::endl; + } + d_last_N = N; std::stringstream filename; - filename << "file" << d_n << ".dat"; + filename.setf(std::ios::fixed, std::ios::floatfield); + filename.precision(8); + filename << "file" << d_n << "_" << d_timeval << ".dat"; d_n++; int fd; @@ -142,15 +170,11 @@ gr_tagged_file_sink::work (int noutput_items, } else { // In burst while(vitr != all_tags.end()) { - //std::cout << "\tin burst: " << *vitr << std::endl; - if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) && pmt::pmt_is_false(gr_tags::get_value(*vitr))) { uint64_t N = gr_tags::get_nitems(*vitr) - start_N; idx_stop = (int)N; - std::cout << "Found end of burst: " << N << ", " << N+start_N << std::endl; - int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle); if (count == 0) break; @@ -164,7 +188,6 @@ gr_tagged_file_sink::work (int noutput_items, } } if(d_state == IN_BURST) { - std::cout << "writing part of burst: " << noutput_items-idx << std::endl; int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle); if (count == 0) break; diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h index c657e6a75..956340f8d 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h @@ -28,7 +28,8 @@ class gr_tagged_file_sink; typedef boost::shared_ptr gr_tagged_file_sink_sptr; -gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize); +gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, + double samp_rate); /*! * \brief Write stream to file descriptor. @@ -37,7 +38,8 @@ gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize); class gr_tagged_file_sink : public gr_sync_block { - friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize); + friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize, + double samp_rate); private: enum { @@ -49,9 +51,12 @@ class gr_tagged_file_sink : public gr_sync_block int d_state; FILE *d_handle; int d_n; - + double d_sample_rate; + uint64_t d_last_N; + double d_timeval; + protected: - gr_tagged_file_sink (size_t itemsize); + gr_tagged_file_sink (size_t itemsize, double samp_rate); public: ~gr_tagged_file_sink (); diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i index 92248e5dd..1408adfc1 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i @@ -23,12 +23,12 @@ GR_SWIG_BLOCK_MAGIC(gr,tagged_file_sink) gr_tagged_file_sink_sptr -gr_make_tagged_file_sink (size_t itemsize); +gr_make_tagged_file_sink (size_t itemsize, double samp_rate); class gr_tagged_file_sink : public gr_sync_block { protected: - gr_tagged_file_sink (size_t itemsize); + gr_tagged_file_sink (size_t itemsize, double samp_rate); public: ~gr_tagged_file_sink (); diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h index 0ba699a0e..5ed30a815 100644 --- a/gnuradio-core/src/lib/runtime/gr_tag_info.h +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h @@ -40,26 +40,46 @@ namespace gr_tags { extern const pmt::pmt_t key_rssi; extern const pmt::pmt_t key_gain; + /*! + * \brief Returns the item \p tag occurred at (as a uint64_t) + */ static inline uint64_t get_nitems(const pmt::pmt_t &tag) { return pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tag, TAG_NITEM_REF)); } + /*! + * \brief Returns the source ID of \p tag (as a PMT) + */ static inline pmt::pmt_t get_srcid(const pmt::pmt_t &tag) { return pmt::pmt_tuple_ref(tag, TAG_SRCID_REF); } + /*! + * \brief Returns the key of \p tag (as a PMT symbol) + */ static inline pmt::pmt_t get_key(const pmt::pmt_t &tag) { return pmt::pmt_tuple_ref(tag, TAG_KEY_REF); } + /*! + * \brief Returns the value of \p tag (as a PMT) + */ static inline pmt::pmt_t get_value(const pmt::pmt_t &tag) { return pmt::pmt_tuple_ref(tag, TAG_VALUE_REF); } + /*! + * \brief Comparison function to test which tag, \p x or \p y, came first in time + */ + static inline bool + nitems_compare(pmt::pmt_t x, pmt::pmt_t y) { + return get_nitems(x) < get_nitems(y); + } + }; /* namespace tags */ #endif /* GR_TAG_INFO */ -- cgit From 734791dfe5489166ac561c6916051fde6241f2f4 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 17:43:58 -0700 Subject: don't generate this file anymore --- .../src/lib/swig/gnuradio_swig_bug_workaround.h | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h new file mode 100644 index 000000000..8f7eea0bf --- /dev/null +++ b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 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. + */ + +#ifndef INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H +#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H + +/* + * This include files works around a bug in SWIG 1.3.21 and 22 + * where it fails to emit these declarations when doing + * %import "gnuradio.i" + */ + +class gr_base_error_handler; +class gr_basic_block; +class gr_block; +class gr_error_handler; +class gr_file_error_handler; +class gr_hier_block2; +class gr_msg_handler; +class gr_msg_queue; +class gr_sync_block; +class gr_sync_decimator; +class gr_sync_interpolator; +class gr_top_block; + +#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */ -- cgit From ac2fcdb905d616c4aa902479ed44d6ea90947c39 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 17:44:29 -0700 Subject: remove -/gnuradio_swig_bug_workaround.h, it's not generated anymore. --- gnuradio-core/src/lib/swig/.gitignore | 1 - 1 file changed, 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore index 35e974948..a6f145618 100644 --- a/gnuradio-core/src/lib/swig/.gitignore +++ b/gnuradio-core/src/lib/swig/.gitignore @@ -10,7 +10,6 @@ /swigrun.py /swigrun_wrap.c /Makefile.swigdeps.new -/gnuradio_swig_bug_workaround.h gnuradio_core_filter.cc gnuradio_core_filter.d gnuradio_core_filter.h -- cgit From 6702bd5b6470dcae091b0d0c5aa426537f2cbc1e Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 18:07:12 -0700 Subject: always go into the swig directory --- gnuradio-core/src/lib/Makefile.am | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am index f3a3accdb..1281b4aa6 100644 --- a/gnuradio-core/src/lib/Makefile.am +++ b/gnuradio-core/src/lib/Makefile.am @@ -24,10 +24,7 @@ include $(top_srcdir)/Makefile.common ## Process this file with automake to produce Makefile.in # We've got to build . before swig -SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier . -if PYTHON -SUBDIRS += swig -endif +SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier . swig AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) -- cgit From d4ed4d96470c91bcb7fb45da5e07641b24331cba Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 18:07:59 -0700 Subject: go back to the generating the lists here, so make check works again --- gnuradio-core/src/lib/swig/Makefile.am | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index e990d998e..95edf5181 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -56,11 +56,13 @@ nobase_swiginclude_HEADERS = \ guile/std_complex.i \ guile/std_vector.i + AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) EXTRA_DIST = gen-swig-bug-fix +if PYTHON # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr @@ -68,9 +70,8 @@ ourpython_PYTHON = gnuradio_core.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... -if PYTHON -gnuradio_swig_bug_workaround.h: gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix - $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@ +# gnuradio_swig_bug_workaround.h : gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix +# $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@ # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = gnuradio_swig_bug_workaround.h @@ -96,13 +97,17 @@ gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) # add some of the variables generated inside the Makefile.swig -endif # end of python +# include the SWIG-generated .h files in the BUILT SOURCES, since they +# aren't by default when using Makefile.swig; order doesn't matter. +PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) +swig_built_sources += $(PYTHON_GEN) +endif # end of if python -if PYTHON -else -gnuradio_swig_bug_workaround.h: - @touch gnuradio_swig_bug_workaround.h -endif # end of guile +if GUILE +SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) +swig_built_sources += $(GUILE_GEN) +endif # end of if guile # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -- cgit From 1b7b68ec2211c50de98bef7414e4ac807edf460a Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 20:51:37 -0500 Subject: Doxygen comments. Fixing typos that were leading to warnings. --- gnuradio-core/src/lib/runtime/gr_block.h | 2 +- gnuradio-core/src/lib/runtime/gr_block_detail.h | 2 +- gnuradio-core/src/lib/runtime/gr_buffer.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 7caf3c34a..36eed3d10 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -247,7 +247,7 @@ class gr_block : public gr_basic_block { /*! * \brief Adds a new tag onto the given output buffer. * - * \param which_ouput an integer of which output stream to attach the tag + * \param which_output an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number * assicated with the tag. Can get from nitems_written. * \param key the tag key as a PMT symbol diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h index 834ef47f5..d7ec3b136 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_detail.h +++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h @@ -103,7 +103,7 @@ class gr_block_detail { * from it. It then calls gr_buffer::add_item_tag(pmt::pmt_t t), * which appends the tag onto its deque. * - * \param which_ouput an integer of which output stream to attach the tag + * \param which_output an integer of which output stream to attach the tag * \param abs_offset a uint64 number of the absolute item number * assicated with the tag. Can get from nitems_written. * \param key the tag key as a PMT symbol diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 2d88c1722..fe0e7585d 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -99,6 +99,11 @@ class gr_buffer { */ void add_item_tag(const pmt::pmt_t &tag); + /*! + * \brief Removes all tags before \p max_time from buffer + * + * \param max_time the time (item number) to trim up until. + */ void prune_tags(uint64_t max_time); std::deque::iterator get_tags_begin() { return d_item_tags.begin(); } @@ -244,6 +249,7 @@ class gr_buffer_reader { /*! * \brief Return the block that reads via this reader. + * */ gr_block_sptr link() { return gr_block_sptr(d_link); } -- cgit From 192acf4d1399f6e72c228f0448ab3c7cec15b36b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 18:56:54 -0700 Subject: always cd into python or guile --- gnuradio-core/src/Makefile.am | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/Makefile.am b/gnuradio-core/src/Makefile.am index 648fe299e..1717d373a 100644 --- a/gnuradio-core/src/Makefile.am +++ b/gnuradio-core/src/Makefile.am @@ -21,12 +21,6 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = gen_interpolator_taps lib tests -if PYTHON -SUBDIRS += python -endif -if GUILE -SUBDIRS += guile -endif +SUBDIRS = gen_interpolator_taps lib tests python guile DIST_SUBDIRS = gen_interpolator_taps lib tests python guile utils -- cgit From 9217bbcafe547fd5815265758370b07c375d72c9 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 21:17:42 -0500 Subject: Fixed file tagger error handling so it doesn't prematurely exit under certain, but correct, conditions. --- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 500a359b3..371d6268c 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -172,28 +172,37 @@ gr_tagged_file_sink::work (int noutput_items, while(vitr != all_tags.end()) { if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) && pmt::pmt_is_false(gr_tags::get_value(*vitr))) { - uint64_t N = gr_tags::get_nitems(*vitr) - start_N; - idx_stop = (int)N; + uint64_t N = gr_tags::get_nitems(*vitr); + idx_stop = (int)N - start_N; + + std::cout << "Found end of burst: " + << idx_stop << ", " << N << std::endl; int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle); - if (count == 0) - break; + if (count == 0) { + if(ferror(d_handle)) { + perror("gr_tagged_file_sink: error writing file"); + } + } idx = idx_stop; d_state = NOT_IN_BURST; vitr++; fclose(d_handle); break; - } else { + } + else { vitr++; } } if(d_state == IN_BURST) { int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle); - if (count == 0) - break; + if (count == 0) { + if(ferror(d_handle)) { + perror("gr_tagged_file_sink: error writing file"); + } + } idx = noutput_items; } - } } -- cgit From 7c5dc0920240f566ad4482f47ca8b9095479f04e Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 21 Nov 2010 21:23:31 -0500 Subject: Removed comments to stdout from file tagger; made it easir to go from internally generated bursts to detected bursts (which needs work). --- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 371d6268c..55c42eaff 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -99,8 +99,8 @@ gr_tagged_file_sink::work (int noutput_items, uint64_t N = gr_tags::get_nitems(*vitr); idx = (int)(N - start_N); - std::cout << std::endl << "Found start of burst: " - << idx << ", " << N << std::endl; + //std::cout << std::endl << "Found start of burst: " + // << idx << ", " << N << std::endl; // Find time burst occurred by getting latest time tag and extrapolating // to new time based on sample rate of this block. @@ -121,18 +121,18 @@ gr_tagged_file_sink::work (int noutput_items, double delta = (double)(N - time_nitems) / d_sample_rate; d_timeval = (double)tsecs + tfrac + delta; - std::cout.setf(std::ios::fixed, std::ios::floatfield); - std::cout.precision(8); - std::cout << "Time found: " << (double)tsecs + tfrac << std::endl; - std::cout << " time: " << d_timeval << std::endl; - std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl; + //std::cout.setf(std::ios::fixed, std::ios::floatfield); + //std::cout.precision(8); + //std::cout << "Time found: " << (double)tsecs + tfrac << std::endl; + //std::cout << " time: " << d_timeval << std::endl; + //std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl; } else { // if no time tag, use last seen tag and update time based on // sample rate of the block d_timeval += (double)(N - d_last_N) / d_sample_rate; - std::cout << "Time not found" << std::endl; - std::cout << " time: " << d_timeval << std::endl; + //std::cout << "Time not found" << std::endl; + //std::cout << " time: " << d_timeval << std::endl; } d_last_N = N; @@ -157,7 +157,7 @@ gr_tagged_file_sink::work (int noutput_items, ::close(fd); // don't leak file descriptor if fdopen fails. } - std::cout << "Created new file: " << filename.str() << std::endl; + //std::cout << "Created new file: " << filename.str() << std::endl; d_state = IN_BURST; break; @@ -175,8 +175,8 @@ gr_tagged_file_sink::work (int noutput_items, uint64_t N = gr_tags::get_nitems(*vitr); idx_stop = (int)N - start_N; - std::cout << "Found end of burst: " - << idx_stop << ", " << N << std::endl; + //std::cout << "Found end of burst: " + // << idx_stop << ", " << N << std::endl; int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle); if (count == 0) { -- cgit From e4eb47f0dd55485693e70ec2f45f79912fa899c4 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 21 Nov 2010 19:43:39 -0800 Subject: Clean up lib/swig/Makefile.am, Makefile.common and Makefile.swig Confirmed that it builds and make checks on all four combintations of --{enable,disable}-{python,guile}. Have not tested make dist, but expect that there may be some problems with it. I'm pretty sure that not all files that need to be removed from the distribution are removed, and make clean may still be leaving some files around. --- gnuradio-core/src/lib/swig/Makefile.am | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 95edf5181..a97bb6ea0 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -24,11 +24,6 @@ include $(top_srcdir)/Makefile.swig BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) -CLEANFILES = python/*.cc python/*.h -if GUILE -CLEANFILES += guile/*.cc gnuradio/*.scm -endif - # ---------------------------------------------------------------- # We've split the previously monstrous gnuradio_core into 6 # smaller pieces. This reduces compile time coupling and creates @@ -62,7 +57,6 @@ AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ EXTRA_DIST = gen-swig-bug-fix -if PYTHON # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr @@ -95,20 +89,5 @@ gnuradio_core_filter_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_core_io_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) -# add some of the variables generated inside the Makefile.swig - -# include the SWIG-generated .h files in the BUILT SOURCES, since they -# aren't by default when using Makefile.swig; order doesn't matter. -PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) -swig_built_sources += $(PYTHON_GEN) -endif # end of if python -if GUILE SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) -swig_built_sources += $(GUILE_GEN) -endif # end of if guile - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) - -- cgit From 9cf988ad17529416f841870b01d0f548e1a0b9a0 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 21 Nov 2010 21:47:15 -0700 Subject: fix so distcheck *almost* fully works --- gnuradio-core/src/guile/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 0c0becbc1..c2f8b5c39 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -23,6 +23,7 @@ TESTS = run_guile_tests EXTRA_DIST = \ run_guile_tests.in \ + $(nobase_guile_DATA) \ $(GUILE_TESTS) # These are the hand-code guile files for gnuradio-core. @@ -51,3 +52,5 @@ GUILE_TESTS = \ tests/io_ctors.test CLEANFILES = guile.log + +no_dist_dirs = python guile -- cgit From 181ad4cda3879a1760d61054ff32f8abbc9c24cf Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 22 Nov 2010 22:46:18 -0500 Subject: Check for relative rate and update tag only if not 1.0; otherwise just copy. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 59799069a..ea489d079 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -110,15 +110,23 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, d->nitems_read(i)); std::vector::iterator t; - for(t = rtags.begin(); t != rtags.end(); t++) { - uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); - pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), - pmt::pmt_tuple_ref(*t, 1), - pmt::pmt_tuple_ref(*t, 2), - pmt::pmt_tuple_ref(*t, 3)); - - for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(newtup); + if(rrate != 1.0) { + for(t = rtags.begin(); t != rtags.end(); t++) { + uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); + pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), + pmt::pmt_tuple_ref(*t, 1), + pmt::pmt_tuple_ref(*t, 2), + pmt::pmt_tuple_ref(*t, 3)); + + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(newtup); + } + } + else { + for(t = rtags.begin(); t != rtags.end(); t++) { + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(*t); + } } } break; -- cgit From 1e0faf29d41c6af754e3ceec30d217ce69452cd1 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 23 Nov 2010 17:16:25 -0700 Subject: add a few more .m files --- gnuradio-core/src/utils/Makefile.am | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/utils/Makefile.am b/gnuradio-core/src/utils/Makefile.am index 07960a072..22dae7117 100644 --- a/gnuradio-core/src/utils/Makefile.am +++ b/gnuradio-core/src/utils/Makefile.am @@ -42,4 +42,15 @@ EXTRA_DIST = \ read_cshort_binary.m \ single_pole_iir.m \ write_float_binary.m \ - write_short_binary.m + write_short_binary.m \ + is_complex.m \ + split_vect.m \ + rainbow.m \ + lp_to_bp.m \ + cool.m \ + read_xambi.m \ + runsum.m \ + plot_cic_decimator_response.m + +# partition-cascaded-decimating-filters.scm +# permute.scm -- cgit From 7d14fec5653b7aa92de8ef9ba76f02b7181ee928 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 23 Nov 2010 22:57:10 -0500 Subject: Removing dependency in QA code to filters that have not necessarily been built yet. Using test block keep_one_in_n to test decimation is handled in propogating tags. --- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 39 ++++---------------------- 1 file changed, 5 insertions(+), 34 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 2092e48ed..14983013c 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -31,8 +31,7 @@ #include #include #include -#include -#include +#include #include #include @@ -375,18 +374,14 @@ qa_block_tags::t5 () gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); // Rate change blocks - std::vector taps = gr_firdes::low_pass_2(1, 1, 0.4, 0.1, 60); - gr_fir_filter_fff_sptr fir_dec10 (gr_make_fir_filter_fff(10, taps)); - gr_interp_fir_filter_fff_sptr fir_int2 (gr_make_interp_fir_filter_fff(2, taps)); + gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10)); tb->connect(src, 0, head, 0); tb->connect(head, 0, ann0, 0); tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, fir_dec10, 0); - tb->connect(fir_dec10, 0, ann2, 0); - tb->connect(ann2, 0, fir_int2, 0); - tb->connect(fir_int2, 0, ann3, 0); - tb->connect(ann3, 0, snk0, 0); + tb->connect(ann1, 0, dec10, 0); + tb->connect(dec10, 0, ann2, 0); + tb->connect(ann2, 0, snk0, 0); tb->run(); @@ -414,24 +409,9 @@ qa_block_tags::t5 () expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); - pmt_t expected_tags3[12]; - expected_tags3[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[3] = mp(pmt_from_uint64(2000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags3[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags3[6] = mp(pmt_from_uint64(4000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags3[7] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[8] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[9] = mp(pmt_from_uint64(6000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags3[10] = mp(pmt_from_uint64(6000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[11] = mp(pmt_from_uint64(6000), mp(str0.str()), mp("seq"), mp(3)); - std::vector tags0 = ann0->data(); std::vector tags1 = ann1->data(); std::vector tags2 = ann2->data(); - std::vector tags3 = ann3->data(); // The first annotator does not receive any tags from the null sink upstream CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); @@ -453,14 +433,5 @@ qa_block_tags::t5 () std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); } - - // annotator 3 gets tags from annotators 0, 1, and 2 - std::cout << std::endl; - std::cout << "tags3.size(): " << tags3.size() << std::endl; - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); - for(size_t i = 0; i < tags3.size(); i++) { - std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); - } } -- cgit From 17b63012f821a85924c174b7d89f1236ba4ac5d0 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 23 Nov 2010 22:25:51 -0800 Subject: Move verbose-equal? to lib.scm --- gnuradio-core/src/guile/gnuradio/test-suite/lib.scm | 13 +++++++++++-- gnuradio-core/src/guile/tests/general_ctors.test | 8 -------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm index 458e627de..abdc89632 100644 --- a/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm +++ b/gnuradio-core/src/guile/gnuradio/test-suite/lib.scm @@ -20,6 +20,7 @@ :use-module (ice-9 stack-catch) :use-module (ice-9 regex) :use-module (ice-9 syncase) + :use-module (ice-9 format) :export ( ;; Exceptions which are commonly being tested for. @@ -597,9 +598,9 @@ (define-syntax test-equal (syntax-rules () ((_ expected test-expr) - (pass-if (equal? expected test-expr))) + (pass-if (verbose-equal? expected test-expr))) ((_ name expected test-exprt) - (pass-if name (equal? expected test-expr))))) + (pass-if name (verbose-equal? expected test-expr))))) ;;; (test-eqv [name] expected test-expr) (define-syntax test-eqv @@ -616,3 +617,11 @@ (pass-if (eq? expected test-expr))) ((_ name expected test-exprt) (pass-if name (eq? expected test-expr))))) + + +(define-public (verbose-equal? expected actual) + (cond ((equal? expected actual) #t) + (else + (format #t "Expected:\n~y\n" expected) + (format #t "Actual:\n~y\n" actual) + #f))) diff --git a/gnuradio-core/src/guile/tests/general_ctors.test b/gnuradio-core/src/guile/tests/general_ctors.test index ff5ee74fa..244249dd8 100644 --- a/gnuradio-core/src/guile/tests/general_ctors.test +++ b/gnuradio-core/src/guile/tests/general_ctors.test @@ -31,14 +31,6 @@ (use-modules (ice-9 format)) -(define (verbose-equal? expected actual) - (cond ((equal? expected actual) #t) - (else - (format #t "Expected:\n~y\n" expected) - (format #t "Actual:\n~y\n" actual) - #f))) - - ;;; Test complex scalars (pass-if (equal? 5.0+5.0i (gr:complex-scalar-test0))) (pass-if (equal? 1.5+0.5i (gr:complex-scalar-test1 1+1i))) -- cgit From 99dc38c8f81fe388b13bf46e3f53cc272765249e Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 13:49:59 -0800 Subject: Consistently use TESTS += in conditionals --- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am index c3017adcc..7d89777ef 100644 --- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am @@ -25,8 +25,7 @@ EXTRA_DIST = \ run_tests.in \ test_16bit_1chunk.wav -TESTS = \ - run_tests +TESTS = run_tests grgrpythondir = $(grpythondir)/gr -- cgit From d692a41f98e7b888c745efbb9fcbbb0400f39025 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 17:29:11 -0800 Subject: Major Makefile.am housecleaning. Passes distcheck. Move all occurrences of swig_built_sources out of Makefile.am's. Move all SWIG related use of BUILT_SOURCES out of Makefile.am's. Clean up 'if PYTHON' conditionalization in gr-* Still left to do: fix Makefile.swig CLEANFILES and no_dist_files such that they remove exactly the generated files. --- gnuradio-core/src/gen_interpolator_taps/Makefile.am | 8 +++++++- gnuradio-core/src/guile/Makefile.am | 4 +--- gnuradio-core/src/lib/filter/Makefile.am | 4 ++-- gnuradio-core/src/lib/g72x/Makefile.am | 2 +- gnuradio-core/src/lib/general/Makefile.am | 2 +- gnuradio-core/src/lib/gengen/Makefile.am | 4 ++-- gnuradio-core/src/lib/missing/Makefile.am | 2 +- gnuradio-core/src/lib/reed-solomon/Makefile.am | 2 +- gnuradio-core/src/lib/swig/Makefile.am | 12 +++++------- gnuradio-core/src/python/bin/Makefile.am | 4 ++-- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 2 +- gnuradio-core/src/tests/Makefile.am | 4 ++-- gnuradio-core/src/utils/Makefile.am | 2 +- 13 files changed, 27 insertions(+), 25 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/gen_interpolator_taps/Makefile.am b/gnuradio-core/src/gen_interpolator_taps/Makefile.am index d244e7f54..1b54af5e7 100644 --- a/gnuradio-core/src/gen_interpolator_taps/Makefile.am +++ b/gnuradio-core/src/gen_interpolator_taps/Makefile.am @@ -21,7 +21,13 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = praxis.txt simpson.h objective_fct.c gen_interpolator_taps.c simpson.c praxis.f +EXTRA_DIST += \ + praxis.txt \ + simpson.h \ + objective_fct.c \ + gen_interpolator_taps.c \ + simpson.c \ + praxis.f # if ENABLE_FORTRAN # noinst_PROGRAMS = gen_interpolator_taps diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index c2f8b5c39..209e664a0 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common TESTS = run_guile_tests -EXTRA_DIST = \ +EXTRA_DIST += \ run_guile_tests.in \ $(nobase_guile_DATA) \ $(GUILE_TESTS) @@ -52,5 +52,3 @@ GUILE_TESTS = \ tests/io_ctors.test CLEANFILES = guile.log - -no_dist_dirs = python guile diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 6d2ec1c7e..38edee3d5 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -67,7 +67,7 @@ code_generator = \ # Source built by Python into $(builddir) -BUILT_SOURCES = \ +BUILT_SOURCES += \ $(GENERATED_H) \ $(GENERATED_I) \ $(GENERATED_CC) \ @@ -178,7 +178,7 @@ EXTRA_libfilter_la_SOURCES = \ $(armv7_a_qa_CODE) -EXTRA_DIST = \ +EXTRA_DIST += \ 3dnow_float_dotprod_really_simple.S \ 3dnow_float_dotprod_simple.S \ $(code_generator) diff --git a/gnuradio-core/src/lib/g72x/Makefile.am b/gnuradio-core/src/lib/g72x/Makefile.am index 6c41f1911..d2700376f 100644 --- a/gnuradio-core/src/lib/g72x/Makefile.am +++ b/gnuradio-core/src/lib/g72x/Makefile.am @@ -24,4 +24,4 @@ include $(top_srcdir)/Makefile.common noinst_LTLIBRARIES = libccitt.la libccitt_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h -EXTRA_DIST = encode.c decode.c +EXTRA_DIST += encode.c decode.c diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 735795789..b25326deb 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -29,7 +29,7 @@ BUILT_SOURCES = # ---------------------------------------------------------------- -EXTRA_DIST = \ +EXTRA_DIST += \ gen_sine_table.py \ gr_constants.cc.in diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index 4978ad1c5..cfa043b67 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -115,7 +115,7 @@ core_generator = \ gr_moving_average_XX.i.t # Source built by Python into $(builddir) -BUILT_SOURCES = \ +BUILT_SOURCES += \ $(GENERATED_H) \ $(GENERATED_I) \ $(GENERATED_CC) \ @@ -123,7 +123,7 @@ BUILT_SOURCES = \ # ---------------------------------------------------------------- -EXTRA_DIST = \ +EXTRA_DIST += \ $(core_generator) libgengen_la_SOURCES = \ diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am index 238370910..bd18cf143 100644 --- a/gnuradio-core/src/lib/missing/Makefile.am +++ b/gnuradio-core/src/lib/missing/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/Makefile.common AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES) -EXTRA_DIST = \ +EXTRA_DIST += \ getopt.h \ getopt.c \ gettimeofday.c \ diff --git a/gnuradio-core/src/lib/reed-solomon/Makefile.am b/gnuradio-core/src/lib/reed-solomon/Makefile.am index b7bd939b0..5548f4280 100644 --- a/gnuradio-core/src/lib/reed-solomon/Makefile.am +++ b/gnuradio-core/src/lib/reed-solomon/Makefile.am @@ -29,7 +29,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) TESTS = rstest -EXTRA_DIST = \ +EXTRA_DIST += \ README.karn noinst_LTLIBRARIES = librs.la diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index a97bb6ea0..f8e7640ae 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -22,7 +22,8 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources) +AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ + $(WITH_INCLUDES) # ---------------------------------------------------------------- # We've split the previously monstrous gnuradio_core into 6 @@ -52,11 +53,6 @@ nobase_swiginclude_HEADERS = \ guile/std_vector.i -AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ - $(WITH_INCLUDES) - -EXTRA_DIST = gen-swig-bug-fix - # special install for this top-level Python script which includes all # of the split Python libraries. ourpythondir = $(grpythondir)/gr @@ -67,9 +63,12 @@ ourpython_PYTHON = gnuradio_core.py # gnuradio_swig_bug_workaround.h : gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix # $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@ +EXTRA_DIST += gen-swig-bug-fix + # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = gnuradio_swig_bug_workaround.h + # Install so that they end up available as: # import gnuradio.gr # This ends up at: @@ -89,5 +88,4 @@ gnuradio_core_filter_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_core_io_la_swig_libadd = $(GNURADIO_CORE_LA) gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA) - SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE diff --git a/gnuradio-core/src/python/bin/Makefile.am b/gnuradio-core/src/python/bin/Makefile.am index 0afd32767..6f9f162f1 100644 --- a/gnuradio-core/src/python/bin/Makefile.am +++ b/gnuradio-core/src/python/bin/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005,2009 Free Software Foundation, Inc. +# Copyright 2005,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = microtune.py +EXTRA_DIST += microtune.py noinst_SCRIPTS = \ microtune.py diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am index 7d89777ef..b8da9cf48 100644 --- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = \ +EXTRA_DIST += \ run_tests.in \ test_16bit_1chunk.wav diff --git a/gnuradio-core/src/tests/Makefile.am b/gnuradio-core/src/tests/Makefile.am index 2bf7cb4e5..c75bb8c2a 100644 --- a/gnuradio-core/src/tests/Makefile.am +++ b/gnuradio-core/src/tests/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001,2008 Free Software Foundation, Inc. +# Copyright 2001,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,7 +31,7 @@ TESTS = test_all # test_atsc #Test program to test setting up buffers using gr_test which can be run manually -EXTRA_DIST = \ +EXTRA_DIST += \ test_buffers.py \ benchmark_dotprod diff --git a/gnuradio-core/src/utils/Makefile.am b/gnuradio-core/src/utils/Makefile.am index 22dae7117..acf439140 100644 --- a/gnuradio-core/src/utils/Makefile.am +++ b/gnuradio-core/src/utils/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = \ +EXTRA_DIST += \ cic_comp_taps.m \ db_width.m \ filter_tools.m \ -- cgit From 4dce044bcba406c69704baad7ff1a30a35a6d0e2 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 19:18:11 -0800 Subject: Add conditionals around gnuradio-core/src/{guile,python} --- gnuradio-core/src/guile/Makefile.am | 6 +++++- gnuradio-core/src/python/Makefile.am | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 209e664a0..4e12b646d 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -19,6 +19,8 @@ include $(top_srcdir)/Makefile.common +if GUILE + TESTS = run_guile_tests EXTRA_DIST += \ @@ -26,7 +28,7 @@ EXTRA_DIST += \ $(nobase_guile_DATA) \ $(GUILE_TESTS) -# These are the hand-code guile files for gnuradio-core. +# These are the hand-coded guile files for gnuradio-core. # # Swig/common.scm is glue that's required for the goops wrappers. # gnuradio/export-safely.scm works around some problems in the goops generated wrappers. @@ -52,3 +54,5 @@ GUILE_TESTS = \ tests/io_ctors.test CLEANFILES = guile.log + +endif diff --git a/gnuradio-core/src/python/Makefile.am b/gnuradio-core/src/python/Makefile.am index e50af8944..a90aaba5c 100644 --- a/gnuradio-core/src/python/Makefile.am +++ b/gnuradio-core/src/python/Makefile.am @@ -21,9 +21,10 @@ include $(top_srcdir)/Makefile.common +if PYTHON SUBDIRS = gnuradio bin noinst_PYTHON = \ build_utils.py \ build_utils_codes.py - +endif -- cgit From 4649aa471222351e8586b90e98bb947325d340b6 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 28 Nov 2010 19:15:27 -0500 Subject: Changing propagation policy enum type name and making a few other minor edits. --- gnuradio-core/src/lib/runtime/gr_block.cc | 4 ++-- gnuradio-core/src/lib/runtime/gr_block.h | 8 ++++---- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 52be37e3b..81a55af9d 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -169,14 +169,14 @@ gr_block::get_tags_in_range(std::vector &v, d_detail->get_tags_in_range(v, which_output, start, end, key); } -gr_block::TAG_PROPAGATION_POLICY +gr_block::tag_propagation_policy_t gr_block::tag_propagation_policy() { return d_tag_propagation_policy; } void -gr_block::set_tag_propagation_policy(TAG_PROPAGATION_POLICY p) +gr_block::set_tag_propagation_policy(tag_propagation_policy_t p) { d_tag_propagation_policy = p; } diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 36eed3d10..ad7fa9555 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -63,7 +63,7 @@ class gr_block : public gr_basic_block { WORK_DONE = -1 }; - enum TAG_PROPAGATION_POLICY { + enum tag_propagation_policy_t { TPP_DONT = 0, TPP_ALL_TO_ALL = 1, TPP_ONE_TO_ONE = 2 @@ -217,12 +217,12 @@ class gr_block : public gr_basic_block { /*! * \brief Asks for the policy used by the scheduler to moved tags downstream. */ - TAG_PROPAGATION_POLICY tag_propagation_policy(); + tag_propagation_policy_t tag_propagation_policy(); /*! * \brief Set the policy by the scheduler to determine how tags are moved downstream. */ - void set_tag_propagation_policy(TAG_PROPAGATION_POLICY p); + void set_tag_propagation_policy(tag_propagation_policy_t p); // ---------------------------------------------------------------------------- @@ -233,7 +233,7 @@ class gr_block : public gr_basic_block { gr_block_detail_sptr d_detail; // implementation details unsigned d_history; bool d_fixed_rate; - TAG_PROPAGATION_POLICY d_tag_propagation_policy; // policy for moving tags downstream + tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream protected: diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 59799069a..4a35e25d5 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2008,2009 Free Software Foundation, Inc. + * Copyright 2004,2008,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -88,7 +88,7 @@ min_available_space (gr_block_detail *d, int output_multiple) } static bool -propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, +propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d, const std::vector &start_nitems_read, double rrate, std::vector &rtags) { @@ -100,10 +100,10 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, } switch(policy) { - case(gr_block::TPP_DONT): + case gr_block::TPP_DONT: return true; break; - case(gr_block::TPP_ALL_TO_ALL): + case gr_block::TPP_ALL_TO_ALL: // every tag on every input propogates to everyone downstream for(int i = 0; i < d->ninputs(); i++) { d->get_tags_in_range(rtags, i, start_nitems_read[i], @@ -122,7 +122,7 @@ propagate_tags(gr_block::TAG_PROPAGATION_POLICY policy, gr_block_detail *d, } } break; - case(gr_block::TPP_ONE_TO_ONE): + case gr_block::TPP_ONE_TO_ONE: // tags from input i only go to output i // this requires d->ninputs() == d->noutputs; this is checked when this // type of tag-propagation system is selected in gr_block_detail @@ -362,7 +362,7 @@ gr_block_executor::run_one_iteration() for (int i = 0; i < d->noutputs (); i++) d_output_items[i] = d->output(i)->write_pointer(); - // determine where to start looking for new tags as 1 past nitems read + // determine where to start looking for new tags for (int i = 0; i < d->ninputs(); i++) d_start_nitems_read[i] = d->nitems_read(i); -- cgit From 0f2bd2c94baa43fc8626f5285c0696a379ef5efd Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 28 Nov 2010 19:17:07 -0500 Subject: Swapping order of testing rrate. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 9c30b1334..112150235 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -110,7 +110,13 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d, d->nitems_read(i)); std::vector::iterator t; - if(rrate != 1.0) { + if(rrate == 1.0) { + for(t = rtags.begin(); t != rtags.end(); t++) { + for(int o = 0; o < d->noutputs(); o++) + d->output(o)->add_item_tag(*t); + } + } + else { for(t = rtags.begin(); t != rtags.end(); t++) { uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate), @@ -122,12 +128,6 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d, d->output(o)->add_item_tag(newtup); } } - else { - for(t = rtags.begin(); t != rtags.end(); t++) { - for(int o = 0; o < d->noutputs(); o++) - d->output(o)->add_item_tag(*t); - } - } } break; case gr_block::TPP_ONE_TO_ONE: -- cgit From 34a9654fa10efcf360fde9c42c624739abaabbc5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 29 Nov 2010 12:59:54 -0500 Subject: Removing global pmt constants. Were causing segfaults during make check. Must fix this later. --- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 4 +++- gnuradio-core/src/lib/runtime/gr_tag_info.cc | 3 ++- gnuradio-core/src/lib/runtime/gr_tag_info.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index 55c42eaff..c76ede542 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -105,7 +105,9 @@ gr_tagged_file_sink::work (int noutput_items, // Find time burst occurred by getting latest time tag and extrapolating // to new time based on sample rate of this block. std::vector time_tags; - get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time); + //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time); + get_tags_in_range(time_tags, 0, d_last_N, N, + pmt::pmt_string_to_symbol("time")); if(time_tags.size() > 0) { pmt::pmt_t tag = time_tags[time_tags.size()-1]; diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc index c64cc7eb8..f15329f9b 100644 --- a/gnuradio-core/src/lib/runtime/gr_tag_info.cc +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.cc @@ -28,10 +28,11 @@ #include namespace gr_tags { - +/* const pmt::pmt_t key_time = pmt::pmt_string_to_symbol("time"); const pmt::pmt_t key_sample_rate = pmt::pmt_string_to_symbol("sample_rate"); const pmt::pmt_t key_frequency = pmt::pmt_string_to_symbol("frequency"); const pmt::pmt_t key_rssi = pmt::pmt_string_to_symbol("rssi"); const pmt::pmt_t key_rx_gain = pmt::pmt_string_to_symbol("gain"); +*/ } diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h index 5ed30a815..5a1e1555a 100644 --- a/gnuradio-core/src/lib/runtime/gr_tag_info.h +++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h @@ -34,11 +34,13 @@ namespace gr_tags { TAG_VALUE_REF }; + /* extern const pmt::pmt_t key_time; extern const pmt::pmt_t key_sample_rate; extern const pmt::pmt_t key_frequency; extern const pmt::pmt_t key_rssi; extern const pmt::pmt_t key_gain; + */ /*! * \brief Returns the item \p tag occurred at (as a uint64_t) -- cgit From 649e4387848a5d9273983600be6f35c3e2a88191 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 29 Nov 2010 14:37:20 -0500 Subject: Block is a gr_block, so this sets its relative rate. Was required for using in the QA of the sample tags code. --- gnuradio-core/src/lib/general/gr_keep_one_in_n.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index c07e177fe..85495e277 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -38,8 +38,9 @@ gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) : gr_block ("keep_one_in_n", gr_make_io_signature (1, 1, item_size), gr_make_io_signature (1, 1, item_size)), - d_n (n), d_count(n) + d_count(n) { + set_n(n); } void @@ -50,6 +51,8 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; + + set_relative_rate(1.0 / (float)n); } int -- cgit From 1b179f0b381cbba224674db5678e542ce34a3d2a Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 29 Nov 2010 14:56:16 -0500 Subject: Modifying QA tests for the sample tags. By default, it only checks the sizes of the tags since order is not specified or guarenteed. --- gnuradio-core/src/lib/runtime/qa_block_tags.cc | 131 ++++++++++++++----------- 1 file changed, 72 insertions(+), 59 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 14983013c..07ce5c276 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -40,11 +40,18 @@ using namespace pmt; +// set to 1 to turn on debug output +// The debug output fully checks that the tags seen are what are expected. While +// this behavior currently works with our implementation, there is no guarentee +// that the tags will be coming in this specific order, so it's dangerous to +// rely on this as a test of the tag system working. We would really want to +// tags we know we should see and then test that they all occur once, but in no +// particular order. +#define QA_TAGS_DEBUG 0 + void qa_block_tags::t0 () { - printf("\nqa_block_tags::t0\n"); - unsigned int N = 1000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); @@ -71,8 +78,6 @@ qa_block_tags::t0 () void qa_block_tags::t1 () { - printf("\nqa_block_tags::t1\n"); - int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); @@ -98,6 +103,16 @@ qa_block_tags::t1 () tb->run(); + std::vector tags0 = ann0->data(); + std::vector tags3 = ann3->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); + +#if QA_TAGS_DEBUG // Kludge together the tags that we know should result from the above graph std::stringstream str0, str1, str2; str0 << ann0->name() << ann0->unique_id(); @@ -123,36 +138,27 @@ qa_block_tags::t1 () expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::vector tags0 = ann0->data(); - std::vector tags3 = ann3->data(); - std::vector tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + std::cout << std::endl << "qa_block_tags::t1" << std::endl; + // For annotator 3, we know it gets tags from ann0 and ann1, test this - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - //pmt_equal(tags3[i], expected_tags3[i]) CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); } // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); } +#endif } void qa_block_tags::t2 () { - printf("\nqa_block_tags::t2\n"); - int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); @@ -181,6 +187,23 @@ qa_block_tags::t2 () tb->run(); + std::vector tags0 = ann0->data(); + std::vector tags1 = ann1->data(); + std::vector tags2 = ann2->data(); + std::vector tags3 = ann4->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); + + // Make sure the rest all have 12 tags + CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12); + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12); + + +#if QA_TAGS_DEBUG // Kludge together the tags that we know should result from the above graph std::stringstream str0, str1; str0 << ann0->name() << ann0->unique_id(); @@ -214,20 +237,7 @@ qa_block_tags::t2 () expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - std::vector tags0 = ann0->data(); - std::vector tags1 = ann1->data(); - std::vector tags2 = ann2->data(); - std::vector tags3 = ann4->data(); - std::vector tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); - - // Make sure the rest all have 12 tags - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12); + std::cout << std::endl << "qa_block_tags::t2" << std::endl; // For annotator[2-4], we know it gets tags from ann0 and ann1 // but the tags from the different outputs of ann1 are different for each. @@ -235,24 +245,21 @@ qa_block_tags::t2 () // inconceivable for ann3 to have it wrong. for(size_t i = 0; i < tags2.size(); i++) { std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - //pmt_equal(tags2[i], expected_tags2[i]) CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); } std::cout << std::endl; for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - //pmt_equal(tags4[i], expected_tags4[i]) CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); } +#endif } void qa_block_tags::t3 () { - printf("\nqa_block_tags::t3\n"); - int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); @@ -279,6 +286,17 @@ qa_block_tags::t3 () tb->run(); + + std::vector tags0 = ann0->data(); + std::vector tags3 = ann3->data(); + std::vector tags4 = ann4->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); + CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); + +#if QA_TAGS_DEBUG // Kludge together the tags that we know should result from the above graph std::stringstream str0, str1, str2; str0 << ann0->name() << ann0->unique_id(); @@ -304,37 +322,28 @@ qa_block_tags::t3 () expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::vector tags0 = ann0->data(); - std::vector tags3 = ann3->data(); - std::vector tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + std::cout << std::endl << "qa_block_tags::t3" << std::endl; + // For annotator 3, we know it gets tags from ann0 and ann1, test this - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); for(size_t i = 0; i < tags3.size(); i++) { std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - //pmt_equal(tags3[i], expected_tags3[i]) CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i])); } // For annotator 4, we know it gets tags from ann0 and ann2, test this std::cout << std::endl; - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); for(size_t i = 0; i < tags4.size(); i++) { std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i])); } +#endif } void qa_block_tags::t4 () { - printf("\nqa_block_tags::t4\n"); - int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(int))); @@ -354,6 +363,9 @@ qa_block_tags::t4 () tb->connect(ann1, 0, snk0, 0); tb->connect(ann2, 0, snk1, 0); + std::cerr << std::endl + << "NOTE: This is supposed to produce an error from gr_block_executor" + << std::endl; tb->run(); } @@ -361,16 +373,13 @@ qa_block_tags::t4 () void qa_block_tags::t5 () { - printf("\nqa_block_tags::t5\n"); - int N = 40000; gr_top_block_sptr tb = gr_make_top_block("top"); gr_block_sptr src (gr_make_null_source(sizeof(float))); gr_block_sptr head (gr_make_head(sizeof(float), N)); gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); + gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(2000, sizeof(float))); gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); // Rate change blocks @@ -385,6 +394,17 @@ qa_block_tags::t5 () tb->run(); + std::vector tags0 = ann0->data(); + std::vector tags1 = ann1->data(); + std::vector tags2 = ann2->data(); + + // The first annotator does not receive any tags from the null sink upstream + CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); + CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); + + +#if QA_TAGS_DEBUG // Kludge together the tags that we know should result from the above graph std::stringstream str0, str1, str2; str0 << ann0->name() << ann0->unique_id(); @@ -409,29 +429,22 @@ qa_block_tags::t5 () expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); - std::vector tags0 = ann0->data(); - std::vector tags1 = ann1->data(); - std::vector tags2 = ann2->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); + std::cout << std::endl << "qa_block_tags::t5" << std::endl; // annotator 1 gets tags from annotator 0 std::cout << "tags1.size(): " << tags1.size() << std::endl; - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); for(size_t i = 0; i < tags1.size(); i++) { std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; - //pmt_equal(tags1[i], expected_tags1[i]) CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i])); } // annotator 2 gets tags from annotators 0 and 1 std::cout << std::endl; std::cout << "tags2.size(): " << tags2.size() << std::endl; - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); for(size_t i = 0; i < tags2.size(); i++) { std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i])); } +#endif } -- cgit From 37c2a3826eb876e8942d83991cd94284cc886903 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 29 Nov 2010 10:59:10 -0800 Subject: Add additional scripting language vector tests --- gnuradio-core/src/lib/general/complex_vec_test.cc | 45 +++++++++++++++++++++++ gnuradio-core/src/lib/general/complex_vec_test.h | 16 +++++++- gnuradio-core/src/lib/general/complex_vec_test.i | 17 ++++++++- 3 files changed, 74 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/complex_vec_test.cc b/gnuradio-core/src/lib/general/complex_vec_test.cc index 21bca1765..df25c325e 100644 --- a/gnuradio-core/src/lib/general/complex_vec_test.cc +++ b/gnuradio-core/src/lib/general/complex_vec_test.cc @@ -35,3 +35,48 @@ complex_scalar_test1(std::complex input) return std::complex(input.real()+0.5, input.imag()-0.5); } + +std::vector +float_vec_test0() +{ + std::vector r(5); + + for (size_t i = 0; i < r.size(); i++) + r[i] = (float) i; + + return r; +} + +std::vector +float_vec_test1(const std::vector &input) +{ + std::vector r(input.size()); + + for (size_t i = 0; i < input.size(); i++) + r[i] = input[i] + 0.5; + + return r; +} + +std::vector +int_vec_test0() +{ + std::vector r(5); + + for (size_t i = 0; i < r.size(); i++) + r[i] = (int) i; + + return r; +} + +std::vector +int_vec_test1(const std::vector &input) +{ + std::vector r(input.size()); + + for (size_t i = 0; i < input.size(); i++) + r[i] = input[i] + 1; + + return r; +} + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h index f1a8a14e2..d13dedf63 100644 --- a/gnuradio-core/src/lib/general/complex_vec_test.h +++ b/gnuradio-core/src/lib/general/complex_vec_test.h @@ -1,10 +1,10 @@ #include #include -std::vector > +std::vector > complex_vec_test0(); -std::vector > +std::vector > complex_vec_test1(const std::vector > &input); std::complex @@ -13,3 +13,15 @@ complex_scalar_test0(); std::complex complex_scalar_test1(std::complex input); +std::vector +int_vec_test0(); + +std::vector +int_vec_test1(const std::vector &input); + +std::vector +float_vec_test0(); + +std::vector +float_vec_test1(const std::vector &input); + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.i b/gnuradio-core/src/lib/general/complex_vec_test.i index 1c62cfda2..4b95633be 100644 --- a/gnuradio-core/src/lib/general/complex_vec_test.i +++ b/gnuradio-core/src/lib/general/complex_vec_test.i @@ -1,7 +1,8 @@ -std::vector > + +std::vector > complex_vec_test0(); -std::vector > +std::vector > complex_vec_test1(const std::vector > &input); std::complex @@ -10,3 +11,15 @@ complex_scalar_test0(); std::complex complex_scalar_test1(std::complex input); +std::vector +int_vec_test0(); + +std::vector +int_vec_test1(const std::vector &input); + +std::vector +float_vec_test0(); + +std::vector +float_vec_test1(const std::vector &input); + -- cgit From 82f2222a58e83971308c9caaaae026f396b3e9fe Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 30 Nov 2010 17:18:22 -0800 Subject: Remove generated file from repo --- .../lib/filter/gri_fir_filter_with_buffer_ccf.h | 131 --------------------- 1 file changed, 131 deletions(-) delete mode 100644 gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h deleted file mode 100644 index bd7fa33cf..000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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. - */ - -/* - * WARNING: This file is automatically generated by generate_gri_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H -#define INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H - -#include -#include -#include -#include -#include - -/*! - * \brief FIR with internal buffer for gr_complex input, - gr_complex output and float taps - * \ingroup filter - * - */ - -class gri_fir_filter_with_buffer_ccf { - -protected: - std::vector d_taps; // reversed taps - gr_complex *d_buffer; - unsigned int d_idx; - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - gri_fir_filter_with_buffer_ccf (const std::vector &taps); - - ~gri_fir_filter_with_buffer_ccf (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input is a single input value of the filter type - * - * \returns the filtered input value. - */ - gr_complex filter (gr_complex input); - - - /*! - * \brief compute a single output value; designed for decimating filters. - * - * \p input is a single input value of the filter type. The value of dec is the - * decimating value of the filter, so input[] must have dec valid values. - * The filter pushes dec number of items onto the circ. buffer before computing - * a single output. - * - * \returns the filtered input value. - */ - gr_complex filter (const gr_complex input[], unsigned long dec); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - void filterN (gr_complex output[], const gr_complex input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - void filterNdec (gr_complex output[], const gr_complex input[], - unsigned long n, unsigned long decimate); - - /*! - * \brief install \p new_taps as the current taps. - */ - void set_taps (const std::vector &taps); - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - const std::vector get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H */ -- cgit From 9d91d36c7e509928705f093935024d08d2c019c8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 2 Dec 2010 17:27:36 -0800 Subject: Move guts of gr-run-waveform into gnuradio/run-waveform.scm --- gnuradio-core/src/guile/Makefile.am | 1 + gnuradio-core/src/guile/gnuradio/run-waveform.scm | 53 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 gnuradio-core/src/guile/gnuradio/run-waveform.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 4e12b646d..50d46411a 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -41,6 +41,7 @@ nobase_guile_DATA = \ gnuradio/export-safely.scm \ gnuradio/runtime-shim.scm \ gnuradio/waveform.scm \ + gnuradio/run-waveform.scm \ gnuradio/test-suite/guile-test \ gnuradio/test-suite/lib.scm diff --git a/gnuradio-core/src/guile/gnuradio/run-waveform.scm b/gnuradio-core/src/guile/gnuradio/run-waveform.scm new file mode 100644 index 000000000..3a2c4e6b7 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/run-waveform.scm @@ -0,0 +1,53 @@ +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; Load and run a waveform defined with define-waveform + + +;; I don't seem to be able to make this work... +;; I think it's some kind of interaction with the syntax-case +;; macro, define-waveform, and the module system. +;; +;;(define-module (gnuradio run-waveform) +;; #:use-module (oop goops) +;; #:use-module (gnuradio core) +;; #:use-module (gnuradio waveform) +;; #:duplicates (merge-generics replace check)) + +(use-modules (oop goops) + (gnuradio core) + (gnuradio waveform)) + + +(define (load-into-module filename module) + (let ((f (open-file filename "r"))) + (let loop ((form (read f))) + (cond ((eof-object? form) #t) + (else (eval form module) + (loop (read f))))))) + + +(define-public (run-waveform waveform-filename . args) + (debug-enable 'backtrace 'debug) + (load waveform-filename) + ;;(load-into-module waveform-filename (current-module)) + (let ((f (waveform-last-registered))) + (if (not f) + (error "No define-waveform found in file \n" filename) + (gr:run (f args))))) -- cgit From cef9e8f38edb3f6aaea811fa04cfeebdbf26ba59 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 2 Dec 2010 21:21:41 -0800 Subject: Moved contents of gr-guile into gnuradio-core/src/guile and removed gr-guile. Passes distcheck. --- gnuradio-core/src/guile/Makefile.am | 4 +++ .../src/guile/example-waveforms/.gitignore | 6 ++++ .../src/guile/example-waveforms/Makefile.am | 28 +++++++++++++++ .../src/guile/example-waveforms/dial-tone.wfd | 40 ++++++++++++++++++++++ .../src/guile/gnuradio/scripts/gr-run-waveform.in | 40 ++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 gnuradio-core/src/guile/example-waveforms/.gitignore create mode 100644 gnuradio-core/src/guile/example-waveforms/Makefile.am create mode 100644 gnuradio-core/src/guile/example-waveforms/dial-tone.wfd create mode 100755 gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 50d46411a..447500b46 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -28,6 +28,9 @@ EXTRA_DIST += \ $(nobase_guile_DATA) \ $(GUILE_TESTS) + +SUBDIRS = example-waveforms + # These are the hand-coded guile files for gnuradio-core. # # Swig/common.scm is glue that's required for the goops wrappers. @@ -42,6 +45,7 @@ nobase_guile_DATA = \ gnuradio/runtime-shim.scm \ gnuradio/waveform.scm \ gnuradio/run-waveform.scm \ + gnuradio/scripts/gr-run-waveform \ gnuradio/test-suite/guile-test \ gnuradio/test-suite/lib.scm diff --git a/gnuradio-core/src/guile/example-waveforms/.gitignore b/gnuradio-core/src/guile/example-waveforms/.gitignore new file mode 100644 index 000000000..16c984055 --- /dev/null +++ b/gnuradio-core/src/guile/example-waveforms/.gitignore @@ -0,0 +1,6 @@ +/Makefile +/Makefile.in +/.deps +/.libs +/*.la +/*.lo diff --git a/gnuradio-core/src/guile/example-waveforms/Makefile.am b/gnuradio-core/src/guile/example-waveforms/Makefile.am new file mode 100644 index 000000000..277b4ad0b --- /dev/null +++ b/gnuradio-core/src/guile/example-waveforms/Makefile.am @@ -0,0 +1,28 @@ +# +# Copyright 2010 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 this program. If not, see . +# + +include $(top_srcdir)/Makefile.common + +waveformdir=$(datarootdir)/gnuradio/example-waveforms + +waveform_DATA = \ + dial-tone.wfd + +EXTRA_DIST += \ + dial-tone.wfd diff --git a/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd b/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd new file mode 100644 index 000000000..ced3df572 --- /dev/null +++ b/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd @@ -0,0 +1,40 @@ +;;; Emacs, format this using -*-scheme-*- mode. +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; This example waveform outputs a signal to an audio_alsa_sink +;;; that sounds like North American dial tone. + +(use-modules (gnuradio audio_alsa)) + + +(define-waveform (dial-tone cmd-line-args) + (vars + (sample-rate 48000) + (ampl 0.1)) + + (blocks + (src0 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 350 ampl)) + (src1 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 440 ampl)) + (sink (gr:audio-alsa-sink sample-rate "plughw:0,0")) + ) + + (connections + (src0 (list sink 0)) ; src0 to left input + (src1 (list sink 1)))) ; src1 to right input diff --git a/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in b/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in new file mode 100755 index 000000000..8186d2e09 --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in @@ -0,0 +1,40 @@ +#!@GUILE@ \ +-e main -s +!# +;;; +;;; Copyright 2010 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 this program. If not, see . +;;; + +;;; Load and run a waveform defined with define-waveform +;;; +;;; usage: gr-run-waveform filename.wfd [args...] + +(load-from-path "gnuradio/run-waveform") + +(define (main args) + (if (not (>= (length args) 2)) + (let ((port (current-error-port))) + (display "usage: " port) + (display (car args) port) + (display " filename.wfd [args...]\n" port) + (exit 1))) + (apply run-waveform (cdr args))) + +;;; Local Variables: +;;; mode: scheme +;;; End: -- cgit From 9bc62cca21a0a171cbc220419af91b3d8f7e333b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 14:08:07 -0800 Subject: Add "shims" for booting (mostly) from magic file system --- gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm | 27 +++++++++++++++++++++++++ gnuradio-core/src/guile/Makefile.am | 1 + 2 files changed, 28 insertions(+) create mode 100644 gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm b/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm new file mode 100644 index 000000000..4926c6f3c --- /dev/null +++ b/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm @@ -0,0 +1,27 @@ +;;; install shims for magic file system (if defined), then chain to real boot code. + +(if (defined? 'xyzzy-primitive-load) + (set! primitive-load xyzzy-primitive-load)) + +(if (defined? 'xyzzy-primitive-load-path) + (set! primitive-load-path xyzzy-primitive-load-path)) + +(if (defined? 'xyzzy-search-path) + (set! search-path xyzzy-search-path)) + +(if (defined? 'xyzzy-search-load-path) + (set! search-load-path xyzzy-search-load-path)) + +;; Remove any path containing /+boot+ from %load-path +(set! %load-path + (let ((new-path '())) + (let loop ((path %load-path)) + (cond ((not (pair? path)) + (reverse! new-path)) + ((string-contains (car path) "/+boot+") + (loop (cdr path))) + (else + (set! new-path (cons (car path) new-path)) + (loop (cdr path))))))) + +(primitive-load-path "ice-9/boot-9.scm") diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 447500b46..cebef89f1 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -39,6 +39,7 @@ SUBDIRS = example-waveforms # gnuradio/runtime-shim implements "guile friendly" versions of connect & disconnect. nobase_guile_DATA = \ + +boot+/ice-9/boot-9.scm \ Swig/common.scm \ gnuradio/core.scm \ gnuradio/export-safely.scm \ -- cgit From c9597503e054b24ec79e6e379b2b56ffc369f3f3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 14:09:06 -0800 Subject: Try to get block destructors called (fairly) early --- gnuradio-core/src/guile/gnuradio/run-waveform.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/run-waveform.scm b/gnuradio-core/src/guile/gnuradio/run-waveform.scm index 3a2c4e6b7..01930521c 100644 --- a/gnuradio-core/src/guile/gnuradio/run-waveform.scm +++ b/gnuradio-core/src/guile/gnuradio/run-waveform.scm @@ -49,5 +49,7 @@ ;;(load-into-module waveform-filename (current-module)) (let ((f (waveform-last-registered))) (if (not f) - (error "No define-waveform found in file \n" filename) - (gr:run (f args))))) + (error "No define-waveform found in file \n" filename)) + (gr:run (f args)) + ;; Attempt to get block destructors called now. + (gc))) -- cgit From 63728823a570a305a18d462dae2d07ba77d520fd Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 14:32:15 -0800 Subject: Revert "Add "shims" for booting (mostly) from magic file system" This reverts commit 9bc62cca21a0a171cbc220419af91b3d8f7e333b. This stragegy didn't work. Our new gsubrs have not yet be defined when the ice-9/boot-9.scm code is loaded. --- gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm | 27 ------------------------- gnuradio-core/src/guile/Makefile.am | 1 - 2 files changed, 28 deletions(-) delete mode 100644 gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm b/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm deleted file mode 100644 index 4926c6f3c..000000000 --- a/gnuradio-core/src/guile/+boot+/ice-9/boot-9.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; install shims for magic file system (if defined), then chain to real boot code. - -(if (defined? 'xyzzy-primitive-load) - (set! primitive-load xyzzy-primitive-load)) - -(if (defined? 'xyzzy-primitive-load-path) - (set! primitive-load-path xyzzy-primitive-load-path)) - -(if (defined? 'xyzzy-search-path) - (set! search-path xyzzy-search-path)) - -(if (defined? 'xyzzy-search-load-path) - (set! search-load-path xyzzy-search-load-path)) - -;; Remove any path containing /+boot+ from %load-path -(set! %load-path - (let ((new-path '())) - (let loop ((path %load-path)) - (cond ((not (pair? path)) - (reverse! new-path)) - ((string-contains (car path) "/+boot+") - (loop (cdr path))) - (else - (set! new-path (cons (car path) new-path)) - (loop (cdr path))))))) - -(primitive-load-path "ice-9/boot-9.scm") diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index cebef89f1..447500b46 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -39,7 +39,6 @@ SUBDIRS = example-waveforms # gnuradio/runtime-shim implements "guile friendly" versions of connect & disconnect. nobase_guile_DATA = \ - +boot+/ice-9/boot-9.scm \ Swig/common.scm \ gnuradio/core.scm \ gnuradio/export-safely.scm \ -- cgit From 4d16f8ac9e88babdcdf3dac3e5080d1bbf6fa1a7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:09:34 -0800 Subject: update .gitignore --- gnuradio-core/src/guile/gnuradio/scripts/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 gnuradio-core/src/guile/gnuradio/scripts/.gitignore (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/gnuradio/scripts/.gitignore b/gnuradio-core/src/guile/gnuradio/scripts/.gitignore new file mode 100644 index 000000000..64cbdbc0e --- /dev/null +++ b/gnuradio-core/src/guile/gnuradio/scripts/.gitignore @@ -0,0 +1 @@ +gr-run-waveform -- cgit From 0b5f66113f43d2ba94a1ca741b5ce65e1f9f2c02 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:30:54 -0800 Subject: Rename libguile- to libguile-gnuradio- to match guile library naming convention. The stuff in gnuradio-core ends up with funky names, but that could be fixed by renaming gnuradio_core_filter.i -> core_filter.i etc. --- gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_io.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i index 0acbfa3a6..d7262f140 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module") +(load-extension "libguile-gnuradio-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index 759a65459..e381f3509 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -51,7 +51,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module") +(load-extension "libguile-gnuradio-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i index c08109173..d9fe6672a 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module") +(load-extension "libguile-gnuradio-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i index 6d7a38321..2869fd56b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module") +(load-extension "libguile-gnuradio-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i index 936522ada..c8d818660 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module") +(load-extension "libguile-gnuradio-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i index bb10b36b2..78b717d22 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -34,7 +34,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") +(load-extension "libguile-gnuradio-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") %} %goops %{ -- cgit From 6df0423fe1880f5c33daa333604552ea68ac9593 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:34:24 -0800 Subject: Regenerated Makefile.swig.gen's --- gnuradio-core/src/lib/swig/Makefile.swig.gen | 60 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen index 160fc8fd8..0c3247565 100644 --- a/gnuradio-core/src/lib/swig/Makefile.swig.gen +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -115,20 +115,20 @@ endif # end of if python if GUILE gnuradio_core_runtime_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_runtime.la -libguile_gnuradio_core_runtime_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_runtime.la +libguile_gnuradio_gnuradio_core_runtime_la_SOURCES = \ guile/gnuradio_core_runtime.cc \ $(gnuradio_core_runtime_la_swig_sources) nobase_gnuradio_core_runtime_scm_DATA = \ gnuradio/gnuradio_core_runtime.scm \ gnuradio/gnuradio_core_runtime-primitive.scm -libguile_gnuradio_core_runtime_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_runtime_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_runtime_la_swig_libadd) -libguile_gnuradio_core_runtime_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_runtime_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_runtime_la_swig_ldflags) -libguile_gnuradio_core_runtime_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_runtime_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_runtime_la_swig_cxxflags) @@ -260,20 +260,20 @@ endif # end of if python if GUILE gnuradio_core_general_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_general.la -libguile_gnuradio_core_general_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_general.la +libguile_gnuradio_gnuradio_core_general_la_SOURCES = \ guile/gnuradio_core_general.cc \ $(gnuradio_core_general_la_swig_sources) nobase_gnuradio_core_general_scm_DATA = \ gnuradio/gnuradio_core_general.scm \ gnuradio/gnuradio_core_general-primitive.scm -libguile_gnuradio_core_general_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_general_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_general_la_swig_libadd) -libguile_gnuradio_core_general_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_general_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_general_la_swig_ldflags) -libguile_gnuradio_core_general_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_general_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_general_la_swig_cxxflags) @@ -405,20 +405,20 @@ endif # end of if python if GUILE gnuradio_core_gengen_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_gengen.la -libguile_gnuradio_core_gengen_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_gengen.la +libguile_gnuradio_gnuradio_core_gengen_la_SOURCES = \ guile/gnuradio_core_gengen.cc \ $(gnuradio_core_gengen_la_swig_sources) nobase_gnuradio_core_gengen_scm_DATA = \ gnuradio/gnuradio_core_gengen.scm \ gnuradio/gnuradio_core_gengen-primitive.scm -libguile_gnuradio_core_gengen_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_gengen_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_gengen_la_swig_libadd) -libguile_gnuradio_core_gengen_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_gengen_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_gengen_la_swig_ldflags) -libguile_gnuradio_core_gengen_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_gengen_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_gengen_la_swig_cxxflags) @@ -550,20 +550,20 @@ endif # end of if python if GUILE gnuradio_core_filter_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_filter.la -libguile_gnuradio_core_filter_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_filter.la +libguile_gnuradio_gnuradio_core_filter_la_SOURCES = \ guile/gnuradio_core_filter.cc \ $(gnuradio_core_filter_la_swig_sources) nobase_gnuradio_core_filter_scm_DATA = \ gnuradio/gnuradio_core_filter.scm \ gnuradio/gnuradio_core_filter-primitive.scm -libguile_gnuradio_core_filter_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_filter_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_filter_la_swig_libadd) -libguile_gnuradio_core_filter_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_filter_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_filter_la_swig_ldflags) -libguile_gnuradio_core_filter_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_filter_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_filter_la_swig_cxxflags) @@ -695,20 +695,20 @@ endif # end of if python if GUILE gnuradio_core_io_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_io.la -libguile_gnuradio_core_io_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_io.la +libguile_gnuradio_gnuradio_core_io_la_SOURCES = \ guile/gnuradio_core_io.cc \ $(gnuradio_core_io_la_swig_sources) nobase_gnuradio_core_io_scm_DATA = \ gnuradio/gnuradio_core_io.scm \ gnuradio/gnuradio_core_io-primitive.scm -libguile_gnuradio_core_io_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_io_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_io_la_swig_libadd) -libguile_gnuradio_core_io_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_io_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_io_la_swig_ldflags) -libguile_gnuradio_core_io_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_io_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_io_la_swig_cxxflags) @@ -840,20 +840,20 @@ endif # end of if python if GUILE gnuradio_core_hier_scmlib_LTLIBRARIES = \ - libguile-gnuradio_core_hier.la -libguile_gnuradio_core_hier_la_SOURCES = \ + libguile-gnuradio-gnuradio_core_hier.la +libguile_gnuradio_gnuradio_core_hier_la_SOURCES = \ guile/gnuradio_core_hier.cc \ $(gnuradio_core_hier_la_swig_sources) nobase_gnuradio_core_hier_scm_DATA = \ gnuradio/gnuradio_core_hier.scm \ gnuradio/gnuradio_core_hier-primitive.scm -libguile_gnuradio_core_hier_la_LIBADD = \ +libguile_gnuradio_gnuradio_core_hier_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(gnuradio_core_hier_la_swig_libadd) -libguile_gnuradio_core_hier_la_LDFLAGS = \ +libguile_gnuradio_gnuradio_core_hier_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(gnuradio_core_hier_la_swig_ldflags) -libguile_gnuradio_core_hier_la_CXXFLAGS = \ +libguile_gnuradio_gnuradio_core_hier_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(gnuradio_core_hier_la_swig_cxxflags) -- cgit From 9911a8d9edcde54b9a18810f37799a58a6895310 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 7 Dec 2010 13:35:54 -0800 Subject: Remove incorrect if PYTHON around swiginclude_HEADERS --- gnuradio-core/src/lib/filter/Makefile.am | 3 +-- gnuradio-core/src/lib/general/Makefile.am | 2 -- gnuradio-core/src/lib/gengen/Makefile.am | 2 -- gnuradio-core/src/lib/hier/Makefile.am | 2 -- gnuradio-core/src/lib/io/Makefile.am | 2 -- gnuradio-core/src/lib/runtime/Makefile.am | 2 -- 6 files changed, 1 insertion(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 38edee3d5..0a34cb5b5 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -345,7 +345,6 @@ noinst_HEADERS = \ qa_gri_fir_filter_with_buffer_scc.h -if PYTHON swiginclude_HEADERS = \ filter.i \ filter_generated.i \ @@ -369,7 +368,7 @@ swiginclude_HEADERS = \ gr_pfb_clock_sync_ccf.i \ gr_pfb_clock_sync_fff.i \ $(GENERATED_I) -endif + # Do creation and inclusion of other Makefiles last diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index c6440506d..17623f0ba 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -365,7 +365,6 @@ noinst_HEADERS = \ sine_table.h \ qa_gr_math.h -if PYTHON swiginclude_HEADERS = \ complex_vec_test.i \ general.i \ @@ -497,4 +496,3 @@ swiginclude_HEADERS = \ gr_annotator_alltoall.i \ gr_annotator_1to1.i \ gr_burst_tagger.i -endif diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index cfa043b67..5fbb6f52c 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -135,13 +135,11 @@ grinclude_HEADERS = \ gr_noise_type.h \ gr_sig_source_waveform.h -if PYTHON swiginclude_HEADERS = \ $(GENERATED_I) \ gr_endianness.i \ gengen.i \ gengen_generated.i -endif # Do creation and inclusion of other Makefiles last diff --git a/gnuradio-core/src/lib/hier/Makefile.am b/gnuradio-core/src/lib/hier/Makefile.am index e2e7fe886..b525d19b4 100644 --- a/gnuradio-core/src/lib/hier/Makefile.am +++ b/gnuradio-core/src/lib/hier/Makefile.am @@ -32,8 +32,6 @@ libhier_la_SOURCES = \ grinclude_HEADERS = \ gr_channel_model.h -if PYTHON swiginclude_HEADERS = \ hier.i \ gr_channel_model.i -endif diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am index 8ce740afd..442d5e3a9 100644 --- a/gnuradio-core/src/lib/io/Makefile.am +++ b/gnuradio-core/src/lib/io/Makefile.am @@ -93,7 +93,6 @@ grinclude_HEADERS = \ gri_wavfile.h \ gr_tagged_file_sink.h -if PYTHON swiginclude_HEADERS = \ io.i \ gr_file_sink.i \ @@ -115,4 +114,3 @@ swiginclude_HEADERS = \ gr_wavfile_source.i \ gr_wavfile_sink.i \ gr_tagged_file_sink.i -endif diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index dd9a8ea64..0fdb58aff 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -142,7 +142,6 @@ noinst_HEADERS = \ qa_block_tags.h \ qa_runtime.h -if PYTHON swiginclude_HEADERS = \ gr_basic_block.i \ gr_block.i \ @@ -162,4 +161,3 @@ swiginclude_HEADERS = \ gr_sync_interpolator.i \ gr_top_block.i \ runtime.i -endif -- cgit From c6d4c7d5b410d066e55a31c787476a9ac96b1277 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 7 Dec 2010 15:54:27 -0800 Subject: Moved out-of-tree includes out of gnuradio_core_INCLUDES to ensure that in-tree includes are searched before out-of-tree includes. --- gnuradio-core/src/lib/filter/Makefile.am | 4 +++- gnuradio-core/src/lib/general/Makefile.am | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 0a34cb5b5..bf97d6cdc 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -26,7 +26,9 @@ include $(top_srcdir)/Makefile.common # other performance critical items # -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) +# $(WITH_INCLUDES) must _always_ be last +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) \ + $(FFTW3F_CPPFLAGS) $(WITH_INCLUDES) noinst_LTLIBRARIES = libfilter.la libfilter-qa.la diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 17623f0ba..08610c58a 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -21,7 +21,9 @@ include $(top_srcdir)/Makefile.common -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) +# $(WITH_INCLUDES) must _always_ be last +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) \ + $(FFTW3F_CPPFLAGS) $(GSL_CPPFLAGS) $(WITH_INCLUDES) noinst_LTLIBRARIES = libgeneral.la libgeneral-qa.la -- cgit From 74cbbd74dec5a1b976b5db028fe3aa4e20a899e3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 9 Dec 2010 20:49:29 -0800 Subject: Disable guile udp tests. They were causing a problem on some systems. --- gnuradio-core/src/guile/tests/io_ctors.test | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/io_ctors.test b/gnuradio-core/src/guile/tests/io_ctors.test index 1c5c9a771..5f40d321c 100644 --- a/gnuradio-core/src/guile/tests/io_ctors.test +++ b/gnuradio-core/src/guile/tests/io_ctors.test @@ -64,14 +64,14 @@ (pass-if (true? (gr:oscope-sink-f 1000 (gr:msg-queue)))) ;;; ./io/gr_udp_sink.h -(pass-if (true? (gr:udp-sink 4 "localhost" 80 1472 #f))) -(pass-if-throw "confirm throw gr:udp-sink" #t - (true? (gr:udp-sink 4 "localhostx" 80 1472 #f))) +;;(pass-if (true? (gr:udp-sink 4 "localhost" 80 1472 #f))) +;;(pass-if-throw "confirm throw gr:udp-sink" #t +;; (true? (gr:udp-sink 4 "localhostx" 80 1472 #f))) ;;; ./io/gr_udp_source.h -(pass-if (true? (gr:udp-source 4 "localhost" 0 1472 #f #t))) -(pass-if-throw "confirm throw gr:udp-sink" #t - (true? (gr:udp-source 4 "localhostx" 0 1472 #f #t))) +;;(pass-if (true? (gr:udp-source 4 "localhost" 0 1472 #f #t))) +;;(pass-if-throw "confirm throw gr:udp-source" #t +;; (true? (gr:udp-source 4 "localhostx" 0 1472 #f #t))) ;;; ./io/gr_wavfile_sink.h (pass-if (true? (gr:wavfile-sink "foo" 2 48000 16))) -- cgit From 67c77e22564fbd9cf4543ff939495b3259b3818c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 10 Dec 2010 16:12:04 -0800 Subject: Add new Guile gsubr that loads shared libraries using the equivalent of the RTLD_GLOBAL flag. This is part of a work-around for swig bug: 1863647 http://sourceforge.net/tracker/index.php?func=detail&aid=1863647&group_id=1645&atid=101645 --- gnuradio-core/src/guile/Makefile.am | 10 ++++ gnuradio-core/src/guile/dynl-global.c | 92 +++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 gnuradio-core/src/guile/dynl-global.c (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index 447500b46..b78225f4d 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -60,4 +60,14 @@ GUILE_TESTS = \ CLEANFILES = guile.log + +scmlibdir = $(libdir) +scmdir = $(guiledir) + +scmlib_LTLIBRARIES = libguile-gnuradio-dynl-global.la + +libguile_gnuradio_dynl_global_la_SOURCES = dynl-global.c +libguile_gnuradio_dynl_global_la_CPPFLAGS = $(GUILE_CFLAGS) +libguile_gnuradio_dynl_global_la_LIBADD = $(GUILE_LIBS) + endif diff --git a/gnuradio-core/src/guile/dynl-global.c b/gnuradio-core/src/guile/dynl-global.c new file mode 100644 index 000000000..1fc3a97a5 --- /dev/null +++ b/gnuradio-core/src/guile/dynl-global.c @@ -0,0 +1,92 @@ +/* -*- c -*- */ +/* + * Copyright 2010 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 this program. If not, see . + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +extern scm_t_bits scm_tc16_dynamic_obj; + +static lt_dlhandle +dlopenext_global (const char *filename) +{ + lt_dlhandle handle = 0; + lt_dladvise advise; + + if (!lt_dladvise_init (&advise) + && !lt_dladvise_ext (&advise) + && !lt_dladvise_global(&advise)) + handle = lt_dlopenadvise (filename, advise); + + lt_dladvise_destroy (&advise); + return handle; +} + + +static void * +sysdep_dynl_link_global (const char *fname, const char *subr) +{ + lt_dlhandle handle; + handle = dlopenext_global (fname); + if (NULL == handle) + { + SCM fn; + SCM msg; + + fn = scm_from_locale_string (fname); + msg = scm_from_locale_string (lt_dlerror ()); + scm_misc_error (subr, "file: ~S, message: ~S", scm_list_2 (fn, msg)); + } + return (void *) handle; +} + +SCM_DEFINE (scm_dynamic_link_global, "dynamic-link-global", 1, 0, 0, + (SCM filename), + "Find the shared object (shared library) denoted by\n" + "@var{filename} and link it into the running Guile\n" + "application. The returned\n" + "scheme object is a ``handle'' for the library which can\n" + "be passed to @code{dynamic-func}, @code{dynamic-call} etc.\n\n" + "Searching for object files is system dependent. Normally,\n" + "if @var{filename} does have an explicit directory it will\n" + "be searched for in locations\n" + "such as @file{/usr/lib} and @file{/usr/local/lib}.") +#define FUNC_NAME s_scm_dynamic_link_global +{ + void *handle; + char *file; + + scm_dynwind_begin (0); + file = scm_to_locale_string (filename); + scm_dynwind_free (file); + handle = sysdep_dynl_link_global (file, FUNC_NAME); + scm_dynwind_end (); + SCM_RETURN_NEWSMOB2 (scm_tc16_dynamic_obj, SCM_UNPACK (filename), handle); +} +#undef FUNC_NAME + +void +scm_init_gnuradio_dynl_global_module(void) +{ + scm_c_define_gsubr (s_scm_dynamic_link_global, 1, 0, 0, (SCM (*)()) scm_dynamic_link_global); +} -- cgit From 08907ee94fb6c34531d57b988324c67c26c8b747 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 10 Dec 2010 16:15:40 -0800 Subject: Use load-extension-global instead of load-extension --- gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_general.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_io.i | 2 +- gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 13 ++++++++++++- 6 files changed, 17 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i index d7262f140..e825467db 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module") +(load-extension-global "libguile-gnuradio-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i index e381f3509..adf6b469a 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i @@ -51,7 +51,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module") +(load-extension-global "libguile-gnuradio-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i index d9fe6672a..496ced077 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module") +(load-extension-global "libguile-gnuradio-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i index 2869fd56b..0b8161c5d 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module") +(load-extension-global "libguile-gnuradio-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i index c8d818660..0d989ea87 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_io.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i @@ -31,7 +31,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module") +(load-extension-global "libguile-gnuradio-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module") %} %goops %{ diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i index 78b717d22..579c51ce5 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i +++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i @@ -34,7 +34,18 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") + +;; Load our gsubr that loads libraries using the RTLD_GLOBAL option +(load-extension "libguile-gnuradio-dynl-global" "scm_init_gnuradio_dynl_global_module") + +;; Define load-extension-global in module '(guile) +(module-define! (resolve-module '(guile)) + 'load-extension-global + (lambda (lib init) + (dynamic-call init (dynamic-link-global lib)))) + +;; Use load-extension-global to load our swig modules +(load-extension-global "libguile-gnuradio-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module") %} %goops %{ -- cgit From 9db640f51b3af0cc73a94471a623b4d394ec2aab Mon Sep 17 00:00:00 2001 From: Matt Ettus Date: Sat, 11 Dec 2010 14:42:57 -0800 Subject: Create method to set rate on pfb_arb_resamp after it has been created. Allow it to be called from GRC. --- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc | 3 +-- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h | 6 +++++- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i | 1 + gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py | 9 +++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 59b76a6f0..2136dd843 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -58,8 +58,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, process. */ d_int_rate = filter_size; - d_dec_rate = (unsigned int)floor(d_int_rate/rate); - d_flt_rate = (d_int_rate/rate) - d_dec_rate; + set_rate(rate); // Store the last filter between calls to work d_last_filter = 0; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h index cf5a79d4e..44dd202b9 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h @@ -161,7 +161,11 @@ public: * Print all of the filterbank taps to screen. */ void print_taps(); - + void set_rate (float rate) { + d_dec_rate = (unsigned int)floor(d_int_rate/rate); + d_flt_rate = (d_int_rate/rate) - d_dec_rate; + } + int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i index 4f07af861..77f28acdf 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i @@ -38,4 +38,5 @@ class gr_pfb_arb_resampler_ccf : public gr_block //void set_taps (const std::vector &taps); void print_taps(); + void set_rate (float rate); }; diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py index cd9289fa5..74eae58dc 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py @@ -48,9 +48,14 @@ class pfb_arb_resampler_ccf(gr.hier_block2): self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten) self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size) - + #print "PFB has %d taps\n" % (len(self._taps),) + self.connect(self, self.pfb) self.connect(self.pfb, self) - + + # Note -- set_taps not implemented in base class yet def set_taps(self, taps): self.pfb.set_taps(taps) + + def set_rate(self, rate): + self.pfb.set_rate(rate) -- cgit From c75950bd5babfcab323b29b956fa0b620c3c19da Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 12 Dec 2010 13:09:32 -0500 Subject: resampler PFB: Sets relative rate when rate is changed. --- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc | 3 --- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 2136dd843..35455aa12 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -80,8 +80,6 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, create_diff_taps(taps, dtaps); create_taps(taps, d_taps, d_filters); create_taps(dtaps, d_dtaps, d_diff_filters); - - set_relative_rate(rate); } gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf () @@ -179,7 +177,6 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, // produce output as long as we can and there are enough input samples while((i < noutput_items) && (count < ninput_items[0]-1)) { - // start j by wrapping around mod the number of channels while((j < d_int_rate) && (i < noutput_items)) { // Take the current filter and derivative filter output diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h index 44dd202b9..2c36c95f9 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h @@ -164,6 +164,7 @@ public: void set_rate (float rate) { d_dec_rate = (unsigned int)floor(d_int_rate/rate); d_flt_rate = (d_int_rate/rate) - d_dec_rate; + set_relative_rate(rate); } int general_work (int noutput_items, -- cgit From 7e21f9ad055bb646b22edb462112443bab670b4e Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 12 Dec 2010 13:22:40 -0500 Subject: PFB resampler: fixes bug where filter could be looking past the number of inputs. --- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 35455aa12..320568bc3 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -176,7 +176,7 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, j = d_last_filter; // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < ninput_items[0]-1)) { + while((i < noutput_items) && (count < ninput_items[0]-d_taps_per_filter)) { // start j by wrapping around mod the number of channels while((j < d_int_rate) && (i < noutput_items)) { // Take the current filter and derivative filter output -- cgit From a151e3e1ba2409b44fd2af8ba1f9bfbf3f0dbf25 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 12 Dec 2010 13:39:06 -0500 Subject: PFB resampler: fix it this way to avoid the signed/unsigned warning. --- gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 320568bc3..834450436 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -176,7 +176,8 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, j = d_last_filter; // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < ninput_items[0]-d_taps_per_filter)) { + int max_input = ninput_items[0]-(int)d_taps_per_filter; + while((i < noutput_items) && (count < max_input)) { // start j by wrapping around mod the number of channels while((j < d_int_rate) && (i < noutput_items)) { // Take the current filter and derivative filter output -- cgit From 272971a25cbd777634331a8777d2fbab2bb10ab7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 22 Dec 2010 16:49:05 -0800 Subject: Check for lt_dladvise_global and fall back to using lt_dlopenext if not found. --- gnuradio-core/src/guile/dynl-global.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/dynl-global.c b/gnuradio-core/src/guile/dynl-global.c index 1fc3a97a5..3bf2741b1 100644 --- a/gnuradio-core/src/guile/dynl-global.c +++ b/gnuradio-core/src/guile/dynl-global.c @@ -18,6 +18,21 @@ * along with this program. If not, see . */ +/* + * This file is an attempt to work around a problem that appears on + * certain Ubuntu (and perhaps other) systems. On those systems + * (10.04 is known to have the problem, while 10.10 and later work OK + * without this kludge), we end up with a situation where exceptions + * are not caught by the swig code, even though the swig generated + * code "looks right" and "is right". Details of the issue can be + * found in swig bug 1863647, + * http://sourceforge.net/tracker/index.php?func=detail&aid=1863647&group_id=1645&atid=101645 + * + * We work around the problem by loading swig generated guile modules + * using the equivalent of the dlopen's RTLD_GLOBAL flag. This is + * only possible on systems using libtool-2.*. Those systems contain + * the lt_dlavise_global function. + */ #ifdef HAVE_CONFIG_H #include #endif @@ -27,6 +42,10 @@ extern scm_t_bits scm_tc16_dynamic_obj; +#ifdef HAVE_LT_DLADVISE_GLOBAL +/* + * Load shared module using the equivalent of the RTLD_GLOBAL flag + */ static lt_dlhandle dlopenext_global (const char *filename) { @@ -42,6 +61,18 @@ dlopenext_global (const char *filename) return handle; } +#else + +/* + * We don't have lt_dladvise_global. Fall back to lt_dlopenext. + */ +static lt_dlhandle +dlopenext_global (const char *filename) +{ + return lt_dlopenext (filename); +} +#endif + static void * sysdep_dynl_link_global (const char *fname, const char *subr) -- cgit From 9fe81031520463dfe46a890fc9d039d44929a43a Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 23 Dec 2010 11:00:58 -0800 Subject: Add test to see if Guile was built with threads enabled --- gnuradio-core/src/guile/tests/00_runtime_basics.test | 1 + 1 file changed, 1 insertion(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/tests/00_runtime_basics.test b/gnuradio-core/src/guile/tests/00_runtime_basics.test index 18b298f22..4a5d967a1 100644 --- a/gnuradio-core/src/guile/tests/00_runtime_basics.test +++ b/gnuradio-core/src/guile/tests/00_runtime_basics.test @@ -32,6 +32,7 @@ (define (vector-map f v) (list->vector (map f (vector->list v)))) +(pass-if "Guile was built with threads" (not (not (memq 'threads *features*)))) (with-test-prefix "connect-1" (let* ((src-data #(-5 -4 -3 -2 -1 0 1 2 3 4 5)) -- cgit From 16416305bf6dc7879b81c6b86568a5597d8d5ab0 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 30 Dec 2010 13:50:11 -0800 Subject: Create and install gr-run-waveform-script, and symlink to it when installed. --- gnuradio-core/src/guile/Makefile.am | 12 ++++- .../src/guile/gnuradio/scripts/.gitignore | 1 - .../src/guile/gnuradio/scripts/gr-run-waveform.in | 40 ----------------- gnuradio-core/src/guile/gr-run-waveform-script.in | 51 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 43 deletions(-) delete mode 100644 gnuradio-core/src/guile/gnuradio/scripts/.gitignore delete mode 100755 gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in create mode 100644 gnuradio-core/src/guile/gr-run-waveform-script.in (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index b78225f4d..a74037ae7 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -31,6 +31,10 @@ EXTRA_DIST += \ SUBDIRS = example-waveforms + +bin_SCRIPTS = \ + gr-run-waveform-script + # These are the hand-coded guile files for gnuradio-core. # # Swig/common.scm is glue that's required for the goops wrappers. @@ -42,10 +46,9 @@ nobase_guile_DATA = \ Swig/common.scm \ gnuradio/core.scm \ gnuradio/export-safely.scm \ + gnuradio/run-waveform.scm \ gnuradio/runtime-shim.scm \ gnuradio/waveform.scm \ - gnuradio/run-waveform.scm \ - gnuradio/scripts/gr-run-waveform \ gnuradio/test-suite/guile-test \ gnuradio/test-suite/lib.scm @@ -70,4 +73,9 @@ libguile_gnuradio_dynl_global_la_SOURCES = dynl-global.c libguile_gnuradio_dynl_global_la_CPPFLAGS = $(GUILE_CFLAGS) libguile_gnuradio_dynl_global_la_LIBADD = $(GUILE_LIBS) +# Create a symlink from gr-run-waveform-script to gr-run-waveform +install-exec-hook: + -$(RM) $(bindir)/gr-run-waveform + (cd $(bindir) && $(LN_S) gr-run-waveform-script gr-run-waveform) + endif diff --git a/gnuradio-core/src/guile/gnuradio/scripts/.gitignore b/gnuradio-core/src/guile/gnuradio/scripts/.gitignore deleted file mode 100644 index 64cbdbc0e..000000000 --- a/gnuradio-core/src/guile/gnuradio/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -gr-run-waveform diff --git a/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in b/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in deleted file mode 100755 index 8186d2e09..000000000 --- a/gnuradio-core/src/guile/gnuradio/scripts/gr-run-waveform.in +++ /dev/null @@ -1,40 +0,0 @@ -#!@GUILE@ \ --e main -s -!# -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; Load and run a waveform defined with define-waveform -;;; -;;; usage: gr-run-waveform filename.wfd [args...] - -(load-from-path "gnuradio/run-waveform") - -(define (main args) - (if (not (>= (length args) 2)) - (let ((port (current-error-port))) - (display "usage: " port) - (display (car args) port) - (display " filename.wfd [args...]\n" port) - (exit 1))) - (apply run-waveform (cdr args))) - -;;; Local Variables: -;;; mode: scheme -;;; End: diff --git a/gnuradio-core/src/guile/gr-run-waveform-script.in b/gnuradio-core/src/guile/gr-run-waveform-script.in new file mode 100644 index 000000000..651b387e9 --- /dev/null +++ b/gnuradio-core/src/guile/gr-run-waveform-script.in @@ -0,0 +1,51 @@ +#!/bin/sh + +# usage: prepend +prepend() { + if [ $# -ne 2 ] + then + echo "$0: prepend needs 2 args" 1>&2 + exit 1 + fi + local path="$1" dir="$2" contents="" + eval "contents=\$$path" + if [ "$dir" != "" ] + then + if [ "$contents" = "" ] + then + eval "$path=\"$dir\"" + else + eval "$path=\"$dir:$contents\"" + fi + fi + #echo end-of-prepend: $path=${!path} +} + +prefix="@prefix@" +exec_prefix="@exec_prefix@" + +prepend GUILE_LOAD_PATH "${prefix}/share/guile/site" +prepend LTDL_LIBRARY_PATH "@libdir@" +prepend DYLD_LIBRARY_PATH "@libdir@" + +export GUILE_LOAD_PATH LTDL_LIBRARY_PATH DYLD_LIBRARY_PATH + +export GUILE_WARN_DEPRECATED="no" + +exec @GUILE@ -e main -s $0 "$@" +!# + +;;; Load and run a waveform defined with define-waveform +;;; +;;; usage: gr-run-waveform filename.wfd [args...] + +(load-from-path "gnuradio/run-waveform") + +(define (main args) + (if (not (>= (length args) 2)) + (let ((port (current-error-port))) + (display "usage: " port) + (display (car args) port) + (display " filename.wfd [args...]\n" port) + (exit 1))) + (apply run-waveform (cdr args))) -- cgit From 9739742f0b90968a8aaf0f5c2e24f9bbadda5e80 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 30 Dec 2010 14:10:00 -0800 Subject: Move example waveforms to gnuradio-examples/waveforms. --- .../src/guile/example-waveforms/.gitignore | 6 ---- .../src/guile/example-waveforms/Makefile.am | 28 --------------- .../src/guile/example-waveforms/dial-tone.wfd | 40 ---------------------- 3 files changed, 74 deletions(-) delete mode 100644 gnuradio-core/src/guile/example-waveforms/.gitignore delete mode 100644 gnuradio-core/src/guile/example-waveforms/Makefile.am delete mode 100644 gnuradio-core/src/guile/example-waveforms/dial-tone.wfd (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/example-waveforms/.gitignore b/gnuradio-core/src/guile/example-waveforms/.gitignore deleted file mode 100644 index 16c984055..000000000 --- a/gnuradio-core/src/guile/example-waveforms/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/Makefile -/Makefile.in -/.deps -/.libs -/*.la -/*.lo diff --git a/gnuradio-core/src/guile/example-waveforms/Makefile.am b/gnuradio-core/src/guile/example-waveforms/Makefile.am deleted file mode 100644 index 277b4ad0b..000000000 --- a/gnuradio-core/src/guile/example-waveforms/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2010 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 this program. If not, see . -# - -include $(top_srcdir)/Makefile.common - -waveformdir=$(datarootdir)/gnuradio/example-waveforms - -waveform_DATA = \ - dial-tone.wfd - -EXTRA_DIST += \ - dial-tone.wfd diff --git a/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd b/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd deleted file mode 100644 index ced3df572..000000000 --- a/gnuradio-core/src/guile/example-waveforms/dial-tone.wfd +++ /dev/null @@ -1,40 +0,0 @@ -;;; Emacs, format this using -*-scheme-*- mode. -;;; -;;; Copyright 2010 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 this program. If not, see . -;;; - -;;; This example waveform outputs a signal to an audio_alsa_sink -;;; that sounds like North American dial tone. - -(use-modules (gnuradio audio_alsa)) - - -(define-waveform (dial-tone cmd-line-args) - (vars - (sample-rate 48000) - (ampl 0.1)) - - (blocks - (src0 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 350 ampl)) - (src1 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 440 ampl)) - (sink (gr:audio-alsa-sink sample-rate "plughw:0,0")) - ) - - (connections - (src0 (list sink 0)) ; src0 to left input - (src1 (list sink 1)))) ; src1 to right input -- cgit From 66768f6ec30edbc2cf481e16b92a387b483dde6c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 30 Dec 2010 15:23:59 -0800 Subject: Create symlink using install-exec-local, not install-exec-hook. Also rm the symlink using uninstall-local. Passes distcheck. --- gnuradio-core/src/guile/Makefile.am | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am index a74037ae7..122f05d97 100644 --- a/gnuradio-core/src/guile/Makefile.am +++ b/gnuradio-core/src/guile/Makefile.am @@ -28,10 +28,6 @@ EXTRA_DIST += \ $(nobase_guile_DATA) \ $(GUILE_TESTS) - -SUBDIRS = example-waveforms - - bin_SCRIPTS = \ gr-run-waveform-script @@ -74,8 +70,11 @@ libguile_gnuradio_dynl_global_la_CPPFLAGS = $(GUILE_CFLAGS) libguile_gnuradio_dynl_global_la_LIBADD = $(GUILE_LIBS) # Create a symlink from gr-run-waveform-script to gr-run-waveform -install-exec-hook: - -$(RM) $(bindir)/gr-run-waveform - (cd $(bindir) && $(LN_S) gr-run-waveform-script gr-run-waveform) +install-exec-local: + -$(RM) $(DESTDIR)$(bindir)/gr-run-waveform + (cd $(DESTDIR)$(bindir) && $(LN_S) gr-run-waveform-script gr-run-waveform) + +uninstall-local: + -$(RM) $(DESTDIR)$(bindir)/gr-run-waveform endif -- cgit From 9c07c99147955574354d9d2a36c18f7aa8988130 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 2 Jan 2011 11:29:38 -0500 Subject: Fixing a comment. --- gnuradio-core/src/lib/runtime/gr_block_executor.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc index 112150235..a8d0bc1c8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc +++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc @@ -93,8 +93,7 @@ propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d, std::vector &rtags) { // Move tags downstream - // if a sink, we don't need to move downstream; - // and do not bother if block uses TAGS_NONE attribute + // if a sink, we don't need to move downstream if(d->sink_p()) { return true; } -- cgit From c11a431055c1e84ed16a6567cc9b2f3b821ad5e7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 2 Jan 2011 11:31:56 -0500 Subject: Buffers now hold on to all tags from both this window and the last window of items instead of just this window. This protects against the rare times when one block is called twice before another block is, thereby pruning the tags before they can be passed downstream. The same thing will happen if a block is called 3 times in a row, which is highly unlikely. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 9 +++++---- gnuradio-core/src/lib/runtime/gr_buffer.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 0b2eb52a0..0bff0271a 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -80,7 +80,8 @@ minimum_buffer_items (long type_size, long page_size) gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) : d_base (0), d_bufsize (0), d_vmcircbuf (0), d_sizeof_item (sizeof_item), d_link(link), - d_write_index (0), d_abs_write_offset(0), d_done (false) + d_write_index (0), d_abs_write_offset(0), d_done (false), + d_last_min_items_read(0) { if (!allocate_buffer (nitems, sizeof_item)) throw std::bad_alloc (); @@ -162,7 +163,9 @@ gr_buffer::space_available () min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); } - prune_tags(min_items_read); + //prune_tags(min_items_read); + prune_tags(d_last_min_items_read); + d_last_min_items_read = min_items_read; // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader @@ -241,7 +244,6 @@ gr_buffer::prune_tags(uint64_t max_time) */ //gruel::scoped_lock guard(*mutex()); - int n = 0; uint64_t item_time; std::deque::iterator itr = d_item_tags.begin(); @@ -249,7 +251,6 @@ gr_buffer::prune_tags(uint64_t max_time) item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); if(item_time < max_time) { d_item_tags.pop_front(); - n++; } itr++; } diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index fe0e7585d..aa26f1e09 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -135,7 +135,7 @@ class gr_buffer { uint64_t d_abs_write_offset; // num items written since the start bool d_done; std::deque d_item_tags; - + uint64_t d_last_min_items_read; unsigned index_add (unsigned a, unsigned b) -- cgit From 9c0bfe8920ec66b5b9f1f287d63ee66b4d208862 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 2 Jan 2011 11:37:01 -0500 Subject: Not using an iterator to prune the tags to see if this fixes a problem in Windows. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 0bff0271a..da1d8b542 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -245,14 +245,11 @@ gr_buffer::prune_tags(uint64_t max_time) //gruel::scoped_lock guard(*mutex()); uint64_t item_time; - std::deque::iterator itr = d_item_tags.begin(); - - while(itr != d_item_tags.end()) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + for(size_t i = 0; i < d_item_tags.size(); i++) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(d_item_tags[i], 0)); if(item_time < max_time) { d_item_tags.pop_front(); } - itr++; } } -- cgit From 6925ccc667c8278c7b250fb4f7225e01680c62ea Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 2 Jan 2011 13:49:08 -0500 Subject: Going back to iterators for use in erasing items from the deque. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index da1d8b542..3c935b960 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -243,13 +243,23 @@ gr_buffer::prune_tags(uint64_t max_time) buffer's mutex al la the scoped_lock line below. */ //gruel::scoped_lock guard(*mutex()); + std::deque::iterator itr = d_item_tags.begin(); uint64_t item_time; - for(size_t i = 0; i < d_item_tags.size(); i++) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(d_item_tags[i], 0)); + + // Since tags are not guarenteed to be in any particular order, + // we need to erase here instead of pop_front. An erase in the + // middle invalidates all iterators; so this resets the iterator + // to find more. Mostly, we wil be erasing from the front and + // therefore lose little time this way. + while(itr != d_item_tags.end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); if(item_time < max_time) { - d_item_tags.pop_front(); + d_item_tags.erase(itr); + itr = d_item_tags.begin(); } + else + itr++; } } -- cgit From 99c2b220675f3ca73ef5cf0a9ebe03706f813d61 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 4 Jan 2011 11:10:27 -0500 Subject: Only prune if we've moved on in the number of items read. Fixes the problem or premature pruning. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 3c935b960..624ca78a8 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -163,9 +163,10 @@ gr_buffer::space_available () min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); } - //prune_tags(min_items_read); - prune_tags(d_last_min_items_read); - d_last_min_items_read = min_items_read; + if(min_items_read != d_last_min_items_read) { + prune_tags(d_last_min_items_read); + d_last_min_items_read = min_items_read; + } // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader -- cgit From 7c78b8501ac6e9f386c9d4c0315913f6d3c72617 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 4 Jan 2011 12:48:49 -0500 Subject: Fixing how far get_tags_in_range looks; should be exclusive of end point. --- gnuradio-core/src/lib/runtime/gr_buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 624ca78a8..03d5a8738 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -319,7 +319,7 @@ gr_buffer_reader::get_tags_in_range(std::vector &v, while(itr != d_buffer->get_tags_end()) { item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - if((item_time >= abs_start) && (item_time <= abs_end)) { + if((item_time >= abs_start) && (item_time < abs_end)) { v.push_back(*itr); } -- cgit From dad65db9c2046a113e704394beac01852ac2b35c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 5 Jan 2011 19:56:00 -0800 Subject: Have swig/guile wrap enums and constants as scheme variables, not functions. --- gnuradio-core/src/lib/swig/gnuradio.i | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 1601cca12..1856d5007 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -37,6 +37,11 @@ %feature("autodoc","1"); +#ifdef SWIGGUILE +// Export constants and enums as scheme variables, not functions. +%feature("constasvar"); +#endif + // local file %include -- cgit From b6005d9e5823d871c091f3b4a048ca67cd885821 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 6 Jan 2011 21:39:10 -0800 Subject: Change pmt message handling interface in gr_basic_block.h Change the API such that the message handler is now implemented with a callback, not an overridden virtual function. The callback is now set using gr_basic_block::set_msg_handler, which will accept pretty much any kind of callable. This change allows us to split the machinery for message handling out from the block inheritance hierarchy, and provides a foundation that can be used to build or experiment with arbitrary message dispatching techniques. --- gnuradio-core/src/lib/runtime/gr_basic_block.h | 54 ++++++++++++++++++---- .../src/lib/runtime/gr_tpb_thread_body.cc | 8 ++-- 2 files changed, 50 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index d059a4bd3..ce7a1aa1d 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2008,2009 Free Software Foundation, Inc. + * Copyright 2006,2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -42,9 +43,27 @@ class gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this { + typedef boost::function msg_handler_t; + +private: + /* + * This function is called by the runtime system to dispatch messages. + * + * The thread-safety guarantees mentioned in set_msg_handler are implemented + * by the callers of this method. + */ + void dispatch_msg(pmt::pmt_t msg) + { + if (d_msg_handler) // Is there a handler? + d_msg_handler(msg); // Yes, invoke it. + }; + + msg_handler_t d_msg_handler; + protected: friend class gr_flowgraph; friend class gr_flat_flowgraph; // TODO: will be redundant + friend class gr_tpb_thread_body; enum vcolor { WHITE, GREY, BLACK }; @@ -99,15 +118,34 @@ public: virtual bool check_topology(int ninputs, int noutputs) { return true; } /*! - * \brief Block message handler. - * - * \param msg Arbitrary message encapsulated as pmt::pmt_t + * \brief Set the callback that is fired when messages are available. * - * This function is called by the runtime system whenever there are - * messages in its queue. Blocks should override this to receive - * messages; the default behavior is to drop them on the floor. + * \p msg_handler can be any kind of function pointer or function object + * that has the signature: + *
+     *    void msg_handler(pmt::pmt msg);
+     * 
+ * + * (You may want to use boost::bind to massage your callable into the + * correct form. See gr_nop.{h,cc} for an example that sets up a class + * method as the callback.) + * + * Blocks that desire to handle messages must call this method in their + * constructors to register the handler that will be invoked when messages + * are available. + * + * If the block inherits from gr_block, the runtime system will ensure that + * msg_handler is called in a thread-safe manner, such that work and + * msg_handler will never be called concurrently. This allows msg_handler + * to update state variables without having to worry about thread-safety + * issues with work, general_work or another invocation of msg_handler. + * + * If the block inherits from gr_hier_block2, the runtime system will + * ensure that no reentrant calls are made to msg_handler. */ - virtual void handle_msg(pmt::pmt_t msg) { }; + template void set_msg_handler(T msg_handler){ + d_msg_handler = msg_handler_t(msg_handler); + } }; inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs) diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc index 03eef17d9..faa888697 100644 --- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc +++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008,2009 Free Software Foundation, Inc. + * Copyright 2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -43,7 +43,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block) // handle any queued up messages while ((msg = d->d_tpb.delete_head_nowait())) - block->handle_msg(msg); + block->dispatch_msg(msg); d->d_tpb.clear_changed(); s = d_exec.run_one_iteration(); @@ -73,7 +73,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block) // handle all pending messages while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){ guard.unlock(); // release lock while processing msg - block->handle_msg(msg); + block->dispatch_msg(msg); guard.lock(); } } @@ -93,7 +93,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block) // handle all pending messages while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){ guard.unlock(); // release lock while processing msg - block->handle_msg(msg); + block->dispatch_msg(msg); guard.lock(); } } -- cgit From 1dc1dbeef3eb15e1316857d4dd7ba32c4304bf69 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 6 Jan 2011 21:46:55 -0800 Subject: Augment gr_nop to count received pmt messages by way of set_msg_handler. --- gnuradio-core/src/lib/general/gr_nop.cc | 24 +++++++++++++++++------- gnuradio-core/src/lib/general/gr_nop.h | 9 +++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc index 950ef878e..bd5e4fd81 100644 --- a/gnuradio-core/src/lib/general/gr_nop.cc +++ b/gnuradio-core/src/lib/general/gr_nop.cc @@ -25,18 +25,30 @@ #endif #include #include +#include + +gr_nop_sptr +gr_make_nop (size_t sizeof_stream_item) +{ + return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item)); +} gr_nop::gr_nop (size_t sizeof_stream_item) : gr_block ("nop", - gr_make_io_signature (0, -1, sizeof_stream_item), - gr_make_io_signature (0, -1, sizeof_stream_item)) + gr_make_io_signature (0, -1, sizeof_stream_item), + gr_make_io_signature (0, -1, sizeof_stream_item)), + d_nmsgs_recvd(0) { + // Arrange to have count_received_msgs called when messages are received. + set_msg_handler(boost::bind(&gr_nop::count_received_msgs, this, _1)); } -gr_nop_sptr -gr_make_nop (size_t sizeof_stream_item) +// Trivial message handler that just counts them. +// (N.B., This feature is used in qa_set_msg_handler) +void +gr_nop::count_received_msgs(pmt::pmt_t msg) { - return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item)); + d_nmsgs_recvd++; } int @@ -51,5 +63,3 @@ gr_nop::general_work (int noutput_items, return noutput_items; } - - diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h index 4f18c9183..354c2f9fc 100644 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ b/gnuradio-core/src/lib/general/gr_nop.h @@ -41,11 +41,20 @@ class gr_nop : public gr_block friend gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); gr_nop (size_t sizeof_stream_item); +protected: + int d_nmsgs_recvd; + + // Method that just counts any received messages. + void count_received_msgs(pmt::pmt_t msg); + public: virtual int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + + int nmsgs_received() const { return d_nmsgs_recvd; } + }; #endif /* INCLUDED_GR_NOP_H */ -- cgit From bb438e7d12c5767123f8abed5810f284a5f18bf8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Thu, 6 Jan 2011 21:48:12 -0800 Subject: Add QA code for gr_basic_block::set_msg_handler. --- gnuradio-core/src/lib/runtime/Makefile.am | 2 + gnuradio-core/src/lib/runtime/qa_runtime.cc | 4 +- .../src/lib/runtime/qa_set_msg_handler.cc | 85 ++++++++++++++++++++++ gnuradio-core/src/lib/runtime/qa_set_msg_handler.h | 43 +++++++++++ 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc create mode 100644 gnuradio-core/src/lib/runtime/qa_set_msg_handler.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 0fdb58aff..3dd2b42f5 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -81,6 +81,7 @@ libruntime_qa_la_SOURCES = \ qa_gr_io_signature.cc \ qa_gr_vmcircbuf.cc \ qa_block_tags.cc \ + qa_set_msg_handler.cc \ qa_runtime.cc grinclude_HEADERS = \ @@ -140,6 +141,7 @@ noinst_HEADERS = \ qa_gr_top_block.h \ qa_gr_vmcircbuf.h \ qa_block_tags.h \ + qa_set_msg_handler.h \ qa_runtime.h swiginclude_HEADERS = \ diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc index 967d4bfa8..c0bee8ea0 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.cc +++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc @@ -1,5 +1,5 @@ /* - * Copyright 2002,2007 Free Software Foundation, Inc. + * Copyright 2002,2007,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,6 +39,7 @@ #include #include #include +#include CppUnit::TestSuite * qa_runtime::suite () @@ -54,6 +55,7 @@ qa_runtime::suite () s->addTest (qa_gr_hier_block2_derived::suite ()); s->addTest (qa_gr_buffer::suite ()); s->addTest (qa_block_tags::suite ()); + s->addTest (qa_set_msg_handler::suite ()); return s; } diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc new file mode 100644 index 000000000..d52ca78b9 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc @@ -0,0 +1,85 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define VERBOSE 0 + +using namespace pmt; + +/* + * The gr_nop block has been instrumented so that it counts + * the number of messages sent to it. We use this feature + * to confirm that gr_nop's call to set_msg_handler is working + * correctly. + */ + +void qa_set_msg_handler::t0() +{ + static const int NMSGS = 10; + + if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n"; + + gr_top_block_sptr tb = gr_make_top_block("top"); + + gr_block_sptr src = gr_make_null_source(sizeof(int)); + gr_nop_sptr nop = gr_make_nop(sizeof(int)); + gr_block_sptr dst = gr_make_null_sink(sizeof(int)); + + tb->connect(src, 0, nop, 0); + tb->connect(nop, 0, dst, 0); + + // Must start graph before sending messages + tb->start(); + + // Send them... + for (int i = 0; i < NMSGS; i++){ + send(nop, mp(mp("example-msg"), mp(i))); + } + + // And send a message to null_source to confirm that the default + // message handling action (which should be a nop) doesn't dump + // core. + send(src, mp(mp("example-msg"), mp(0))); + + // Surrender our CPU for a bit + boost::this_thread::yield(); + + tb->stop(); + tb->wait(); + + // Confirm that the nop block received the right number of messages. + CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received()); +} diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h new file mode 100644 index 000000000..e73fffbcd --- /dev/null +++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011 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. + */ + +#ifndef INCLUDED_QA_SET_MSG_HANDLER_H +#define INCLUDED_QA_SET_MSG_HANDLER_H + +#include +#include +#include + +class qa_set_msg_handler : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(qa_set_msg_handler); + + CPPUNIT_TEST(t0); + + CPPUNIT_TEST_SUITE_END(); + +private: + + void t0(); +}; + +#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */ -- cgit From 00de7b95681c9ec32d3758c6060c2e044849b7a0 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Tue, 4 Jan 2011 18:03:07 -0500 Subject: dotprod_ccf : Add NEON support for ccf fir filter. --- gnuradio-core/src/lib/filter/Makefile.am | 8 +- gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c | 90 +++++++++++++++++++++ gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h | 47 +++++++++++ gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc | 91 ++++++++++++++++++++++ gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h | 45 +++++++++++ .../src/lib/filter/gr_fir_sysconfig_armv7_a.cc | 25 +++--- 6 files changed, 290 insertions(+), 16 deletions(-) create mode 100644 gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c create mode 100644 gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h create mode 100644 gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc create mode 100644 gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index bf97d6cdc..ebc7ad203 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -159,7 +159,9 @@ armv7_a_CODE = \ gr_fir_sysconfig_armv7_a.cc \ gr_cpu_armv7_a.cc \ gr_fir_fff_armv7_a.cc \ - dotprod_fff_armv7_a.c + dotprod_fff_armv7_a.c \ + gr_fir_ccf_armv7_a.cc \ + dotprod_ccf_armv7_a.c armv7_a_qa_CODE = \ qa_dotprod_armv7_a.cc @@ -312,6 +314,7 @@ noinst_HEADERS = \ assembly.h \ dotprod_fff_altivec.h \ dotprod_fff_armv7_a.h \ + dotprod_ccf_armv7_a.h \ gr_fir_scc_simd.h \ gr_fir_scc_x86.h \ gr_fir_fcc_simd.h \ @@ -322,6 +325,7 @@ noinst_HEADERS = \ gr_fir_ccc_x86.h \ gr_fir_fff_altivec.h \ gr_fir_fff_armv7_a.h \ + gr_fir_ccf_armv7_a.h \ gr_fir_fff_simd.h \ gr_fir_fff_x86.h \ gr_fir_fsf_simd.h \ diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c new file mode 100644 index 000000000..90bd2ee10 --- /dev/null +++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c @@ -0,0 +1,90 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +/*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p x rounded down to a multiple of \p pow2. + */ +static inline size_t +gr_p2_round_down(size_t x, size_t pow2) +{ + return x & -pow2; +} + + +#if 0 + +void +dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) +{ + size_t i; + res[0] = 0; + res[1] = 0; + + for (i = 0; i < n; i++){ + res[0] += a[2*i] * b[i]; + res[1] += a[2*i+1] * b[i]; + } +} + +#else + +/* + * preconditions: + * + * n > 0 and a multiple of 4 + * a 4-byte aligned + * b 16-byte aligned + */ +void +dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) +{ + + asm volatile( + "vmov.f32 q14, #0.0 \n\t" + "vmov.f32 q15, #0.0 \n\t" + "1: \n\t" + "subs %2, %2, #4 \n\t" + "vld2.f32 {q0-q1}, [%0]! \n\t" + "vld1.f32 {q2}, [%1]! \n\t" + "vmla.f32 q14, q0, q2 \n\t" + "vmla.f32 q15, q1, q2 \n\t" + "bgt 1b \n\t" + "vpadd.f32 d0, d28, d29 \n\t" + "vpadd.f32 d1, d30, d31 \n\t" + "vpadd.f32 d0, d0, d1 \n\t" + "vst1.f32 {d0}, [%3] \n\t" + + : "+&r"(a), "+&r"(b), "+&r"(n) + : "r"(res) + : "memory", "d0", "d1", "d2", "d3", "d4", "d5", + "d28", "d29", "d30", "d31" ); +} + + +#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h new file mode 100644 index 000000000..7ee728ac4 --- /dev/null +++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h @@ -0,0 +1,47 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_DOTPROD_CCF_ARMV7_A_H +#define INCLUDED_DOTPROD_CCF_ARMV7_A_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + *
+ *
+ *  preconditions:
+ *
+ *    n > 0 and a multiple of 4
+ *    a   4-byte aligned
+ *    b  16-byte aligned
+ *
+ * 
+ */ +void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc new file mode 100644 index 000000000..ac42b57b7 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#define FLOATS_PER_VEC 4 + +gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a() + : gr_fir_ccf_generic(), + d_naligned_taps(0), d_aligned_taps(0) +{ +} + +gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector &new_taps) + : gr_fir_ccf_generic(new_taps), + d_naligned_taps(0), d_aligned_taps(0) +{ + set_taps(new_taps); +} + +gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a() +{ + if (d_aligned_taps){ + free(d_aligned_taps); + d_aligned_taps = 0; + } +} + +void +gr_fir_ccf_armv7_a::set_taps(const std::vector &inew_taps) +{ + gr_fir_ccf_generic::set_taps(inew_taps); // call superclass + d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); + + if (d_aligned_taps){ + free(d_aligned_taps); + d_aligned_taps = 0; + } + void *p; + int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); + if (r != 0){ + throw std::bad_alloc(); + } + d_aligned_taps = (float *) p; + memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); + for (size_t i = ntaps(); i < d_naligned_taps; i++) + d_aligned_taps[i] = 0.0; +} + + +gr_complex +gr_fir_ccf_armv7_a::filter (const gr_complex input[]) +{ + if (d_naligned_taps == 0) + return 0.0; + + gr_complex result; + float *presult = reinterpret_cast(&result); + const float *pinput = reinterpret_cast(input); + + dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps); + return result; +} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h new file mode 100644 index 000000000..719ff4010 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_GR_FIR_CCF_ARMV7_A_H +#define INCLUDED_GR_FIR_CCF_ARMV7_A_H + +#include + +/*! + * \brief armv7_a using NEON coprocessor version of gr_fir_ccf + */ +class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic +{ +protected: + + size_t d_naligned_taps; // number of taps (multiple of 4) + float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 + +public: + gr_fir_ccf_armv7_a(); + gr_fir_ccf_armv7_a(const std::vector &taps); + ~gr_fir_ccf_armv7_a(); + + virtual void set_taps (const std::vector &taps); + virtual gr_complex filter (const gr_complex input[]); +}; + +#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc index 34c7d4c01..71e622d37 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. + * Copyright 2002,2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -51,13 +52,13 @@ using std::cerr; * ---------------------------------------------------------------- */ -#if 0 static gr_fir_ccf * -make_gr_fir_ccf_altivec(const std::vector &taps) +make_gr_fir_ccf_armv7_a (const std::vector &taps) { - return new gr_fir_ccf_altivec(taps); + return new gr_fir_ccf_armv7_a(taps); } +#if 0 static gr_fir_fcc * make_gr_fir_fcc_altivec(const std::vector &taps) { @@ -107,15 +108,13 @@ gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector &taps) { static bool first = true; -#if 0 - if (gr_cpu::has_altivec ()){ + if (gr_cpu::has_armv7_a ()){ if (first){ - cerr << ">>> gr_fir_ccf: using altivec\n"; + cerr << ">>> gr_fir_ccf: using armv7_a\n"; first = false; } - return make_gr_fir_ccf_altivec (taps); + return make_gr_fir_ccf_armv7_a (taps); } -#endif if (0 && first){ cerr << ">>> gr_fir_ccf: handing off to parent class\n"; @@ -245,15 +244,13 @@ gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector *inf // invoke parent.. gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); -#if 0 // add our stuff... gr_fir_ccf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccf_altivec; + if (gr_cpu::has_armv7_a ()){ + t.name = "armv7_a"; + t.create = make_gr_fir_ccf_armv7_a; (*info).push_back (t); } -#endif } void -- cgit From 76be4e363152aa330955b546824aaa5beb2f5c80 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Mon, 10 Jan 2011 19:04:30 -0500 Subject: dotprod_fff : Fix clobber register entries. --- gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c index bd1b88e22..c3275c331 100644 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c +++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c @@ -77,7 +77,8 @@ dotprod_fff_armv7_a(const float *a, const float *b, size_t n) "vpadd.f32 d0, d16, d17 \n\t" "vadd.f32 %0, s0, s1 \n\t" : "=w"(s), "+r"(a), "+r"(b), "+r"(n) - :: "q0", "q1", "q2", "q3", "q8", "q9"); + :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", + "d16", "d17", "d18", "d19"); return s; -- cgit From a2262b6bb70923d89e96ca0d597d96a8a01e4b67 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 10 Jan 2011 23:05:18 -0800 Subject: qa_set_msg_handler: Use sleep instead of yield. Confirmed to fix problem on 32-bit CoreDuo. Probably fixes problem on Arm too. --- gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc index d52ca78b9..35ef5527e 100644 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc @@ -74,8 +74,8 @@ void qa_set_msg_handler::t0() // core. send(src, mp(mp("example-msg"), mp(0))); - // Surrender our CPU for a bit - boost::this_thread::yield(); + // Give the messages a chance to be processed + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); tb->stop(); tb->wait(); -- cgit From 48f9ca90e0cbcbfe67b0e10889c60928d9be5c49 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 17 Jan 2011 16:37:45 -0800 Subject: gr math simplification: Replaces gr_gcd, gr_isnan, and gr_signbit one-time instances with boot math calls. No point in wrapping these utility math functions into gnuradio when they are 1) provided by boost 2) only called once Removes gr_math.cc, and configure checks for isnan. --- gnuradio-core/src/lib/general/Makefile.am | 1 - gnuradio-core/src/lib/general/gr_math.cc | 102 ----------------------------- gnuradio-core/src/lib/general/gr_math.h | 13 ---- gnuradio-core/src/lib/runtime/gr_buffer.cc | 3 +- 4 files changed, 2 insertions(+), 117 deletions(-) delete mode 100644 gnuradio-core/src/lib/general/gr_math.cc (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 08610c58a..3ceea7a6d 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -100,7 +100,6 @@ libgeneral_la_SOURCES = \ gr_lms_dfe_cc.cc \ gr_lms_dfe_ff.cc \ gr_map_bb.cc \ - gr_math.cc \ gr_misc.cc \ gr_mpsk_receiver_cc.cc \ gr_nlog10_ff.cc \ diff --git a/gnuradio-core/src/lib/general/gr_math.cc b/gnuradio-core/src/lib/general/gr_math.cc deleted file mode 100644 index 82dff469c..000000000 --- a/gnuradio-core/src/lib/general/gr_math.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -/* - * Greatest Common Divisor, using Euclid's algorithm. - * [There are faster algorithms. See Knuth 4.5.2 if you care] - */ - -long -gr_gcd (long m, long n) -{ - if (m < 0) - m = -m; - - if (n < 0) - n = -n; - - while (n != 0){ - long t = m % n; - m = n; - n = t; - } - - return m; -} - - -/* - * These really need some configure hacking to figure out the right answer. - * As a stop gap, try for a macro, and if not that, then try std:: - */ - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise - -#if defined(isnan) || !defined(CXX_HAS_STD_ISNAN) - -int -gr_isnan (double value) -{ - return isnan (value); -} - -#else - -int -gr_isnan (double value) -{ - return std::isnan (value); -} - -#endif - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -#ifdef signbit - -int -gr_signbit (double x) -{ - return signbit (x); -} - -#else - -int -gr_signbit (double x) -{ - return std::signbit (x); -} - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h index ea0f20027..f5935c1da 100644 --- a/gnuradio-core/src/lib/general/gr_math.h +++ b/gnuradio-core/src/lib/general/gr_math.h @@ -35,19 +35,6 @@ gr_is_power_of_2(long x) return x != 0 && (x & (x-1)) == 0; } -long gr_gcd (long m, long n); - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise -int gr_isnan (double value); - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -int gr_signbit (double x); - /*! * \brief Fast arc tangent using table lookup and linear interpolation * \ingroup misc diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 03d5a8738..fa3722714 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -31,6 +31,7 @@ #include #include #include +#include static long s_buffer_count = 0; // counts for debugging storage mgmt static long s_buffer_reader_count = 0; @@ -73,7 +74,7 @@ static long s_buffer_reader_count = 0; static long minimum_buffer_items (long type_size, long page_size) { - return page_size / gr_gcd (type_size, page_size); + return page_size / boost::math::gcd (type_size, page_size); } -- cgit From e4d3b484edb2e852932d9da3d328273d4d35f475 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 17 Jan 2011 16:45:33 -0800 Subject: math explicit type overloads: Use explicit data type casts in math functions where the overloaded function could not be determined. affects msvc --- gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc | 2 +- gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc | 2 +- gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc | 2 +- gnuradio-core/src/lib/general/gr_firdes.cc | 2 +- gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc | 2 +- gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc | 2 +- gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc | 4 ++-- gnuradio-core/src/tests/benchmark_vco.cc | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc index 1bf4a6f4b..891905dd0 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc @@ -99,7 +99,7 @@ gri_fft_filter_ccc_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); + d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); d_nsamples = d_fftsize - d_ntaps + 1; if (0) diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc index 74058fa93..b3fbe1d1a 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc @@ -86,7 +86,7 @@ gri_fft_filter_fff_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); + d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); d_nsamples = d_fftsize - d_ntaps + 1; if (0) diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc index d5425bfc8..c5e1320a3 100644 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc +++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc @@ -39,7 +39,7 @@ gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb() { float RATE = 0.5; float ebn0 = 12.0; - float esn0 = RATE*pow(10.0, ebn0/10); + float esn0 = RATE*pow(10.0, ebn0/10.0); gen_met(d_mettab, 100, esn0, 0.0, 256); viterbi_chunks_init(d_state0); diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc index 8efeb3438..5d192d67e 100644 --- a/gnuradio-core/src/lib/general/gr_firdes.cc +++ b/gnuradio-core/src/lib/general/gr_firdes.cc @@ -574,7 +574,7 @@ gr_firdes::gaussian (double gain, vector taps(ntaps); double scale = 0; double dt = 1.0/spb; - double s = 1.0/(sqrt(log(2)) / (2*M_PI*bt)); + double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt)); double t0 = -0.5 * ntaps; double ts; for(int i=0;i &sym_positio d_sym_position = sym_position; d_sym_value_out = sym_value_out; - d_nbits = (unsigned long)ceil(log10(d_sym_value_out.size()) / log10(2.0)); + d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0)); return true; } diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc index 370b029cd..cc4aba0cb 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc +++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc @@ -113,7 +113,7 @@ gr_ofdm_mapper_bcv::gr_ofdm_mapper_bcv (const std::vector &constella throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); } - d_nbits = (unsigned long)ceil(log10(d_constellation.size()) / log10(2.0)); + d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0)); } gr_ofdm_mapper_bcv::~gr_ofdm_mapper_bcv(void) diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc index 9885b3852..113006a22 100644 --- a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc +++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc @@ -53,7 +53,7 @@ qa_gr_fxpt_vco::t0 () float input[SIN_COS_BLOCK_SIZE]; for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(i); + input[i] = sin(double(i)); } for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ @@ -85,7 +85,7 @@ qa_gr_fxpt_vco::t1 () double max_error = 0; for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(i); + input[i] = sin(double(i)); } ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); diff --git a/gnuradio-core/src/tests/benchmark_vco.cc b/gnuradio-core/src/tests/benchmark_vco.cc index ed0ae3b67..3a6ade78c 100644 --- a/gnuradio-core/src/tests/benchmark_vco.cc +++ b/gnuradio-core/src/tests/benchmark_vco.cc @@ -63,7 +63,7 @@ benchmark (void test (float *x, const float *y), const char *implementation_name // touch memory memset(output, 0, BLOCK_SIZE*sizeof(float)); for (int i = 0; i #endif #include -#include "gr_fir_ccc_simd.h" #include "ccomplex_dotprod_generic.h" #include diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc index 89eb6db87..8cbc4aa70 100644 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc +++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc @@ -24,7 +24,6 @@ #include #endif #include -#include "gr_fir_scc_simd.h" #include "complex_dotprod_generic.h" -- cgit From 089fe0e8b2cd02e90fc4c095297128c771fa43fa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 17 Jan 2011 17:26:09 -0800 Subject: gr fxpt static const fix: Initialize PI and TWO_TO_THE_31 the standard portable c++ way. No need for "gcc 4.x fix". See http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12 --- gnuradio-core/src/lib/general/gr_fxpt.cc | 5 ++--- gnuradio-core/src/lib/general/gr_fxpt.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_fxpt.cc b/gnuradio-core/src/lib/general/gr_fxpt.cc index e752364a5..fae02c71e 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.cc +++ b/gnuradio-core/src/lib/general/gr_fxpt.cc @@ -30,9 +30,8 @@ const float gr_fxpt::s_sine_table[1 << NBITS][2] = { #include "sine_table.h" }; -// gcc 4.x fix -const float gr_fxpt::TWO_TO_THE_31; -const float gr_fxpt::PI; +const float gr_fxpt::PI = 3.14159265358979323846; +const float gr_fxpt::TWO_TO_THE_31 = 2147483648.0; #if 0 /* diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h index 520729f8d..c98d31b27 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.h +++ b/gnuradio-core/src/lib/general/gr_fxpt.h @@ -40,8 +40,8 @@ class gr_fxpt static const int WORDBITS = 32; static const int NBITS = 10; static const float s_sine_table[1 << NBITS][2]; - static const float PI = 3.14159265358979323846; - static const float TWO_TO_THE_31 = 2147483648.0; + static const float PI; + static const float TWO_TO_THE_31; public: static gr_int32 -- cgit From 05cc02cec03507c47846a668c92e6dcc4ba2e71e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 18 Jan 2011 01:00:15 -0800 Subject: cleanup mkdir usage with boost filesystem: Replaced copy/pasted code and MKDIR_TAKES_ONE_ARG #ifdefs with portable boost filesystem path and directory creation. Gets the correct home directory on windows systems: APPDATA. Replaces large amounts of copypasta with single lines of code. Removes MKDIR_TAKES_ONE_ARG configuration checks from m4 files. Adds boost filesystem and system library as build dependencies. --- gnuradio-core/src/lib/general/gri_fft.cc | 33 +++++++++++---------- gnuradio-core/src/lib/missing/Makefile.am | 2 +- gnuradio-core/src/lib/runtime/gr_preferences.cc | 39 ++++++++++++------------- gnuradio-core/src/lib/runtime/gr_unittests.h | 38 ++++-------------------- gnuradio-core/src/tests/test_all.cc | 5 +--- gnuradio-core/src/tests/test_atsc.cc | 5 +--- gnuradio-core/src/tests/test_filter.cc | 5 +--- gnuradio-core/src/tests/test_general.cc | 5 +--- gnuradio-core/src/tests/test_runtime.cc | 5 +--- 9 files changed, 47 insertions(+), 90 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index e535f28c7..37be06f09 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -29,6 +29,17 @@ #include #include +#include +#include +namespace fs = boost::filesystem; + +static std::string get_home_dir(void){ + #if defined(BOOST_WINDOWS) + return getenv ("APPDATA"); + #else + return getenv ("HOME"); + #endif +} boost::mutex & gri_fft_planner::mutex() @@ -38,26 +49,18 @@ gri_fft_planner::mutex() return s_planning_mutex; } -static char * +static const char * wisdom_filename () { - static const char *filename = ".gr_fftw_wisdom"; - - char *home = getenv ("HOME"); - if (home){ - char *p = new char[strlen (home) + strlen (filename) + 2]; - strcpy (p, home); - strcat (p, "/"); - strcat (p, filename); - return p; - } - return 0; + static fs::path path; + path = fs::path(get_home_dir()) / ".gr_fftw_wisdom"; + return path.string().c_str(); } static void gri_fftw_import_wisdom () { - char *filename = wisdom_filename (); + const char *filename = wisdom_filename (); FILE *fp = fopen (filename, "r"); if (fp != 0){ int r = fftwf_import_wisdom_from_file (fp); @@ -66,13 +69,12 @@ gri_fftw_import_wisdom () fprintf (stderr, "gri_fftw: can't import wisdom from %s\n", filename); } } - delete [] filename; } static void gri_fftw_export_wisdom () { - char *filename = wisdom_filename (); + const char *filename = wisdom_filename (); FILE *fp = fopen (filename, "w"); if (fp != 0){ fftwf_export_wisdom_to_file (fp); @@ -82,7 +84,6 @@ gri_fftw_export_wisdom () fprintf (stderr, "gri_fftw: "); perror (filename); } - delete [] filename; } // ---------------------------------------------------------------- diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am index bd18cf143..7c97834e0 100644 --- a/gnuradio-core/src/lib/missing/Makefile.am +++ b/gnuradio-core/src/lib/missing/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES) +AM_CPPFLAGS = $(GRUEL_INCLUDES) $(GNURADIO_INCLUDES) $(WITH_INCLUDES) EXTRA_DIST += \ getopt.h \ diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc index 5f7412248..21934677b 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.cc +++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc @@ -33,12 +33,17 @@ #include #include - -#ifdef MKDIR_TAKES_ONE_ARG -#define gr_mkdir(pathname, mode) mkdir(pathname) -#else -#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) -#endif +#include +#include +namespace fs = boost::filesystem; + +static std::string get_home_dir(void){ + #if defined(BOOST_WINDOWS) + return getenv ("APPDATA"); + #else + return getenv ("HOME"); + #endif +} /* * The simplest thing that could possibly work: @@ -48,27 +53,19 @@ static const char * pathname (const char *key) { - static char buf[200]; - snprintf (buf, sizeof (buf), "%s/.gnuradio/prefs/%s", getenv ("HOME"), key); - return buf; + static fs::path path; + path = fs::path(get_home_dir()) / ".gnuradio" / "prefs" / key; + return path.string().c_str(); } static void ensure_dir_path () { - char path[200]; - struct stat statbuf; - - snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME")); - if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) - return; - - // blindly try to make it // FIXME make this robust. C++ SUCKS! + fs::path path = fs::path(get_home_dir()) / ".gnuradio"; + if (!fs::is_directory(path)) fs::create_directory(path); - snprintf (path, sizeof (path), "%s/.gnuradio", getenv ("HOME")); - gr_mkdir (path, 0750); - snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME")); - gr_mkdir (path, 0750); + path = path / "prefs"; + if (!fs::is_directory(path)) fs::create_directory(path); } const char * diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h index 70aa6f294..6e62bc7c1 100644 --- a/gnuradio-core/src/lib/runtime/gr_unittests.h +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -31,37 +31,11 @@ #include #include +#include +#include -#ifdef MKDIR_TAKES_ONE_ARG -#define gr_mkdir(pathname, mode) mkdir(pathname) -#else -#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) -#endif - -/* - * Mostly taken from gr_preferences.cc/h - * The simplest thing that could possibly work: - * the key is the filename; the value is the file contents. - */ - -static void -ensure_unittest_path (const char *path) -{ - struct stat statbuf; - if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) - return; - - // blindly try to make it // FIXME make this robust. C++ SUCKS! - gr_mkdir (path, 0750); +static std::string get_unittest_path(const std::string &filename){ + boost::filesystem::path path = boost::filesystem::current_path() / ".unittests"; + if (!boost::filesystem::is_directory(path)) boost::filesystem::create_directory(path); + return (path / filename).string(); } - -static void -get_unittest_path (const char *filename, char *fullpath, size_t pathsize) -{ - char path[200]; - snprintf (path, sizeof(path), "./.unittests"); - snprintf (fullpath, pathsize, "%s/%s", path, filename); - - ensure_unittest_path(path); -} - diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 17ee32f34..41bb59dcd 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -34,11 +34,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_all.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc index 51642f81a..37386d88e 100644 --- a/gnuradio-core/src/tests/test_atsc.cc +++ b/gnuradio-core/src/tests/test_atsc.cc @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_atsc.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_atsc.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_atsc::suite ()); diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc index 2781cfb35..3f7d70beb 100644 --- a/gnuradio-core/src/tests/test_filter.cc +++ b/gnuradio-core/src/tests/test_filter.cc @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_filter.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_filter::suite ()); diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc index 16ee9c3ad..98cece680 100644 --- a/gnuradio-core/src/tests/test_general.cc +++ b/gnuradio-core/src/tests/test_general.cc @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_general.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_general.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_general::suite ()); diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc index c7983a23e..608998df6 100644 --- a/gnuradio-core/src/tests/test_runtime.cc +++ b/gnuradio-core/src/tests/test_runtime.cc @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_runtime.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); -- cgit From ebb0f56da62e9ff16928b32cc525f24c93a99e0b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 22 Jan 2011 14:54:20 -0500 Subject: Updating copyright. --- gnuradio-core/src/lib/general/gri_fft.cc | 2 +- gnuradio-core/src/lib/missing/Makefile.am | 2 +- gnuradio-core/src/lib/runtime/gr_preferences.cc | 2 +- gnuradio-core/src/lib/runtime/gr_unittests.h | 2 +- gnuradio-core/src/tests/test_all.cc | 2 +- gnuradio-core/src/tests/test_atsc.cc | 2 +- gnuradio-core/src/tests/test_filter.cc | 2 +- gnuradio-core/src/tests/test_general.cc | 2 +- gnuradio-core/src/tests/test_runtime.cc | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index 37be06f09..eebe3b9c5 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2008 Free Software Foundation, Inc. + * Copyright 2003,2008,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am index 7c97834e0..1cc6014a1 100644 --- a/gnuradio-core/src/lib/missing/Makefile.am +++ b/gnuradio-core/src/lib/missing/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. +# Copyright 2003,2004,2008,2009,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc index 21934677b..e9216e4ac 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.cc +++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2010 Free Software Foundation, Inc. + * Copyright 2003,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h index 6e62bc7c1..59149bb2e 100644 --- a/gnuradio-core/src/lib/runtime/gr_unittests.h +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 41bb59dcd..6cec8ad0e 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc index 37386d88e..66cb2a312 100644 --- a/gnuradio-core/src/tests/test_atsc.cc +++ b/gnuradio-core/src/tests/test_atsc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc index 3f7d70beb..3227a9ff2 100644 --- a/gnuradio-core/src/tests/test_filter.cc +++ b/gnuradio-core/src/tests/test_filter.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc index 98cece680..ca6dee40a 100644 --- a/gnuradio-core/src/tests/test_general.cc +++ b/gnuradio-core/src/tests/test_general.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc index 608998df6..77af3001b 100644 --- a/gnuradio-core/src/tests/test_runtime.cc +++ b/gnuradio-core/src/tests/test_runtime.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * -- cgit From d65ae4249bf709d0e4062ef2825bef28ff77492a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 22 Jan 2011 22:47:08 -0800 Subject: created gr_sys_paths.h to house functions for getting system paths gr_sys_paths.h has gr_tmp_path() and gr_appdata_path() this replaces gr_tmp_path.h --- gnuradio-core/src/lib/general/gri_fft.cc | 13 ++--- gnuradio-core/src/lib/runtime/Makefile.am | 6 +-- gnuradio-core/src/lib/runtime/gr_preferences.cc | 15 ++---- gnuradio-core/src/lib/runtime/gr_sys_paths.cc | 55 ++++++++++++++++++++++ gnuradio-core/src/lib/runtime/gr_sys_paths.h | 31 ++++++++++++ gnuradio-core/src/lib/runtime/gr_tmp_path.cc | 52 -------------------- gnuradio-core/src/lib/runtime/gr_tmp_path.h | 31 ------------ .../lib/runtime/gr_vmcircbuf_createfilemapping.cc | 3 +- .../src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc | 4 +- .../src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc | 4 +- 10 files changed, 101 insertions(+), 113 deletions(-) create mode 100644 gnuradio-core/src/lib/runtime/gr_sys_paths.cc create mode 100644 gnuradio-core/src/lib/runtime/gr_sys_paths.h delete mode 100644 gnuradio-core/src/lib/runtime/gr_tmp_path.cc delete mode 100644 gnuradio-core/src/lib/runtime/gr_tmp_path.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index 37be06f09..f20b15ca0 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2008 Free Software Foundation, Inc. + * Copyright 2003,2008,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -33,14 +34,6 @@ #include namespace fs = boost::filesystem; -static std::string get_home_dir(void){ - #if defined(BOOST_WINDOWS) - return getenv ("APPDATA"); - #else - return getenv ("HOME"); - #endif -} - boost::mutex & gri_fft_planner::mutex() { @@ -53,7 +46,7 @@ static const char * wisdom_filename () { static fs::path path; - path = fs::path(get_home_dir()) / ".gr_fftw_wisdom"; + path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom"; return path.string().c_str(); } diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 3dd2b42f5..eca92e526 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2003,2004,2007,2008,2009,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -58,7 +58,7 @@ libruntime_la_SOURCES = \ gr_sync_block.cc \ gr_sync_decimator.cc \ gr_sync_interpolator.cc \ - gr_tmp_path.cc \ + gr_sys_paths.cc \ gr_top_block.cc \ gr_top_block_impl.cc \ gr_tpb_detail.cc \ @@ -121,7 +121,7 @@ grinclude_HEADERS = \ gr_tpb_detail.h \ gr_tpb_thread_body.h \ gr_timer.h \ - gr_tmp_path.h \ + gr_sys_paths.h \ gr_types.h \ gr_unittests.h \ gr_vmcircbuf.h \ diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc index 21934677b..c2ca047a8 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.cc +++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2010 Free Software Foundation, Inc. + * Copyright 2003,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,6 +25,7 @@ #endif #include +#include #include #include #include @@ -37,14 +38,6 @@ #include namespace fs = boost::filesystem; -static std::string get_home_dir(void){ - #if defined(BOOST_WINDOWS) - return getenv ("APPDATA"); - #else - return getenv ("HOME"); - #endif -} - /* * The simplest thing that could possibly work: * the key is the filename; the value is the file contents. @@ -54,14 +47,14 @@ static const char * pathname (const char *key) { static fs::path path; - path = fs::path(get_home_dir()) / ".gnuradio" / "prefs" / key; + path = fs::path(gr_appdata_path()) / ".gnuradio" / "prefs" / key; return path.string().c_str(); } static void ensure_dir_path () { - fs::path path = fs::path(get_home_dir()) / ".gnuradio"; + fs::path path = fs::path(gr_appdata_path()) / ".gnuradio"; if (!fs::is_directory(path)) fs::create_directory(path); path = path / "prefs"; diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.cc b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc new file mode 100644 index 000000000..9d10a3ccd --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2011 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. + */ + +#include +#include //getenv +#include //P_tmpdir (maybe) + +const char *gr_tmp_path(){ + const char *path; + + //first case, try TMP environment variable + path = getenv("TMP"); + if (path) return path; + + //second case, try P_tmpdir when its defined + #ifdef P_tmpdir + if (P_tmpdir) return P_tmpdir; + #endif /*P_tmpdir*/ + + //fall-through case, nothing worked + return "/tmp"; +} + +const char *gr_appdata_path(){ + const char *path; + + //first case, try HOME environment variable (unix) + path = getenv("HOME"); + if (path) return path; + + //second case, try APPDATA environment variable (windows) + path = getenv("APPDATA"); + if (path) return path; + + //fall-through case, nothing worked + return gr_tmp_path(); +} diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h new file mode 100644 index 000000000..aa8249775 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h @@ -0,0 +1,31 @@ +/* + * Copyright 2011 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. + */ + +#ifndef _GR_SYS_PATHS_H_ +#define _GR_SYS_PATHS_H_ + +//! directory to create temporary files +const char *gr_tmp_path(); + +//! directory to store application data +const char *gr_appdata_path(); + +#endif /* _GR_SYS_PATHS_H_ */ diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc b/gnuradio-core/src/lib/runtime/gr_tmp_path.cc deleted file mode 100644 index 1f0c830cd..000000000 --- a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#include -#include -#include -#include - -const char * -gr_tmp_path () -{ - static char *pp = 0; - - if (pp) - return pp; - - char *s = getenv ("TMP"); - if (s){ - pp = strdup (s); - return pp; - } - -#ifdef P_tmpdir - if (P_tmpdir){ - pp = strdup (P_tmpdir); - return pp; - } -#endif - - pp = strdup ("/tmp"); - return pp; -} - diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.h b/gnuradio-core/src/lib/runtime/gr_tmp_path.h deleted file mode 100644 index 3d02043c7..000000000 --- a/gnuradio-core/src/lib/runtime/gr_tmp_path.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#ifndef _GR_TMP_PATH_H_ -#define _GR_TMP_PATH_H_ - -/*! - * \brief return directory portion of pathname used for temporary files. - */ -const char *gr_tmp_path (); - -#endif /* _GR_TMP_PATH_H_ */ diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc index 65fe0c488..42c459484 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2005 Free Software Foundation, Inc. + * Copyright 2003,2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -36,7 +36,6 @@ #include #include #include -#include #include #ifdef HAVE_CREATEFILEMAPPING diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc index 3017036ef..4f7ae39cd 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -37,7 +37,7 @@ #include #include #include -#include +#include gr_vmcircbuf_mmap_shm_open::gr_vmcircbuf_mmap_shm_open (int size) diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc index faae4b396..ee8b0c485 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,7 +39,7 @@ #include #include #include -#include +#include gr_vmcircbuf_mmap_tmpfile::gr_vmcircbuf_mmap_tmpfile (int size) : gr_vmcircbuf (size) -- cgit From 5aeb617549b92eec3fe978e5fad12eacbed97f65 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 22 Jan 2011 23:44:05 -0800 Subject: implemented cpuid gcc call in gr-filter gr_cpu_x86.cc, removes cpuid asm files --- gnuradio-core/src/lib/filter/Makefile.am | 7 +- gnuradio-core/src/lib/filter/cpuid_x86.S | 60 --------- gnuradio-core/src/lib/filter/cpuid_x86_64.S | 54 -------- gnuradio-core/src/lib/filter/gcc_x86_cpuid.h | 178 +++++++++++++++++++++++++++ gnuradio-core/src/lib/filter/gr_cpu_x86.cc | 5 +- 5 files changed, 183 insertions(+), 121 deletions(-) delete mode 100644 gnuradio-core/src/lib/filter/cpuid_x86.S delete mode 100644 gnuradio-core/src/lib/filter/cpuid_x86_64.S create mode 100644 gnuradio-core/src/lib/filter/gcc_x86_cpuid.h (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index ebc7ad203..dee13e239 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -120,8 +120,7 @@ x86_SUBCODE = \ ccomplex_dotprod_sse.S \ fcomplex_dotprod_3dnow.S \ fcomplex_dotprod_sse.S \ - short_dotprod_mmx.S \ - cpuid_x86.S + short_dotprod_mmx.S x86_64_SUBCODE = \ float_dotprod_sse64.S \ @@ -134,8 +133,7 @@ x86_64_SUBCODE = \ ccomplex_dotprod_sse64.S \ fcomplex_dotprod_3dnow64.S \ fcomplex_dotprod_sse64.S \ - short_dotprod_mmx64.S \ - cpuid_x86_64.S + short_dotprod_mmx64.S x86_qa_CODE = \ qa_dotprod_x86.cc \ @@ -312,6 +310,7 @@ grinclude_HEADERS = \ noinst_HEADERS = \ assembly.h \ + gcc_x86_cpuid.h \ dotprod_fff_altivec.h \ dotprod_fff_armv7_a.h \ dotprod_ccf_armv7_a.h \ diff --git a/gnuradio-core/src/lib/filter/cpuid_x86.S b/gnuradio-core/src/lib/filter/cpuid_x86.S deleted file mode 100644 index 4e1a9404f..000000000 --- a/gnuradio-core/src/lib/filter/cpuid_x86.S +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright 2003 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. -# - -# -# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result -# -# void cpuid_x86 (unsigned int op, unsigned int result[4]); -# - -#include "assembly.h" - -.file "cpuid_x86.S" - .version "01.01" -.text -.globl GLOB_SYMB(cpuid_x86) - DEF_FUNC_HEAD(cpuid_x86) -GLOB_SYMB(cpuid_x86): - pushl %ebp - movl %esp, %ebp - pushl %ebx # must save in PIC mode, holds GOT pointer - pushl %esi - - movl 8(%ebp), %eax # op - movl 12(%ebp), %esi # result - cpuid - movl %eax, 0(%esi) - movl %ebx, 4(%esi) - movl %ecx, 8(%esi) - movl %edx, 12(%esi) - - popl %esi - popl %ebx - popl %ebp - ret - -FUNC_TAIL(cpuid_x86) - .ident "Hand coded cpuid assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/cpuid_x86_64.S b/gnuradio-core/src/lib/filter/cpuid_x86_64.S deleted file mode 100644 index 32b1847cd..000000000 --- a/gnuradio-core/src/lib/filter/cpuid_x86_64.S +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright 2003,2005 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. -# - -# -# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result -# -# void cpuid_x86 (unsigned int op, unsigned int result[4]); -# - -#include "assembly.h" - -.file "cpuid_x86_64.S" - .version "01.01" -.text -.globl GLOB_SYMB(cpuid_x86) - DEF_FUNC_HEAD(cpuid_x86) -GLOB_SYMB(cpuid_x86): - mov %rbx, %r11 # must save in PIC mode, holds GOT pointer - - mov %rdi, %rax # op - cpuid - movl %eax, 0(%rsi) # result - movl %ebx, 4(%rsi) - movl %ecx, 8(%rsi) - movl %edx, 12(%rsi) - - mov %r11, %rbx - retq - -FUNC_TAIL(cpuid_x86) - .ident "Hand coded cpuid64 assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h new file mode 100644 index 000000000..2d0916fb3 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + * + * This file 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. + * + * This file 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. + * + * Under Section 7 of GPL version 3, you are granted additional + * permissions described in the GCC Runtime Library Exception, version + * 3.1, as published by the Free Software Foundation. + * + * You should have received a copy of the GNU General Public License and + * a copy of the GCC Runtime Library Exception along with this program; + * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * . + */ + +/* %ecx */ +#define bit_SSE3 (1 << 0) +#define bit_PCLMUL (1 << 1) +#define bit_SSSE3 (1 << 9) +#define bit_FMA (1 << 12) +#define bit_CMPXCHG16B (1 << 13) +#define bit_SSE4_1 (1 << 19) +#define bit_SSE4_2 (1 << 20) +#define bit_MOVBE (1 << 22) +#define bit_POPCNT (1 << 23) +#define bit_AES (1 << 25) +#define bit_XSAVE (1 << 26) +#define bit_OSXSAVE (1 << 27) +#define bit_AVX (1 << 28) + +/* %edx */ +#define bit_CMPXCHG8B (1 << 8) +#define bit_CMOV (1 << 15) +#define bit_MMX (1 << 23) +#define bit_FXSAVE (1 << 24) +#define bit_SSE (1 << 25) +#define bit_SSE2 (1 << 26) + +/* Extended Features */ +/* %ecx */ +#define bit_LAHF_LM (1 << 0) +#define bit_SSE4a (1 << 6) +#define bit_SSE5 (1 << 11) + +/* %edx */ +#define bit_LM (1 << 29) +#define bit_3DNOWP (1 << 30) +#define bit_3DNOW (1 << 31) + + +#if defined(__i386__) && defined(__PIC__) +/* %ebx may be the PIC register. */ +#if __GNUC__ >= 3 +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif +#else +#define __cpuid(level, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif + +/* Return highest supported input value for cpuid instruction. ext can + be either 0x0 or 0x8000000 to return highest supported value for + basic or extended cpuid information. Function returns 0 if cpuid + is not supported or whatever cpuid returns in eax register. If sig + pointer is non-null, then first four bytes of the signature + (as found in ebx register) are returned in location pointed by sig. */ + +static __inline unsigned int +__get_cpuid_max (unsigned int __ext, unsigned int *__sig) +{ + unsigned int __eax, __ebx, __ecx, __edx; + +#ifndef __x86_64__ +#if __GNUC__ >= 3 + /* See if we can use cpuid. On AMD64 we always can. */ + __asm__ ("pushf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "mov{l}\t{%0, %1|%1, %0}\n\t" + "xor{l}\t{%2, %0|%0, %2}\n\t" + "push{l}\t%0\n\t" + "popf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "popf{l|d}\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ + __asm__ ("pushfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "movl\t%0, %1\n\t" + "xorl\t%2, %0\n\t" + "pushl\t%0\n\t" + "popfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "popfl\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#endif + + if (!((__eax ^ __ebx) & 0x00200000)) + return 0; +#endif + + /* Host supports cpuid. Return highest supported cpuid input value. */ + __cpuid (__ext, __eax, __ebx, __ecx, __edx); + + if (__sig) + *__sig = __ebx; + + return __eax; +} + +/* Return cpuid data for requested cpuid level, as found in returned + eax, ebx, ecx and edx registers. The function checks if cpuid is + supported and returns 1 for valid cpuid information or 0 for + unsupported cpuid level. All pointers are required to be non-null. */ + +static __inline int +__get_cpuid (unsigned int __level, + unsigned int *__eax, unsigned int *__ebx, + unsigned int *__ecx, unsigned int *__edx) +{ + unsigned int __ext = __level & 0x80000000; + + if (__get_cpuid_max (__ext, 0) < __level) + return 0; + + __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); + return 1; +} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc index ac8a2eeb7..9be95235d 100644 --- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc +++ b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc @@ -21,13 +21,12 @@ */ #include +#include "gcc_x86_cpuid.h" /* * execute CPUID instruction, return EAX, EBX, ECX and EDX values in result */ -extern "C" { -void cpuid_x86 (unsigned int op, unsigned int result[4]); -}; +#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3) /* * CPUID functions returning a single datum -- cgit From 606681bd0ab4abf43e0c3eab3c847a198269ca88 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 23 Jan 2011 15:21:11 -0500 Subject: Needed to specify the use of boost::filesystem library. --- gnuradio-core/src/lib/Makefile.am | 5 ++++- gnuradio-core/src/tests/Makefile.am | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am index 1281b4aa6..4db2ff167 100644 --- a/gnuradio-core/src/lib/Makefile.am +++ b/gnuradio-core/src/lib/Makefile.am @@ -66,4 +66,7 @@ libgnuradio_core_qa_la_LIBADD = \ bin_PROGRAMS = gnuradio-config-info gnuradio_config_info_SOURCES = gnuradio-config-info.cc -gnuradio_config_info_LDADD = libgnuradio-core.la $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) +gnuradio_config_info_LDADD = libgnuradio-core.la \ + $(BOOST_LDFLAGS) \ + $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(BOOST_FILESYSTEM_LIB) diff --git a/gnuradio-core/src/tests/Makefile.am b/gnuradio-core/src/tests/Makefile.am index c75bb8c2a..5879a13d8 100644 --- a/gnuradio-core/src/tests/Makefile.am +++ b/gnuradio-core/src/tests/Makefile.am @@ -59,7 +59,7 @@ noinst_SCRIPTS = \ benchmark_dotprod -LIBGNURADIO = $(GNURADIO_CORE_LA) +LIBGNURADIO = $(GNURADIO_CORE_LA) $(BOOST_FILESYSTEM_LIB) LIBGNURADIOQA = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core-qa.la $(LIBGNURADIO) benchmark_dotprod_fff_SOURCES = benchmark_dotprod_fff.cc -- cgit From 52c9710d9335dc5f0c7bcd0b4ffa076866fe3968 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 23 Jan 2011 15:21:18 -0500 Subject: Forced initialization of arrays to avoid warnings. --- gnuradio-core/src/lib/filter/gr_cpu_x86.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc index 9be95235d..da970e133 100644 --- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc +++ b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc @@ -34,28 +34,28 @@ static inline unsigned int cpuid_eax(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[0]; } static inline unsigned int cpuid_ebx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[1]; } static inline unsigned int cpuid_ecx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[2]; } static inline unsigned int cpuid_edx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[3]; } -- cgit From 8e5f4bc89af1682b258ecb1bc46b04d24ea3addd Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 26 Feb 2011 14:48:34 -0800 Subject: use boost::math::trunc in gr_frequency_modulator_fc.cc this replaces the need for a conditional trunc implementation in config.h --- gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc index 0f6f0d719..bff22be25 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,6 +28,7 @@ #include #include #include +#include gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity) @@ -62,7 +63,7 @@ gr_frequency_modulator_fc::work (int noutput_items, // to avoid loss of precision in the addition above. if (fabs (d_phase) > 16 * M_PI){ - double ii = trunc (d_phase / (2 * M_PI)); + double ii = boost::math::trunc (d_phase / (2 * M_PI)); d_phase = d_phase - (ii * 2 * M_PI); } -- cgit From 239c5860be82936e00cfec16a4e1f06f1a004c59 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 26 Feb 2011 14:49:53 -0800 Subject: use boost::math::iround in gr_histo_sink_f.cc and gr_wavfile_sink.cc this provides a round implementation on platforms w/o c99 standard --- gnuradio-core/src/lib/io/gr_histo_sink_f.cc | 5 +++-- gnuradio-core/src/lib/io/gr_wavfile_sink.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc index a37189c24..fc0c12ce6 100644 --- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc +++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009,2010 Free Software Foundation, Inc. + * Copyright 2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,6 +26,7 @@ #include #include +#include static float get_clean_num(float num){ if (num == 0) return 0; @@ -101,7 +102,7 @@ gr_histo_sink_f::send_frame(void){ int index; float bin_width = (maximum - minimum)/(d_num_bins-1); for (unsigned int i = 0; i < d_sample_count; i++){ - index = round((d_samps[i] - minimum)/bin_width); + index = boost::math::iround((d_samps[i] - minimum)/bin_width); /* ensure the index range in case a small floating point error is involed */ if (index < 0) index = 0; if (index >= (int)d_num_bins) index = d_num_bins-1; diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc index b60a6e3ab..a96aadc72 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc +++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2004,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -33,6 +33,7 @@ #include #include #include +#include // win32 (mingw/msvc) specific #ifdef HAVE_IO_H @@ -224,7 +225,7 @@ gr_wavfile_sink::convert_to_short(float sample) sample = d_min_sample_val; } - return (short int) roundf(sample); + return (short int) boost::math::iround(sample); } -- cgit From aedfa8ec254f1def125167a77a50bb0eec4ab00c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Jan 2011 12:23:58 -0800 Subject: gr_flowgraph.cc explicit include of Added explicit include of , which was implicitly included by . Affects platforms where vector does not automatically pull in iterator. --- gnuradio-core/src/lib/runtime/gr_flowgraph.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc index 27f6257cc..0d3bbb011 100644 --- a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc +++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,6 +28,7 @@ #include #include #include +#include #define GR_FLOWGRAPH_DEBUG 0 -- cgit From e73c25fb9226029f0e50052b1ffacedb3a78622b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Jan 2011 00:34:28 -0800 Subject: gruel thread simplification: Removed get_new_timeout from thread.h (usrp2_vrt carryover) Basically it was created because of a misunderstanding of the time types; and its only ever called once. This also removes thread.cc Call posix_time::milliseconds in usrp2 control.cc. Notice that it passes a time_duration rather than a ptime (aka system time). Added #include to gr_buffer.h. It turns out that boost posix_time.hpp implicitly included the deque header which was missing from gr_buffer.h Replaced the include for thread.hpp with only the includes for the boost thread types mentioned in gruel/thread.h. Also, making use of the scoped_lock typedef that comes with boost thread locks. boost 3.5 safe. --- gnuradio-core/src/lib/runtime/gr_buffer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index aa26f1e09..e5725d386 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2010 Free Software Foundation, Inc. + * Copyright 2004,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,6 +27,7 @@ #include #include #include +#include class gr_vmcircbuf; -- cgit From 7e2bd5adbf9828e6ca671ff5a176bff7ab48c557 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 12:52:02 -0800 Subject: uhd: fix generation typo on uhd grc blocks io direction --- gnuradio-core/src/lib/general/gr_keep_one_in_n.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index 85495e277..e38240a3f 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,16 +31,15 @@ gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n) { - return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n)); + return gr_keep_one_in_n_sptr (new gr_keep_one_in_n (item_size, n)); } gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) : gr_block ("keep_one_in_n", gr_make_io_signature (1, 1, item_size), gr_make_io_signature (1, 1, item_size)), - d_count(n) + d_n (n), d_count(n) { - set_n(n); } void @@ -51,8 +50,6 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; - - set_relative_rate(1.0 / (float)n); } int -- cgit From 8eeba059728257812924ed5b70b9e1e97d98886f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 16:08:36 -0800 Subject: reverted accidental change to keep 1 in n block --- gnuradio-core/src/lib/general/gr_keep_one_in_n.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index e38240a3f..85495e277 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,15 +31,16 @@ gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n) { - return gr_keep_one_in_n_sptr (new gr_keep_one_in_n (item_size, n)); + return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n)); } gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) : gr_block ("keep_one_in_n", gr_make_io_signature (1, 1, item_size), gr_make_io_signature (1, 1, item_size)), - d_n (n), d_count(n) + d_count(n) { + set_n(n); } void @@ -50,6 +51,8 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; + + set_relative_rate(1.0 / (float)n); } int -- cgit From a83d1cf1518827e8b5398bcecef1c8216808ee7c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 9 Mar 2011 14:31:44 -0800 Subject: audio: make prefs look like old audio, removed old audio.py --- gnuradio-core/src/python/gnuradio/Makefile.am | 3 +- gnuradio-core/src/python/gnuradio/audio.py | 88 --------------------------- 2 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 gnuradio-core/src/python/gnuradio/audio.py (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am index a3f3518de..eff35e95c 100644 --- a/gnuradio-core/src/python/gnuradio/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2004-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,7 +26,6 @@ SUBDIRS = gr gru gruimpl blks2 blks2impl vocoder grpython_PYTHON = \ __init__.py \ - audio.py \ eng_notation.py \ eng_option.py \ modulation_utils.py \ diff --git a/gnuradio-core/src/python/gnuradio/audio.py b/gnuradio-core/src/python/gnuradio/audio.py deleted file mode 100644 index f6e921f0e..000000000 --- a/gnuradio-core/src/python/gnuradio/audio.py +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright 2004,2006 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. -# - -""" -This is the 'generic' audio or soundcard interface. - -The behavior of this module is controlled by the [audio] audio_module -configuration parameter. If it is 'auto' we attempt to import modules -from the known_modules list, using the first one imported successfully. - -If [audio] audio_module is not 'auto', we assume it's the name of -an audio module and attempt to import it. -""" - -__all__ = ['source', 'sink'] - -from gnuradio import gr -import sys - -source = None -sink = None - - -known_modules = ( - 'audio_alsa', 'audio_oss', 'audio_osx', 'audio_jack', 'audio_portaudio', 'audio_windows') - - -def try_import(name): - """ - Build a blob of code and try to execute it. - If it succeeds we will have set the globals source and sink - as side effects. - - returns True or False - """ - global source, sink - full_name = "gnuradio." + name - code = """ -import %s -source = %s.source -sink = %s.sink -""" % (full_name, full_name, full_name) - try: - exec code in globals() - return True - except ImportError: - return False - - -def __init__ (): - p = gr.prefs() # get preferences (config file) object - verbose = p.get_bool('audio', 'verbose', False) - module = p.get_string('audio', 'audio_module', 'auto') - - if module == 'auto': # search our list for the first one that we can import - for m in known_modules: - if try_import(m): - if verbose: sys.stderr.write('audio: using %s\n' % (m,)) - return - raise ImportError, 'Unable to locate an audio module.' - - else: # use the one the user specified - if try_import(module): - if verbose: sys.stderr.write('audio: using %s\n' % (module,)) - else: - msg = 'Failed to import user-specified audio module %s' % (module,) - if verbose: sys.stderr.write('audio: %s\n' % (msg,)) - raise ImportError, msg - -__init__() -- cgit From 6673be777cd5395ae867e67db8c95aa09066617a Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 12 Mar 2011 15:47:40 -0800 Subject: Added/updated ignore files. --- gnuradio-core/src/guile/.gitignore | 1 + 1 file changed, 1 insertion(+) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore index 82a29a907..ea2593923 100644 --- a/gnuradio-core/src/guile/.gitignore +++ b/gnuradio-core/src/guile/.gitignore @@ -2,3 +2,4 @@ /Makefile.in /run_guile_tests /guile.log +/gr-run-waveform-script -- cgit From bf9c13870fa9766b68dbfeda9307c4a0aa5e2963 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 14 Mar 2011 11:23:19 -0700 Subject: created gruel/attributes.h to house compiler specific attribute macros replaced instances of __attribute__ with __GR_ATTR from attributes.h what else has compiler specific attributes? volk - volk is stand-alone, needs its own attributes.h gcell - not touching that, probably gcc only anyways usrp2 firmware - does not matter to host build --- gnuradio-core/src/lib/bug_work_around_6.cc | 4 ++-- gnuradio-core/src/lib/filter/qa_gr_rotator.cc | 7 ++++++- gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc | 7 ++++++- gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h | 3 ++- gnuradio-core/src/lib/missing/bug_work_around_8.cc | 3 ++- 5 files changed, 18 insertions(+), 6 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/bug_work_around_6.cc b/gnuradio-core/src/lib/bug_work_around_6.cc index b829360fc..f8012af0d 100644 --- a/gnuradio-core/src/lib/bug_work_around_6.cc +++ b/gnuradio-core/src/lib/bug_work_around_6.cc @@ -1,3 +1,3 @@ // if libgrio has no sources, it doesn't get built correctly - -static int gr_bug_work_around_6 __attribute__((unused)); +#include +static int gr_bug_work_around_6 __GR_ATTR_UNUSED; diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc index ce71a3d88..ef41127fd 100644 --- a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc +++ b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc @@ -20,6 +20,11 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include #include #include #include @@ -29,7 +34,7 @@ // error vector magnitude -__attribute__((unused)) static float +__GR_ATTR_UNUSED static float error_vector_mag(gr_complex a, gr_complex b) { return abs(a-b); diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc index 3c379ea25..2fc97a78a 100644 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc +++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc @@ -20,6 +20,11 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include #include #include #include @@ -55,7 +60,7 @@ void qa_gri_mmse_fir_interpolator_cc::t1() { static const unsigned N = 100; - gr_complex input[N + 10] __attribute__ ((aligned (8))); + __GR_ATTR_ALIGNED(8) gr_complex input[N + 10]; for (unsigned i = 0; i < NELEM(input); i++) input[i] = test_fcn ((double) i); diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h index 024d74ada..f17b68aa0 100644 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h +++ b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_MPSK_RECEIVER_CC_H #define INCLUDED_GR_MPSK_RECEIVER_CC_H +#include #include #include #include @@ -299,7 +300,7 @@ protected: static const unsigned int DLLEN = 8; //! delay line plus some length for overflow protection - gr_complex d_dl[2*DLLEN] __attribute__ ((aligned(8))); + __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN]; //! index to delay line unsigned int d_dl_idx; diff --git a/gnuradio-core/src/lib/missing/bug_work_around_8.cc b/gnuradio-core/src/lib/missing/bug_work_around_8.cc index b2cbdb3d9..5e431a210 100644 --- a/gnuradio-core/src/lib/missing/bug_work_around_8.cc +++ b/gnuradio-core/src/lib/missing/bug_work_around_8.cc @@ -1,2 +1,3 @@ // if libmisc has no sources, it doesn't get built correctly -static int gr_bug_work_around_8 __attribute__((unused)); +#include +static int gr_bug_work_around_8 __GR_ATTR_UNUSED; -- cgit From 64dac6a1f62fb8484e879f0d20ee60bc02da179c Mon Sep 17 00:00:00 2001 From: Don Ward Date: Fri, 25 Mar 2011 11:53:04 -0400 Subject: Fixing missing include files and various other patches for Windows build issues. --- gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc | 7 ++++--- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 1 - gnuradio-core/src/lib/io/gr_tagged_file_sink.h | 1 + gnuradio-core/src/lib/io/gr_wavfile_source.cc | 1 - gnuradio-core/src/lib/io/gr_wavfile_source.h | 1 + gnuradio-core/src/lib/runtime/gr_error_handler.cc | 1 - gnuradio-core/src/lib/runtime/gr_error_handler.h | 1 + gnuradio-core/src/tests/benchmark_dotprod_ccc.cc | 8 +++++--- gnuradio-core/src/tests/benchmark_dotprod_ccf.cc | 8 +++++--- 9 files changed, 17 insertions(+), 12 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc index e87d93ebf..ca76c8eb8 100644 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc +++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc @@ -42,6 +42,7 @@ typedef gr_complex acc_type; using std::vector; +#define MAX_DATA (32767) #define ERR_DELTA (1e-5) #define NELEM(x) (sizeof (x) / sizeof (x[0])) @@ -56,8 +57,8 @@ static void random_complex (gr_complex *buf, unsigned n) { for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); + float re = rint (uniform () * MAX_DATA); + float im = rint (uniform () * MAX_DATA); buf[i] = gr_complex (re, im); } } @@ -151,7 +152,7 @@ qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate) for (int o = 0; o < (int)(ol/decimate); o++){ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); + sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA); } delete f1; } diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc index c76ede542..154611c32 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h index 956340f8d..2e0a5c63a 100644 --- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h +++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_TAGGED_FILE_SINK_H #include +#include // for FILE class gr_tagged_file_sink; typedef boost::shared_ptr gr_tagged_file_sink_sptr; diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.cc b/gnuradio-core/src/lib/io/gr_wavfile_source.cc index d00dd3028..136e52611 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_source.cc +++ b/gnuradio-core/src/lib/io/gr_wavfile_source.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.h b/gnuradio-core/src/lib/io/gr_wavfile_source.h index 0c663f0a0..e434a6b4c 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_source.h +++ b/gnuradio-core/src/lib/io/gr_wavfile_source.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_WAVFILE_SOURCE_H #include +#include // for FILE class gr_wavfile_source; typedef boost::shared_ptr gr_wavfile_source_sptr; diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.cc b/gnuradio-core/src/lib/runtime/gr_error_handler.cc index 6dbb0a5d2..4b4cdacef 100644 --- a/gnuradio-core/src/lib/runtime/gr_error_handler.cc +++ b/gnuradio-core/src/lib/runtime/gr_error_handler.cc @@ -48,7 +48,6 @@ #include #include #include -#include #ifdef HAVE_IO_H #include diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h index 530a2c23c..aedb6f41f 100644 --- a/gnuradio-core/src/lib/runtime/gr_error_handler.h +++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h @@ -45,6 +45,7 @@ #include #include +#include // for FILE /*! * \brief abstract error handler diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc index 5d53a9f89..8ef26a40d 100644 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc +++ b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc @@ -56,7 +56,8 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) { int i; gr_complex coeffs[NTAPS]; - gr_complex input[BLOCK_SIZE + NTAPS]; + //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned + gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; long n; gr_complex result; #ifdef HAVE_SYS_RESOURCE_H @@ -86,7 +87,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) exit (1); } #else - clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC); + clock_start= (double) clock() / CLOCKS_PER_SEC; #endif // do the actual work @@ -116,7 +117,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) double total = user + sys; #else - clock_end = (double) clock() * (1000000. / CLOCKS_PER_SEC); + clock_end = (double) clock() / CLOCKS_PER_SEC; double total = clock_end - clock_start; #endif @@ -126,6 +127,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); delete f; + delete [] input; } static void diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc index 60855ec94..ed3c49165 100644 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc +++ b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc @@ -56,7 +56,8 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) { int i; float coeffs[NTAPS]; - gr_complex input[BLOCK_SIZE + NTAPS]; + //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned + gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; long n; gr_complex result; #ifdef HAVE_SYS_RESOURCE_H @@ -86,7 +87,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) exit (1); } #else - clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC); + clock_start= (double) clock() / CLOCKS_PER_SEC; #endif // do the actual work @@ -118,7 +119,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) double total = user + sys; #else - clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC); + clock_end= (double) clock() / CLOCKS_PER_SEC; double total = clock_end - clock_start; #endif @@ -128,6 +129,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name) implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); delete f; + delete [] input; } static void -- cgit From a111deb45559296d6eadded9226df68af21c0477 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 16 Mar 2011 14:51:58 -0700 Subject: runtime: changes to block headers to allow pure virtual sub-classes (interfaces) --- gnuradio-core/src/lib/runtime/gr_basic_block.h | 2 ++ gnuradio-core/src/lib/runtime/gr_block.h | 2 +- gnuradio-core/src/lib/runtime/gr_sync_block.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index ce7a1aa1d..3b0cd51dd 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -73,6 +73,8 @@ protected: long d_unique_id; vcolor d_color; + gr_basic_block(void){} //allows pure virtual interface sub-classes + //! Protected constructor prevents instantiation by non-derived classes gr_basic_block(const std::string &name, gr_io_signature_sptr input_signature, diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index ad7fa9555..fc22f9ea8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -236,7 +236,7 @@ class gr_block : public gr_basic_block { tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream protected: - + gr_block (void){} //allows pure virtual interface sub-classes gr_block (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h index 3a5d89d19..c5a6a50f1 100644 --- a/gnuradio-core/src/lib/runtime/gr_sync_block.h +++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h @@ -34,7 +34,7 @@ class gr_sync_block : public gr_block { protected: - + gr_sync_block (void){} //allows pure virtual interface sub-classes gr_sync_block (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); -- cgit From 3ff8f7a5545592a9dac201a27d18bfdae4cdcb7b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 16 Mar 2011 15:36:36 -0700 Subject: throttle: cleanup conditional code and reimplement with boost posix time This greatly cleans up gr_throttle and moves the implementation into the .cc file. The implementation uses boost's posix time library so it will work on all systems. Also added set_sample_rate() method and support for callback in grc. --- gnuradio-core/src/lib/general/gr_throttle.cc | 136 +++++++++++---------------- gnuradio-core/src/lib/general/gr_throttle.h | 33 ++----- gnuradio-core/src/lib/general/gr_throttle.i | 13 ++- 3 files changed, 67 insertions(+), 115 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc index 3189e01c0..a24b1da8c 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.cc +++ b/gnuradio-core/src/lib/general/gr_throttle.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2010 Free Software Foundation, Inc. + * Copyright 2005-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,92 +26,64 @@ #include #include -#include -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#if !defined(HAVE_NANOSLEEP) && defined(HAVE_SSLEEP) -#include -#endif - +#include +#include -#ifdef HAVE_NANOSLEEP -void -gr_nanosleep(struct timespec *ts) -{ - struct timespec *req = ts; - struct timespec rem; - int r = nanosleep(req, &rem); - while (r < 0 && errno == EINTR){ - req = &rem; - r = nanosleep(req, &rem); - } - if (r < 0) - perror ("gr_nanosleep"); -} -#endif - -gr_throttle_sptr -gr_make_throttle(size_t itemsize, double samples_per_sec) -{ - return gnuradio::get_initial_sptr(new gr_throttle(itemsize, samples_per_sec)); -} +class gr_throttle_impl : public gr_throttle{ +public: + gr_throttle_impl(size_t itemsize): + gr_sync_block("throttle", + gr_make_io_signature(1, 1, itemsize), + gr_make_io_signature(1, 1, itemsize)), + d_itemsize(itemsize) + { + /* NOP */ + } -gr_throttle::gr_throttle(size_t itemsize, double samples_per_sec) - : gr_sync_block("throttle", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize), d_samples_per_sec(samples_per_sec), - d_total_samples(0) -{ -#ifdef HAVE_GETTIMEOFDAY - gettimeofday(&d_start, 0); -#endif -} + void set_sample_rate(double rate){ + //changing the sample rate performs a reset of state params + d_start = boost::get_system_time(); + d_total_samples = 0; + d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second(); + d_samps_per_us = rate/1e6; + } -gr_throttle::~gr_throttle() -{ -} + int work ( + int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + //calculate the expected number of samples to have passed through + boost::system_time now = boost::get_system_time(); + boost::int64_t ticks = (now - d_start).ticks(); + uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks); -int -gr_throttle::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; + //if the expected samples was less, we need to throttle back + if (d_total_samples > expected_samps){ + boost::this_thread::sleep(boost::posix_time::microseconds( + long((d_total_samples - expected_samps)/d_samps_per_us) + )); + } -#if defined(HAVE_GETTIMEOFDAY) - // - // If our average sample rate exceeds our target sample rate, - // delay long enough to reduce to our target rate. - // - struct timeval now; - gettimeofday(&now, 0); - long t_usec = now.tv_usec - d_start.tv_usec; - long t_sec = now.tv_sec - d_start.tv_sec; - double t = (double)t_sec + (double)t_usec * 1e-6; - if (t < 1e-6) // avoid unlikely divide by zero - t = 1e-6; + //copy all samples output[i] <= input[i] + const char *in = (const char *) input_items[0]; + char *out = (char *) output_items[0]; + std::memcpy(out, in, noutput_items * d_itemsize); + d_total_samples += noutput_items; + return noutput_items; + } - double actual_samples_per_sec = d_total_samples / t; - if (actual_samples_per_sec > d_samples_per_sec){ // need to delay - double delay = d_total_samples / d_samples_per_sec - t; -#ifdef HAVE_NANOSLEEP - struct timespec ts; - ts.tv_sec = (time_t)floor(delay); - ts.tv_nsec = (long)((delay - floor(delay)) * 1e9); - gr_nanosleep(&ts); -#elif HAVE_SSLEEP - Sleep( (DWORD)(delay*1000) ); -#endif - } -#endif +private: + boost::system_time d_start; + size_t d_itemsize; + uint64_t d_total_samples; + double d_samps_per_tick, d_samps_per_us; +}; - memcpy(out, in, noutput_items * d_itemsize); - d_total_samples += noutput_items; - return noutput_items; +gr_throttle::sptr +gr_make_throttle(size_t itemsize, double samples_per_sec) +{ + gr_throttle::sptr throttle(new gr_throttle_impl(itemsize)); + throttle->set_sample_rate(samples_per_sec); + return throttle; } diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h index a1c9773c9..a82821f77 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ b/gnuradio-core/src/lib/general/gr_throttle.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,15 +23,6 @@ #define INCLUDED_GR_THROTTLE_H #include -#ifdef HAVE_SYS_TIME_H -#include -#endif - -class gr_throttle; -typedef boost::shared_ptr gr_throttle_sptr; - - -gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec); /*! * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec. @@ -44,25 +35,15 @@ gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec); * controlling the rate of samples. That should be controlled by a * source or sink tied to sample clock. E.g., a USRP or audio card. */ -class gr_throttle : public gr_sync_block +class gr_throttle : virtual public gr_sync_block { - friend gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec); - size_t d_itemsize; - double d_samples_per_sec; - double d_total_samples; -#ifdef HAVE_SYS_TIME_H - struct timeval d_start; -#endif - - gr_throttle(size_t itemsize, double samples_per_sec); - public: - ~gr_throttle(); + typedef boost::shared_ptr sptr; - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + //! Sets the sample rate in samples per second + virtual void set_sample_rate(double rate) = 0; }; - + +gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); #endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i index 21f7703ef..0b1ec165f 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.i +++ b/gnuradio-core/src/lib/general/gr_throttle.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,11 +20,10 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,throttle); +%{ +#include +%} -gr_throttle_sptr gr_make_throttle (size_t itemsize, double samples_per_sec); +GR_SWIG_BLOCK_MAGIC(gr,throttle); -class gr_throttle : public gr_sync_block -{ - gr_throttle (size_t itemsize, double samples_per_sec); -}; +%include -- cgit From eca5501969aa6175562b7e70b350cf3e6ddec603 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 4 Apr 2011 08:12:21 -0400 Subject: pfb: fixed documentation for PFB-based clock sync. --- gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h index 4e6ef5fc4..684ac85ce 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h @@ -84,7 +84,7 @@ class gr_fir_ccf; * the block constructor, we just ask for "gain," which is d_alpha while d_beta is * equal to (gain^2)/4. * - * The clock sync block needs to know the number of samples per second (sps), because it + * The clock sync block needs to know the number of samples per symbol (sps), because it * only returns a single point representing the sample. The sps can be any positive real * number and does not need to be an integer. The filter taps must also be specified. The * taps are generated by first conceiving of the prototype filter that would be the signal's @@ -115,7 +115,7 @@ class gr_pfb_clock_sync_ccf : public gr_block private: /*! * Build the polyphase filterbank timing synchronizer. - * \param sps (double) The number of samples per second in the incoming signal + * \param sps (double) The number of samples per symbol in the incoming signal * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default. * \param taps (vector) The filter taps. * \param filter_size (uint) The number of filters in the filterbank (default = 32). -- cgit From e36dc98e5f5aa82b146007c0379b6e55eca40578 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 7 Apr 2011 11:09:51 -0400 Subject: core: adding a type converter - int -> float. --- gnuradio-core/src/lib/general/Makefile.am | 2 + gnuradio-core/src/lib/general/general.i | 2 + gnuradio-core/src/lib/general/gr_int_to_float.cc | 59 ++++++++++++++++++++++++ gnuradio-core/src/lib/general/gr_int_to_float.h | 51 ++++++++++++++++++++ gnuradio-core/src/lib/general/gr_int_to_float.i | 30 ++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.cc create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.h create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3ceea7a6d..c36e7d7e7 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -139,6 +139,7 @@ libgeneral_la_SOURCES = \ gr_rms_cf.cc \ gr_rms_ff.cc \ gr_short_to_float.cc \ + gr_int_to_float.cc \ gr_simple_correlator.cc \ gr_simple_framer.cc \ gr_simple_squelch_cc.cc \ @@ -301,6 +302,7 @@ grinclude_HEADERS = \ gr_rms_cf.h \ gr_rms_ff.h \ gr_short_to_float.h \ + gr_int_to_float.h \ gr_simple_correlator.h \ gr_simple_framer.h \ gr_simple_framer_sync.h \ diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index fb9c4c0f2..e8a18ab19 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -167,6 +168,7 @@ %include "gr_float_to_char.i" %include "gr_float_to_uchar.i" %include "gr_short_to_float.i" +%include "gr_int_to_float.i" %include "gr_char_to_float.i" %include "gr_uchar_to_float.i" %include "gr_frequency_modulator_fc.i" diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc new file mode 100644 index 000000000..c60157e34 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +gr_int_to_float_sptr +gr_make_int_to_float () +{ + return gnuradio::get_initial_sptr(new gr_int_to_float ()); +} + +gr_int_to_float::gr_int_to_float () + : gr_sync_block ("gr_int_to_float", + gr_make_io_signature (1, 1, sizeof (int32_t)), + gr_make_io_signature (1, 1, sizeof (float))) +{ +} + +int +gr_int_to_float::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const int32_t *in = (const int32_t *) input_items[0]; + float *out = (float *) output_items[0]; + + for(int i=0; i + +class gr_int_to_float; +typedef boost::shared_ptr gr_int_to_float_sptr; + +gr_int_to_float_sptr +gr_make_int_to_float (); + +/*! + * \brief Convert stream of short to a stream of float + * \ingroup converter_blk + */ + +class gr_int_to_float : public gr_sync_block +{ + friend gr_int_to_float_sptr gr_make_int_to_float (); + gr_int_to_float (); + + public: + virtual int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif /* INCLUDED_GR_INT_TO_FLOAT_H */ diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.i b/gnuradio-core/src/lib/general/gr_int_to_float.i new file mode 100644 index 000000000..8cb9e35b5 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_int_to_float.i @@ -0,0 +1,30 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,int_to_float) + +gr_int_to_float_sptr gr_make_int_to_float (); + +class gr_int_to_float : public gr_sync_block +{ + gr_int_to_float (); +}; -- cgit From 82c41716e7ad1642266fefa819b60e674142e79b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 7 Apr 2011 16:40:54 -0400 Subject: core: adding QA code for int_to_float block. --- gnuradio-core/src/lib/general/gr_int_to_float.cc | 10 ++--- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 1 + .../src/python/gnuradio/gr/qa_int_to_float.py | 49 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc index c60157e34..b5a19e5c0 100644 --- a/gnuradio-core/src/lib/general/gr_int_to_float.cc +++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc @@ -42,15 +42,15 @@ gr_int_to_float::gr_int_to_float () int gr_int_to_float::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const int32_t *in = (const int32_t *) input_items[0]; float *out = (float *) output_items[0]; - for(int i=0; intaps()); + (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE; } gr_complex @@ -111,8 +111,6 @@ gr_clock_recovery_mm_cc::slicer_45deg (gr_complex sample) algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. */ -static const int FUDGE = 16; - int gr_clock_recovery_mm_cc::general_work (int noutput_items, gr_vector_int &ninput_items, -- cgit From f53fef3d2bc39b2020b8bce3d88b43569dd16605 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 12 May 2011 16:29:33 +0100 Subject: core: adding get/set sensitivity accessors to frequency_modulator_fc block. --- gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h | 4 +++- gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h index 4ba05d709..55f8412ce 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h @@ -47,7 +47,9 @@ class gr_frequency_modulator_fc : public gr_sync_block gr_frequency_modulator_fc (double sensitivity); public: - + void set_sensitivity(float sens) { d_sensitivity = sens; } + float get_sensitivity() { return d_sensitivity; } + int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i index 612b59026..04d9a41ba 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i @@ -28,4 +28,7 @@ class gr_frequency_modulator_fc : public gr_sync_block { private: gr_frequency_modulator_fc (double sensitivity); +public: + void set_sensitivity(float sens) { d_sensitivity = sens; } + float get_sensitivity() { return d_sensitivity; } }; -- cgit From 09f5b9606b57631d27d3abd868dcf5fe7eca6d12 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 25 May 2011 16:29:22 +0100 Subject: filter: adding a DC blocker algorithm. --- gnuradio-core/src/lib/filter/Makefile.am | 7 +- gnuradio-core/src/lib/filter/filter.i | 2 + gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc | 138 +++++++++++++++++++++++ gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h | 110 ++++++++++++++++++ gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i | 34 ++++++ 5 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index dee13e239..95489156f 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -216,7 +216,8 @@ libfilter_la_common_SOURCES = \ gr_pfb_interpolator_ccf.cc \ gr_pfb_arb_resampler_ccf.cc \ gr_pfb_clock_sync_ccf.cc \ - gr_pfb_clock_sync_fff.cc + gr_pfb_clock_sync_fff.cc \ + gr_dc_blocker_cc.cc libfilter_qa_la_common_SOURCES = \ qa_filter.cc \ @@ -306,7 +307,8 @@ grinclude_HEADERS = \ gr_pfb_interpolator_ccf.h \ gr_pfb_arb_resampler_ccf.h \ gr_pfb_clock_sync_ccf.h \ - gr_pfb_clock_sync_fff.h + gr_pfb_clock_sync_fff.h \ + gr_dc_blocker_cc.h noinst_HEADERS = \ assembly.h \ @@ -372,6 +374,7 @@ swiginclude_HEADERS = \ gr_pfb_arb_resampler_ccf.i \ gr_pfb_clock_sync_ccf.i \ gr_pfb_clock_sync_fff.i \ + gr_dc_blocker_cc.i \ $(GENERATED_I) diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i index 645607cba..b8f4d06eb 100644 --- a/gnuradio-core/src/lib/filter/filter.i +++ b/gnuradio-core/src/lib/filter/filter.i @@ -39,6 +39,7 @@ #include #include #include +#include %} %include "gr_iir_filter_ffd.i" @@ -62,5 +63,6 @@ %include "gr_pfb_arb_resampler_ccf.i" %include "gr_pfb_clock_sync_ccf.i" %include "gr_pfb_clock_sync_fff.i" +%include "gr_dc_blocker_cc.i" %include "filter_generated.i" diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc new file mode 100644 index 000000000..66f59f240 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc @@ -0,0 +1,138 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +moving_averager::moving_averager(int D) + : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) +{ + d_delay_line = std::deque(d_length-1, gr_complex(0,0)); +} + +moving_averager::~moving_averager() +{ +} + +gr_complex +moving_averager::filter(gr_complex x) +{ + d_out_d1 = d_out; + d_delay_line.push_back(x); + d_out = d_delay_line[0]; + d_delay_line.pop_front(); + + gr_complex y = x - d_out_d1 + d_out_d2; + d_out_d2 = y; + + return (y / (float)(d_length)); +} + + + +gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form) +{ + return gnuradio::get_initial_sptr(new gr_dc_blocker_cc(D, long_form)); +} + + +gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form) + : gr_sync_block ("dc_blocker_cc", + gr_make_io_signature (1, 1, sizeof(gr_complex)), + gr_make_io_signature (1, 1, sizeof(gr_complex))), + d_length(D), d_long_form(long_form) +{ + if(d_long_form) { + d_ma_0 = new moving_averager(D); + d_ma_1 = new moving_averager(D); + d_ma_2 = new moving_averager(D); + d_ma_3 = new moving_averager(D); + d_delay_line = std::deque(d_length-1, gr_complex(0,0)); + } + else { + d_ma_0 = new moving_averager(D); + d_ma_1 = new moving_averager(D); + } +} + +gr_dc_blocker_cc::~gr_dc_blocker_cc() +{ + if(d_long_form) { + delete d_ma_0; + delete d_ma_1; + delete d_ma_2; + delete d_ma_3; + } + else { + delete d_ma_0; + delete d_ma_1; + } +} + +int +gr_dc_blocker_cc::get_group_delay() +{ + if(d_long_form) + return (2*d_length-2); + else + return d_length - 1; +} + +int +gr_dc_blocker_cc::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const gr_complex *in = (const gr_complex*)input_items[0]; + gr_complex *out = (gr_complex*)output_items[0]; + + if(d_long_form) { + gr_complex y1, y2, y3, y4, d; + for(int i = 0; i < noutput_items; i++) { + y1 = d_ma_0->filter(in[i]); + y2 = d_ma_1->filter(y1); + y3 = d_ma_2->filter(y2); + y4 = d_ma_3->filter(y3); + + d_delay_line.push_back(d_ma_0->delayed_sig()); + d = d_delay_line[0]; + d_delay_line.pop_front(); + + out[i] = d - y4; + } + } + else { + gr_complex y1, y2; + for(int i = 0; i < noutput_items; i++) { + y1 = d_ma_0->filter(in[i]); + y2 = d_ma_1->filter(y1); + out[i] = d_ma_0->delayed_sig() - y2; + } + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h new file mode 100644 index 000000000..26a2247ea --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h @@ -0,0 +1,110 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + + +#ifndef INCLUDED_GR_DC_BLOCKER_CC_H +#define INCLUDED_GR_DC_BLOCKER_CC_H + +#include +#include + +class gr_dc_blocker_cc; +typedef boost::shared_ptr gr_dc_blocker_cc_sptr; +gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); + +/*! + * \class gr_dc_blocker_cc + * \brief a computationally efficient controllabel DC blocker + * + * \ingroup filter_blk + * + * This block implements a computationally efficient DC blocker that produces + * a tigher notch filter around DC for a smaller group delay than an + * equivalent FIR filter or using a single pole IIR filter. + * + * The block defaults to using a delay line of length 32 and the long form + * of the filter. Optionally, the delay line length can be changed to alter + * the width of the DC notch (longer lines will decrease the width). + * + * The long form of the filter produces a nearly flat response outside of + * the notch but at the cost of a group delay of 2D-2. + * + * The short form of the filter does not have a flat a response in the + * passband but has a group delay of only D-1 and is cheaper to compute. + * + * The theory behind this block can be found in the paper: + * + * R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, + * Mar. 2008, pp 132-134. + */ +class moving_averager +{ +public: + moving_averager(int D); + ~moving_averager(); + + gr_complex filter(gr_complex x); + gr_complex delayed_sig() { return d_out; } + +private: + int d_length; + gr_complex d_out, d_out_d1, d_out_d2; + std::deque d_delay_line; +}; + +class gr_dc_blocker_cc : public gr_sync_block +{ + private: + /*! + * Build the DC blocker. + * \param D (int) the length of the delay line + * \param long_form (bool) whether to use long (true, default) or short form + * \param channel (unsigned integer) Selects the channel to return [default=0]. + */ + friend gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form); + + int d_length; + bool d_long_form; + moving_averager *d_ma_0; + moving_averager *d_ma_1; + moving_averager *d_ma_2; + moving_averager *d_ma_3; + std::deque d_delay_line; + + gr_dc_blocker_cc (int D, bool long_form); + +public: + ~gr_dc_blocker_cc (); + + /*! + * Get the blocker's group delay that is based on length of delay lines + */ + int get_group_delay(); + + //int set_length(int D); + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i new file mode 100644 index 000000000..b88fecbde --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_cc); + +gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); + +class gr_dc_blocker_cc : public gr_sync_block +{ + private: + gr_dc_blocker_cc (int D, bool long_form); + + public: + ~gr_dc_blocker_cc (); +}; -- cgit From e45053b962d8a8c3d6615950397cb6429a34e336 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 25 May 2011 16:49:57 +0100 Subject: filter: changing name of moving average class to remove name conflicts. --- gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc | 18 +++++++++--------- gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc index 66f59f240..e7d5ced25 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc @@ -28,18 +28,18 @@ #include #include -moving_averager::moving_averager(int D) +moving_averager_c::moving_averager_c(int D) : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) { d_delay_line = std::deque(d_length-1, gr_complex(0,0)); } -moving_averager::~moving_averager() +moving_averager_c::~moving_averager_c() { } gr_complex -moving_averager::filter(gr_complex x) +moving_averager_c::filter(gr_complex x) { d_out_d1 = d_out; d_delay_line.push_back(x); @@ -67,15 +67,15 @@ gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form) d_length(D), d_long_form(long_form) { if(d_long_form) { - d_ma_0 = new moving_averager(D); - d_ma_1 = new moving_averager(D); - d_ma_2 = new moving_averager(D); - d_ma_3 = new moving_averager(D); + d_ma_0 = new moving_averager_c(D); + d_ma_1 = new moving_averager_c(D); + d_ma_2 = new moving_averager_c(D); + d_ma_3 = new moving_averager_c(D); d_delay_line = std::deque(d_length-1, gr_complex(0,0)); } else { - d_ma_0 = new moving_averager(D); - d_ma_1 = new moving_averager(D); + d_ma_0 = new moving_averager_c(D); + d_ma_1 = new moving_averager_c(D); } } diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h index 26a2247ea..8e6164cbd 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h @@ -56,11 +56,11 @@ gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); * R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, * Mar. 2008, pp 132-134. */ -class moving_averager +class moving_averager_c { public: - moving_averager(int D); - ~moving_averager(); + moving_averager_c(int D); + ~moving_averager_c(); gr_complex filter(gr_complex x); gr_complex delayed_sig() { return d_out; } @@ -84,10 +84,10 @@ class gr_dc_blocker_cc : public gr_sync_block int d_length; bool d_long_form; - moving_averager *d_ma_0; - moving_averager *d_ma_1; - moving_averager *d_ma_2; - moving_averager *d_ma_3; + moving_averager_c *d_ma_0; + moving_averager_c *d_ma_1; + moving_averager_c *d_ma_2; + moving_averager_c *d_ma_3; std::deque d_delay_line; gr_dc_blocker_cc (int D, bool long_form); -- cgit From b0b248eadb35bfcca178f97d5ba0160c5d3717eb Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 25 May 2011 16:50:25 +0100 Subject: filter: adding floating point version of DC blocker alg. --- gnuradio-core/src/lib/filter/Makefile.am | 7 +- gnuradio-core/src/lib/filter/filter.i | 2 + gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc | 138 +++++++++++++++++++++++ gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h | 110 ++++++++++++++++++ gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i | 34 ++++++ 5 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h create mode 100644 gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 95489156f..0314079a2 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -217,7 +217,8 @@ libfilter_la_common_SOURCES = \ gr_pfb_arb_resampler_ccf.cc \ gr_pfb_clock_sync_ccf.cc \ gr_pfb_clock_sync_fff.cc \ - gr_dc_blocker_cc.cc + gr_dc_blocker_cc.cc \ + gr_dc_blocker_ff.cc libfilter_qa_la_common_SOURCES = \ qa_filter.cc \ @@ -308,7 +309,8 @@ grinclude_HEADERS = \ gr_pfb_arb_resampler_ccf.h \ gr_pfb_clock_sync_ccf.h \ gr_pfb_clock_sync_fff.h \ - gr_dc_blocker_cc.h + gr_dc_blocker_cc.h \ + gr_dc_blocker_ff.h noinst_HEADERS = \ assembly.h \ @@ -375,6 +377,7 @@ swiginclude_HEADERS = \ gr_pfb_clock_sync_ccf.i \ gr_pfb_clock_sync_fff.i \ gr_dc_blocker_cc.i \ + gr_dc_blocker_ff.i \ $(GENERATED_I) diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i index b8f4d06eb..58bb4f0d5 100644 --- a/gnuradio-core/src/lib/filter/filter.i +++ b/gnuradio-core/src/lib/filter/filter.i @@ -40,6 +40,7 @@ #include #include #include +#include %} %include "gr_iir_filter_ffd.i" @@ -64,5 +65,6 @@ %include "gr_pfb_clock_sync_ccf.i" %include "gr_pfb_clock_sync_fff.i" %include "gr_dc_blocker_cc.i" +%include "gr_dc_blocker_ff.i" %include "filter_generated.i" diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc new file mode 100644 index 000000000..d684bc7e8 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc @@ -0,0 +1,138 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +moving_averager_f::moving_averager_f(int D) + : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) +{ + d_delay_line = std::deque(d_length-1, 0); +} + +moving_averager_f::~moving_averager_f() +{ +} + +float +moving_averager_f::filter(float x) +{ + d_out_d1 = d_out; + d_delay_line.push_back(x); + d_out = d_delay_line[0]; + d_delay_line.pop_front(); + + float y = x - d_out_d1 + d_out_d2; + d_out_d2 = y; + + return (y / (float)(d_length)); +} + + + +gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form) +{ + return gnuradio::get_initial_sptr(new gr_dc_blocker_ff(D, long_form)); +} + + +gr_dc_blocker_ff::gr_dc_blocker_ff (int D, bool long_form) + : gr_sync_block ("dc_blocker_ff", + gr_make_io_signature (1, 1, sizeof(float)), + gr_make_io_signature (1, 1, sizeof(float))), + d_length(D), d_long_form(long_form) +{ + if(d_long_form) { + d_ma_0 = new moving_averager_f(D); + d_ma_1 = new moving_averager_f(D); + d_ma_2 = new moving_averager_f(D); + d_ma_3 = new moving_averager_f(D); + d_delay_line = std::deque(d_length-1, 0); + } + else { + d_ma_0 = new moving_averager_f(D); + d_ma_1 = new moving_averager_f(D); + } +} + +gr_dc_blocker_ff::~gr_dc_blocker_ff() +{ + if(d_long_form) { + delete d_ma_0; + delete d_ma_1; + delete d_ma_2; + delete d_ma_3; + } + else { + delete d_ma_0; + delete d_ma_1; + } +} + +int +gr_dc_blocker_ff::get_group_delay() +{ + if(d_long_form) + return (2*d_length-2); + else + return d_length - 1; +} + +int +gr_dc_blocker_ff::work(int noutput_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]; + + if(d_long_form) { + float y1, y2, y3, y4, d; + for(int i = 0; i < noutput_items; i++) { + y1 = d_ma_0->filter(in[i]); + y2 = d_ma_1->filter(y1); + y3 = d_ma_2->filter(y2); + y4 = d_ma_3->filter(y3); + + d_delay_line.push_back(d_ma_0->delayed_sig()); + d = d_delay_line[0]; + d_delay_line.pop_front(); + + out[i] = d - y4; + } + } + else { + float y1, y2; + for(int i = 0; i < noutput_items; i++) { + y1 = d_ma_0->filter(in[i]); + y2 = d_ma_1->filter(y1); + out[i] = d_ma_0->delayed_sig() - y2; + } + } + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h new file mode 100644 index 000000000..adaaca1e2 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h @@ -0,0 +1,110 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + + +#ifndef INCLUDED_GR_DC_BLOCKER_FF_H +#define INCLUDED_GR_DC_BLOCKER_FF_H + +#include +#include + +class gr_dc_blocker_ff; +typedef boost::shared_ptr gr_dc_blocker_ff_sptr; +gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); + +/*! + * \class gr_dc_blocker_ff + * \brief a computationally efficient controllabel DC blocker + * + * \ingroup filter_blk + * + * This block implements a computationally efficient DC blocker that produces + * a tigher notch filter around DC for a smaller group delay than an + * equivalent FIR filter or using a single pole IIR filter. + * + * The block defaults to using a delay line of length 32 and the long form + * of the filter. Optionally, the delay line length can be changed to alter + * the width of the DC notch (longer lines will decrease the width). + * + * The long form of the filter produces a nearly flat response outside of + * the notch but at the cost of a group delay of 2D-2. + * + * The short form of the filter does not have a flat a response in the + * passband but has a group delay of only D-1 and is cheaper to compute. + * + * The theory behind this block can be found in the paper: + * + * R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, + * Mar. 2008, pp 132-134. + */ +class moving_averager_f +{ +public: + moving_averager_f(int D); + ~moving_averager_f(); + + float filter(float x); + float delayed_sig() { return d_out; } + +private: + int d_length; + float d_out, d_out_d1, d_out_d2; + std::deque d_delay_line; +}; + +class gr_dc_blocker_ff : public gr_sync_block +{ + private: + /*! + * Build the DC blocker. + * \param D (int) the length of the delay line + * \param long_form (bool) whether to use long (true, default) or short form + * \param channel (unsigned integer) Selects the channel to return [default=0]. + */ + friend gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form); + + int d_length; + bool d_long_form; + moving_averager_f *d_ma_0; + moving_averager_f *d_ma_1; + moving_averager_f *d_ma_2; + moving_averager_f *d_ma_3; + std::deque d_delay_line; + + gr_dc_blocker_ff (int D, bool long_form); + +public: + ~gr_dc_blocker_ff (); + + /*! + * Get the blocker's group delay that is based on length of delay lines + */ + int get_group_delay(); + + //int set_length(int D); + + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i new file mode 100644 index 000000000..032145c9e --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + +GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_ff); + +gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); + +class gr_dc_blocker_ff : public gr_sync_block +{ + private: + gr_dc_blocker_ff (int D, bool long_form); + + public: + ~gr_dc_blocker_ff (); +}; -- cgit From 7ed92966c100c0e70152a87ed730750b60f2903f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 2 Jun 2011 11:04:24 -0400 Subject: QA: adding QA code for DC blocker block. Tests impulse response for complex and float, long and short form for each. --- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 1 + .../src/python/gnuradio/gr/qa_dc_blocker.py | 108 +++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am index f1b4ba2b1..45c970227 100644 --- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am @@ -55,6 +55,7 @@ noinst_PYTHON = \ qa_copy.py \ qa_correlate_access_code.py \ qa_delay.py \ + qa_dc_blocker.py \ qa_diff_encoder.py \ qa_diff_phasor_cc.py \ qa_ecc_ccsds_27.py \ diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py new file mode 100755 index 000000000..8977b475a --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# +# Copyright 2011 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. +# + +from gnuradio import gr, gr_unittest + +class test_dc_blocker(gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_001(self): + ''' Test impulse response - long form, cc ''' + src_data = [1,] + 100*[0,] + expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j), + (0.979156494140625+0j), (-0.02081298828125+0j), + (-0.02072429656982422+0j)) + + src = gr.vector_source_c(src_data) + op = gr.dc_blocker_cc(32, True) + dst = gr.vector_sink_c() + + self.tb.connect (src, op, dst) + self.tb.run() + + # only test samples around 2D-2 + result_data = dst.data()[60:65] + self.assertFloatTuplesAlmostEqual (expected_result, result_data) + + def test_002(self): + ''' Test impulse response - short form, cc ''' + src_data = [1,] + 100*[0,] + expected_result = ((-0.029296875+0j), (-0.0302734375+0j), + (0.96875+0j), (-0.0302734375+0j), + (-0.029296875+0j)) + + src = gr.vector_source_c(src_data) + op = gr.dc_blocker_cc(32, False) + dst = gr.vector_sink_c() + + self.tb.connect (src, op, dst) + self.tb.run() + + # only test samples around D-1 + result_data = dst.data()[29:34] + self.assertFloatTuplesAlmostEqual (expected_result, result_data) + + + def test_003(self): + ''' Test impulse response - long form, ff ''' + src_data = [1,] + 100*[0,] + expected_result = ((-0.02072429656982422), (-0.02081298828125), + (0.979156494140625), (-0.02081298828125), + (-0.02072429656982422)) + + src = gr.vector_source_f(src_data) + op = gr.dc_blocker_ff(32, True) + dst = gr.vector_sink_f() + + self.tb.connect (src, op, dst) + self.tb.run() + + # only test samples around 2D-2 + result_data = dst.data()[60:65] + self.assertFloatTuplesAlmostEqual (expected_result, result_data) + + def test_004(self): + ''' Test impulse response - short form, ff ''' + src_data = [1,] + 100*[0,] + expected_result = ((-0.029296875), (-0.0302734375), + (0.96875), (-0.0302734375), + (-0.029296875)) + + src = gr.vector_source_f(src_data) + op = gr.dc_blocker_ff(32, False) + dst = gr.vector_sink_f() + + self.tb.connect (src, op, dst) + self.tb.run() + + # only test samples around D-1 + result_data = dst.data()[29:34] + self.assertFloatTuplesAlmostEqual (expected_result, result_data) + +if __name__ == '__main__': + gr_unittest.run(test_dc_blocker, "test_dc_blocker.xml") + -- cgit From 7829d145d3a00b64a9e203008a6ea4847e966388 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 2 Jun 2011 11:11:17 -0400 Subject: core: fixed documentation for dc blocker. --- gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h | 5 +++-- gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h index 8e6164cbd..de9ccc0ea 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h @@ -39,7 +39,8 @@ gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); * * This block implements a computationally efficient DC blocker that produces * a tigher notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter. + * equivalent FIR filter or using a single pole IIR filter (though the IIR + * filter is computationally cheaper). * * The block defaults to using a delay line of length 32 and the long form * of the filter. Optionally, the delay line length can be changed to alter @@ -48,7 +49,7 @@ gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); * The long form of the filter produces a nearly flat response outside of * the notch but at the cost of a group delay of 2D-2. * - * The short form of the filter does not have a flat a response in the + * The short form of the filter does not have as flat a response in the * passband but has a group delay of only D-1 and is cheaper to compute. * * The theory behind this block can be found in the paper: diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h index adaaca1e2..b632d81da 100644 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h +++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h @@ -39,7 +39,8 @@ gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); * * This block implements a computationally efficient DC blocker that produces * a tigher notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter. + * equivalent FIR filter or using a single pole IIR filter (though the IIR + * filter is computationally cheaper). * * The block defaults to using a delay line of length 32 and the long form * of the filter. Optionally, the delay line length can be changed to alter @@ -48,7 +49,7 @@ gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); * The long form of the filter produces a nearly flat response outside of * the notch but at the cost of a group delay of 2D-2. * - * The short form of the filter does not have a flat a response in the + * The short form of the filter does not have as flat a response in the * passband but has a group delay of only D-1 and is cheaper to compute. * * The theory behind this block can be found in the paper: -- cgit