Octave patches for 3.4.0 compatibility, etc. (sf 3387394, thanks for Karl Wette)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12774 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Xavier Delacour 2011-08-08 21:41:34 +00:00
commit dae9457962
20 changed files with 49 additions and 16 deletions

View file

@ -333,6 +333,7 @@ python_clean:
# Make sure these locate your Octave installation
OCTAVE_INCLUDE= $(DEFS) @OCTAVEEXT@
OCTAVE_LIB =
OCTAVE = @OCTAVE@
# Extra Octave specific dynamic linking options
OCTAVE_DLNK = @OCTAVEDYNAMICLINKING@
@ -358,6 +359,15 @@ octave_cpp: $(SRCS)
$(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
$(CXXSHARED) -g $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# -----------------------------------------------------------------
# Running an Octave example
# -----------------------------------------------------------------
OCTSCRIPT = runme.m
octave_run: $(OCTSCRIPT)
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):$$OCTAVEPATH $(OCTAVE) $(OCTSCRIPT) >/dev/null
# -----------------------------------------------------------------
# Cleaning the octave examples
# -----------------------------------------------------------------

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).m
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -10,13 +10,13 @@
/* An output method that turns a complex into a short string */
%extend ComplexVal {
char *__str() {
char *__str__() {
static char temp[512];
sprintf(temp,"(%g,%g)", $self->re(), $self->im());
return temp;
}
ComplexVal __paren(int j) {
ComplexVal __paren__(int j) {
return ComplexVal($self->re()*j,$self->im()*j);
}
};

View file

@ -4,21 +4,21 @@ example
a = example.ComplexVal(2,3);
b = example.ComplexVal(-5,10);
printf("a = %s\n",a);
printf("b = %s\n",b);
printf("a = %s\n",disp(a));
printf("b = %s\n",disp(b));
c = a + b;
printf("c = %s\n",c);
printf("a*b = %s\n",a*b);
printf("a-c = %s\n",a-c);
printf("c = %s\n",disp(c));
printf("a*b = %s\n",disp(a*b));
printf("a-c = %s\n",disp(a-c));
e = example.ComplexVal(a-c);
printf("e = %s\n",e);
printf("e = %s\n",disp(e));
# Big expression
f = ((a+b)*(c+b*e)) + (-a);
printf("f = %s\n",f);
printf("f = %s\n",disp(f));
# paren overloading
printf("a(3)= %s\n",a(3));
printf("a(3)= %s\n",disp(a(3)));

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile octave_run

View file

@ -399,6 +399,10 @@ namespace Swig {
Swig::erase_rtdir(types[j].second.ptr);
}
dim_vector dims(void) const {
return dim_vector(1,1);
}
octave_value as_value() {
++count;
return Swig::swig_value_ref(this);
@ -928,6 +932,9 @@ namespace Swig {
octave_base_value *empty_clone() const
{ return new octave_swig_ref(0); }
dim_vector dims(void) const
{ return ptr->dims(); }
bool is_defined() const
{ return ptr->is_defined(); }

View file

@ -923,19 +923,20 @@ fi
AC_MSG_CHECKING(for Octave header files)
if test -n "$OCTAVE"; then
OCTAVEDIR="/usr/include"
OCTAVECONFIG=[`echo $OCTAVEBIN | sed 's|octave\([^/]*\)$|octave-config\1|'`]
if test -r "$OCTAVECONFIG"; then
OCTAVEDIR=`$OCTAVECONFIG -p OCTINCLUDEDIR | sed 's|/octave$||'`
else
OCTAVEDIR="/usr/include"
fi
if test "$OCTAVEDIR" != ""; then
dirs="$OCTAVEDIR"
dirs="$OCTAVEDIR/octave $OCTAVEDIR"
OCTAVEEXT=""
for i in $dirs; do
if test -r $i/octave/oct.h; then
OCTAVEEXT="$i"
break;
fi
if test -r $i/octave/octave/oct.h; then
OCTAVEEXT="$i/octave"
break;
fi
done
if test "$OCTAVEEXT" = "" ; then
AC_MSG_RESULT(not found)