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

@ -1,4 +1,3 @@
/* File : example.cxx */
#include "example.h"

View file

@ -44,7 +44,7 @@ public:
const Employee *get_item(int i) {
return list[i];
}
~EmployeeList() {
~EmployeeList() {
std::vector<Employee*>::iterator i;
std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl;
for (i=list.begin(); i!=list.end(); i++) {
@ -53,4 +53,3 @@ public:
std::cout << "~EmployeeList empty." << std::endl;
}
};

View file

@ -1,5 +1,5 @@
/* File : example.i */
%module(directors="1") example
%module(directors="1") swigexample
%{
#include "example.h"
%}
@ -12,4 +12,3 @@
%feature("director") Manager;
%include "example.h"

View file

@ -2,12 +2,12 @@
# This file illustrates the cross language polymorphism using directors.
example
swigexample
# CEO class, which overrides Employee::getPosition().
CEO=@(name) subclass(example.Manager(name),'getPosition',@(self) "CEO");
CEO=@(name) subclass(swigexample.Manager(name),'getPosition',@(self) "CEO");
# Create an instance of our employee extension class, CEO. The calls to
# getName() and getPosition() are standard, the call to getTitle() uses
@ -22,7 +22,7 @@ printf("----------------------\n");
# Create a new EmployeeList instance. This class does not have a C++
# director wrapper, but can be used freely with other classes that do.
list = example.EmployeeList();
list = swigexample.EmployeeList();
# EmployeeList owns its items, so we must surrender ownership of objects
# we add. This involves first calling the __disown__ method to tell the
@ -71,4 +71,3 @@ printf("----------------------\n");
# All done.
printf("octave exit\n");