merge from trunk

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12002 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2010-04-30 03:03:24 +00:00
commit 07cb6351f1
181 changed files with 4467 additions and 6779 deletions

View file

@ -203,22 +203,28 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
%typemap(in) wchar_t "$1 = $input;";
%typemap(lin,numinputs=1) wchar_t "(cl::let (($out (cl:char-code $in)))\n $body)";
%typemap(lin,numinputs=1) wchar_t* "(excl:with-native-string ($out $in
%typemap(lin,numinputs=1) wchar_t * "(excl:with-native-string ($out $in
:external-format #+little-endian :fat-le #-little-endian :fat)\n
$body)"
%typemap(out) wchar_t "$result = $1;";
%typemap(lout) wchar_t "(cl::setq ACL_ffresult (cl::code-char $body))";
%typemap(lout) wchar_t* "(cl::setq ACL_ffresult (excl:native-to-string $body
%typemap(lout) wchar_t * "(cl::setq ACL_ffresult (excl:native-to-string $body
:external-format #+little-endian :fat-le #-little-endian :fat))";
%typemap(ffitype) wchar_t ":unsigned-short";
%typemap(lisptype) wchar_t "";
%typemap(ctype) wchar_t "wchar_t";
%typemap(lispclass) wchar_t "cl:character";
%typemap(lispclass) wchar_t* "cl:string";
%typemap(lispclass) wchar_t * "cl:string";
//////////////////////////////////////////////////////////////
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* name conversion for overloaded operators. */
#ifdef __cplusplus
%rename(__add__) *::operator+;

View file

@ -130,6 +130,11 @@
%typemap(lispclass) double "cl:number";
%typemap(lispclass) char * "cl:string";
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
%{

View file

@ -679,6 +679,16 @@ $result = C_SCHEME_UNDEFINED;
%apply unsigned long { size_t };
/* ------------------------------------------------------------
* Various
* ------------------------------------------------------------ */
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* Overloaded operator support
* ------------------------------------------------------------ */

View file

@ -30,7 +30,7 @@ namespace std {
%typemap(typecheck) string = char *;
%typemap(typecheck) const string & = char *;
%typemap(in) string (char* tempptr) {
%typemap(in) string (char * tempptr) {
if ($input == C_SCHEME_FALSE) {
$1.resize(0);
} else {
@ -44,8 +44,7 @@ namespace std {
}
}
%typemap(in) const string& (std::string temp,
char* tempptr) {
%typemap(in) const string& (std::string temp, char *tempptr) {
if ($input == C_SCHEME_FALSE) {
temp.resize(0);

View file

@ -1,7 +1,9 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
@ -10,6 +12,7 @@
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
@ -41,10 +44,10 @@
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = (((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -135,7 +138,7 @@
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE *& {
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;

View file

@ -522,6 +522,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -782,24 +783,21 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
} %}
/* Pointer reference typemaps */
%typemap(ctype) SWIGTYPE *& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *& "HandleRef"
%typemap(cstype) SWIGTYPE *& "$*csclassname"
%typemap(csin) SWIGTYPE *& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *& {
%typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef"
%typemap(cstype) SWIGTYPE *const& "$*csclassname"
%typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& {
IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret;
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ $result = (void *)*$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Marshal C/C++ pointer to IntPtr */
%typemap(ctype) void *VOID_INT_PTR "void *"
%typemap(imtype) void *VOID_INT_PTR "IntPtr"
@ -841,7 +839,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(csbody_derived) SWIGTYPE %{
private HandleRef swigCPtr;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclassnameUpcast(cPtr), cMemoryOwn) {
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
@ -953,6 +951,12 @@ using System.Runtime.InteropServices;
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* csharp keywords */
%include <csharpkw.swg>

View file

@ -296,14 +296,14 @@ namespace std {
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning specialize_std_map_on_key ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning specialize_std_map_on_value ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning specialize_std_map_on_both ignored - macro is deprecated and no longer necessary
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef

View file

@ -25,7 +25,7 @@
%include <std_common.i>
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CTYPE...)
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
%typemap(cscode) std::vector<CTYPE > %{
public $csclassname(System.Collections.ICollection c) : this() {
@ -208,16 +208,16 @@
public:
typedef size_t size_type;
typedef CTYPE value_type;
typedef CONST_REFERENCE_TYPE const_reference;
typedef CONST_REFERENCE const_reference;
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
void push_back(const value_type& x);
void push_back(CTYPE const& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
%newobject GetRange(int index, int count);
%newobject Repeat(const value_type& value, int count);
%newobject Repeat(CTYPE const& value, int count);
vector();
vector(const vector &other);
%extend {
@ -243,7 +243,7 @@
else
throw std::out_of_range("index");
}
void setitem(int index, const value_type& val) throw (std::out_of_range) {
void setitem(int index, CTYPE const& val) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
(*$self)[index] = val;
else
@ -263,7 +263,7 @@
throw std::invalid_argument("invalid range");
return new std::vector<CTYPE >($self->begin()+index, $self->begin()+index+count);
}
void Insert(int index, const value_type& x) throw (std::out_of_range) {
void Insert(int index, CTYPE const& x) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size()+1)
$self->insert($self->begin()+index, x);
else
@ -291,7 +291,7 @@
throw std::invalid_argument("invalid range");
$self->erase($self->begin()+index, $self->begin()+index+count);
}
static std::vector<CTYPE > *Repeat(const value_type& value, int count) throw (std::out_of_range) {
static std::vector<CTYPE > *Repeat(CTYPE const& value, int count) throw (std::out_of_range) {
if (count < 0)
throw std::out_of_range("count");
return new std::vector<CTYPE >(count, value);
@ -320,31 +320,31 @@
%enddef
%define SWIG_STD_VECTOR_MINIMUM(CTYPE...)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, CTYPE const&, CTYPE)
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// The class will then implement IList<>, which adds extra functionality
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
%extend {
bool Contains(const value_type& value) {
bool Contains(CTYPE const& value) {
return std::find($self->begin(), $self->end(), value) != $self->end();
}
int IndexOf(const value_type& value) {
int IndexOf(CTYPE const& value) {
int index = -1;
std::vector<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end())
index = (int)(it - $self->begin());
return index;
}
int LastIndexOf(const value_type& value) {
int LastIndexOf(CTYPE const& value) {
int index = -1;
std::vector<CTYPE >::reverse_iterator rit = std::find($self->rbegin(), $self->rend(), value);
if (rit != $self->rend())
index = (int)($self->rend() - 1 - rit);
return index;
}
bool Remove(const value_type& value) {
bool Remove(CTYPE const& value) {
std::vector<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end()) {
$self->erase(it);
@ -359,7 +359,7 @@ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector<CTYPE > {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, CTYPE)
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, CTYPE const&, CTYPE)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
@ -394,16 +394,12 @@ namespace std {
template<class T> class vector {
SWIG_STD_VECTOR_MINIMUM(T)
};
// specializations for pointers
template<class T> class vector<T*> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T*)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T*)
// specialization for pointers
template<class T> class vector<T *> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, T *const&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
template<class T> class vector<const T*> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, const T*)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(const T*)
};
// bool is a bit different in the C++ standard
// bool is specialized in the C++ standard - const_reference in particular
template<> class vector<bool> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool)

View file

@ -224,7 +224,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& __getitem__(const K& key) throw (std::out_of_range) {
const T& __getitem__(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -26,7 +26,7 @@ namespace std {
%typemap(typecheck) string = char *;
%typemap(typecheck) const string & = char *;
%typemap(in) string (char* tempptr) {
%typemap(in) string (char * tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
$1.assign(tempptr);
@ -36,8 +36,7 @@ namespace std {
}
}
%typemap(in) const string & (std::string temp,
char* tempptr) {
%typemap(in) const string & (std::string temp, char *tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
temp.assign(tempptr);
@ -48,7 +47,7 @@ namespace std {
}
}
%typemap(in) string * (char* tempptr) {
%typemap(in) string * (char *tempptr) {
if (gh_string_p($input)) {
tempptr = SWIG_scm2str($input);
$1 = new std::string(tempptr);

View file

@ -208,7 +208,7 @@ namespace std {
self->pop_back();
return x;
}
T& ref(int i) throw (std::out_of_range) {
const T& ref(int i) throw (std::out_of_range) {
int size = int(self->size());
if (i>=0 && i<size)
return (*self)[i];

View file

@ -448,4 +448,10 @@ typedef unsigned long SCM;
$1 = SWIG_CheckState(res);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* typemaps.i ends here */

View file

@ -1,13 +1,16 @@
%include <intrusive_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE "(void)arg1; delete smartarg1;"
// Typemap customisations...
%typemap(in) CONST TYPE ($&1_type argp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain value
@ -66,12 +69,12 @@
#endif
%}
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain pointer by reference
temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp;
%}
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE *& %{
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
// plain pointer by reference(out)
#if ($owner)
if (*$1) {
@ -243,7 +246,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
@ -350,10 +353,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
@ -393,7 +396,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -1,15 +1,18 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in) CONST TYPE ($&1_type argp = 0) %{
@ -41,10 +44,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -129,7 +132,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -897,6 +897,7 @@
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -1025,23 +1026,20 @@
}
/* Pointer reference typemaps */
%typemap(jni) SWIGTYPE *& "jlong"
%typemap(jtype) SWIGTYPE *& "long"
%typemap(jstype) SWIGTYPE *& "$*javaclassname"
%typemap(javain) SWIGTYPE *& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *& {
%typemap(jni) SWIGTYPE *const& "jlong"
%typemap(jtype) SWIGTYPE *const& "long"
%typemap(jstype) SWIGTYPE *const& "$*javaclassname"
%typemap(javain) SWIGTYPE *const& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *const& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new $*javaclassname(cPtr, $owner);
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
%{ temp = *($1_ltype)&$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ *($1_ltype)&$result = *$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
@ -1072,7 +1070,7 @@
private long swigCPtr;
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
super($imclassname.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
super($imclassname.$javaclazznameSWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
@ -1085,7 +1083,7 @@
/* Set the default for SWIGTYPE: pointer constructor is protected,
getCPtr is protected. Season to your own taste! */
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
SWIG_JAVABODY_METHODS(public, public, SWIGTYPE)
// Typewrapper classes
%typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
@ -1132,7 +1130,7 @@ SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
*/
%define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclassname_director_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
this($imcall, OWNERSHIP);$directorconnect
}
%enddef
@ -1195,7 +1193,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
#define %nojavaexception %feature("except","0",throws="")
#define %clearjavaexception %feature("except","",throws="")
%pragma(java) jniclassclassmodifiers="class"
%pragma(java) jniclassclassmodifiers="public class"
%pragma(java) moduleclassmodifiers="public class"
/* Some ANSI C typemaps */
@ -1203,6 +1201,12 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* java keywords */
%include <javakw.swg>

View file

@ -58,119 +58,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
}

View file

@ -40,7 +40,7 @@
%typemap(consttab) long long, unsigned long long
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
%typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
// member function pointers
@ -176,7 +176,7 @@ use %include <std_except.i> instead
%{lua_pushnumber(L,(lua_Number)(int)$1);SWIG_fail; %}
// strings are just sent as errors
%typemap(throws) char*, const char*
%typemap(throws) char *, const char *
%{lua_pushstring(L,$1);SWIG_fail;%}
// char is changed to a string

View file

@ -661,7 +661,7 @@ SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
swig_lua_userdata* usr;
if (lua_isuserdata(L,tp))
{
usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
if (usr && usr->type && usr->type->str)
return usr->type->str;
return "userdata (unknown type)";

View file

@ -89,30 +89,39 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
%typemap(out) const bool&
%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%}
// strings (char* and char[])
%typemap(in,checkfn="lua_isstring") const char*, char*
// strings (char * and char[])
%fragment("SWIG_lua_isnilstring", "header") {
int SWIG_lua_isnilstring(lua_State *L, int idx) {
int ret = lua_isstring(L, idx);
if (!ret)
ret = lua_isnil(L, idx);
return ret;
}
}
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char *, char *
%{$1 = ($ltype)lua_tostring(L, $input);%}
%typemap(in,checkfn="lua_isstring") const char[ANY], char[ANY]
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char[ANY], char[ANY]
%{$1 = ($ltype)lua_tostring(L, $input);%}
%typemap(out) const char*, char*
%{ lua_pushstring(L,(const char*)$1); SWIG_arg++;%}
%typemap(out) const char *, char *
%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%}
%typemap(out) const char[ANY], char[ANY]
%{ lua_pushstring(L,(const char*)$1); SWIG_arg++;%}
%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%}
// char's
// currently treating chars as small strings, not as numbers
// (however signed & unsigned char's are numbers...)
%typemap(in,checkfn="lua_isstring") char
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") char
%{$1 = (lua_tostring(L, $input))[0];%}
%typemap(out) char
%{ lua_pushfstring(L,"%c",$1); SWIG_arg++;%}
// by const ref
%typemap(in,checkfn="lua_isstring") const char& (char temp)
%typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char& (char temp)
%{temp = (lua_tostring(L, $input))[0]; $1=&temp;%}
%typemap(out) const char&
@ -167,11 +176,11 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
// Also needed for object ptrs by const ref
// eg A* const& ref_pointer(A* const& a);
// found in mixed_types.i
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *&($*ltype temp)
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *const&($*ltype temp)
%{temp=($*ltype)SWIG_MustGetPtr(L,$input,$*descriptor,0,$argnum,"$symname");
$1=&temp;%}
$1=($1_ltype)&temp;%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{SWIG_NewPointerObj(L,*$1,$*descriptor,$owner); SWIG_arg++; %}
@ -288,12 +297,12 @@ parmeters match which function
}
// special check for a char (string of length 1)
%typecheck(SWIG_TYPECHECK_CHAR) char, const char& {
$1 = lua_isstring(L,$input) && (lua_strlen(L,$input)==1);
%typecheck(SWIG_TYPECHECK_CHAR,fragment="SWIG_lua_isnilstring") char, const char& {
$1 = SWIG_lua_isnilstring(L,$input) && (lua_strlen(L,$input)==1);
}
%typecheck(SWIG_TYPECHECK_STRING) char *, char[] {
$1 = lua_isstring(L,$input);
%typecheck(SWIG_TYPECHECK_STRING,fragment="SWIG_lua_isnilstring") char *, char[] {
$1 = SWIG_lua_isnilstring(L,$input);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
@ -335,7 +344,7 @@ parmeters match which function
// Also needed for object ptrs by const ref
// eg const A* ref_pointer(A* const& a);
// found in mixed_types.i
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE* const &
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
{
void *ptr;
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
@ -352,6 +361,9 @@ parmeters match which function
// Array reference typemaps
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
// size_t (which is just a unsigned long)
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };

View file

@ -12,11 +12,11 @@
%{
#include <stdlib.h>
wchar_t* str2wstr(const char* str, int len)
wchar_t* str2wstr(const char *str, int len)
{
wchar_t* p;
if (str==0 || len<1) return 0;
p=(wchar*)malloc((len+1)*sizeof(wchar_t));
p=(wchar *)malloc((len+1)*sizeof(wchar_t));
if (p==0) return 0;
if (mbstowcs(p, str, len)==-1)
{
@ -28,13 +28,13 @@ wchar_t* str2wstr(const char* str, int len)
}
%}
%typemap( in, checkfn="lua_isstring" ) wchar_t*
%typemap(in, checkfn="SWIG_lua_isnilstring", fragment="SWIG_lua_isnilstring") wchar_t *
%{
$1 = str2wstr(lua_tostring( L, $input ),lua_strlen( L, $input ));
if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);goto fail;}
%}
%typemap( freearg ) wchar_t*
%typemap(freearg) wchar_t *
%{
free($1);
%}

View file

@ -745,3 +745,10 @@ FROM BlaBla IMPORT Bla;
/* Some ANSI C typemaps */
%apply unsigned long { size_t };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -247,8 +247,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
result = scheme_make_pair(k,result);
@ -467,8 +467,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_TO(i->first);
result = scheme_make_pair(k,result);
}
@ -679,8 +679,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
K* key = new K(i->first);
Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
result = scheme_make_pair(k,result);
@ -891,8 +891,8 @@ namespace std {
}
Scheme_Object* keys() {
Scheme_Object* result = scheme_null;
for (std::map<K,T >::reverse_iterator i=$1.rbegin();
i!=$1.rend(); ++i) {
for (std::map<K,T >::reverse_iterator i=self->rbegin();
i!=self->rend(); ++i) {
Scheme_Object* k = CONVERT_K_TO(i->first);
result = scheme_make_pair(k,result);
}

View file

@ -349,3 +349,10 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -10,6 +10,8 @@
#include <string>
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
namespace Swig {
/* base class for director exceptions */
class DirectorException {

View file

@ -2,7 +2,7 @@
#define OCAML_OCAMLKW_SWG_
/* Warnings for Ocaml keywords */
#define OCAMLKW(x) %namewarn("314: '" #x "' is a ocaml keyword and it will properly renamed") #x
#define OCAMLKW(x) %namewarn("314: '" #x "' is an ocaml keyword and it will be appropriately renamed") #x
/*
from

View file

@ -29,7 +29,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
@ -53,118 +53,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
}

View file

@ -314,3 +314,11 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
%swig_enum_out(out)
%swig_enum_out(varout)
%swig_enum_out(directorin)
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -1,17 +1,22 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Feature to adapt the code generated in the swigregister functions for smart pointers
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
// Typemap customisations...
// plain value
%typemap(in) CONST TYPE (void *argp, int res = 0) {
int newmem = 0;
@ -138,7 +143,7 @@
// plain pointer by reference
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
%typemap(in) CONST TYPE *& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
if (!SWIG_IsOK(res)) {
@ -153,15 +158,15 @@
}
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *& {
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
%typemap(varin) CONST TYPE *& %{
%typemap(varin) TYPE *CONST& %{
#error "varin typemap not implemented"
%}
%typemap(varout) CONST TYPE *& %{
%typemap(varout) TYPE *CONST& %{
#error "varout typemap not implemented"
%}
@ -278,10 +283,10 @@
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
CONST TYPE,
CONST TYPE &,
CONST TYPE *,
CONST TYPE *&,
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,

View file

@ -106,6 +106,8 @@ SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *point
typedef octave_value_list(*octave_func) (const octave_value_list &, int);
class octave_swig_type;
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
namespace Swig {
class Director;

View file

@ -75,7 +75,7 @@
%include <typemaps/swigtypemaps.swg>
/* ------------------------------------------------------------
* Perl extra typemaps
* Perl extra typemaps / typemap overrides
* ------------------------------------------------------------ */
%typemap(varout,type="$1_descriptor") SWIGTYPE *, SWIGTYPE []
@ -90,3 +90,6 @@
%typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) {
SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor);
}
%typemap(varout) SWIGTYPE *const = SWIGTYPE *;

View file

@ -30,7 +30,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
@ -54,119 +54,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
}

View file

@ -115,12 +115,12 @@
}
}
%typemap(in) SWIGTYPE *& ($*ltype temp)
%typemap(in) SWIGTYPE *const& ($*ltype temp)
{
if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
$1 = &temp;
$1 = ($1_ltype)&temp;
}
%typemap(in) SWIGTYPE *DISOWN
@ -339,7 +339,7 @@
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{
SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
%}
@ -394,10 +394,6 @@
SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1_name), $&1_descriptor, 2);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
%typemap(out) void "";
%typemap(out) char [ANY]
@ -441,10 +437,11 @@
_v = (SWIG_ConvertPtr(*$input, (void **)&tmp, $&1_descriptor, 0) >= 0);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *,
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &,
SWIGTYPE *&
SWIGTYPE *const&
{
void *tmp;
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
@ -478,6 +475,12 @@
SWIG_PHP_Error(E_ERROR, (char *)$1);
%}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* php keywords */
%include <phpkw.swg>

View file

@ -451,6 +451,7 @@ PHPCN(sqlitedatabase);
PHPCN(sqliteresult);
PHPCN(sqliteunbuffered);
PHPCN(sqliteexception);
PHPCN(datetime);
/* Built-in PHP functions (incomplete). */
PHPFN(cos);

View file

@ -29,7 +29,7 @@ namespace std {
unsigned int size() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
@ -56,125 +56,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
bool is_empty() const {
return self->empty();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
bool is_empty() const {
return self->empty();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
bool is_empty() const {
return self->empty();
}
}
};
%enddef
// add specializations here
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
}

View file

@ -264,6 +264,12 @@ extern "C" {
}
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* Overloaded operator support
* ------------------------------------------------------------ */

View file

@ -60,7 +60,7 @@ SWIG_AsArgcArgv(PyObject *input,
}
/*
This typemap works with either a char**, a python list or a python
This typemap works with either a char **, a python list or a python
tuple
*/

View file

@ -6,18 +6,23 @@
#define SHARED_PTR_DISOWN 0
#endif
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
// destructor wrapper customisation
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Feature to adapt the code generated in the swigregister functions for smart pointers
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
// Typemap customisations...
// plain value
%typemap(in) CONST TYPE (void *argp, int res = 0) {
int newmem = 0;
@ -146,7 +151,7 @@
// plain pointer by reference
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
%typemap(in) CONST TYPE *& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
if (!SWIG_IsOK(res)) {
@ -161,15 +166,15 @@
}
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *& {
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
%typemap(varin) CONST TYPE *& %{
%typemap(varin) TYPE *CONST& %{
#error "varin typemap not implemented"
%}
%typemap(varout) CONST TYPE *& %{
%typemap(varout) TYPE *CONST& %{
#error "varout typemap not implemented"
%}
@ -286,10 +291,10 @@
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
CONST TYPE,
CONST TYPE &,
CONST TYPE *,
CONST TYPE *&,
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,

View file

@ -85,13 +85,13 @@ namespace Swig {
}
# endif /* SWIG_DIRECTOR_RTDIR */
# define SWIG_DIRECTOR_CAST(Arg) Swig::get_rtdir(static_cast<void*>(Arg))
# define SWIG_DIRECTOR_RGTR(Arg1, Arg2) Swig::set_rtdir(static_cast<void*>(Arg1), Arg2)
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void*>(ARG))
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void*>(ARG1), ARG2)
#else
# define SWIG_DIRECTOR_CAST(Arg) dynamic_cast<Swig::Director*>(Arg)
# define SWIG_DIRECTOR_RGTR(Arg1, Arg2)
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2)
#endif /* SWIG_DIRECTOR_NORTTI */

View file

@ -3,13 +3,13 @@
#ifdef SWIG_DOC_DOXYGEN_STYLE
%typemap(doc) SWIGTYPE "@param $1_name $1_type value";
%typemap(doc) SWIGTYPE* "@param $1_name $1_type value";
%typemap(doc) const SWIGTYPE& "@param $1_name $1_type value";
%typemap(doc) SWIGTYPE * "@param $1_name $1_type value";
%typemap(doc) const SWIGTYPE & "@param $1_name $1_type value";
%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type value";
#else
%typemap(doc) SWIGTYPE "$1_name: $1_type value";
%typemap(doc) SWIGTYPE* "$1_name: $1_type value";
%typemap(doc) const SWIGTYPE& "$1_name: $1_type value";
%typemap(doc) SWIGTYPE * "$1_name: $1_type value";
%typemap(doc) const SWIGTYPE & "$1_name: $1_type value";
%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type value";
%typemap(doc) SWIGTYPE *INOUT "$1_name: $1_type input/ouput value";

View file

@ -61,7 +61,7 @@
/* ------------------------------------------------------------
* Python extra typemaps
* Python extra typemaps / typemap overrides
* ------------------------------------------------------------ */
/* Get the address of the 'python self' object */

View file

@ -144,11 +144,11 @@ SWIG_InitializeModule(0);
$1 = %reinterpret_cast(INTEGER($input), $1_ltype);
}
%typemap(in,noblock=1,fragment="SWIG_strdup") char* {
%typemap(in,noblock=1,fragment="SWIG_strdup") char * {
$1 = %reinterpret_cast(SWIG_strdup(CHAR(STRING_ELT($input, 0))), $1_ltype);
}
%typemap(freearg,noblock=1) char* {
%typemap(freearg,noblock=1) char * {
free($1);
}
@ -189,7 +189,7 @@ else
strcpy($1, "");
%}
%typemap(out,noblock=1) char*
%typemap(out,noblock=1) char *
{ $result = $1 ? Rf_mkString(%reinterpret_cast($1,char *)) : R_NilValue; }
%typemap(in,noblock=1) char {

View file

@ -29,8 +29,10 @@
%typemap("rtype") bool, bool * "logical";
%typemap("rtype") enum SWIGTYPE "character";
%typemap("rtype") enum SWIGTYPE * "character";
%typemap("rtype") enum SWIGTYPE *const "character";
%typemap("rtype") enum SWIGTYPE & "character";
%typemap("rtype") SWIGTYPE * "$R_class";
%typemap("rtype") SWIGTYPE *const "$R_class";
%typemap("rtype") SWIGTYPE & "$R_class";
%typemap("rtype") SWIGTYPE "$&R_class";
@ -65,13 +67,15 @@
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) enum SWIGTYPE *
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) enum SWIGTYPE *const
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE &
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
%{ %}
/*
%typemap(scoercein) SWIGTYPE *
%typemap(scoercein) SWIGTYPE *, SWIGTYPE *const
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
%typemap(scoercein) SWIGTYPE &
@ -115,6 +119,9 @@ string &, std::string &
%typemap(scoerceout) enum SWIGTYPE *
%{ $result = enumToInteger($result, "$R_class"); %}
%typemap(scoerceout) enum SWIGTYPE *const
%{ $result = enumToInteger($result, "$R_class"); %}
%typemap(scoerceout) SWIGTYPE
%{ class($result) <- "$&R_class"; %}
@ -125,6 +132,9 @@ string &, std::string &
%typemap(scoerceout) SWIGTYPE *
%{ class($result) <- "$R_class"; %}
%typemap(scoerceout) SWIGTYPE *const
%{ class($result) <- "$R_class"; %}
/* Override the SWIGTYPE * above. */
%typemap(scoerceout) char,
char *,

View file

@ -21,6 +21,8 @@
#include <iostream>
#include <map>
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
namespace Swig {
/* memory handler */
struct GCItem

View file

@ -1,6 +1,6 @@
%wrapper %{
#include "ruby.h"
#include <ruby.h>
int
main(argc, argv)

View file

@ -443,11 +443,10 @@ namespace swig
%typemap(out,noblock=1,fragment="RubySequence_Cont")
std::pair<const_iterator, const_iterator> {
$result = rb_ary_new2(2);
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
RARRAY_PTR($result)[1] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
RARRAY_LEN($result) = 2;
rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
}
// std::map/multimap/set allow returning std::pair< iterator, iterator > from
@ -456,11 +455,10 @@ namespace swig
%typemap(out,noblock=1,fragment="RubySequence_Cont")
std::pair<iterator, iterator> {
$result = rb_ary_new2(2);
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
RARRAY_PTR($result)[1] = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
RARRAY_LEN($result) = 2;
rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
}
@ -563,7 +561,8 @@ namespace swig
{
Sequence::const_iterator i = $self->begin();
Sequence::const_iterator e = $self->end();
VALUE str = rb_str_new2( swig::type_name< Sequence >() );
const char *type_name = swig::type_name< Sequence >();
VALUE str = rb_str_new2(type_name);
str = rb_str_cat2( str, " [" );
bool comma = false;
VALUE tmp;
@ -927,7 +926,7 @@ namespace swig
}
catch( std::invalid_argument )
{
rb_raise( rb_eArgError,
rb_raise( rb_eArgError, "%s",
Ruby_Format_TypeError( "",
swig::type_name<Sequence::value_type>(),
__FUNCTION__, idx+2, elem ));
@ -954,7 +953,7 @@ namespace swig
}
catch( std::invalid_argument )
{
rb_raise( rb_eArgError,
rb_raise( rb_eArgError, "%s",
Ruby_Format_TypeError( "",
swig::type_name<Sequence::value_type>(),
__FUNCTION__, idx+2, elem ));
@ -1009,7 +1008,7 @@ namespace swig {
if (seq) {
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
rb_raise(rb_eTypeError, e.what());
rb_raise(rb_eTypeError, "%s", e.what());
}
}
return SWIG_ERROR;
@ -1049,7 +1048,7 @@ namespace swig {
if (seq) {
VALUE lastErr = rb_gv_get("$!");
if (lastErr == Qnil) {
rb_raise(rb_eTypeError, e.what());
rb_raise(rb_eTypeError, "%s", e.what());
}
}
return SWIG_ERROR;
@ -1086,9 +1085,8 @@ namespace swig {
int i = 0;
for (const_iterator it = seq.begin();
it != seq.end(); ++it, ++i) {
RARRAY_PTR(obj)[i] = swig::from< value_type >(*it);
rb_ary_push(obj, swig::from< value_type >(*it));
}
RARRAY_LEN(obj) = size;
rb_obj_freeze(obj); // treat as immutable result
return obj;
} else {

View file

@ -72,7 +72,7 @@
catch ( const std::invalid_argument& )
{
rb_raise(rb_eTypeError,
"Yield block did not return a valid element for " #Container);
"Yield block did not return a valid element for " "Container");
}
return $self;

View file

@ -97,7 +97,7 @@ static ID swig_call_id = 0;
++swig_virtual_calls;
# define SWIG_RELEASE_STACK --swig_virtual_calls;
# define Ruby_DirectorTypeMismatchException(x) \
rb_raise( rb_eTypeError, x ); return c_result;
rb_raise( rb_eTypeError, "%s", x ); return c_result;
static unsigned int swig_virtual_calls = 0;

View file

@ -345,7 +345,8 @@
{
Map::const_iterator i = $self->begin();
Map::const_iterator e = $self->end();
VALUE str = rb_str_new2( swig::type_name< Map >() );
const char *type_name = swig::type_name< Map >();
VALUE str = rb_str_new2( type_name );
str = rb_str_cat2( str, " {" );
bool comma = false;
VALUE tmp;

View file

@ -115,7 +115,8 @@
{
MultiMap::iterator i = $self->begin();
MultiMap::iterator e = $self->end();
VALUE str = rb_str_new2( swig::type_name< MultiMap >() );
const char *type_name = swig::type_name< MultiMap >();
VALUE str = rb_str_new2( type_name );
str = rb_str_cat2( str, " {" );
VALUE tmp;
while ( i != e )

View file

@ -118,13 +118,11 @@
static VALUE from(const std::pair<T,U>& val) {
VALUE obj = rb_ary_new2(2);
RARRAY_PTR(obj)[0] = swig::from<
typename swig::noconst_traits<T >::noconst_type>(val.first);
RARRAY_PTR(obj)[1] = swig::from(val.second);
RARRAY_LEN(obj) = 2;
rb_define_singleton_method(obj, "second",
rb_ary_push(obj, swig::from<typename swig::noconst_traits<T >::noconst_type>(val.first));
rb_ary_push(obj, swig::from(val.second));
rb_define_singleton_method(obj, "second",
VALUEFUNC(_wrap_pair_second), 0 );
rb_define_singleton_method(obj, "second=",
rb_define_singleton_method(obj, "second=",
VALUEFUNC(_wrap_pair_second_eq), 1 );
rb_obj_freeze(obj); // treat as immutable tuple
return obj;
@ -148,7 +146,8 @@
VALUE inspect() const
{
VALUE tmp;
VALUE str = rb_str_new2( swig::type_name< pair >() );
const char *type_name = swig::type_name< pair >();
VALUE str = rb_str_new2( type_name );
str = rb_str_cat2( str, " (" );
tmp = swig::from( $self->first );
tmp = rb_obj_as_string( tmp );

View file

@ -170,10 +170,9 @@
%typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator")
std::pair<iterator, bool> {
$result = rb_ary_new2(2);
RARRAY_PTR($result)[0] = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first),
swig::Iterator::descriptor(),SWIG_POINTER_OWN);
RARRAY_PTR($result)[1] = SWIG_From(bool)(%static_cast($1,const $type &).second);
RARRAY_LEN($result) = 2;
rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first),
swig::Iterator::descriptor(),SWIG_POINTER_OWN));
rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second));
}
%extend {

View file

@ -1,3 +1,7 @@
// The main implementation detail in using this smart pointer of a type is to customise the code generated
// to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type.
// So for some type T, shared_ptr<T> * is used rather than T *.
// shared_ptr namespaces could be boost or std or std::tr1
// For example for std::tr1, use:
// #define SWIG_SHARED_PTR_NAMESPACE std

View file

@ -138,11 +138,11 @@ namespace std {
// const pointer specialization
// ***
template<class _Tp, class _Alloc >
class vector<const _Tp *, _Alloc > {
class vector<_Tp const *, _Alloc > {
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef const _Tp * value_type;
typedef _Tp const * value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type reference;
@ -151,32 +151,32 @@ namespace std {
%traits_swigtype(_Tp);
%fragment(SWIG_Traits_frag(std::vector<const _Tp *, _Alloc >), "header",
%fragment(SWIG_Traits_frag(std::vector<_Tp const*, _Alloc >), "header",
fragment=SWIG_Traits_frag(_Tp),
fragment="StdVectorTraits") {
namespace swig {
template <> struct traits<std::vector<const _Tp *, _Alloc > > {
template <> struct traits<std::vector<_Tp const*, _Alloc > > {
typedef value_category category;
static const char* type_name() {
return "std::vector<const " #_Tp " *," #_Alloc " >";
return "std::vector<" #_Tp " const*," #_Alloc " >";
}
};
}
}
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<const _Tp *, _Alloc >);
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp const*, _Alloc >);
#ifdef %swig_vector_methods_val
// Add swig/language extra methods
%swig_vector_methods_val(std::vector<const _Tp *, _Alloc >);
%swig_vector_methods_val(std::vector<_Tp const*, _Alloc >);
#endif
%std_vector_methods_val(vector);
};
// ***
// ***
// bool specialization
// ***
template<class _Alloc >
class vector<bool,_Alloc > {

View file

@ -156,6 +156,11 @@
#define %nonaturalvar %feature("naturalvar","0")
#define %clearnaturalvar %feature("naturalvar","")
/* nspace directives */
#define %nspace %feature("nspace")
#define %nonspace %feature("nspace","0")
#define %clearnspace %feature("nspace","")
/* valuewrapper directives */
#define %valuewrapper %feature("valuewrapper")
#define %clearvaluewrapper %feature("valuewrapper","")

View file

@ -31,7 +31,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
@ -55,119 +55,17 @@ namespace std {
}
};
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
// specializations for built-ins
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef
}

View file

@ -61,7 +61,7 @@
/* ------------------------------------------------------------
* Tcl extra typemaps
* Tcl extra typemaps / typemap overrides
* ------------------------------------------------------------ */
#if 1
@ -84,6 +84,7 @@
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE *const = SWIGTYPE *;
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;

View file

@ -147,8 +147,7 @@
*/
%define Name ## _mutable(TYPEMAP,EXP...)
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP
(int res, Char* t = 0, size_t n = 0, int alloc = 0, size_t expansion = 0) {
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP (int res, Char *t = 0, size_t n = 0, int alloc = 0, size_t expansion = 0) {
#if #EXP != ""
expansion += EXP;
#endif

View file

@ -1,238 +1,15 @@
/*
Fragments:
==========
Fragments
=========
See the "Typemap fragments" section in the documentation for understanding
fragments. Below is some info on how fragments and automatic type
specialization is used.
Second to typemaps, fragments are one the most powerful and
dangerous swig features. So, if you are starting to read about them,
make sure you read all of this document.
Macros that make the automatic generation of typemaps easier are provided.
Basics:
=======
Consider the following code:
Fragments provide a way to include or generate code into "on-demand"
as the typemaps could require.
For example, if you have a very long typemap
%typemap(in) MyClass * {
MyClass *value = 0;
<very long typemap>
....
value = somewhere_converted_from_input_object_here($input);
...
<very long typemap>
$result = value;
}
very soon you will discover yourself copying the same long
conversion code in several typemaps, such as varin, directorout,
etc. Also, you will discover that swig copes verbatim the same very
long conversion code for every argument that requires it, making the
code very large too.
To eliminate this automatic or manual code copying, we define a
fragment that includes the common conversion code:
%fragment("AsMyClass","header") {
MyClass *AsMyClass(PyObject *obj) {
MyClass *value = 0;
<very long conversion>
....
value = somewhere_converted_from_input_object_here(obj);
...
<very long conversion>
return value;
}
}
%typemap(in,fragment="AsMyClass") MyClass * {
$result = AsMyClass($input);
}
%typemap(varin,fragment="AsMyClass") MyClass * {
$result = AsMyClass($input);
}
When the 'in' or 'varin' typemaps for MyClass are invoked, the
fragment "AsMyClass" is added to the "header" section, and then the
typemap code is emitted. Hence, the method AsMyClass will be
included in the wrapping code and it will be available at the time
the typemap is applied.
To define a fragment then you need a name, a section where it goes,
and the code. Usually the section refers to the "header" part, and
both string and braces forms are accepted, ie:
%fragment("my_name","header") { ... }
%fragment("my_name","header") "...";
To ensure all the fragment/typemap engine works as expected, there
are some rules that fragments follow:
1.- A fragment is added to the wrapping code only once, ie, for the
method:
int foo(MyClass *a, MyClass *b);
the wrapped code will look as much as:
MyClass *AsMyClass(PyObject *obj) {
.....
}
int _wrap_foo(...) {
....
arg1 = AsMyClass(obj1);
arg2 = AsMyClass(obj2);
...
result = foo(arg1, arg2);
}
even when there will be duplicated typemap to process 'a' and
'b', the 'AsMyClass' method will be defined only once.
2.- A fragment can only defined once, and the first definition
is the only one taking in account. All other definitions of the
same fragments are silently ignored. For example, you can have
%fragment("AsMyClass","header") { <definition 1> }
....
%fragment("AsMyClass","header") { <definition 2> }
and then only the first definition is considered. In this way
you can change the 'system' fragments by including yours first.
Note that this behavior is opposite to the typemaps, where the
last typemap applied or defined prevails. Fragment follows the
first-in-first-out convention since they are intended to be
"global", while typemaps intend to be "locally" specialized.
3.- Fragments names can not contain commas.
A fragment can include one or more additional fragments, for example:
%fragment("<limits.h>", "header") {
#include <limits.h>
}
%fragment("AsMyClass", "header", fragment="<limits.h>") {
MyClass *AsMyClass(PyObject *obj) {
MyClass *value = 0;
int ival = somewhere_converted_from_input_object_here(obj)
...
if (ival < CHAR_MIN) {
value = something_from_ival(ival);
} else {
...
}
...
return value;
}
}
in this case, when the "AsMyClass" fragment is emitted, it also
trigger the inclusion of the "<limits.h>" fragment.
You can add as many fragments as you want, for example
%fragment("bigfragment","header", fragment="frag1", fragment="frag2", fragment="frag3") "";
here, when the "bigfragment" is included, the three fragments "frag1",
"frag2" and "frag3" are included. Note that as "bigframent" is defined
empty, "", it does not add any code by itself, buy only trigger the
inclusion of the other fragments.
In a typemap you can also include more than one fragment, but since the
syntax is different, you need to specify them in a 'comma separated'
list, for example, considering the previous example:
%typemap(in,fragment="frag1,frag2,frag3") {...}
is equivalent to
%typemap(in,fragment="bigfragment") {...}
Finally, you can force the inclusion of a fragment at any moment as follow:
%fragment("bigfragment");
which is very useful inside a template class, for example.
Fragment type specialization
============================
Fragments can be "type specialized". The syntax is as follows
%fragment("name","header") { a type independent fragment }
%fragment("name" {Type}, "header") { a type dependent fragment }
and they can also, as typemaps, be used inside templates, for exampe:
template <class T>
struct A {
%fragment("incode"{A<T>},"header") {
'incode' specialized fragment
}
%typemap(in,fragment="incode"{A<T>}) {
here we use the 'type specialized'
fragment "incode"{A<T>}
}
};
which could seems a not much interesting feature, but is
fundamental for automatic typemap and template specialization.
Fragments and automatic typemap specialization:
===============================================
Since fragments can be type specialized, they can be elegantly used
to specialized typemaps .
For example, if you have something like:
%fragment("incode"{float}, "header") {
float in_method_float(PyObject *obj) {
...
}
}
%fragment("incode"{long}, "header") {
float in_method_long(PyObject *obj) {
...
}
}
%define %my_typemaps(Type)
%typemaps(in,fragment="incode"{Type}) {
value = in_method_##Type(obj);
}
%enddef
%my_typemaps(float);
%my_typemaps(long);
then the proper "incode"{float,double} fragment will be included,
and the proper in_method_{float,double} will be called.
Since this is a recurrent fragment use, we provide a couple of
macros that make the automatic generation of typemaps easier:
Consider for example the following code:
%fragment(SWIG_From_frag(bool),"header") {
%fragment(SWIG_From_frag(bool), "header") {
static PyObject*
SWIG_From_dec(bool)(bool value)
{
@ -242,7 +19,7 @@
}
}
%typemap(out,fragment=SWIG_From_frag(bool)) bool {
%typemap(out, fragment=SWIG_From_frag(bool)) bool {
$result = SWIG_From(bool)($1));
}

View file

@ -54,7 +54,7 @@
/* out */
%typemap(out,noblock=1,fragment=#SWIG_FromCharPtr) Char *, const Char* {
%typemap(out,noblock=1,fragment=#SWIG_FromCharPtr) Char *, const Char * {
%set_output(SWIG_FromCharPtr((const Char *)$1));
}
@ -98,7 +98,7 @@
/* varout */
%typemap(varout,noblock=1,fragment=#SWIG_FromCharPtr) Char*, const Char* {
%typemap(varout,noblock=1,fragment=#SWIG_FromCharPtr) Char *, const Char * {
%set_varoutput(SWIG_FromCharPtr($1));
}
@ -165,8 +165,7 @@
/* directorout */
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG)
Char * (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ) {
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) Char * (int res, Char *buf = 0, int alloc = SWIG_NEWOBJ) {
res = SWIG_AsCharPtr($input, &buf, &alloc);
if (!SWIG_IsOK(res)) {
%dirout_fail(res, "$type");
@ -184,9 +183,7 @@
}
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG)
Char * const& (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ),
Char const* const& (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ) {
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) Char *const& (int res, Char *buf = 0, int alloc = SWIG_NEWOBJ), Char const*const& (int res, Char *buf = 0, int alloc = SWIG_NEWOBJ) {
res = SWIG_AsCharPtr($input, &buf, &alloc);
if (!SWIG_IsOK(res)) {
%dirout_fail(res, "$type");
@ -226,8 +223,8 @@
* Unknown size const Character array Char[ANY] handling
* ------------------------------------------------------------ */
%apply Char* { Char [] };
%apply const Char* { const Char [] };
%apply Char * { Char [] };
%apply const Char * { const Char [] };
%typemap(varin,noblock=1,warning="462:Unable to set variable of type Char []") Char []
{

View file

@ -21,15 +21,15 @@
%typemap(freearg) SWIGTYPE [] "";
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, int res = 0, $*ltype temp) {
%typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) {
res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags);
if (!SWIG_IsOK(res)) {
%argument_fail(res, "$*ltype", $symname, $argnum);
}
temp = %reinterpret_cast(argp, $*ltype);
$1 = &temp;
$1 = %reinterpret_cast(&temp, $1_ltype);
}
%typemap(freearg) SWIGTYPE* const& "";
%typemap(freearg) SWIGTYPE *const& "";
/* Reference */
@ -106,7 +106,7 @@
%set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags));
}
%typemap(out, noblock=1) SWIGTYPE* const& {
%typemap(out, noblock=1) SWIGTYPE *const& {
%set_output(SWIG_NewPointerObj(%as_voidptr(*$1), $*descriptor, $owner | %newpointer_flags));
}
@ -299,6 +299,12 @@
$1 = SWIG_CheckState(res);
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& {
void *vptr = 0;
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
$1 = SWIG_CheckState(res);
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & {
void *vptr = 0;
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
@ -337,7 +343,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE*, SWIGTYPE* const& {
%typemap(directorin,noblock=1) SWIGTYPE *, SWIGTYPE *const& {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
}
@ -345,7 +351,7 @@
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $&descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE& {
%typemap(directorin,noblock=1) SWIGTYPE & {
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
}
@ -407,7 +413,7 @@
* --- Constants ---
* ------------------------------------------------------------ */
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []{
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
%set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags));
}
@ -547,6 +553,7 @@
}
#endif
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* --- Special typemaps ---
@ -602,3 +609,4 @@
%typemap(varout,noblock=1) SWIGTYPE INSTANCE {
%set_varoutput(SWIG_NewInstanceObj(%as_voidptr(&$1), $&1_descriptor, %newinstance_flags));
}