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,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
|
||||
|
|
|
|||
|
|
@ -14,5 +14,3 @@ int gcd(int x, int y) {
|
|||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
%module swigexample
|
||||
|
||||
%inline %{
|
||||
extern int gcd(int x, int y);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue