mirror of https://github.com/swig/swig
Fix typecheck typemaps for SWIGTYPE *const&
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12413 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0731ad0a6a
commit
640cce2c50
|
@ -5,7 +5,11 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.2 (in progress)
|
||||
===========================
|
||||
|
||||
2010-01-17: wsfulton
|
||||
2011-01-30: wsfulton
|
||||
Fix overloading with const pointer reference (SWIGTYPE *const&) parameters for a
|
||||
number of scripting languages.
|
||||
|
||||
2011-01-17: wsfulton
|
||||
New warning for smart pointers if only some of the classes in the inheritance
|
||||
chain are marked as smart pointer, eg, %shared_ptr should be used for all classes
|
||||
in an inheritance hierarchy, so this new warning highlights code where this is
|
||||
|
@ -14,12 +18,12 @@ Version 2.0.2 (in progress)
|
|||
example.i:12: Warning 520: Base class 'A' of 'B' is not similarly marked as a smart pointer.
|
||||
example.i:16: Warning 520: Derived class 'C' of 'B' is not similarly marked as a smart pointer.
|
||||
|
||||
2010-01-14: wsfulton
|
||||
2011-01-14: wsfulton
|
||||
Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and
|
||||
(char *STRING, int LENGTH). Documentation for this updated. Java patch from
|
||||
Volker Grabsch.
|
||||
|
||||
2010-01-11: iant
|
||||
2011-01-11: iant
|
||||
Require Go version 7077 or later.
|
||||
|
||||
2010-12-30: klickverbot
|
||||
|
|
|
@ -12,6 +12,9 @@ public class pointer_reference_runme {
|
|||
Struct ss = new Struct(20);
|
||||
pointer_reference.set(ss);
|
||||
if (Struct.instance.value != 20) throw new Exception("set test failed");
|
||||
|
||||
if (pointer_reference.overloading(1) != 111) throw new Exception("overload test 1 failed");
|
||||
if (pointer_reference.overloading(ss) != 222) throw new Exception("overload test 2 failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,5 +19,8 @@ public class pointer_reference_runme {
|
|||
Struct ss = new Struct(20);
|
||||
pointer_reference.set(ss);
|
||||
if (Struct.getInstance().getValue() != 20) throw new RuntimeException("set test failed");
|
||||
|
||||
if (pointer_reference.overloading(1) != 111) throw new RuntimeException("overload test 1 failed");
|
||||
if (pointer_reference.overloading(ss) != 222) throw new RuntimeException("overload test 2 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,3 +9,5 @@ ss = pointer_reference.Struct(20);
|
|||
pointer_reference.set(ss);
|
||||
assert(pointer_reference.Struct_instance.value == 20)
|
||||
|
||||
assert(pointer_reference.overloading(1) == 111)
|
||||
assert(pointer_reference.overloading(ss) == 222)
|
||||
|
|
|
@ -11,5 +11,8 @@ pointer_reference::set($ss);
|
|||
$i = Struct::instance();
|
||||
check::equal($i->value, 20, "pointer_reference::set() failed");
|
||||
|
||||
check::equal(pointer_reference::overloading(1), 111, "overload test 1 failed");
|
||||
check::equal(pointer_reference::overloading($ss), 222, "overload test 2 failed");
|
||||
|
||||
check::done();
|
||||
?>
|
||||
|
|
|
@ -35,6 +35,12 @@ void set(Struct *const& s) {
|
|||
Struct *const& get() {
|
||||
return Struct::pInstance;
|
||||
}
|
||||
int overloading(int i) {
|
||||
return 111;
|
||||
}
|
||||
int overloading(Struct *const& s) {
|
||||
return 222;
|
||||
}
|
||||
%}
|
||||
|
||||
%{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import pointer_reference
|
||||
|
||||
s = pointer_reference.get()
|
||||
if s.value != 10:
|
||||
raise RuntimeError, "get test failed"
|
||||
|
||||
ss = pointer_reference.Struct(20)
|
||||
pointer_reference.set(ss)
|
||||
if pointer_reference.cvar.Struct_instance.value != 20:
|
||||
raise RuntimeError, "set test failed"
|
||||
|
||||
if pointer_reference.overloading(1) != 111:
|
||||
raise RuntimeError, "overload test 1 failed"
|
||||
|
||||
if pointer_reference.overloading(ss) != 222:
|
||||
raise RuntimeError, "overload test 2 failed"
|
|
@ -446,6 +446,12 @@
|
|||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $*1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||
{
|
||||
void *tmp;
|
||||
|
|
|
@ -301,7 +301,7 @@
|
|||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue