Skip to content

Commit

Permalink
Merge pull request #1256 from kwwette/octave
Browse files Browse the repository at this point in the history
[Octave] Add support for version 4.4
  • Loading branch information
kwwette committed May 17, 2018
2 parents fecc4f2 + e66827b commit 12c66f9
Show file tree
Hide file tree
Showing 11 changed files with 276 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ matrix:
env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.2 CPP11=1
sudo: required
dist: trusty
- compiler: gcc
os: linux
env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.4 CPP11=1
sudo: required
dist: trusty
- compiler: gcc
os: linux
env: SWIGLANG=perl5
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.current
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.0 (in progress)
===========================

2018-05-15: kwwette
[Octave] add support for version 4.4
- Should not introduce any user-visible incompatibilities

2018-05-15: wsfulton
[C#, D, Java] Fix lookup of csconstruct, dconstruct and javaconstruct typemaps.
The C++ namespace was previously ignored when looking up the typemap.
Expand Down
2 changes: 1 addition & 1 deletion Examples/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ octave_cpp: $(SRCDIR_SRCS)
# -----------------------------------------------------------------

octave_run:
OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)
env OCTAVE_PATH= OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)

# -----------------------------------------------------------------
# Version display
Expand Down
65 changes: 39 additions & 26 deletions Examples/octave/module_load/runme.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,73 @@

# load module
clear all;
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
clear all
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
clear all

# load module in a function globally before base context
clear all;
function testme
function testme_1
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
endfunction
testme
testme
testme_1
testme_1
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
clear all
function testme
function testme_2
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
endfunction
testme
testme
testme_2
testme_2
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
clear all

# load module in a function globally after base context
clear all;
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
function testme
function testme_3
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
endfunction
testme
testme
testme_3
testme_3
clear all
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
function testme
function testme_4
assert(exist("swigexample") == 3);
swigexample;
assert(isglobal("swigexample"));
assert(cvar.ivar == ifunc);
assert(exist("swigexample","var"));
endfunction
testme
testme
testme_4
testme_4
clear all

# octave 3.0.5 randomly crashes on the remaining tests
Expand All @@ -71,13 +81,16 @@

# load module with no cvar
clear all;
who;
assert(exist("swigexample2") == 3);
swigexample2;
assert(isglobal("swigexample2"));
assert(swigexample2.ivar == ifunc);
assert(exist("swigexample2","var"));
assert(!isglobal("cvar"))
assert(!exist("cvar", "var"));
clear all
assert(exist("swigexample2") == 3);
swigexample2;
assert(isglobal("swigexample2"));
assert(swigexample2.ivar == ifunc);
assert(exist("swigexample2","var"));
assert(!isglobal("cvar"))
assert(!exist("cvar", "var"));
clear all
2 changes: 1 addition & 1 deletion Examples/test-suite/octave/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CSRCS = octave_empty.c
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir) OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi

# Clean: remove the generated .m file
Expand Down
4 changes: 2 additions & 2 deletions Examples/test-suite/register_par.i
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
%module register_par

%{
struct tree;
struct swig_tree;
%}

// bug # 924413
%inline {
void clear_tree_flags(register struct tree *tp, register int i) {}
void clear_tree_flags(register struct swig_tree *tp, register int i) {}
}
4 changes: 4 additions & 0 deletions Lib/octave/octcontainer.swg
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 11 additions & 1 deletion Lib/octave/octprimtypes.swg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ SWIGINTERNINLINE octave_value
SWIGINTERN int
SWIG_AsVal_dec(bool)(const octave_value& ov, bool *val)
{
%#if SWIG_OCTAVE_PREREQ(4,4,0)
if (!ov.islogical())
%#else
if (!ov.is_bool_type())
%#endif
return SWIG_ERROR;
if (val)
*val = ov.bool_value();
Expand Down Expand Up @@ -214,7 +218,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;
Expand Down
Loading

0 comments on commit 12c66f9

Please sign in to comment.