Re: [Discuss-gnuradio] py_msg_queue__delete_head

2014-05-11 Thread Tom Rondeau
On Sat, May 10, 2014 at 10:22 PM, chenjian josnche...@gmail.com wrote:

 Hi, All

 I check the code in GNURadio 3.7.3,
  gnuradio-3.7.3/gnuradio-runtime/swig/msg_queue.i

 the code:
  83 #ifdef SWIGPYTHON
  84 %inline %{
  85   gr::message::sptr py_msg_queue__delete_head(gr::msg_queue::sptr q) {
  86 gr::message::sptr msg;
  87 GR_PYTHON_BLOCKING_CODE(
  88 msg = q-delete_head();
  89 )
  90 return msg;
  91   }
  92
  93   void py_msg_queue__insert_tail(gr::msg_queue::sptr q,
 gr::message::sptr msg) {
  94 GR_PYTHON_BLOCKING_CODE(
  95 q-insert_tail(msg);
  96 )
  97   }
  98 %}

 output is located in  gnuradio-runtime/swig/runtime_swig.py
 the output is like:
 3791 def py_msg_queue__delete_head(*args, **kwargs):
 3792   py_msg_queue__delete_head(sptr q) - sptr
 3793   return _runtime_swig.py_msg_queue__delete_head(*args, **kwargs)
 3794
 3795 def py_msg_queue__insert_tail(*args, **kwargs):
 3796   py_msg_queue__insert_tail(sptr q, sptr msg)
 3797   return _runtime_swig.py_msg_queue__insert_tail(*args, **kwargs)

 *Of course, the above in the gnuradio is work well.*

 I could not understand these swig output. so I write a small .i file to
 test this
   1 /* -*- c -*- */
   2 // swig2.0 -python *.i
   3 //swig2.0 -python -v -c++ *.i
   4
   5 %module(directors=1) util_swig
   6
   7 #ifdef SWIGPYTHON
   8
   9
  10 %inline %{
  11   int fun1(int q) {
  12 return q;
  13   }
  14 %}
  15
  16 #endif

 but there is one more line (see line 73  )  in the output file *.py

  71 def fun1(*args):
  72   return _util_swig.fun1(*args)
  73 fun1 = _util_swig.fun1
  74 # This file is compatible with both classic and new-style classes.

 Is it some configuration in other place lead the output to be different
 from the standard swig command ?

 Thanks  Best Regards.


We are not meant to understand the workings of SWIG...

But seriously, this is a SWIG question and not a GNU Radio question. Best
ask the SWIG developers.

Tom
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] py_msg_queue__delete_head

2014-05-10 Thread chenjian
Hi, All

I check the code in GNURadio 3.7.3,
 gnuradio-3.7.3/gnuradio-runtime/swig/msg_queue.i

the code:
 83 #ifdef SWIGPYTHON
 84 %inline %{
 85   gr::message::sptr py_msg_queue__delete_head(gr::msg_queue::sptr q) {
 86 gr::message::sptr msg;
 87 GR_PYTHON_BLOCKING_CODE(
 88 msg = q-delete_head();
 89 )
 90 return msg;
 91   }
 92
 93   void py_msg_queue__insert_tail(gr::msg_queue::sptr q,
gr::message::sptr msg) {
 94 GR_PYTHON_BLOCKING_CODE(
 95 q-insert_tail(msg);
 96 )
 97   }
 98 %}

output is located in  gnuradio-runtime/swig/runtime_swig.py
the output is like:
3791 def py_msg_queue__delete_head(*args, **kwargs):
3792   py_msg_queue__delete_head(sptr q) - sptr
3793   return _runtime_swig.py_msg_queue__delete_head(*args, **kwargs)
3794
3795 def py_msg_queue__insert_tail(*args, **kwargs):
3796   py_msg_queue__insert_tail(sptr q, sptr msg)
3797   return _runtime_swig.py_msg_queue__insert_tail(*args, **kwargs)

*Of course, the above in the gnuradio is work well.*

I could not understand these swig output. so I write a small .i file to
test this
  1 /* -*- c -*- */
  2 // swig2.0 -python *.i
  3 //swig2.0 -python -v -c++ *.i
  4
  5 %module(directors=1) util_swig
  6
  7 #ifdef SWIGPYTHON
  8
  9
 10 %inline %{
 11   int fun1(int q) {
 12 return q;
 13   }
 14 %}
 15
 16 #endif

but there is one more line (see line 73  )  in the output file *.py

 71 def fun1(*args):
 72   return _util_swig.fun1(*args)
 73 fun1 = _util_swig.fun1
 74 # This file is compatible with both classic and new-style classes.

Is it some configuration in other place lead the output to be different
from the standard swig command ?

Thanks  Best Regards.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio