fix varin typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6896 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
aa048182d7
commit
e7b400bc7d
3 changed files with 31 additions and 6 deletions
|
|
@ -140,6 +140,7 @@ CPP_TEST_CASES += \
|
|||
features \
|
||||
friends \
|
||||
global_ns_arg \
|
||||
global_vars \
|
||||
grouping \
|
||||
ignore_parameter \
|
||||
import_nomodule \
|
||||
|
|
|
|||
22
SWIG/Examples/test-suite/global_vars.i
Normal file
22
SWIG/Examples/test-suite/global_vars.i
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
%module global_vars
|
||||
|
||||
%inline %{
|
||||
|
||||
|
||||
struct A
|
||||
{
|
||||
int x;
|
||||
};
|
||||
|
||||
|
||||
A a;
|
||||
A *ap;
|
||||
const A *cap;
|
||||
A &ar = a;
|
||||
|
||||
int x;
|
||||
int *xp;
|
||||
void *vp;
|
||||
|
||||
|
||||
%}
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
|
||||
%typemap(varin) SWIGTYPE * {
|
||||
void *temp;
|
||||
if (SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0) < 0) {
|
||||
if (SWIG_ConvertPtr($input, &temp, $1_descriptor,0) < 0) {
|
||||
croak("Type error in argument $argnum of $symname. Expected $1_mangle");
|
||||
}
|
||||
$1 = ($1_ltype) temp;
|
||||
|
|
@ -268,25 +268,27 @@
|
|||
|
||||
%typemap(varin) SWIGTYPE & {
|
||||
void *temp;
|
||||
if (SWIG_ConvertPtr($input, (void **) &temp, $1_descriptor,0) < 0) {
|
||||
if (SWIG_ConvertPtr($input, &temp, $1_descriptor,0) < 0) {
|
||||
croak("Type error in argument $argnum of $symname. Expected $1_mangle");
|
||||
}
|
||||
$1 = *($1_ltype) temp;
|
||||
}
|
||||
|
||||
%typemap(varin) void * {
|
||||
if (SWIG_ConvertPtr($input, (void **) &$1, 0,0) < 0) {
|
||||
void *temp;
|
||||
if (SWIG_ConvertPtr($input, &temp, 0,0) < 0) {
|
||||
croak("Type error in argument $argnum of $symname. Expected $1_mangle");
|
||||
}
|
||||
$1 = temp;
|
||||
}
|
||||
|
||||
/* Object passed by value. Convert to a pointer */
|
||||
%typemap(varin) SWIGTYPE {
|
||||
$&1_ltype argp;
|
||||
if (SWIG_ConvertPtr($input,(void **) &argp, $&1_descriptor,0) < 0) {
|
||||
$&1_ltype temp;
|
||||
if (SWIG_ConvertPtr($input,(void **) &temp, $&1_descriptor,0) < 0) {
|
||||
croak("Type error in argument $argnum of $symname. Expected $&1_mangle");
|
||||
}
|
||||
$1 = *argp;
|
||||
$1 = *temp;
|
||||
}
|
||||
|
||||
/* Member pointer */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue