fix extern declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7321 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c838d83d2c
commit
c47c930f59
50 changed files with 232 additions and 20 deletions
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
%rename(mod) my_mod;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern double My_variable;
|
extern double My_variable;
|
||||||
extern int fact(int);
|
extern int fact(int);
|
||||||
%rename(mod) my_mod;
|
|
||||||
extern int my_mod(int n, int m);
|
extern int my_mod(int n, int m);
|
||||||
extern char *get_time();
|
extern char *get_time();
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,6 @@ ensure:
|
||||||
Circle >= 0;
|
Circle >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int Circle (int x, int y, int radius);
|
extern int Circle (int x, int y, int radius);
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,19 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@
|
||||||
/* Put headers and other declarations here */
|
/* Put headers and other declarations here */
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern double My_variable;
|
extern double My_variable;
|
||||||
extern int fact(int);
|
extern int fact(int);
|
||||||
extern int mod(int n, int m);
|
extern int mod(int n, int m);
|
||||||
extern char *get_time();
|
extern char *get_time();
|
||||||
|
%}
|
||||||
|
|
||||||
%include guile/guilemain.i
|
%include guile/guilemain.i
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
|
|
||||||
%typemap(jni) (int argc, char *argv[]) "jobjectArray"
|
%typemap(jni) (int argc, char *argv[]) "jobjectArray"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,22 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module Example
|
%module Example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
%rename(mod) my_mod;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern double My_variable;
|
extern double My_variable;
|
||||||
extern int fact(int);
|
extern int fact(int);
|
||||||
%name(mod) extern int my_mod(int n, int m);
|
|
||||||
extern int my_mod(int n, int m);
|
extern int my_mod(int n, int m);
|
||||||
extern char *get_time();
|
extern char *get_time();
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some functions that manipulate Vectors by value */
|
/* Some functions that manipulate Vectors by value */
|
||||||
|
%inline %{
|
||||||
extern double dot_product(Vector a, Vector b);
|
extern double dot_product(Vector a, Vector b);
|
||||||
extern Vector vector_add(Vector a, Vector b);
|
extern Vector vector_add(Vector a, Vector b);
|
||||||
|
%}
|
||||||
|
|
||||||
/* Include this because the vector_add() function will leak memory */
|
/* Include this because the vector_add() function will leak memory */
|
||||||
void free(void *);
|
void free(void *);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,22 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some functions that manipulate Vectors by value */
|
/* Some functions that manipulate Vectors by value */
|
||||||
|
%inline %{
|
||||||
extern double dot_product(Vector a, Vector b);
|
extern double dot_product(Vector a, Vector b);
|
||||||
extern Vector vector_add(Vector a, Vector b);
|
extern Vector vector_add(Vector a, Vector b);
|
||||||
|
%}
|
||||||
|
|
||||||
/* Include this because the vector_add() function will leak memory */
|
/* Include this because the vector_add() function will leak memory */
|
||||||
void free(void *);
|
void free(void *);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,15 +24,21 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern int value_ent(int *value);
|
extern int value_ent(int *value);
|
||||||
|
|
@ -39,7 +46,5 @@ extern int value_ent(int *value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ ensure:
|
||||||
fact >= 1;
|
fact >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern int fact(int n);
|
extern int fact(int n);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,22 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,14 @@
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
%include typemaps.i
|
%include typemaps.i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some functions that manipulate Vectors by value */
|
/* Some functions that manipulate Vectors by value */
|
||||||
|
%inline %{
|
||||||
extern double dot_product(Vector a, Vector b);
|
extern double dot_product(Vector a, Vector b);
|
||||||
extern Vector vector_add(Vector a, Vector b);
|
extern Vector vector_add(Vector a, Vector b);
|
||||||
|
%}
|
||||||
|
|
||||||
/* Include this because the vector_add() function will leak memory */
|
/* Include this because the vector_add() function will leak memory */
|
||||||
void free(void *);
|
void free(void *);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,22 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ ensure:
|
||||||
fact >= 1;
|
fact >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern int fact(int n);
|
extern int fact(int n);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@ extern int add(int,int);
|
||||||
extern int sub(int,int);
|
extern int sub(int,int);
|
||||||
extern int mul(int,int);
|
extern int mul(int,int);
|
||||||
|
|
||||||
|
extern int (*funcvar)(int,int);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern int gcd(int x, int y);
|
||||||
|
extern int gcdmain(int argc, char *argv[]);
|
||||||
|
extern int count(char *bytes, int len, char c);
|
||||||
|
extern void capitalize (char *str, int len);
|
||||||
|
extern void circle (double cx, double cy);
|
||||||
|
extern int squareCubed (int n, int *OUTPUT);
|
||||||
|
%}
|
||||||
|
|
||||||
%include exception.i
|
%include exception.i
|
||||||
|
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%{
|
||||||
|
extern void add(int *, int *, int *);
|
||||||
|
extern void sub(int *, int *, int *);
|
||||||
|
extern int divide(int, int, int *);
|
||||||
|
%}
|
||||||
|
|
||||||
/* This example illustrates a couple of different techniques
|
/* This example illustrates a couple of different techniques
|
||||||
for manipulating C pointers */
|
for manipulating C pointers */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* File : example.i */
|
/* File : example.i */
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
extern double Foo;
|
extern double Foo;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some functions that manipulate Vectors by value */
|
/* Some functions that manipulate Vectors by value */
|
||||||
|
%inline %{
|
||||||
extern double dot_product(Vector a, Vector b);
|
extern double dot_product(Vector a, Vector b);
|
||||||
extern Vector vector_add(Vector a, Vector b);
|
extern Vector vector_add(Vector a, Vector b);
|
||||||
|
%}
|
||||||
|
|
||||||
/* Include this because the vector_add() function will leak memory */
|
/* Include this because the vector_add() function will leak memory */
|
||||||
void free(void *);
|
void free(void *);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Some global variable declarations */
|
/* Some global variable declarations */
|
||||||
|
%inline %{
|
||||||
extern int ivar;
|
extern int ivar;
|
||||||
extern short svar;
|
extern short svar;
|
||||||
extern long lvar;
|
extern long lvar;
|
||||||
|
|
@ -23,22 +24,26 @@ extern char name[256];
|
||||||
|
|
||||||
extern Point *ptptr;
|
extern Point *ptptr;
|
||||||
extern Point pt;
|
extern Point pt;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* Some read-only variables */
|
/* Some read-only variables */
|
||||||
|
|
||||||
%immutable;
|
%immutable;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
extern int status;
|
extern int status;
|
||||||
extern char path[256];
|
extern char path[256];
|
||||||
|
%}
|
||||||
|
|
||||||
%mutable;
|
%mutable;
|
||||||
|
|
||||||
/* Some helper functions to make it easier to test */
|
/* Some helper functions to make it easier to test */
|
||||||
|
%inline %{
|
||||||
extern void print_vars();
|
extern void print_vars();
|
||||||
extern int *new_int(int value);
|
extern int *new_int(int value);
|
||||||
extern Point *new_Point(int x, int y);
|
extern Point *new_Point(int x, int y);
|
||||||
extern char *Point_print(Point *p);
|
extern char *Point_print(Point *p);
|
||||||
extern void pt_print();
|
extern void pt_print();
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue