diff options
author | Karl Wette <karl.wette@ligo.org> | 2013-05-08 22:43:49 +0200 |
---|---|---|
committer | william <william@nadia.(none)> | 2013-05-08 22:44:40 +0100 |
commit | c28d0c6c80c5254eeedcd63e0942f154dcb60871 (patch) | |
tree | 1a04abfb6914ca9ed4072ee42f100f033ecd71a4 | |
parent | 7964ebe34fb12f0e61fea48ca501dee2ca0f7246 (diff) | |
download | swig-c28d0c6c80c5254eeedcd63e0942f154dcb60871.tar.gz |
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
63 files changed, 212 insertions, 346 deletions
diff --git a/Examples/octave/callback/Makefile b/Examples/octave/callback/Makefile index ffc60e0c0..d38d7f896 100644 --- a/Examples/octave/callback/Makefile +++ b/Examples/octave/callback/Makefile @@ -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 diff --git a/Examples/octave/callback/example.cxx b/Examples/octave/callback/example.cxx index 450d75608..893a956f4 100644 --- a/Examples/octave/callback/example.cxx +++ b/Examples/octave/callback/example.cxx @@ -1,4 +1,3 @@ /* File : example.cxx */ #include "example.h" - diff --git a/Examples/octave/callback/example.h b/Examples/octave/callback/example.h index 1a0e8c432..74ddad954 100644 --- a/Examples/octave/callback/example.h +++ b/Examples/octave/callback/example.h @@ -20,4 +20,3 @@ public: void setCallback(Callback *cb) { delCallback(); _callback = cb; } void call() { if (_callback) _callback->run(); } }; - diff --git a/Examples/octave/callback/example.i b/Examples/octave/callback/example.i index 90beda01a..3192904db 100644 --- a/Examples/octave/callback/example.i +++ b/Examples/octave/callback/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module(directors="1") example +%module(directors="1") swigexample %{ #include "example.h" %} @@ -10,4 +10,3 @@ %feature("director") Callback; %include "example.h" - diff --git a/Examples/octave/callback/runme.m b/Examples/octave/callback/runme.m index b87925e3d..103985358 100644 --- a/Examples/octave/callback/runme.m +++ b/Examples/octave/callback/runme.m @@ -2,14 +2,13 @@ # This file illustrates the cross language polymorphism using directors. -example +swigexample -OctCallback=@() subclass(example.Callback(), \ - 'run',@(self) printf("OctCallback.run()\n")); +OctCallback=@() subclass(swigexample.Callback(),"run",@(self) printf("OctCallback.run()\n")); # Create an Caller instance -caller = example.Caller(); +caller = swigexample.Caller(); # Add a simple C++ callback (caller owns the callback, so # we disown it first) @@ -17,7 +16,7 @@ caller = example.Caller(); printf("Adding and calling a normal C++ callback\n"); printf("----------------------------------------\n"); -callback = example.Callback().__disown(); +callback = swigexample.Callback().__disown(); caller.setCallback(callback); caller.call(); caller.delCallback(); @@ -43,7 +42,7 @@ caller.call(); caller.delCallback(); # careful-- using callback here may cause problems; octave_swig_type still -# exists, but is holding a destroyed object (the C++ example.Callback). +# exists, but is holding a destroyed object (the C++ swigexample.Callback). # to manually drop the octave-side reference, you can use clear callback; @@ -60,4 +59,3 @@ a.Callback.run(); # All done. printf("octave exit\n"); - diff --git a/Examples/octave/class/Makefile b/Examples/octave/class/Makefile index ffc60e0c0..d38d7f896 100644 --- a/Examples/octave/class/Makefile +++ b/Examples/octave/class/Makefile @@ -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 diff --git a/Examples/octave/class/example.h b/Examples/octave/class/example.h index 46d901361..0d4527e92 100644 --- a/Examples/octave/class/example.h +++ b/Examples/octave/class/example.h @@ -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); }; - - - - - diff --git a/Examples/octave/class/example.i b/Examples/octave/class/example.i index 75700b305..b109bcb78 100644 --- a/Examples/octave/class/example.i +++ b/Examples/octave/class/example.i @@ -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" - diff --git a/Examples/octave/class/runme.m b/Examples/octave/class/runme.m index c833a701b..04221b4bb 100644 --- a/Examples/octave/class/runme.m +++ b/Examples/octave/class/runme.m @@ -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"); - - diff --git a/Examples/octave/constants/Makefile b/Examples/octave/constants/Makefile index 60b0578c6..03501bd81 100644 --- a/Examples/octave/constants/Makefile +++ b/Examples/octave/constants/Makefile @@ -1,10 +1,10 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = example +CXXSRCS = +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 diff --git a/Examples/octave/constants/example.i b/Examples/octave/constants/example.i index 4f7b1a4d7..405974b44 100644 --- a/Examples/octave/constants/example.i +++ b/Examples/octave/constants/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample /* A few preprocessor macros */ @@ -23,5 +23,3 @@ %constant int iconst = 37; %constant double fconst = 3.14; - - diff --git a/Examples/octave/constants/runme.m b/Examples/octave/constants/runme.m index 322858734..c6ed24535 100644 --- a/Examples/octave/constants/runme.m +++ b/Examples/octave/constants/runme.m @@ -1,29 +1,25 @@ # file: runme.m -example - -printf("ICONST = %i (should be 42)\n", example.ICONST); -printf("FCONST = %f (should be 2.1828)\n", example.FCONST); -printf("CCONST = %s (should be 'x')\n", example.CCONST); -printf("CCONST2 = %s (this should be on a new line)\n", example.CCONST2); -printf("SCONST = %s (should be 'Hello World')\n", example.SCONST); -printf("SCONST2 = %s (should be '\"Hello World\"')\n", example.SCONST2); -printf("EXPR = %f (should be 48.5484)\n", example.EXPR); -printf("iconst = %i (should be 37)\n", example.iconst); -printf("fconst = %f (should be 3.14)\n", example.fconst); +swigexample + +printf("ICONST = %i (should be 42)\n", swigexample.ICONST); +printf("FCONST = %f (should be 2.1828)\n", swigexample.FCONST); +printf("CCONST = %s (should be 'x')\n", swigexample.CCONST); +printf("CCONST2 = %s (this should be on a new line)\n", swigexample.CCONST2); +printf("SCONST = %s (should be 'Hello World')\n", swigexample.SCONST); +printf("SCONST2 = %s (should be '\"Hello World\"')\n", swigexample.SCONST2); +printf("EXPR = %f (should be 48.5484)\n", swigexample.EXPR); +printf("iconst = %i (should be 37)\n", swigexample.iconst); +printf("fconst = %f (should be 3.14)\n", swigexample.fconst); try - printf("EXTERN = %s (Arg! This shouldn't printf(anything)\n", example.EXTERN); + printf("EXTERN = %s (Arg! This shouldn't printf(anything)\n", swigexample.EXTERN); catch printf("EXTERN isn't defined (good)\n"); end_try_catch try - printf("FOO = %i (Arg! This shouldn't printf(anything)\n", example.FOO); + printf("FOO = %i (Arg! This shouldn't printf(anything)\n", swigexample.FOO); catch printf("FOO isn't defined (good)\n"); end_try_catch - - - - diff --git a/Examples/octave/contract/Makefile b/Examples/octave/contract/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/contract/Makefile +++ b/Examples/octave/contract/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/contract/example.c b/Examples/octave/contract/example.c index 1a644543f..fbdc054cd 100644 --- a/Examples/octave/contract/example.c +++ b/Examples/octave/contract/example.c @@ -19,5 +19,3 @@ int fact(int n) { if (n <= 0) return 1; return n*fact(n-1); } - - diff --git a/Examples/octave/contract/example.i b/Examples/octave/contract/example.i index 8fd1a80af..78c459efc 100644 --- a/Examples/octave/contract/example.i +++ b/Examples/octave/contract/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %contract gcd(int x, int y) { require: diff --git a/Examples/octave/contract/runme.m b/Examples/octave/contract/runme.m index 62b72320b..fa36bbe10 100644 --- a/Examples/octave/contract/runme.m +++ b/Examples/octave/contract/runme.m @@ -1,22 +1,21 @@ # file: runme.m -example +swigexample # Call our gcd() function x = 42; y = 105; -g = example.gcd(x,y); +g = swigexample.gcd(x,y); printf("The gcd of %d and %d is %d\n",x,y,g); # Manipulate the Foo global variable # Output its current value -printf("Foo = %f\n", example.cvar.Foo); +printf("Foo = %f\n", swigexample.cvar.Foo); # Change its value -example.cvar.Foo = 3.1415926; +swigexample.cvar.Foo = 3.1415926; # See if the change took effect -printf("Foo = %f\n", example.cvar.Foo); - +printf("Foo = %f\n", swigexample.cvar.Foo); diff --git a/Examples/octave/enum/Makefile b/Examples/octave/enum/Makefile index ffc60e0c0..d38d7f896 100644 --- a/Examples/octave/enum/Makefile +++ b/Examples/octave/enum/Makefile @@ -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 diff --git a/Examples/octave/enum/example.h b/Examples/octave/enum/example.h index 525d62afc..490d502e8 100644 --- a/Examples/octave/enum/example.h +++ b/Examples/octave/enum/example.h @@ -10,4 +10,3 @@ class Foo { }; void enum_test(color c, Foo::speed s); - diff --git a/Examples/octave/enum/example.i b/Examples/octave/enum/example.i index 23ee8a822..cee9af471 100644 --- a/Examples/octave/enum/example.i +++ b/Examples/octave/enum/example.i @@ -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" - diff --git a/Examples/octave/enum/runme.m b/Examples/octave/enum/runme.m index a749e81db..0108135b2 100644 --- a/Examples/octave/enum/runme.m +++ b/Examples/octave/enum/runme.m @@ -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); diff --git a/Examples/octave/extend/Makefile b/Examples/octave/extend/Makefile index ffc60e0c0..d38d7f896 100644 --- a/Examples/octave/extend/Makefile +++ b/Examples/octave/extend/Makefile @@ -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 diff --git a/Examples/octave/extend/example.cxx b/Examples/octave/extend/example.cxx index 450d75608..893a956f4 100644 --- a/Examples/octave/extend/example.cxx +++ b/Examples/octave/extend/example.cxx @@ -1,4 +1,3 @@ /* File : example.cxx */ #include "example.h" - diff --git a/Examples/octave/extend/example.h b/Examples/octave/extend/example.h index b27ab9711..9e15cf8e4 100644 --- a/Examples/octave/extend/example.h +++ b/Examples/octave/extend/example.h @@ -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; } }; - diff --git a/Examples/octave/extend/example.i b/Examples/octave/extend/example.i index c8ec32e09..953c2f314 100644 --- a/Examples/octave/extend/example.i +++ b/Examples/octave/extend/example.i @@ -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" - diff --git a/Examples/octave/extend/runme.m b/Examples/octave/extend/runme.m index c64c082c4..4536f2761 100644 --- a/Examples/octave/extend/runme.m +++ b/Examples/octave/extend/runme.m @@ -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"); - diff --git a/Examples/octave/funcptr/Makefile b/Examples/octave/funcptr/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/funcptr/Makefile +++ b/Examples/octave/funcptr/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/funcptr/example.h b/Examples/octave/funcptr/example.h index 9936e24fc..f95ae2cc9 100644 --- a/Examples/octave/funcptr/example.h +++ b/Examples/octave/funcptr/example.h @@ -6,4 +6,3 @@ extern int sub(int,int); extern int mul(int,int); extern int (*funcvar)(int,int); - diff --git a/Examples/octave/funcptr/example.i b/Examples/octave/funcptr/example.i index 8b3bef678..163a1991b 100644 --- a/Examples/octave/funcptr/example.i +++ b/Examples/octave/funcptr/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %{ #include "example.h" %} @@ -13,4 +13,3 @@ extern int do_op(int a, int b, int (*op)(int, int)); %constant int (*MUL)(int,int) = mul; extern int (*funcvar)(int,int); - diff --git a/Examples/octave/funcptr/runme.m b/Examples/octave/funcptr/runme.m index 455311c16..4e2e28fbc 100644 --- a/Examples/octave/funcptr/runme.m +++ b/Examples/octave/funcptr/runme.m @@ -1,6 +1,6 @@ # file: runme.m -example +swigexample a = 37 b = 42 @@ -10,12 +10,11 @@ b = 42 printf("Trying some C callback functions\n"); printf(" a = %i\n", a); printf(" b = %i\n", b); -printf(" ADD(a,b) = %i\n", example.do_op(a,b,example.ADD)); -printf(" SUB(a,b) = %i\n", example.do_op(a,b,example.SUB)); -printf(" MUL(a,b) = %i\n", example.do_op(a,b,example.MUL)); +printf(" ADD(a,b) = %i\n", swigexample.do_op(a,b,swigexample.ADD)); +printf(" SUB(a,b) = %i\n", swigexample.do_op(a,b,swigexample.SUB)); +printf(" MUL(a,b) = %i\n", swigexample.do_op(a,b,swigexample.MUL)); printf("Here is what the C callback function objects look like in Octave\n"); -example.ADD -example.SUB -example.MUL - +swigexample.ADD +swigexample.SUB +swigexample.MUL diff --git a/Examples/octave/funcptr2/Makefile b/Examples/octave/funcptr2/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/funcptr2/Makefile +++ b/Examples/octave/funcptr2/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/funcptr2/example.h b/Examples/octave/funcptr2/example.h index 9936e24fc..f95ae2cc9 100644 --- a/Examples/octave/funcptr2/example.h +++ b/Examples/octave/funcptr2/example.h @@ -6,4 +6,3 @@ extern int sub(int,int); extern int mul(int,int); extern int (*funcvar)(int,int); - diff --git a/Examples/octave/funcptr2/example.i b/Examples/octave/funcptr2/example.i index 681775a3e..33378a1c1 100644 --- a/Examples/octave/funcptr2/example.i +++ b/Examples/octave/funcptr2/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %{ #include "example.h" %} @@ -15,4 +15,3 @@ int mul(int, int); %nocallback; extern int (*funcvar)(int,int); - diff --git a/Examples/octave/funcptr2/runme.m b/Examples/octave/funcptr2/runme.m index 1d3d8f73a..574635ed2 100644 --- a/Examples/octave/funcptr2/runme.m +++ b/Examples/octave/funcptr2/runme.m @@ -1,6 +1,6 @@ # file: runme.m -example +swigexample a = 37 b = 42 @@ -10,15 +10,15 @@ b = 42 printf("Trying some C callback functions\n"); printf(" a = %i\n", a); printf(" b = %i\n", b); -printf(" ADD(a,b) = %i\n", example.do_op(a,b,example.ADD)); -printf(" SUB(a,b) = %i\n", example.do_op(a,b,example.SUB)); -printf(" MUL(a,b) = %i\n", example.do_op(a,b,example.MUL)); +printf(" ADD(a,b) = %i\n", swigexample.do_op(a,b,swigexample.ADD)); +printf(" SUB(a,b) = %i\n", swigexample.do_op(a,b,swigexample.SUB)); +printf(" MUL(a,b) = %i\n", swigexample.do_op(a,b,swigexample.MUL)); printf("Here is what the C callback function objects look like in Octave\n"); -example.ADD -example.SUB -example.MUL +swigexample.ADD +swigexample.SUB +swigexample.MUL printf("Call the functions directly...\n"); -printf(" add(a,b) = %i\n", example.add(a,b)); -printf(" sub(a,b) = %i\n", example.sub(a,b)); +printf(" add(a,b) = %i\n", swigexample.add(a,b)); +printf(" sub(a,b) = %i\n", swigexample.sub(a,b)); diff --git a/Examples/octave/functor/Makefile b/Examples/octave/functor/Makefile index 09c680b4e..94fb96337 100644 --- a/Examples/octave/functor/Makefile +++ b/Examples/octave/functor/Makefile @@ -1,10 +1,10 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = example +CXXSRCS = +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 CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp -static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/functor/example.i b/Examples/octave/functor/example.i index 2fd38176f..ade20c56c 100644 --- a/Examples/octave/functor/example.i +++ b/Examples/octave/functor/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %inline %{ @@ -23,7 +23,3 @@ public: // Instantiate a few versions %template(intSum) Sum<int>; %template(doubleSum) Sum<double>; - - - - diff --git a/Examples/octave/functor/runme.m b/Examples/octave/functor/runme.m index 65dabcc91..8b41691c3 100644 --- a/Examples/octave/functor/runme.m +++ b/Examples/octave/functor/runme.m @@ -1,8 +1,8 @@ # Operator overloading example -example +swigexample -a = example.intSum(0); -b = example.doubleSum(100.0); +a = swigexample.intSum(0); +b = swigexample.doubleSum(100.0); # Use the objects. They should be callable just like a normal # python function. @@ -14,5 +14,3 @@ endfor a.result() b.result() - - diff --git a/Examples/octave/module_load/Makefile b/Examples/octave/module_load/Makefile index bead6f150..e388763bd 100644 --- a/Examples/octave/module_load/Makefile +++ b/Examples/octave/module_load/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -13,10 +13,6 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)2' SWIGOPT='-module $$(TARGET) -globals .' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean rm -f $(TARGET).m diff --git a/Examples/octave/module_load/runme.m b/Examples/octave/module_load/runme.m index 0fda218cd..bc311b5e6 100644 --- a/Examples/octave/module_load/runme.m +++ b/Examples/octave/module_load/runme.m @@ -2,60 +2,60 @@ # load module clear all; -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); clear all -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); clear all # load module in a function globally before base context clear all; function testme - example; + swigexample; assert(cvar.ivar == ifunc); - assert(exist("example","var")); + assert(exist("swigexample","var")); endfunction testme testme -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); clear all function testme - example; + swigexample; assert(cvar.ivar == ifunc); - assert(exist("example","var")); + assert(exist("swigexample","var")); endfunction testme testme -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); clear all # load module in a function globally after base context clear all; -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); function testme - example; + swigexample; assert(cvar.ivar == ifunc); - assert(exist("example","var")); + assert(exist("swigexample","var")); endfunction testme testme clear all -example; +swigexample; assert(cvar.ivar == ifunc); -assert(exist("example","var")); +assert(exist("swigexample","var")); function testme - example; + swigexample; assert(cvar.ivar == ifunc); - assert(exist("example","var")); + assert(exist("swigexample","var")); endfunction testme testme @@ -69,13 +69,13 @@ endif # load module with no cvar clear all; -example2; -assert(example2.ivar == ifunc); -assert(exist("example2","var")); +swigexample2; +assert(swigexample2.ivar == ifunc); +assert(exist("swigexample2","var")); assert(!isglobal("cvar")) clear all -example2; -assert(example2.ivar == ifunc); -assert(exist("example2","var")); +swigexample2; +assert(swigexample2.ivar == ifunc); +assert(exist("swigexample2","var")); assert(!isglobal("cvar")) clear all diff --git a/Examples/octave/operator/Makefile b/Examples/octave/operator/Makefile index 09c680b4e..94fb96337 100644 --- a/Examples/octave/operator/Makefile +++ b/Examples/octave/operator/Makefile @@ -1,10 +1,10 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = example +CXXSRCS = +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 CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp -static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/operator/example.h b/Examples/octave/operator/example.h index a9b69e009..d91adabe8 100644 --- a/Examples/octave/operator/example.h +++ b/Examples/octave/operator/example.h @@ -25,7 +25,7 @@ public: ComplexVal operator-() const { return ComplexVal(-rpart, -ipart); } - + double re() const { return rpart; } double im() const { return ipart; } }; diff --git a/Examples/octave/operator/example.i b/Examples/octave/operator/example.i index 7b903e69b..a2d97731d 100644 --- a/Examples/octave/operator/example.i +++ b/Examples/octave/operator/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample #pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ %{ #include "example.h" diff --git a/Examples/octave/operator/runme.m b/Examples/octave/operator/runme.m index 85fd99ad4..9ab614ffb 100644 --- a/Examples/octave/operator/runme.m +++ b/Examples/octave/operator/runme.m @@ -1,8 +1,8 @@ # Operator overloading example -example +swigexample -a = example.ComplexVal(2,3); -b = example.ComplexVal(-5,10); +a = swigexample.ComplexVal(2,3); +b = swigexample.ComplexVal(-5,10); printf("a = %s\n",disp(a)); printf("b = %s\n",disp(b)); @@ -12,7 +12,7 @@ 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); +e = swigexample.ComplexVal(a-c); printf("e = %s\n",disp(e)); # Big expression diff --git a/Examples/octave/pointer/Makefile b/Examples/octave/pointer/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/pointer/Makefile +++ b/Examples/octave/pointer/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/pointer/example.i b/Examples/octave/pointer/example.i index a8ac79499..545e3ada4 100644 --- a/Examples/octave/pointer/example.i +++ b/Examples/octave/pointer/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %{ extern void add(int *, int *, int *); @@ -24,7 +24,3 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT); %apply int *OUTPUT { int *r }; extern int divide(int n, int d, int *r); - - - - diff --git a/Examples/octave/pointer/runme.m b/Examples/octave/pointer/runme.m index c36df7270..a76de67de 100644 --- a/Examples/octave/pointer/runme.m +++ b/Examples/octave/pointer/runme.m @@ -1,42 +1,39 @@ # file: runme.m -example; +swigexample; # First create some objects using the pointer library. printf("Testing the pointer library\n"); -a = example.new_intp(); -b = example.new_intp(); -c = example.new_intp(); -example.intp_assign(a,37); -example.intp_assign(b,42); +a = swigexample.new_intp(); +b = swigexample.new_intp(); +c = swigexample.new_intp(); +swigexample.intp_assign(a,37); +swigexample.intp_assign(b,42); a,b,c # Call the add() function with some pointers -example.add(a,b,c); +swigexample.add(a,b,c); # Now get the result -r = example.intp_value(c); +r = swigexample.intp_value(c); printf(" 37 + 42 = %i\n",r); # Clean up the pointers -example.delete_intp(a); -example.delete_intp(b); -example.delete_intp(c); +swigexample.delete_intp(a); +swigexample.delete_intp(b); +swigexample.delete_intp(c); # Now try the typemap library # This should be much easier. Now how it is no longer # necessary to manufacture pointers. printf("Trying the typemap library\n"); -r = example.sub(37,42); +r = swigexample.sub(37,42); printf(" 37 - 42 = %i\n",r); # Now try the version with multiple return values printf("Testing multiple return values\n"); -[q,r] = example.divide(42,37); +[q,r] = swigexample.divide(42,37); printf(" 42/37 = %d remainder %d\n",q,r); - - - diff --git a/Examples/octave/reference/Makefile b/Examples/octave/reference/Makefile index ffc60e0c0..d38d7f896 100644 --- a/Examples/octave/reference/Makefile +++ b/Examples/octave/reference/Makefile @@ -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 diff --git a/Examples/octave/reference/example.cxx b/Examples/octave/reference/example.cxx index 8a513bf49..9b72ca6a2 100644 --- a/Examples/octave/reference/example.cxx +++ b/Examples/octave/reference/example.cxx @@ -43,4 +43,3 @@ Vector &VectorArray::operator[](int index) { int VectorArray::size() { return maxsize; } - diff --git a/Examples/octave/reference/example.h b/Examples/octave/reference/example.h index 4915adb1b..697afafe0 100644 --- a/Examples/octave/reference/example.h +++ b/Examples/octave/reference/example.h @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/octave/reference/example.i b/Examples/octave/reference/example.i index 8c95b3213..da09800c0 100644 --- a/Examples/octave/reference/example.i +++ b/Examples/octave/reference/example.i @@ -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: } } }; - - - - diff --git a/Examples/octave/reference/runme.m b/Examples/octave/reference/runme.m index f59c8eb7d..630ee0cd2 100644 --- a/Examples/octave/reference/runme.m +++ b/Examples/octave/reference/runme.m @@ -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 - diff --git a/Examples/octave/simple/Makefile b/Examples/octave/simple/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/simple/Makefile +++ b/Examples/octave/simple/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/simple/example.c b/Examples/octave/simple/example.c index 1c2af789c..8df41189c 100644 --- a/Examples/octave/simple/example.c +++ b/Examples/octave/simple/example.c @@ -14,5 +14,3 @@ int gcd(int x, int y) { } return g; } - - diff --git a/Examples/octave/simple/example.i b/Examples/octave/simple/example.i index 24093b9bf..127bfcd84 100644 --- a/Examples/octave/simple/example.i +++ b/Examples/octave/simple/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %inline %{ extern int gcd(int x, int y); diff --git a/Examples/octave/simple/runme.m b/Examples/octave/simple/runme.m index 8dc5eaa58..6345df0cf 100644 --- a/Examples/octave/simple/runme.m +++ b/Examples/octave/simple/runme.m @@ -1,22 +1,21 @@ # file: runme.m -example +swigexample # Call our gcd() function x = 42 y = 105 -g = example.gcd(x,y) +g = swigexample.gcd(x,y) printf("The gcd of %d and %d is %d\n",x,y,g); # Manipulate the Foo global variable # Output its current value -example.cvar.Foo +swigexample.cvar.Foo # Change its value -example.cvar.Foo = 3.1415926 +swigexample.cvar.Foo = 3.1415926 # See if the change took effect -printf("Foo = %f\n", example.cvar.Foo); - +printf("Foo = %f\n", swigexample.cvar.Foo); diff --git a/Examples/octave/template/Makefile b/Examples/octave/template/Makefile index 527e3cec6..94fb96337 100644 --- a/Examples/octave/template/Makefile +++ b/Examples/octave/template/Makefile @@ -1,10 +1,10 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = example +CXXSRCS = +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 CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp -static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_cpp_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/template/example.h b/Examples/octave/template/example.h index 7401df650..5eb65dabb 100644 --- a/Examples/octave/template/example.h +++ b/Examples/octave/template/example.h @@ -29,4 +29,3 @@ template<class T> class vector { } #endif }; - diff --git a/Examples/octave/template/example.i b/Examples/octave/template/example.i index 8f94c4da1..cfff18ded 100644 --- a/Examples/octave/template/example.i +++ b/Examples/octave/template/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %{ #include "example.h" @@ -14,4 +14,3 @@ %template(maxdouble) max<double>; %template(vecint) vector<int>; %template(vecdouble) vector<double>; - diff --git a/Examples/octave/template/runme.m b/Examples/octave/template/runme.m index a9891d459..b0abbf22f 100644 --- a/Examples/octave/template/runme.m +++ b/Examples/octave/template/runme.m @@ -1,15 +1,15 @@ # file: runme.m -example +swigexample # Call some templated functions -example.maxint(3,7) -example.maxdouble(3.14,2.18) +swigexample.maxint(3,7) +swigexample.maxdouble(3.14,2.18) # Create some class -iv = example.vecint(100) -dv = example.vecdouble(1000) +iv = swigexample.vecint(100) +dv = swigexample.vecdouble(1000) for i=0:99, iv.setitem(i,2*i); @@ -33,5 +33,3 @@ sum clear iv clear dv - - diff --git a/Examples/octave/variables/Makefile b/Examples/octave/variables/Makefile index 2c33cd3d8..73e3962ed 100644 --- a/Examples/octave/variables/Makefile +++ b/Examples/octave/variables/Makefile @@ -1,7 +1,7 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig SRCS = example.c -TARGET = example +TARGET = swigexample INTERFACE = example.i check: build @@ -11,9 +11,5 @@ build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave -static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='myoctave' INTERFACE='$(INTERFACE)' octave_static - clean: $(MAKE) -f $(TOP)/Makefile octave_clean diff --git a/Examples/octave/variables/example.c b/Examples/octave/variables/example.c index aa4ffe9b3..15dcc1b8e 100644 --- a/Examples/octave/variables/example.c +++ b/Examples/octave/variables/example.c @@ -11,7 +11,7 @@ #include <stdlib.h> #include "example.h" -int ivar = 0; +int ivar = 0; short svar = 0; long lvar = 0; unsigned int uivar = 0; diff --git a/Examples/octave/variables/example.h b/Examples/octave/variables/example.h index 0f7e89594..8d95fa1a4 100644 --- a/Examples/octave/variables/example.h +++ b/Examples/octave/variables/example.h @@ -3,4 +3,3 @@ typedef struct { int x,y; } Point; - diff --git a/Examples/octave/variables/example.i b/Examples/octave/variables/example.i index 639b6c704..3e11495ad 100644 --- a/Examples/octave/variables/example.i +++ b/Examples/octave/variables/example.i @@ -1,5 +1,5 @@ /* File : example.i */ -%module example +%module swigexample %{ #include "example.h" %} @@ -50,4 +50,3 @@ extern Point *new_Point(int x, int y); extern char *Point_print(Point *p); extern void pt_print(); %} - diff --git a/Examples/octave/variables/runme.m b/Examples/octave/variables/runme.m index db88b18b0..c6788398b 100644 --- a/Examples/octave/variables/runme.m +++ b/Examples/octave/variables/runme.m @@ -1,56 +1,56 @@ # file: runme.m -example +swigexample # Try to set the values of some global variables -example.cvar.ivar = 42; -example.cvar.svar = -31000; -example.cvar.lvar = 65537; -example.cvar.uivar = 123456; -example.cvar.usvar = 61000; -example.cvar.ulvar = 654321; -example.cvar.scvar = -13; -example.cvar.ucvar = 251; -example.cvar.cvar = "S"; -example.cvar.fvar = 3.14159; -example.cvar.dvar = 2.1828; -example.cvar.strvar = "Hello World"; -example.cvar.iptrvar= example.new_int(37); -example.cvar.ptptr = example.new_Point(37,42); -example.cvar.name = "Bill"; +swigexample.cvar.ivar = 42; +swigexample.cvar.svar = -31000; +swigexample.cvar.lvar = 65537; +swigexample.cvar.uivar = 123456; +swigexample.cvar.usvar = 61000; +swigexample.cvar.ulvar = 654321; +swigexample.cvar.scvar = -13; +swigexample.cvar.ucvar = 251; +swigexample.cvar.cvar = "S"; +swigexample.cvar.fvar = 3.14159; +swigexample.cvar.dvar = 2.1828; +swigexample.cvar.strvar = "Hello World"; +swigexample.cvar.iptrvar= swigexample.new_int(37); +swigexample.cvar.ptptr = swigexample.new_Point(37,42); +swigexample.cvar.name = "Bill"; # Now print out the values of the variables printf("Variables (values printed from Octave)\n"); -printf("ivar = %i\n", example.cvar.ivar); -printf("svar = %i\n", example.cvar.svar); -printf("lvar = %i\n", example.cvar.lvar); -printf("uivar = %i\n", example.cvar.uivar); -printf("usvar = %i\n", example.cvar.usvar); -printf("ulvar = %i\n", example.cvar.ulvar); -printf("scvar = %i\n", example.cvar.scvar); -printf("ucvar = %i\n", example.cvar.ucvar); -printf("fvar = %i\n", example.cvar.fvar); -printf("dvar = %i\n", example.cvar.dvar); -printf("cvar = %s\n", example.cvar.cvar); -printf("strvar = %s\n", example.cvar.strvar); -#printf("cstrvar = %s\n", example.cvar.cstrvar); -example.cvar.iptrvar -printf("name = %i\n", example.cvar.name); -printf("ptptr = %s\n", example.Point_print(example.cvar.ptptr)); -#printf("pt = %s\n", example.cvar.Point_print(example.cvar.pt)); +printf("ivar = %i\n", swigexample.cvar.ivar); +printf("svar = %i\n", swigexample.cvar.svar); +printf("lvar = %i\n", swigexample.cvar.lvar); +printf("uivar = %i\n", swigexample.cvar.uivar); +printf("usvar = %i\n", swigexample.cvar.usvar); +printf("ulvar = %i\n", swigexample.cvar.ulvar); +printf("scvar = %i\n", swigexample.cvar.scvar); +printf("ucvar = %i\n", swigexample.cvar.ucvar); +printf("fvar = %i\n", swigexample.cvar.fvar); +printf("dvar = %i\n", swigexample.cvar.dvar); +printf("cvar = %s\n", swigexample.cvar.cvar); +printf("strvar = %s\n", swigexample.cvar.strvar); +#printf("cstrvar = %s\n", swigexample.cvar.cstrvar); +swigexample.cvar.iptrvar +printf("name = %i\n", swigexample.cvar.name); +printf("ptptr = %s\n", swigexample.Point_print(swigexample.cvar.ptptr)); +#printf("pt = %s\n", swigexample.cvar.Point_print(swigexample.cvar.pt)); printf("\nVariables (values printed from C)\n"); -example.print_vars(); +swigexample.print_vars(); printf("\nNow I'm going to try and modify some read only variables\n"); printf(" Tring to set 'path'\n"); try - example.cvar.path = "Whoa!"; + swigexample.cvar.path = "Whoa!"; printf("Hey, what's going on?!?! This shouldn't work\n"); catch printf("Good.\n"); @@ -58,7 +58,7 @@ end_try_catch printf(" Trying to set 'status'\n"); try - example.cvar.status = 0; + swigexample.cvar.status = 0; printf("Hey, what's going on?!?! This shouldn't work\n"); catch printf("Good.\n"); @@ -67,9 +67,6 @@ end_try_catch printf("\nI'm going to try and update a structure variable.\n"); -example.cvar.pt = example.cvar.ptptr; - -printf("The new value is %s\n", example.Point_print(example.cvar.pt)); - - +swigexample.cvar.pt = swigexample.cvar.ptptr; +printf("The new value is %s\n", swigexample.Point_print(swigexample.cvar.pt)); |