Lib/octave: replace is_cell() with iscell() for Octave >= 4.4

This commit is contained in:
Karl Wette 2018-05-10 20:32:50 +10:00
commit 358345db9e
4 changed files with 43 additions and 5 deletions

View file

@ -567,7 +567,11 @@ namespace swig {
if (seq) *seq = p;
return SWIG_OLDOBJ;
}
%#if SWIG_OCTAVE_PREREQ(4,4,0)
} else if (obj.iscell()) {
%#else
} else if (obj.is_cell()) {
%#endif
try {
OctSequence_Cont<value_type> octseq(obj);
if (seq) {

View file

@ -214,7 +214,13 @@ SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
SWIGINTERN int
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);
if (!ov.is_string())
return SWIG_TypeError;

View file

@ -383,7 +383,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
return dim_vector(1,1);
// Return value should be cell or matrix of integers
#if SWIG_OCTAVE_PREREQ(4,4,0)
if (out.iscell()) {
#else
if (out.is_cell()) {
#endif
const Cell & c=out.cell_value();
int ndim = c.rows();
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) {
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);
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) {
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);
if (!ov.is_defined() ||
(ov.is_matrix_type() && ov.rows() == 0 && ov.columns() == 0) ) {

View file

@ -38,7 +38,13 @@
}
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();
if (c.numel()<2) {
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) {
if (obj.is_cell()) {
if (
%#if SWIG_OCTAVE_PREREQ(4,4,0)
obj.iscell()
%#else
obj.is_cell()
%#endif
) {
Cell c=obj.cell_value();
if (c.numel()<2) {
error("pair from Cell array requires at least two elements");