Recursive call

Hello All,

I’m trying manage a vector of 10528 bytes, I made a C++ routine and
works
but, when I work with my routine in GNU Radio, It do really extrange
things
and I don’t know why. I try to explain:

My Routine in GNU is:

ex_scramb_ss::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{

    const unsigned char *mpeg2package = (const unsigned char *)

input_items[0];
unsigned char *mpeg2packageout = (unsigned char *)
output_items[0];

    unsigned char result

;

printf (“hello”);
for (short i=0;i<10528;i++){
result=mpeg2package[i];



}
}

And my test in python is:

from gnuradio import gr, gr_unittest
import ex

class qa_ex (gr_unittest.TestCase):

def setUp (self):
    self.tb = gr.top_block ()

def tearDown (self):
    self.tb = None

def test_001_escramb_ss (self):

src_data=(0x47, 0xA7, 0x15, 0x38......(10528))
src = gr.vector_source_b (src_data)
dst = gr.vector_sink_b ()
sqr = ex.suma_ss ()
self.tb.connect (src, (sqr,0))
self.tb.connect (sqr, dst)
self.tb.run ()
result_data = dst.data ()

if name == ‘main’:
gr_unittest.main ()

Ok, I put printf(“hello”) and hello is printed 4 times and I don’t know
why,
only I connect one time my block, besides, when I print mpeg2package[i],
my
entry, is printed 4 times and with diferents value (71 0 0 184), this
isn’t
sense because I don’t modify, and I can’t, my entry


View this message in context:
http://old.nabble.com/Recursive-call-tp26872871p26872871.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Dec 21, 2009 at 03:41:16AM -0800, Chris_Spain wrote:

         gr_vector_int &ninput_items,

Ok, I put printf(“hello”) and hello is printed 4 times and I don’t know why,
only I connect one time my block, besides, when I print mpeg2package[i], my
entry, is printed 4 times and with diferents value (71 0 0 184), this isn’t
sense because I don’t modify, and I can’t, my entry

It’s perfectly normal for your general_work function to be called more
than once.

Which GNU Radio class are you subclassing?
Why did you choose that one?
If reasonably short (< 200 lines), please post your .h and .cc file,
or post a link to it instead.

Eric