change camel case to match SWIG conventions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9182 626c5289-ae23-0410-ae9c-e8d60b6d4f22
48 lines
No EOL
844 B
OpenEdge ABL
48 lines
No EOL
844 B
OpenEdge ABL
%module funcptr
|
|
|
|
/*
|
|
Works if we use the typedef or the inline function pointer.
|
|
int (*op)(int i,int j));
|
|
*/
|
|
|
|
|
|
/*
|
|
typedef struct B (*Bar)(int i, struct C a);
|
|
typedef struct A *(*Foo)(int i, struct B a);
|
|
|
|
*/
|
|
|
|
|
|
/*
|
|
Complicated one that should defeat just reading , to find
|
|
the number of arguments expected in the function pointer.
|
|
extern void do(int (*op)(int (*i)(double, double), int j));
|
|
*/
|
|
|
|
%inline %{
|
|
typedef double (*DistFun)(double* data, int r, int c, int i, int j,
|
|
void *xdata);
|
|
|
|
void distance(double *data, int *dim, DistFun fun, double *output) {
|
|
}
|
|
|
|
typedef int (*Operator)(int i,int j);
|
|
|
|
int do_op(int a, int b, int (*op)(int,int)) {
|
|
return (*op)(a,b);
|
|
}
|
|
|
|
int add(int a, int b) {
|
|
return a+b;
|
|
}
|
|
|
|
int sub(int a, int b) {
|
|
return a-b;
|
|
}
|
|
|
|
int mul(int a, int b) {
|
|
return a*b;
|
|
}
|
|
|
|
int (*funcvar)(int,int) = add;
|
|
%} |