diff options
author | Eric Blossom <eb@comsec.com> | 2010-10-23 19:53:03 -0700 |
---|---|---|
committer | Eric Blossom <eb@comsec.com> | 2010-11-10 12:13:53 -0800 |
commit | 5939ce6971607b83b33c2ac0ede627a83670113a (patch) | |
tree | 908c85c8bbedce143ede3b32f531263c60561a0b /gnuradio-core/src/lib/swig/guile | |
parent | 0a81b7d48de58cd83f7076fb9bd45cf30595c9ec (diff) |
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.
Diffstat (limited to 'gnuradio-core/src/lib/swig/guile')
-rw-r--r-- | gnuradio-core/src/lib/swig/guile/std_complex.i | 30 |
1 files changed, 30 insertions, 0 deletions
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 0000000000..cafcfeae3a --- /dev/null +++ b/gnuradio-core/src/lib/swig/guile/std_complex.i @@ -0,0 +1,30 @@ +%{ +#include <complex> +%} + +// To the target language, complex number conversion +%typemap(out) complex, complex<double>, std::complex<double> { + $result = scm_make_rectangular( gh_double2scm ($1.real ()), + gh_double2scm ($1.imag ()) ); +} + +// To the target language, complex number conversion +%typemap(out) complex, complex<float>, std::complex<float> { + $result = scm_make_rectangular( gh_double2scm ($1.real ()), + gh_double2scm ($1.imag ()) ); +} + +// From the target language, complex number conversion +%typemap(in) complex, complex<double>, std::complex<double> { + $1 = std::complex<double>( gh_scm2double (scm_real_part ($input)), + gh_scm2double (scm_imag_part ($input)) ); +} + +// From the target language, complex number conversion +%typemap(in) complex, complex<float>, std::complex<float> { + $1 = std::complex<float>( gh_scm2double (scm_real_part ($input)), + gh_scm2double (scm_imag_part ($input)) ); +} + +%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>); +%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>); |