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

@ -8,7 +8,7 @@ public:
virtual ~Shape() {
nshapes--;
};
double x, y;
double x, y;
void move(double dx, double dy);
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
@ -32,8 +32,3 @@ public:
virtual double area(void);
virtual double perimeter(void);
};

View file

@ -1,5 +1,5 @@
/* File : example.i */
%module example
%module swigexample
%{
#include "example.h"
@ -7,4 +7,3 @@
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -3,17 +3,17 @@
# This file illustrates the proxy class C++ interface generated
# by SWIG.
example
swigexample
# ----- Object creation -----
printf("Creating some objects:\n");
c = example.Circle(10)
s = example.Square(10)
c = swigexample.Circle(10)
s = swigexample.Square(10)
# ----- Access a static member -----
printf("\nA total of %i shapes were created\n", example.Shape.nshapes);
printf("\nA total of %i shapes were created\n", swigexample.Shape.nshapes);
# ----- Member data access -----
@ -46,7 +46,5 @@ printf("\nGuess I'll clean up now\n");
clear c
clear s
printf("%i shapes remain\n", example.Shape.nshapes);
printf("%i shapes remain\n", swigexample.Shape.nshapes);
printf("Goodbye\n");