fix varin for ptr types
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6909 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a89d51a5e7
commit
a80aa7fe40
2 changed files with 12 additions and 4 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
%module global_vars
|
%module global_vars
|
||||||
|
|
||||||
|
%include std_string.i
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
|
|
@ -7,6 +9,7 @@
|
||||||
int x;
|
int x;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string b;
|
||||||
A a;
|
A a;
|
||||||
A *ap;
|
A *ap;
|
||||||
const A *cap;
|
const A *cap;
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,14 @@
|
||||||
Type *ptr = (Type *)0;
|
Type *ptr = (Type *)0;
|
||||||
int res = asptr_meth($input, &ptr);
|
int res = asptr_meth($input, &ptr);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred()) {
|
||||||
SWIG_type_error("$basetype", $input);
|
SWIG_type_error("$basetype", $input);
|
||||||
SWIG_append_msg(" C/C++ variable '$name'");
|
}
|
||||||
|
SWIG_append_errmsg(" C/C++ variable '$name'");
|
||||||
return 1;
|
return 1;
|
||||||
} else if (!ptr) {
|
} else if (!ptr) {
|
||||||
SWIG_null_ref("$basetype");
|
SWIG_null_ref("$basetype");
|
||||||
SWIG_append_msg(" C/C++ variable '$name'");
|
SWIG_append_errmsg(" C/C++ variable '$name'");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
$1 = *ptr;
|
$1 = *ptr;
|
||||||
|
|
@ -69,6 +70,7 @@
|
||||||
$result = &temp;
|
$result = &temp;
|
||||||
if (res == SWIG_NEWOBJ) delete ptr;
|
if (res == SWIG_NEWOBJ) delete ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(directorout,fragment=pyfrag) Type {
|
%typemap(directorout,fragment=pyfrag) Type {
|
||||||
Type *ptr = 0;
|
Type *ptr = 0;
|
||||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||||
|
|
@ -77,7 +79,8 @@
|
||||||
$result = *ptr;
|
$result = *ptr;
|
||||||
if (res == SWIG_NEWOBJ) delete ptr;
|
if (res == SWIG_NEWOBJ) delete ptr;
|
||||||
}
|
}
|
||||||
%typemap(directorout,fragment=pyfrag,warning="470:Possible thread/reentrant unsafe wrapping, consider using a plain '"#Type"' return type instead.") const Type& {
|
|
||||||
|
%typemap(directorout,fragment=pyfrag,warning="470:Possible thread/reentrant unsafe wrapping, consider using a plain '"#Type"' return type instead.") const Type& {
|
||||||
Type *ptr = 0;
|
Type *ptr = 0;
|
||||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||||
if (!res || !ptr)
|
if (!res || !ptr)
|
||||||
|
|
@ -92,7 +95,9 @@
|
||||||
$result = ptr;
|
$result = ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(directorout,fragment=pyfrag) Type &DIRECTOROUT = Type
|
%typemap(directorout,fragment=pyfrag) Type &DIRECTOROUT = Type
|
||||||
|
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
/* typecheck */
|
/* typecheck */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue