Move funcptr.i from being an R only test to a test for all languages. Modify the test to test function pointers with no arguments, which is a problem for R.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10250 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
14d23e5a59
commit
9029bae5e0
3 changed files with 10 additions and 17 deletions
|
|
@ -384,6 +384,7 @@ C_TEST_CASES += \
|
||||||
empty \
|
empty \
|
||||||
enums \
|
enums \
|
||||||
extern_declaration \
|
extern_declaration \
|
||||||
|
funcptr \
|
||||||
function_typedef \
|
function_typedef \
|
||||||
immutable \
|
immutable \
|
||||||
inctest \
|
inctest \
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,5 @@
|
||||||
%module funcptr
|
%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
|
Complicated one that should defeat just reading , to find
|
||||||
the number of arguments expected in the function pointer.
|
the number of arguments expected in the function pointer.
|
||||||
|
|
@ -20,8 +7,7 @@ extern void do(int (*op)(int (*i)(double, double), int j));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
typedef double (*DistFun)(double* data, int r, int c, int i, int j,
|
typedef double (*DistFun)(double* data, int r, int c, int i, int j, void *xdata);
|
||||||
void *xdata);
|
|
||||||
|
|
||||||
void distance(double *data, int *dim, DistFun fun, double *output) {
|
void distance(double *data, int *dim, DistFun fun, double *output) {
|
||||||
}
|
}
|
||||||
|
|
@ -44,5 +30,11 @@ int mul(int a, int b) {
|
||||||
return a*b;
|
return a*b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int *nowt() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int (*funcvar)(int,int) = add;
|
int (*funcvar)(int,int) = add;
|
||||||
%}
|
int * (*funcvar2)() = nowt;
|
||||||
|
int * (*funcvar3)(void) = nowt;
|
||||||
|
%}
|
||||||
|
|
@ -11,7 +11,7 @@ top_srcdir = @top_srcdir@
|
||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
|
|
||||||
C_TEST_CASES = copy_struct simple_array legacy
|
C_TEST_CASES = copy_struct simple_array legacy
|
||||||
CPP_TEST_CASES = funcptr double_delete
|
CPP_TEST_CASES = double_delete
|
||||||
|
|
||||||
include $(srcdir)/../common.mk
|
include $(srcdir)/../common.mk
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue