Fixes to two bugs in Lib/octave/octcomplex.swg (by Karl Wette)
* replace PyObject with octave_value in the SWIG_AsVal(float) fragment * modify %swig_fromcplx_conv to use the correct Octave constructor for double (Complex) and float (FloatComplex) Also remove an unneeded %ifcplusplus (Octave wrapping code is always in C++). Checked that %swig_cplxflt_convn now compiles correctly for single-precision complex values, and that make check-octave-examples passes. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12671 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8848b16e01
commit
a3689a02fc
1 changed files with 7 additions and 10 deletions
|
|
@ -4,17 +4,17 @@
|
||||||
the complex Constructor method, and the Real and Imag complex
|
the complex Constructor method, and the Real and Imag complex
|
||||||
accesor methods.
|
accesor methods.
|
||||||
|
|
||||||
See the std_complex.i and ccomplex.i for concret examples.
|
See the std_complex.i and ccomplex.i for concrete examples.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* the common from conversor */
|
/* the common from conversor */
|
||||||
%define %swig_fromcplx_conv(Type, Real, Imag)
|
%define %swig_fromcplx_conv(Type, OctConstructor, Real, Imag)
|
||||||
%fragment(SWIG_From_frag(Type),"header")
|
%fragment(SWIG_From_frag(Type),"header")
|
||||||
{
|
{
|
||||||
SWIGINTERNINLINE octave_value
|
SWIGINTERNINLINE octave_value
|
||||||
SWIG_From(Type)(%ifcplusplus(const Type&, Type) c)
|
SWIG_From(Type)(const Type& c)
|
||||||
{
|
{
|
||||||
return octave_value(Complex(Real(c), Imag(c)));
|
return octave_value(OctConstructor(Real(c), Imag(c)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%swig_fromcplx_conv(Type, Real, Imag);
|
%swig_fromcplx_conv(Type, Complex, Real, Imag);
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
// the float case
|
// the float case
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
%fragment(SWIG_AsVal_frag(Type),"header",
|
%fragment(SWIG_AsVal_frag(Type),"header",
|
||||||
fragment=SWIG_AsVal_frag(float)) {
|
fragment=SWIG_AsVal_frag(float)) {
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal(Type)(PyObject *o, Type *val)
|
SWIG_AsVal(Type) (const octave_value& ov, Type* val)
|
||||||
{
|
{
|
||||||
if (ov.is_complex_scalar()) {
|
if (ov.is_complex_scalar()) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%swig_fromcplx_conv(Type, Real, Imag);
|
%swig_fromcplx_conv(Type, FloatComplex, Real, Imag);
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
|
#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
|
||||||
|
|
@ -90,6 +90,3 @@
|
||||||
|
|
||||||
#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
|
#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
|
||||||
%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
|
%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue