1 /* ----------------------------------------------------------------------------- 2 * ccomplex.i 3 * 4 * C complex typemaps 5 * ISO C99: 7.3 Complex arithmetic <complex.h> 6 * ----------------------------------------------------------------------------- */ 7 8 9 %include <pycomplex.swg> 10 11 %{ 12 #include <complex.h> 13 %} 14 15 16 /* C complex constructor */ 17 #define CCplxConst(r, i) ((r) + I*(i)) 18 19 %swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); 20 %swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); 21 %swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); 22 23 /* declaring the typemaps */ 24 %typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); 25 %typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); 26 %typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex); 27