Lib/octave: replace is_cell() with iscell() for Octave >= 4.4
This commit is contained in:
parent
a46909a414
commit
358345db9e
4 changed files with 43 additions and 5 deletions
|
|
@ -567,7 +567,11 @@ namespace swig {
|
||||||
if (seq) *seq = p;
|
if (seq) *seq = p;
|
||||||
return SWIG_OLDOBJ;
|
return SWIG_OLDOBJ;
|
||||||
}
|
}
|
||||||
|
%#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
} else if (obj.iscell()) {
|
||||||
|
%#else
|
||||||
} else if (obj.is_cell()) {
|
} else if (obj.is_cell()) {
|
||||||
|
%#endif
|
||||||
try {
|
try {
|
||||||
OctSequence_Cont<value_type> octseq(obj);
|
OctSequence_Cont<value_type> octseq(obj);
|
||||||
if (seq) {
|
if (seq) {
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,13 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsCharPtrAndSize(octave_value ov, char** cptr, size_t* psize, int *alloc)
|
SWIG_AsCharPtrAndSize(octave_value ov, char** cptr, size_t* psize, int *alloc)
|
||||||
{
|
{
|
||||||
if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
|
if (
|
||||||
|
%#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
ov.iscell()
|
||||||
|
%#else
|
||||||
|
ov.is_cell()
|
||||||
|
%#endif
|
||||||
|
&& ov.rows() == 1 && ov.columns() == 1)
|
||||||
ov = ov.cell_value()(0);
|
ov = ov.cell_value()(0);
|
||||||
if (!ov.is_string())
|
if (!ov.is_string())
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||||
return dim_vector(1,1);
|
return dim_vector(1,1);
|
||||||
|
|
||||||
// Return value should be cell or matrix of integers
|
// Return value should be cell or matrix of integers
|
||||||
|
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
if (out.iscell()) {
|
||||||
|
#else
|
||||||
if (out.is_cell()) {
|
if (out.is_cell()) {
|
||||||
|
#endif
|
||||||
const Cell & c=out.cell_value();
|
const Cell & c=out.cell_value();
|
||||||
int ndim = c.rows();
|
int ndim = c.rows();
|
||||||
if (ndim==1 && c.columns()!=1) ndim = c.columns();
|
if (ndim==1 && c.columns()!=1) ndim = c.columns();
|
||||||
|
|
@ -1238,7 +1242,13 @@ namespace Swig {
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME octave_swig_type *swig_value_deref(octave_value ov) {
|
SWIGRUNTIME octave_swig_type *swig_value_deref(octave_value ov) {
|
||||||
if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
|
if (
|
||||||
|
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
ov.iscell()
|
||||||
|
#else
|
||||||
|
ov.is_cell()
|
||||||
|
#endif
|
||||||
|
&& ov.rows() == 1 && ov.columns() == 1)
|
||||||
ov = ov.cell_value()(0);
|
ov = ov.cell_value()(0);
|
||||||
return swig_value_deref(*ov.internal_rep());
|
return swig_value_deref(*ov.internal_rep());
|
||||||
}
|
}
|
||||||
|
|
@ -1357,7 +1367,13 @@ SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *ty
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) {
|
SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) {
|
||||||
if (ov.is_cell() && ov.rows() == 1 && ov.columns() == 1)
|
if (
|
||||||
|
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
ov.iscell()
|
||||||
|
#else
|
||||||
|
ov.is_cell()
|
||||||
|
#endif
|
||||||
|
&& ov.rows() == 1 && ov.columns() == 1)
|
||||||
ov = ov.cell_value()(0);
|
ov = ov.cell_value()(0);
|
||||||
if (!ov.is_defined() ||
|
if (!ov.is_defined() ||
|
||||||
(ov.is_matrix_type() && ov.rows() == 0 && ov.columns() == 0) ) {
|
(ov.is_matrix_type() && ov.rows() == 0 && ov.columns() == 0) ) {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asval(const octave_value& obj, std::pair<T,U> *val) {
|
static int asval(const octave_value& obj, std::pair<T,U> *val) {
|
||||||
if (obj.is_cell()) {
|
if (
|
||||||
|
%#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
obj.iscell()
|
||||||
|
%#else
|
||||||
|
obj.is_cell()
|
||||||
|
%#endif
|
||||||
|
) {
|
||||||
Cell c=obj.cell_value();
|
Cell c=obj.cell_value();
|
||||||
if (c.numel()<2) {
|
if (c.numel()<2) {
|
||||||
error("pair from Cell array requires at least two elements");
|
error("pair from Cell array requires at least two elements");
|
||||||
|
|
@ -96,7 +102,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asptr(const octave_value& obj, std::pair<T,U> **val) {
|
static int asptr(const octave_value& obj, std::pair<T,U> **val) {
|
||||||
if (obj.is_cell()) {
|
if (
|
||||||
|
%#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||||
|
obj.iscell()
|
||||||
|
%#else
|
||||||
|
obj.is_cell()
|
||||||
|
%#endif
|
||||||
|
) {
|
||||||
Cell c=obj.cell_value();
|
Cell c=obj.cell_value();
|
||||||
if (c.numel()<2) {
|
if (c.numel()<2) {
|
||||||
error("pair from Cell array requires at least two elements");
|
error("pair from Cell array requires at least two elements");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue