discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gr-uhd swig troubles


From: Josh Blum
Subject: Re: [Discuss-gnuradio] gr-uhd swig troubles
Date: Wed, 20 Apr 2011 10:13:15 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8


On 04/20/2011 10:02 AM, Moritz Fischer wrote:
> On Wed, Apr 20, 2011 at 06:28:45PM +0200, Josh Blum wrote:
>> What do other gnuradio enums give you?
>>
>> python -c "from gnuradio import gr; print type(gr.GR_COS_WAVE)"
>>
>> Can you create a gr.sig_source?
> Yeah, it's a <type 'int'>
> 

I think I see why:

> //! Complex floating point (64-bit floats) range [-1.0, +1.0]
> COMPLEX_FLOAT64 = 'd',
> //! Complex floating point (32-bit floats) range [-1.0, +1.0]
> COMPLEX_FLOAT32 = 'f',
> //! Complex signed integer (16-bit integers) range [-32768, +32767]
> COMPLEX_INT16 =   's',
> //! Complex signed integer (8-bit integers) range [-128, 127]
> COMPLEX_INT8 =    'b'

Swig 2 is interpreting that as a string. Which in kind of nice, except
that things that use those enums in python expect type int.

I dont know the magical swig switch to turn that off. Does this diff
make it work for you?

> diff --git a/host/include/uhd/types/io_type.hpp 
> b/host/include/uhd/types/io_type.hpp
> index 990d701..ace643a 100644
> --- a/host/include/uhd/types/io_type.hpp
> +++ b/host/include/uhd/types/io_type.hpp
> @@ -34,15 +34,15 @@ namespace uhd{
>           */
>          enum tid_t{
>              //! Custom type (technically unsupported by implementation)
> -            CUSTOM_TYPE =     '?',
> +            CUSTOM_TYPE =     int('?'),
>              //! Complex floating point (64-bit floats) range [-1.0, +1.0]
> -            COMPLEX_FLOAT64 = 'd',
> +            COMPLEX_FLOAT64 = int('d'),
>              //! Complex floating point (32-bit floats) range [-1.0, +1.0]
> -            COMPLEX_FLOAT32 = 'f',
> +            COMPLEX_FLOAT32 = int('f'),
>              //! Complex signed integer (16-bit integers) range [-32768, 
> +32767]
> -            COMPLEX_INT16 =   's',
> +            COMPLEX_INT16 =   int('s'),
>              //! Complex signed integer (8-bit integers) range [-128, 127]
> -            COMPLEX_INT8 =    'b'
> +            COMPLEX_INT8 =    int('b')
>          };

-Josh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]