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
|
||||
|
|
|
|||
|
|
@ -6,4 +6,3 @@ extern int sub(int,int);
|
|||
extern int mul(int,int);
|
||||
|
||||
extern int (*funcvar)(int,int);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue