Merge branch 'master' into array_fix
This commit is contained in:
commit
1a4dc82931
1964 changed files with 57298 additions and 30865 deletions
|
|
@ -232,6 +232,8 @@ $body)"
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* name conversion for overloaded operators. */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -28,17 +28,20 @@ namespace std{
|
|||
template<class T> class list
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T &reference;
|
||||
typedef const T& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef T &iterator;
|
||||
typedef const T& const_iterator;
|
||||
|
||||
|
||||
list();
|
||||
list(unsigned int size, const T& value = T());
|
||||
list(const list<T> &);
|
||||
list(const list& other);
|
||||
|
||||
~list();
|
||||
void assign(unsigned int n, const T& value);
|
||||
void swap(list<T> &x);
|
||||
|
||||
|
|
@ -46,21 +49,20 @@ namespace std{
|
|||
const_reference back();
|
||||
const_iterator begin();
|
||||
const_iterator end();
|
||||
|
||||
|
||||
void resize(unsigned int n, T c = T());
|
||||
bool empty() const;
|
||||
|
||||
void push_front(const T& INPUT);
|
||||
void push_back(const T& INPUT);
|
||||
|
||||
|
||||
void pop_front();
|
||||
void pop_back();
|
||||
void clear();
|
||||
unsigned int size() const;
|
||||
unsigned int max_size() const;
|
||||
void resize(unsigned int n, const T& INPUT);
|
||||
|
||||
|
||||
void remove(const T& INPUT);
|
||||
void unique();
|
||||
void reverse();
|
||||
|
|
@ -153,7 +155,7 @@ namespace std{
|
|||
if (j<0) j += size;
|
||||
if (i<0) i = 0;
|
||||
if (j>size) j = size;
|
||||
|
||||
|
||||
for (int k=0;k<i;k++)
|
||||
{
|
||||
first++;
|
||||
|
|
@ -174,7 +176,7 @@ namespace std{
|
|||
if (j<0) j += size;
|
||||
if (i<0) i = 0;
|
||||
if (j>size) j = size;
|
||||
|
||||
|
||||
for (int k=0;k<i;k++)
|
||||
{
|
||||
first++;
|
||||
|
|
@ -200,7 +202,6 @@ namespace std{
|
|||
}
|
||||
else self->insert(self->end(),v.begin(),v.end());
|
||||
}
|
||||
|
||||
}
|
||||
unsigned int __len__()
|
||||
{
|
||||
|
|
@ -218,8 +219,7 @@ namespace std{
|
|||
{
|
||||
self->pop_back();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
*/
|
||||
|
||||
%include <chicken/chickenkw.swg>
|
||||
%include <csharp/csharpkw.swg>
|
||||
%include <d/dkw.swg>
|
||||
%include <go/gokw.swg>
|
||||
|
|
@ -24,9 +23,7 @@
|
|||
%include <lua/luakw.swg>
|
||||
%include <ocaml/ocamlkw.swg>
|
||||
%include <perl5/perlkw.swg>
|
||||
%include <php5/phpkw.swg>
|
||||
%include <php/phpkw.swg>
|
||||
%include <pike/pikekw.swg>
|
||||
%include <python/pythonkw.swg>
|
||||
%include <r/rkw.swg>
|
||||
%include <ruby/rubykw.swg>
|
||||
|
|
|
|||
15
Lib/cdata.i
15
Lib/cdata.i
|
|
@ -21,21 +21,6 @@ typedef struct SWIGCDATA {
|
|||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGCHICKEN
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
C_word *string_space = C_alloc(C_SIZEOF_STRING($1.len));
|
||||
$result = C_string(&string_space, $1.len, $1.data);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGPHP5
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
ZVAL_STRINGL($result, $1.data, $1.len, 1);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGPHP7
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
%{
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@
|
|||
#include <chicken.h>
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; // Common C API type-checking code
|
||||
%insert(runtime) "chickenrun.swg"; // CHICKEN run-time code
|
||||
%insert(runtime) "swigrun.swg" // Common C API type-checking code
|
||||
%insert(runtime) "swigerrors.swg" // SWIG errors
|
||||
%insert(runtime) "chickenrun.swg" // CHICKEN run-time code
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* standard typemaps
|
||||
|
|
@ -617,7 +618,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
$1 = C_swig_is_string ($input);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
$1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
|
||||
}
|
||||
|
|
@ -630,33 +631,30 @@ $result = C_SCHEME_UNDEFINED;
|
|||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &
|
||||
{
|
||||
void *ptr = 0;
|
||||
if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) {
|
||||
/* error */
|
||||
if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = (ptr != 0);
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &&
|
||||
{
|
||||
void *ptr = 0;
|
||||
if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) {
|
||||
/* error */
|
||||
if (SWIG_ConvertPtr($input, &ptr, $descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = (ptr != 0);
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
|
||||
{
|
||||
void *ptr = 0;
|
||||
if (SWIG_ConvertPtr($input, &ptr, $&descriptor, 0)) {
|
||||
/* error */
|
||||
if (SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = (ptr != 0);
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -716,6 +714,8 @@ $result = C_SCHEME_UNDEFINED;
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Overloaded operator support
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__BORLANDC__) || defined(_WATCOM)
|
||||
# ifndef snprintf
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
|
|
@ -265,6 +265,7 @@ SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags
|
|||
|
||||
if (s == C_SCHEME_FALSE) {
|
||||
*result = NULL;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
} else if (C_swig_is_swigpointer(s)) {
|
||||
/* try and convert type */
|
||||
from = (swig_type_info *) C_block_item(s, 1);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,47 @@ CSHARP_ARRAYS(long long, long)
|
|||
CSHARP_ARRAYS(unsigned long long, ulong)
|
||||
CSHARP_ARRAYS(float, float)
|
||||
CSHARP_ARRAYS(double, double)
|
||||
CSHARP_ARRAYS(bool, bool)
|
||||
|
||||
// By default C# will marshal bools as 4 bytes
|
||||
// UnmanagedType.I1 will change this to 1 byte
|
||||
// FIXME - When running on mono ArraySubType appears to be ignored and bools will be marshalled as 4-byte
|
||||
// https://github.com/mono/mono/issues/15592
|
||||
|
||||
// input only arrays
|
||||
%typemap(ctype) bool INPUT[] "bool*"
|
||||
%typemap(cstype) bool INPUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INPUT[] "bool[]"
|
||||
%typemap(csin) bool INPUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool INPUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool INPUT[] ""
|
||||
%typemap(argout) bool INPUT[] ""
|
||||
|
||||
// output only arrays
|
||||
%typemap(ctype) bool OUTPUT[] "bool*"
|
||||
%typemap(cstype) bool OUTPUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool OUTPUT[] "bool[]"
|
||||
%typemap(csin) bool OUTPUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool OUTPUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool OUTPUT[] ""
|
||||
%typemap(argout) bool OUTPUT[] ""
|
||||
|
||||
// inout arrays
|
||||
%typemap(ctype) bool INOUT[] "bool*"
|
||||
%typemap(cstype) bool INOUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INOUT[] "bool[]"
|
||||
%typemap(csin) bool INOUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool INOUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool INOUT[] ""
|
||||
%typemap(argout) bool INOUT[] ""
|
||||
|
||||
|
||||
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
|
|
@ -323,11 +323,10 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
|
|
@ -336,8 +335,7 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +471,7 @@
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
|
|
@ -482,11 +480,10 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
|
|
@ -495,8 +492,7 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -505,6 +501,17 @@
|
|||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
|
||||
// Typecheck typemaps
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="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 > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
""
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
||||
// destructor mods
|
||||
%feature("unref") TYPE
|
||||
%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;"
|
||||
|
||||
|
|
@ -28,9 +28,21 @@
|
|||
return $null;
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%typemap(out) CONST TYPE
|
||||
%typemap(out) CONST TYPE
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorin) CONST TYPE
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
|
||||
return $null;
|
||||
}
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
$result = *smartarg->get();
|
||||
%}
|
||||
|
||||
// plain pointer
|
||||
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
|
|
@ -39,6 +51,13 @@
|
|||
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%}
|
||||
|
||||
%typemap(directorin) CONST TYPE *
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
|
||||
|
||||
%typemap(directorout) CONST TYPE * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in, canthrow=1) CONST TYPE & %{
|
||||
$1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
|
||||
|
|
@ -49,6 +68,13 @@
|
|||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
|
||||
|
||||
%typemap(directorin) CONST TYPE &
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
%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);
|
||||
|
|
@ -56,17 +82,41 @@
|
|||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
|
||||
|
||||
%typemap(directorin) TYPE *CONST&
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
|
||||
|
||||
%typemap(directorout) TYPE *CONST& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ if ($input) $1 = *($&1_ltype)$input; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ $result = $1 ? new $1_ltype($1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ if ($input) {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
$result = *smartarg;
|
||||
}
|
||||
%}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
|
||||
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
|
||||
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
|
||||
|
|
@ -75,12 +125,26 @@
|
|||
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
|
||||
if ($owner) delete $1; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
|
||||
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
|
||||
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
|
||||
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
|
||||
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
|
||||
|
|
@ -91,20 +155,20 @@
|
|||
%}
|
||||
|
||||
|
||||
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
|
||||
%typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)"
|
||||
|
||||
%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
|
||||
|
|
@ -175,6 +239,18 @@
|
|||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(csdirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($cscall).Handle"
|
||||
|
||||
%typemap(csdirectorin) CONST TYPE,
|
||||
CONST TYPE *,
|
||||
CONST TYPE &,
|
||||
TYPE *CONST& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
|
||||
|
||||
%typemap(csdirectorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
|
||||
|
||||
|
||||
// Proxy classes (base classes, ie, not derived classes)
|
||||
%typemap(csbody) TYPE %{
|
||||
|
|
@ -206,7 +282,7 @@
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
|
|
@ -215,11 +291,10 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
|
|
@ -228,11 +303,21 @@
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
// Typecheck typemaps
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="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 > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
""
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
5
Lib/csharp/complex.i
Normal file
5
Lib/csharp/complex.i
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifdef __cplusplus
|
||||
%include <std_complex.i>
|
||||
#else
|
||||
#error C# module only supports complex in C++ mode.
|
||||
#endif
|
||||
|
|
@ -843,11 +843,26 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarout, excode=SWIGEXCODE) SWIGTYPE *const& %{
|
||||
get {
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = ($1_ltype)&temp; %}
|
||||
%typemap(out) SWIGTYPE *const&
|
||||
%{ $result = (void *)*$1; %}
|
||||
%typemap(directorin) SWIGTYPE *const&
|
||||
%{ $input = (void *) $1; %}
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) SWIGTYPE *const&
|
||||
%{ static $*1_ltype swig_temp;
|
||||
swig_temp = ($*1_ltype)$input;
|
||||
$result = &swig_temp; %}
|
||||
%typemap(csdirectorin) SWIGTYPE *const& "($iminput == global::System.IntPtr.Zero) ? null : new $*csclassname($iminput, false)"
|
||||
%typemap(csdirectorout) SWIGTYPE *const& "$*csclassname.getCPtr($cscall).Handle"
|
||||
|
||||
/* Marshal C/C++ pointer to global::System.IntPtr */
|
||||
%typemap(ctype) void *VOID_INT_PTR "void *"
|
||||
|
|
@ -860,6 +875,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
global::System.IntPtr ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
|
||||
get {
|
||||
global::System.IntPtr ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
%typemap(csdirectorin) void *VOID_INT_PTR "$iminput"
|
||||
%typemap(csdirectorout) void *VOID_INT_PTR "$cscall"
|
||||
|
||||
|
|
@ -870,6 +894,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(csinterfaces) SWIGTYPE "global::System.IDisposable"
|
||||
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
|
||||
|
||||
|
||||
// csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
|
||||
|
|
@ -944,17 +969,24 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIG_CSBODY_PROXY(internal, internal, SWIGTYPE)
|
||||
SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
||||
|
||||
%typemap(csfinalize) SWIGTYPE %{
|
||||
%typemap(csdispose) SWIGTYPE %{
|
||||
~$csclassname() {
|
||||
Dispose();
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csdispose_derived) SWIGTYPE ""
|
||||
|
||||
%typemap(csconstruct, excode=SWIGEXCODE,directorconnect="\n SwigDirectorConnect();") SWIGTYPE %{: this($imcall, true) {$excode$directorconnect
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
|
||||
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") SWIGTYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwn) {
|
||||
|
|
@ -963,11 +995,10 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
|
||||
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") SWIGTYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwn) {
|
||||
|
|
@ -976,8 +1007,7 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
}
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -995,6 +1025,7 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
#define %csmethodmodifiers %feature("cs:methodmodifiers")
|
||||
#define %csnothrowexception %feature("except")
|
||||
#define %csattributes %feature("cs:attributes")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
||||
%pragma(csharp) imclassclassmodifiers="class"
|
||||
%pragma(csharp) moduleclassmodifiers="public class"
|
||||
|
|
@ -1010,6 +1041,8 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* csharp keywords */
|
||||
%include <csharpkw.swg>
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
[global::System.ThreadStatic]
|
||||
private static global::System.Exception pendingException = null;
|
||||
private static int numExceptionsPending = 0;
|
||||
private static global::System.Object exceptionsLock = null;
|
||||
|
||||
public static bool Pending {
|
||||
get {
|
||||
|
|
@ -259,7 +260,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
if (pendingException != null)
|
||||
throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
|
||||
pendingException = e;
|
||||
lock(typeof($imclassname)) {
|
||||
lock(exceptionsLock) {
|
||||
numExceptionsPending++;
|
||||
}
|
||||
}
|
||||
|
|
@ -270,13 +271,17 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
if (pendingException != null) {
|
||||
e = pendingException;
|
||||
pendingException = null;
|
||||
lock(typeof($imclassname)) {
|
||||
lock(exceptionsLock) {
|
||||
numExceptionsPending--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
static SWIGPendingException() {
|
||||
exceptionsLock = new global::System.Object();
|
||||
}
|
||||
}
|
||||
%}
|
||||
#endif // SWIG_CSHARP_NO_EXCEPTION_HELPER
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ namespace Swig {
|
|||
public:
|
||||
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorPureVirtualException(msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
%define SWIG_STD_ARRAY_INTERNAL(T, N)
|
||||
%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n";
|
||||
%typemap(cscode) std::array< T, N > %{
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
bool empty() const;
|
||||
|
||||
%rename(Fill) fill;
|
||||
void fill(const value_type& val);
|
||||
void fill(const value_type& value);
|
||||
|
||||
%rename(Swap) swap;
|
||||
void swap(array& other);
|
||||
|
|
|
|||
95
Lib/csharp/std_complex.i
Normal file
95
Lib/csharp/std_complex.i
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_complex.i
|
||||
*
|
||||
* Typemaps for handling std::complex<float> and std::complex<double> as a .NET
|
||||
* System.Numerics.Complex type. Requires .NET 4 minimum.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <complex>
|
||||
%}
|
||||
|
||||
%fragment("SwigSystemNumericsComplex", "header") {
|
||||
extern "C" {
|
||||
// Identical to the layout of System.Numerics.Complex, but does assume that it is
|
||||
// LayoutKind.Sequential on the managed side
|
||||
struct SwigSystemNumericsComplex {
|
||||
double real;
|
||||
double imag;
|
||||
};
|
||||
}
|
||||
|
||||
SWIGINTERN SwigSystemNumericsComplex SwigCreateSystemNumericsComplex(double real, double imag) {
|
||||
SwigSystemNumericsComplex cpx;
|
||||
cpx.real = real;
|
||||
cpx.imag = imag;
|
||||
return cpx;
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
%naturalvar complex;
|
||||
|
||||
template<typename T>
|
||||
class complex
|
||||
{
|
||||
public:
|
||||
complex(T re = T(), T im = T());
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
%define SWIG_COMPLEX_TYPEMAPS(T)
|
||||
%typemap(ctype, fragment="SwigSystemNumericsComplex") std::complex<T>, const std::complex<T> & "SwigSystemNumericsComplex"
|
||||
%typemap(imtype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
|
||||
%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
|
||||
|
||||
%typemap(in) std::complex<T>
|
||||
%{$1 = std::complex< double >($input.real, $input.imag);%}
|
||||
|
||||
%typemap(in) const std::complex<T> &($*1_ltype temp)
|
||||
%{temp = std::complex< T >((T)$input.real, (T)$input.imag);
|
||||
$1 = &temp;%}
|
||||
|
||||
%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") std::complex<T>
|
||||
%{$result = SwigCreateSystemNumericsComplex($1.real(), $1.imag());%}
|
||||
|
||||
%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") const std::complex<T> &
|
||||
%{$result = SwigCreateSystemNumericsComplex($1->real(), $1->imag());%}
|
||||
|
||||
%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
|
||||
|
||||
%typemap(csin) std::complex<T>, const std::complex<T> & "$csinput"
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) std::complex<T>, const std::complex<T> & {
|
||||
System.Numerics.Complex ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) const std::complex<T> & %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) const std::complex<T> & %{
|
||||
get {
|
||||
System.Numerics.Complex ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
%}
|
||||
|
||||
%template() std::complex<T>;
|
||||
%enddef
|
||||
|
||||
// By default, typemaps for both std::complex<double> and std::complex<float>
|
||||
// are defined, but one of them can be disabled by predefining the
|
||||
// corresponding symbol before including this file.
|
||||
#ifndef SWIG_NO_STD_COMPLEX_DOUBLE
|
||||
SWIG_COMPLEX_TYPEMAPS(double)
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_NO_STD_COMPLEX_FLOAT
|
||||
SWIG_COMPLEX_TYPEMAPS(float)
|
||||
#endif
|
||||
519
Lib/csharp/std_list.i
Normal file
519
Lib/csharp/std_list.i
Normal file
|
|
@ -0,0 +1,519 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_list.i
|
||||
*
|
||||
* SWIG typemaps for std::list<T>
|
||||
* C# implementation
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.LinkedList<> collection.
|
||||
*
|
||||
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::list wrappers. The ICollection<> interface is also implemented to provide enhanced functionality
|
||||
* whenever we are confident that the required C++ operator== is available. This is the case for when
|
||||
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_LIST_ENHANCED
|
||||
* macro to obtain this enhanced functionality, for example:
|
||||
*
|
||||
* SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
|
||||
* %template(ListKlass) std::list<SomeNamespace::Klass>;
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// MACRO for use within the std::list class body
|
||||
%define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...)
|
||||
%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
|
||||
%apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * };
|
||||
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.IEnumerable c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
this.AddLast(element);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode First {
|
||||
get {
|
||||
if (Count == 0)
|
||||
return null;
|
||||
return new $csclassnameNode(getFirstIter(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode Last {
|
||||
get {
|
||||
if (Count == 0)
|
||||
return null;
|
||||
return new $csclassnameNode(getLastIter(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode AddFirst($typemap(cstype, CTYPE) value) {
|
||||
push_front(value);
|
||||
return new $csclassnameNode(getFirstIter(), this);
|
||||
}
|
||||
|
||||
public void AddFirst($csclassnameNode newNode) {
|
||||
ValidateNewNode(newNode);
|
||||
if (!newNode.inlist) {
|
||||
push_front(newNode.csharpvalue);
|
||||
newNode.iter = getFirstIter();
|
||||
newNode.inlist = true;
|
||||
} else {
|
||||
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode AddLast($typemap(cstype, CTYPE) value) {
|
||||
push_back(value);
|
||||
return new $csclassnameNode(getLastIter(), this);
|
||||
}
|
||||
|
||||
public void AddLast($csclassnameNode newNode) {
|
||||
ValidateNewNode(newNode);
|
||||
if (!newNode.inlist) {
|
||||
push_back(newNode.csharpvalue);
|
||||
newNode.iter = getLastIter();
|
||||
newNode.inlist = true;
|
||||
} else {
|
||||
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode AddBefore($csclassnameNode node, $typemap(cstype, CTYPE) value) {
|
||||
return new $csclassnameNode(insertNode(node.iter, value), this);
|
||||
}
|
||||
|
||||
public void AddBefore($csclassnameNode node, $csclassnameNode newNode) {
|
||||
ValidateNode(node);
|
||||
ValidateNewNode(newNode);
|
||||
if (!newNode.inlist) {
|
||||
newNode.iter = insertNode(node.iter, newNode.csharpvalue);
|
||||
newNode.inlist = true;
|
||||
} else {
|
||||
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode AddAfter($csclassnameNode node, $typemap(cstype, CTYPE) value) {
|
||||
node = node.Next;
|
||||
return new $csclassnameNode(insertNode(node.iter, value), this);
|
||||
}
|
||||
|
||||
public void AddAfter($csclassnameNode node, $csclassnameNode newNode) {
|
||||
ValidateNode(node);
|
||||
ValidateNewNode(newNode);
|
||||
if (!newNode.inlist) {
|
||||
if (node == this.Last)
|
||||
AddLast(newNode);
|
||||
else
|
||||
{
|
||||
node = node.Next;
|
||||
newNode.iter = insertNode(node.iter, newNode.csharpvalue);
|
||||
newNode.inlist = true;
|
||||
}
|
||||
} else {
|
||||
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void Add($typemap(cstype, CTYPE) value) {
|
||||
AddLast(value);
|
||||
}
|
||||
|
||||
public void Remove($csclassnameNode node) {
|
||||
ValidateNode(node);
|
||||
eraseIter(node.iter);
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array, int index) {
|
||||
if (array == null)
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (index < 0 || index > array.Length)
|
||||
throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
$csclassnameNode node = this.First;
|
||||
if (node != null) {
|
||||
do {
|
||||
array[index++] = node.Value;
|
||||
node = node.Next;
|
||||
} while (node != null);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ValidateNode($csclassnameNode node) {
|
||||
if (node == null) {
|
||||
throw new System.ArgumentNullException("node");
|
||||
}
|
||||
if (!node.inlist || node.list != this) {
|
||||
throw new System.InvalidOperationException("node");
|
||||
}
|
||||
}
|
||||
|
||||
internal void ValidateNewNode($csclassnameNode node) {
|
||||
if (node == null) {
|
||||
throw new System.ArgumentNullException("node");
|
||||
}
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
public $csclassnameEnumerator GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private $csclassnameNode currentNode;
|
||||
private int currentIndex;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
collectionRef = collection;
|
||||
currentNode = collection.First;
|
||||
currentIndex = 0;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public $typemap(cstype, CTYPE) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize)
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return ($typemap(cstype, CTYPE))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Type-unsafe IEnumerator.Current
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
if (currentNode == null) {
|
||||
currentIndex = collectionRef.Count + 1;
|
||||
return false;
|
||||
}
|
||||
++currentIndex;
|
||||
currentObject = currentNode.Value;
|
||||
currentNode = currentNode.Next;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class $csclassnameNode {
|
||||
internal $csclassname list;
|
||||
internal System.IntPtr iter;
|
||||
internal $typemap(cstype, CTYPE) csharpvalue;
|
||||
internal bool inlist;
|
||||
|
||||
public $csclassnameNode($typemap(cstype, CTYPE) value) {
|
||||
csharpvalue = value;
|
||||
inlist = false;
|
||||
}
|
||||
|
||||
internal $csclassnameNode(System.IntPtr iter, $csclassname list) {
|
||||
this.list = list;
|
||||
this.iter = iter;
|
||||
inlist = true;
|
||||
}
|
||||
|
||||
public $csclassname List {
|
||||
get {
|
||||
return this.list;
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode Next {
|
||||
get {
|
||||
if (list.getNextIter(iter) == System.IntPtr.Zero)
|
||||
return null;
|
||||
return new $csclassnameNode(list.getNextIter(iter), list);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassnameNode Previous {
|
||||
get {
|
||||
if (list.getPrevIter(iter) == System.IntPtr.Zero)
|
||||
return null;
|
||||
return new $csclassnameNode(list.getPrevIter(iter), list);
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(cstype, CTYPE) Value {
|
||||
get {
|
||||
return list.getItem(this.iter);
|
||||
}
|
||||
set {
|
||||
list.setItem(this.iter, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator==($csclassnameNode node1, $csclassnameNode node2) {
|
||||
if (object.ReferenceEquals(node1, null) && object.ReferenceEquals(node2, null))
|
||||
return true;
|
||||
if (object.ReferenceEquals(node1, null) || object.ReferenceEquals(node2, null))
|
||||
return false;
|
||||
return node1.Equals(node2);
|
||||
}
|
||||
|
||||
public static bool operator!=($csclassnameNode node1, $csclassnameNode node2) {
|
||||
if (node1 == null && node2 == null)
|
||||
return false;
|
||||
if (node1 == null || node2 == null)
|
||||
return true;
|
||||
return !node1.Equals(node2);
|
||||
}
|
||||
|
||||
public bool Equals($csclassnameNode node) {
|
||||
if (node == null)
|
||||
return false;
|
||||
if (!node.inlist || !this.inlist)
|
||||
return object.ReferenceEquals(this, node);
|
||||
return list.equals(this.iter, node.iter);
|
||||
}
|
||||
|
||||
public override bool Equals(object node) {
|
||||
return Equals(($csclassnameNode)node);
|
||||
}
|
||||
|
||||
public override int GetHashCode() {
|
||||
int hash = 13;
|
||||
if (inlist) {
|
||||
hash = (hash * 7) + this.list.GetHashCode();
|
||||
hash = (hash * 7) + this.Value.GetHashCode();
|
||||
hash = (hash * 7) + this.list.getNextIter(this.iter).GetHashCode();
|
||||
hash = (hash * 7) + this.list.getPrevIter(this.iter).GetHashCode();
|
||||
} else {
|
||||
hash = (hash * 7) + this.csharpvalue.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
list.deleteIter(this.iter);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
class iterator;
|
||||
|
||||
void push_front(CTYPE const& x);
|
||||
void push_back(CTYPE const& x);
|
||||
%rename(RemoveFirst) pop_front;
|
||||
void pop_front();
|
||||
%rename(RemoveLast) pop_back;
|
||||
void pop_back();
|
||||
size_type size() const;
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%extend {
|
||||
const_reference getItem(iterator *iter) {
|
||||
return **iter;
|
||||
}
|
||||
|
||||
void setItem(iterator *iter, CTYPE const& val) {
|
||||
*(*iter) = val;
|
||||
}
|
||||
|
||||
iterator *getFirstIter() {
|
||||
if ($self->size() == 0)
|
||||
return NULL;
|
||||
return new std::list< CTYPE >::iterator($self->begin());
|
||||
}
|
||||
|
||||
iterator *getLastIter() {
|
||||
if ($self->size() == 0)
|
||||
return NULL;
|
||||
return new std::list< CTYPE >::iterator(--$self->end());
|
||||
}
|
||||
|
||||
iterator *getNextIter(iterator *iter) {
|
||||
std::list< CTYPE >::iterator it = *iter;
|
||||
if (std::distance(it, --$self->end()) != 0) {
|
||||
std::list< CTYPE >::iterator* itnext = new std::list< CTYPE >::iterator(++it);
|
||||
return itnext;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
iterator *getPrevIter(iterator *iter) {
|
||||
std::list< CTYPE >::iterator it = *iter;
|
||||
if (std::distance($self->begin(), it) != 0) {
|
||||
std::list< CTYPE >::iterator* itprev = new std::list< CTYPE >::iterator(--it);
|
||||
return itprev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
iterator *insertNode(iterator *iter, CTYPE const& value) {
|
||||
std::list< CTYPE >::iterator it = $self->insert(*iter, value);
|
||||
return new std::list< CTYPE >::iterator(it);
|
||||
}
|
||||
|
||||
void eraseIter(iterator *iter) {
|
||||
std::list< CTYPE >::iterator it = *iter;
|
||||
$self->erase(it);
|
||||
}
|
||||
|
||||
void deleteIter(iterator *iter) {
|
||||
delete iter;
|
||||
}
|
||||
|
||||
bool equals(iterator *iter1, iterator *iter2) {
|
||||
if (iter1 == NULL && iter2 == NULL)
|
||||
return true;
|
||||
std::list< CTYPE >::iterator it1 = *iter1;
|
||||
std::list< CTYPE >::iterator it2 = *iter2;
|
||||
return it1 == it2;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
// Extra methods added to the collection class if operator== is defined for the class being wrapped
|
||||
// The class will then implement ICollection<>, which adds extra functionality
|
||||
%define SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
|
||||
%extend {
|
||||
bool Contains(CTYPE const& value) {
|
||||
return std::find($self->begin(), $self->end(), value) != $self->end();
|
||||
}
|
||||
|
||||
bool Remove(CTYPE const& value) {
|
||||
std::list< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
|
||||
if (it != $self->end()) {
|
||||
$self->erase(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
iterator *find(CTYPE const& value) {
|
||||
if (std::find($self->begin(), $self->end(), value) != $self->end()) {
|
||||
return new std::list< CTYPE >::iterator(std::find($self->begin(), $self->end(), value));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
%proxycode %{
|
||||
public $csclassnameNode Find($typemap(cstype, CTYPE) value) {
|
||||
System.IntPtr tmp = find(value);
|
||||
if (tmp != System.IntPtr.Zero) {
|
||||
return new $csclassnameNode(tmp, this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
// Macros for std::list class specializations/enhancements
|
||||
%define SWIG_STD_LIST_ENHANCED(CTYPE...)
|
||||
namespace std {
|
||||
template<> class list< CTYPE > {
|
||||
SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, %arg(CTYPE));
|
||||
SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE)
|
||||
};
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
%{
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%csmethodmodifiers std::list::size "private"
|
||||
%csmethodmodifiers std::list::getItem "private"
|
||||
%csmethodmodifiers std::list::setItem "private"
|
||||
%csmethodmodifiers std::list::push_front "private"
|
||||
%csmethodmodifiers std::list::push_back "private"
|
||||
%csmethodmodifiers std::list::getFirstIter "private"
|
||||
%csmethodmodifiers std::list::getNextIter "private"
|
||||
%csmethodmodifiers std::list::getPrevIter "private"
|
||||
%csmethodmodifiers std::list::getLastIter "private"
|
||||
%csmethodmodifiers std::list::find "private"
|
||||
%csmethodmodifiers std::list::deleteIter "private"
|
||||
|
||||
namespace std {
|
||||
// primary (unspecialized) class template for std::list
|
||||
// does not require operator== to be defined
|
||||
template<class T>
|
||||
class list {
|
||||
SWIG_STD_LIST_MINIMUM_INTERNAL(IEnumerable, T)
|
||||
};
|
||||
// specialization for pointers
|
||||
template<class T>
|
||||
class list<T *> {
|
||||
SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, T *)
|
||||
SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(T *)
|
||||
};
|
||||
}
|
||||
|
||||
// template specializations for std::list
|
||||
// these provide extra collections methods as operator== is defined
|
||||
SWIG_STD_LIST_ENHANCED(char)
|
||||
SWIG_STD_LIST_ENHANCED(signed char)
|
||||
SWIG_STD_LIST_ENHANCED(unsigned char)
|
||||
SWIG_STD_LIST_ENHANCED(short)
|
||||
SWIG_STD_LIST_ENHANCED(unsigned short)
|
||||
SWIG_STD_LIST_ENHANCED(int)
|
||||
SWIG_STD_LIST_ENHANCED(unsigned int)
|
||||
SWIG_STD_LIST_ENHANCED(long)
|
||||
SWIG_STD_LIST_ENHANCED(unsigned long)
|
||||
SWIG_STD_LIST_ENHANCED(long long)
|
||||
SWIG_STD_LIST_ENHANCED(unsigned long long)
|
||||
SWIG_STD_LIST_ENHANCED(float)
|
||||
SWIG_STD_LIST_ENHANCED(double)
|
||||
SWIG_STD_LIST_ENHANCED(std::string) // also requires a %include <std_string.i>
|
||||
SWIG_STD_LIST_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>
|
||||
|
|
@ -4,14 +4,14 @@
|
|||
* SWIG typemaps for std::map< K, T, C >
|
||||
*
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IDictionary<>.
|
||||
*
|
||||
*
|
||||
* Using this wrapper is fairly simple. For example, to create a map from integers to doubles use:
|
||||
*
|
||||
* %include <std_map.i>
|
||||
* %template(MapIntDouble) std::map<int, double>
|
||||
*
|
||||
* Notes:
|
||||
* 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::map wrappers.
|
||||
*
|
||||
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
%define SWIG_STD_MAP_INTERNAL(K, T, C)
|
||||
|
||||
%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
|
||||
%typemap(cscode) std::map<K, T, C > %{
|
||||
%proxycode %{
|
||||
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
get {
|
||||
|
|
@ -55,8 +55,8 @@
|
|||
}
|
||||
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
return vals;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
Add(item.Key, item.Value);
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
/// whenever the collection is modified. This has been done for changes in the size of the
|
||||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
currentObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
public:
|
||||
|
|
@ -214,9 +214,14 @@
|
|||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map< K, T, C > &other);
|
||||
map(const map& other);
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(Clear) clear;
|
||||
|
|
@ -239,11 +244,11 @@
|
|||
return iter != $self->end();
|
||||
}
|
||||
|
||||
void Add(const key_type& key, const mapped_type& val) throw (std::out_of_range) {
|
||||
void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
throw std::out_of_range("key already exists");
|
||||
$self->insert(std::pair< K, T >(key, val));
|
||||
$self->insert(std::pair< K, T >(key, value));
|
||||
}
|
||||
|
||||
bool Remove(const key_type& key) {
|
||||
|
|
@ -251,7 +256,7 @@
|
|||
if (iter != $self->end()) {
|
||||
$self->erase(iter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -285,12 +290,12 @@
|
|||
%csmethodmodifiers std::map::destroy_iterator "private"
|
||||
|
||||
// Default implementation
|
||||
namespace std {
|
||||
namespace std {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
SWIG_STD_MAP_INTERNAL(K, T, C)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Legacy macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T t, U u);
|
||||
pair(const pair& p);
|
||||
pair(T first, U second);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
311
Lib/csharp/std_set.i
Normal file
311
Lib/csharp/std_set.i
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_set.i
|
||||
*
|
||||
* SWIG typemaps for std::set<T>.
|
||||
*
|
||||
* Note that ISet<> used here requires .NET 4 or later.
|
||||
*
|
||||
* The C# wrapper implements ISet<> interface and shares performance
|
||||
* characteristics of C# System.Collections.Generic.SortedSet<> class, but
|
||||
* doesn't provide quite all of its methods.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%csmethodmodifiers std::set::size "private"
|
||||
%csmethodmodifiers std::set::getitem "private"
|
||||
%csmethodmodifiers std::set::create_iterator_begin "private"
|
||||
%csmethodmodifiers std::set::get_next "private"
|
||||
%csmethodmodifiers std::set::destroy_iterator "private"
|
||||
|
||||
namespace std {
|
||||
|
||||
// TODO: Add support for comparator and allocator template parameters.
|
||||
template <class T>
|
||||
class set {
|
||||
|
||||
%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n";
|
||||
%proxycode %{
|
||||
void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) {
|
||||
((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item);
|
||||
}
|
||||
|
||||
public bool TryGetValue($typemap(cstype, T) equalValue, out $typemap(cstype, T) actualValue) {
|
||||
try {
|
||||
actualValue = getitem(equalValue);
|
||||
return true;
|
||||
} catch {
|
||||
actualValue = default($typemap(cstype, T));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array) {
|
||||
CopyTo(array, 0);
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) {
|
||||
if (array == null)
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (arrayIndex < 0)
|
||||
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
if (arrayIndex+this.Count > array.Length)
|
||||
throw new global::System.ArgumentException("Number of elements to copy is too large.");
|
||||
|
||||
foreach ($typemap(cstype, T) item in this) {
|
||||
array.SetValue(item, arrayIndex++);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void IntersectWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
$csclassname old = new $csclassname(this);
|
||||
|
||||
Clear();
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (old.Contains(item))
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private static int count_enum(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
int count = 0;
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public bool IsProperSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSubsetOf(other) && Count < count_enum(other);
|
||||
}
|
||||
|
||||
public bool IsProperSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSupersetOf(other) && Count > count_enum(other);
|
||||
}
|
||||
|
||||
public bool IsSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
int countContained = 0;
|
||||
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (Contains(item))
|
||||
countContained++;
|
||||
}
|
||||
|
||||
return countContained == Count;
|
||||
}
|
||||
|
||||
public bool IsSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (!Contains(item))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Overlaps(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (Contains(item))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetEquals(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSupersetOf(other) && Count == count_enum(other);
|
||||
}
|
||||
|
||||
public void SymmetricExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (!Remove(item))
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnionWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Items {
|
||||
get {
|
||||
global::System.Collections.Generic.ICollection<$typemap(cstype, T)> items = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
|
||||
int size = this.Count;
|
||||
if (size > 0) {
|
||||
global::System.IntPtr iter = create_iterator_begin();
|
||||
for (int i = 0; i < size; i++) {
|
||||
items.Add(get_next(iter));
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
public $csclassnameEnumerator GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
// Type-safe enumerator
|
||||
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
|
||||
/// whenever the collection is modified. This has been done for changes in the size of the
|
||||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
|
||||
private int currentIndex;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
collectionRef = collection;
|
||||
ItemsCollection = new global::System.Collections.Generic.List<$typemap(cstype, T)>(collection.Items);
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public $typemap(cstype, T) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize - 1)
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return ($typemap(cstype, T))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Type-unsafe IEnumerator.Current
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
int size = collectionRef.Count;
|
||||
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
|
||||
if (moveOkay) {
|
||||
currentIndex++;
|
||||
currentObject = ItemsCollection[currentIndex];
|
||||
} else {
|
||||
currentObject = null;
|
||||
}
|
||||
return moveOkay;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T key_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
set();
|
||||
set(const set& other);
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%extend {
|
||||
bool Add(const value_type& item) {
|
||||
return $self->insert(item).second;
|
||||
}
|
||||
|
||||
bool Contains(const value_type& item) {
|
||||
return $self->count(item) != 0;
|
||||
}
|
||||
|
||||
bool Remove(const value_type& item) {
|
||||
return $self->erase(item) != 0;
|
||||
}
|
||||
|
||||
const value_type& getitem(const value_type& item) throw (std::out_of_range) {
|
||||
std::set<T>::iterator iter = $self->find(item);
|
||||
if (iter == $self->end())
|
||||
throw std::out_of_range("item not found");
|
||||
|
||||
return *iter;
|
||||
}
|
||||
|
||||
// create_iterator_begin(), get_next() and destroy_iterator work together to provide a collection of items to C#
|
||||
%apply void *VOID_INT_PTR { std::set<T>::iterator *create_iterator_begin }
|
||||
%apply void *VOID_INT_PTR { std::set<T>::iterator *swigiterator }
|
||||
|
||||
std::set<T>::iterator *create_iterator_begin() {
|
||||
return new std::set<T>::iterator($self->begin());
|
||||
}
|
||||
|
||||
const key_type& get_next(std::set<T>::iterator *swigiterator) {
|
||||
std::set<T>::iterator iter = *swigiterator;
|
||||
(*swigiterator)++;
|
||||
return *iter;
|
||||
}
|
||||
|
||||
void destroy_iterator(std::set<T>::iterator *swigiterator) {
|
||||
delete swigiterator;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -5,28 +5,31 @@
|
|||
* C# implementation
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
|
||||
*
|
||||
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
|
||||
* whenever we are confident that the required C++ operator== is available. This is the case for when
|
||||
* whenever we are confident that the required C++ operator== is available. This is the case for when
|
||||
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_VECTOR_ENHANCED
|
||||
* macro to obtain this enhanced functionality, for example:
|
||||
*
|
||||
* SWIG_STD_VECTOR_ENHANCED(SomeNamespace::Klass)
|
||||
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
|
||||
*
|
||||
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// Warning: Use the typemaps here in the expectation that the macros they are in will change name.
|
||||
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// MACRO for use within the std::vector class body
|
||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
|
||||
%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
%typemap(cscode) std::vector< CTYPE > %{
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.IEnumerable c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
this.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public $csclassname(global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)> c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
|
|
@ -62,7 +65,7 @@
|
|||
set {
|
||||
if (value < size())
|
||||
throw new global::System.ArgumentOutOfRangeException("Capacity");
|
||||
reserve((uint)value);
|
||||
reserve(($typemap(cstype, size_t))value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,6 +109,12 @@
|
|||
array.SetValue(getitemcopy(index+i), arrayIndex+i);
|
||||
}
|
||||
|
||||
public $typemap(cstype, CTYPE)[] ToArray() {
|
||||
$typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[this.Count];
|
||||
this.CopyTo(array);
|
||||
return array;
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
|
@ -187,8 +196,13 @@
|
|||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef CONST_REFERENCE const_reference;
|
||||
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%rename(Add) push_back;
|
||||
|
|
@ -198,8 +212,10 @@
|
|||
void reserve(size_type n);
|
||||
%newobject GetRange(int index, int count);
|
||||
%newobject Repeat(CTYPE const& value, int count);
|
||||
|
||||
vector();
|
||||
vector(const vector &other);
|
||||
|
||||
%extend {
|
||||
vector(int capacity) throw (std::out_of_range) {
|
||||
std::vector< CTYPE >* pv = 0;
|
||||
|
|
@ -324,7 +340,7 @@
|
|||
std::vector< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
|
||||
if (it != $self->end()) {
|
||||
$self->erase(it);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -335,7 +351,7 @@
|
|||
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
|
||||
namespace std {
|
||||
template<> class vector< CTYPE > {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, %arg(CTYPE const&), %arg(CTYPE))
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, %arg(CTYPE))
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
|
||||
};
|
||||
}
|
||||
|
|
@ -368,11 +384,11 @@ namespace std {
|
|||
// primary (unspecialized) class template for std::vector
|
||||
// does not require operator== to be defined
|
||||
template<class T> class vector {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, T const&, T)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, T)
|
||||
};
|
||||
// specialization for pointers
|
||||
template<class T> class vector<T *> {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, T *const&, T *)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T *)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
|
||||
};
|
||||
// bool is specialized in the C++ standard - const_reference in particular
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ class wstring;
|
|||
|
||||
// wstring
|
||||
%typemap(ctype, out="void *") wstring "wchar_t *"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
|
||||
%typemap(imtype,
|
||||
inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
|
||||
outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
|
||||
) wstring "string"
|
||||
%typemap(cstype) wstring "string"
|
||||
%typemap(csdirectorin) wstring "$iminput"
|
||||
%typemap(csdirectorout) wstring "$cscall"
|
||||
|
|
@ -60,7 +63,10 @@ class wstring;
|
|||
|
||||
// const wstring &
|
||||
%typemap(ctype, out="void *") const wstring & "wchar_t *"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string"
|
||||
%typemap(imtype,
|
||||
inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
|
||||
outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
|
||||
) const wstring & "string"
|
||||
%typemap(cstype) const wstring & "string"
|
||||
|
||||
%typemap(csdirectorin) const wstring & "$iminput"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* stl.i
|
||||
*
|
||||
* Initial STL definition. extended as needed in each language
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
|
|||
%pragma(csharp) imclasscode=%{
|
||||
protected class SWIGWStringHelper {
|
||||
|
||||
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
|
||||
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
|
||||
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
|
|||
|
||||
// wchar_t
|
||||
%typemap(ctype) wchar_t "wchar_t"
|
||||
%typemap(imtype) wchar_t "char"
|
||||
%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
|
||||
%typemap(cstype) wchar_t "char"
|
||||
|
||||
%typemap(csin) wchar_t "$csinput"
|
||||
|
|
@ -91,7 +92,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
|
|||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
|
||||
get {
|
||||
string ret = $imcall;$excode
|
||||
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(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) %{
|
||||
|
|
@ -22,6 +25,18 @@
|
|||
%typemap(out) CONST TYPE
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorin) CONST TYPE
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE
|
||||
%{ if (!$input) {
|
||||
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type");
|
||||
return $null;
|
||||
}
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
$result = *smartarg->get();
|
||||
%}
|
||||
|
||||
// plain pointer
|
||||
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
|
|
@ -30,6 +45,13 @@
|
|||
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%}
|
||||
|
||||
%typemap(directorin) CONST TYPE *
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
|
||||
|
||||
%typemap(directorout) CONST TYPE * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in, canthrow=1) CONST TYPE & %{
|
||||
$1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
|
||||
|
|
@ -40,6 +62,13 @@
|
|||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
|
||||
|
||||
%typemap(directorin) CONST TYPE &
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
%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);
|
||||
|
|
@ -47,18 +76,42 @@
|
|||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
|
||||
|
||||
%typemap(directorin) TYPE *CONST&
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
|
||||
|
||||
%typemap(directorout) TYPE *CONST& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ if ($input) $1 = *($&1_ltype)$input; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ $result = $1 ? new $1_ltype($1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ if ($input) {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
|
||||
$result = *smartarg;
|
||||
}
|
||||
%}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
|
||||
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
|
||||
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
|
||||
|
|
@ -66,6 +119,13 @@
|
|||
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
|
||||
if ($owner) delete $1; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
|
||||
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
|
||||
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
|
||||
|
|
@ -73,6 +133,13 @@
|
|||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
|
||||
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
|
||||
#error "typemaps for $1_type not available"
|
||||
|
|
@ -96,9 +163,22 @@
|
|||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE)"
|
||||
|
||||
%typemap(din) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
|
||||
|
||||
%typemap(ddirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(dtype, TYPE).swigGetCPtr($dcall)"
|
||||
|
||||
%typemap(ddirectorin) CONST TYPE,
|
||||
CONST TYPE *,
|
||||
CONST TYPE &,
|
||||
TYPE *CONST& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
|
||||
|
||||
%typemap(ddirectorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
|
||||
|
||||
|
||||
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
|
||||
void* cPtr = $imcall;
|
||||
|
|
@ -141,8 +221,7 @@
|
|||
return ret;
|
||||
}
|
||||
|
||||
// For shared pointers, both the derived and the base class have to »own« their
|
||||
// pointer; otherwise the reference count is not decreased properly on destruction.
|
||||
// Proxy classes (base classes, ie, not derived classes)
|
||||
%typemap(dbody) SWIGTYPE %{
|
||||
private void* swigCPtr;
|
||||
private bool swigCMemOwn;
|
||||
|
|
@ -157,6 +236,7 @@ public static void* swigGetCPtr(typeof(this) obj) {
|
|||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(dbody_derived) SWIGTYPE %{
|
||||
private void* swigCPtr;
|
||||
private bool swigCMemOwn;
|
||||
|
|
@ -197,5 +277,17 @@ public static void* swigGetCPtr(typeof(this) obj) {
|
|||
}
|
||||
}
|
||||
|
||||
// Typecheck typemaps
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="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 > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
""
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
// We do not use »override« attribute for generated dispose() methods to stay
|
||||
// somewhat compatible to Phobos and older Tango versions where Object.dispose()
|
||||
// does not exist.
|
||||
%typemap(ddispose, methodname="dispose", methodmodifiers="public") SWIGTYPE {
|
||||
%typemap(ddispose, methodname="dispose", methodmodifiers="public", parameters="") SWIGTYPE {
|
||||
synchronized(this) {
|
||||
if (swigCPtr !is null) {
|
||||
if (swigCMemOwn) {
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public") SWIGTYPE {
|
||||
%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public", parameters="") SWIGTYPE {
|
||||
synchronized(this) {
|
||||
if (swigCPtr !is null) {
|
||||
if (swigCMemOwn) {
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@
|
|||
#define %dconstvalue(value) %feature("d:constvalue",value)
|
||||
#define %dmethodmodifiers %feature("d:methodmodifiers")
|
||||
#define %dnothrowexception %feature("except")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ namespace Swig {
|
|||
public:
|
||||
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorPureVirtualException(msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
return ret;
|
||||
}
|
||||
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/*
|
||||
* Helper functions to pack/unpack arbitrary binary data (member function
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
/*
|
||||
* The SWIG_D_PRIMITIVE macro is used to define the typemaps for the primitive
|
||||
* types, because are more or less the same for all of them. The few special
|
||||
* cases are handeled below.
|
||||
* cases are handled below.
|
||||
*/
|
||||
%define SWIG_D_PRIMITIVE(TYPE, DTYPE)
|
||||
%typemap(ctype) TYPE, const TYPE & "TYPE"
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@
|
|||
return ret;
|
||||
}
|
||||
|
||||
// Treat references to arrays like like references to a single element.
|
||||
// Treat references to arrays like references to a single element.
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
|
||||
|
||||
|
|
@ -182,3 +182,16 @@
|
|||
$*dclassname ret = (cPtr is null) ? null : new $*dclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(directorin) SWIGTYPE *const&
|
||||
"$input = (void *) $1;"
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *const&
|
||||
%{ static $*1_ltype swig_temp;
|
||||
swig_temp = ($*1_ltype)$input;
|
||||
$result = &swig_temp; %}
|
||||
%typemap(ddirectorin,
|
||||
nativepointer="cast($dtype)$winput"
|
||||
) SWIGTYPE *const& "($winput is null) ? null : new $*dclassname($winput, false)"
|
||||
%typemap(ddirectorout,
|
||||
nativepointer="cast(void*)$dcall"
|
||||
) SWIGTYPE *const& "$*dclassname.swigGetCPtr($dcall)"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,44 +16,47 @@
|
|||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// exported class
|
||||
|
||||
namespace std {
|
||||
template<class K, class T> class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
map();
|
||||
map(const map<K,T> &);
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
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;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
void set(const K& key, const 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();
|
||||
}
|
||||
map();
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::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, const T& x) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::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, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T t, U u);
|
||||
pair(const pair& p);
|
||||
pair(T first, U second);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...)
|
||||
#if (SWIG_D_VERSION == 1)
|
||||
%typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;"
|
||||
%typemap(dcode) std::vector< CTYPE > %{
|
||||
%proxycode %{
|
||||
public this($typemap(dtype, CTYPE)[] values) {
|
||||
this();
|
||||
append(values);
|
||||
|
|
@ -104,15 +104,22 @@ public void capacity(size_t value) {
|
|||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef CONST_REFERENCE const_reference;
|
||||
|
||||
void clear();
|
||||
void push_back(CTYPE const& x);
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n) throw (std::length_error);
|
||||
|
||||
vector();
|
||||
vector(const vector &other);
|
||||
|
||||
%extend {
|
||||
vector(size_type capacity) throw (std::length_error) {
|
||||
std::vector< CTYPE >* pv = 0;
|
||||
|
|
@ -128,7 +135,7 @@ public void capacity(size_t value) {
|
|||
return $self->capacity() - $self->size();
|
||||
}
|
||||
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -138,7 +145,7 @@ public void capacity(size_t value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -153,7 +160,7 @@ public void capacity(size_t value) {
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
@ -185,7 +192,7 @@ static import std.exception;
|
|||
static import std.range;
|
||||
static import std.traits;
|
||||
%}
|
||||
%typemap(dcode) std::vector< CTYPE > %{
|
||||
%proxycode %{
|
||||
alias size_t KeyType;
|
||||
alias $typemap(dtype, CTYPE) ValueType;
|
||||
|
||||
|
|
@ -442,8 +449,13 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef CONST_REFERENCE const_reference;
|
||||
|
||||
bool empty() const;
|
||||
void clear();
|
||||
void push_back(CTYPE const& x);
|
||||
|
|
@ -451,8 +463,10 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n) throw (std::length_error);
|
||||
|
||||
vector();
|
||||
vector(const vector &other);
|
||||
|
||||
%extend {
|
||||
vector(size_type capacity) throw (std::length_error) {
|
||||
std::vector< CTYPE >* pv = 0;
|
||||
|
|
@ -464,7 +478,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return pv;
|
||||
}
|
||||
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -474,7 +488,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return value;
|
||||
}
|
||||
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -506,7 +520,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
@ -544,7 +558,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
|
||||
namespace std {
|
||||
template<> class vector<CTYPE > {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(%arg(CTYPE const&), %arg(CTYPE))
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, %arg(CTYPE))
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
|
||||
};
|
||||
}
|
||||
|
|
@ -559,11 +573,11 @@ namespace std {
|
|||
// primary (unspecialized) class template for std::vector
|
||||
// does not require operator== to be defined
|
||||
template<class T> class vector {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(T const&, T)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, T)
|
||||
};
|
||||
// specializations for pointers
|
||||
template<class T> class vector<T *> {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(T *const&, T *)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, T *)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
|
||||
};
|
||||
// bool is a bit different in the C++ standard - const_reference in particular
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* stl.i
|
||||
*
|
||||
* Initial STL definition. extended as needed in each language
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,10 @@ private {
|
|||
} else {
|
||||
version(D_Version2) {
|
||||
static import std.conv;
|
||||
} else {
|
||||
static import std.c.string;
|
||||
}
|
||||
static import std.string;
|
||||
static import std.c.string;
|
||||
}
|
||||
|
||||
version(D_Version2) {
|
||||
|
|
@ -112,7 +113,7 @@ private {
|
|||
version(Tango) {
|
||||
import tango.sys.Common;
|
||||
} else version(linux) {
|
||||
import std.c.linux.linux;
|
||||
import core.sys.posix.dlfcn;
|
||||
} else {
|
||||
extern(C) {
|
||||
const RTLD_NOW = 2;
|
||||
|
|
|
|||
|
|
@ -12,13 +12,6 @@
|
|||
%insert("runtime") "swigerrors.swg"
|
||||
|
||||
|
||||
#ifdef SWIGPHP5
|
||||
%{
|
||||
#include "zend_exceptions.h"
|
||||
#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); goto thrown; } while (0)
|
||||
%}
|
||||
#endif
|
||||
|
||||
#ifdef SWIGPHP7
|
||||
%{
|
||||
#include "zend_exceptions.h"
|
||||
|
|
@ -134,33 +127,48 @@ SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
|
|||
|
||||
#ifdef SWIGOCAML
|
||||
%{
|
||||
#define OCAML_MSG_BUF_LEN 1024
|
||||
SWIGINTERN void SWIG_exception_(int code, const char *msg) {
|
||||
char msg_buf[OCAML_MSG_BUF_LEN];
|
||||
sprintf( msg_buf, "Exception(%d): %s\n", code, msg );
|
||||
failwith( msg_buf );
|
||||
SWIGINTERN void SWIG_OCamlException(int code, const char *msg) {
|
||||
CAMLparam0();
|
||||
|
||||
SWIG_OCamlExceptionCodes exception_code = SWIG_OCamlUnknownError;
|
||||
switch (code) {
|
||||
case SWIG_DivisionByZero:
|
||||
exception_code = SWIG_OCamlArithmeticException;
|
||||
break;
|
||||
case SWIG_IndexError:
|
||||
exception_code = SWIG_OCamlIndexOutOfBoundsException;
|
||||
break;
|
||||
case SWIG_IOError:
|
||||
case SWIG_SystemError:
|
||||
exception_code = SWIG_OCamlSystemException;
|
||||
break;
|
||||
case SWIG_MemoryError:
|
||||
exception_code = SWIG_OCamlOutOfMemoryError;
|
||||
break;
|
||||
case SWIG_OverflowError:
|
||||
exception_code = SWIG_OCamlOverflowException;
|
||||
break;
|
||||
case SWIG_RuntimeError:
|
||||
exception_code = SWIG_OCamlRuntimeException;
|
||||
break;
|
||||
case SWIG_SyntaxError:
|
||||
case SWIG_TypeError:
|
||||
case SWIG_ValueError:
|
||||
exception_code = SWIG_OCamlIllegalArgumentException;
|
||||
break;
|
||||
case SWIG_UnknownError:
|
||||
default:
|
||||
exception_code = SWIG_OCamlUnknownError;
|
||||
break;
|
||||
}
|
||||
SWIG_OCamlThrowException(exception_code, msg);
|
||||
CAMLreturn0;
|
||||
}
|
||||
#define SWIG_exception(a,b) SWIG_exception_((a),(b))
|
||||
#define SWIG_exception(code, msg) SWIG_OCamlException(code, msg)
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SWIGCHICKEN
|
||||
%{
|
||||
SWIGINTERN void SWIG_exception_(int code, const char *msg) {
|
||||
C_word *a;
|
||||
C_word scmmsg;
|
||||
C_word list;
|
||||
|
||||
a = C_alloc (C_SIZEOF_STRING (strlen (msg)) + C_SIZEOF_LIST(2));
|
||||
scmmsg = C_string2 (&a, (char *) msg);
|
||||
list = C_list(&a, 2, C_fix(code), scmmsg);
|
||||
SWIG_ThrowException(list);
|
||||
}
|
||||
#define SWIG_exception(a,b) SWIG_exception_((a),(b))
|
||||
%}
|
||||
#endif
|
||||
|
||||
#ifdef SWIGCSHARP
|
||||
%{
|
||||
SWIGINTERN void SWIG_CSharpException(int code, const char *msg) {
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
%{
|
||||
#include <gcj/cni.h>
|
||||
%}
|
||||
|
||||
%include <gcj/javaprims.i>
|
||||
|
||||
extern void JvInitClass (jclass cls);
|
||||
|
||||
extern jstring JvAllocString (jsize sz);
|
||||
|
||||
extern jstring JvNewString (const jchar *chars, jsize len);
|
||||
|
||||
extern jstring JvNewStringLatin1 (const char *bytes, jsize len);
|
||||
|
||||
extern jstring JvNewStringLatin1 (const char *bytes);
|
||||
|
||||
extern jchar* JvGetStringChars (jstring str);
|
||||
|
||||
extern jsize JvGetStringUTFLength (jstring string);
|
||||
|
||||
extern jsize JvGetStringUTFRegion (jstring str, jsize start, jsize len, char *buf);
|
||||
|
||||
extern jstring JvNewStringUTF (const char *bytes);
|
||||
|
||||
extern void *JvMalloc (jsize size);
|
||||
|
||||
extern void JvFree (void *ptr);
|
||||
|
||||
extern jint JvCreateJavaVM (JvVMInitArgs* vm_args);
|
||||
|
||||
extern java::lang::Thread* JvAttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
|
||||
|
||||
extern java::lang::Thread* JvAttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);
|
||||
|
||||
extern jint JvDetachCurrentThread (void);
|
||||
|
||||
|
||||
%include <gcj/cni.swg>
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* cni.swg
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef SWIG
|
||||
|
||||
#define __attribute__(...)
|
||||
%ignore class$;
|
||||
#pragma SWIG nowarn=313,402
|
||||
|
||||
%nodefaultdtor;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,422 +0,0 @@
|
|||
%include <stdint.i>
|
||||
|
||||
typedef int8_t jbyte;
|
||||
typedef int16_t jshort;
|
||||
typedef int32_t jint;
|
||||
typedef int64_t jlong;
|
||||
typedef float jfloat;
|
||||
typedef double jdouble;
|
||||
typedef jint jsize;
|
||||
typedef int8_t jboolean;
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
class BufferedInputStream;
|
||||
class BufferedOutputStream;
|
||||
class BufferedReader;
|
||||
class BufferedWriter;
|
||||
class ByteArrayInputStream;
|
||||
class ByteArrayOutputStream;
|
||||
class CharArrayReader;
|
||||
class CharArrayWriter;
|
||||
class CharConversionException;
|
||||
class DataInput;
|
||||
class DataInputStream;
|
||||
class DataOutput;
|
||||
class DataOutputStream;
|
||||
class EOFException;
|
||||
class Externalizable;
|
||||
class File;
|
||||
class FileDescriptor;
|
||||
class FileFilter;
|
||||
class FileInputStream;
|
||||
class FileNotFoundException;
|
||||
class FileOutputStream;
|
||||
class FilePermission;
|
||||
class FileReader;
|
||||
class FileWriter;
|
||||
class FilenameFilter;
|
||||
class FilterInputStream;
|
||||
class FilterOutputStream;
|
||||
class FilterReader;
|
||||
class FilterWriter;
|
||||
class IOException;
|
||||
class InputStream;
|
||||
class InputStreamReader;
|
||||
class InterfaceComparator;
|
||||
class InterruptedIOException;
|
||||
class InvalidClassException;
|
||||
class InvalidObjectException;
|
||||
class LineNumberInputStream;
|
||||
class LineNumberReader;
|
||||
class MemberComparator;
|
||||
class NotActiveException;
|
||||
class NotSerializableException;
|
||||
class ObjectInput;
|
||||
class ObjectInputStream;
|
||||
class ObjectInputStream$GetField;
|
||||
class ObjectInputValidation;
|
||||
class ObjectOutput;
|
||||
class ObjectOutputStream;
|
||||
class ObjectOutputStream$PutField;
|
||||
class ObjectStreamClass;
|
||||
class ObjectStreamConstants;
|
||||
class ObjectStreamException;
|
||||
class ObjectStreamField;
|
||||
class OptionalDataException;
|
||||
class OutputStream;
|
||||
class OutputStreamWriter;
|
||||
class PipedInputStream;
|
||||
class PipedOutputStream;
|
||||
class PipedReader;
|
||||
class PipedWriter;
|
||||
class PrintStream;
|
||||
class PrintWriter;
|
||||
class PushbackInputStream;
|
||||
class PushbackReader;
|
||||
class RandomAccessFile;
|
||||
class Reader;
|
||||
class SequenceInputStream;
|
||||
class Serializable;
|
||||
class SerializablePermission;
|
||||
class StreamCorruptedException;
|
||||
class StreamTokenizer;
|
||||
class StringBufferInputStream;
|
||||
class StringReader;
|
||||
class StringWriter;
|
||||
class SyncFailedException;
|
||||
class UTFDataFormatException;
|
||||
class UnsupportedEncodingException;
|
||||
class VMObjectStreamClass;
|
||||
class ValidatorAndPriority;
|
||||
class WriteAbortedException;
|
||||
class Writer;
|
||||
}
|
||||
|
||||
namespace lang
|
||||
{
|
||||
class AbstractMethodError;
|
||||
class ArithmeticException;
|
||||
class ArrayIndexOutOfBoundsException;
|
||||
class ArrayStoreException;
|
||||
class AssertionError;
|
||||
class Boolean;
|
||||
class Byte;
|
||||
class CharSequence;
|
||||
class Character;
|
||||
class Character$Subset;
|
||||
class Character$UnicodeBlock;
|
||||
class Class;
|
||||
class ClassCastException;
|
||||
class ClassCircularityError;
|
||||
class ClassFormatError;
|
||||
class ClassLoader;
|
||||
class ClassNotFoundException;
|
||||
class CloneNotSupportedException;
|
||||
class Cloneable;
|
||||
class Comparable;
|
||||
class Compiler;
|
||||
class ConcreteProcess;
|
||||
class Double;
|
||||
class Error;
|
||||
class Exception;
|
||||
class ExceptionInInitializerError;
|
||||
class Float;
|
||||
class IllegalAccessError;
|
||||
class IllegalAccessException;
|
||||
class IllegalArgumentException;
|
||||
class IllegalMonitorStateException;
|
||||
class IllegalStateException;
|
||||
class IllegalThreadStateException;
|
||||
class IncompatibleClassChangeError;
|
||||
class IndexOutOfBoundsException;
|
||||
class InheritableThreadLocal;
|
||||
class InstantiationError;
|
||||
class InstantiationException;
|
||||
class Integer;
|
||||
class InternalError;
|
||||
class InterruptedException;
|
||||
class LinkageError;
|
||||
class Long;
|
||||
class Math;
|
||||
class NegativeArraySizeException;
|
||||
class NoClassDefFoundError;
|
||||
class NoSuchFieldError;
|
||||
class NoSuchFieldException;
|
||||
class NoSuchMethodError;
|
||||
class NoSuchMethodException;
|
||||
class NullPointerException;
|
||||
class Number;
|
||||
class NumberFormatException;
|
||||
class Object;
|
||||
class OutOfMemoryError;
|
||||
class Package;
|
||||
class Process;
|
||||
class Runnable;
|
||||
class Runtime;
|
||||
class RuntimeException;
|
||||
class RuntimePermission;
|
||||
class SecurityContext;
|
||||
class SecurityException;
|
||||
class SecurityManager;
|
||||
class Short;
|
||||
class StackOverflowError;
|
||||
class StackTraceElement;
|
||||
class StrictMath;
|
||||
class String;
|
||||
class String$CaseInsensitiveComparator;
|
||||
class StringBuffer;
|
||||
class StringIndexOutOfBoundsException;
|
||||
class System;
|
||||
class Thread;
|
||||
class ThreadDeath;
|
||||
class ThreadGroup;
|
||||
class ThreadLocal;
|
||||
class Throwable;
|
||||
class UnknownError;
|
||||
class UnsatisfiedLinkError;
|
||||
class UnsupportedClassVersionError;
|
||||
class UnsupportedOperationException;
|
||||
class VMClassLoader;
|
||||
class VMSecurityManager;
|
||||
class VMThrowable;
|
||||
class VerifyError;
|
||||
class VirtualMachineError;
|
||||
class Void;
|
||||
namespace ref
|
||||
{
|
||||
class PhantomReference;
|
||||
class Reference;
|
||||
class ReferenceQueue;
|
||||
class SoftReference;
|
||||
class WeakReference;
|
||||
}
|
||||
|
||||
namespace reflect
|
||||
{
|
||||
class AccessibleObject;
|
||||
class Array;
|
||||
class Constructor;
|
||||
class Field;
|
||||
class InvocationHandler;
|
||||
class InvocationTargetException;
|
||||
class Member;
|
||||
class Method;
|
||||
class Modifier;
|
||||
class Proxy;
|
||||
class Proxy$ClassFactory;
|
||||
class Proxy$ProxyData;
|
||||
class Proxy$ProxySignature;
|
||||
class Proxy$ProxyType;
|
||||
class ReflectPermission;
|
||||
class UndeclaredThrowableException;
|
||||
}
|
||||
}
|
||||
|
||||
namespace util
|
||||
{
|
||||
class AbstractCollection;
|
||||
class AbstractList;
|
||||
class AbstractMap;
|
||||
class AbstractMap$BasicMapEntry;
|
||||
class AbstractSequentialList;
|
||||
class AbstractSet;
|
||||
class ArrayList;
|
||||
class Arrays;
|
||||
class Arrays$ArrayList;
|
||||
class BitSet;
|
||||
class Calendar;
|
||||
class Collection;
|
||||
class Collections;
|
||||
class Collections$CopiesList;
|
||||
class Collections$EmptyList;
|
||||
class Collections$EmptyMap;
|
||||
class Collections$EmptySet;
|
||||
class Collections$ReverseComparator;
|
||||
class Collections$SingletonList;
|
||||
class Collections$SingletonMap;
|
||||
class Collections$SingletonSet;
|
||||
class Collections$SynchronizedCollection;
|
||||
class Collections$SynchronizedIterator;
|
||||
class Collections$SynchronizedList;
|
||||
class Collections$SynchronizedListIterator;
|
||||
class Collections$SynchronizedMap;
|
||||
class Collections$SynchronizedMapEntry;
|
||||
class Collections$SynchronizedRandomAccessList;
|
||||
class Collections$SynchronizedSet;
|
||||
class Collections$SynchronizedSortedMap;
|
||||
class Collections$SynchronizedSortedSet;
|
||||
class Collections$UnmodifiableCollection;
|
||||
class Collections$UnmodifiableEntrySet;
|
||||
class Collections$UnmodifiableIterator;
|
||||
class Collections$UnmodifiableList;
|
||||
class Collections$UnmodifiableListIterator;
|
||||
class Collections$UnmodifiableMap;
|
||||
class Collections$UnmodifiableRandomAccessList;
|
||||
class Collections$UnmodifiableSet;
|
||||
class Collections$UnmodifiableSortedMap;
|
||||
class Collections$UnmodifiableSortedSet;
|
||||
class Comparator;
|
||||
class ConcurrentModificationException;
|
||||
class Currency;
|
||||
class Date;
|
||||
class Dictionary;
|
||||
class EmptyStackException;
|
||||
class Enumeration;
|
||||
class EventListener;
|
||||
class EventListenerProxy;
|
||||
class EventObject;
|
||||
class GregorianCalendar;
|
||||
class HashMap;
|
||||
class HashMap$HashEntry;
|
||||
class HashMap$HashIterator;
|
||||
class HashSet;
|
||||
class Hashtable;
|
||||
class Hashtable$Enumerator;
|
||||
class Hashtable$HashEntry;
|
||||
class Hashtable$HashIterator;
|
||||
class IdentityHashMap;
|
||||
class IdentityHashMap$IdentityEntry;
|
||||
class IdentityHashMap$IdentityIterator;
|
||||
class Iterator;
|
||||
class LinkedHashMap;
|
||||
class LinkedHashMap$LinkedHashEntry;
|
||||
class LinkedHashSet;
|
||||
class LinkedList;
|
||||
class LinkedList$Entry;
|
||||
class LinkedList$LinkedListItr;
|
||||
class List;
|
||||
class ListIterator;
|
||||
class ListResourceBundle;
|
||||
class Locale;
|
||||
class Map;
|
||||
class Map$Entry;
|
||||
class Map$Map;
|
||||
class MissingResourceException;
|
||||
class MyResources;
|
||||
class NoSuchElementException;
|
||||
class Observable;
|
||||
class Observer;
|
||||
class Properties;
|
||||
class PropertyPermission;
|
||||
class PropertyPermissionCollection;
|
||||
class PropertyResourceBundle;
|
||||
class Random;
|
||||
class RandomAccess;
|
||||
class RandomAccessSubList;
|
||||
class ResourceBundle;
|
||||
class Set;
|
||||
class SimpleTimeZone;
|
||||
class SortedMap;
|
||||
class SortedSet;
|
||||
class Stack;
|
||||
class StringTokenizer;
|
||||
class SubList;
|
||||
class TimeZone;
|
||||
class Timer;
|
||||
class Timer$Scheduler;
|
||||
class Timer$TaskQueue;
|
||||
class TimerTask;
|
||||
class TooManyListenersException;
|
||||
class TreeMap;
|
||||
class TreeMap$Node;
|
||||
class TreeMap$SubMap;
|
||||
class TreeMap$TreeIterator;
|
||||
class TreeSet;
|
||||
class Vector;
|
||||
class WeakHashMap;
|
||||
class WeakHashMap$WeakBucket;
|
||||
class WeakHashMap$WeakEntry;
|
||||
class WeakHashMap$WeakEntrySet;
|
||||
namespace jar
|
||||
{
|
||||
class Attributes;
|
||||
class Attributes$Name;
|
||||
class JarEntry;
|
||||
class JarException;
|
||||
class JarFile;
|
||||
class JarFile$JarEnumeration;
|
||||
class JarInputStream;
|
||||
class JarOutputStream;
|
||||
class Manifest;
|
||||
}
|
||||
|
||||
namespace logging
|
||||
{
|
||||
class ConsoleHandler;
|
||||
class ErrorManager;
|
||||
class FileHandler;
|
||||
class Filter;
|
||||
class Formatter;
|
||||
class Handler;
|
||||
class Level;
|
||||
class LogManager;
|
||||
class LogRecord;
|
||||
class Logger;
|
||||
class LoggingPermission;
|
||||
class MemoryHandler;
|
||||
class SimpleFormatter;
|
||||
class SocketHandler;
|
||||
class StreamHandler;
|
||||
class XMLFormatter;
|
||||
}
|
||||
|
||||
namespace prefs
|
||||
{
|
||||
class AbstractPreferences;
|
||||
class BackingStoreException;
|
||||
class InvalidPreferencesFormatException;
|
||||
class NodeChangeEvent;
|
||||
class NodeChangeListener;
|
||||
class PreferenceChangeEvent;
|
||||
class PreferenceChangeListener;
|
||||
class Preferences;
|
||||
class PreferencesFactory;
|
||||
}
|
||||
|
||||
namespace regex
|
||||
{
|
||||
class Matcher;
|
||||
class Pattern;
|
||||
class PatternSyntaxException;
|
||||
}
|
||||
|
||||
namespace zip
|
||||
{
|
||||
class Adler32;
|
||||
class CRC32;
|
||||
class CheckedInputStream;
|
||||
class CheckedOutputStream;
|
||||
class Checksum;
|
||||
class DataFormatException;
|
||||
class Deflater;
|
||||
class DeflaterOutputStream;
|
||||
class GZIPInputStream;
|
||||
class GZIPOutputStream;
|
||||
class Inflater;
|
||||
class InflaterInputStream;
|
||||
class ZipConstants;
|
||||
class ZipEntry;
|
||||
class ZipException;
|
||||
class ZipFile;
|
||||
class ZipFile$PartialInputStream;
|
||||
class ZipFile$ZipEntryEnumeration;
|
||||
class ZipInputStream;
|
||||
class ZipOutputStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef class java::lang::Object* jobject;
|
||||
typedef class java::lang::Class* jclass;
|
||||
typedef class java::lang::Throwable* jthrowable;
|
||||
typedef class java::lang::String* jstring;
|
||||
|
||||
|
||||
%include <gcj/cni.swg>
|
||||
|
||||
80
Lib/go/director.swg
Normal file
80
Lib/go/director.swg
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes so that Go proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include <exception>
|
||||
#include <map>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
class DirectorException : public std::exception {
|
||||
};
|
||||
}
|
||||
|
||||
/* Handle memory management for directors. */
|
||||
|
||||
namespace {
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {}
|
||||
};
|
||||
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem* operator->() {
|
||||
return _item;
|
||||
}
|
||||
|
||||
private:
|
||||
GCItem *_item;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
}
|
||||
|
||||
class Swig_memory {
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_pointer(Type* vptr) {
|
||||
if (vptr) {
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
private:
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
swig_ownership_map swig_owner;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
static void swig_acquire_pointer(Swig_memory** pmem, Type* ptr) {
|
||||
if (!pmem) {
|
||||
*pmem = new Swig_memory;
|
||||
}
|
||||
(*pmem)->swig_acquire_pointer(ptr);
|
||||
}
|
||||
|
|
@ -341,8 +341,6 @@
|
|||
%typemap(directorout) SWIGTYPE *
|
||||
%{ $result = *($&1_ltype)&$input; %}
|
||||
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
||||
/* Pointer references. */
|
||||
|
||||
%typemap(gotype) SWIGTYPE *const&
|
||||
|
|
@ -382,6 +380,11 @@
|
|||
%typemap(directorout) SWIGTYPE &
|
||||
%{ *($&1_ltype)&$result = $input; %}
|
||||
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *const&
|
||||
%{ static $*1_ltype swig_temp;
|
||||
swig_temp = *($1_ltype)&$input;
|
||||
$result = &swig_temp; %}
|
||||
|
||||
%typemap(gotype) SWIGTYPE &&
|
||||
%{$gotypename%}
|
||||
|
||||
|
|
@ -692,6 +695,10 @@
|
|||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* Go keywords. */
|
||||
%include <gokw.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -346,75 +346,6 @@ type _swig_fnptr *byte
|
|||
type _swig_memberptr *byte
|
||||
%}
|
||||
|
||||
/* Handle memory management for directors. */
|
||||
|
||||
%insert(director) %{
|
||||
#include <map>
|
||||
|
||||
namespace {
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {}
|
||||
};
|
||||
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem* operator->() {
|
||||
return _item;
|
||||
}
|
||||
|
||||
private:
|
||||
GCItem *_item;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
}
|
||||
|
||||
class Swig_memory {
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_pointer(Type* vptr) {
|
||||
if (vptr) {
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
private:
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
swig_ownership_map swig_owner;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
static void swig_acquire_pointer(Swig_memory** pmem, Type* ptr) {
|
||||
if (!pmem) {
|
||||
*pmem = new Swig_memory;
|
||||
}
|
||||
(*pmem)->swig_acquire_pointer(ptr);
|
||||
}
|
||||
%}
|
||||
|
||||
/* For directors we need C++ to track a Go pointer. Since we can't
|
||||
pass a Go pointer into C++, we use a map to track the pointers on
|
||||
the Go side. */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_vector.i
|
||||
* std_list.i
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<class T, class Alloc = allocator<T> >
|
||||
template<class T>
|
||||
class list {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
|
|
@ -19,9 +19,10 @@ namespace std {
|
|||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef Alloc allocator_type;
|
||||
|
||||
list();
|
||||
list(const list& other);
|
||||
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(isEmpty) empty;
|
||||
|
|
|
|||
|
|
@ -20,22 +20,28 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class map {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map<K,T> &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -45,14 +51,14 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,17 @@ namespace std {
|
|||
template<class T> class vector {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
@ -46,10 +53,17 @@ namespace std {
|
|||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef bool const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
|
|||
|
|
@ -7,3 +7,4 @@
|
|||
%include <std_vector.i>
|
||||
%include <std_map.i>
|
||||
%include <std_pair.i>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#define SWIGGUILE_SCM
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "swigerrors.swg" // SWIG errors
|
||||
|
||||
%runtime "guile_scm_run.swg"
|
||||
%include <guile.i>
|
||||
|
|
@ -26,10 +27,10 @@
|
|||
else { \
|
||||
if (!gswig_list_p) { \
|
||||
gswig_list_p = 1; \
|
||||
gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED); \
|
||||
gswig_result = scm_list_n(gswig_result, object, SCM_UNDEFINED); \
|
||||
} \
|
||||
else \
|
||||
gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED)); \
|
||||
gswig_result = scm_append(scm_list_n(gswig_result, scm_list_n(object, SCM_UNDEFINED), SCM_UNDEFINED)); \
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ scm_module_variable (SCM module, SCM sym)
|
|||
return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
|
||||
}
|
||||
|
||||
#define scm_to_utf8_string scm_to_locale_string
|
||||
#define scm_from_utf8_string scm_from_locale_string
|
||||
#endif
|
||||
|
||||
#if SCM_MAJOR_VERSION >= 2
|
||||
|
|
@ -40,10 +42,6 @@ typedef struct swig_guile_clientdata {
|
|||
SCM goops_class;
|
||||
} swig_guile_clientdata;
|
||||
|
||||
#if SCM_MAJOR_VERSION <= 2
|
||||
#define scm_to_utf8_string scm_to_locale_string
|
||||
#define scm_from_utf8_string scm_from_locale_string
|
||||
#endif
|
||||
#define SWIG_scm2str(s) \
|
||||
SWIG_Guile_scm2newstr(s, NULL)
|
||||
#define SWIG_str02scm(str) \
|
||||
|
|
@ -101,6 +99,7 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
|
|||
static int swig_initialized = 0;
|
||||
static scm_t_bits swig_tag = 0;
|
||||
static scm_t_bits swig_collectable_tag = 0;
|
||||
static scm_t_bits swig_finalized_tag = 0;
|
||||
static scm_t_bits swig_destroyed_tag = 0;
|
||||
static scm_t_bits swig_member_function_tag = 0;
|
||||
static SCM swig_make_func = SCM_EOL;
|
||||
|
|
@ -165,7 +164,19 @@ SWIG_Guile_PointerType(SCM object)
|
|||
}
|
||||
else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_Guile_IsValidSmob(SCM smob)
|
||||
{
|
||||
/* We do not accept smobs representing destroyed pointers, but we have to
|
||||
allow finalized smobs because Guile >= 2.0.12 sets all smob instances
|
||||
to the 'finalized' type before calling their 'free' function. This change
|
||||
was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
|
||||
return SCM_SMOB_PREDICATE(swig_tag, smob)
|
||||
|| SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
|
||||
|| SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
|
||||
{
|
||||
|
|
@ -175,12 +186,13 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
|
|||
|
||||
if (SCM_NULLP(smob)) {
|
||||
*result = NULL;
|
||||
return SWIG_OK;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
#if SCM_MAJOR_VERSION >= 2
|
||||
} else if (SCM_POINTER_P(s)) {
|
||||
*result = SCM_POINTER_VALUE(s);
|
||||
return SWIG_OK;
|
||||
} else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
|
||||
/* we do not accept smobs representing destroyed pointers */
|
||||
#endif /* if SCM_MAJOR_VERSION >= 2 */
|
||||
} else if (SWIG_Guile_IsValidSmob(smob)) {
|
||||
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
|
||||
if (!from) return SWIG_ERROR;
|
||||
if (type) {
|
||||
|
|
@ -239,7 +251,7 @@ SWIG_Guile_MarkPointerNoncollectable(SCM s)
|
|||
{
|
||||
SCM smob = SWIG_Guile_GetSmob(s);
|
||||
if (!SCM_NULLP(smob)) {
|
||||
if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
|
||||
if (SWIG_Guile_IsValidSmob(smob)) {
|
||||
SCM_SET_CELL_TYPE(smob, swig_tag);
|
||||
}
|
||||
else scm_wrong_type_arg(NULL, 0, s);
|
||||
|
|
@ -252,7 +264,7 @@ SWIG_Guile_MarkPointerDestroyed(SCM s)
|
|||
{
|
||||
SCM smob = SWIG_Guile_GetSmob(s);
|
||||
if (!SCM_NULLP(smob)) {
|
||||
if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
|
||||
if (SWIG_Guile_IsValidSmob(smob)) {
|
||||
SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
|
||||
}
|
||||
else scm_wrong_type_arg(NULL, 0, s);
|
||||
|
|
@ -419,6 +431,8 @@ SWIG_Guile_Init ()
|
|||
scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
|
||||
scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
|
||||
scm_set_smob_free(swig_collectable_tag, free_swig);
|
||||
/* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
|
||||
swig_finalized_tag = swig_collectable_tag & ~0xff00;
|
||||
}
|
||||
if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
|
||||
"destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Debugger interface (don't change the order of the following lines) */
|
||||
#define GDB_TYPE SCM
|
||||
#include <libguile/gdb_interface.h>
|
||||
GDB_INTERFACE;
|
||||
|
||||
static void
|
||||
inner_main(void *closure, int argc, char **argv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
%{
|
||||
#include <string>
|
||||
|
||||
inline std::string SWIG_scm2string(SCM x) {
|
||||
SWIGINTERNINLINE
|
||||
std::string SWIG_scm2string(SCM x) {
|
||||
char* temp;
|
||||
temp = SWIG_scm2str(x);
|
||||
std::string s(temp);
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class map {
|
||||
%typemap(in) map<K,T> {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
%typemap(in) map< K, T, C > {
|
||||
if (scm_is_null($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
} else if (scm_is_pair($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
K* k;
|
||||
|
|
@ -72,13 +72,13 @@ namespace std {
|
|||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const map<K,T>& (std::map<K,T> temp),
|
||||
const map<K,T>* (std::map<K,T> temp) {
|
||||
%typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
|
||||
const map< K, T, C >* (std::map< K, T, C > temp) {
|
||||
if (scm_is_null($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
} else if (scm_is_pair($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
|
|
@ -105,9 +105,9 @@ namespace std {
|
|||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) map<K,T> {
|
||||
%typemap(out) map< K, T, C > {
|
||||
SCM alist = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=$i.rbegin(); i!=$i.rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
K* key = new K(i->first);
|
||||
T* val = new T(i->second);
|
||||
SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
|
||||
|
|
@ -117,7 +117,7 @@ namespace std {
|
|||
}
|
||||
$result = alist;
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
|
||||
/* native sequence? */
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -153,7 +153,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
/* wrapped map? */
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$&1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -161,8 +161,8 @@ namespace std {
|
|||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
|
||||
const map<K,T>* {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
|
||||
const map< K, T, C >* {
|
||||
/* native sequence? */
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -198,7 +198,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
/* wrapped map? */
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -218,15 +218,21 @@ namespace std {
|
|||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map< K, T> &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& __getitem__(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -236,19 +242,19 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void __delitem__(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
SCM keys() {
|
||||
SCM result = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
K* key = new K(i->first);
|
||||
SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
|
||||
result = scm_cons(k,result);
|
||||
|
|
@ -263,12 +269,12 @@ namespace std {
|
|||
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
|
||||
template<class T> class map<K,T> {
|
||||
%typemap(in) map<K,T> {
|
||||
template<class T> class map< K, T, C > {
|
||||
%typemap(in) map< K, T, C > {
|
||||
if (scm_is_null($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
} else if (scm_is_pair($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
T* x;
|
||||
|
|
@ -280,7 +286,7 @@ namespace std {
|
|||
val = SCM_CDR(entry);
|
||||
if (!CHECK(key))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
if (SWIG_ConvertPtr(val,(void**) &x,
|
||||
$descriptor(T *), 0) != 0) {
|
||||
if (!scm_is_pair(val))
|
||||
|
|
@ -296,13 +302,13 @@ namespace std {
|
|||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const map<K,T>& (std::map<K,T> temp),
|
||||
const map<K,T>* (std::map<K,T> temp) {
|
||||
%typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
|
||||
const map< K, T, C >* (std::map< K, T, C > temp) {
|
||||
if (scm_is_null($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
} else if (scm_is_pair($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
|
|
@ -315,7 +321,7 @@ namespace std {
|
|||
val = SCM_CDR(entry);
|
||||
if (!CHECK(key))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
if (SWIG_ConvertPtr(val,(void**) &x,
|
||||
$descriptor(T *), 0) != 0) {
|
||||
if (!scm_is_pair(val))
|
||||
|
|
@ -330,9 +336,9 @@ namespace std {
|
|||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) map<K,T> {
|
||||
%typemap(out) map< K, T, C > {
|
||||
SCM alist = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
T* val = new T(i->second);
|
||||
SCM k = CONVERT_TO(i->first);
|
||||
SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
|
||||
|
|
@ -341,7 +347,7 @@ namespace std {
|
|||
}
|
||||
$result = alist;
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -375,7 +381,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$&1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -383,8 +389,8 @@ namespace std {
|
|||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
|
||||
const map<K,T>* {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
|
||||
const map< K, T, C >* {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -418,7 +424,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -434,15 +440,25 @@ namespace std {
|
|||
%rename("delete!") __delitem__;
|
||||
%rename("has-key?") has_key;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map< K, T > &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
T& __getitem__(K key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -452,19 +468,19 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void __delitem__(K key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
SCM keys() {
|
||||
SCM result = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
SCM k = CONVERT_TO(i->first);
|
||||
result = scm_cons(k,result);
|
||||
}
|
||||
|
|
@ -475,12 +491,12 @@ namespace std {
|
|||
%enddef
|
||||
|
||||
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
template<class K> class map<K,T> {
|
||||
%typemap(in) map<K,T> {
|
||||
template<class K> class map< K, T, C > {
|
||||
%typemap(in) map< K, T, C > {
|
||||
if (scm_is_null($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
} else if (scm_is_pair($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
K* k;
|
||||
|
|
@ -497,7 +513,7 @@ namespace std {
|
|||
val = SCM_CAR(val);
|
||||
if (!CHECK(val))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
}
|
||||
(($1_type &)$1)[*k] = CONVERT_FROM(val);
|
||||
alist = SCM_CDR(alist);
|
||||
|
|
@ -507,13 +523,13 @@ namespace std {
|
|||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const map<K,T>& (std::map<K,T> temp),
|
||||
const map<K,T>* (std::map<K,T> temp) {
|
||||
%typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
|
||||
const map< K, T, C >* (std::map< K, T, C > temp) {
|
||||
if (scm_is_null($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
} else if (scm_is_pair($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
|
|
@ -531,7 +547,7 @@ namespace std {
|
|||
val = SCM_CAR(val);
|
||||
if (!CHECK(val))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
}
|
||||
temp[*k] = CONVERT_FROM(val);
|
||||
alist = SCM_CDR(alist);
|
||||
|
|
@ -540,9 +556,9 @@ namespace std {
|
|||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) map<K,T> {
|
||||
%typemap(out) map< K, T, C > {
|
||||
SCM alist = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
K* key = new K(i->first);
|
||||
SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
|
||||
SCM x = CONVERT_TO(i->second);
|
||||
|
|
@ -551,7 +567,7 @@ namespace std {
|
|||
}
|
||||
$result = alist;
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -583,7 +599,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$&1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -591,8 +607,8 @@ namespace std {
|
|||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
|
||||
const map<K,T>* {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
|
||||
const map< K, T, C >* {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -624,7 +640,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -640,15 +656,25 @@ namespace std {
|
|||
%rename("delete!") __delitem__;
|
||||
%rename("has-key?") has_key;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map< K, T > &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
T __getitem__(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -658,19 +684,19 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void __delitem__(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
SCM keys() {
|
||||
SCM result = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
K* key = new K(i->first);
|
||||
SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
|
||||
result = scm_cons(k,result);
|
||||
|
|
@ -683,12 +709,12 @@ namespace std {
|
|||
|
||||
%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> {
|
||||
%typemap(in) map<K,T> {
|
||||
template<> class map< K, T, C > {
|
||||
%typemap(in) map< K, T, C > {
|
||||
if (scm_is_null($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
} else if (scm_is_pair($input)) {
|
||||
$1 = std::map< K, T >();
|
||||
$1 = std::map< K, T, C >();
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
SCM entry, key, val;
|
||||
|
|
@ -699,14 +725,14 @@ namespace std {
|
|||
val = SCM_CDR(entry);
|
||||
if (!CHECK_K(key))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
if (!CHECK_T(val)) {
|
||||
if (!scm_is_pair(val))
|
||||
SWIG_exception(SWIG_TypeError,"alist expected");
|
||||
val = SCM_CAR(val);
|
||||
if (!CHECK_T(val))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
}
|
||||
(($1_type &)$1)[CONVERT_K_FROM(key)] =
|
||||
CONVERT_T_FROM(val);
|
||||
|
|
@ -717,13 +743,13 @@ namespace std {
|
|||
SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
|
||||
}
|
||||
}
|
||||
%typemap(in) const map<K,T>& (std::map<K,T> temp),
|
||||
const map<K,T>* (std::map<K,T> temp) {
|
||||
%typemap(in) const map< K, T, C >& (std::map< K, T, C > temp),
|
||||
const map< K, T, C >* (std::map< K, T, C > temp) {
|
||||
if (scm_is_null($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
} else if (scm_is_pair($input)) {
|
||||
temp = std::map< K, T >();
|
||||
temp = std::map< K, T, C >();
|
||||
$1 = &temp;
|
||||
SCM alist = $input;
|
||||
while (!scm_is_null(alist)) {
|
||||
|
|
@ -735,14 +761,14 @@ namespace std {
|
|||
val = SCM_CDR(entry);
|
||||
if (!CHECK_K(key))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
if (!CHECK_T(val)) {
|
||||
if (!scm_is_pair(val))
|
||||
SWIG_exception(SWIG_TypeError,"alist expected");
|
||||
val = SCM_CAR(val);
|
||||
if (!CHECK_T(val))
|
||||
SWIG_exception(SWIG_TypeError,
|
||||
"map<" #K "," #T "> expected");
|
||||
"map<" #K "," #T "," #C "> expected");
|
||||
}
|
||||
temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
|
||||
alist = SCM_CDR(alist);
|
||||
|
|
@ -751,9 +777,9 @@ namespace std {
|
|||
$1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
|
||||
}
|
||||
}
|
||||
%typemap(out) map<K,T> {
|
||||
%typemap(out) map< K, T, C > {
|
||||
SCM alist = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) {
|
||||
SCM k = CONVERT_K_TO(i->first);
|
||||
SCM x = CONVERT_T_TO(i->second);
|
||||
SCM entry = scm_cons(k,x);
|
||||
|
|
@ -761,7 +787,7 @@ namespace std {
|
|||
}
|
||||
$result = alist;
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -792,7 +818,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$&1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -800,8 +826,8 @@ namespace std {
|
|||
$1 = 0;
|
||||
}
|
||||
}
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
|
||||
const map<K,T>* {
|
||||
%typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&,
|
||||
const map< K, T, C >* {
|
||||
// native sequence?
|
||||
if (scm_is_null($input)) {
|
||||
/* an empty sequence can be of any type */
|
||||
|
|
@ -832,7 +858,7 @@ namespace std {
|
|||
}
|
||||
} else {
|
||||
// wrapped map?
|
||||
std::map< K, T >* m;
|
||||
std::map< K, T, C >* m;
|
||||
if (SWIG_ConvertPtr($input,(void **) &m,
|
||||
$1_descriptor, 0) == 0)
|
||||
$1 = 1;
|
||||
|
|
@ -848,15 +874,25 @@ namespace std {
|
|||
%rename("delete!") __delitem__;
|
||||
%rename("has-key?") has_key;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map< K, T> &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
T __getitem__(K key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -866,19 +902,19 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void __delitem__(K key) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
SCM keys() {
|
||||
SCM result = SCM_EOL;
|
||||
for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) {
|
||||
SCM k = CONVERT_K_TO(i->first);
|
||||
result = scm_cons(k,result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,11 +113,15 @@ namespace std {
|
|||
$1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
@ -217,9 +221,9 @@ namespace std {
|
|||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
@ -317,9 +321,9 @@ namespace std {
|
|||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
@ -408,9 +412,9 @@ namespace std {
|
|||
}
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
|
|
@ -187,9 +187,18 @@ namespace std {
|
|||
}
|
||||
}
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector(unsigned int size = 0);
|
||||
vector(unsigned int size, const T& value);
|
||||
vector(const vector<T>&);
|
||||
vector(const vector& other);
|
||||
|
||||
%rename(length) size;
|
||||
unsigned int size() const;
|
||||
%rename("empty?") empty;
|
||||
|
|
@ -351,9 +360,18 @@ namespace std {
|
|||
}
|
||||
}
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector(unsigned int size = 0);
|
||||
vector(unsigned int size, const T& value);
|
||||
vector(const vector<T>&);
|
||||
vector(const vector& other);
|
||||
|
||||
%rename(length) size;
|
||||
unsigned int size() const;
|
||||
%rename("empty?") empty;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* stl.i
|
||||
*
|
||||
* Initial STL definition. extended as needed in each language
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@
|
|||
%typemap(throws) SWIGTYPE {
|
||||
$<ype temp = new $ltype($1);
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj(temp, $&descriptor, 1),
|
||||
scm_list_n(SWIG_NewPointerObj(temp, $&descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE & {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
|
|
@ -87,13 +87,13 @@
|
|||
|
||||
%typemap(throws) SWIGTYPE * {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE [] {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
%typemap(varout) enum SWIGTYPE { $result = scm_from_long((int)$1); }
|
||||
%typemap(throws) enum SWIGTYPE {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(scm_from_long((int)$1), SCM_UNDEFINED));
|
||||
scm_list_n(scm_from_long((int)$1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
%typemap(throws) C_NAME {
|
||||
C_NAME swig_c_value = $1;
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(C_TO_SCM_EXPR, SCM_UNDEFINED));
|
||||
scm_list_n(C_TO_SCM_EXPR, SCM_UNDEFINED));
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -269,7 +269,7 @@
|
|||
/* Throw typemap */
|
||||
%typemap(throws) C_NAME {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(C_TO_SCM($1), SCM_UNDEFINED));
|
||||
scm_list_n(C_TO_SCM($1), SCM_UNDEFINED));
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer);
|
|||
|
||||
%typemap(throws) char * {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_str02scm($1), SCM_UNDEFINED));
|
||||
scm_list_n(SWIG_str02scm($1), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/* Void */
|
||||
|
|
@ -444,15 +444,21 @@ typedef unsigned long SCM;
|
|||
$1 = scm_is_string($input) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &, SWIGTYPE && {
|
||||
void *ptr;
|
||||
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, SWIG_POINTER_NO_NULL);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
||||
void *ptr;
|
||||
int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, 0);
|
||||
int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
|
@ -468,5 +474,7 @@ typedef unsigned long SCM;
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* typemaps.i ends here */
|
||||
|
|
|
|||
|
|
@ -44,18 +44,16 @@ struct SWIG_null_deleter {
|
|||
%#define SWIG_NO_NULL_DELETER_1
|
||||
}
|
||||
|
||||
// Workaround empty first macro argument bug
|
||||
#define SWIGEMPTYHACK
|
||||
// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
|
||||
%define %intrusive_ptr(TYPE...)
|
||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS(, TYPE)
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
|
||||
%enddef
|
||||
|
||||
%define %intrusive_ptr_no_wrap(TYPE...)
|
||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(SWIGEMPTYHACK, TYPE)
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(, TYPE)
|
||||
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -337,7 +337,8 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
|
||||
/* Add some code to the proxy class of the array type for converting between type used in
|
||||
* JNI class (long[]) and type used in proxy class ( ARRAYSOFCLASSES[] ) */
|
||||
%typemap(javacode) ARRAYSOFCLASSES %{
|
||||
%extend ARRAYSOFCLASSES {
|
||||
%proxycode %{
|
||||
protected static long[] cArrayUnwrap($javaclassname[] arrayWrapper) {
|
||||
long[] cArray = new long[arrayWrapper.length];
|
||||
for (int i=0; i<arrayWrapper.length; i++)
|
||||
|
|
@ -352,6 +353,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
return arrayWrapper;
|
||||
}
|
||||
%}
|
||||
}
|
||||
|
||||
%enddef /* JAVA_ARRAYSOFCLASSES */
|
||||
|
||||
|
|
|
|||
|
|
@ -29,26 +29,26 @@
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
|
||||
return $null;
|
||||
}
|
||||
$1 = *argp;
|
||||
$1 = *argp;
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
|
||||
//plain value(out)
|
||||
$1_ltype* resultp = new $1_ltype(($1_ltype &)$1);
|
||||
intrusive_ptr_add_ref(resultp);
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
%}
|
||||
|
||||
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
// plain pointer
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
|
||||
$1 = (TYPE *)(smartarg ? smartarg->get() : 0);
|
||||
$1 = (TYPE *)(smartarg ? smartarg->get() : 0);
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE * %{
|
||||
//plain pointer(out)
|
||||
#if ($owner)
|
||||
if ($1) {
|
||||
intrusive_ptr_add_ref($1);
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
|
|
@ -63,70 +63,70 @@
|
|||
if(!$1) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
}
|
||||
}
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{
|
||||
//plain reference(out)
|
||||
#if ($owner)
|
||||
if ($1) {
|
||||
intrusive_ptr_add_ref($1);
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
#endif
|
||||
%}
|
||||
|
||||
%typemap(in) TYPE *CONST& ($*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 = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
|
||||
$1 = &temp;
|
||||
$1 = &temp;
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
|
||||
// plain pointer by reference(out)
|
||||
#if ($owner)
|
||||
if (*$1) {
|
||||
intrusive_ptr_add_ref(*$1);
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1, SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_0);
|
||||
#endif
|
||||
%}
|
||||
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > ($&1_type argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > ($&1_type argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by value
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
if (smartarg) {
|
||||
$1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
}
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
|
||||
if ($1) {
|
||||
intrusive_ptr_add_ref(result.get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(result.get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
|
||||
// shared_ptr by value
|
||||
smartarg = *($&1_ltype*)&$input;
|
||||
if (smartarg) $1 = *smartarg;
|
||||
smartarg = *($&1_ltype*)&$input;
|
||||
if (smartarg) $1 = *smartarg;
|
||||
%}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
|
||||
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
|
||||
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
|
||||
%}
|
||||
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by reference
|
||||
if ( $input ) {
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
|
|
@ -140,21 +140,21 @@
|
|||
$1 = *temp;
|
||||
}
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
|
||||
if (*$1) {
|
||||
intrusive_ptr_add_ref($1->get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
%}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by pointer
|
||||
if ( $input ) {
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = &tempnull;
|
||||
}
|
||||
|
|
@ -163,17 +163,17 @@
|
|||
delete $1;
|
||||
if ($self) $1 = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input);
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{
|
||||
if ($1 && *$1) {
|
||||
intrusive_ptr_add_ref($1->get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
if ($owner) delete $1;
|
||||
if ($owner) delete $1;
|
||||
%}
|
||||
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& (SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > temp, $*1_ltype tempp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& (SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > temp, $*1_ltype tempp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by pointer reference
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
if ($input) {
|
||||
|
|
@ -185,14 +185,14 @@
|
|||
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{
|
||||
if ($self) $1 = *$input;
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{
|
||||
if (*$1 && **$1) {
|
||||
intrusive_ptr_add_ref((*$1)->get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >((*$1)->get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
%}
|
||||
%}
|
||||
|
||||
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
|
||||
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "jlong"
|
||||
%typemap (jtype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
|
||||
%typemap (jtype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
return $null;
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%typemap(out) CONST TYPE
|
||||
%typemap(out) CONST TYPE
|
||||
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
|
||||
|
||||
// plain pointer
|
||||
|
|
@ -371,11 +371,11 @@
|
|||
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
|
||||
// shared_ptr by value
|
||||
smartarg = *($&1_ltype*)&$input;
|
||||
if (smartarg) $1 = *smartarg;
|
||||
smartarg = *($&1_ltype*)&$input;
|
||||
if (smartarg) $1 = *smartarg;
|
||||
%}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
|
||||
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
|
||||
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
|
||||
%}
|
||||
|
||||
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
|
||||
|
|
@ -467,6 +467,17 @@
|
|||
%typemap(jtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "long"
|
||||
%typemap(jtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "long"
|
||||
|
||||
// Typecheck typemaps
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="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 > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
""
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
||||
// destructor wrapper customisation
|
||||
%feature("unref") TYPE
|
||||
%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;"
|
||||
|
||||
|
|
@ -28,9 +28,22 @@
|
|||
return $null;
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%typemap(out) CONST TYPE
|
||||
%typemap(out) CONST TYPE
|
||||
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE
|
||||
%{ $input = 0;
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE
|
||||
%{ if (!$input) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
|
||||
return $null;
|
||||
}
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
|
||||
$result = *smartarg->get();
|
||||
%}
|
||||
|
||||
// plain pointer
|
||||
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
|
||||
|
|
@ -39,6 +52,16 @@
|
|||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") CONST TYPE *
|
||||
%{ $input = 0;
|
||||
if ($1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($1 SWIG_NO_NULL_DELETER_0);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) CONST TYPE * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & %{
|
||||
$1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
|
||||
|
|
@ -49,6 +72,14 @@
|
|||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
|
||||
%{ *(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(directorin,descriptor="L$packagepath/$javaclassname;") CONST TYPE &
|
||||
%{ $input = 0;
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
%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);
|
||||
|
|
@ -56,18 +87,50 @@
|
|||
%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(directorin,descriptor="L$packagepath/$*javaclassname;") TYPE *CONST&
|
||||
%{ $input = 0;
|
||||
if ($1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($1 SWIG_NO_NULL_DELETER_0);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) TYPE *CONST& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ($&1_type argp)
|
||||
%{ argp = *($&1_ltype*)&$input;
|
||||
%{ argp = *($&1_ltype*)&$input;
|
||||
if (argp) $1 = *argp; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ $input = 0;
|
||||
if ($1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
|
||||
%{ if ($input) {
|
||||
$&1_type smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
|
||||
$result = *smartarg;
|
||||
} %}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
|
||||
%{ $1 = $input ? *($&1_ltype)&$input : &tempnull; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ *($&1_ltype)&$result = *$1 ? new $*1_ltype(*$1) : 0; %}
|
||||
%{ *($&1_ltype)&$result = *$1 ? new $*1_ltype(*$1) : 0; %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
|
||||
%{ $input = 0;
|
||||
if ($1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
|
||||
|
|
@ -76,12 +139,32 @@
|
|||
%{ *($&1_ltype)&$result = ($1 && *$1) ? new $*1_ltype(*$1) : 0;
|
||||
if ($owner) delete $1; %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
|
||||
%{ $input = 0;
|
||||
if ($1 && *$1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
|
||||
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
|
||||
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
|
||||
|
||||
%typemap(directorin,descriptor="L$packagepath/$typemap(jstype, TYPE);") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
%{ $input = 0;
|
||||
if ($1 && *$1) {
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1);
|
||||
} %}
|
||||
|
||||
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
|
||||
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
|
||||
|
|
@ -92,20 +175,20 @@
|
|||
%}
|
||||
|
||||
|
||||
%typemap (jni) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (jni) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "jlong"
|
||||
%typemap (jtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (jtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "long"
|
||||
%typemap (jstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (jstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(jstype, TYPE)"
|
||||
|
||||
%typemap(javain) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap(javain) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(jstype, TYPE).getCPtr($javainput)"
|
||||
|
|
@ -143,6 +226,18 @@
|
|||
return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
|
||||
}
|
||||
|
||||
%typemap(javadirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(jstype, TYPE).getCPtr($javacall)"
|
||||
|
||||
%typemap(javadirectorin) CONST TYPE,
|
||||
CONST TYPE *,
|
||||
CONST TYPE &,
|
||||
TYPE *CONST& "($jniinput == 0) ? null : new $typemap(jstype, TYPE)($jniinput, true)"
|
||||
|
||||
%typemap(javadirectorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "($jniinput == 0) ? null : new $typemap(jstype, TYPE)($jniinput, true)"
|
||||
|
||||
// Base proxy classes
|
||||
%typemap(javabody) TYPE %{
|
||||
private transient long swigCPtr;
|
||||
|
|
@ -156,6 +251,10 @@
|
|||
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY void swigSetCMemOwn(boolean own) {
|
||||
swigCMemOwn = own;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
|
|
@ -172,6 +271,11 @@
|
|||
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY void swigSetCMemOwn(boolean own) {
|
||||
swigCMemOwnDerived = own;
|
||||
super.swigSetCMemOwn(own);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") TYPE {
|
||||
|
|
@ -195,6 +299,38 @@
|
|||
super.delete();
|
||||
}
|
||||
|
||||
%typemap(directordisconnect, methodname="swigDirectorDisconnect") TYPE %{
|
||||
protected void $methodname() {
|
||||
swigSetCMemOwn(false);
|
||||
$jnicall;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(directorowner_release, methodname="swigReleaseOwnership") TYPE %{
|
||||
public void $methodname() {
|
||||
swigSetCMemOwn(false);
|
||||
$jnicall;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(directorowner_take, methodname="swigTakeOwnership") TYPE %{
|
||||
public void $methodname() {
|
||||
swigSetCMemOwn(true);
|
||||
$jnicall;
|
||||
}
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="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 > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
|
||||
""
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -5,12 +5,52 @@
|
|||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION)
|
||||
#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) || defined(DEBUG_DIRECTOR_THREAD_NAME)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
|
||||
#if defined(SWIG_JAVA_USE_THREAD_NAME)
|
||||
|
||||
#if !defined(SWIG_JAVA_GET_THREAD_NAME)
|
||||
namespace Swig {
|
||||
SWIGINTERN int GetThreadName(char *name, size_t len);
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include <sys/prctl.h>
|
||||
SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
|
||||
(void)len;
|
||||
#if defined(PR_GET_NAME)
|
||||
return prctl(PR_GET_NAME, (unsigned long)name, 0, 0, 0);
|
||||
#else
|
||||
(void)name;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(__unix__) || defined(__APPLE__)
|
||||
|
||||
#include <pthread.h>
|
||||
SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
|
||||
return pthread_getname_np(pthread_self(), name, len);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
|
||||
(void)len;
|
||||
(void)name;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace Swig {
|
||||
|
||||
/* Java object wrapper */
|
||||
|
|
@ -139,12 +179,27 @@ namespace Swig {
|
|||
void **jenv = (void **)&jenv_;
|
||||
#endif
|
||||
env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2);
|
||||
JavaVMAttachArgs args;
|
||||
args.version = JNI_VERSION_1_2;
|
||||
args.group = NULL;
|
||||
args.name = NULL;
|
||||
#if defined(SWIG_JAVA_USE_THREAD_NAME)
|
||||
char thread_name[64]; // MAX_TASK_COMM_LEN=16 is hard-coded in the Linux kernel and MacOS has MAXTHREADNAMESIZE=64.
|
||||
if (Swig::GetThreadName(thread_name, sizeof(thread_name)) == 0) {
|
||||
args.name = thread_name;
|
||||
#if defined(DEBUG_DIRECTOR_THREAD_NAME)
|
||||
std::cout << "JNIEnvWrapper: thread name: " << thread_name << std::endl;
|
||||
} else {
|
||||
std::cout << "JNIEnvWrapper: Couldn't set Java thread name" << std::endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON)
|
||||
// Attach a daemon thread to the JVM. Useful when the JVM should not wait for
|
||||
// the thread to exit upon shutdown. Only for jdk-1.4 and later.
|
||||
director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL);
|
||||
director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, &args);
|
||||
#else
|
||||
director_->swig_jvm_->AttachCurrentThread(jenv, NULL);
|
||||
director_->swig_jvm_->AttachCurrentThread(jenv, &args);
|
||||
#endif
|
||||
}
|
||||
~JNIEnvWrapper() {
|
||||
|
|
@ -160,6 +215,15 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
struct SwigDirectorMethod {
|
||||
const char *name;
|
||||
const char *desc;
|
||||
jmethodID methid;
|
||||
SwigDirectorMethod(JNIEnv *jenv, jclass baseclass, const char *name, const char *desc) : name(name), desc(desc) {
|
||||
methid = jenv->GetMethodID(baseclass, name, desc);
|
||||
}
|
||||
};
|
||||
|
||||
/* Java object wrapper */
|
||||
JObjectWrapper swig_self_;
|
||||
|
||||
|
|
@ -183,6 +247,11 @@ namespace Swig {
|
|||
}
|
||||
}
|
||||
|
||||
jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) {
|
||||
jclass clz = jenv->FindClass(classname);
|
||||
return clz ? (jclass)jenv->NewGlobalRef(clz) : 0;
|
||||
}
|
||||
|
||||
public:
|
||||
Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() {
|
||||
/* Acquire the Java VM pointer */
|
||||
|
|
@ -259,8 +328,10 @@ namespace Swig {
|
|||
JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) {
|
||||
}
|
||||
|
||||
const char *message() const {
|
||||
return message_.c_str("Could not get exception message in JavaExceptionMessage");
|
||||
// Return a C string of the exception message in the jthrowable passed in the constructor
|
||||
// If no message is available, null_string is return instead
|
||||
const char *message(const char *null_string = "Could not get exception message in JavaExceptionMessage") const {
|
||||
return message_.c_str(null_string);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -294,10 +365,11 @@ namespace Swig {
|
|||
public:
|
||||
|
||||
// Construct exception from a Java throwable
|
||||
DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) {
|
||||
DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(0), msg_(0) {
|
||||
|
||||
// Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/')
|
||||
if (throwable) {
|
||||
if (jenv && throwable) {
|
||||
jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
|
||||
jclass throwclz = jenv->GetObjectClass(throwable);
|
||||
if (throwclz) {
|
||||
jclass clzclz = jenv->GetObjectClass(throwclz);
|
||||
|
|
@ -318,11 +390,11 @@ namespace Swig {
|
|||
}
|
||||
|
||||
JavaExceptionMessage exceptionmsg(jenv, throwable);
|
||||
msg_ = copystr(exceptionmsg.message());
|
||||
msg_ = copystr(exceptionmsg.message(0));
|
||||
}
|
||||
|
||||
// More general constructor for handling as a java.lang.RuntimeException
|
||||
DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) {
|
||||
DirectorException(const char *msg) : jenv_(0), throwable_(0), classname_(0), msg_(msg ? copystr(msg) : 0) {
|
||||
}
|
||||
|
||||
~DirectorException() throw() {
|
||||
|
|
@ -331,31 +403,53 @@ namespace Swig {
|
|||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return msg_;
|
||||
return msg_ ? msg_ : "Unspecified DirectorException message";
|
||||
}
|
||||
|
||||
// Reconstruct and raise/throw the Java Exception that caused the DirectorException
|
||||
// Note that any error in the JNI exception handling results in a Java RuntimeException
|
||||
void raiseJavaException(JNIEnv *jenv) const {
|
||||
void throwException(JNIEnv *jenv) const {
|
||||
if (jenv) {
|
||||
jenv->ExceptionClear();
|
||||
if (jenv == jenv_ && throwable_) {
|
||||
// Throw original exception if not already pending
|
||||
jthrowable throwable = jenv->ExceptionOccurred();
|
||||
if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) {
|
||||
jenv->ExceptionClear();
|
||||
throwable = 0;
|
||||
}
|
||||
if (!throwable)
|
||||
jenv->Throw(throwable_);
|
||||
} else {
|
||||
// Try and reconstruct original exception, but original stacktrace is not reconstructed
|
||||
jenv->ExceptionClear();
|
||||
|
||||
jmethodID ctorMethodID = 0;
|
||||
jclass throwableclass = 0;
|
||||
if (classname_) {
|
||||
throwableclass = jenv->FindClass(classname_);
|
||||
if (throwableclass)
|
||||
ctorMethodID = jenv->GetMethodID(throwableclass, "<init>", "(Ljava/lang/String;)V");
|
||||
}
|
||||
jmethodID ctorMethodID = 0;
|
||||
jclass throwableclass = 0;
|
||||
if (classname_) {
|
||||
throwableclass = jenv->FindClass(classname_);
|
||||
if (throwableclass)
|
||||
ctorMethodID = jenv->GetMethodID(throwableclass, "<init>", "(Ljava/lang/String;)V");
|
||||
}
|
||||
|
||||
if (ctorMethodID) {
|
||||
jenv->ThrowNew(throwableclass, what());
|
||||
} else {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what());
|
||||
}
|
||||
if (ctorMethodID) {
|
||||
jenv->ThrowNew(throwableclass, what());
|
||||
} else {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated - use throwException
|
||||
void raiseJavaException(JNIEnv *jenv) const {
|
||||
throwException(jenv);
|
||||
}
|
||||
|
||||
// Create and throw the DirectorException
|
||||
static void raise(JNIEnv *jenv, jthrowable throwable) {
|
||||
throw DirectorException(jenv, throwable);
|
||||
}
|
||||
|
||||
private:
|
||||
static char *copypath(const char *srcmsg) {
|
||||
char *target = copystr(srcmsg);
|
||||
|
|
@ -376,11 +470,14 @@ namespace Swig {
|
|||
return target;
|
||||
}
|
||||
|
||||
JNIEnv *jenv_;
|
||||
jthrowable throwable_;
|
||||
const char *classname_;
|
||||
const char *msg_;
|
||||
};
|
||||
|
||||
// Helper method to determine if a Java throwable matches a particular Java class type
|
||||
// Note side effect of clearing any pending exceptions
|
||||
SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) {
|
||||
bool matches = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,14 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_JavaIntFromSize_t", "header") {
|
||||
/* Check for overflow converting to Java int (always signed 32-bit) from (unsigned variable-bit) size_t */
|
||||
SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
|
||||
static const jint JINT_MAX = 0x7FFFFFFF;
|
||||
return (size > (size_t)JINT_MAX) ? -1 : (jint)size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Primitive types */
|
||||
%typemap(jni) bool, const bool & "jboolean"
|
||||
%typemap(jni) char, const char & "jchar"
|
||||
|
|
@ -103,6 +111,21 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jstype) double, const double & "double"
|
||||
%typemap(jstype) void "void"
|
||||
|
||||
%typemap(jboxtype) bool, const bool & "Boolean"
|
||||
%typemap(jboxtype) char, const char & "Character"
|
||||
%typemap(jboxtype) signed char, const signed char & "Byte"
|
||||
%typemap(jboxtype) unsigned char, const unsigned char & "Short"
|
||||
%typemap(jboxtype) short, const short & "Short"
|
||||
%typemap(jboxtype) unsigned short, const unsigned short & "Integer"
|
||||
%typemap(jboxtype) int, const int & "Integer"
|
||||
%typemap(jboxtype) unsigned int, const unsigned int & "Long"
|
||||
%typemap(jboxtype) long, const long & "Integer"
|
||||
%typemap(jboxtype) unsigned long, const unsigned long & "Long"
|
||||
%typemap(jboxtype) long long, const long long & "Long"
|
||||
%typemap(jboxtype) unsigned long long, const unsigned long long & "java.math.BigInteger"
|
||||
%typemap(jboxtype) float, const float & "Float"
|
||||
%typemap(jboxtype) double, const double & "Double"
|
||||
|
||||
%typemap(jni) char *, char *&, char[ANY], char[] "jstring"
|
||||
%typemap(jtype) char *, char *&, char[ANY], char[] "String"
|
||||
%typemap(jstype) char *, char *&, char[ANY], char[] "String"
|
||||
|
|
@ -137,7 +160,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jtype) jfloat "float"
|
||||
%typemap(jtype) jdouble "double"
|
||||
%typemap(jtype) jstring "String"
|
||||
%typemap(jtype) jobject "Object"
|
||||
%typemap(jtype) jobject "java.lang.Object"
|
||||
%typemap(jtype) jbooleanArray "boolean[]"
|
||||
%typemap(jtype) jcharArray "char[]"
|
||||
%typemap(jtype) jbyteArray "byte[]"
|
||||
|
|
@ -146,7 +169,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jtype) jlongArray "long[]"
|
||||
%typemap(jtype) jfloatArray "float[]"
|
||||
%typemap(jtype) jdoubleArray "double[]"
|
||||
%typemap(jtype) jobjectArray "Object[]"
|
||||
%typemap(jtype) jobjectArray "java.lang.Object[]"
|
||||
|
||||
%typemap(jstype) jboolean "boolean"
|
||||
%typemap(jstype) jchar "char"
|
||||
|
|
@ -157,7 +180,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jstype) jfloat "float"
|
||||
%typemap(jstype) jdouble "double"
|
||||
%typemap(jstype) jstring "String"
|
||||
%typemap(jstype) jobject "Object"
|
||||
%typemap(jstype) jobject "java.lang.Object"
|
||||
%typemap(jstype) jbooleanArray "boolean[]"
|
||||
%typemap(jstype) jcharArray "char[]"
|
||||
%typemap(jstype) jbyteArray "byte[]"
|
||||
|
|
@ -166,12 +189,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jstype) jlongArray "long[]"
|
||||
%typemap(jstype) jfloatArray "float[]"
|
||||
%typemap(jstype) jdoubleArray "double[]"
|
||||
%typemap(jstype) jobjectArray "Object[]"
|
||||
%typemap(jstype) jobjectArray "java.lang.Object[]"
|
||||
|
||||
/* Non primitive types */
|
||||
%typemap(jni) SWIGTYPE "jlong"
|
||||
%typemap(jtype) SWIGTYPE "long"
|
||||
%typemap(jstype) SWIGTYPE "$&javaclassname"
|
||||
%typemap(jboxtype) SWIGTYPE "$typemap(jstype, $1_type)"
|
||||
|
||||
%typemap(jni) SWIGTYPE [] "jlong"
|
||||
%typemap(jtype) SWIGTYPE [] "long"
|
||||
|
|
@ -363,11 +387,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$result = bigint;
|
||||
}
|
||||
|
||||
/* Convert to BigInteger (see out typemap) */
|
||||
%typemap(directorin, descriptor="Ljava/math/BigInteger;") unsigned long long, const unsigned long long & {
|
||||
%typemap(directorin, descriptor="Ljava/math/BigInteger;", noblock=1) unsigned long long, const unsigned long long & {
|
||||
{
|
||||
jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
|
||||
jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
|
||||
jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
|
||||
|
|
@ -382,8 +408,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$input = bigint;
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
||||
|
||||
%typemap(javadirectorin) unsigned long long "$jniinput"
|
||||
%typemap(javadirectorout) unsigned long long "$javacall"
|
||||
|
|
@ -611,6 +639,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$result = bigint;
|
||||
}
|
||||
|
||||
|
|
@ -1022,6 +1051,14 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1);
|
||||
return $null; %}
|
||||
|
||||
/* For methods to raise/throw the original Java exception thrown in a director method */
|
||||
%typemap(throws) Swig::DirectorException
|
||||
%{ $1.throwException(jenv);
|
||||
return $null; %}
|
||||
|
||||
/* Java to C++ DirectorException should already be handled. Suppress warning and do nothing in the
|
||||
event a user specifies a global: %catches(Swig::DirectorException); */
|
||||
%typemap(directorthrows) Swig::DirectorException ""
|
||||
|
||||
/* Typemaps for code generation in proxy classes and Java type wrapper classes */
|
||||
|
||||
|
|
@ -1144,6 +1181,14 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$1 = ($1_ltype)&temp; %}
|
||||
%typemap(out) SWIGTYPE *const&
|
||||
%{ *($1_ltype)&$result = *$1; %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$*javaclassname;") SWIGTYPE *const&
|
||||
%{ *(($1_ltype)&$input) = ($*1_ltype) $1; %}
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) SWIGTYPE *const&
|
||||
%{ static $*1_ltype swig_temp;
|
||||
swig_temp = *($1_ltype)&$input;
|
||||
$result = &swig_temp; %}
|
||||
%typemap(javadirectorin) SWIGTYPE *const& "($jniinput == 0) ? null : new $*javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE *const& "$*javaclassname.getCPtr($javacall)"
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
|
|
@ -1151,6 +1196,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javainterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
|
||||
|
||||
/* javabody typemaps */
|
||||
|
||||
|
|
@ -1228,6 +1274,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE)
|
|||
SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
|
||||
|
||||
%typemap(javafinalize) SWIGTYPE %{
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void finalize() {
|
||||
delete();
|
||||
}
|
||||
|
|
@ -1255,7 +1302,7 @@ SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
|
|||
*/
|
||||
|
||||
%define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
|
||||
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
|
||||
%typemap(javaconstruct,directorconnect="\n $imclassname.$javaclazznamedirector_connect(this, swigCPtr, OWNERSHIP, WEAKREF);") TYPENAME {
|
||||
this($imcall, OWNERSHIP);$directorconnect
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -1267,7 +1314,7 @@ SWIG_PROXY_CONSTRUCTOR(true, false, TYPENAME)
|
|||
// Set the default for SWIGTYPE: Java owns the C/C++ object.
|
||||
SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
||||
|
||||
%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
|
||||
%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized", parameters="") SWIGTYPE {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
|
|
@ -1277,7 +1324,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
|
||||
%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized", parameters="") SWIGTYPE {
|
||||
if (swigCPtr != 0) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
|
|
@ -1317,6 +1364,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
#define %javaexception(exceptionclasses) %feature("except",throws=exceptionclasses)
|
||||
#define %nojavaexception %feature("except","0",throws="")
|
||||
#define %clearjavaexception %feature("except","",throws="")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
||||
%pragma(java) jniclassclassmodifiers="public class"
|
||||
%pragma(java) moduleclassmodifiers="public class"
|
||||
|
|
@ -1332,14 +1380,16 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* String & length */
|
||||
%typemap(jni) (char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (char *STRING, size_t LENGTH) {
|
||||
%typemap(jni) (const char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (const char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (const char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (const char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (const char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (const char *STRING, size_t LENGTH) {
|
||||
if ($input) {
|
||||
$1 = ($1_ltype) JCALL2(GetByteArrayElements, jenv, $input, 0);
|
||||
$2 = ($2_type) JCALL1(GetArrayLength, jenv, $input);
|
||||
|
|
@ -1348,18 +1398,26 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
$2 = 0;
|
||||
}
|
||||
}
|
||||
%typemap(argout) (const char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, JNI_ABORT);
|
||||
}
|
||||
%typemap(directorin, descriptor="[B", noblock=1) (const char *STRING, size_t LENGTH) {
|
||||
$input = 0;
|
||||
if ($1) {
|
||||
$input = JCALL1(NewByteArray, jenv, (jsize)$2);
|
||||
if (!$input) return $null;
|
||||
JCALL4(SetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1);
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input);
|
||||
}
|
||||
%typemap(javadirectorin, descriptor="[B") (const char *STRING, size_t LENGTH) "$jniinput"
|
||||
%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) }
|
||||
/* Enable write-back for non-const version */
|
||||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
%typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) {
|
||||
jbyteArray jb = (jenv)->NewByteArray((jsize)$2);
|
||||
(jenv)->SetByteArrayRegion(jb, 0, (jsize)$2, (jbyte *)$1);
|
||||
$input = jb;
|
||||
}
|
||||
%typemap(directorargout) (char *STRING, size_t LENGTH)
|
||||
%{(jenv)->GetByteArrayRegion($input, 0, (jsize)$2, (jbyte *)$1);
|
||||
(jenv)->DeleteLocalRef($input);%}
|
||||
%typemap(javadirectorin, descriptor="[B") (char *STRING, size_t LENGTH) "$jniinput"
|
||||
%typemap(directorargout, noblock=1) (char *STRING, size_t LENGTH)
|
||||
{ if ($input && $1) JCALL4(GetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); }
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
/* java keywords */
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
|
||||
/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so
|
||||
* that the same typemaps can be used for generating code for both C and C++. The SWIG preprocessor can expand
|
||||
* the macros thereby generating the correct calling convention. It is thus essential that all typemaps that
|
||||
* use the macros are not within %{ %} brackets as they won't be run through the SWIG preprocessor. */
|
||||
|
|
@ -50,15 +50,16 @@
|
|||
%insert(runtime) %{
|
||||
/* Support for throwing Java exceptions */
|
||||
typedef enum {
|
||||
SWIG_JavaOutOfMemoryError = 1,
|
||||
SWIG_JavaIOException,
|
||||
SWIG_JavaRuntimeException,
|
||||
SWIG_JavaOutOfMemoryError = 1,
|
||||
SWIG_JavaIOException,
|
||||
SWIG_JavaRuntimeException,
|
||||
SWIG_JavaIndexOutOfBoundsException,
|
||||
SWIG_JavaArithmeticException,
|
||||
SWIG_JavaIllegalArgumentException,
|
||||
SWIG_JavaNullPointerException,
|
||||
SWIG_JavaDirectorPureVirtual,
|
||||
SWIG_JavaUnknownError
|
||||
SWIG_JavaUnknownError,
|
||||
SWIG_JavaIllegalStateException,
|
||||
} SWIG_JavaExceptionCodes;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -80,6 +81,7 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
|
|||
{ SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
|
||||
{ SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
|
||||
{ SWIG_JavaUnknownError, "java/lang/UnknownError" },
|
||||
{ SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
|
||||
{ (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" }
|
||||
};
|
||||
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
|
||||
|
|
|
|||
|
|
@ -8,15 +8,17 @@ namespace std {
|
|||
|
||||
template<class T, size_t N> class array {
|
||||
public:
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
array();
|
||||
array(const array& other);
|
||||
|
||||
size_type size() const;
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
|
|
|
|||
225
Lib/java/std_list.i
Normal file
225
Lib/java/std_list.i
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_list.i
|
||||
*
|
||||
* SWIG typemaps for std::list.
|
||||
* The Java proxy class extends java.util.AbstractSequentialList. The std::list
|
||||
* container looks and feels much like a java.util.LinkedList from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
%{
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("SWIG_ListSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_ListSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1)
|
||||
throw std::out_of_range("list size is too large to fit into a Java int");
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%javamethodmodifiers std::list::begin "private";
|
||||
%javamethodmodifiers std::list::insert "private";
|
||||
%javamethodmodifiers std::list::doSize "private";
|
||||
%javamethodmodifiers std::list::doPreviousIndex "private";
|
||||
%javamethodmodifiers std::list::doNextIndex "private";
|
||||
%javamethodmodifiers std::list::doHasNext "private";
|
||||
|
||||
// Match Java style better:
|
||||
%rename(Iterator) std::list::iterator;
|
||||
|
||||
%nodefaultctor std::list::iterator;
|
||||
|
||||
namespace std {
|
||||
template <typename T> class list {
|
||||
|
||||
%typemap(javabase) std::list<T> "java.util.AbstractSequentialList<$typemap(jboxtype, T)>"
|
||||
%proxycode %{
|
||||
public $javaclassname(java.util.Collection c) {
|
||||
this();
|
||||
java.util.ListIterator<$typemap(jboxtype, T)> it = listIterator(0);
|
||||
// Special case the "copy constructor" here to avoid lots of cross-language calls
|
||||
for (java.lang.Object o : c) {
|
||||
it.add(($typemap(jboxtype, T))o);
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return doSize();
|
||||
}
|
||||
|
||||
public boolean add($typemap(jboxtype, T) value) {
|
||||
addLast(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public java.util.ListIterator<$typemap(jboxtype, T)> listIterator(int index) {
|
||||
return new java.util.ListIterator<$typemap(jboxtype, T)>() {
|
||||
private Iterator pos;
|
||||
private Iterator last;
|
||||
|
||||
private java.util.ListIterator<$typemap(jboxtype, T)> init(int index) {
|
||||
if (index < 0 || index > $javaclassname.this.size())
|
||||
throw new IndexOutOfBoundsException("Index: " + index);
|
||||
pos = $javaclassname.this.begin();
|
||||
pos = pos.advance_unchecked(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void add($typemap(jboxtype, T) v) {
|
||||
// Technically we can invalidate last here, but this makes more sense
|
||||
last = $javaclassname.this.insert(pos, v);
|
||||
}
|
||||
|
||||
public void set($typemap(jboxtype, T) v) {
|
||||
if (null == last) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
last.set_unchecked(v);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
if (null == last) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
$javaclassname.this.remove(last);
|
||||
last = null;
|
||||
}
|
||||
|
||||
public int previousIndex() {
|
||||
return $javaclassname.this.doPreviousIndex(pos);
|
||||
}
|
||||
|
||||
public int nextIndex() {
|
||||
return $javaclassname.this.doNextIndex(pos);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) previous() {
|
||||
if (previousIndex() < 0) {
|
||||
throw new java.util.NoSuchElementException();
|
||||
}
|
||||
last = pos;
|
||||
pos = pos.previous_unchecked();
|
||||
return last.deref_unchecked();
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) next() {
|
||||
if (!hasNext()) {
|
||||
throw new java.util.NoSuchElementException();
|
||||
}
|
||||
last = pos;
|
||||
pos = pos.next_unchecked();
|
||||
return last.deref_unchecked();
|
||||
}
|
||||
|
||||
public boolean hasPrevious() {
|
||||
// This call to previousIndex() will be much slower than the hasNext() implementation, but it's simpler like this with C++ forward iterators
|
||||
return previousIndex() != -1;
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return $javaclassname.this.doHasNext(pos);
|
||||
}
|
||||
}.init(index);
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
/*
|
||||
* We'd actually be better off having the nested class *not* be static in the wrapper
|
||||
* output, but this doesn't actually remove the $static from the nested class still.
|
||||
* (This would allow us to somewhat simplify the implementation of the ListIterator
|
||||
* interface and give "natural" semantics to Java users of the C++ iterator)
|
||||
*/
|
||||
//%typemap(javaclassmodifiers) iterator "public class"
|
||||
//%typemap(javainterfaces) iterator "java.util.ListIterator<$typemap(jboxtype, T)>"
|
||||
|
||||
struct iterator {
|
||||
%extend {
|
||||
void set_unchecked(const T &v) {
|
||||
**$self = v;
|
||||
}
|
||||
|
||||
iterator next_unchecked() const {
|
||||
std::list<T>::iterator ret = *$self;
|
||||
++ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
iterator previous_unchecked() const {
|
||||
std::list<T>::iterator ret = *$self;
|
||||
--ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
T deref_unchecked() const {
|
||||
return **$self;
|
||||
}
|
||||
|
||||
iterator advance_unchecked(size_type index) const {
|
||||
std::list<T>::iterator ret = *$self;
|
||||
std::advance(ret, index);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
list();
|
||||
list(const list& other);
|
||||
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%rename(remove) erase;
|
||||
iterator erase(iterator pos);
|
||||
%rename(removeLast) pop_back;
|
||||
void pop_back();
|
||||
%rename(removeFirst) pop_front;
|
||||
void pop_front();
|
||||
%rename(addLast) push_back;
|
||||
void push_back(const T &value);
|
||||
%rename(addFirst) push_front;
|
||||
void push_front(const T &value);
|
||||
iterator begin();
|
||||
iterator end();
|
||||
iterator insert(iterator pos, const T &value);
|
||||
|
||||
%extend {
|
||||
%fragment("SWIG_ListSize");
|
||||
|
||||
list(jint count, const T &value) throw (std::out_of_range) {
|
||||
if (count < 0)
|
||||
throw std::out_of_range("list count must be positive");
|
||||
return new std::list<T>(static_cast<std::list<T>::size_type>(count), value);
|
||||
}
|
||||
|
||||
jint doSize() const throw (std::out_of_range) {
|
||||
return SWIG_ListSize(self->size());
|
||||
}
|
||||
|
||||
jint doPreviousIndex(const iterator &pos) const throw (std::out_of_range) {
|
||||
return pos == self->begin() ? -1 : SWIG_ListSize(std::distance(self->begin(), static_cast<std::list<T>::const_iterator>(pos)));
|
||||
}
|
||||
|
||||
jint doNextIndex(const iterator &pos) const throw (std::out_of_range) {
|
||||
return pos == self->end() ? SWIG_ListSize(self->size()) : SWIG_ListSize(std::distance(self->begin(), static_cast<std::list<T>::const_iterator>(pos)));
|
||||
}
|
||||
|
||||
bool doHasNext(const iterator &pos) const {
|
||||
return pos != $self->end();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
* std_map.i
|
||||
*
|
||||
* SWIG typemaps for std::map
|
||||
* The Java proxy class extends java.util.AbstractMap. The std::map
|
||||
* container looks and feels much like a java.util.HashMap from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
|
@ -12,52 +14,200 @@
|
|||
|
||||
%{
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// exported class
|
||||
%fragment("SWIG_MapSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_MapSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1) {
|
||||
throw std::out_of_range("map size is too large to fit into a Java int");
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%javamethodmodifiers std::map::sizeImpl "private";
|
||||
%javamethodmodifiers std::map::containsImpl "private";
|
||||
%javamethodmodifiers std::map::putUnchecked "private";
|
||||
%javamethodmodifiers std::map::removeUnchecked "private";
|
||||
%javamethodmodifiers std::map::find "private";
|
||||
%javamethodmodifiers std::map::begin "private";
|
||||
%javamethodmodifiers std::map::end "private";
|
||||
|
||||
%rename(Iterator) std::map::iterator;
|
||||
%nodefaultctor std::map::iterator;
|
||||
%javamethodmodifiers std::map::iterator::getNextUnchecked "private";
|
||||
%javamethodmodifiers std::map::iterator::isNot "private";
|
||||
%javamethodmodifiers std::map::iterator::getKey "private";
|
||||
%javamethodmodifiers std::map::iterator::getValue "private";
|
||||
%javamethodmodifiers std::map::iterator::setValue "private";
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
map();
|
||||
map(const map<K,T> &);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
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;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
void set(const K& key, const 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();
|
||||
}
|
||||
template<class K, class T, class C = std::less< K> > class map {
|
||||
|
||||
%typemap(javabase) std::map< K, T, C >
|
||||
"java.util.AbstractMap<$typemap(jboxtype, K), $typemap(jboxtype, T)>"
|
||||
|
||||
%proxycode %{
|
||||
|
||||
public int size() {
|
||||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean containsKey(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return containsImpl(($typemap(jboxtype, K))key);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) get(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
return itr.getValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) {
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
$typemap(jboxtype, T) oldValue = itr.getValue();
|
||||
itr.setValue(value);
|
||||
return oldValue;
|
||||
} else {
|
||||
putUnchecked(key, value);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) remove(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
$typemap(jboxtype, T) oldValue = itr.getValue();
|
||||
removeUnchecked(itr);
|
||||
return oldValue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> entrySet() {
|
||||
java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> setToReturn =
|
||||
new java.util.HashSet<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>>();
|
||||
|
||||
Iterator itr = begin();
|
||||
final Iterator end = end();
|
||||
while (itr.isNot(end)) {
|
||||
setToReturn.add(new Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>() {
|
||||
private Iterator iterator;
|
||||
|
||||
private Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)> init(Iterator iterator) {
|
||||
this.iterator = iterator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, K) getKey() {
|
||||
return iterator.getKey();
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) getValue() {
|
||||
return iterator.getValue();
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) setValue($typemap(jboxtype, T) newValue) {
|
||||
$typemap(jboxtype, T) oldValue = iterator.getValue();
|
||||
iterator.setValue(newValue);
|
||||
return oldValue;
|
||||
}
|
||||
}.init(itr));
|
||||
itr = itr.getNextUnchecked();
|
||||
}
|
||||
|
||||
return setToReturn;
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map& other);
|
||||
|
||||
struct iterator {
|
||||
%typemap(javaclassmodifiers) iterator "protected class"
|
||||
%extend {
|
||||
std::map< K, T, C >::iterator getNextUnchecked() {
|
||||
std::map< K, T, C >::iterator copy = (*$self);
|
||||
return ++copy;
|
||||
}
|
||||
|
||||
bool isNot(iterator other) const {
|
||||
return (*$self != other);
|
||||
}
|
||||
|
||||
K getKey() const {
|
||||
return (*$self)->first;
|
||||
}
|
||||
|
||||
T getValue() const {
|
||||
return (*$self)->second;
|
||||
}
|
||||
|
||||
void setValue(const T& newValue) {
|
||||
(*$self)->second = newValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
iterator find(const K& key);
|
||||
iterator begin();
|
||||
iterator end();
|
||||
%extend {
|
||||
%fragment("SWIG_MapSize");
|
||||
|
||||
jint sizeImpl() const throw (std::out_of_range) {
|
||||
return SWIG_MapSize(self->size());
|
||||
}
|
||||
|
||||
bool containsImpl(const K& key) {
|
||||
return (self->count(key) > 0);
|
||||
}
|
||||
|
||||
void putUnchecked(const K& key, const T& value) {
|
||||
(*self)[key] = value;
|
||||
}
|
||||
|
||||
void removeUnchecked(const std::map< K, T, C >::iterator itr) {
|
||||
self->erase(itr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 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"
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
203
Lib/java/std_set.i
Normal file
203
Lib/java/std_set.i
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_set.i
|
||||
*
|
||||
* SWIG typemaps for std::set
|
||||
* The Java proxy class extends java.util.AbstractSet. The std::set
|
||||
* container looks and feels much like a java.util.HashSet from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::set
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("SWIG_SetSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_SetSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1) {
|
||||
throw std::out_of_range("set size is too large to fit into a Java int");
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%javamethodmodifiers std::set::sizeImpl "private";
|
||||
%javamethodmodifiers std::set::containsImpl "private";
|
||||
%javamethodmodifiers std::set::removeImpl "private";
|
||||
%javamethodmodifiers std::set::hasNextImpl "private";
|
||||
%javamethodmodifiers std::set::begin "private";
|
||||
%javamethodmodifiers std::set::end "private";
|
||||
|
||||
%rename(Iterator) std::set::iterator;
|
||||
%nodefaultctor std::set::iterator;
|
||||
%javamethodmodifiers std::set::iterator::incrementUnchecked "private";
|
||||
%javamethodmodifiers std::set::iterator::derefUnchecked "private";
|
||||
%javamethodmodifiers std::set::iterator::isNot "private";
|
||||
|
||||
namespace std {
|
||||
|
||||
template <class T>
|
||||
class set {
|
||||
|
||||
%typemap(javabase) std::set<T> "java.util.AbstractSet<$typemap(jboxtype, T)>"
|
||||
%proxycode %{
|
||||
public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
|
||||
this();
|
||||
addAll(collection);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean add($typemap(jboxtype, T) key) {
|
||||
return addImpl(key);
|
||||
}
|
||||
|
||||
public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
|
||||
boolean didAddElement = false;
|
||||
for (java.lang.Object object : collection) {
|
||||
didAddElement |= add(($typemap(jboxtype, T))object);
|
||||
}
|
||||
|
||||
return didAddElement;
|
||||
}
|
||||
|
||||
public java.util.Iterator<$typemap(jboxtype, T)> iterator() {
|
||||
return new java.util.Iterator<$typemap(jboxtype, T)>() {
|
||||
private Iterator curr;
|
||||
private Iterator end;
|
||||
|
||||
private java.util.Iterator<$typemap(jboxtype, T)> init() {
|
||||
curr = $javaclassname.this.begin();
|
||||
end = $javaclassname.this.end();
|
||||
return this;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) next() {
|
||||
if (!hasNext()) {
|
||||
throw new java.util.NoSuchElementException();
|
||||
}
|
||||
|
||||
// Save the current position, increment it,
|
||||
// then return the value at the position before the increment.
|
||||
final $typemap(jboxtype, T) currValue = curr.derefUnchecked();
|
||||
curr.incrementUnchecked();
|
||||
return currValue;
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return curr.isNot(end);
|
||||
}
|
||||
}.init();
|
||||
}
|
||||
|
||||
public boolean containsAll(java.util.Collection<?> collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
if (!contains(object)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean contains(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return containsImpl(($typemap(jboxtype, T))object);
|
||||
}
|
||||
|
||||
public boolean removeAll(java.util.Collection<?> collection) {
|
||||
boolean didRemoveElement = false;
|
||||
for (java.lang.Object object : collection) {
|
||||
didRemoveElement |= remove(object);
|
||||
}
|
||||
|
||||
return didRemoveElement;
|
||||
}
|
||||
|
||||
public boolean remove(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return removeImpl(($typemap(jboxtype, T))object);
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
|
||||
struct iterator {
|
||||
%typemap(javaclassmodifiers) iterator "protected class"
|
||||
%extend {
|
||||
void incrementUnchecked() {
|
||||
++(*$self);
|
||||
}
|
||||
|
||||
T derefUnchecked() const {
|
||||
return **$self;
|
||||
}
|
||||
|
||||
bool isNot(iterator other) const {
|
||||
return (*$self != other);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T key_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
set();
|
||||
set(const set& other);
|
||||
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
iterator begin();
|
||||
iterator end();
|
||||
|
||||
%extend {
|
||||
%fragment("SWIG_SetSize");
|
||||
|
||||
// Returns whether item was inserted.
|
||||
bool addImpl(const T& key) {
|
||||
return self->insert(key).second;
|
||||
}
|
||||
|
||||
// Returns whether set contains key.
|
||||
bool containsImpl(const T& key) {
|
||||
return (self->count(key) > 0);
|
||||
}
|
||||
|
||||
// Returns whether the item was erased.
|
||||
bool removeImpl(const T& key) {
|
||||
return (self->erase(key) > 0);
|
||||
}
|
||||
|
||||
jint sizeImpl() const throw (std::out_of_range) {
|
||||
return SWIG_SetSize(self->size());
|
||||
}
|
||||
|
||||
bool hasNextImpl(const iterator& itr) const {
|
||||
return (itr != $self->end());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
211
Lib/java/std_unordered_map.i
Normal file
211
Lib/java/std_unordered_map.i
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_unordered_map.i
|
||||
*
|
||||
* SWIG typemaps for std::unordered_map
|
||||
* The Java proxy class extends java.util.AbstractMap. The std::unordered_map
|
||||
* container looks and feels much like a java.util.HashMap from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::unordered_map
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <unordered_map>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("SWIG_MapSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_MapSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1) {
|
||||
throw std::out_of_range("map size is too large to fit into a Java int");
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%javamethodmodifiers std::unordered_map::sizeImpl "private";
|
||||
%javamethodmodifiers std::unordered_map::containsImpl "private";
|
||||
%javamethodmodifiers std::unordered_map::putUnchecked "private";
|
||||
%javamethodmodifiers std::unordered_map::removeUnchecked "private";
|
||||
%javamethodmodifiers std::unordered_map::find "private";
|
||||
%javamethodmodifiers std::unordered_map::begin "private";
|
||||
%javamethodmodifiers std::unordered_map::end "private";
|
||||
|
||||
%rename(Iterator) std::unordered_map::iterator;
|
||||
%nodefaultctor std::unordered_map::iterator;
|
||||
%javamethodmodifiers std::unordered_map::iterator::getNextUnchecked "private";
|
||||
%javamethodmodifiers std::unordered_map::iterator::isNot "private";
|
||||
%javamethodmodifiers std::unordered_map::iterator::getKey "private";
|
||||
%javamethodmodifiers std::unordered_map::iterator::getValue "private";
|
||||
%javamethodmodifiers std::unordered_map::iterator::setValue "private";
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class unordered_map {
|
||||
|
||||
%typemap(javabase) std::unordered_map<K, T>
|
||||
"java.util.AbstractMap<$typemap(jboxtype, K), $typemap(jboxtype, T)>"
|
||||
|
||||
%proxycode %{
|
||||
|
||||
public int size() {
|
||||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean containsKey(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return containsImpl(($typemap(jboxtype, K))key);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) get(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
return itr.getValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) {
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
$typemap(jboxtype, T) oldValue = itr.getValue();
|
||||
itr.setValue(value);
|
||||
return oldValue;
|
||||
} else {
|
||||
putUnchecked(key, value);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) remove(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator itr = find(($typemap(jboxtype, K)) key);
|
||||
if (itr.isNot(end())) {
|
||||
$typemap(jboxtype, T) oldValue = itr.getValue();
|
||||
removeUnchecked(itr);
|
||||
return oldValue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> entrySet() {
|
||||
java.util.Set<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>> setToReturn =
|
||||
new java.util.HashSet<Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>>();
|
||||
|
||||
Iterator itr = begin();
|
||||
final Iterator end = end();
|
||||
while (itr.isNot(end)) {
|
||||
setToReturn.add(new Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)>() {
|
||||
private Iterator iterator;
|
||||
|
||||
private Entry<$typemap(jboxtype, K), $typemap(jboxtype, T)> init(Iterator iterator) {
|
||||
this.iterator = iterator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, K) getKey() {
|
||||
return iterator.getKey();
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) getValue() {
|
||||
return iterator.getValue();
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) setValue($typemap(jboxtype, T) newValue) {
|
||||
$typemap(jboxtype, T) oldValue = iterator.getValue();
|
||||
iterator.setValue(newValue);
|
||||
return oldValue;
|
||||
}
|
||||
}.init(itr));
|
||||
itr = itr.getNextUnchecked();
|
||||
}
|
||||
|
||||
return setToReturn;
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
unordered_map();
|
||||
unordered_map(const unordered_map& other);
|
||||
|
||||
struct iterator {
|
||||
%typemap(javaclassmodifiers) iterator "protected class"
|
||||
%extend {
|
||||
std::unordered_map< K, T >::iterator getNextUnchecked() {
|
||||
std::unordered_map< K, T >::iterator copy = (*$self);
|
||||
return ++copy;
|
||||
}
|
||||
|
||||
bool isNot(iterator other) const {
|
||||
return (*$self != other);
|
||||
}
|
||||
|
||||
K getKey() const {
|
||||
return (*$self)->first;
|
||||
}
|
||||
|
||||
T getValue() const {
|
||||
return (*$self)->second;
|
||||
}
|
||||
|
||||
void setValue(const T& newValue) {
|
||||
(*$self)->second = newValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
iterator find(const K& key);
|
||||
iterator begin();
|
||||
iterator end();
|
||||
%extend {
|
||||
%fragment("SWIG_MapSize");
|
||||
|
||||
jint sizeImpl() const throw (std::out_of_range) {
|
||||
return SWIG_MapSize(self->size());
|
||||
}
|
||||
|
||||
bool containsImpl(const K& key) {
|
||||
return (self->count(key) > 0);
|
||||
}
|
||||
|
||||
void putUnchecked(const K& key, const T& value) {
|
||||
(*self)[key] = value;
|
||||
}
|
||||
|
||||
void removeUnchecked(const std::unordered_map< K, T >::iterator itr) {
|
||||
self->erase(itr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
199
Lib/java/std_unordered_set.i
Normal file
199
Lib/java/std_unordered_set.i
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_unordered_set.i
|
||||
*
|
||||
* SWIG typemaps for std::unordered_set
|
||||
* The Java proxy class extends java.util.AbstractSet. The std::unordered_set
|
||||
* container looks and feels much like a java.util.HashSet from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::unordered_set
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <unordered_set>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("SWIG_UnorderedSetSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_UnorderedSetSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1) {
|
||||
throw std::out_of_range("unordered_set size is too large to fit into a Java int");
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%javamethodmodifiers std::unordered_set::sizeImpl "private";
|
||||
%javamethodmodifiers std::unordered_set::containsImpl "private";
|
||||
%javamethodmodifiers std::unordered_set::removeImpl "private";
|
||||
%javamethodmodifiers std::unordered_set::hasNextImpl "private";
|
||||
%javamethodmodifiers std::unordered_set::begin "private";
|
||||
%javamethodmodifiers std::unordered_set::end "private";
|
||||
|
||||
%rename(Iterator) std::unordered_set::iterator;
|
||||
%nodefaultctor std::unordered_set::iterator;
|
||||
%javamethodmodifiers std::unordered_set::iterator::incrementUnchecked "private";
|
||||
%javamethodmodifiers std::unordered_set::iterator::derefUnchecked "private";
|
||||
%javamethodmodifiers std::unordered_set::iterator::isNot "private";
|
||||
|
||||
namespace std {
|
||||
|
||||
template <class Key>
|
||||
class unordered_set {
|
||||
|
||||
%typemap(javabase) std::unordered_set<Key> "java.util.AbstractSet<$typemap(jboxtype, Key)>"
|
||||
%proxycode %{
|
||||
public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) {
|
||||
this();
|
||||
addAll(collection);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) {
|
||||
boolean didAddElement = false;
|
||||
for (java.lang.Object object : collection) {
|
||||
didAddElement |= add(($typemap(jboxtype, Key))object);
|
||||
}
|
||||
|
||||
return didAddElement;
|
||||
}
|
||||
|
||||
public java.util.Iterator<$typemap(jboxtype, Key)> iterator() {
|
||||
return new java.util.Iterator<$typemap(jboxtype, Key)>() {
|
||||
private Iterator curr;
|
||||
private Iterator end;
|
||||
|
||||
private java.util.Iterator<$typemap(jboxtype, Key)> init() {
|
||||
curr = $javaclassname.this.begin();
|
||||
end = $javaclassname.this.end();
|
||||
return this;
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, Key) next() {
|
||||
if (!hasNext()) {
|
||||
throw new java.util.NoSuchElementException();
|
||||
}
|
||||
|
||||
// Save the current position, increment it,
|
||||
// then return the value at the position before the increment.
|
||||
final $typemap(jboxtype, Key) currValue = curr.derefUnchecked();
|
||||
curr.incrementUnchecked();
|
||||
return currValue;
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return curr.isNot(end);
|
||||
}
|
||||
}.init();
|
||||
}
|
||||
|
||||
public boolean containsAll(java.util.Collection<?> collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
if (!contains(object)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean contains(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, Key))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return containsImpl(($typemap(jboxtype, Key))object);
|
||||
}
|
||||
|
||||
public boolean removeAll(java.util.Collection<?> collection) {
|
||||
boolean didRemoveElement = false;
|
||||
for (java.lang.Object object : collection) {
|
||||
didRemoveElement |= remove(object);
|
||||
}
|
||||
|
||||
return didRemoveElement;
|
||||
}
|
||||
|
||||
public boolean remove(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, Key))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return removeImpl(($typemap(jboxtype, Key))object);
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
|
||||
struct iterator {
|
||||
%typemap(javaclassmodifiers) iterator "protected class"
|
||||
%extend {
|
||||
void incrementUnchecked() {
|
||||
++(*$self);
|
||||
}
|
||||
|
||||
Key derefUnchecked() const {
|
||||
return **$self;
|
||||
}
|
||||
|
||||
bool isNot(iterator other) const {
|
||||
return (*$self != other);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef Key value_type;
|
||||
typedef Key key_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
unordered_set();
|
||||
unordered_set(const unordered_set& other);
|
||||
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
iterator begin();
|
||||
iterator end();
|
||||
|
||||
%extend {
|
||||
%fragment("SWIG_UnorderedSetSize");
|
||||
|
||||
// Returns whether item was inserted.
|
||||
bool add(const Key& key) {
|
||||
return self->insert(key).second;
|
||||
}
|
||||
|
||||
// Returns whether set contains key.
|
||||
bool containsImpl(const Key& key) {
|
||||
return (self->count(key) > 0);
|
||||
}
|
||||
|
||||
// Returns whether the item was erased.
|
||||
bool removeImpl(const Key& key) {
|
||||
return (self->erase(key) > 0);
|
||||
}
|
||||
|
||||
jint sizeImpl() const throw (std::out_of_range) {
|
||||
return SWIG_UnorderedSetSize(self->size());
|
||||
}
|
||||
|
||||
bool hasNextImpl(const iterator& itr) const {
|
||||
return (itr != $self->end());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_vector.i
|
||||
*
|
||||
* SWIG typemaps for std::vector.
|
||||
* The Java proxy class extends java.util.AbstractList and implements
|
||||
* java.util.RandomAccess. The std::vector container looks and feels much like a
|
||||
* java.util.ArrayList from Java.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
|
@ -9,77 +14,172 @@
|
|||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef T value_type;
|
||||
typedef const value_type& const_reference;
|
||||
vector();
|
||||
vector(size_type n);
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
void set(int i, const value_type& val) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = val;
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
%fragment("SWIG_VectorSize", "header", fragment="SWIG_JavaIntFromSize_t") {
|
||||
SWIGINTERN jint SWIG_VectorSize(size_t size) {
|
||||
jint sz = SWIG_JavaIntFromSize_t(size);
|
||||
if (sz == -1)
|
||||
throw std::out_of_range("vector size is too large to fit into a Java int");
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CTYPE, CONST_REFERENCE)
|
||||
%typemap(javabase) std::vector< CTYPE > "java.util.AbstractList<$typemap(jboxtype, CTYPE)>"
|
||||
%typemap(javainterfaces) std::vector< CTYPE > "java.util.RandomAccess"
|
||||
%proxycode %{
|
||||
public $javaclassname($typemap(jstype, CTYPE)[] initialElements) {
|
||||
this();
|
||||
reserve(initialElements.length);
|
||||
|
||||
for ($typemap(jstype, CTYPE) element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public $javaclassname(Iterable<$typemap(jboxtype, CTYPE)> initialElements) {
|
||||
this();
|
||||
for ($typemap(jstype, CTYPE) element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, CTYPE) get(int index) {
|
||||
return doGet(index);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, CTYPE) set(int index, $typemap(jboxtype, CTYPE) e) {
|
||||
return doSet(index, e);
|
||||
}
|
||||
|
||||
public boolean add($typemap(jboxtype, CTYPE) e) {
|
||||
modCount++;
|
||||
doAdd(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void add(int index, $typemap(jboxtype, CTYPE) e) {
|
||||
modCount++;
|
||||
doAdd(index, e);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, CTYPE) remove(int index) {
|
||||
modCount++;
|
||||
return doRemove(index);
|
||||
}
|
||||
|
||||
protected void removeRange(int fromIndex, int toIndex) {
|
||||
modCount++;
|
||||
doRemoveRange(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return doSize();
|
||||
}
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef CTYPE *pointer;
|
||||
typedef CTYPE const *const_pointer;
|
||||
typedef CTYPE &reference;
|
||||
typedef CONST_REFERENCE const_reference;
|
||||
|
||||
vector();
|
||||
vector(const vector &other);
|
||||
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n) throw (std::length_error);
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
%fragment("SWIG_VectorSize");
|
||||
|
||||
vector(jint count, const CTYPE &value) throw (std::out_of_range) {
|
||||
if (count < 0)
|
||||
throw std::out_of_range("vector count must be positive");
|
||||
return new std::vector< CTYPE >(static_cast<std::vector< CTYPE >::size_type>(count), value);
|
||||
}
|
||||
|
||||
jint doSize() const throw (std::out_of_range) {
|
||||
return SWIG_VectorSize(self->size());
|
||||
}
|
||||
|
||||
void doAdd(const value_type& x) {
|
||||
self->push_back(x);
|
||||
}
|
||||
|
||||
void doAdd(jint index, const value_type& x) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (0 <= index && index <= size) {
|
||||
self->insert(self->begin() + index, x);
|
||||
} else {
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
value_type doRemove(jint index) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (0 <= index && index < size) {
|
||||
CTYPE const old_value = (*self)[index];
|
||||
self->erase(self->begin() + index);
|
||||
return old_value;
|
||||
} else {
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
CONST_REFERENCE doGet(jint index) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (index >= 0 && index < size)
|
||||
return (*self)[index];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
|
||||
value_type doSet(jint index, const value_type& val) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (index >= 0 && index < size) {
|
||||
CTYPE const old_value = (*self)[index];
|
||||
(*self)[index] = val;
|
||||
return old_value;
|
||||
}
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
|
||||
void doRemoveRange(jint fromIndex, jint toIndex) throw (std::out_of_range) {
|
||||
jint size = static_cast<jint>(self->size());
|
||||
if (0 <= fromIndex && fromIndex <= toIndex && toIndex <= size) {
|
||||
self->erase(self->begin() + fromIndex, self->begin() + toIndex);
|
||||
} else {
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
%javamethodmodifiers std::vector::doSize "private";
|
||||
%javamethodmodifiers std::vector::doAdd "private";
|
||||
%javamethodmodifiers std::vector::doGet "private";
|
||||
%javamethodmodifiers std::vector::doSet "private";
|
||||
%javamethodmodifiers std::vector::doRemove "private";
|
||||
%javamethodmodifiers std::vector::doRemoveRange "private";
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(T, const value_type&)
|
||||
};
|
||||
|
||||
// bool specialization
|
||||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef bool value_type;
|
||||
typedef bool const_reference;
|
||||
vector();
|
||||
vector(size_type n);
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
void set(int i, const value_type& val) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = val;
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(bool, bool)
|
||||
};
|
||||
}
|
||||
|
||||
%define specialize_std_vector(T)
|
||||
#warning "specialize_std_vector - specialization for type T no longer needed"
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
%typemap(jtype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
|
||||
%typemap(jstype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
|
||||
%typemap(javain) TYPE *OUTPUT, TYPE &OUTPUT "$javainput"
|
||||
%typemap(javadirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$jniinput"
|
||||
%typemap(javadirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$javacall"
|
||||
|
||||
%typemap(in) TYPE *OUTPUT($*1_ltype temp), TYPE &OUTPUT($*1_ltype temp)
|
||||
{
|
||||
|
|
@ -204,29 +206,57 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
|
||||
%typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT ""
|
||||
|
||||
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
|
||||
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
|
||||
{
|
||||
JNITYPE jvalue = (JNITYPE)temp$argnum;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
|
||||
}
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT %{
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
if (!$input) return $null;
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE *OUTPUT %{
|
||||
if ($1) {
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
if (!$input) return $null;
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE &OUTPUT
|
||||
{
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *OUTPUT
|
||||
{
|
||||
if ($result) {
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
|
||||
%typemap(typecheck) TYPE &OUTPUT = TYPECHECKTYPE;
|
||||
%enddef
|
||||
|
||||
OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray);
|
||||
OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray);
|
||||
OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
OUTPUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava/lang/BigInteger;", SWIGBIGINTEGERARRAY);
|
||||
OUTPUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray);
|
||||
OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray);
|
||||
OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray);
|
||||
OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray);
|
||||
OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray);
|
||||
OUTPUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray);
|
||||
OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(int, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(long, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[Ljava/math/BigInteger;", jobjectArray);
|
||||
OUTPUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray);
|
||||
OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||
|
||||
#undef OUTPUT_TYPEMAP
|
||||
|
||||
|
|
@ -244,6 +274,23 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleAr
|
|||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) bool &OUTPUT
|
||||
{
|
||||
jboolean $1_jvalue;
|
||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue ? true : false;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) bool *OUTPUT
|
||||
{
|
||||
if ($result) {
|
||||
jboolean $1_jvalue;
|
||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Convert to BigInteger - byte array holds number in 2's complement big endian format */
|
||||
/* Use first element in BigInteger array for output */
|
||||
/* Overrides the typemap in the OUTPUT_TYPEMAP macro */
|
||||
|
|
@ -262,6 +309,7 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleAr
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
JCALL3(SetObjectArrayElement, jenv, $input, 0, bigint);
|
||||
}
|
||||
|
||||
|
|
@ -330,6 +378,8 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
|||
%typemap(jtype) TYPE *INOUT, TYPE &INOUT "JTYPE[]"
|
||||
%typemap(jstype) TYPE *INOUT, TYPE &INOUT "JTYPE[]"
|
||||
%typemap(javain) TYPE *INOUT, TYPE &INOUT "$javainput"
|
||||
%typemap(javadirectorin) TYPE *INOUT, TYPE &INOUT "$jniinput"
|
||||
%typemap(javadirectorout) TYPE *INOUT, TYPE &INOUT "$javacall"
|
||||
|
||||
%typemap(in) TYPE *INOUT, TYPE &INOUT {
|
||||
if (!$input) {
|
||||
|
|
@ -348,24 +398,54 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
|||
%typemap(argout) TYPE *INOUT, TYPE &INOUT
|
||||
{ JCALL3(Release##JAVATYPE##ArrayElements, jenv, $input, (JNITYPE *)$1, 0); }
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
if (!$input) return $null;
|
||||
JNITYPE $1_jvalue = (JNITYPE)$1;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE *INOUT %{
|
||||
if ($1) {
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
if (!$input) return $null;
|
||||
JNITYPE $1_jvalue = (JNITYPE)*$1;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE &INOUT
|
||||
{
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *INOUT
|
||||
{
|
||||
if ($result) {
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
|
||||
%typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE;
|
||||
%enddef
|
||||
|
||||
INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray);
|
||||
INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray);
|
||||
INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
INOUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
INOUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava.math.BigInteger;", SWIGBIGINTEGERARRAY);
|
||||
INOUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray);
|
||||
INOUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray);
|
||||
INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray);
|
||||
INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray);
|
||||
INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray);
|
||||
INOUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray);
|
||||
INOUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(int, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(long, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[java/math/BigInteger;", jobjectArray);
|
||||
INOUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray);
|
||||
INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||
|
||||
#undef INOUT_TYPEMAP
|
||||
|
||||
|
|
@ -390,6 +470,22 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArr
|
|||
JCALL3(ReleaseBooleanArrayElements, jenv, $input , (jboolean *)jbtemp$argnum, 0);
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) bool &INOUT
|
||||
{
|
||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue ? true : false;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) bool *INOUT
|
||||
{
|
||||
if ($result) {
|
||||
jboolean $1_jvalue;
|
||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Override the typemap in the INOUT_TYPEMAP macro for unsigned long long */
|
||||
%typemap(in) unsigned long long *INOUT ($*1_ltype temp), unsigned long long &INOUT ($*1_ltype temp) {
|
||||
jobject bigint;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
/*
|
||||
* char *BYTE typemaps.
|
||||
* These are input typemaps for mapping a Java byte[] array to a C char array.
|
||||
* Note that as a Java array is used and thus passeed by reference, the C routine
|
||||
* Note that as a Java array is used and thus passed by reference, the C routine
|
||||
* can return data to Java via the parameter.
|
||||
*
|
||||
* Example usage wrapping:
|
||||
|
|
|
|||
|
|
@ -12,15 +12,16 @@
|
|||
#include <complex.h>
|
||||
%}
|
||||
|
||||
#define complex _Complex
|
||||
|
||||
/* C complex constructor */
|
||||
#define CCplxConst(r, i) ((r) + I*(i))
|
||||
|
||||
%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ static JSStaticFunction $jsmangledname_functions[] = {
|
|||
* jsc_nspace_declaration: template for a namespace declaration
|
||||
* - $jsnspace: mangled name of the namespace
|
||||
* - $jsglobalvariables: list of variable entries
|
||||
* - $jsglobalfunctions: list if fuction entries
|
||||
* - $jsglobalfunctions: list of function entries
|
||||
* ----------------------------------------------------------------------------- */
|
||||
%fragment ("jsc_nspace_declaration", "templates")
|
||||
%{
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ SWIG_AsVal_dec(Type)(JSValueRef o, Type *val)
|
|||
float re;
|
||||
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = Constructor(re, 0.0);
|
||||
if (val) *val = Constructor(re, 0.0f);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,64 @@
|
|||
%insert(init) %{
|
||||
SWIGRUNTIME void
|
||||
SWIG_JSC_SetModule(swig_module_info *swig_module) {}
|
||||
SWIG_JSC_SetModule(void *clientdata, swig_module_info *swig_module) {
|
||||
JSGlobalContextRef context;
|
||||
JSObjectRef globalObject;
|
||||
JSStringRef moduleName;
|
||||
JSClassDefinition classDef;
|
||||
JSClassRef classRef;
|
||||
JSObjectRef object;
|
||||
|
||||
if(clientdata == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
context = (JSGlobalContextRef)clientdata;
|
||||
|
||||
globalObject = JSContextGetGlobalObject(context);
|
||||
moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
||||
|
||||
classDef = kJSClassDefinitionEmpty;
|
||||
classRef = JSClassCreate(&classDef);
|
||||
|
||||
object = JSObjectMake(context, classRef, NULL);
|
||||
JSObjectSetPrivate(object, (void*)swig_module);
|
||||
|
||||
JSObjectSetProperty(context, globalObject, moduleName, object, kJSPropertyAttributeNone, NULL);
|
||||
|
||||
JSClassRelease(classRef);
|
||||
JSStringRelease(moduleName);
|
||||
}
|
||||
SWIGRUNTIME swig_module_info *
|
||||
SWIG_JSC_GetModule(void) {
|
||||
return 0;
|
||||
SWIG_JSC_GetModule(void *clientdata) {
|
||||
JSGlobalContextRef context;
|
||||
JSObjectRef globalObject;
|
||||
JSStringRef moduleName;
|
||||
JSValueRef value;
|
||||
JSObjectRef object;
|
||||
|
||||
if(clientdata == 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
context = (JSGlobalContextRef)clientdata;
|
||||
|
||||
globalObject = JSContextGetGlobalObject(context);
|
||||
moduleName = JSStringCreateWithUTF8CString("swig_module_info_data");
|
||||
|
||||
if(JSObjectHasProperty(context, globalObject, moduleName) == false) {
|
||||
JSStringRelease(moduleName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = JSObjectGetProperty(context, globalObject, moduleName, NULL);
|
||||
object = JSValueToObject(context, value, NULL);
|
||||
JSStringRelease(moduleName);
|
||||
|
||||
return (swig_module_info*)JSObjectGetPrivate(object);
|
||||
}
|
||||
|
||||
#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(pointer)
|
||||
#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule(clientdata)
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(clientdata, pointer)
|
||||
%}
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
|
@ -26,7 +76,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) {
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_InitializeModule((void*)context);
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ SWIGRUNTIME int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, voi
|
|||
/* special case: JavaScript null => C NULL pointer */
|
||||
if(JSValueIsNull(context, valRef)) {
|
||||
*ptr=0;
|
||||
return SWIG_OK;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
|
||||
if(!JSValueIsObject(context, valRef)) {
|
||||
|
|
@ -317,6 +317,30 @@ unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) {
|
|||
}
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
bool SWIGJSC_ValueIsArray(JSContextRef context, JSValueRef value) {
|
||||
if (JSValueIsObject(context, value)) {
|
||||
static JSStringRef ArrayString = NULL;
|
||||
static JSStringRef isArrayString = NULL;
|
||||
JSObjectRef array = NULL;
|
||||
JSObjectRef isArray = NULL;
|
||||
JSValueRef retval = NULL;
|
||||
|
||||
if (!ArrayString)
|
||||
ArrayString = JSStringCreateWithUTF8CString("Array");
|
||||
if (!isArrayString)
|
||||
isArrayString = JSStringCreateWithUTF8CString("isArray");
|
||||
|
||||
array = (JSObjectRef)JSObjectGetProperty(context, JSContextGetGlobalObject(context), ArrayString, NULL);
|
||||
isArray = (JSObjectRef)JSObjectGetProperty(context, array, isArrayString, NULL);
|
||||
retval = JSObjectCallAsFunction(context, isArray, NULL, 1, &value, NULL);
|
||||
|
||||
if (JSValueIsBoolean(context, retval))
|
||||
return JSValueToBoolean(context, retval);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueRef obj) {
|
||||
JSObjectRef arr;
|
||||
|
|
@ -324,6 +348,8 @@ JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueR
|
|||
|
||||
if (JSValueIsUndefined(context, value)) {
|
||||
arr = JSObjectMakeArray(context, 0, 0, 0);
|
||||
} else if (!SWIGJSC_ValueIsArray(context, value)) {
|
||||
arr = JSObjectMakeArray(context, 1, &value, 0);
|
||||
} else {
|
||||
arr = JSValueToObject(context, value, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@
|
|||
#include <complex>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
%naturalvar complex;
|
||||
template<typename T> class complex;
|
||||
%template() complex<double>;
|
||||
%template() complex<float>;
|
||||
}
|
||||
|
||||
/* defining the complex as/from converters */
|
||||
|
||||
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
|
||||
|
|
|
|||
|
|
@ -20,22 +20,29 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class map {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
|
||||
map();
|
||||
map(const map<K,T> &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -45,14 +52,14 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
|
|
@ -14,10 +14,17 @@ namespace std {
|
|||
template<class T> class vector {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
@ -48,10 +55,17 @@ namespace std {
|
|||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef bool const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
|
|||
|
|
@ -6,21 +6,22 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%include <javscriptcomplex.swg>
|
||||
%include <javascriptcomplex.swg>
|
||||
|
||||
%{
|
||||
#include <complex.h>
|
||||
%}
|
||||
|
||||
#define complex _Complex
|
||||
|
||||
/* C complex constructor */
|
||||
#define CCplxConst(r, i) ((r) + I*(i))
|
||||
|
||||
%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex);
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@
|
|||
%fragment("js_ctor", "templates") %{
|
||||
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Object> self = args.Holder();
|
||||
|
||||
SWIGV8_OBJECT self = args.Holder();
|
||||
$jslocals
|
||||
if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
|
||||
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
|
||||
$jscode
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
|||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
OverloadErrorHandler errorHandler;
|
||||
v8::Handle<v8::Value> self;
|
||||
SWIGV8_VALUE self;
|
||||
|
||||
// switch all cases by means of series of if-returns.
|
||||
$jsdispatchcases
|
||||
|
|
@ -77,9 +78,10 @@ fail:
|
|||
%fragment("js_overloaded_ctor", "templates") %{
|
||||
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Object> self = args.Holder();
|
||||
|
||||
SWIGV8_OBJECT self = args.Holder();
|
||||
$jslocals
|
||||
if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper.");
|
||||
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
|
||||
$jscode
|
||||
|
||||
|
|
@ -133,10 +135,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
|
|||
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
|
||||
v8::Local<v8::Object> object = data.GetValue();
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#else
|
||||
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#endif
|
||||
|
||||
if(proxy->swigCMemOwn && proxy->swigCObject) {
|
||||
|
|
@ -147,7 +152,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
|
|||
}
|
||||
delete proxy;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
object.Clear();
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
object.Dispose();
|
||||
|
|
@ -155,7 +162,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
|
|||
object.Dispose(isolate);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
object->Dispose(isolate);
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
object->Dispose();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -177,10 +184,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
|
|||
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
|
||||
v8::Local<v8::Object> object = data.GetValue();
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#else
|
||||
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#endif
|
||||
|
||||
if(proxy->swigCMemOwn && proxy->swigCObject) {
|
||||
|
|
@ -197,7 +207,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
|
|||
object->Dispose(isolate);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
object->Dispose();
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
object.Clear();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -211,10 +221,14 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("js_getter", "templates")
|
||||
%{
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
|
||||
#else
|
||||
static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
|
||||
#endif
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
$jslocals
|
||||
$jscode
|
||||
SWIGV8_RETURN_INFO(jsresult, info);
|
||||
|
|
@ -233,8 +247,11 @@ fail:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("js_setter", "templates")
|
||||
%{
|
||||
static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value,
|
||||
const SwigV8PropertyCallbackInfoVoid &info) {
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
|
||||
#else
|
||||
static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
|
||||
#endif
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
$jslocals
|
||||
|
|
@ -256,7 +273,7 @@ fail:
|
|||
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
$jslocals
|
||||
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
|
||||
|
||||
|
|
@ -281,7 +298,7 @@ fail:
|
|||
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
OverloadErrorHandler errorHandler;
|
||||
$jscode
|
||||
|
||||
|
|
@ -305,7 +322,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
|
|||
{
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
$jslocals
|
||||
$jscode
|
||||
SWIGV8_RETURN(jsresult);
|
||||
|
|
@ -359,7 +376,7 @@ fail:
|
|||
%fragment("jsv8_define_class_template", "templates")
|
||||
%{
|
||||
/* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
|
||||
v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
|
||||
SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
|
||||
SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
|
||||
$jsmangledname_clientData.dtor = $jsdtor;
|
||||
if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
|
||||
|
|
@ -405,11 +422,18 @@ fail:
|
|||
%fragment("jsv8_create_class_instance", "templates")
|
||||
%{
|
||||
/* Class: $jsname ($jsmangledname) */
|
||||
v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
|
||||
SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
|
||||
$jsmangledname_class_0->SetCallHandler($jsctor);
|
||||
$jsmangledname_class_0->Inherit($jsmangledname_class);
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
$jsmangledname_class_0->SetHiddenPrototype(true);
|
||||
v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
$jsmangledname_class_0->SetHiddenPrototype(true);
|
||||
v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
|
||||
#else
|
||||
v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -420,7 +444,12 @@ fail:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("jsv8_register_class", "templates")
|
||||
%{
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
|
||||
#else
|
||||
SWIGV8_MAYBE_CHECK($jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -429,7 +458,7 @@ fail:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("jsv8_create_namespace", "templates")
|
||||
%{
|
||||
v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
|
||||
SWIGV8_OBJECT $jsmangledname_obj = SWIGV8_OBJECT_NEW();
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -440,7 +469,11 @@ fail:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment("jsv8_register_namespace", "templates")
|
||||
%{
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
|
||||
#else
|
||||
SWIGV8_MAYBE_CHECK($jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@
|
|||
%fragment(SWIG_From_frag(Type),"header",
|
||||
fragment=SWIG_From_frag(double))
|
||||
{
|
||||
SWIGINTERNINLINE v8::Handle<v8::Value>
|
||||
SWIGINTERNINLINE SWIGV8_VALUE
|
||||
SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
|
||||
{
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(2);
|
||||
v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW();
|
||||
|
||||
vals->Set(0, SWIG_From(double)(Real(c)));
|
||||
vals->Set(1, SWIG_From(double)(Imag(c)));
|
||||
SWIGV8_ARRAY_SET(vals, 0, SWIG_From(double)(Real(c)));
|
||||
SWIGV8_ARRAY_SET(vals, 1, SWIG_From(double)(Imag(c)));
|
||||
SWIGV8_ESCAPE(vals);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,23 +32,23 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
|
|||
fragment=SWIG_AsVal_frag(double))
|
||||
{
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
|
||||
SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
|
||||
{
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
if (o->IsArray()) {
|
||||
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
|
||||
SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
|
||||
|
||||
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
|
||||
double re, im;
|
||||
int res;
|
||||
|
||||
res = SWIG_AsVal(double)(array->Get(0), &re);
|
||||
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
|
||||
if(!SWIG_IsOK(res)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
res = SWIG_AsVal(double)(array->Get(1), &im);
|
||||
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
|
||||
if(!SWIG_IsOK(res)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
|
@ -74,23 +74,23 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
|
|||
%fragment(SWIG_AsVal_frag(Type),"header",
|
||||
fragment=SWIG_AsVal_frag(float)) {
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
|
||||
SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
|
||||
{
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
if (o->IsArray()) {
|
||||
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
|
||||
SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
|
||||
|
||||
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
|
||||
double re, im;
|
||||
int res;
|
||||
|
||||
res = SWIG_AsVal(double)(array->Get(0), &re);
|
||||
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
|
||||
if(!SWIG_IsOK(res)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
res = SWIG_AsVal(double)(array->Get(1), &im);
|
||||
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
|
||||
if(!SWIG_IsOK(res)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,29 +6,34 @@ typedef v8::InvocationCallback SwigV8FunctionCallback;
|
|||
typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
|
||||
typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
typedef v8::FunctionCallback SwigV8FunctionCallback;
|
||||
typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
|
||||
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
|
||||
#else
|
||||
typedef v8::FunctionCallback SwigV8FunctionCallback;
|
||||
typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
|
||||
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a class template for a class with specified initialization function.
|
||||
*/
|
||||
SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
|
||||
SWIGRUNTIME SWIGV8_FUNCTION_TEMPLATE SWIGV8_CreateClassTemplate(const char* symbol) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
|
||||
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
|
||||
SWIGV8_OBJECT_TEMPLATE inst_templ = class_templ->InstanceTemplate();
|
||||
inst_templ->SetInternalFieldCount(1);
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
|
||||
SWIGV8_OBJECT_TEMPLATE equals_templ = class_templ->PrototypeTemplate();
|
||||
equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
|
||||
SWIGV8_OBJECT_TEMPLATE cptr_templ = class_templ->PrototypeTemplate();
|
||||
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
|
||||
|
||||
SWIGV8_ESCAPE(class_templ);
|
||||
|
|
@ -37,46 +42,68 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
|
|||
/**
|
||||
* Registers a class method with given name for a given class template.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
|
||||
SWIGRUNTIME void SWIGV8_AddMemberFunction(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol,
|
||||
SwigV8FunctionCallback _func) {
|
||||
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
|
||||
SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->PrototypeTemplate();
|
||||
proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class property with given name for a given class template.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
|
||||
SWIGRUNTIME void SWIGV8_AddMemberVariable(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol,
|
||||
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
|
||||
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
|
||||
SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->InstanceTemplate();
|
||||
proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class method with given name for a given object.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
|
||||
SWIGRUNTIME void SWIGV8_AddStaticFunction(SWIGV8_OBJECT obj, const char* symbol,
|
||||
const SwigV8FunctionCallback& _func) {
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) || (SWIG_V8_VERSION < 0x0704)
|
||||
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
|
||||
#else
|
||||
SWIGV8_MAYBE_CHECK(obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class method with given name for a given object.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
|
||||
SWIGRUNTIME void SWIGV8_AddStaticVariable(SWIGV8_OBJECT obj, const char* symbol,
|
||||
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
|
||||
#else
|
||||
SWIGV8_MAYBE_CHECK(obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter));
|
||||
#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
|
||||
const SwigV8PropertyCallbackInfoVoid& info)
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
|
||||
#else
|
||||
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
|
||||
#endif
|
||||
{
|
||||
char buffer[256];
|
||||
char msg[512];
|
||||
int res;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
property->WriteUtf8(buffer, 256);
|
||||
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
|
||||
#else
|
||||
v8::Local<v8::String> sproperty;
|
||||
if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
|
||||
SWIGV8_WRITE_UTF8(sproperty, buffer, 256);
|
||||
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
|
||||
}
|
||||
else {
|
||||
res = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(res<0) {
|
||||
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
|
||||
|
|
|
|||
|
|
@ -1,21 +1,35 @@
|
|||
%insert(init) %{
|
||||
|
||||
%insert(header) %{
|
||||
#include <assert.h>
|
||||
%}
|
||||
|
||||
%insert(init) %{
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
|
||||
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
|
||||
v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module);
|
||||
assert(!mod.IsEmpty());
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
|
||||
global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod);
|
||||
#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME swig_module_info *
|
||||
SWIG_V8_GetModule(void *) {
|
||||
v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
|
||||
v8::Local<v8::Value> moduleinfo;
|
||||
if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (moduleinfo.IsEmpty())
|
||||
if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined())
|
||||
{
|
||||
// It's not yet loaded
|
||||
return 0;
|
||||
|
|
@ -23,7 +37,7 @@ SWIG_V8_GetModule(void *) {
|
|||
|
||||
v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo);
|
||||
|
||||
if (moduleinfo_extern.IsEmpty())
|
||||
if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined())
|
||||
{
|
||||
// Something's not right
|
||||
return 0;
|
||||
|
|
@ -54,16 +68,16 @@ SWIG_V8_GetModule(void *) {
|
|||
// TODO: is it ok to do that?
|
||||
extern "C"
|
||||
#if (NODE_MODULE_VERSION < 0x000C)
|
||||
void SWIGV8_INIT (v8::Handle<v8::Object> exports)
|
||||
void SWIGV8_INIT (SWIGV8_OBJECT exports)
|
||||
#else
|
||||
void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
|
||||
void SWIGV8_INIT (SWIGV8_OBJECT exports, SWIGV8_OBJECT /*module*/)
|
||||
#endif
|
||||
{
|
||||
SWIG_InitializeModule(static_cast<void *>(&exports));
|
||||
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Object> exports_obj = exports;
|
||||
SWIGV8_OBJECT exports_obj = exports;
|
||||
%}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
%fragment(SWIG_From_frag(bool),"header") {
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value>
|
||||
SWIGV8_VALUE
|
||||
SWIG_From_dec(bool)(bool value)
|
||||
{
|
||||
return SWIGV8_BOOLEAN_NEW(value);
|
||||
|
|
@ -16,13 +16,13 @@ SWIG_From_dec(bool)(bool value)
|
|||
%fragment(SWIG_AsVal_frag(bool),"header",
|
||||
fragment=SWIG_AsVal_frag(long)) {
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
|
||||
int SWIG_AsVal_dec(bool)(SWIGV8_VALUE obj, bool *val)
|
||||
{
|
||||
if(!obj->IsBoolean()) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (val) *val = obj->BooleanValue();
|
||||
if (val) *val = SWIGV8_BOOLEAN_VALUE(obj);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
|
|||
|
||||
%fragment(SWIG_From_frag(int),"header") {
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
|
||||
SWIGV8_VALUE SWIG_From_dec(int)(int value)
|
||||
{
|
||||
return SWIGV8_INT32_NEW(value);
|
||||
}
|
||||
|
|
@ -39,12 +39,12 @@ v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
|
|||
|
||||
%fragment(SWIG_AsVal_frag(int),"header") {
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
|
||||
int SWIG_AsVal_dec(int)(SWIGV8_VALUE valRef, int* val)
|
||||
{
|
||||
if (!valRef->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if(val) *val = valRef->IntegerValue();
|
||||
if(val) *val = SWIGV8_INTEGER_VALUE(valRef);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
|
|||
|
||||
%fragment(SWIG_From_frag(long),"header") {
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
|
||||
SWIGV8_VALUE SWIG_From_dec(long)(long value)
|
||||
{
|
||||
return SWIGV8_NUMBER_NEW(value);
|
||||
}
|
||||
|
|
@ -63,12 +63,12 @@ v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
|
|||
%fragment(SWIG_AsVal_frag(long),"header",
|
||||
fragment="SWIG_CanCastAsInteger") {
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
|
||||
int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val)
|
||||
{
|
||||
if (!obj->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if(val) *val = (long) obj->IntegerValue();
|
||||
if(val) *val = (long) SWIGV8_INTEGER_VALUE(obj);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -79,23 +79,22 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
|
|||
%fragment(SWIG_From_frag(unsigned long),"header",
|
||||
fragment=SWIG_From_frag(long)) {
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
|
||||
SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value)
|
||||
{
|
||||
return (value > LONG_MAX) ?
|
||||
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
|
||||
return SWIGV8_INTEGER_NEW_UNS(value);
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_AsVal_frag(unsigned long),"header",
|
||||
fragment="SWIG_CanCastAsInteger") {
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
|
||||
int SWIG_AsVal_dec(unsigned long)(SWIGV8_VALUE obj, unsigned long *val)
|
||||
{
|
||||
if(!obj->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long longVal = (long) obj->NumberValue();
|
||||
long longVal = (long) SWIGV8_NUMBER_VALUE(obj);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
|
@ -115,7 +114,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
|
|||
fragment="SWIG_LongLongAvailable") {
|
||||
%#ifdef SWIG_LONG_LONG_AVAILABLE
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
|
||||
SWIGV8_VALUE SWIG_From_dec(long long)(long long value)
|
||||
{
|
||||
return SWIGV8_NUMBER_NEW(value);
|
||||
}
|
||||
|
|
@ -128,12 +127,12 @@ v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
|
|||
fragment="SWIG_LongLongAvailable") {
|
||||
%#ifdef SWIG_LONG_LONG_AVAILABLE
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
|
||||
int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val)
|
||||
{
|
||||
if (!obj->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if(val) *val = (long long) obj->IntegerValue();
|
||||
if(val) *val = (long long) SWIGV8_INTEGER_VALUE(obj);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -148,10 +147,9 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
|
|||
fragment="SWIG_LongLongAvailable") {
|
||||
%#ifdef SWIG_LONG_LONG_AVAILABLE
|
||||
SWIGINTERNINLINE
|
||||
v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
|
||||
SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value)
|
||||
{
|
||||
return (value > LONG_MAX) ?
|
||||
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
|
||||
return SWIGV8_INTEGER_NEW_UNS(value);
|
||||
}
|
||||
%#endif
|
||||
}
|
||||
|
|
@ -162,13 +160,13 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value
|
|||
fragment="SWIG_LongLongAvailable") {
|
||||
%#ifdef SWIG_LONG_LONG_AVAILABLE
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val)
|
||||
int SWIG_AsVal_dec(unsigned long long)(SWIGV8_VALUE obj, unsigned long long *val)
|
||||
{
|
||||
if(!obj->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long long longVal = (long long) obj->NumberValue();
|
||||
long long longVal = (long long) SWIGV8_NUMBER_VALUE(obj);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
|
@ -185,7 +183,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
|
|||
|
||||
%fragment(SWIG_From_frag(double),"header") {
|
||||
SWIGINTERN
|
||||
v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
|
||||
SWIGV8_VALUE SWIG_From_dec(double) (double val)
|
||||
{
|
||||
return SWIGV8_NUMBER_NEW(val);
|
||||
}
|
||||
|
|
@ -193,14 +191,13 @@ v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
|
|||
|
||||
%fragment(SWIG_AsVal_frag(double),"header") {
|
||||
SWIGINTERN
|
||||
int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
|
||||
int SWIG_AsVal_dec(double)(SWIGV8_VALUE obj, double *val)
|
||||
{
|
||||
if(!obj->IsNumber()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if(val) *val = obj->NumberValue();
|
||||
if(val) *val = SWIGV8_NUMBER_VALUE(obj);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/* ---------------------------------------------------------------------------
|
||||
* These typedefs and defines are used to deal with v8 API changes
|
||||
*
|
||||
* Useful table of versions: https://nodejs.org/en/download/releases/
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
// First v8 version that uses "SetWeak" and not "MakeWeak"
|
||||
|
|
@ -9,8 +10,10 @@
|
|||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
|
||||
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
|
||||
#else
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
|
||||
#else
|
||||
#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked()
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
|
|
@ -47,12 +50,24 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::New(str)
|
||||
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
|
||||
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
|
||||
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::String::kNormalString)
|
||||
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::String::kNormalString)
|
||||
#else
|
||||
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
|
||||
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
|
||||
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
|
||||
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
|
||||
#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::NewStringType::kNormal)).ToLocalChecked()
|
||||
#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::NewStringType::kNormal)).ToLocalChecked()
|
||||
#endif
|
||||
|
||||
#if (SWIG_V8_VERSION < 0x0704)
|
||||
#define SWIGV8_MAYBE_CHECK(maybe) maybe.FromJust()
|
||||
#else
|
||||
#define SWIGV8_MAYBE_CHECK(maybe) maybe.Check()
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
|
||||
|
|
@ -67,7 +82,14 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num)
|
||||
#define SWIGV8_OBJECT_NEW() v8::Object::New()
|
||||
#define SWIGV8_UNDEFINED() v8::Undefined()
|
||||
#define SWIGV8_ARRAY v8::Handle<v8::Array>
|
||||
#define SWIGV8_FUNCTION_TEMPLATE v8::Handle<v8::FunctionTemplate>
|
||||
#define SWIGV8_OBJECT v8::Handle<v8::Object>
|
||||
#define SWIGV8_OBJECT_TEMPLATE v8::Handle<v8::ObjectTemplate>
|
||||
#define SWIGV8_VALUE v8::Handle<v8::Value>
|
||||
#define SWIGV8_NULL() v8::Null()
|
||||
#define SWIGV8_ARRAY_GET(array, index) (array)->Get(index)
|
||||
#define SWIGV8_ARRAY_SET(array, index, value) (array)->Set(index, value)
|
||||
#else
|
||||
#define SWIGV8_ARRAY_NEW(size) v8::Array::New(v8::Isolate::GetCurrent(), size)
|
||||
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
|
||||
|
|
@ -80,7 +102,14 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num)
|
||||
#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_ARRAY v8::Local<v8::Array>
|
||||
#define SWIGV8_FUNCTION_TEMPLATE v8::Local<v8::FunctionTemplate>
|
||||
#define SWIGV8_OBJECT v8::Local<v8::Object>
|
||||
#define SWIGV8_OBJECT_TEMPLATE v8::Local<v8::ObjectTemplate>
|
||||
#define SWIGV8_VALUE v8::Local<v8::Value>
|
||||
#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_ARRAY_GET(array, index) (array)->Get(SWIGV8_CURRENT_CONTEXT(), index).ToLocalChecked()
|
||||
#define SWIGV8_ARRAY_SET(array, index, value) SWIGV8_MAYBE_CHECK((array)->Set(SWIGV8_CURRENT_CONTEXT(), index, value))
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
|
|
@ -91,6 +120,40 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
|||
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
|
||||
#endif
|
||||
|
||||
#ifdef NODE_VERSION
|
||||
#if NODE_VERSION_AT_LEAST(10, 12, 0)
|
||||
#define SWIG_NODE_AT_LEAST_1012
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Necessary to check Node.js version because V8 API changes are backported in Node.js
|
||||
#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \
|
||||
(!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7)
|
||||
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
|
||||
#define SWIGV8_TO_STRING(handle) (handle)->ToString()
|
||||
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
|
||||
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue()
|
||||
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
|
||||
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
|
||||
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
|
||||
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
|
||||
#else
|
||||
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
|
||||
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Error handling
|
||||
*
|
||||
|
|
@ -109,11 +172,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) {
|
|||
Note: There are two contexts for handling errors.
|
||||
A static V8ErrorHandler is used in not overloaded methods.
|
||||
For overloaded methods the throwing type checking mechanism is used
|
||||
during dispatching. As V8 exceptions can not be resetted properly
|
||||
during dispatching. As V8 exceptions can not be reset properly
|
||||
the trick is to use a dynamic ErrorHandler with same local name as the global
|
||||
one.
|
||||
|
||||
- See defintion of SWIG_Error above.
|
||||
- See definition of SWIG_Error above.
|
||||
- See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload',
|
||||
and 'JS_function_dispatch_case' in javascriptcode.swg
|
||||
|
||||
|
|
@ -137,7 +200,7 @@ public:
|
|||
SWIGV8_THROW_EXCEPTION(err);
|
||||
}
|
||||
}
|
||||
v8::Handle<v8::Value> err;
|
||||
SWIGV8_VALUE err;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
|
|
@ -193,14 +256,16 @@ public:
|
|||
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
|
||||
#else
|
||||
void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
|
||||
#endif
|
||||
};
|
||||
|
||||
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
|
||||
|
|
@ -241,19 +306,22 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val
|
|||
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#else
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#endif
|
||||
|
||||
delete proxy;
|
||||
}
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
|
||||
SWIGRUNTIME int SWIG_V8_GetInstancePtr(SWIGV8_VALUE valRef, void **ptr) {
|
||||
if(!valRef->IsObject()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
v8::Handle<v8::Object> objRef = valRef->ToObject();
|
||||
SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
|
||||
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
|
||||
|
||||
|
|
@ -273,7 +341,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGRUNTIME void SWIGV8_SetPrivateData(SWIGV8_OBJECT obj, void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
|
||||
cdata->swigCObject = ptr;
|
||||
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
|
||||
|
|
@ -312,43 +380,50 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
|
|||
} else {
|
||||
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
|
||||
} else {
|
||||
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#else
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
|
||||
} else {
|
||||
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle.MarkIndependent();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
cdata->handle.MarkIndependent();
|
||||
// Looks like future versions do not require that anymore:
|
||||
// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGRUNTIME int SWIG_V8_ConvertPtr(SWIGV8_VALUE valRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
/* special case: JavaScript null => C NULL pointer */
|
||||
if(valRef->IsNull()) {
|
||||
*ptr=0;
|
||||
return SWIG_OK;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
if(!valRef->IsObject()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
v8::Handle<v8::Object> objRef = valRef->ToObject();
|
||||
SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
|
||||
}
|
||||
|
||||
SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGRUNTIME SWIGV8_VALUE SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
v8::Handle<v8::FunctionTemplate> class_templ;
|
||||
SWIGV8_FUNCTION_TEMPLATE class_templ;
|
||||
|
||||
if (ptr == NULL) {
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
|
|
@ -375,8 +450,12 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
|
|||
}
|
||||
#endif
|
||||
|
||||
// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) || (SWIG_V8_VERSION < 0x0704)
|
||||
v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
|
||||
#else
|
||||
v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
|
||||
#endif
|
||||
|
||||
SWIGV8_SetPrivateData(result, ptr, info, flags);
|
||||
|
||||
SWIGV8_ESCAPE(result);
|
||||
|
|
@ -396,7 +475,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
|
|||
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
void *arg1 = (void *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
bool result;
|
||||
|
|
@ -426,7 +505,7 @@ fail:
|
|||
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
SWIGV8_VALUE jsresult;
|
||||
void *arg1 = (void *) 0 ;
|
||||
long result;
|
||||
int res1;
|
||||
|
|
@ -465,23 +544,30 @@ public:
|
|||
};
|
||||
|
||||
SWIGRUNTIMEINLINE
|
||||
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
|
||||
int SwigV8Packed_Check(SWIGV8_VALUE valRef) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Object> objRef = valRef->ToObject();
|
||||
SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
if(objRef->InternalFieldCount() < 1) return false;
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
return (flag->IsBoolean() && flag->BooleanValue());
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
v8::Local<v8::Value> flag;
|
||||
if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
|
||||
return false;
|
||||
#endif
|
||||
return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag));
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
|
||||
swig_type_info *SwigV8Packed_UnpackData(SWIGV8_VALUE valRef, void *ptr, size_t size) {
|
||||
if (SwigV8Packed_Check(valRef)) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
SwigV8PackedData *sobj;
|
||||
|
||||
v8::Handle<v8::Object> objRef = valRef->ToObject();
|
||||
SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
|
||||
|
|
@ -498,7 +584,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
|
|||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
int SWIGV8_ConvertPacked(SWIGV8_VALUE valRef, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
|
||||
if (!to) return SWIG_ERROR;
|
||||
if (ty) {
|
||||
|
|
@ -519,10 +605,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist
|
|||
SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
|
||||
v8::Local<v8::Object> object = data.GetValue();
|
||||
SwigV8PackedData *cdata = data.GetParameter();
|
||||
#else
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
|
||||
SwigV8PackedData *cdata = data.GetParameter();
|
||||
#endif
|
||||
|
||||
delete cdata;
|
||||
|
|
@ -537,20 +626,25 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob
|
|||
object->Dispose(isolate);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
object->Dispose();
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
object.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
|
||||
SWIGV8_VALUE SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
|
||||
// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
|
||||
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
obj->SetPointerInInternalField(0, cdata);
|
||||
|
|
@ -573,20 +667,25 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
|
|||
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
|
||||
#else
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
|
||||
// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
|
||||
#else
|
||||
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle.MarkIndependent();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
#elif (SWIG_V8_VERSION < 0x0704)
|
||||
cdata->handle.MarkIndependent();
|
||||
// Looks like future versions do not require that anymore:
|
||||
// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
|
||||
#endif
|
||||
|
||||
SWIGV8_ESCAPE(obj);
|
||||
|
||||
}
|
||||
|
||||
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty)
|
||||
|
|
@ -600,22 +699,18 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
|
|||
|
||||
SWIGRUNTIME
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
|
||||
#else
|
||||
v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
|
||||
#endif
|
||||
SWIGV8_VALUE SWIGV8_AppendOutput(SWIGV8_VALUE result, SWIGV8_VALUE obj) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
if (result->IsUndefined()) {
|
||||
result = SWIGV8_ARRAY_NEW(0);
|
||||
} else if (!result->IsArray()) {
|
||||
SWIGV8_ARRAY tmparr = SWIGV8_ARRAY_NEW(0);
|
||||
SWIGV8_ARRAY_SET(tmparr, 0, result);
|
||||
result = tmparr;
|
||||
}
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);
|
||||
#else
|
||||
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
|
||||
#endif
|
||||
arr->Set(arr->Length(), obj);
|
||||
|
||||
SWIGV8_ARRAY arr = SWIGV8_ARRAY::Cast(result);
|
||||
SWIGV8_ARRAY_SET(arr, arr->Length(), obj);
|
||||
SWIGV8_ESCAPE(arr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@
|
|||
#ifdef BUILDING_NODE_EXTENSION
|
||||
%insert("runtime") %{
|
||||
#include <node.h>
|
||||
//Older version of node.h does not include this
|
||||
#include <node_version.h>
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
|
@ -54,6 +56,11 @@
|
|||
%insert(runtime) %{
|
||||
#include <v8.h>
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && defined(V8_MINOR_VERSION)
|
||||
#undef SWIG_V8_VERSION
|
||||
#define SWIG_V8_VERSION (V8_MAJOR_VERSION * 256 + V8_MINOR_VERSION)
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -4,14 +4,18 @@
|
|||
* ------------------------------------------------------------ */
|
||||
%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
|
||||
SWIG_AsCharPtrAndSize(SWIGV8_VALUE valRef, char** cptr, size_t* psize, int *alloc)
|
||||
{
|
||||
if(valRef->IsString()) {
|
||||
v8::Handle<v8::String> js_str = valRef->ToString();
|
||||
%#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
|
||||
%#else
|
||||
v8::Local<v8::String> js_str = SWIGV8_TO_STRING(valRef);
|
||||
%#endif
|
||||
|
||||
size_t len = js_str->Utf8Length() + 1;
|
||||
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
|
||||
char* cstr = new char[len];
|
||||
js_str->WriteUtf8(cstr, len);
|
||||
SWIGV8_WRITE_UTF8(js_str, cstr, len);
|
||||
|
||||
if(alloc) *alloc = SWIG_NEWOBJ;
|
||||
if(psize) *psize = len;
|
||||
|
|
@ -20,7 +24,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
|
|||
return SWIG_OK;
|
||||
} else {
|
||||
if(valRef->IsObject()) {
|
||||
v8::Handle<v8::Object> obj = valRef->ToObject();
|
||||
SWIGV8_OBJECT obj = SWIGV8_TO_OBJECT(valRef);
|
||||
// try if the object is a wrapped char[]
|
||||
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
||||
if (pchar_descriptor) {
|
||||
|
|
@ -41,7 +45,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
|
|||
}
|
||||
|
||||
%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
|
||||
SWIGINTERNINLINE v8::Handle<v8::Value>
|
||||
SWIGINTERNINLINE SWIGV8_VALUE
|
||||
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
||||
{
|
||||
if (carray) {
|
||||
|
|
@ -49,7 +53,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
|||
// TODO: handle extra long strings
|
||||
return SWIGV8_UNDEFINED();
|
||||
} else {
|
||||
%#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
|
||||
%#else
|
||||
v8::Local<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
|
||||
%#endif
|
||||
return js_str;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
/* Javascript types */
|
||||
|
||||
#define SWIG_Object v8::Handle<v8::Value>
|
||||
#define SWIG_Object SWIGV8_VALUE
|
||||
#define VOID_Object SWIGV8_UNDEFINED()
|
||||
|
||||
/* Overload of the output/constant/exception/dirout handling */
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@
|
|||
#include <complex>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
%naturalvar complex;
|
||||
template<typename T> class complex;
|
||||
%template() complex<double>;
|
||||
%template() complex<float>;
|
||||
}
|
||||
|
||||
/* defining the complex as/from converters */
|
||||
|
||||
%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
|
||||
|
|
|
|||
|
|
@ -20,22 +20,28 @@
|
|||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T> class map {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map<K,T> &);
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
|
|
@ -45,14 +51,14 @@ namespace std {
|
|||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator i = self->find(key);
|
||||
std::map< K, T, C >::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);
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@
|
|||
namespace std {
|
||||
|
||||
template<class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& p);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &p);
|
||||
template <class U1, class U2> pair(const pair<U1, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
|
|
|
|||
|
|
@ -14,10 +14,17 @@ namespace std {
|
|||
template<class T> class vector {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
@ -48,10 +55,17 @@ namespace std {
|
|||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef bool const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ you would use a real value instead.
|
|||
int *INPUT
|
||||
short *INPUT
|
||||
long *INPUT
|
||||
long long *INPUT
|
||||
long long *INPUT
|
||||
unsigned int *INPUT
|
||||
unsigned short *INPUT
|
||||
unsigned long *INPUT
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
%typemap(consttab) char *, const char *, char [], const char []
|
||||
{SWIG_LUA_CONSTTAB_STRING("$symname", $value)}
|
||||
|
||||
// note: char is treated as a seperate special type
|
||||
// note: char is treated as a separate special type
|
||||
// signed char & unsigned char are numbers
|
||||
%typemap(consttab) char
|
||||
{SWIG_LUA_CONSTTAB_CHAR("$symname", $value)}
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ typedef struct swig_elua_entry {
|
|||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/* Push the string STR on the Lua stack, like lua_pushstring, but
|
||||
prefixed with the the location of the innermost Lua call-point
|
||||
(as formated by luaL_where). */
|
||||
prefixed with the location of the innermost Lua call-point
|
||||
(as formatted by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pusherrstring (lua_State *L, const char *str)
|
||||
{
|
||||
|
|
@ -191,8 +191,8 @@ SWIG_Lua_pusherrstring (lua_State *L, const char *str)
|
|||
}
|
||||
|
||||
/* Push a formatted string generated from FMT and following args on
|
||||
the Lua stack, like lua_pushfstring, but prefixed with the the
|
||||
location of the innermost Lua call-point (as formated by luaL_where). */
|
||||
the Lua stack, like lua_pushfstring, but prefixed with the
|
||||
location of the innermost Lua call-point (as formatted by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
|
||||
{
|
||||
|
|
@ -289,7 +289,7 @@ to tell the two structures apart within SWIG, other than by looking at the type
|
|||
typedef struct {
|
||||
swig_type_info *type;
|
||||
int own; /* 1 if owned & must be destroyed */
|
||||
char data[1]; /* arbitary amount of data */
|
||||
char data[1]; /* arbitrary amount of data */
|
||||
} swig_lua_rawdata;
|
||||
|
||||
/* Common SWIG API */
|
||||
|
|
@ -341,7 +341,7 @@ typedef struct {
|
|||
#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* Special helper for member function pointers
|
||||
/* Special helper for member function pointers
|
||||
it gets the address, casts it, then dereferences it */
|
||||
/*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */
|
||||
#endif
|
||||
|
|
@ -444,7 +444,7 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
|
|||
lua_pop(L,1); /*remove nil */
|
||||
lua_newtable(L);
|
||||
SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
|
||||
}
|
||||
}
|
||||
if(is_metatable) {
|
||||
assert(lua_istable(L,-1));
|
||||
lua_pushvalue(L,-1);
|
||||
|
|
@ -453,11 +453,11 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
|
|||
|
||||
break;
|
||||
case LUA_TUSERDATA:
|
||||
if(entry->value.value.userdata.member)
|
||||
if(entry->value.value.userdata.member)
|
||||
SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
|
||||
entry->value.value.userdata.lvalue,
|
||||
*(entry->value.value.userdata.ptype));
|
||||
else
|
||||
else
|
||||
SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
|
||||
*(entry->value.value.userdata.ptype),0);
|
||||
break;
|
||||
|
|
@ -502,7 +502,7 @@ SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
|
|||
}
|
||||
assert(lua_gettop(L) == 2);
|
||||
return 1;
|
||||
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return 0;
|
||||
|
|
@ -520,7 +520,7 @@ SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
|
|||
lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
|
||||
lua_rawset(L,-3);
|
||||
lua_pop(L,2);
|
||||
|
||||
|
||||
}
|
||||
/* END OF REMOVE */
|
||||
|
||||
|
|
@ -1039,17 +1039,11 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
|
|||
{
|
||||
/* there should be 1 param passed in
|
||||
(1) userdata (not the metatable) */
|
||||
const char *className;
|
||||
void* userData;
|
||||
swig_lua_userdata* userData;
|
||||
assert(lua_isuserdata(L,1)); /* just in case */
|
||||
userData = lua_touserdata(L,1); /* get the userdata address for later */
|
||||
lua_getmetatable(L,1); /* get the meta table */
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */
|
||||
|
||||
lua_getfield(L, -1, ".type");
|
||||
className = lua_tostring(L, -1);
|
||||
|
||||
lua_pushfstring(L, "<%s userdata: %p>", className, userData);
|
||||
lua_pushfstring(L, "<userdata of type '%s' at %p>", userData->type->str, userData->ptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1061,7 +1055,7 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
|
|||
swig_lua_userdata *usr;
|
||||
assert(lua_isuserdata(L,-1)); /* just in case */
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
|
||||
|
||||
|
||||
usr->own = 0; /* clear our ownership */
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1170,7 +1164,7 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
|
|||
Each class structure has a list of pointers to the base class structures.
|
||||
This function fills them.
|
||||
It cannot be done at compile time, as this will not work with hireachies
|
||||
spread over more than one swig file.
|
||||
spread over more than one swig file.
|
||||
Therefore it must be done at runtime, querying the SWIG type system.
|
||||
*/
|
||||
SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
|
||||
|
|
@ -1404,11 +1398,11 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
|
|||
|
||||
lua_checkstack(L,5);
|
||||
numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
|
||||
|
||||
|
||||
/* Get upvalues from closure */
|
||||
lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
|
||||
metamethod_name_idx = lua_gettop(L);
|
||||
|
||||
|
||||
lua_pushvalue(L, lua_upvalueindex(2));
|
||||
clss = (const swig_lua_class*)(lua_touserdata(L,-1));
|
||||
lua_pop(L,1); /* remove lightuserdata with clss from stack */
|
||||
|
|
@ -1440,7 +1434,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
|
||||
/* metamethod name - on the top of the stack */
|
||||
assert(lua_isstring(L,-1));
|
||||
|
||||
|
||||
key_index = lua_gettop(L);
|
||||
|
||||
/* Check whether method is already defined in metatable */
|
||||
|
|
@ -1450,7 +1444,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
lua_pop(L,1);
|
||||
return -1;
|
||||
}
|
||||
lua_pop(L,1);
|
||||
lua_pop(L,1);
|
||||
|
||||
/* Iterating over immediate bases */
|
||||
for(i=0;clss->bases[i];i++)
|
||||
|
|
@ -1460,13 +1454,13 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
lua_pushvalue(L, key_index);
|
||||
lua_rawget(L, -2);
|
||||
if( !lua_isnil(L,-1) ) {
|
||||
lua_pushvalue(L, key_index);
|
||||
lua_pushvalue(L, key_index);
|
||||
|
||||
/* Add proxy function */
|
||||
lua_pushvalue(L, key_index); /* first closure value is function name */
|
||||
lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
|
||||
lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
|
||||
|
||||
|
||||
lua_rawset(L, metatable_index);
|
||||
success = 1;
|
||||
}
|
||||
|
|
@ -1477,7 +1471,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
break;
|
||||
}
|
||||
|
||||
return success;
|
||||
return success;
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
|
||||
|
|
@ -1765,7 +1759,17 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
|
|||
{
|
||||
swig_lua_userdata *usr;
|
||||
swig_cast_info *cast;
|
||||
if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
|
||||
/* special case: lua nil => NULL pointer */
|
||||
if (lua_isnil(L,index))
|
||||
{
|
||||
*ptr=0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
if (lua_islightuserdata(L,index))
|
||||
{
|
||||
*ptr=lua_touserdata(L,index);
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
|
||||
if (usr)
|
||||
{
|
||||
|
|
@ -1811,7 +1815,7 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_t
|
|||
memcpy(raw->data,ptr,size); /* copy the data */
|
||||
SWIG_Lua_AddMetatable(L,type); /* add metatable */
|
||||
}
|
||||
|
||||
|
||||
/* converts a packed userdata. user for member fn pointers only */
|
||||
SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
|
||||
{
|
||||
|
|
@ -1860,7 +1864,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
|
|||
switch(constants[i].type) {
|
||||
case SWIG_LUA_INT:
|
||||
lua_pushstring(L,constants[i].name);
|
||||
lua_pushinteger(L,(lua_Number)constants[i].lvalue);
|
||||
lua_pushinteger(L,(lua_Integer)constants[i].lvalue);
|
||||
lua_rawset(L,-3);
|
||||
break;
|
||||
case SWIG_LUA_FLOAT:
|
||||
|
|
@ -1871,7 +1875,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
|
|||
case SWIG_LUA_CHAR:
|
||||
lua_pushstring(L,constants[i].name);
|
||||
{
|
||||
char c = constants[i].lvalue;
|
||||
char c = (char)constants[i].lvalue;
|
||||
lua_pushlstring(L,&c,1);
|
||||
}
|
||||
lua_rawset(L,-3);
|
||||
|
|
@ -1910,7 +1914,7 @@ Unfortunately lua keeps changing its APIs, so we need a conditional compile
|
|||
In lua 5.0.X it's lua_dostring()
|
||||
In lua 5.1.X it's luaL_dostring()
|
||||
*/
|
||||
SWIGINTERN int
|
||||
SWIGINTERN int
|
||||
SWIG_Lua_dostring(lua_State *L, const char *str) {
|
||||
int ok,top;
|
||||
if (str==0 || str[0]==0) return 0; /* nothing to do */
|
||||
|
|
@ -1925,7 +1929,7 @@ SWIG_Lua_dostring(lua_State *L, const char *str) {
|
|||
}
|
||||
lua_settop(L,top); /* restore the stack */
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue