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

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to