Merge branch 'master' into js-v8-52-tests
This commit is contained in:
commit
6c78195d75
459 changed files with 13117 additions and 4710 deletions
|
|
@ -505,6 +505,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 %{
|
||||
|
|
@ -233,6 +309,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
@ -855,6 +855,14 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$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 *"
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -192,9 +192,9 @@
|
|||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
void setitem(int index, const_reference val) throw (std::out_of_range) {
|
||||
void setitem(int index, const_reference value) throw (std::out_of_range) {
|
||||
if (index>=0 && index<(int)$self->size())
|
||||
(*$self)[index] = val;
|
||||
(*$self)[index] = value;
|
||||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
|
|
|
|||
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
|
||||
|
|
@ -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!
|
||||
|
|
@ -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:
|
||||
|
|
@ -239,11 +239,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 +251,7 @@
|
|||
if (iter != $self->end()) {
|
||||
$self->erase(iter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -285,12 +285,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)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
* 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:
|
||||
*
|
||||
|
|
@ -33,14 +33,14 @@
|
|||
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) {
|
||||
this.Add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFixedSize {
|
||||
get {
|
||||
|
|
@ -114,6 +114,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);
|
||||
}
|
||||
|
|
@ -231,9 +237,9 @@
|
|||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
void setitem(int index, CTYPE const& val) throw (std::out_of_range) {
|
||||
void setitem(int index, CTYPE const& value) throw (std::out_of_range) {
|
||||
if (index>=0 && index<(int)$self->size())
|
||||
(*$self)[index] = val;
|
||||
(*$self)[index] = value;
|
||||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
|
|
@ -332,7 +338,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,41 @@
|
|||
#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 map {
|
||||
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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,11 +165,11 @@ public void capacity(size_t value) {
|
|||
// generation issue when using const pointers as vector elements (like
|
||||
// std::vector< const int* >).
|
||||
%extend {
|
||||
void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) {
|
||||
void setElement(size_type index, CTYPE const& value) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to set value of element with invalid index.");
|
||||
}
|
||||
(*$self)[index] = val;
|
||||
(*$self)[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -517,11 +517,11 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
// generation issue when using const pointers as vector elements (like
|
||||
// std::vector< const int* >).
|
||||
%extend {
|
||||
void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) {
|
||||
void setElement(size_type index, CTYPE const& value) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to set value of element with invalid index.");
|
||||
}
|
||||
(*$self)[index] = val;
|
||||
(*$self)[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
15
Lib/go/director.swg
Normal file
15
Lib/go/director.swg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes so that Go proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
class DirectorException : public std::exception {
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -380,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%}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,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) \
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -259,8 +259,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 +296,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 +321,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 +334,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 +401,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"
|
||||
|
|
@ -172,6 +195,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%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"
|
||||
|
|
@ -1027,6 +1051,14 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
|||
%{ 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 */
|
||||
|
||||
|
|
@ -1149,6 +1181,14 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
|||
$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::*) ""
|
||||
|
|
@ -1260,7 +1300,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
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ 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 T &reference;
|
||||
typedef const T &const_reference;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
array();
|
||||
array(const array& other);
|
||||
size_type size() const;
|
||||
|
|
@ -29,10 +29,10 @@ namespace std {
|
|||
else
|
||||
throw std::out_of_range("array index out of range");
|
||||
}
|
||||
void set(int i, const value_type& val) throw (std::out_of_range) {
|
||||
void set(int i, const value_type& value) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = val;
|
||||
(*self)[i] = value;
|
||||
else
|
||||
throw std::out_of_range("array index out of range");
|
||||
}
|
||||
|
|
|
|||
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 (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 T value_type;
|
||||
typedef T &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) 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));
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -16,47 +16,44 @@
|
|||
#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> &);
|
||||
|
||||
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 map {
|
||||
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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Legacy macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
|
|
|
|||
|
|
@ -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,73 +14,171 @@
|
|||
#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, CREF_TYPE)
|
||||
%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();
|
||||
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 &reference;
|
||||
typedef CREF_TYPE const_reference;
|
||||
typedef CTYPE *pointer;
|
||||
typedef CTYPE const *const_pointer;
|
||||
|
||||
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) 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));
|
||||
}
|
||||
|
||||
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& value) {
|
||||
self->push_back(value);
|
||||
}
|
||||
|
||||
void doAdd(jint index, const value_type& value) throw (std::out_of_range) {
|
||||
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
|
||||
if (0 <= index && index <= size) {
|
||||
self->insert(self->begin() + index, value);
|
||||
} else {
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
|
||||
value_type doRemove(jint index) throw (std::out_of_range) {
|
||||
const jint size = static_cast<std::vector< CTYPE >::size_type>(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");
|
||||
}
|
||||
}
|
||||
|
||||
CREF_TYPE doGet(jint index) throw (std::out_of_range) {
|
||||
const jint size = static_cast<std::vector< CTYPE >::size_type>(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& value) throw (std::out_of_range) {
|
||||
const jint size = static_cast<std::vector< CTYPE >::size_type>(self->size());
|
||||
if (index >= 0 && index < size) {
|
||||
CTYPE const old_value = (*self)[index];
|
||||
(*self)[index] = value;
|
||||
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) {
|
||||
const jint size = static_cast<std::vector< CTYPE >::size_type>(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 T&)
|
||||
};
|
||||
|
||||
// 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)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,14 +220,14 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
{
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue;
|
||||
$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *OUTPUT
|
||||
{
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue;
|
||||
*$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
|
||||
|
|
@ -264,6 +264,21 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
|||
$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
|
||||
{
|
||||
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 */
|
||||
|
|
@ -386,13 +401,13 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
|||
%typemap(directorargout, noblock=1) TYPE &INOUT
|
||||
{
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue;
|
||||
$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *INOUT
|
||||
{
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue;
|
||||
*$result = ($*1_ltype)$1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
|
||||
|
|
@ -436,6 +451,19 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
|||
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
|
||||
{
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ 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)));
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ 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
|
||||
prefixed with the location of the innermost Lua call-point
|
||||
(as formated by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pusherrstring (lua_State *L, const char *str)
|
||||
|
|
@ -191,7 +191,7 @@ 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
|
||||
the Lua stack, like lua_pushfstring, but prefixed with the
|
||||
location of the innermost Lua call-point (as formated by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
|
||||
|
|
@ -1860,7 +1860,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 +1871,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);
|
||||
|
|
|
|||
|
|
@ -235,7 +235,6 @@ $1=($1_ltype)&temp;%}
|
|||
// so the standard wrapping cannot be done
|
||||
// nor can you cast a member function pointer to a void* (obviously)
|
||||
// therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written
|
||||
#ifdef __cplusplus
|
||||
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*)
|
||||
%{
|
||||
if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($type),$descriptor)))
|
||||
|
|
@ -246,7 +245,6 @@ $1=($1_ltype)&temp;%}
|
|||
%{
|
||||
SWIG_NewMemberObj(L,(void*)(&$1),sizeof($type),$descriptor); SWIG_arg++;
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
// void (must be empty without the SWIG_arg++)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
%include <shared_ptr.i>
|
||||
|
||||
// Set SHARED_PTR_DISOWN to $disown if required, for example
|
||||
// #define SHARED_PTR_DISOWN $disown
|
||||
#if !defined(SHARED_PTR_DISOWN)
|
||||
#define SHARED_PTR_DISOWN 0
|
||||
#endif
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
|
||||
|
|
@ -8,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;"
|
||||
|
||||
|
|
@ -19,7 +25,7 @@
|
|||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $symname, $argnum);
|
||||
|
|
@ -52,13 +58,31 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (!swig_argp) {
|
||||
%dirout_nullref("$type");
|
||||
} else {
|
||||
$result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
}
|
||||
}
|
||||
|
||||
// plain pointer
|
||||
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -69,6 +93,7 @@
|
|||
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
|
|
@ -97,12 +122,20 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE * %{
|
||||
#error "directorout typemap for plain pointer not implemented"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
|
|
@ -142,13 +175,21 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE & %{
|
||||
#error "directorout typemap for plain reference not implemented"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -160,7 +201,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -171,12 +212,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) TYPE *CONST& %{
|
||||
#error "directorout typemap for plain pointer by reference not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) $1 = *(%reinterpret_cast(argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype);
|
||||
|
|
@ -201,12 +250,28 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (swig_argp) {
|
||||
$result = *(%reinterpret_cast(swig_argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $<ype);
|
||||
}
|
||||
}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -228,12 +293,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "directorout typemap for shared_ptr ref not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -244,7 +317,7 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
if ($owner) delete $1;
|
||||
}
|
||||
|
|
@ -256,12 +329,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "directorout typemap for pointer to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $*ltype);
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype);
|
||||
|
|
@ -269,7 +350,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -280,10 +361,18 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "directorout typemap for pointer ref to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1)
|
||||
TYPE CONST,
|
||||
TYPE CONST &,
|
||||
TYPE CONST *,
|
||||
|
|
@ -307,5 +396,6 @@
|
|||
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
||||
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -46,7 +46,22 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
struct DirectorTypeMismatchException {
|
||||
// Base class for director exceptions.
|
||||
class DirectorException : public std::exception {
|
||||
public:
|
||||
static void raise(const char *msg) {
|
||||
// ... todo
|
||||
throw(DirectorException());
|
||||
}
|
||||
|
||||
static void raise(const octave_value &ov, const char *msg) {
|
||||
// ... todo
|
||||
raise(msg);
|
||||
}
|
||||
};
|
||||
|
||||
class DirectorTypeMismatchException : public DirectorException {
|
||||
public:
|
||||
static void raise(const char *msg) {
|
||||
// ... todo
|
||||
throw(DirectorTypeMismatchException());
|
||||
|
|
@ -58,7 +73,8 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
struct DirectorPureVirtualException {
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
static void raise(const char *msg) {
|
||||
// ... todo
|
||||
throw(DirectorPureVirtualException());
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ namespace swig
|
|||
// swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, _index);
|
||||
octave_value item; // * todo
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
return swig::as<T>(item);
|
||||
} catch (const std::exception& e) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "in sequence element %d ", _index);
|
||||
if (!Octave_Error_Occurred()) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace swig {
|
|||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr(const octave_value& obj, Type **val) {
|
||||
Type *p;
|
||||
Type *p = 0;
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -103,14 +103,14 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, value_category> {
|
||||
static Type as(const octave_value& obj, bool throw_error) {
|
||||
static Type as(const octave_value& obj) {
|
||||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (!obj.is_defined() || !SWIG_IsOK(res)) {
|
||||
if (!Octave_Error_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(const octave_value& obj, bool throw_error) {
|
||||
static Type as(const octave_value& obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
|
|
@ -130,21 +130,17 @@ namespace swig {
|
|||
return *v;
|
||||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
if (!Octave_Error_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<Type*, pointer_category> {
|
||||
static Type* as(const octave_value& obj, bool throw_error) {
|
||||
static Type* as(const octave_value& obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -153,15 +149,14 @@ namespace swig {
|
|||
if (!Octave_Error_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
return 0;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline Type as(const octave_value& obj, bool te = false) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj, te);
|
||||
inline Type as(const octave_value& obj) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
|
|
|
|||
|
|
@ -10,24 +10,20 @@
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_AsCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val)
|
||||
{
|
||||
SWIG_AsPtr(std::basic_string<char>)(octave_value obj, std::string **val) {
|
||||
if (obj.is_string()) {
|
||||
if (val)
|
||||
*val = new std::string(obj.string_value());
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
if (val)
|
||||
error("a string is expected");
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_FromCharPtrAndSize") {
|
||||
SWIGINTERNINLINE octave_value
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s) {
|
||||
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -45,41 +41,20 @@ SWIGINTERNINLINE octave_value
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_AsWCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<wchar_t> *");
|
||||
std::wstring *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::wstring(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (val) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError,"a wstring is expected");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(octave_value obj, std::wstring **val) {
|
||||
if (obj.is_string()) {
|
||||
if (val)
|
||||
*val = new std::wstring(obj.string_value());
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_FromWCharPtrAndSize") {
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
|
||||
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
%warnfilter(SWIGWARN_PARSE_KEYWORD) java::lang::ref;
|
||||
|
||||
%{
|
||||
#undef STATIC
|
||||
%}
|
||||
%include <gcj/cni.i>
|
||||
%{
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
%}
|
||||
|
||||
%include <jstring.i>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
|
||||
#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
|
||||
#define SWIG_AcquirePtr(ptr, src) SWIG_Perl_AcquirePtr(ptr, src)
|
||||
#define swig_owntype int
|
||||
|
||||
/* for raw packed data */
|
||||
|
|
@ -229,6 +230,14 @@ SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Acquire a pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
|
||||
/* TODO */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
|
|
@ -392,7 +401,7 @@ SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Convert a packed value value */
|
||||
/* Convert a packed pointer value */
|
||||
SWIGRUNTIME int
|
||||
SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
|
||||
swig_cast_info *tc;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@
|
|||
/* raise exception */
|
||||
%define %raise(obj, type, desc) sv_setsv(get_sv("@", GV_ADD), obj); SWIG_fail %enddef
|
||||
|
||||
/* For directors to raise/throw the original exception */
|
||||
%typemap(throws) Swig::DirectorException
|
||||
%{ sv_setsv(ERRSV, $1.getNative()); SWIG_fail; %}
|
||||
|
||||
/* Include the unified typemap library */
|
||||
%include <typemaps/swigtypemaps.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
%typemap(in) SWIGTYPE *DISOWN
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
%typemap(in) SWIGTYPE *DISOWN
|
||||
{
|
||||
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,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;"
|
||||
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $symname, $argnum);
|
||||
|
|
@ -62,13 +62,31 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (!swig_argp) {
|
||||
%dirout_nullref("$type");
|
||||
} else {
|
||||
$result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
}
|
||||
}
|
||||
|
||||
// plain pointer
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -108,12 +126,20 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE * %{
|
||||
#error "directorout typemap for plain pointer not implemented"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
|
|
@ -153,13 +179,21 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE & %{
|
||||
#error "directorout typemap for plain reference not implemented"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -171,7 +205,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -182,12 +216,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter_python") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) TYPE *CONST& %{
|
||||
#error "directorout typemap for plain pointer by reference not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) $1 = *(%reinterpret_cast(argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype);
|
||||
|
|
@ -212,12 +254,28 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (swig_argp) {
|
||||
$result = *(%reinterpret_cast(swig_argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $<ype);
|
||||
}
|
||||
}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -239,12 +297,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "directorout typemap for shared_ptr ref not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -255,7 +321,7 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
if ($owner) delete $1;
|
||||
}
|
||||
|
|
@ -267,12 +333,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "directorout typemap for pointer to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $*ltype);
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype);
|
||||
|
|
@ -280,7 +354,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -291,10 +365,18 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "directorout typemap for pointer ref to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1)
|
||||
TYPE CONST,
|
||||
TYPE CONST &,
|
||||
TYPE CONST *,
|
||||
|
|
@ -321,4 +403,3 @@
|
|||
|
||||
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -393,10 +393,10 @@ SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
|
|||
|
||||
SWIGINTERN void
|
||||
SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
|
||||
int base_count = 0;
|
||||
Py_ssize_t base_count = 0;
|
||||
PyTypeObject **b;
|
||||
PyObject *tuple;
|
||||
int i;
|
||||
Py_ssize_t i;
|
||||
|
||||
if (!bases[0]) {
|
||||
bases[0] = SwigPyObject_type();
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
%include <gcj/cni.i>
|
||||
%include <jstring.i>
|
||||
|
|
@ -434,8 +434,8 @@ namespace swig
|
|||
{
|
||||
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
return swig::as<T>(item);
|
||||
} catch (const std::invalid_argument& e) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "in sequence element %d ", (int)_index);
|
||||
if (!PyErr_Occurred()) {
|
||||
|
|
@ -655,6 +655,14 @@ namespace swig
|
|||
}
|
||||
|
||||
%define %swig_sequence_iterator(Sequence...)
|
||||
%swig_sequence_iterator_with_making_function(swig::make_output_iterator,Sequence...)
|
||||
%enddef
|
||||
|
||||
%define %swig_sequence_forward_iterator(Sequence...)
|
||||
%swig_sequence_iterator_with_making_function(swig::make_output_forward_iterator,Sequence...)
|
||||
%enddef
|
||||
|
||||
%define %swig_sequence_iterator_with_making_function(Make_output_iterator,Sequence...)
|
||||
#if defined(SWIG_EXPORT_ITERATOR_METHODS)
|
||||
class iterator;
|
||||
class reverse_iterator;
|
||||
|
|
@ -663,15 +671,15 @@ namespace swig
|
|||
|
||||
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
|
||||
iterator, reverse_iterator, const_iterator, const_reverse_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)),
|
||||
$result = SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &)),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
%typemap(out,noblock=1,fragment="SwigPySequence_Cont")
|
||||
std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> {
|
||||
$result = PyTuple_New(2);
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
PyTuple_SetItem($result,1,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).second),
|
||||
PyTuple_SetItem($result,1,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).second),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -680,7 +688,7 @@ namespace swig
|
|||
%typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator")
|
||||
std::pair<iterator, bool>, std::pair<const_iterator, bool> {
|
||||
$result = PyTuple_New(2);
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &).first),
|
||||
PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN));
|
||||
PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second));
|
||||
}
|
||||
|
|
@ -715,7 +723,7 @@ namespace swig
|
|||
%newobject iterator(PyObject **PYTHON_SELF);
|
||||
%extend {
|
||||
swig::SwigPyIterator* iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
return Make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
|
|
|
|||
|
|
@ -53,14 +53,17 @@ SWIG_Python_AddErrorMsg(const char* mesg)
|
|||
PyObject *value = 0;
|
||||
PyObject *traceback = 0;
|
||||
|
||||
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Fetch(&type, &value, &traceback);
|
||||
if (value) {
|
||||
char *tmp;
|
||||
PyObject *old_str = PyObject_Str(value);
|
||||
const char *tmp = SWIG_Python_str_AsChar(old_str);
|
||||
PyErr_Clear();
|
||||
Py_XINCREF(type);
|
||||
|
||||
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
|
||||
if (tmp)
|
||||
PyErr_Format(type, "%s %s", tmp, mesg);
|
||||
else
|
||||
PyErr_Format(type, "%s", mesg);
|
||||
SWIG_Python_str_DelForPy3(tmp);
|
||||
Py_DECREF(old_str);
|
||||
Py_DECREF(value);
|
||||
|
|
|
|||
|
|
@ -38,14 +38,16 @@ SWIGINTERN char*
|
|||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
char *cstr;
|
||||
char *newstr;
|
||||
Py_ssize_t len;
|
||||
char *newstr = 0;
|
||||
str = PyUnicode_AsUTF8String(str);
|
||||
PyBytes_AsStringAndSize(str, &cstr, &len);
|
||||
newstr = (char *) malloc(len+1);
|
||||
memcpy(newstr, cstr, len+1);
|
||||
Py_XDECREF(str);
|
||||
if (str) {
|
||||
char *cstr;
|
||||
Py_ssize_t len;
|
||||
PyBytes_AsStringAndSize(str, &cstr, &len);
|
||||
newstr = (char *) malloc(len+1);
|
||||
memcpy(newstr, cstr, len+1);
|
||||
Py_XDECREF(str);
|
||||
}
|
||||
return newstr;
|
||||
#else
|
||||
return PyString_AsString(str);
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ swig_varlink_str(swig_varlinkobject *v) {
|
|||
|
||||
SWIGINTERN int
|
||||
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
|
||||
char *tmp;
|
||||
PyObject *str = swig_varlink_str(v);
|
||||
const char *tmp = SWIG_Python_str_AsChar(str);
|
||||
fprintf(fp,"Swig global variables ");
|
||||
fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
|
||||
fprintf(fp,"%s\n", tmp ? tmp : "Invalid global variable");
|
||||
SWIG_Python_str_DelForPy3(tmp);
|
||||
Py_DECREF(str);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -198,16 +198,16 @@ namespace swig {
|
|||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class SwigPyIteratorOpen_T : public SwigPyIterator_T<OutIterator>
|
||||
class SwigPyForwardIteratorOpen_T : public SwigPyIterator_T<OutIterator>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
|
||||
typedef SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
|
||||
SwigPyForwardIteratorOpen_T(out_iterator curr, PyObject *seq)
|
||||
: SwigPyIterator_T<OutIterator>(curr, seq)
|
||||
{
|
||||
}
|
||||
|
|
@ -229,6 +229,25 @@ namespace swig {
|
|||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class SwigPyIteratorOpen_T : public SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
|
||||
: SwigPyForwardIteratorOpen_T<OutIterator>(curr, seq)
|
||||
{
|
||||
}
|
||||
|
||||
SwigPyIterator *decr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
|
|
@ -241,16 +260,16 @@ namespace swig {
|
|||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class SwigPyIteratorClosed_T : public SwigPyIterator_T<OutIterator>
|
||||
class SwigPyForwardIteratorClosed_T : public SwigPyIterator_T<OutIterator>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
|
||||
typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
|
||||
SwigPyForwardIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
|
||||
: SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last)
|
||||
{
|
||||
}
|
||||
|
|
@ -280,10 +299,33 @@ namespace swig {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected:
|
||||
out_iterator begin;
|
||||
out_iterator end;
|
||||
};
|
||||
|
||||
template<typename OutIterator,
|
||||
typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
|
||||
typename FromOper = from_oper<ValueType> >
|
||||
class SwigPyIteratorClosed_T : public SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>
|
||||
{
|
||||
public:
|
||||
FromOper from;
|
||||
typedef OutIterator out_iterator;
|
||||
typedef ValueType value_type;
|
||||
typedef SwigPyIterator_T<out_iterator> base;
|
||||
typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> base0;
|
||||
typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
|
||||
|
||||
SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
|
||||
: SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
|
||||
SwigPyIterator *decr(size_t n = 1)
|
||||
{
|
||||
while (n--) {
|
||||
if (base::current == begin) {
|
||||
if (base::current == base0::begin) {
|
||||
throw stop_iteration();
|
||||
} else {
|
||||
--base::current;
|
||||
|
|
@ -291,12 +333,16 @@ namespace swig {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private:
|
||||
out_iterator begin;
|
||||
out_iterator end;
|
||||
};
|
||||
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_forward_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyForwardIteratorClosed_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
|
||||
|
|
@ -304,6 +350,13 @@ namespace swig {
|
|||
return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_forward_iterator(const OutIter& current, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyForwardIteratorOpen_T<OutIter>(current, seq);
|
||||
}
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_iterator(const OutIter& current, PyObject *seq = 0)
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ SwigPyObject_dealloc(PyObject *v)
|
|||
PyObject *res;
|
||||
|
||||
/* PyObject_CallFunction() has the potential to silently drop
|
||||
the active active exception. In cases of unnamed temporary
|
||||
the active exception. In cases of unnamed temporary
|
||||
variable or where we just finished iterating over a generator
|
||||
StopIteration will be active right now, and this needs to
|
||||
remain true upon return from SwigPyObject_dealloc. So save
|
||||
|
|
@ -1308,7 +1308,7 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Convert a packed value value */
|
||||
/* Convert a packed pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
|
|
@ -1672,14 +1672,16 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront)
|
|||
PyObject *traceback = 0;
|
||||
PyErr_Fetch(&type, &value, &traceback);
|
||||
if (value) {
|
||||
char *tmp;
|
||||
PyObject *old_str = PyObject_Str(value);
|
||||
const char *tmp = SWIG_Python_str_AsChar(old_str);
|
||||
if (!tmp)
|
||||
tmp = "Invalid error message";
|
||||
Py_XINCREF(type);
|
||||
PyErr_Clear();
|
||||
if (infront) {
|
||||
PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
|
||||
PyErr_Format(type, "%s %s", mesg, tmp);
|
||||
} else {
|
||||
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
|
||||
PyErr_Format(type, "%s %s", tmp, mesg);
|
||||
}
|
||||
SWIG_Python_str_DelForPy3(tmp);
|
||||
Py_DECREF(old_str);
|
||||
|
|
@ -1805,6 +1807,8 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
|
|||
Py_INCREF(name);
|
||||
} else {
|
||||
encoded_name = PyUnicode_AsUTF8String(name);
|
||||
if (!encoded_name)
|
||||
return -1;
|
||||
}
|
||||
PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
|
||||
Py_DECREF(encoded_name);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/* Use debug wrappers with the Python release dll */
|
||||
# undef _DEBUG
|
||||
# include <Python.h>
|
||||
# define _DEBUG
|
||||
# define _DEBUG 1
|
||||
#else
|
||||
# include <Python.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace swig {
|
|||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr(PyObject *obj, Type **val) {
|
||||
Type *p;
|
||||
Type *p = 0;
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -107,14 +107,14 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, value_category> {
|
||||
static Type as(PyObject *obj, bool throw_error) {
|
||||
static Type as(PyObject *obj) {
|
||||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (!obj || !SWIG_IsOK(res)) {
|
||||
if (!PyErr_Occurred()) {
|
||||
::%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(PyObject *obj, bool throw_error) {
|
||||
static Type as(PyObject *obj) {
|
||||
Type *v = 0;
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
|
|
@ -134,21 +134,17 @@ namespace swig {
|
|||
return *v;
|
||||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
if (!PyErr_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<Type*, pointer_category> {
|
||||
static Type* as(PyObject *obj, bool throw_error) {
|
||||
static Type* as(PyObject *obj) {
|
||||
Type *v = 0;
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -157,15 +153,14 @@ namespace swig {
|
|||
if (!PyErr_Occurred()) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
return 0;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline Type as(PyObject *obj, bool te = false) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj, te);
|
||||
inline Type as(PyObject *obj) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
%#endif
|
||||
{
|
||||
char *cstr; Py_ssize_t len;
|
||||
int ret = SWIG_OK;
|
||||
%#if PY_VERSION_HEX>=0x03000000
|
||||
%#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||
if (!alloc && cptr) {
|
||||
|
|
@ -26,7 +27,10 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
return SWIG_RuntimeError;
|
||||
}
|
||||
obj = PyUnicode_AsUTF8String(obj);
|
||||
if(alloc) *alloc = SWIG_NEWOBJ;
|
||||
if (!obj)
|
||||
return SWIG_TypeError;
|
||||
if (alloc)
|
||||
*alloc = SWIG_NEWOBJ;
|
||||
%#endif
|
||||
PyBytes_AsStringAndSize(obj, &cstr, &len);
|
||||
%#else
|
||||
|
|
@ -64,6 +68,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
%#endif
|
||||
%#else
|
||||
*cptr = SWIG_Python_str_AsChar(obj);
|
||||
if (!*cptr)
|
||||
ret = SWIG_TypeError;
|
||||
%#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +77,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
%#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||
Py_XDECREF(obj);
|
||||
%#endif
|
||||
return SWIG_OK;
|
||||
return ret;
|
||||
} else {
|
||||
%#if defined(SWIG_PYTHON_2_UNICODE)
|
||||
%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||
|
|
@ -84,6 +90,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
|||
return SWIG_RuntimeError;
|
||||
}
|
||||
obj = PyUnicode_AsUTF8String(obj);
|
||||
if (!obj)
|
||||
return SWIG_TypeError;
|
||||
if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
|
||||
if (cptr) {
|
||||
if (alloc) *alloc = SWIG_NEWOBJ;
|
||||
|
|
|
|||
|
|
@ -9,41 +9,34 @@
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_AsCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<char> *");
|
||||
std::string *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
SWIG_AsPtr(std::basic_string<char>)(PyObject* obj, std::string **val) {
|
||||
static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<char> *");
|
||||
std::string *vptr;
|
||||
if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
char* buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::string(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
if (val) *val = 0;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (val) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError,"a string is expected");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
}
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_FromCharPtrAndSize") {
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s) {
|
||||
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -59,41 +52,34 @@ SWIGINTERNINLINE PyObject*
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_AsWCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<wchar_t> *");
|
||||
std::wstring *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::wstring(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(PyObject* obj, std::wstring **val) {
|
||||
static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<wchar_t> *");
|
||||
std::wstring *vptr;
|
||||
if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_IsOK(SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc))) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::wstring(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (val) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError,"a wstring is expected");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
if (val) *val = 0;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_FromWCharPtrAndSize") {
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
|
||||
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -18,5 +25,3 @@
|
|||
%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
|
||||
%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@
|
|||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
/* In Python 3.x the ".items()" method returns a dict_items object */
|
||||
items = PySequence_Fast(items, ".items() didn't return a sequence!");
|
||||
%#endif
|
||||
res = traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
multimap_type *p;
|
||||
swig_type_info *descriptor = swig::type_info<multimap_type>();
|
||||
|
|
@ -68,7 +72,17 @@
|
|||
|
||||
%define %swig_multimap_methods(Type...)
|
||||
%swig_map_common(Type);
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
#endif
|
||||
|
||||
%extend {
|
||||
// This will be called through the mp_ass_subscript slot to delete an entry.
|
||||
void __setitem__(const key_type& key) {
|
||||
self->erase(key);
|
||||
}
|
||||
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
self->insert(Type::value_type(key,x));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Unordered Maps
|
||||
*/
|
||||
|
||||
%fragment("StdMapTraits","header",fragment="StdSequenceTraits")
|
||||
%fragment("StdUnorderedMapTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class SwigPySeq, class K, class T >
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
static PyObject *from(const unordered_map_type& unordered_map) {
|
||||
swig_type_info *desc = swig::type_info<unordered_map_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new unordered_map_type(unordered_map), desc, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(new unordered_map_type(unordered_map), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = unordered_map.size();
|
||||
Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
||||
|
|
@ -74,33 +74,11 @@
|
|||
}
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct from_key_oper
|
||||
{
|
||||
typedef const ValueType& argument_type;
|
||||
typedef PyObject *result_type;
|
||||
result_type operator()(argument_type v) const
|
||||
{
|
||||
return swig::from(v.first);
|
||||
}
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct from_value_oper
|
||||
{
|
||||
typedef const ValueType& argument_type;
|
||||
typedef PyObject *result_type;
|
||||
result_type operator()(argument_type v) const
|
||||
{
|
||||
return swig::from(v.second);
|
||||
}
|
||||
};
|
||||
|
||||
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
||||
struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
struct SwigPyMapForwardIterator_T : SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
{
|
||||
SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
SwigPyMapForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -108,27 +86,27 @@
|
|||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_key_oper<typename OutIterator::value_type> >
|
||||
struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
struct SwigPyMapKeyForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
SwigPyMapKeyForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
make_output_key_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq);
|
||||
return new SwigPyMapKeyForwardIterator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_value_oper<typename OutIterator::value_type> >
|
||||
struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
struct SwigPyMapValueForwardIterator_T : SwigPyMapForwardIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
SwigPyMapValueForwardIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapForwardIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -136,15 +114,15 @@
|
|||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
make_output_value_forward_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyMapValueITerator_T<OutIter>(current, begin, end, seq);
|
||||
return new SwigPyMapValueForwardIterator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%define %swig_unordered_map_common(Map...)
|
||||
%swig_sequence_iterator(Map);
|
||||
%swig_sequence_forward_iterator(Map);
|
||||
%swig_container_methods(Map)
|
||||
|
||||
%extend {
|
||||
|
|
@ -227,12 +205,12 @@
|
|||
|
||||
%newobject key_iterator(PyObject **PYTHON_SELF);
|
||||
swig::SwigPyIterator* key_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
return swig::make_output_key_forward_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%newobject value_iterator(PyObject **PYTHON_SELF);
|
||||
swig::SwigPyIterator* value_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
return swig::make_output_value_forward_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%pythoncode %{def __iter__(self):
|
||||
|
|
@ -248,7 +226,17 @@
|
|||
|
||||
%define %swig_unordered_map_methods(Map...)
|
||||
%swig_unordered_map_common(Map)
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
#endif
|
||||
|
||||
%extend {
|
||||
// This will be called through the mp_ass_subscript slot to delete an entry.
|
||||
void __setitem__(const key_type& key) {
|
||||
self->erase(key);
|
||||
}
|
||||
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@
|
|||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
return traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
/* In Python 3.x the ".items()" method returns a dict_items object */
|
||||
items = PySequence_Fast(items, ".items() didn't return a sequence!");
|
||||
%#endif
|
||||
res = traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
unordered_multimap_type *p;
|
||||
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
|
||||
|
|
@ -50,7 +54,7 @@
|
|||
static PyObject *from(const unordered_multimap_type& unordered_multimap) {
|
||||
swig_type_info *desc = swig::type_info<unordered_multimap_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN);
|
||||
return SWIG_InternalNewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = unordered_multimap.size();
|
||||
Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
||||
|
|
@ -74,8 +78,18 @@
|
|||
}
|
||||
|
||||
%define %swig_unordered_multimap_methods(Type...)
|
||||
%swig_map_common(Type);
|
||||
%swig_unordered_map_common(Type);
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
|
||||
#endif
|
||||
|
||||
%extend {
|
||||
// This will be called through the mp_ass_subscript slot to delete an entry.
|
||||
void __setitem__(const key_type& key) {
|
||||
self->erase(key);
|
||||
}
|
||||
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
self->insert(Type::value_type(key,x));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
%}
|
||||
|
||||
#define %swig_unordered_multiset_methods(Set...) %swig_set_methods(Set)
|
||||
#define %swig_unordered_multiset_methods(Set...) %swig_unordered_set_methods(Set)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
%}
|
||||
|
||||
%define %swig_unordered_set_methods(unordered_set...)
|
||||
%swig_sequence_iterator(unordered_set);
|
||||
%swig_sequence_forward_iterator(unordered_set);
|
||||
%swig_container_methods(unordered_set);
|
||||
|
||||
%extend {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
%include <shared_ptr.i>
|
||||
|
||||
// Set SHARED_PTR_DISOWN to $disown if required, for example
|
||||
// #define SHARED_PTR_DISOWN $disown
|
||||
#if !defined(SHARED_PTR_DISOWN)
|
||||
#define SHARED_PTR_DISOWN 0
|
||||
#endif
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
|
||||
|
|
@ -8,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;"
|
||||
|
||||
|
|
@ -19,7 +25,7 @@
|
|||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $symname, $argnum);
|
||||
|
|
@ -29,7 +35,8 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) CONST TYPE {
|
||||
%set_output(SWIG_NewPointerObj(new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(varin) CONST TYPE {
|
||||
|
|
@ -47,16 +54,35 @@
|
|||
}
|
||||
}
|
||||
%typemap(varout) CONST TYPE {
|
||||
%set_varoutput(SWIG_NewPointerObj(new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (!swig_argp) {
|
||||
%dirout_nullref("$type");
|
||||
} else {
|
||||
$result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
}
|
||||
}
|
||||
|
||||
// plain pointer
|
||||
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -67,8 +93,9 @@
|
|||
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -95,12 +122,20 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE * %{
|
||||
#error "directorout typemap for plain pointer not implemented"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
|
|
@ -140,13 +175,21 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE & %{
|
||||
#error "directorout typemap for plain reference not implemented"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -158,7 +201,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -169,12 +212,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) TYPE *CONST& %{
|
||||
#error "directorout typemap for plain pointer by reference not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) $1 = *(%reinterpret_cast(argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype);
|
||||
|
|
@ -199,12 +250,28 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (swig_argp) {
|
||||
$result = *(%reinterpret_cast(swig_argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $<ype);
|
||||
}
|
||||
}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -226,12 +293,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "directorout typemap for shared_ptr ref not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -242,7 +317,7 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
if ($owner) delete $1;
|
||||
}
|
||||
|
|
@ -254,12 +329,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "directorout typemap for pointer to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $*ltype);
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype);
|
||||
|
|
@ -267,7 +350,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -278,10 +361,18 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "directorout typemap for pointer ref to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1)
|
||||
TYPE CONST,
|
||||
TYPE CONST &,
|
||||
TYPE CONST *,
|
||||
|
|
@ -305,5 +396,6 @@
|
|||
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
%enddef
|
||||
|
||||
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -213,17 +213,15 @@ R_SWIG_ReferenceFinalizer(SEXP el)
|
|||
return;
|
||||
}
|
||||
|
||||
typedef enum {R_SWIG_EXTERNAL, R_SWIG_OWNER } R_SWIG_Owner;
|
||||
|
||||
SWIGRUNTIME SEXP
|
||||
SWIG_MakePtr(void *ptr, const char *typeName, R_SWIG_Owner owner)
|
||||
SWIG_MakePtr(void *ptr, const char *typeName, int flags)
|
||||
{
|
||||
SEXP external, r_obj;
|
||||
|
||||
Rf_protect(external = R_MakeExternalPtr(ptr, Rf_install(typeName), R_NilValue));
|
||||
Rf_protect(r_obj = NEW_OBJECT(MAKE_CLASS((char *) typeName)));
|
||||
|
||||
if(owner)
|
||||
if (flags & SWIG_POINTER_OWN)
|
||||
R_RegisterCFinalizer(external, R_SWIG_ReferenceFinalizer);
|
||||
|
||||
r_obj = SET_SLOT(r_obj, Rf_mkString((char *) "ref"), external);
|
||||
|
|
@ -262,7 +260,11 @@ AddOutputArgToReturn(int pos, SEXP value, const char *name, SEXP output)
|
|||
/* Create a new pointer object */
|
||||
SWIGRUNTIMEINLINE SEXP
|
||||
SWIG_R_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||
SEXP rptr = R_MakeExternalPtr(ptr,
|
||||
SEXP rptr;
|
||||
if (!ptr) {
|
||||
return R_NilValue;
|
||||
}
|
||||
rptr = R_MakeExternalPtr(ptr,
|
||||
R_MakeExternalPtr(type, R_NilValue, R_NilValue), R_NilValue);
|
||||
SET_S4_OBJECT(rptr);
|
||||
return rptr;
|
||||
|
|
@ -350,7 +352,7 @@ SWIG_R_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
|||
return ptr ? RSwigPacked_New((void *) ptr, sz, type) : R_NilValue;
|
||||
}
|
||||
|
||||
/* Convert a packed value value */
|
||||
/* Convert a packed pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_R_ConvertPacked(SEXP obj, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace swig {
|
|||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr(SWIG_Object obj, Type **val) {
|
||||
Type *p;
|
||||
Type *p = 0;
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -101,12 +101,11 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, value_category> {
|
||||
static Type as(SWIG_Object obj, bool throw_error) {
|
||||
static Type as(SWIG_Object obj) {
|
||||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (!obj || !SWIG_IsOK(res)) {
|
||||
if (throw_error)
|
||||
throw std::invalid_argument("bad type");
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
@ -114,7 +113,7 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(SWIG_Object obj, bool throw_error) {
|
||||
static Type as(SWIG_Object obj) {
|
||||
Type *v = 0;
|
||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
|
|
@ -126,12 +125,7 @@ namespace swig {
|
|||
return *v;
|
||||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
if (throw_error)
|
||||
throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -152,8 +146,8 @@ namespace swig {
|
|||
};
|
||||
|
||||
template <class Type>
|
||||
inline Type as(SWIG_Object obj, bool te = false) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj, te);
|
||||
inline Type as(SWIG_Object obj) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
|
|
|
|||
|
|
@ -152,19 +152,26 @@ string &, std::string &
|
|||
%typemap(scoerceout) SEXP %{ %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE
|
||||
%{ $result <- new("$&R_class", ref=$result); %}
|
||||
%{ $result <- if (is.null($result)) $result
|
||||
else new("$&R_class", ref=$result); %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE &
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
%{ $result <- if (is.null($result)) $result
|
||||
else new("$R_class", ref=$result); %}
|
||||
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE &&
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
%{ $result <- if (is.null($result)) $result
|
||||
else new("$R_class", ref=$result); %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE *
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
%{ $result <- if (is.null($result)) $result
|
||||
else new("$R_class", ref=$result); %}
|
||||
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE *const
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
%{ $result <- if (is.null($result)) $result
|
||||
else new("$R_class", ref=$result); %}
|
||||
|
||||
|
||||
/* Override the SWIGTYPE * above. */
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
# This could be provided as a separate run-time library but this
|
||||
# approach allows the code to to be included directly into the
|
||||
# approach allows the code to be included directly into the
|
||||
# generated bindings and so removes the need to have and install an
|
||||
# additional library. We may however end up with multiple copies of
|
||||
# this and some confusion at run-time as to which class to use. This
|
||||
|
|
|
|||
2
Lib/r/std_shared_ptr.i
Normal file
2
Lib/r/std_shared_ptr.i
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define SWIG_SHARED_PTR_NAMESPACE std
|
||||
%include <boost_shared_ptr.i>
|
||||
|
|
@ -6,10 +6,6 @@
|
|||
#define SHARED_PTR_DISOWN 0
|
||||
#endif
|
||||
|
||||
%fragment("SWIG_null_deleter_python", "header", fragment="SWIG_null_deleter") {
|
||||
%#define SWIG_NO_NULL_DELETER_SWIG_BUILTIN_INIT
|
||||
}
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
|
||||
|
|
@ -62,6 +58,24 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (!swig_argp) {
|
||||
%dirout_nullref("$type");
|
||||
} else {
|
||||
$result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
|
||||
if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
}
|
||||
}
|
||||
|
||||
// plain pointer
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) {
|
||||
|
|
@ -80,7 +94,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -103,11 +117,19 @@
|
|||
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE * %{
|
||||
#error "directorout typemap for plain pointer not implemented"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
|
|
@ -124,7 +146,7 @@
|
|||
$1 = %const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -148,11 +170,19 @@
|
|||
$1 = *%const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE & %{
|
||||
#error "directorout typemap for plain reference not implemented"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
|
|
@ -170,8 +200,8 @@
|
|||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -182,6 +212,14 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) TYPE *CONST& %{
|
||||
#error "directorout typemap for plain pointer by reference not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
|
|
@ -212,6 +250,22 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (swig_argp) {
|
||||
$result = *(%reinterpret_cast(swig_argp, $<ype));
|
||||
if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $<ype);
|
||||
}
|
||||
}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
|
|
@ -239,6 +293,14 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "directorout typemap for shared_ptr ref not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
|
|
@ -255,7 +317,7 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
if ($owner) delete $1;
|
||||
}
|
||||
|
|
@ -267,6 +329,14 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "directorout typemap for pointer to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) {
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
|
|
@ -280,7 +350,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -291,10 +361,18 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "directorout typemap for pointer ref to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1)
|
||||
TYPE CONST,
|
||||
TYPE CONST &,
|
||||
TYPE CONST *,
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
%include <gcj/cni.i>
|
||||
%include <jstring.i>
|
||||
|
|
@ -183,8 +183,8 @@ namespace swig
|
|||
{
|
||||
VALUE item = rb_ary_entry(_seq, _index );
|
||||
try {
|
||||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
return swig::as<T>(item);
|
||||
} catch (const std::invalid_argument& e) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "in sequence element %d ", _index);
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
|
|
@ -926,7 +926,7 @@ namespace swig
|
|||
VALUE elem = argv[0];
|
||||
int idx = 0;
|
||||
try {
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem );
|
||||
if ( i >= len ) {
|
||||
$self->resize(i-1, val);
|
||||
return $self;
|
||||
|
|
@ -943,7 +943,7 @@ namespace swig
|
|||
}
|
||||
|
||||
}
|
||||
catch( std::invalid_argument )
|
||||
catch( const std::invalid_argument & )
|
||||
{
|
||||
rb_raise( rb_eArgError, "%s",
|
||||
Ruby_Format_TypeError( "",
|
||||
|
|
@ -967,10 +967,10 @@ namespace swig
|
|||
Sequence::iterator start = $self->begin();
|
||||
VALUE elem = argv[idx];
|
||||
try {
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
|
||||
Sequence::value_type val = swig::as<Sequence::value_type>( elem );
|
||||
$self->insert( start, val );
|
||||
}
|
||||
catch( std::invalid_argument )
|
||||
catch( const std::invalid_argument & )
|
||||
{
|
||||
rb_raise( rb_eArgError, "%s",
|
||||
Ruby_Format_TypeError( "",
|
||||
|
|
|
|||
|
|
@ -171,10 +171,11 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|||
swig_class *sklass;
|
||||
VALUE klass;
|
||||
VALUE obj;
|
||||
|
||||
|
||||
if (!ptr)
|
||||
return Qnil;
|
||||
|
||||
|
||||
assert(type);
|
||||
if (type->clientdata) {
|
||||
sklass = (swig_class *) type->clientdata;
|
||||
|
||||
|
|
@ -182,7 +183,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|||
track = sklass->trackObjects;
|
||||
if (track) {
|
||||
obj = SWIG_RubyInstanceFor(ptr);
|
||||
|
||||
|
||||
/* Check the object's type and make sure it has the correct type.
|
||||
It might not in cases where methods do things like
|
||||
downcast methods. */
|
||||
|
|
@ -214,7 +215,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|||
obj = Data_Wrap_Struct(klass, 0, 0, ptr);
|
||||
}
|
||||
rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +363,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
|
|||
return rb_str_new2(result);
|
||||
}
|
||||
|
||||
/* Convert a packed value value */
|
||||
/* Convert a packed pointer value */
|
||||
SWIGRUNTIME int
|
||||
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
|
||||
swig_cast_info *tc;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
* The Ruby classes, for C++
|
||||
* ------------------------------------------------------------ */
|
||||
%include <rubyclasses.swg>
|
||||
%include <rubystdcommon_forward.swg>
|
||||
|
||||
%fragment("StdTraits","header",fragment="StdTraitsCommon")
|
||||
%fragment("StdTraits","header",fragment="StdTraitsCommon",fragment="StdTraitsForwardDeclaration")
|
||||
{
|
||||
|
||||
namespace swig {
|
||||
|
|
@ -52,7 +53,7 @@ namespace swig {
|
|||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr(VALUE obj, Type **val) {
|
||||
Type *p;
|
||||
Type *p = 0;
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -114,15 +115,15 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, value_category> {
|
||||
static Type as(VALUE obj, bool throw_error) {
|
||||
static Type as(VALUE obj) {
|
||||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
@ -130,7 +131,7 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(VALUE obj, bool throw_error) {
|
||||
static Type as(VALUE obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
|
|
@ -142,40 +143,35 @@ namespace swig {
|
|||
return *v;
|
||||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<Type*, pointer_category> {
|
||||
static Type* as(VALUE obj, bool throw_error) {
|
||||
static Type* as(VALUE obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return v;
|
||||
} else {
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
return 0;
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline Type as(VALUE obj, bool te = false) {
|
||||
return traits_as< Type, typename traits< Type >::category >::as(obj, te);
|
||||
inline Type as(VALUE obj) {
|
||||
return traits_as< Type, typename traits< Type >::category >::as(obj);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
|
|
|
|||
15
Lib/ruby/rubystdcommon_forward.swg
Normal file
15
Lib/ruby/rubystdcommon_forward.swg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%fragment("StdTraitsForwardDeclaration","header")
|
||||
{
|
||||
namespace swig {
|
||||
template <class Type> struct traits_asptr;
|
||||
template <class Type> struct traits_asval;
|
||||
struct pointer_category;
|
||||
template <class Type, class Category> struct traits_as;
|
||||
template <class Type> struct traits_from;
|
||||
template <class Type> struct traits_from_ptr;
|
||||
template <class Type> struct noconst_traits;
|
||||
template <class Type> swig_type_info* type_info();
|
||||
template <class Type> const char* type_name();
|
||||
template <class Type> VALUE from(const Type& val);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* rubytracking.swg
|
||||
*
|
||||
* This file contains support for tracking mappings from
|
||||
* This file contains support for tracking mappings from
|
||||
* Ruby objects to C++ objects. This functionality is needed
|
||||
* to implement mark functions for Ruby's mark and sweep
|
||||
* garbage collector.
|
||||
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* Global hash table to store Trackings from C/C++
|
||||
structs to Ruby Objects.
|
||||
structs to Ruby Objects.
|
||||
*/
|
||||
static st_table* swig_ruby_trackings = NULL;
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
|
|||
/* Create a hash table to store Trackings from C++
|
||||
objects to Ruby objects. */
|
||||
|
||||
/* Try to see if some other .so has already created a
|
||||
/* Try to see if some other .so has already created a
|
||||
tracking hash table, which we keep hidden in an instance var
|
||||
in the SWIG module.
|
||||
This is done to allow multiple DSOs to share the same
|
||||
|
|
@ -101,13 +101,14 @@ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
|
|||
|
||||
/* This is a helper method that unlinks a Ruby object from its
|
||||
underlying C++ object. This is needed if the lifetime of the
|
||||
Ruby object is longer than the C++ object */
|
||||
Ruby object is longer than the C++ object. */
|
||||
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
|
||||
VALUE object = SWIG_RubyInstanceFor(ptr);
|
||||
|
||||
if (object != Qnil) {
|
||||
if (TYPE(object) != T_DATA)
|
||||
abort();
|
||||
// object might have the T_ZOMBIE type, but that's just
|
||||
// because the GC has flagged it as such for a deferred
|
||||
// destruction. Until then, it's still a T_DATA object.
|
||||
DATA_PTR(object) = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,71 +1,57 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* rubywstrings.swg
|
||||
*
|
||||
* Currently, Ruby does not support Unicode or WChar properly, so these
|
||||
* are still treated as char arrays for now.
|
||||
* There are other libraries available that add support to this in
|
||||
* ruby including WString, FXString, etc.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* utility methods for wchar_t strings
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_AsCharPtrAndSize") {
|
||||
%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_AsCharPtrAndSize",fragment="SWIG_ruby_wstring_encoding_init") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc)
|
||||
{
|
||||
return SWIG_AsCharPtrAndSize( obj, (char**)cptr, psize, alloc);
|
||||
// VALUE tmp = 0;
|
||||
// bool ok = false;
|
||||
// if ( TYPE(obj) == T_STRING ) {
|
||||
// if (cptr) {
|
||||
// obj = tmp = SWIG_Unicode_FromObject(obj);
|
||||
// ok = true;
|
||||
// }
|
||||
// }
|
||||
// if (ok) {
|
||||
// Py_ssize_t len = PyUnicode_GetSize(obj);
|
||||
// rb_notimplement();
|
||||
// if (cptr) {
|
||||
// *cptr = %new_array(len + 1, wchar_t);
|
||||
// SWIG_Unicode_AsWideChar((PyUnicodeObject *)obj, *cptr, len);
|
||||
// (*cptr)[len] = 0;
|
||||
// }
|
||||
// if (psize) *psize = (size_t) len + 1;
|
||||
// if (alloc) *alloc = cptr ? SWIG_NEWOBJ : 0;
|
||||
// return SWIG_OK;
|
||||
// } else {
|
||||
// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
|
||||
// if (pwchar_descriptor) {
|
||||
// void * vptr = 0;
|
||||
// if (SWIG_ConvertPtr(obj, &vptr, pwchar_descriptor, 0) == SWIG_OK) {
|
||||
// if (cptr) *cptr = (wchar_t *)vptr;
|
||||
// if (psize) *psize = vptr ? (wcslen((wchar_t *)vptr) + 1) : 0;
|
||||
// return SWIG_OK;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return SWIG_TypeError;
|
||||
rb_encoding* wstr_enc = swig_ruby_wstring_encoding;
|
||||
|
||||
if (TYPE(obj) == T_STRING) {
|
||||
VALUE rstr = rb_str_conv_enc(obj, rb_enc_get(obj), wstr_enc);
|
||||
wchar_t* cstr = (wchar_t*) StringValuePtr(rstr);
|
||||
size_t size = RSTRING_LEN(rstr) / sizeof(wchar_t) + 1;
|
||||
|
||||
if ( RSTRING_LEN(rstr) % sizeof(wchar_t) != 0 ) {
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"The length of the byte sequence of converted string is not a multiplier of sizeof(wchar_t). Invalid byte sequence is given. Or invalid SWIG_RUBY_WSTRING_ENCODING is given when compiling this binding.");
|
||||
}
|
||||
if (cptr && alloc) {
|
||||
*alloc = SWIG_NEWOBJ;
|
||||
*cptr = %new_array(size, wchar_t);
|
||||
memmove(*cptr, cstr, RSTRING_LEN(rstr));
|
||||
}
|
||||
if (psize) *psize = size;
|
||||
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_FromCharPtrAndSize") {
|
||||
%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_FromCharPtrAndSize",fragment="SWIG_ruby_wstring_encoding_init") {
|
||||
SWIGINTERNINLINE VALUE
|
||||
SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size)
|
||||
{
|
||||
return SWIG_FromCharPtrAndSize( (const char*)carray, size);
|
||||
// if (carray) {
|
||||
// if (size > INT_MAX) {
|
||||
// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
|
||||
// return pwchar_descriptor ?
|
||||
// SWIG_NewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : Qnil;
|
||||
// } else {
|
||||
// return SWIG_Unicode_FromWideChar(carray, %numeric_cast(size,int));
|
||||
// }
|
||||
// } else {
|
||||
// return Qnil;
|
||||
// }
|
||||
rb_encoding* wstr_enc = swig_ruby_wstring_encoding;
|
||||
rb_encoding* rb_enc = swig_ruby_internal_encoding;
|
||||
|
||||
if (carray && size <= LONG_MAX/sizeof(wchar_t)) {
|
||||
VALUE rstr = rb_str_new( (const char*)carray, %numeric_cast(size*sizeof(wchar_t),long) );
|
||||
rb_encoding* new_enc = rb_default_internal_encoding();
|
||||
|
||||
rb_enc_associate(rstr, wstr_enc);
|
||||
if ( !new_enc ) {
|
||||
new_enc = rb_enc;
|
||||
}
|
||||
return rb_str_conv_enc(rstr, wstr_enc, new_enc);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,40 +13,37 @@
|
|||
%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_AsCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<char> *");
|
||||
std::string *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val) {
|
||||
static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<char> *");
|
||||
std::string *vptr;
|
||||
if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
char* buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::string(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
}
|
||||
if (val) {
|
||||
rb_raise( rb_eTypeError, "a string is expected");
|
||||
}
|
||||
return 0;
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<char>),"header",
|
||||
fragment="SWIG_FromCharPtrAndSize") {
|
||||
SWIGINTERNINLINE VALUE
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<char>)(const std::string& s) {
|
||||
return SWIG_FromCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
||||
%ignore std::basic_string::operator!=;
|
||||
%ignore std::basic_string::operator+=;
|
||||
|
||||
%include <std/std_basic_string.i>
|
||||
%typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
|
||||
|
||||
|
|
@ -55,39 +52,37 @@ SWIGINTERNINLINE VALUE
|
|||
|
||||
#if !defined(SWIG_STD_WSTRING)
|
||||
|
||||
%traits_swigtype(std::basic_string<wchar_t>);
|
||||
%fragment(SWIG_Traits_frag(std::basic_string<wchar_t>));
|
||||
|
||||
|
||||
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_AsWCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val)
|
||||
{
|
||||
static swig_type_info* string_info =
|
||||
SWIG_TypeQuery("std::basic_string<wchar_t> *");
|
||||
std::wstring *vptr;
|
||||
if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::wstring(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val) {
|
||||
static swig_type_info* string_info = SWIG_TypeQuery("std::basic_string<wchar_t> *");
|
||||
std::wstring *vptr;
|
||||
if (SWIG_IsOK(SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0))) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_IsOK(SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc))) {
|
||||
if (buf) {
|
||||
if (val) *val = new std::wstring(buf, size - 1);
|
||||
if (alloc == SWIG_NEWOBJ) %delete_array(buf);
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
if (val) {
|
||||
rb_raise( rb_eTypeError, "a string is expected");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
|
||||
fragment="SWIG_FromWCharPtrAndSize") {
|
||||
SWIGINTERNINLINE VALUE
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
|
||||
{
|
||||
SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s) {
|
||||
return SWIG_FromWCharPtrAndSize(s.data(), s.size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,141 @@
|
|||
#define SWIG_SHARED_PTR_NAMESPACE std
|
||||
%include <boost_shared_ptr.i>
|
||||
%include <rubystdcommon_forward.swg>
|
||||
|
||||
|
||||
%fragment("StdSharedPtrTraits","header",fragment="StdTraitsForwardDeclaration",fragment="<memory>")
|
||||
{
|
||||
namespace swig {
|
||||
/*
|
||||
Template specialization for functions defined in rubystdcommon.swg. Special handling for shared_ptr
|
||||
is required as, shared_ptr<T> * is used rather than the usual T *, see shared_ptr.i.
|
||||
*/
|
||||
template <class Type>
|
||||
struct traits_asptr<std::shared_ptr<Type> > {
|
||||
static int asptr(VALUE obj, std::shared_ptr<Type> **val) {
|
||||
std::shared_ptr<Type> *p = 0;
|
||||
swig_type_info *descriptor = type_info<std::shared_ptr<Type> >();
|
||||
swig_ruby_owntype newmem = {0, 0};
|
||||
int res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) {
|
||||
if (*val) {
|
||||
**val = p ? *p : std::shared_ptr<Type>();
|
||||
} else {
|
||||
*val = p;
|
||||
if (newmem.own & SWIG_CAST_NEW_MEMORY) {
|
||||
// Upcast for pointers to shared_ptr in this generic framework has not been implemented
|
||||
res = SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newmem.own & SWIG_CAST_NEW_MEMORY)
|
||||
delete p;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_asval<std::shared_ptr<Type> > {
|
||||
static int asval(VALUE obj, std::shared_ptr<Type> *val) {
|
||||
if (val) {
|
||||
std::shared_ptr<Type> ret;
|
||||
std::shared_ptr<Type> *p = &ret;
|
||||
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
|
||||
if (!SWIG_IsOK(res))
|
||||
return res;
|
||||
*val = ret;
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return traits_asptr<std::shared_ptr<Type> >::asptr(obj, (std::shared_ptr<Type> **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_asval<std::shared_ptr<Type> *> {
|
||||
static int asval(VALUE obj, std::shared_ptr<Type> **val) {
|
||||
if (val) {
|
||||
typedef typename noconst_traits<std::shared_ptr<Type> >::noconst_type noconst_type;
|
||||
if (*val) {
|
||||
noconst_type ret;
|
||||
noconst_type *p = &ret;
|
||||
int res = traits_asptr<noconst_type>::asptr(obj, &p);
|
||||
if (SWIG_IsOK(res))
|
||||
**(const_cast<noconst_type**>(val)) = ret;
|
||||
return res;
|
||||
} else {
|
||||
noconst_type *p = 0;
|
||||
int res = traits_asptr<noconst_type>::asptr(obj, &p);
|
||||
if (SWIG_IsOK(res))
|
||||
*val = p;
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
return traits_asptr<std::shared_ptr<Type> >::asptr(obj, (std::shared_ptr<Type> **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<std::shared_ptr<Type>, pointer_category> {
|
||||
static std::shared_ptr<Type> as(VALUE obj) {
|
||||
std::shared_ptr<Type> ret;
|
||||
std::shared_ptr<Type> *v = &ret;
|
||||
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return ret;
|
||||
} else {
|
||||
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil)
|
||||
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<std::shared_ptr<Type> *, pointer_category> {
|
||||
static std::shared_ptr<Type> * as(VALUE obj) {
|
||||
std::shared_ptr<Type> *p = 0;
|
||||
int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &p);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return p;
|
||||
} else {
|
||||
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil)
|
||||
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> *>());
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_from_ptr<std::shared_ptr<Type> > {
|
||||
static VALUE from(std::shared_ptr<Type> *val, int owner = 0) {
|
||||
if (val && *val) {
|
||||
return SWIG_NewPointerObj(val, type_info<std::shared_ptr<Type> >(), owner);
|
||||
} else {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
The descriptors in the shared_ptr typemaps remove the const qualifier for the SWIG type system.
|
||||
Remove const likewise here, otherwise SWIG_TypeQuery("std::shared_ptr<const Type>") will return NULL.
|
||||
*/
|
||||
template<class Type>
|
||||
struct traits_from<std::shared_ptr<const Type> > {
|
||||
static VALUE from(const std::shared_ptr<const Type>& val) {
|
||||
std::shared_ptr<Type> p = std::const_pointer_cast<Type>(val);
|
||||
return swig::from(p);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("StdSharedPtrTraits");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
%warnfilter(801) std::string; // wrong class name
|
||||
%warnfilter(378) std::basic_string::operator!=;
|
||||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string<char>;
|
||||
|
||||
AUTODOC(substr, "Return a portion of the String");
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%include <std_unordered_set.i>
|
||||
|
||||
%fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits")
|
||||
%fragment("StdUnorderedMultisetTraits","header",fragment="StdUnorderedSetTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class RubySeq, class T>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%include <std_set.i>
|
||||
|
||||
%fragment("StdUnorderedSetTraits","header",fragment="<stddef.h>",fragment="StdSequenceTraits")
|
||||
%fragment("StdUnorderedSetTraits","header",fragment="<stddef.h>",fragment="StdSetTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class RubySeq, class T>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,52 @@
|
|||
%{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RUBY_ENCODING_H
|
||||
#include "ruby/encoding.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The internal encoding of std::wstring is defined based on
|
||||
* the size of wchar_t. If it is not appropriate for your library,
|
||||
* SWIG_RUBY_WSTRING_ENCODING must be given when compiling.
|
||||
*/
|
||||
#ifndef SWIG_RUBY_WSTRING_ENCODING
|
||||
|
||||
#if WCHAR_MAX == 0x7fff || WCHAR_MAX == 0xffff
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-16LE"
|
||||
#elif WCHAR_MAX == 0x7fffffff || WCHAR_MAX == 0xffffffff
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-32LE"
|
||||
#else
|
||||
#error unsupported wchar_t size. SWIG_RUBY_WSTRING_ENCODING must be given.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If Encoding.default_internal is nil, this encoding will be used
|
||||
* when converting from std::wstring to String object in Ruby.
|
||||
*/
|
||||
#ifndef SWIG_RUBY_INTERNAL_ENCODING
|
||||
#define SWIG_RUBY_INTERNAL_ENCODING "UTF-8"
|
||||
#endif
|
||||
|
||||
static rb_encoding *swig_ruby_wstring_encoding;
|
||||
static rb_encoding *swig_ruby_internal_encoding;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("SWIG_ruby_wstring_encoding_init", "init") {
|
||||
swig_ruby_wstring_encoding = rb_enc_find( SWIG_RUBY_WSTRING_ENCODING );
|
||||
swig_ruby_internal_encoding = rb_enc_find( SWIG_RUBY_INTERNAL_ENCODING );
|
||||
}
|
||||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string<wchar_t>;
|
||||
|
||||
%include <rubywstrings.swg>
|
||||
%include <typemaps/std_wstring.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;"
|
||||
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) {
|
||||
%argument_nullref("$type", $symname, $argnum);
|
||||
|
|
@ -58,13 +58,31 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (!swig_argp) {
|
||||
%dirout_nullref("$type");
|
||||
} else {
|
||||
$result = *(%reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get());
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
}
|
||||
}
|
||||
|
||||
// plain pointer
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -76,7 +94,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -99,17 +117,25 @@
|
|||
$1 = %const_cast((smartarg ? smartarg->get() : 0), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE * {
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE * %{
|
||||
#error "directorout typemap for plain pointer not implemented"
|
||||
%}
|
||||
|
||||
// plain reference
|
||||
%typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
|
|
@ -120,7 +146,7 @@
|
|||
$1 = %const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
|
@ -144,18 +170,26 @@
|
|||
$1 = *%const_cast(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get(), $1_ltype);
|
||||
}
|
||||
}
|
||||
%typemap(varout, fragment="SWIG_null_deleter_python") CONST TYPE & {
|
||||
%typemap(varout, fragment="SWIG_null_deleter") CONST TYPE & {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(&$1 SWIG_NO_NULL_DELETER_0);
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) CONST TYPE & %{
|
||||
#error "directorout typemap for plain reference not implemented"
|
||||
%}
|
||||
|
||||
// plain pointer by reference
|
||||
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
|
||||
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
|
||||
|
|
@ -166,8 +200,8 @@
|
|||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(out, fragment="SWIG_null_deleter_python") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
|
||||
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -178,12 +212,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1, fragment="SWIG_null_deleter") TYPE *CONST& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) TYPE *CONST& %{
|
||||
#error "directorout typemap for plain pointer by reference not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by value
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) $1 = *(%reinterpret_cast(argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype);
|
||||
|
|
@ -208,12 +250,28 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *swig_argp, int swig_res = 0) {
|
||||
int newmem = 0;
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res, "$type");
|
||||
}
|
||||
if (swig_argp) {
|
||||
$result = *(%reinterpret_cast(swig_argp, $<ype));
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(swig_argp, $<ype);
|
||||
}
|
||||
}
|
||||
|
||||
// shared_ptr by reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -235,12 +293,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
#error "directorout typemap for shared_ptr ref not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) {
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $ltype);
|
||||
|
|
@ -251,7 +317,7 @@
|
|||
}
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 && *$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
if ($owner) delete $1;
|
||||
}
|
||||
|
|
@ -263,12 +329,20 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
#error "directorout typemap for pointer to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// shared_ptr by pointer reference
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) {
|
||||
int newmem = 0;
|
||||
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (argp) tempshared = *%reinterpret_cast(argp, $*ltype);
|
||||
if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype);
|
||||
|
|
@ -276,7 +350,7 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = *$1 && **$1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0;
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
|
||||
}
|
||||
|
||||
|
|
@ -287,10 +361,18 @@
|
|||
#error "varout typemap not implemented"
|
||||
%}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0;
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
|
||||
%}
|
||||
%typemap(directorout,noblock=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
|
||||
#error "directorout typemap for pointer ref to shared_ptr not implemented"
|
||||
%}
|
||||
|
||||
// Typecheck typemaps
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
|
||||
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1)
|
||||
TYPE CONST,
|
||||
TYPE CONST &,
|
||||
TYPE CONST *,
|
||||
|
|
@ -317,4 +399,3 @@
|
|||
|
||||
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
|
||||
%fragment("SciSequence_Cont", "header",
|
||||
fragment="StdTraits",
|
||||
fragment="SwigSciIterator_T")
|
||||
fragment="SwigSciIterator_T",
|
||||
fragment=SWIG_Traits_Sequence_frag(ptr),
|
||||
fragment=SWIG_Traits_SequenceItem_frag(ptr))
|
||||
{
|
||||
namespace swig
|
||||
{
|
||||
|
|
@ -334,8 +336,7 @@ namespace swig
|
|||
|
||||
%fragment("StdSequenceTraits","header",
|
||||
fragment="StdTraits",
|
||||
fragment="SciSequence_Cont",
|
||||
fragment=SWIG_Traits_SequenceItem_frag(ptr))
|
||||
fragment="SciSequence_Cont")
|
||||
{
|
||||
namespace swig {
|
||||
template <class SciSeq, class Seq>
|
||||
|
|
|
|||
|
|
@ -446,36 +446,81 @@ int SWIG_this(SWIG_GatewayParameters) {
|
|||
extern "C"
|
||||
#endif
|
||||
int SWIG_ptr(SWIG_GatewayParameters) {
|
||||
void *ptrValue = NULL;
|
||||
double dValue = 0;
|
||||
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, ptrValue, NULL, 0, NULL));
|
||||
}
|
||||
else {
|
||||
int *piAddr;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
|
||||
if(sciErr.iErr) {
|
||||
if (SWIG_NbInputArgument(pvApiCtx) > 0) {
|
||||
SciErr sciErr;
|
||||
int *piAddrVar1 = NULL;
|
||||
int iTypeVar1 = 0;
|
||||
char *pstInputPtrTypeName = NULL;
|
||||
char *pstOutputMListTypeName = NULL;
|
||||
if (SWIG_NbInputArgument(pvApiCtx) > 2) {
|
||||
int *piAddrVar2 = NULL;
|
||||
int *piAddrVar3 = NULL;
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrVar2);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (getAllocatedSingleString(pvApiCtx, piAddrVar2, &pstInputPtrTypeName)) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddrVar3);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (getAllocatedSingleString(pvApiCtx, piAddrVar3, &pstOutputMListTypeName)) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrVar1);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (getScalarDouble(pvApiCtx, piAddr, &dValue) == 0) {
|
||||
if (dValue != (uintptr_t)dValue) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_ValueError;
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar1, &iTypeVar1);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if ((iTypeVar1 == sci_pointer) || (iTypeVar1 == sci_mlist)) {
|
||||
void *ptrValue = NULL;
|
||||
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, (char *) "SWIG_ptr") == SWIG_OK) {
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, ptrValue, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, pstOutputMListTypeName));
|
||||
}
|
||||
if ((dValue < 0) || (dValue > ULONG_MAX)) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_OverflowError;
|
||||
else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
else if (iTypeVar1 == sci_matrix) {
|
||||
double dValue = 0;
|
||||
if (getScalarDouble(pvApiCtx, piAddrVar1, &dValue) == 0) {
|
||||
if (dValue != (uintptr_t)dValue) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_ValueError;
|
||||
}
|
||||
if ((dValue < 0) || (dValue > ULONG_MAX)) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_OverflowError;
|
||||
}
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, SWIG_Scilab_TypeQuery(pstInputPtrTypeName), 0, pstOutputMListTypeName));
|
||||
}
|
||||
else {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL));
|
||||
}
|
||||
else {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A pointer or a double expected.\n"), "SWIG_ptr", 1);
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A mlist, pointer or a double expected.\n"), (char *) "SWIG_ptr", 1);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: A mlist, pointer, or a double expected.\n"), "SWIG_ptr", 1);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@ SWIG_Scilab_SetModule(swig_module_info *swig_module) {
|
|||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_Scilab_TypeQuery(const char *name) {
|
||||
if (SWIG_Module_Initialized()) {
|
||||
return SWIG_TypeQuery(name);
|
||||
if (name) {
|
||||
return SWIG_TypeQuery(name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SWIG_Error(SWIG_RuntimeError, "the module is not initialized");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace swig {
|
|||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr(const SwigSciObject& obj, Type **val) {
|
||||
Type *p;
|
||||
Type *p = 0;
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
|
|
@ -104,23 +104,21 @@ namespace swig {
|
|||
|
||||
template <class Type>
|
||||
struct traits_as<Type, value_category> {
|
||||
static Type as(const SwigSciObject& obj, bool throw_error) {
|
||||
static Type as(const SwigSciObject& obj) {
|
||||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return v;
|
||||
} else {
|
||||
%type_error(swig::type_name<Type>());
|
||||
if (throw_error)
|
||||
throw std::invalid_argument("bad type");
|
||||
return res;
|
||||
%type_error(swig::type_name<Type>());
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<Type, pointer_category> {
|
||||
static Type as(const SwigSciObject& obj, bool throw_error) {
|
||||
static Type as(const SwigSciObject& obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res) && v) {
|
||||
|
|
@ -132,36 +130,29 @@ namespace swig {
|
|||
return *v;
|
||||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
%type_error(swig::type_name<Type>());
|
||||
if (throw_error)
|
||||
throw std::invalid_argument("bad type");
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
%type_error(swig::type_name<Type>());
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_as<Type*, pointer_category> {
|
||||
static Type* as(const SwigSciObject& obj, bool throw_error) {
|
||||
static Type* as(const SwigSciObject& obj) {
|
||||
Type *v = 0;
|
||||
int res = traits_asptr<Type>::asptr(obj, &v);
|
||||
if (SWIG_IsOK(res)) {
|
||||
return v;
|
||||
} else {
|
||||
%type_error(swig::type_name<Type>());
|
||||
if (throw_error)
|
||||
throw std::invalid_argument("bad type");
|
||||
return SWIG_OK;
|
||||
%type_error(swig::type_name<Type>());
|
||||
throw std::invalid_argument("bad type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline Type as(const SwigSciObject& obj, bool te = false) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj, te);
|
||||
inline Type as(const SwigSciObject& obj) {
|
||||
return traits_as<Type, typename traits<Type>::category>::as(obj);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#define SWIG_Object int
|
||||
|
||||
#define %append_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
|
||||
#define %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by the the function name
|
||||
#define %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by the function name
|
||||
#define %raise(obj, type, desc) SWIG_Scilab_Raise(obj, type, desc)
|
||||
#define %set_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
|
||||
#define %set_varoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ SWIG_AsPtr_dec(std::basic_string<char>)(int _iVar, std::basic_string<char> **_ps
|
|||
delete[] buf;
|
||||
}
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (_pstValue) {
|
||||
*_pstValue = NULL;
|
||||
}
|
||||
|
|
|
|||
2
Lib/scilab/std_shared_ptr.i
Normal file
2
Lib/scilab/std_shared_ptr.i
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define SWIG_SHARED_PTR_NAMESPACE std
|
||||
%include <boost_shared_ptr.i>
|
||||
|
|
@ -49,12 +49,10 @@ struct SWIG_null_deleter {
|
|||
}
|
||||
|
||||
|
||||
// Workaround empty first macro argument bug
|
||||
#define SWIGEMPTYHACK
|
||||
// Main user macro for defining shared_ptr typemaps for both const and non-const pointer types
|
||||
%define %shared_ptr(TYPE...)
|
||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
|
||||
SWIG_SHARED_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
|
||||
SWIG_SHARED_PTR_TYPEMAPS(, TYPE)
|
||||
SWIG_SHARED_PTR_TYPEMAPS(const, TYPE)
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -309,11 +309,13 @@ static int NAME(TYPE x) {
|
|||
|
||||
%define %$classname %$ismember,"match$parentNode$name" %enddef
|
||||
%define %$isnested "match$nested"="1" %enddef
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Include all the warnings labels and macros
|
||||
* Common includes for warning labels, macros, fragments etc
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <swigwarnings.swg>
|
||||
%include <swigfragments.swg>
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Overloading support
|
||||
|
|
|
|||
86
Lib/swigfragments.swg
Normal file
86
Lib/swigfragments.swg
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* swigfragments.swg
|
||||
*
|
||||
* Common fragments
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Fragments for C header files
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%fragment("<float.h>", "header") %{
|
||||
#include <float.h>
|
||||
%}
|
||||
|
||||
/* Default compiler options for gcc allow long_long but not LLONG_MAX.
|
||||
* Define SWIG_NO_LLONG_MAX if this added limits support is not wanted. */
|
||||
%fragment("<limits.h>", "header") %{
|
||||
#include <limits.h>
|
||||
#if !defined(SWIG_NO_LLONG_MAX)
|
||||
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
||||
# endif
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("<math.h>", "header") %{
|
||||
#include <math.h>
|
||||
%}
|
||||
|
||||
%fragment("<stddef.h>", "header") %{
|
||||
#include <stddef.h>
|
||||
%}
|
||||
|
||||
%fragment("<stdio.h>", "header") %{
|
||||
#include <stdio.h>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
|
||||
# ifndef snprintf
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("<stdlib.h>", "header") %{
|
||||
#include <stdlib.h>
|
||||
#ifdef _MSC_VER
|
||||
# ifndef strtoull
|
||||
# define strtoull _strtoui64
|
||||
# endif
|
||||
# ifndef strtoll
|
||||
# define strtoll _strtoi64
|
||||
# endif
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("<wchar.h>", "header") %{
|
||||
#include <wchar.h>
|
||||
#include <limits.h>
|
||||
#ifndef WCHAR_MIN
|
||||
# define WCHAR_MIN 0
|
||||
#endif
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX 65535
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Fragments for C++ header files
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%fragment("<algorithm>", "header") %{
|
||||
#include <algorithm>
|
||||
%}
|
||||
|
||||
%fragment("<stdexcept>", "header") %{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("<string>", "header") %{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%fragment("<memory>", "header") %{
|
||||
#include <memory>
|
||||
%}
|
||||
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