Fix import_stl testcase

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12688 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-05-19 06:42:56 +00:00
commit dfa13b658e
5 changed files with 64 additions and 58 deletions

View file

@ -2,8 +2,12 @@ This file contains the changes for the current release.
See the CHANGES file for changes in older releases. See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release. See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.4 (17 May 2011) Version 2.0.4 (in progress)
=========================== ===========================
2011-05-19: wsfulton
[Ruby] Fix %import where one of the imported files %include one of the STL include
files such as std_vector.i.
2011-05-17: wsfulton 2011-05-17: wsfulton
[Java] Apply #3289851 from Alan Harder to fix memory leak in directors when checking [Java] Apply #3289851 from Alan Harder to fix memory leak in directors when checking
for pending exceptions. for pending exceptions.

View file

@ -34,52 +34,7 @@
*/ */
namespace swig { %fragment("GC_VALUE_definition","header") {
%nodirector GC_VALUE;
// We ignore the constructor so that user can never create a GC_VALUE
// manually
%ignore GC_VALUE::GC_VALUE;
struct GC_VALUE {
VALUE inspect() const;
VALUE to_s() const;
GC_VALUE();
protected:
GC_VALUE( const GC_VALUE& );
~GC_VALUE();
};
%exception GC_VALUE {};
%apply VALUE {GC_VALUE};
// Make sure this is the last typecheck done
%typecheck(999999,noblock=1) GC_VALUE, GC_VALUE&,
const GC_VALUE& { $1 = 1; };
/* For input */
%typemap(in,noblock=1) GC_VALUE* (GC_VALUE r), GC_VALUE& (GC_VALUE r) {
r = $input; $1 = &r;
}
/* For output */
%typemap(out,noblock=1) GC_VALUE {
$result = (VALUE)$1;
}
%typemap(out,noblock=1) GC_VALUE*, GC_VALUE const & {
$result = (VALUE)*$1;
}
%ignore LANGUAGE_OBJ;
typedef GC_VALUE LANGUAGE_OBJ;
}
%{
namespace swig { namespace swig {
class GC_VALUE { class GC_VALUE {
protected: protected:
@ -213,7 +168,7 @@ namespace swig {
} }
#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \ %#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
bool op( const GC_VALUE& other ) const \ bool op( const GC_VALUE& other ) const \
{ \ { \
if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \ if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \
@ -253,14 +208,14 @@ namespace swig {
GC_VALUE_CMP( le_id, operator<=, <=, <= 0 ) GC_VALUE_CMP( le_id, operator<=, <=, <= 0 )
GC_VALUE_CMP( gt_id, operator>, > , > 0 ) GC_VALUE_CMP( gt_id, operator>, > , > 0 )
GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 ) GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 )
#undef GC_VALUE_CMP %#undef GC_VALUE_CMP
bool operator!=( const GC_VALUE& other ) bool operator!=( const GC_VALUE& other )
{ {
return !(this->operator==(other)); return !(this->operator==(other));
} }
#define GC_VALUE_UNARY( proc_id, op ) \ %#define GC_VALUE_UNARY( proc_id, op ) \
GC_VALUE op() const \ GC_VALUE op() const \
{ \ { \
VALUE ret = Qnil; \ VALUE ret = Qnil; \
@ -280,9 +235,9 @@ namespace swig {
GC_VALUE_UNARY( pos_id, operator+ ) GC_VALUE_UNARY( pos_id, operator+ )
GC_VALUE_UNARY( neg_id, operator- ) GC_VALUE_UNARY( neg_id, operator- )
GC_VALUE_UNARY( inv_id, operator~ ) GC_VALUE_UNARY( inv_id, operator~ )
#undef GC_VALUE_BINARY %#undef GC_VALUE_BINARY
#define GC_VALUE_BINARY( proc_id, op ) \ %#define GC_VALUE_BINARY( proc_id, op ) \
GC_VALUE op( const GC_VALUE& other ) const \ GC_VALUE op( const GC_VALUE& other ) const \
{ \ { \
VALUE ret = Qnil; \ VALUE ret = Qnil; \
@ -311,7 +266,7 @@ namespace swig {
GC_VALUE_BINARY( lshift_id, operator<< ); GC_VALUE_BINARY( lshift_id, operator<< );
GC_VALUE_BINARY( rshift_id, operator>> ); GC_VALUE_BINARY( rshift_id, operator>> );
#undef GC_VALUE_BINARY %#undef GC_VALUE_BINARY
}; };
@ -345,7 +300,53 @@ namespace swig {
} // namespace swig } // namespace swig
%} } // %fragment(GC_VALUE_definition)
namespace swig {
%apply VALUE {GC_VALUE};
// Make sure this is the last typecheck done
%typecheck(999999,fragment="GC_VALUE_definition",noblock=1) GC_VALUE, GC_VALUE&,
const GC_VALUE& { $1 = 1; };
/* For input */
%typemap(in,fragment="GC_VALUE_definition",noblock=1) GC_VALUE* (GC_VALUE r), GC_VALUE& (GC_VALUE r) {
r = $input; $1 = &r;
}
/* For output */
%typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE {
$result = (VALUE)$1;
}
%typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE*, GC_VALUE const & {
$result = (VALUE)*$1;
}
%nodirector GC_VALUE;
// We ignore the constructor so that user can never create a GC_VALUE
// manually
%ignore GC_VALUE::GC_VALUE;
struct GC_VALUE {
VALUE inspect() const;
VALUE to_s() const;
GC_VALUE();
protected:
GC_VALUE( const GC_VALUE& );
~GC_VALUE();
};
%exception GC_VALUE {};
%ignore LANGUAGE_OBJ;
typedef GC_VALUE LANGUAGE_OBJ;
}
%init { %init {
@ -359,7 +360,7 @@ namespace swig {
// These functions may be invoked as a need of the from(), asval(), // These functions may be invoked as a need of the from(), asval(),
// asptr() and as() template functors, usually used in %typemaps. // asptr() and as() template functors, usually used in %typemaps.
// //
%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") { %fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits",fragment="GC_VALUE_definition") {
namespace swig { namespace swig {
template <> struct traits<GC_VALUE > { template <> struct traits<GC_VALUE > {
typedef value_category category; typedef value_category category;

View file

@ -972,7 +972,8 @@ namespace swig
%fragment("StdSequenceTraits","header", %fragment("StdSequenceTraits","header",
fragment="StdTraits", fragment="StdTraits",
fragment="RubySequence_Cont") fragment="RubySequence_Cont",
fragment="GC_VALUE_definition")
{ {
namespace swig { namespace swig {
template <class RubySeq, class Seq> template <class RubySeq, class Seq>

View file

@ -12,7 +12,7 @@
%include <std_common.i> %include <std_common.i>
%fragment("ConstIterator","header") { %fragment("ConstIterator","header",fragment="GC_VALUE_definition") {
namespace swig { namespace swig {
struct stop_iteration { struct stop_iteration {
}; };

View file

@ -83,7 +83,7 @@ namespace swig {
} }
%fragment("StdFunctors","header",fragment="StdTraits") %fragment("StdFunctors","header",fragment="StdTraits",fragment="GC_VALUE_definition")
{ {
namespace swig { namespace swig {