Differentiate complex and real scalar types.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
652cf605fa
commit
316a2decd7
2 changed files with 11 additions and 1 deletions
|
|
@ -374,7 +374,7 @@ can be used from Octave like this
|
|||
<pre>octave:1> example;
|
||||
octave:2> p1=example.Point(3,5);
|
||||
octave:3> p2=example.Point(1,2);
|
||||
octave:3> p1.distance(p2)
|
||||
octave:4> p1.distance(p2)
|
||||
ans = 3.6056
|
||||
</pre></div>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
|||
{
|
||||
if (!ov.is_scalar_type())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_complex_scalar())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_double_type()||ov.is_single_type()) {
|
||||
double v=ov.double_value();
|
||||
if (v!=floor(v))
|
||||
|
|
@ -67,6 +69,8 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
|||
{
|
||||
if (!ov.is_scalar_type())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_complex_scalar())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_double_type()||ov.is_single_type()) {
|
||||
double v=ov.double_value();
|
||||
if (v<0)
|
||||
|
|
@ -106,6 +110,8 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
|||
{
|
||||
if (!ov.is_scalar_type())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_complex_scalar())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_double_type()||ov.is_single_type()) {
|
||||
double v=ov.double_value();
|
||||
if (v!=floor(v))
|
||||
|
|
@ -135,6 +141,8 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
|||
{
|
||||
if (!ov.is_scalar_type())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_complex_scalar())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_double_type()||ov.is_single_type()) {
|
||||
double v=ov.double_value();
|
||||
if (v<0)
|
||||
|
|
@ -180,6 +188,8 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
|||
{
|
||||
if (!ov.is_scalar_type())
|
||||
return SWIG_TypeError;
|
||||
if (ov.is_complex_scalar())
|
||||
return SWIG_TypeError;
|
||||
if (val)
|
||||
*val = ov.double_value();
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue