Fixes to Octave examples

- rename example modules from "example" to "swigexample", to avoid a
  warning from shadowing the Octave built-in function "example"
- remove deprecated "static" Makefile targets: there is no longer
  an option to build static Octave modules in the Examples Makefile
- emacs whitespace cleanup run on all files
This commit is contained in:
Karl Wette 2013-05-08 22:43:49 +02:00 committed by william
commit c28d0c6c80
63 changed files with 211 additions and 345 deletions

View file

@ -1,10 +1,10 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS = example.cxx
TARGET = example
TARGET = swigexample
INTERFACE = example.i
LIBS = -lm
SWIGOPT =
SWIGOPT =
check: build
$(MAKE) -f $(TOP)/Makefile octave_run
@ -13,9 +13,5 @@ build:
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
static:
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile octave_clean

View file

@ -43,4 +43,3 @@ Vector &VectorArray::operator[](int index) {
int VectorArray::size() {
return maxsize;
}

View file

@ -20,7 +20,3 @@ public:
Vector &operator[](int);
int size();
};

View file

@ -2,7 +2,7 @@
/* This file has a few "typical" uses of C++ references. */
%module example
%module swigexample
%{
#include "example.h"
@ -31,7 +31,7 @@ public:
VectorArray(int maxsize);
~VectorArray();
int size();
/* This wrapper provides an alternative to the [] operator */
%extend {
Vector &get(int index) {
@ -42,7 +42,3 @@ public:
}
}
};

View file

@ -2,13 +2,13 @@
# This file illustrates the manipulation of C++ references in Octave
example
swigexample
# ----- Object creation -----
printf("Creating some objects:\n");
a = example.Vector(3,4,5)
b = example.Vector(10,11,12)
a = swigexample.Vector(3,4,5)
b = swigexample.Vector(10,11,12)
printf(" Created %s\n",a.cprint());
printf(" Created %s\n",b.cprint());
@ -17,12 +17,12 @@ printf(" Created %s\n",b.cprint());
# This calls the wrapper we placed around
#
# operator+(const Vector &a, const Vector &)
# operator+(const Vector &a, const Vector &)
#
# It returns a new allocated object.
printf("Adding a+b\n");
c = example.addv(a,b);
c = swigexample.addv(a,b);
printf(" a+b = %s\n", c.cprint());
clear c
@ -31,7 +31,7 @@ clear c
# Note: Using the high-level interface here
printf("Creating an array of vectors\n");
va = example.VectorArray(10)
va = swigexample.VectorArray(10)
# ----- Set some values in the array -----
@ -39,7 +39,7 @@ va = example.VectorArray(10)
va.set(0,a);
va.set(1,b);
va.set(2,example.addv(a,b))
va.set(2,swigexample.addv(a,b))
# Get some values from the array
@ -60,4 +60,3 @@ printf("Cleaning up\n");
clear va
clear a
clear b