Skip to content

Commit 1a66014

Browse files
committed
pure-octave: Fixes for Octave 5.x compatibility.
1 parent 54bdfd4 commit 1a66014

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pure-octave/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ octversion = $(shell $(mkoctfile) --version 2>&1 | sed -e 's/^mkoctfile, version
3434
octversionflag = -DOCTAVE_MAJOR=$(word 1,$(octversion)) -DOCTAVE_MINOR=$(word 2,$(octversion))
3535

3636
# Add the -rpath flag so that the dynamic linker finds liboctave.so etc. when
37-
# Pure loads the module.
37+
# Pure loads the module. NOTE: This doesn't seem to be needed any more.
3838
RLD_FLAG=$(shell $(mkoctfile) -p RLD_FLAG)
3939

40+
# Octave 5.1 doesn't automatically include these linker options any more.
41+
OCT_FLAGS=-L$(shell $(mkoctfile) -p OCTLIBDIR) $(shell $(mkoctfile) -p LIBOCTINTERP) $(shell $(mkoctfile) -p LIBOCTAVE)
42+
4043
DISTFILES = COPYING Makefile README embed.cc embed.h \
4144
gsl_structs.h gnuplot.pure octave.pure debian/* examples/*.pure
4245
SEDFILES = README
@@ -68,7 +71,7 @@ octave_embed$(DLL): embed.cc embed.h
6871
else
6972
octave_embed$(DLL): embed.cc embed.h
7073
rm -f $@
71-
$(mkoctfile) -v $(octversionflag) -o $@ $< -lpure $(RLD_FLAG)
74+
$(mkoctfile) -v $(octversionflag) -o $@ $< -lpure $(RLD_FLAG) $(OCT_FLAGS)
7275
if test -f $@.oct; then mv $@.oct $@; fi
7376
endif
7477
endif

pure-octave/embed.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ extern "C" void octave_restore_signal_mask (void);
6161
#define octave_interrupt_exception octave::interrupt_exception
6262
#define octave_execution_exception octave::execution_exception
6363
#if OCTAVE_MAJOR>4 || OCTAVE_MAJOR>=4 && OCTAVE_MINOR>=3
64+
#if OCTAVE_MAJOR<=4
6465
#define eval_string octave::eval_string
66+
#endif
6567
#define feval octave::feval
6668
#endif
6769
#endif
@@ -237,7 +239,12 @@ int octave_eval(const char *cmd)
237239
// XXXFIXME: eval_string() just always segfaults with Octave 4.2.0+. No
238240
// workaround for this is known yet. Octave 4.0 and 4.3 seem to be ok,
239241
// though, so just stick to one of these until this is fixed.
242+
#if OCTAVE_MAJOR>4
243+
const std::string cmd_s = cmd;
244+
embedded_interpreter->eval_string(cmd_s, false, parse_status, 0);
245+
#else
240246
eval_string(cmd, false, parse_status, 0);
247+
#endif
241248
} catch (octave_interrupt_exception) {
242249
recover ();
243250
std::cout << "\n";

0 commit comments

Comments
 (0)