Skip to content

Commit

Permalink
pure-octave: Fixes for Octave 5.x compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
agraef committed Aug 13, 2019
1 parent 54bdfd4 commit 1a66014
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pure-octave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ octversion = $(shell $(mkoctfile) --version 2>&1 | sed -e 's/^mkoctfile, version
octversionflag = -DOCTAVE_MAJOR=$(word 1,$(octversion)) -DOCTAVE_MINOR=$(word 2,$(octversion))

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

# Octave 5.1 doesn't automatically include these linker options any more.
OCT_FLAGS=-L$(shell $(mkoctfile) -p OCTLIBDIR) $(shell $(mkoctfile) -p LIBOCTINTERP) $(shell $(mkoctfile) -p LIBOCTAVE)

DISTFILES = COPYING Makefile README embed.cc embed.h \
gsl_structs.h gnuplot.pure octave.pure debian/* examples/*.pure
SEDFILES = README
Expand Down Expand Up @@ -68,7 +71,7 @@ octave_embed$(DLL): embed.cc embed.h
else
octave_embed$(DLL): embed.cc embed.h
rm -f $@
$(mkoctfile) -v $(octversionflag) -o $@ $< -lpure $(RLD_FLAG)
$(mkoctfile) -v $(octversionflag) -o $@ $< -lpure $(RLD_FLAG) $(OCT_FLAGS)
if test -f $@.oct; then mv $@.oct $@; fi
endif
endif
Expand Down
7 changes: 7 additions & 0 deletions pure-octave/embed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ extern "C" void octave_restore_signal_mask (void);
#define octave_interrupt_exception octave::interrupt_exception
#define octave_execution_exception octave::execution_exception
#if OCTAVE_MAJOR>4 || OCTAVE_MAJOR>=4 && OCTAVE_MINOR>=3
#if OCTAVE_MAJOR<=4
#define eval_string octave::eval_string
#endif
#define feval octave::feval
#endif
#endif
Expand Down Expand Up @@ -237,7 +239,12 @@ int octave_eval(const char *cmd)
// XXXFIXME: eval_string() just always segfaults with Octave 4.2.0+. No
// workaround for this is known yet. Octave 4.0 and 4.3 seem to be ok,
// though, so just stick to one of these until this is fixed.
#if OCTAVE_MAJOR>4
const std::string cmd_s = cmd;
embedded_interpreter->eval_string(cmd_s, false, parse_status, 0);
#else
eval_string(cmd, false, parse_status, 0);
#endif
} catch (octave_interrupt_exception) {
recover ();
std::cout << "\n";
Expand Down

0 comments on commit 1a66014

Please sign in to comment.