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:
parent
7964ebe34f
commit
c28d0c6c80
63 changed files with 211 additions and 345 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -10,4 +10,3 @@ class Foo {
|
|||
};
|
||||
|
||||
void enum_test(color c, Foo::speed s);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
%module swigexample
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
|
|
@ -8,4 +8,3 @@
|
|||
/* Let's just grab the original header file here */
|
||||
|
||||
%include "example.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,30 @@
|
|||
# file: runme.m
|
||||
|
||||
example
|
||||
swigexample
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
# Print out the value of some enums
|
||||
printf("*** color ***\n");
|
||||
printf(" RED = %i\n", example.RED);
|
||||
printf(" BLUE = %i\n", example.BLUE);
|
||||
printf(" GREEN = %i\n", example.GREEN);
|
||||
printf(" RED = %i\n", swigexample.RED);
|
||||
printf(" BLUE = %i\n", swigexample.BLUE);
|
||||
printf(" GREEN = %i\n", swigexample.GREEN);
|
||||
|
||||
printf("\n*** Foo::speed ***\n");
|
||||
printf(" Foo_IMPULSE = %i\n", example.Foo_IMPULSE);
|
||||
printf(" Foo_WARP = %i\n", example.Foo_WARP);
|
||||
printf(" Foo_LUDICROUS = %i\n", example.Foo_LUDICROUS);
|
||||
printf(" Foo_IMPULSE = %i\n", swigexample.Foo_IMPULSE);
|
||||
printf(" Foo_WARP = %i\n", swigexample.Foo_WARP);
|
||||
printf(" Foo_LUDICROUS = %i\n", swigexample.Foo_LUDICROUS);
|
||||
|
||||
printf("\nTesting use of enums with functions\n");
|
||||
|
||||
example.enum_test(example.RED, example.Foo_IMPULSE);
|
||||
example.enum_test(example.BLUE, example.Foo_WARP);
|
||||
example.enum_test(example.GREEN, example.Foo_LUDICROUS);
|
||||
example.enum_test(1234,5678)
|
||||
swigexample.enum_test(swigexample.RED, swigexample.Foo_IMPULSE);
|
||||
swigexample.enum_test(swigexample.BLUE, swigexample.Foo_WARP);
|
||||
swigexample.enum_test(swigexample.GREEN, swigexample.Foo_LUDICROUS);
|
||||
swigexample.enum_test(1234,5678)
|
||||
|
||||
printf("\nTesting use of enum with class method\n");
|
||||
f = example.Foo();
|
||||
|
||||
f.enum_test(example.Foo_IMPULSE);
|
||||
f.enum_test(example.Foo_WARP);
|
||||
f.enum_test(example.Foo_LUDICROUS);
|
||||
|
||||
f = swigexample.Foo();
|
||||
|
||||
f.enum_test(swigexample.Foo_IMPULSE);
|
||||
f.enum_test(swigexample.Foo_WARP);
|
||||
f.enum_test(swigexample.Foo_LUDICROUS);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue