upgrade node and swig
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,104 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cdata.i
|
||||
*
|
||||
* SWIG library file containing macros for manipulating raw C data as strings.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
typedef struct SWIGCDATA {
|
||||
char *data;
|
||||
int len;
|
||||
} SWIGCDATA;
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Typemaps for returning binary data
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if SWIGGUILE
|
||||
%typemap(out) SWIGCDATA {
|
||||
$result = scm_from_locale_stringn($1.data,$1.len);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGPHP7
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
ZVAL_STRINGL($result, $1.data, $1.len);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGJAVA
|
||||
|
||||
%apply (char *STRING, int LENGTH) { (const void *indata, int inlen) }
|
||||
%typemap(jni) SWIGCDATA "jbyteArray"
|
||||
%typemap(jtype) SWIGCDATA "byte[]"
|
||||
%typemap(jstype) SWIGCDATA "byte[]"
|
||||
%fragment("SWIG_JavaArrayOutCDATA", "header") {
|
||||
static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) {
|
||||
jbyte *arr;
|
||||
int i;
|
||||
jbyteArray jresult = JCALL1(NewByteArray, jenv, sz);
|
||||
if (!jresult)
|
||||
return NULL;
|
||||
arr = JCALL2(GetByteArrayElements, jenv, jresult, 0);
|
||||
if (!arr)
|
||||
return NULL;
|
||||
for (i=0; i<sz; i++)
|
||||
arr[i] = (jbyte)result[i];
|
||||
JCALL3(ReleaseByteArrayElements, jenv, jresult, arr, 0);
|
||||
return jresult;
|
||||
}
|
||||
}
|
||||
%typemap(out, fragment="SWIG_JavaArrayOutCDATA") SWIGCDATA
|
||||
%{$result = SWIG_JavaArrayOutCDATA(jenv, (char *)$1.data, $1.len); %}
|
||||
%typemap(javaout) SWIGCDATA {
|
||||
return $jnicall;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %cdata(TYPE [, NAME])
|
||||
*
|
||||
* Convert raw C data to a binary string.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %cdata(TYPE,NAME...)
|
||||
|
||||
%insert("header") {
|
||||
#if #NAME == ""
|
||||
static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) {
|
||||
#else
|
||||
static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) {
|
||||
#endif
|
||||
SWIGCDATA d;
|
||||
d.data = (char *) ptr;
|
||||
#if #TYPE != "void"
|
||||
d.len = nelements*sizeof(TYPE);
|
||||
#else
|
||||
d.len = nelements;
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(default) int nelements "$1 = 1;"
|
||||
|
||||
#if #NAME == ""
|
||||
SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
|
||||
#else
|
||||
SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements);
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%typemap(default) int nelements;
|
||||
|
||||
%rename(cdata) ::cdata_void(void *ptr, int nelements);
|
||||
|
||||
%cdata(void);
|
||||
|
||||
/* Memory move function. Due to multi-argument typemaps this appears to be wrapped as
|
||||
void memmove(void *data, const char *s); */
|
||||
void memmove(void *data, const void *indata, int inlen);
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
The typemaps here allow to handle functions returning std::auto_ptr<>,
|
||||
which is the most common use of this type. If you have functions taking it
|
||||
as parameter, these typemaps can't be used for them and you need to do
|
||||
something else (e.g. use shared_ptr<> which SWIG supports fully).
|
||||
*/
|
||||
|
||||
%define %auto_ptr(TYPE)
|
||||
%typemap (ctype) std::auto_ptr<TYPE > "void *"
|
||||
%typemap (imtype, out="System.IntPtr") std::auto_ptr<TYPE > "HandleRef"
|
||||
%typemap (cstype) std::auto_ptr<TYPE > "$typemap(cstype, TYPE)"
|
||||
%typemap (out) std::auto_ptr<TYPE > %{
|
||||
$result = (void *)$1.release();
|
||||
%}
|
||||
%typemap(csout, excode=SWIGEXCODE) std::auto_ptr<TYPE > {
|
||||
System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%template() std::auto_ptr<TYPE >;
|
||||
%enddef
|
||||
|
||||
namespace std {
|
||||
template <class T> class auto_ptr {};
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_wstring.i
|
||||
*
|
||||
* Typemaps for std::wstring and const std::wstring&
|
||||
* These are mapped to a C# String and are passed around by value.
|
||||
*
|
||||
* To use non-const std::wstring references use the following %apply. Note
|
||||
* that they are passed by value.
|
||||
* %apply const std::wstring & {std::wstring &};
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <wchar.i>
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
%naturalvar wstring;
|
||||
|
||||
class wstring;
|
||||
|
||||
// wstring
|
||||
%typemap(ctype, out="void *") wstring "wchar_t *"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
|
||||
%typemap(cstype) wstring "string"
|
||||
%typemap(csdirectorin) wstring "$iminput"
|
||||
%typemap(csdirectorout) wstring "$cscall"
|
||||
|
||||
%typemap(in, canthrow=1) wstring
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
$1.assign($input); %}
|
||||
%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
|
||||
|
||||
%typemap(directorout, canthrow=1) wstring
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
$result.assign($input); %}
|
||||
|
||||
%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
|
||||
|
||||
%typemap(csin) wstring "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) wstring {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(typecheck) wstring = wchar_t *;
|
||||
|
||||
%typemap(throws, canthrow=1) wstring
|
||||
%{ std::string message($1.begin(), $1.end());
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
|
||||
return $null; %}
|
||||
|
||||
// const wstring &
|
||||
%typemap(ctype, out="void *") const wstring & "wchar_t *"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string"
|
||||
%typemap(cstype) const wstring & "string"
|
||||
|
||||
%typemap(csdirectorin) const wstring & "$iminput"
|
||||
%typemap(csdirectorout) const wstring & "$cscall"
|
||||
|
||||
%typemap(in, canthrow=1) const wstring &
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
std::wstring $1_str($input);
|
||||
$1 = &$1_str; %}
|
||||
%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %}
|
||||
|
||||
%typemap(csin) const wstring & "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) const wstring & {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring &
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
|
||||
return $null;
|
||||
}
|
||||
/* possible thread/reentrant code problem */
|
||||
static std::wstring $1_str;
|
||||
$1_str = $input;
|
||||
$result = &$1_str; %}
|
||||
|
||||
%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
|
||||
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{
|
||||
get {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(typecheck) const wstring & = wchar_t *;
|
||||
|
||||
%typemap(throws, canthrow=1) const wstring &
|
||||
%{ std::string message($1.begin(), $1.end());
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
|
||||
return $null; %}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* wchar.i
|
||||
*
|
||||
* Typemaps for the wchar_t type
|
||||
* These are mapped to a C# String and are passed around by value.
|
||||
*
|
||||
* Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if !defined(SWIG_CSHARP_NO_WSTRING_HELPER)
|
||||
#if !defined(SWIG_CSHARP_WSTRING_HELPER_)
|
||||
#define SWIG_CSHARP_WSTRING_HELPER_
|
||||
%insert(runtime) %{
|
||||
/* Callback for returning strings to C# without leaking memory */
|
||||
typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *);
|
||||
static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
|
||||
%}
|
||||
|
||||
%pragma(csharp) imclasscode=%{
|
||||
protected class SWIGWStringHelper {
|
||||
|
||||
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
|
||||
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
|
||||
public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
|
||||
|
||||
static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) {
|
||||
return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
|
||||
}
|
||||
|
||||
static SWIGWStringHelper() {
|
||||
SWIGRegisterWStringCallback_$module(wstringDelegate);
|
||||
}
|
||||
}
|
||||
|
||||
static protected SWIGWStringHelper swigWStringHelper = new SWIGWStringHelper();
|
||||
%}
|
||||
|
||||
%insert(runtime) %{
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) {
|
||||
SWIG_csharp_wstring_callback = callback;
|
||||
}
|
||||
%}
|
||||
#endif // SWIG_CSHARP_WSTRING_HELPER_
|
||||
#endif // SWIG_CSHARP_NO_WSTRING_HELPER
|
||||
|
||||
|
||||
// wchar_t
|
||||
%typemap(ctype) wchar_t "wchar_t"
|
||||
%typemap(imtype) wchar_t "char"
|
||||
%typemap(cstype) wchar_t "char"
|
||||
|
||||
%typemap(csin) wchar_t "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) wchar_t {
|
||||
char ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t %{
|
||||
get {
|
||||
char ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(in) wchar_t %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) wchar_t %{ $result = (wchar_t)$1; %}
|
||||
|
||||
%typemap(typecheck) wchar_t = char;
|
||||
|
||||
// wchar_t *
|
||||
%typemap(ctype) wchar_t * "wchar_t *"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string"
|
||||
%typemap(cstype) wchar_t * "string"
|
||||
|
||||
%typemap(csin) wchar_t * "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) wchar_t * {
|
||||
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
|
||||
get {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %}
|
||||
|
||||
%typemap(typecheck) wchar_t * = char *;
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cdata.i
|
||||
*
|
||||
* SWIG library file containing macros for manipulating raw C data as strings.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
typedef struct SWIGCDATA {
|
||||
char *data;
|
||||
intgo len;
|
||||
} SWIGCDATA;
|
||||
%}
|
||||
|
||||
%fragment("cdata", "header") %{
|
||||
struct swigcdata {
|
||||
intgo size;
|
||||
void *data;
|
||||
};
|
||||
%}
|
||||
|
||||
%typemap(gotype) SWIGCDATA "[]byte"
|
||||
|
||||
%typemap(imtype) SWIGCDATA "uint64"
|
||||
|
||||
%typemap(out, fragment="cdata") SWIGCDATA(struct swigcdata *swig_out) %{
|
||||
swig_out = (struct swigcdata *)malloc(sizeof(*swig_out));
|
||||
if (swig_out) {
|
||||
swig_out->size = $1.len;
|
||||
swig_out->data = malloc(swig_out->size);
|
||||
if (swig_out->data) {
|
||||
memcpy(swig_out->data, $1.data, swig_out->size);
|
||||
}
|
||||
}
|
||||
$result = *(long long *)(void **)&swig_out;
|
||||
%}
|
||||
|
||||
%typemap(goout) SWIGCDATA %{
|
||||
{
|
||||
type swigcdata struct { size int; data uintptr }
|
||||
p := (*swigcdata)(unsafe.Pointer(uintptr($1)))
|
||||
if p == nil || p.data == 0 {
|
||||
$result = nil
|
||||
} else {
|
||||
b := make([]byte, p.size)
|
||||
a := (*[0x7fffffff]byte)(unsafe.Pointer(p.data))[:p.size]
|
||||
copy(b, a)
|
||||
Swig_free(p.data)
|
||||
Swig_free(uintptr(unsafe.Pointer(p)))
|
||||
$result = b
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %cdata(TYPE [, NAME])
|
||||
*
|
||||
* Convert raw C data to a binary string.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %cdata(TYPE,NAME...)
|
||||
|
||||
%insert("header") {
|
||||
#if #NAME == ""
|
||||
static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) {
|
||||
#else
|
||||
static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) {
|
||||
#endif
|
||||
SWIGCDATA d;
|
||||
d.data = (char *) ptr;
|
||||
#if #TYPE != "void"
|
||||
d.len = nelements*sizeof(TYPE);
|
||||
#else
|
||||
d.len = nelements;
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(default) int nelements "$1 = 1;"
|
||||
|
||||
#if #NAME == ""
|
||||
SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
|
||||
#else
|
||||
SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements);
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%typemap(default) int nelements;
|
||||
|
||||
%rename(cdata) ::cdata_void(void *ptr, int nelements);
|
||||
|
||||
%cdata(void);
|
||||
|
||||
/* Memory move function. Due to multi-argument typemaps this appears
|
||||
to be wrapped as
|
||||
void memmove(void *data, const char *s); */
|
||||
void memmove(void *data, char *indata, int inlen);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
The typemaps here allow to handle functions returning std::auto_ptr<>,
|
||||
which is the most common use of this type. If you have functions taking it
|
||||
as parameter, these typemaps can't be used for them and you need to do
|
||||
something else (e.g. use shared_ptr<> which SWIG supports fully).
|
||||
*/
|
||||
|
||||
%define %auto_ptr(TYPE)
|
||||
%typemap (jni) std::auto_ptr<TYPE > "jlong"
|
||||
%typemap (jtype) std::auto_ptr<TYPE > "long"
|
||||
%typemap (jstype) std::auto_ptr<TYPE > "$typemap(jstype, TYPE)"
|
||||
|
||||
%typemap (out) std::auto_ptr<TYPE > %{
|
||||
jlong lpp = 0;
|
||||
*(TYPE**) &lpp = $1.release();
|
||||
$result = lpp;
|
||||
%}
|
||||
%typemap(javaout) std::auto_ptr<TYPE > {
|
||||
long cPtr = $jnicall;
|
||||
return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true);
|
||||
}
|
||||
%template() std::auto_ptr<TYPE >;
|
||||
%enddef
|
||||
|
||||
namespace std {
|
||||
template <class T> class auto_ptr {};
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* arrays_javascript.i
|
||||
*
|
||||
* These typemaps give more natural support for arrays. The typemaps are not efficient
|
||||
* as there is a lot of copying of the array values whenever the array is passed to C/C++
|
||||
* from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array.
|
||||
* An exception is thrown if they are not.
|
||||
*
|
||||
* Example usage:
|
||||
* Wrapping:
|
||||
*
|
||||
* %include <arrays_javascript.i>
|
||||
* %inline %{
|
||||
* extern int FiddleSticks[3];
|
||||
* %}
|
||||
*
|
||||
* Use from JavaScript like this:
|
||||
*
|
||||
* var fs = [10, 11, 12];
|
||||
* example.FiddleSticks = fs;
|
||||
* fs = example.FiddleSticks;
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
|
||||
%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {}
|
||||
|
||||
%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
|
||||
(int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
|
||||
if (JSValueIsObject(context, $input))
|
||||
{
|
||||
// Convert into Array
|
||||
array = JSValueToObject(context, $input, NULL);
|
||||
|
||||
length = $1_dim0;
|
||||
|
||||
$1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
|
||||
|
||||
// Get each element from array
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
|
||||
|
||||
// Get primitive value from JSObject
|
||||
res = SWIG_AsVal(int)(jsvalue, &temp);
|
||||
if (!SWIG_IsOK(res))
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
|
||||
}
|
||||
arg$argnum[i] = temp;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) int[], int[ANY] {
|
||||
free($1);
|
||||
}
|
||||
|
||||
%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0)
|
||||
{
|
||||
length = $1_dim0;
|
||||
JSValueRef values[length];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
values[i] = SWIG_From(int)($1[i]);
|
||||
}
|
||||
|
||||
$result = JSObjectMakeArray(context, length, values, NULL);
|
||||
}
|
||||
|
||||
%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY]
|
||||
(int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
|
||||
if (JSValueIsObject(context, $input))
|
||||
{
|
||||
// Convert into Array
|
||||
array = JSValueToObject(context, $input, NULL);
|
||||
|
||||
length = $1_dim0;
|
||||
|
||||
$1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
|
||||
|
||||
// Get each element from array
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL);
|
||||
|
||||
// Get primitive value from JSObject
|
||||
res = SWIG_AsVal(double)(jsvalue, &temp);
|
||||
if (!SWIG_IsOK(res))
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
|
||||
}
|
||||
arg$argnum[i] = temp;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) double[], double[ANY] {
|
||||
free($1);
|
||||
}
|
||||
|
||||
%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
|
||||
{
|
||||
length = $1_dim0;
|
||||
JSValueRef values[length];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
values[i] = SWIG_From(double)($1[i]);
|
||||
}
|
||||
|
||||
$result = JSObjectMakeArray(context, length, values, NULL);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
#define JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
|
||||
/* Warnings for Java keywords */
|
||||
#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x`
|
||||
|
||||
/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */
|
||||
|
||||
JAVASCRIPTKW(break);
|
||||
JAVASCRIPTKW(case);
|
||||
JAVASCRIPTKW(catch);
|
||||
JAVASCRIPTKW(continue);
|
||||
JAVASCRIPTKW(default);
|
||||
JAVASCRIPTKW(delete);
|
||||
JAVASCRIPTKW(do);
|
||||
JAVASCRIPTKW(else);
|
||||
JAVASCRIPTKW(finally);
|
||||
JAVASCRIPTKW(for);
|
||||
JAVASCRIPTKW(function);
|
||||
JAVASCRIPTKW(if);
|
||||
JAVASCRIPTKW(in);
|
||||
JAVASCRIPTKW(instanceof);
|
||||
JAVASCRIPTKW(new);
|
||||
JAVASCRIPTKW(return);
|
||||
JAVASCRIPTKW(switch);
|
||||
JAVASCRIPTKW(this);
|
||||
JAVASCRIPTKW(throw);
|
||||
JAVASCRIPTKW(try);
|
||||
JAVASCRIPTKW(typeof);
|
||||
JAVASCRIPTKW(var);
|
||||
JAVASCRIPTKW(void);
|
||||
JAVASCRIPTKW(while);
|
||||
JAVASCRIPTKW(with);
|
||||
|
||||
/* others bad names if any*/
|
||||
// for example %namewarn("321:clone() is a javascript bad method name") *::clone();
|
||||
|
||||
#undef JAVASCRIPTKW
|
||||
|
||||
#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
@@ -1,81 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_map.i
|
||||
*
|
||||
* SWIG typemaps for std::map
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::map
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// exported class
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
// add typemaps here
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
|
||||
map();
|
||||
map(const map& other);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
void set(const K& key, const T& x) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
self->erase(i);
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
bool has_key(const K& key) {
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Legacy macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
|
||||
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* arrays_javascript.i
|
||||
*
|
||||
* These typemaps give more natural support for arrays. The typemaps are not efficient
|
||||
* as there is a lot of copying of the array values whenever the array is passed to C/C++
|
||||
* from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array.
|
||||
* An exception is thrown if they are not.
|
||||
*
|
||||
* Example usage:
|
||||
* Wrapping:
|
||||
*
|
||||
* %include <arrays_javascript.i>
|
||||
* %inline %{
|
||||
* extern int FiddleSticks[3];
|
||||
* %}
|
||||
*
|
||||
* Use from JavaScript like this:
|
||||
*
|
||||
* var fs = [10, 11, 12];
|
||||
* example.FiddleSticks = fs;
|
||||
* fs = example.FiddleSticks;
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {}
|
||||
%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {}
|
||||
|
||||
%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY]
|
||||
(int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
|
||||
if ($input->IsArray())
|
||||
{
|
||||
// Convert into Array
|
||||
array = v8::Local<v8::Array>::Cast($input);
|
||||
|
||||
length = $1_dim0;
|
||||
|
||||
$1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
|
||||
|
||||
// Get each element from array
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
jsvalue = array->Get(i);
|
||||
|
||||
// Get primitive value from JSObject
|
||||
res = SWIG_AsVal(int)(jsvalue, &temp);
|
||||
if (!SWIG_IsOK(res))
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
|
||||
}
|
||||
arg$argnum[i] = temp;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) int[], int[ANY] {
|
||||
free($1);
|
||||
}
|
||||
|
||||
%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0)
|
||||
{
|
||||
length = $1_dim0;
|
||||
v8::Local<v8::Array> array = v8::Array::New(length);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
array->Set(i, SWIG_From(int)($1[i]));
|
||||
}
|
||||
|
||||
|
||||
$result = array;
|
||||
}
|
||||
|
||||
%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY]
|
||||
(int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) {
|
||||
if ($input->IsArray())
|
||||
{
|
||||
// Convert into Array
|
||||
array = v8::Local<v8::Array>::Cast($input);
|
||||
|
||||
length = $1_dim0;
|
||||
|
||||
$1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length);
|
||||
|
||||
// Get each element from array
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
jsvalue = array->Get(i);
|
||||
|
||||
// Get primitive value from JSObject
|
||||
res = SWIG_AsVal(double)(jsvalue, &temp);
|
||||
if (!SWIG_IsOK(res))
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double");
|
||||
}
|
||||
arg$argnum[i] = temp;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) double[], double[ANY] {
|
||||
free($1);
|
||||
}
|
||||
|
||||
%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0)
|
||||
{
|
||||
length = $1_dim0;
|
||||
v8::Local<v8::Array> array = v8::Array::New(length);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
array->Set(i, SWIG_From(double)($1[i]));
|
||||
}
|
||||
|
||||
|
||||
$result = array;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ccomplex.i
|
||||
*
|
||||
* C complex typemaps
|
||||
* ISO C99: 7.3 Complex arithmetic <complex.h>
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%include <javscriptcomplex.swg>
|
||||
|
||||
%{
|
||||
#include <complex.h>
|
||||
%}
|
||||
|
||||
|
||||
/* C complex constructor */
|
||||
#define CCplxConst(r, i) ((r) + I*(i))
|
||||
|
||||
%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
|
||||
%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
|
||||
|
||||
/* declaring the typemaps */
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
|
||||
%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,112 +0,0 @@
|
||||
%insert(runtime) %{
|
||||
|
||||
// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
typedef v8::InvocationCallback SwigV8FunctionCallback;
|
||||
typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
|
||||
typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
typedef v8::FunctionCallback SwigV8FunctionCallback;
|
||||
typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
|
||||
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
|
||||
#else
|
||||
typedef v8::FunctionCallback SwigV8FunctionCallback;
|
||||
typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
|
||||
typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
|
||||
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a class template for a class with specified initialization function.
|
||||
*/
|
||||
SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
|
||||
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
|
||||
inst_templ->SetInternalFieldCount(1);
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
|
||||
equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
|
||||
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
|
||||
|
||||
SWIGV8_ESCAPE(class_templ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class method with given name for a given class template.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
|
||||
SwigV8FunctionCallback _func) {
|
||||
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
|
||||
proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class property with given name for a given class template.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
|
||||
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
|
||||
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
|
||||
proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class method with given name for a given object.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
|
||||
const SwigV8FunctionCallback& _func) {
|
||||
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class method with given name for a given object.
|
||||
*/
|
||||
SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
|
||||
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
|
||||
#else
|
||||
obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
|
||||
#else
|
||||
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
|
||||
#endif
|
||||
{
|
||||
char buffer[256];
|
||||
char msg[512];
|
||||
int res;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
property->WriteUtf8(buffer, 256);
|
||||
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
|
||||
#else
|
||||
v8::Local<v8::String> sproperty;
|
||||
if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
|
||||
SWIGV8_WRITE_UTF8(sproperty, buffer, 256);
|
||||
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
|
||||
}
|
||||
else {
|
||||
res = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(res<0) {
|
||||
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
|
||||
} else {
|
||||
SWIG_exception(SWIG_ERROR, msg);
|
||||
}
|
||||
fail: ;
|
||||
}
|
||||
|
||||
%} // v8_helper_functions
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
#define JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
|
||||
/* Warnings for Java keywords */
|
||||
#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x`
|
||||
|
||||
/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */
|
||||
|
||||
JAVASCRIPTKW(break);
|
||||
JAVASCRIPTKW(case);
|
||||
JAVASCRIPTKW(catch);
|
||||
JAVASCRIPTKW(continue);
|
||||
JAVASCRIPTKW(default);
|
||||
JAVASCRIPTKW(delete);
|
||||
JAVASCRIPTKW(do);
|
||||
JAVASCRIPTKW(else);
|
||||
JAVASCRIPTKW(finally);
|
||||
JAVASCRIPTKW(for);
|
||||
JAVASCRIPTKW(function);
|
||||
JAVASCRIPTKW(if);
|
||||
JAVASCRIPTKW(in);
|
||||
JAVASCRIPTKW(instanceof);
|
||||
JAVASCRIPTKW(new);
|
||||
JAVASCRIPTKW(return);
|
||||
JAVASCRIPTKW(switch);
|
||||
JAVASCRIPTKW(this);
|
||||
JAVASCRIPTKW(throw);
|
||||
JAVASCRIPTKW(try);
|
||||
JAVASCRIPTKW(typeof);
|
||||
JAVASCRIPTKW(var);
|
||||
JAVASCRIPTKW(void);
|
||||
JAVASCRIPTKW(while);
|
||||
JAVASCRIPTKW(with);
|
||||
|
||||
/* others bad names if any*/
|
||||
// for example %namewarn("321:clone() is a javascript bad method name") *::clone();
|
||||
|
||||
#undef JAVASCRIPTKW
|
||||
|
||||
#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_
|
||||
@@ -1,675 +0,0 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* These typedefs and defines are used to deal with v8 API changes
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
// First v8 version that uses "SetWeak" and not "MakeWeak"
|
||||
|
||||
#define SWIGV8_SETWEAK_VERSION 0x032224
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
|
||||
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
|
||||
#else
|
||||
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
typedef v8::Handle<v8::Value> SwigV8ReturnValue;
|
||||
typedef v8::Arguments SwigV8Arguments;
|
||||
typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
|
||||
#define SWIGV8_RETURN(val) return scope.Close(val)
|
||||
#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val)
|
||||
#else
|
||||
typedef void SwigV8ReturnValue;
|
||||
typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments;
|
||||
typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
||||
#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
|
||||
#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117)
|
||||
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
|
||||
#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
|
||||
#define SWIGV8_ESCAPE(val) return scope.Close(val)
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
|
||||
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_ESCAPE(val) return scope.Close(val)
|
||||
#else
|
||||
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent());
|
||||
#define SWIGV8_ESCAPE(val) return scope.Escape(val)
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
|
||||
#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size)
|
||||
#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
|
||||
#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::New(str)
|
||||
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
|
||||
#else
|
||||
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
|
||||
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
|
||||
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
|
||||
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
|
||||
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
|
||||
#define SWIGV8_ARRAY_NEW() v8::Array::New()
|
||||
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool)
|
||||
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
|
||||
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
|
||||
#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New()
|
||||
#define SWIGV8_INT32_NEW(num) v8::Int32::New(num)
|
||||
#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num)
|
||||
#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num)
|
||||
#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num)
|
||||
#define SWIGV8_OBJECT_NEW() v8::Object::New()
|
||||
#define SWIGV8_UNDEFINED() v8::Undefined()
|
||||
#define SWIGV8_NULL() v8::Null()
|
||||
#else
|
||||
#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
|
||||
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
|
||||
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func)
|
||||
#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_INT32_NEW(num) v8::Int32::New(v8::Isolate::GetCurrent(), num)
|
||||
#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(v8::Isolate::GetCurrent(), num)
|
||||
#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), num)
|
||||
#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num)
|
||||
#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
|
||||
#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent())
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(class);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), class);
|
||||
#else
|
||||
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
|
||||
#endif
|
||||
|
||||
#ifdef NODE_VERSION
|
||||
#if NODE_VERSION_AT_LEAST(10, 12, 0)
|
||||
#define SWIG_NODE_AT_LEAST_1012
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Necessary to check Node.js version because V8 API changes are backported in Node.js
|
||||
#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \
|
||||
(!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7)
|
||||
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
|
||||
#define SWIGV8_TO_STRING(handle) (handle)->ToString()
|
||||
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
|
||||
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue()
|
||||
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
|
||||
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
|
||||
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
|
||||
#else
|
||||
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
|
||||
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
|
||||
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
|
||||
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Error handling
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
||||
#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0)
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIGV8_OVERLOAD false
|
||||
|
||||
SWIGINTERN void SWIG_V8_Raise(const char *msg) {
|
||||
SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg)));
|
||||
}
|
||||
|
||||
/*
|
||||
Note: There are two contexts for handling errors.
|
||||
A static V8ErrorHandler is used in not overloaded methods.
|
||||
For overloaded methods the throwing type checking mechanism is used
|
||||
during dispatching. As V8 exceptions can not be reset properly
|
||||
the trick is to use a dynamic ErrorHandler with same local name as the global
|
||||
one.
|
||||
|
||||
- See definition of SWIG_Error above.
|
||||
- See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload',
|
||||
and 'JS_function_dispatch_case' in javascriptcode.swg
|
||||
|
||||
*/
|
||||
class V8ErrorHandler {
|
||||
public:
|
||||
virtual ~V8ErrorHandler() {}
|
||||
virtual void error(int code, const char *msg) {
|
||||
SWIG_V8_Raise(msg);
|
||||
}
|
||||
};
|
||||
// this is used in usually
|
||||
SWIGRUNTIME V8ErrorHandler SWIGV8_ErrorHandler;
|
||||
|
||||
// instances of this are used in overloaded functions
|
||||
class OverloadErrorHandler: public V8ErrorHandler {
|
||||
public:
|
||||
virtual void error(int code, const char *msg) {
|
||||
err = v8::Exception::Error(SWIGV8_STRING_NEW(msg));
|
||||
if(code != SWIG_TypeError) {
|
||||
SWIGV8_THROW_EXCEPTION(err);
|
||||
}
|
||||
}
|
||||
v8::Handle<v8::Value> err;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Basic Proxy object
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
// Note: to trigger the v8 gc more often one can tell v8 about the memory consumption
|
||||
// TODO: we could add a v8 specific parameter to control this value
|
||||
#define SWIGV8_AVG_OBJ_SIZE 1000
|
||||
|
||||
class SWIGV8_Proxy {
|
||||
public:
|
||||
SWIGV8_Proxy(): swigCMemOwn(false), swigCObject(0), info(0) {
|
||||
SWIGV8_ADJUST_MEMORY(SWIGV8_AVG_OBJ_SIZE);
|
||||
};
|
||||
|
||||
~SWIGV8_Proxy() {
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
handle.ClearWeak();
|
||||
handle.Dispose();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
handle.ClearWeak(v8::Isolate::GetCurrent());
|
||||
handle.Dispose(v8::Isolate::GetCurrent());
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
handle.ClearWeak();
|
||||
handle.Dispose();
|
||||
#else
|
||||
handle.ClearWeak();
|
||||
handle.Reset();
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
handle.Clear();
|
||||
#endif
|
||||
|
||||
SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE);
|
||||
}
|
||||
|
||||
bool swigCMemOwn;
|
||||
void *swigCObject;
|
||||
swig_type_info *info;
|
||||
v8::Persistent<v8::Object> handle;
|
||||
};
|
||||
|
||||
class SWIGV8_ClientData {
|
||||
public:
|
||||
v8::Persistent<v8::FunctionTemplate> class_templ;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
void (*dtor) (v8::Persistent< v8::Value> object, void *parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
|
||||
#else
|
||||
void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
|
||||
#endif
|
||||
};
|
||||
|
||||
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
|
||||
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
|
||||
#else
|
||||
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
|
||||
#endif
|
||||
|
||||
if(cdata == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if(cdata->info != info) {
|
||||
swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info);
|
||||
if (!tc && cdata->info->name) {
|
||||
tc = SWIG_TypeCheck(cdata->info->name, info);
|
||||
}
|
||||
bool type_valid = tc != 0;
|
||||
if(!type_valid) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
*ptr = cdata->swigCObject;
|
||||
if(flags & SWIG_POINTER_DISOWN) {
|
||||
cdata->swigCMemOwn = false;
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) {
|
||||
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) {
|
||||
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#else
|
||||
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
|
||||
SWIGV8_Proxy *proxy = data.GetParameter();
|
||||
#endif
|
||||
|
||||
delete proxy;
|
||||
}
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
|
||||
if(!valRef->IsObject()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
|
||||
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
|
||||
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
|
||||
#else
|
||||
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
|
||||
#endif
|
||||
|
||||
if(cdata == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*ptr = cdata->swigCObject;
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
|
||||
cdata->swigCObject = ptr;
|
||||
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
|
||||
cdata->info = info;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
obj->SetPointerInInternalField(0, cdata);
|
||||
#else
|
||||
obj->SetAlignedPointerInInternalField(0, cdata);
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle = v8::Persistent<v8::Object>::New(obj);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
|
||||
#else
|
||||
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
// clientdata must be set for owned data as we need to register the dtor
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
|
||||
} else {
|
||||
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
|
||||
} else {
|
||||
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
|
||||
} else {
|
||||
cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
|
||||
} else {
|
||||
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
|
||||
}
|
||||
#else
|
||||
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
|
||||
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
|
||||
} else {
|
||||
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle.MarkIndependent();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
cdata->handle.MarkIndependent();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
/* special case: JavaScript null => C NULL pointer */
|
||||
if(valRef->IsNull()) {
|
||||
*ptr=0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
if(!valRef->IsObject()) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
|
||||
}
|
||||
|
||||
SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
v8::Handle<v8::FunctionTemplate> class_templ;
|
||||
|
||||
if (ptr == NULL) {
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
SWIGV8_ESCAPE(SWIGV8_NULL());
|
||||
#else
|
||||
v8::Local<v8::Primitive> result = SWIGV8_NULL();
|
||||
SWIGV8_ESCAPE(result);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
if(info->clientdata != 0) {
|
||||
class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
|
||||
} else {
|
||||
class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ;
|
||||
}
|
||||
#else
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
|
||||
if(info->clientdata != 0) {
|
||||
class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, ((SWIGV8_ClientData*) info->clientdata)->class_templ);
|
||||
} else {
|
||||
class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ);
|
||||
}
|
||||
#endif
|
||||
|
||||
// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
|
||||
v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
|
||||
SWIGV8_SetPrivateData(result, ptr, info, flags);
|
||||
|
||||
SWIGV8_ESCAPE(result);
|
||||
}
|
||||
|
||||
#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags)
|
||||
#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags)
|
||||
|
||||
#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags)
|
||||
#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags)
|
||||
|
||||
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_V8_ConvertPtr(obj, pptr, type, 0)
|
||||
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_V8_NewPointerObj(ptr, type, 0)
|
||||
|
||||
#define SWIG_GetInstancePtr(obj, ptr) SWIG_V8_GetInstancePtr(obj, ptr)
|
||||
|
||||
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
void *arg1 = (void *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
bool result;
|
||||
int res1;
|
||||
int res2;
|
||||
|
||||
if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for equals.");
|
||||
|
||||
res1 = SWIG_GetInstancePtr(args.Holder(), &arg1);
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ERROR, "Could not get pointer from 'this' object for equals.");
|
||||
}
|
||||
res2 = SWIG_GetInstancePtr(args[0], &arg2);
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "1"" of type '" "void *""'");
|
||||
}
|
||||
|
||||
result = (bool)(arg1 == arg2);
|
||||
jsresult = SWIGV8_BOOLEAN_NEW(result);
|
||||
|
||||
SWIGV8_RETURN(jsresult);
|
||||
goto fail;
|
||||
fail:
|
||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||
}
|
||||
|
||||
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Value> jsresult;
|
||||
void *arg1 = (void *) 0 ;
|
||||
long result;
|
||||
int res1;
|
||||
|
||||
res1 = SWIG_GetInstancePtr(args.Holder(), &arg1);
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCPtr" "', argument " "1"" of type '" "void *""'");
|
||||
}
|
||||
|
||||
result = (long)arg1;
|
||||
jsresult = SWIGV8_NUMBER_NEW(result);
|
||||
|
||||
SWIGV8_RETURN(jsresult);
|
||||
goto fail;
|
||||
fail:
|
||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* PackedData object
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
class SwigV8PackedData {
|
||||
public:
|
||||
SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(data), size(size), type(type) {};
|
||||
|
||||
~SwigV8PackedData() {
|
||||
};
|
||||
|
||||
void *data;
|
||||
size_t size;
|
||||
swig_type_info *type;
|
||||
|
||||
v8::Persistent<v8::Object> handle;
|
||||
};
|
||||
|
||||
SWIGRUNTIMEINLINE
|
||||
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
if(objRef->InternalFieldCount() < 1) return false;
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
v8::Local<v8::Value> flag;
|
||||
if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
|
||||
return false;
|
||||
#endif
|
||||
return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag));
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
|
||||
if (SwigV8Packed_Check(valRef)) {
|
||||
SWIGV8_HANDLESCOPE();
|
||||
|
||||
SwigV8PackedData *sobj;
|
||||
|
||||
v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
|
||||
sobj = static_cast<SwigV8PackedData*>(v8::External::Unwrap(cdataRef));
|
||||
#else
|
||||
sobj = static_cast<SwigV8PackedData*>(objRef->GetAlignedPointerFromInternalField(0));
|
||||
#endif
|
||||
if (sobj == NULL || sobj->size != size) return 0;
|
||||
memcpy(ptr, sobj->data, size);
|
||||
return sobj->type;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
|
||||
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
|
||||
if (!to) return SWIG_ERROR;
|
||||
if (ty) {
|
||||
if (to != ty) {
|
||||
/* check type cast? */
|
||||
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
|
||||
if (!tc) return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) {
|
||||
SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
|
||||
SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
|
||||
v8::Local<v8::Object> object = data.GetValue();
|
||||
SwigV8PackedData *cdata = data.GetParameter();
|
||||
#else
|
||||
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
|
||||
SwigV8PackedData *cdata = data.GetParameter();
|
||||
#endif
|
||||
|
||||
delete cdata;
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
object.Clear();
|
||||
object.Dispose();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
object.Clear();
|
||||
object.Dispose(isolate);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
object->Dispose(isolate);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
object->Dispose();
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
object.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME
|
||||
v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
|
||||
// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
|
||||
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 5
|
||||
obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
|
||||
#else
|
||||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
|
||||
obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
|
||||
obj->SetPointerInInternalField(0, cdata);
|
||||
#else
|
||||
obj->SetAlignedPointerInInternalField(0, cdata);
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle = v8::Persistent<v8::Object>::New(obj);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
|
||||
cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
|
||||
#else
|
||||
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
|
||||
#endif
|
||||
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
|
||||
cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
|
||||
cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
|
||||
#elif (V8_MAJOR_VERSION-0) < 5
|
||||
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
|
||||
// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
|
||||
#else
|
||||
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
|
||||
#endif
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
|
||||
cdata->handle.MarkIndependent();
|
||||
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
|
||||
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
|
||||
#else
|
||||
cdata->handle.MarkIndependent();
|
||||
#endif
|
||||
|
||||
SWIGV8_ESCAPE(obj);
|
||||
}
|
||||
|
||||
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty)
|
||||
#define SWIG_NewMemberObj(ptr, sz, type) SWIGV8_NewPackedObj(ptr, sz, type)
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg)
|
||||
*
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
SWIGRUNTIME
|
||||
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
|
||||
#else
|
||||
v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
|
||||
#endif
|
||||
SWIGV8_HANDLESCOPE_ESC();
|
||||
|
||||
if (result->IsUndefined()) {
|
||||
result = SWIGV8_ARRAY_NEW();
|
||||
}
|
||||
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
|
||||
v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);
|
||||
#else
|
||||
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
|
||||
#endif
|
||||
arr->Set(arr->Length(), obj);
|
||||
|
||||
SWIGV8_ESCAPE(arr);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* javascriptruntime.swg
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// V8 Version Macro
|
||||
// ----------------
|
||||
//
|
||||
// v8 added version macros V8_MAJOR_VERSION, V8_MINOR_VERSION, V8_BUILD_NUMBER
|
||||
// and V8_PATCH_LEVEL in version 4.3.0. SWIG generated code uses these if
|
||||
// they are defined - to support earlier versions you can specify the V8 version
|
||||
// in use via the command line when you run SWIG:
|
||||
//
|
||||
// swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i
|
||||
//
|
||||
// Or code in the interface file using SWIG_V8_VERSION:
|
||||
//
|
||||
// %begin %{#define SWIG_V8_VERSION 0x031110%}
|
||||
//
|
||||
// This is specified as a hex constant, but the constant is read as pairs of
|
||||
// decimal digits, so for V8 3.25.30 use constant 0x032530. This scheme can't
|
||||
// represent components > 99, but this constant is only useful for V8 < 4.3.0,
|
||||
// and no V8 versions from that era had a component > 99.
|
||||
|
||||
%define %swig_v8_define_version(version)
|
||||
%insert("runtime") %{
|
||||
#ifndef SWIG_V8_VERSION
|
||||
#define SWIG_V8_VERSION version
|
||||
#endif
|
||||
%}
|
||||
%enddef
|
||||
|
||||
#ifdef V8_VERSION
|
||||
%swig_v8_define_version(V8_VERSION)
|
||||
#else
|
||||
// HACK: defining a default version
|
||||
%swig_v8_define_version(0x031110)
|
||||
#endif
|
||||
|
||||
|
||||
// Node support
|
||||
// ------------
|
||||
|
||||
#ifdef BUILDING_NODE_EXTENSION
|
||||
%insert("runtime") %{
|
||||
#include <node.h>
|
||||
//Older version of node.h does not include this
|
||||
#include <node_version.h>
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
// V8 runtime
|
||||
// ----------
|
||||
|
||||
%insert(runtime) %{
|
||||
#include <v8.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||
%insert(runtime) "swigerrors.swg"; /* SWIG errors */
|
||||
|
||||
%insert(runtime) "javascriptrun.swg"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,212 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ocamldec.swg
|
||||
*
|
||||
* Ocaml runtime code -- declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define SWIGEXT extern "C"
|
||||
SWIGEXT {
|
||||
#else
|
||||
#define SWIGEXT
|
||||
#endif
|
||||
#define value caml_value_t
|
||||
#define CAML_VALUE caml_value_t
|
||||
#define CAML_NAME_SPACE
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/custom.h>
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/memory.h>
|
||||
#include <caml/callback.h>
|
||||
#include <caml/fail.h>
|
||||
#include <caml/misc.h>
|
||||
|
||||
#if defined(CAMLassert)
|
||||
/* Both this macro and version.h were introduced in version 4.02.0 */
|
||||
#include <caml/version.h>
|
||||
#else
|
||||
#define OCAML_VERSION 0 /* Unknown, but < 40200 */
|
||||
#endif
|
||||
|
||||
#define caml_array_set swig_caml_array_set
|
||||
|
||||
/* Adapted from memory.h and mlvalues.h */
|
||||
|
||||
#define SWIG_CAMLlocal1(x) \
|
||||
caml_value_t x = 0; \
|
||||
CAMLxparam1 (x)
|
||||
|
||||
#define SWIG_CAMLlocal2(x, y) \
|
||||
caml_value_t x = 0, y = 0; \
|
||||
CAMLxparam2 (x, y)
|
||||
|
||||
#define SWIG_CAMLlocal3(x, y, z) \
|
||||
caml_value_t x = 0, y = 0, z = 0; \
|
||||
CAMLxparam3 (x, y, z)
|
||||
|
||||
#define SWIG_CAMLlocal4(x, y, z, t) \
|
||||
caml_value_t x = 0, y = 0, z = 0, t = 0; \
|
||||
CAMLxparam4 (x, y, z, t)
|
||||
|
||||
#define SWIG_CAMLlocal5(x, y, z, t, u) \
|
||||
caml_value_t x = 0, y = 0, z = 0, t = 0, u = 0; \
|
||||
CAMLxparam5 (x, y, z, t, u)
|
||||
|
||||
#define SWIG_CAMLlocalN(x, size) \
|
||||
caml_value_t x [(size)] = { 0, /* 0, 0, ... */ }; \
|
||||
CAMLxparamN (x, (size))
|
||||
|
||||
#define SWIG_Field(x, i) (((caml_value_t *)(x)) [i]) /* Also an l-value. */
|
||||
#define SWIG_Store_field(block, offset, val) do{ \
|
||||
mlsize_t caml__temp_offset = (offset); \
|
||||
caml_value_t caml__temp_val = (val); \
|
||||
caml_modify (&SWIG_Field ((block), caml__temp_offset), caml__temp_val); \
|
||||
}while(0)
|
||||
|
||||
#define SWIG_Data_custom_val(v) ((void *) &SWIG_Field((v), 1))
|
||||
#ifdef ARCH_BIG_ENDIAN
|
||||
#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-1])
|
||||
/* Also an l-value. */
|
||||
#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [sizeof(caml_value_t)-1])
|
||||
/* Also an l-value. */
|
||||
#else
|
||||
#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-sizeof(caml_value_t)])
|
||||
/* Also an l-value. */
|
||||
#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [0])
|
||||
/* Also an l-value. */
|
||||
#endif
|
||||
|
||||
#ifdef CAMLreturn0
|
||||
#undef CAMLreturn0
|
||||
#endif
|
||||
#define CAMLreturn0 do{ \
|
||||
caml_local_roots = caml__frame; \
|
||||
return; \
|
||||
}while (0)
|
||||
|
||||
#ifdef CAMLreturn
|
||||
#undef CAMLreturn
|
||||
#endif
|
||||
#define CAMLreturn(result) do{ \
|
||||
caml_value_t caml__temp_result = (result); \
|
||||
caml_local_roots = caml__frame; \
|
||||
return (caml__temp_result); \
|
||||
}while(0)
|
||||
|
||||
#define CAMLreturn_type(result) do{ \
|
||||
caml_local_roots = caml__frame; \
|
||||
return result; \
|
||||
}while(0)
|
||||
|
||||
#ifdef CAMLnoreturn
|
||||
#undef CAMLnoreturn
|
||||
#endif
|
||||
#define CAMLnoreturn ((void) caml__frame)
|
||||
|
||||
|
||||
#ifndef ARCH_ALIGN_INT64
|
||||
#if OCAML_VERSION >= 40300
|
||||
#define SWIG_Int64_val(v) (*((int64_t *) SWIG_Data_custom_val(v)))
|
||||
#else
|
||||
#define SWIG_Int64_val(v) (*((int64 *) SWIG_Data_custom_val(v)))
|
||||
#endif
|
||||
#else
|
||||
#if OCAML_VERSION >= 40300
|
||||
CAMLextern int64_t Int64_val(caml_value_t v);
|
||||
#else
|
||||
CAMLextern int64 Int64_val(caml_value_t v);
|
||||
#endif
|
||||
#define SWIG_Int64_val(v) Int64_val(v)
|
||||
#endif
|
||||
|
||||
#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type)
|
||||
#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule(clientdata)
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer)
|
||||
|
||||
typedef enum {
|
||||
SWIG_OCamlArithmeticException,
|
||||
SWIG_OCamlDirectorPureVirtual,
|
||||
SWIG_OCamlOutOfMemoryError,
|
||||
SWIG_OCamlOverflowException,
|
||||
SWIG_OCamlIllegalArgumentException,
|
||||
SWIG_OCamlIndexOutOfBoundsException,
|
||||
SWIG_OCamlRuntimeException,
|
||||
SWIG_OCamlSystemException,
|
||||
SWIG_OCamlUnknownError
|
||||
} SWIG_OCamlExceptionCodes;
|
||||
|
||||
SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const char *msg) {
|
||||
CAMLparam0();
|
||||
SWIG_CAMLlocal1(str);
|
||||
|
||||
switch (code) {
|
||||
case SWIG_OCamlIllegalArgumentException:
|
||||
caml_invalid_argument(msg);
|
||||
break;
|
||||
case SWIG_OCamlSystemException:
|
||||
str = caml_copy_string(msg);
|
||||
caml_raise_sys_error(str);
|
||||
break;
|
||||
case SWIG_OCamlArithmeticException:
|
||||
case SWIG_OCamlIndexOutOfBoundsException:
|
||||
case SWIG_OCamlOutOfMemoryError:
|
||||
case SWIG_OCamlOverflowException:
|
||||
case SWIG_OCamlRuntimeException:
|
||||
case SWIG_OCamlUnknownError:
|
||||
default:
|
||||
caml_failwith(msg);
|
||||
break;
|
||||
}
|
||||
CAMLreturn0;
|
||||
}
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);}
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_GetPtr(void *source, void **result, swig_type_info *type, swig_type_info *result_type);
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n );
|
||||
SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt );
|
||||
SWIGINTERN int caml_list_length( CAML_VALUE lst );
|
||||
SWIGINTERN CAML_VALUE caml_array_new( int n );
|
||||
SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
|
||||
SWIGINTERN CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
|
||||
SWIGINTERN int caml_array_len( CAML_VALUE arr );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_char( char c );
|
||||
SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char c );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_short( short s );
|
||||
SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short s );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_int( int x );
|
||||
SWIGINTERN CAML_VALUE caml_val_uint( unsigned int x );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_long( long x );
|
||||
SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long x );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_float( float f );
|
||||
SWIGINTERN CAML_VALUE caml_val_double( double d );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor );
|
||||
|
||||
SWIGINTERN CAML_VALUE caml_val_string( const char *str );
|
||||
SWIGINTERN CAML_VALUE caml_val_string_len( const char *str, int len );
|
||||
|
||||
SWIGINTERN long caml_long_val( CAML_VALUE v );
|
||||
SWIGINTERN double caml_double_val( CAML_VALUE v );
|
||||
|
||||
SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out,
|
||||
swig_type_info *descriptor );
|
||||
SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor );
|
||||
|
||||
SWIGINTERN char *caml_string_val( CAML_VALUE v );
|
||||
SWIGINTERN int caml_string_len( CAML_VALUE v );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,47 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* const.i
|
||||
*
|
||||
* Typemaps for constants
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%typemap(consttab) int,
|
||||
unsigned int,
|
||||
short,
|
||||
unsigned short,
|
||||
long,
|
||||
unsigned long,
|
||||
unsigned char,
|
||||
signed char,
|
||||
enum SWIGTYPE
|
||||
"SWIG_LONG_CONSTANT($symname, ($1_type)$value);";
|
||||
|
||||
%typemap(consttab) bool
|
||||
"SWIG_BOOL_CONSTANT($symname, ($1_type)$value);";
|
||||
|
||||
%typemap(consttab) float,
|
||||
double
|
||||
"SWIG_DOUBLE_CONSTANT($symname, $value);";
|
||||
|
||||
%typemap(consttab) char
|
||||
"SWIG_CHAR_CONSTANT($symname, $value);";
|
||||
|
||||
%typemap(consttab) char *,
|
||||
const char *,
|
||||
char [],
|
||||
const char []
|
||||
"SWIG_STRING_CONSTANT($symname, $value);";
|
||||
|
||||
%typemap(consttab) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE [] {
|
||||
zend_constant c;
|
||||
SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0);
|
||||
zval_copy_ctor(&c.value);
|
||||
c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);
|
||||
SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
|
||||
zend_register_constant(&c);
|
||||
}
|
||||
|
||||
/* Handled as a global variable. */
|
||||
%typemap(consttab) SWIGTYPE (CLASS::*) "";
|
||||
@@ -1,293 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* globalvar.i
|
||||
*
|
||||
* Global variables - add the variable to PHP
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%typemap(varinit) char *
|
||||
{
|
||||
zval z_var;
|
||||
if ($1) {
|
||||
ZVAL_STRING(&z_var, $1);
|
||||
} else {
|
||||
ZVAL_STR(&z_var, ZSTR_EMPTY_ALLOC());
|
||||
}
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) char []
|
||||
{
|
||||
zval z_var;
|
||||
ZVAL_STRING(&z_var, $1);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) int,
|
||||
unsigned int,
|
||||
unsigned short,
|
||||
short,
|
||||
unsigned short,
|
||||
long,
|
||||
unsigned long,
|
||||
signed char,
|
||||
unsigned char,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
zval z_var;
|
||||
ZVAL_LONG(&z_var, (long)$1);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) bool
|
||||
{
|
||||
zval z_var;
|
||||
ZVAL_BOOL(&z_var, ($1)?1:0);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) float, double
|
||||
{
|
||||
zval z_var;
|
||||
ZVAL_DOUBLE(&z_var, (double)$1);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) char
|
||||
{
|
||||
zval z_var;
|
||||
char c = $1;
|
||||
ZVAL_STRINGL(&z_var, &c, 1);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) SWIGTYPE *, SWIGTYPE []
|
||||
{
|
||||
zval z_var;
|
||||
SWIG_SetPointerZval(&z_var, (void*)$1, $1_descriptor, 0);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval z_var;
|
||||
SWIG_SetPointerZval(&z_var, (void*)&$1, $&1_descriptor, 0);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit) char [ANY]
|
||||
{
|
||||
zval z_var;
|
||||
/* varinit char [ANY] */
|
||||
ZVAL_STRINGL(&z_var, $1, $1_dim0);
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var);
|
||||
}
|
||||
|
||||
%typemap(varinit, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
{
|
||||
zval resource;
|
||||
void * p = emalloc(sizeof($1));
|
||||
memcpy(p, &$1, sizeof($1));
|
||||
ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr));
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource);
|
||||
}
|
||||
|
||||
%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
$1 = zval_get_long(z_var);
|
||||
}
|
||||
|
||||
%typemap(varin) bool
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
convert_to_boolean(z_var);
|
||||
$1 = (Z_TYPE_P(z_var) == IS_TRUE);
|
||||
}
|
||||
|
||||
%typemap(varin) double,float
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
$1 = zval_get_double(z_var);
|
||||
}
|
||||
|
||||
%typemap(varin) char
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
convert_to_string(z_var);
|
||||
if ($1 != Z_STRVAL_P(z_var)[0]) {
|
||||
$1 = Z_STRVAL_P(z_var)[0];
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varin) char *
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
char *s1;
|
||||
convert_to_string(z_var);
|
||||
s1 = Z_STRVAL_P(z_var);
|
||||
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
|
||||
if (s1)
|
||||
$1 = estrdup(s1);
|
||||
else
|
||||
$1 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%typemap(varin) SWIGTYPE []
|
||||
{
|
||||
if ($1) {
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, $owner);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varin) char [ANY]
|
||||
{
|
||||
zval **z_var;
|
||||
char *s1;
|
||||
|
||||
zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var);
|
||||
s1 = Z_STRVAL_P(z_var);
|
||||
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
|
||||
if (s1)
|
||||
strncpy($1, s1, $1_dim0);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE
|
||||
{
|
||||
zval *z_var;
|
||||
$&1_ltype _temp;
|
||||
|
||||
z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
if (SWIG_ConvertPtr(z_var, (void**)&_temp, $&1_descriptor, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
|
||||
}
|
||||
|
||||
$1 = *($&1_ltype)_temp;
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval *z_var;
|
||||
$1_ltype _temp;
|
||||
|
||||
z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
if (SWIG_ConvertPtr(z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
|
||||
}
|
||||
|
||||
$1 = ($1_ltype)_temp;
|
||||
}
|
||||
|
||||
%typemap(varin, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
void * p = (void*)zend_fetch_resource_ex(z_var, SWIG_MEMBER_PTR, swig_member_ptr);
|
||||
memcpy(&$1, p, sizeof($1));
|
||||
}
|
||||
|
||||
%typemap(varout) int,
|
||||
unsigned int,
|
||||
unsigned short,
|
||||
short,
|
||||
long,
|
||||
unsigned long,
|
||||
signed char,
|
||||
unsigned char,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
if ($1 != ($1_ltype)Z_LVAL_P(z_var)) {
|
||||
z_var->value.lval = (long)$1;
|
||||
}
|
||||
}
|
||||
|
||||
//SAMFIX need to cast zval->type, what if zend-hash_find fails? etc?
|
||||
%typemap(varout) bool
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
if ($1 != ($1_ltype)Z_LVAL_P(z_var)) {
|
||||
z_var->value.lval = (long)$1;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) double, float
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
if ($1 != ($1_ltype)Z_DVAL_P(z_var)) {
|
||||
z_var->value.dval = (double)$1;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) char
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
char c = $1;
|
||||
if ($1 != Z_STRVAL_P(z_val)[0]) {
|
||||
ZVAL_STRING(z_var, &c);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) char *
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
const char *s1 = Z_STRVAL_P(z_var);
|
||||
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
|
||||
if (s1)
|
||||
efree(s1);
|
||||
if ($1) {
|
||||
(z_var)->value.str.val = estrdup($1);
|
||||
(z_var)->value.str.len = strlen($1) + 1;
|
||||
} else {
|
||||
(z_var)->value.str.val = 0;
|
||||
(z_var)->value.str.len = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
SWIG_SetPointerZval(z_var, (void*)&$1, $&1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE []
|
||||
{
|
||||
if($1) {
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) char [ANY]
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
const char *s1 = Z_STRVAL_P(z_var);
|
||||
deliberate error cos this code looks bogus to me
|
||||
if ((s1 == NULL) || strcmp(s1, $1)) {
|
||||
if ($1) {
|
||||
(z_var)->value.str.val = estrdup($1);
|
||||
(z_var)->value.str.len = strlen($1) + 1;
|
||||
} else {
|
||||
(z_var)->value.str.val = 0;
|
||||
(z_var)->value.str.len = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1);
|
||||
SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
{
|
||||
zval resource;
|
||||
void * p = emalloc(sizeof($1));
|
||||
memcpy(p, &$1, sizeof($1));
|
||||
ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr));
|
||||
zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource);
|
||||
}
|
||||
@@ -1,539 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* php.swg
|
||||
*
|
||||
* PHP configuration file
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%runtime "swigrun.swg" // Common C API type-checking code
|
||||
%runtime "swigerrors.swg" // SWIG errors
|
||||
%runtime "phprun.swg" // PHP runtime functions
|
||||
|
||||
%include <phpinit.swg> // PHP initialization routine.
|
||||
|
||||
%include <globalvar.i> // Global variables.
|
||||
%include <const.i>
|
||||
|
||||
// use %init %{ "/*code goes here*/ " %}
|
||||
// or %minit %{ "/* code goes here*/ " %} to
|
||||
// insert code in the PHP_MINIT_FUNCTION
|
||||
#define %minit %insert("init")
|
||||
|
||||
// use %rinit %{ "/* code goes here*/ " %} to
|
||||
// insert code in the PHP_RINIT_FUNCTION
|
||||
#define %rinit %insert("rinit")
|
||||
|
||||
// use %shutdown %{ " /*code goes here*/ " %} to
|
||||
// insert code in the PHP_MSHUTDOWN_FUNCTION
|
||||
#define %shutdown %insert("shutdown")
|
||||
#define %mshutdown %insert("shutdown")
|
||||
|
||||
// use %rshutdown %{ " /*code goes here*/" %} to
|
||||
// insert code in the PHP_RSHUTDOWN_FUNCTION
|
||||
#define %rshutdown %insert("rshutdown")
|
||||
|
||||
/* Typemaps for input parameters by value */
|
||||
|
||||
%include <utils.i>
|
||||
|
||||
%pass_by_val(bool,CONVERT_BOOL_IN);
|
||||
|
||||
%pass_by_val(size_t, CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(enum SWIGTYPE, CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(signed int, CONVERT_INT_IN);
|
||||
%pass_by_val(int,CONVERT_INT_IN);
|
||||
%pass_by_val(unsigned int,CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(signed short, CONVERT_INT_IN);
|
||||
%pass_by_val(short,CONVERT_INT_IN);
|
||||
%pass_by_val(unsigned short, CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(signed long, CONVERT_INT_IN);
|
||||
%pass_by_val(long, CONVERT_INT_IN);
|
||||
%pass_by_val(unsigned long, CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(signed long long, CONVERT_LONG_LONG_IN);
|
||||
%pass_by_val(long long, CONVERT_LONG_LONG_IN);
|
||||
%pass_by_val(unsigned long long, CONVERT_UNSIGNED_LONG_LONG_IN);
|
||||
|
||||
%pass_by_val(signed char, CONVERT_INT_IN);
|
||||
%pass_by_val(char, CONVERT_CHAR_IN);
|
||||
%pass_by_val(unsigned char, CONVERT_INT_IN);
|
||||
|
||||
%pass_by_val(float, CONVERT_FLOAT_IN);
|
||||
|
||||
%pass_by_val(double, CONVERT_FLOAT_IN);
|
||||
|
||||
%pass_by_val(char *, CONVERT_STRING_IN);
|
||||
%typemap(in) char *& = const char *&;
|
||||
%typemap(directorout) char *& = const char *&;
|
||||
|
||||
// char array can be in/out, though the passed string may not be big enough...
|
||||
// so we have to size it
|
||||
%typemap(in) char[ANY]
|
||||
%{
|
||||
convert_to_string(&$input);
|
||||
$1 = ($1_ltype) Z_STRVAL($input);
|
||||
%}
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) %{
|
||||
convert_to_string(&$input);
|
||||
$1 = ($1_ltype) Z_STRVAL($input);
|
||||
$2 = ($2_ltype) Z_STRLEN($input);
|
||||
%}
|
||||
|
||||
/* Object passed by value. Convert to a pointer */
|
||||
%typemap(in) SWIGTYPE ($&1_ltype tmp)
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
}
|
||||
$1 = *tmp;
|
||||
%}
|
||||
|
||||
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
|
||||
%{
|
||||
/* If exit was via exception, PHP NULL is returned so skip the conversion. */
|
||||
if (!EG(exception)) {
|
||||
if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL)
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||
$result = *tmp;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIGTYPE *,
|
||||
SWIGTYPE []
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIGTYPE &
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIGTYPE &&
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(in) SWIGTYPE *const& ($*ltype temp)
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
|
||||
}
|
||||
$1 = ($1_ltype)&temp;
|
||||
%}
|
||||
|
||||
%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");
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(argout) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&;
|
||||
|
||||
%typemap(in) void *
|
||||
%{
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) {
|
||||
/* Allow NULL from php for void* */
|
||||
if (Z_ISNULL($input)) $1=0;
|
||||
else
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||
}
|
||||
%}
|
||||
|
||||
/* Special case when void* is passed by reference so it can be made to point
|
||||
to opaque api structs */
|
||||
%typemap(in) void ** ($*1_ltype ptr, int force),
|
||||
void *& ($*1_ltype ptr, int force)
|
||||
{
|
||||
/* If they pass NULL by reference, make it into a void*
|
||||
This bit should go in arginit if arginit support init-ing scripting args */
|
||||
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
||||
/* So... we didn't get a ref or ptr, but we'll accept NULL by reference */
|
||||
if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) {
|
||||
/* wasn't a pre/ref/thing, OR anything like an int thing */
|
||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
|
||||
}
|
||||
}
|
||||
force=0;
|
||||
if (arg1==NULL) {
|
||||
#ifdef __cplusplus
|
||||
ptr=new $*1_ltype();
|
||||
#else
|
||||
ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
|
||||
#endif
|
||||
$1=&ptr;
|
||||
/* have to passback arg$arg too */
|
||||
force=1;
|
||||
}
|
||||
}
|
||||
%typemap(argout) void **,
|
||||
void *&
|
||||
%{
|
||||
if (force$argnum) {
|
||||
SWIG_SetPointerZval(&$input, (void*) ptr$argnum, $*1_descriptor, 1);
|
||||
}
|
||||
%}
|
||||
|
||||
/* Typemap for output values */
|
||||
|
||||
%typemap(out) int,
|
||||
unsigned int,
|
||||
short,
|
||||
unsigned short,
|
||||
long,
|
||||
unsigned long,
|
||||
signed char,
|
||||
unsigned char,
|
||||
bool,
|
||||
size_t
|
||||
%{
|
||||
RETVAL_LONG($1);
|
||||
%}
|
||||
|
||||
%typemap(out) enum SWIGTYPE
|
||||
%{
|
||||
RETVAL_LONG((long)$1);
|
||||
%}
|
||||
|
||||
%typemap(out) long long
|
||||
%{
|
||||
if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) {
|
||||
RETVAL_LONG((long)($1));
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", (long long)$1);
|
||||
RETVAL_STRING(temp);
|
||||
}
|
||||
%}
|
||||
%typemap(out) unsigned long long
|
||||
%{
|
||||
if ($1 <= (unsigned long long)LONG_MAX) {
|
||||
RETVAL_LONG((long)($1));
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", (unsigned long long)$1);
|
||||
RETVAL_STRING(temp);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(out) const int &,
|
||||
const unsigned int &,
|
||||
const short &,
|
||||
const unsigned short &,
|
||||
const long &,
|
||||
const unsigned long &,
|
||||
const signed char &,
|
||||
const unsigned char &,
|
||||
const bool &,
|
||||
const size_t &
|
||||
%{
|
||||
RETVAL_LONG(*$1);
|
||||
%}
|
||||
|
||||
%typemap(out) const enum SWIGTYPE &
|
||||
%{
|
||||
RETVAL_LONG((long)*$1);
|
||||
%}
|
||||
|
||||
%typemap(out) const enum SWIGTYPE &&
|
||||
%{
|
||||
RETVAL_LONG((long)*$1);
|
||||
%}
|
||||
|
||||
%typemap(out) const long long &
|
||||
%{
|
||||
if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) {
|
||||
RETVAL_LONG((long)(*$1));
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%lld", (long long)(*$1));
|
||||
RETVAL_STRING(temp);
|
||||
}
|
||||
%}
|
||||
%typemap(out) const unsigned long long &
|
||||
%{
|
||||
if (*$1 <= (unsigned long long)LONG_MAX) {
|
||||
RETVAL_LONG((long)(*$1));
|
||||
} else {
|
||||
char temp[256];
|
||||
sprintf(temp, "%llu", (unsigned long long)(*$1));
|
||||
RETVAL_STRING(temp);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(directorin) int,
|
||||
unsigned int,
|
||||
short,
|
||||
unsigned short,
|
||||
long,
|
||||
unsigned long,
|
||||
signed char,
|
||||
unsigned char,
|
||||
size_t,
|
||||
enum SWIGTYPE
|
||||
%{
|
||||
ZVAL_LONG($input,$1);
|
||||
%}
|
||||
|
||||
%typemap(directorin) enum SWIGTYPE
|
||||
%{
|
||||
ZVAL_LONG($input, (long)$1_name);
|
||||
%}
|
||||
|
||||
%typemap(directorin) char *, char []
|
||||
%{
|
||||
if(!$1) {
|
||||
ZVAL_NULL($input);
|
||||
} else {
|
||||
ZVAL_STRING($input, (const char*)$1);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(out) bool
|
||||
%{
|
||||
RETVAL_BOOL(($1) ? 1 : 0);
|
||||
%}
|
||||
|
||||
%typemap(out) const bool &
|
||||
%{
|
||||
RETVAL_BOOL((*$1) ? 1 : 0);
|
||||
%}
|
||||
|
||||
%typemap(directorin) bool
|
||||
%{
|
||||
ZVAL_BOOL($input, ($1) ? 1 : 0);
|
||||
%}
|
||||
|
||||
%typemap(out) float,
|
||||
double
|
||||
%{
|
||||
RETVAL_DOUBLE($1);
|
||||
%}
|
||||
|
||||
%typemap(out) const float &,
|
||||
const double &
|
||||
%{
|
||||
RETVAL_DOUBLE(*$1);
|
||||
%}
|
||||
|
||||
%typemap(directorin) float,
|
||||
double
|
||||
%{
|
||||
ZVAL_DOUBLE($input, $1);
|
||||
%}
|
||||
|
||||
%typemap(out) char
|
||||
%{
|
||||
RETVAL_STRINGL(&$1, 1);
|
||||
%}
|
||||
|
||||
%typemap(out) const char &
|
||||
%{
|
||||
RETVAL_STRINGL(&*$1, 1);
|
||||
%}
|
||||
|
||||
%typemap(out) char *,
|
||||
char []
|
||||
%{
|
||||
if (!$1) {
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
RETVAL_STRING((const char *)$1);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(out) char *&
|
||||
%{
|
||||
if (!*$1) {
|
||||
RETVAL_NULL();
|
||||
} else {
|
||||
RETVAL_STRING((const char *)*$1);
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(out) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
|
||||
%}
|
||||
|
||||
%typemap(out) SWIGTYPE *const&
|
||||
%{
|
||||
SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
|
||||
%}
|
||||
|
||||
%typemap(directorin) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
{
|
||||
void * p = emalloc(sizeof($1));
|
||||
memcpy(p, &$1, sizeof($1));
|
||||
RETVAL_RES(zend_register_resource(p, swig_member_ptr));
|
||||
}
|
||||
|
||||
%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
{
|
||||
void * p = (void*)zend_fetch_resource_ex(&$input, SWIG_MEMBER_PTR, swig_member_ptr);
|
||||
memcpy(&$1, p, sizeof($1));
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE *DYNAMIC,
|
||||
SWIGTYPE &DYNAMIC
|
||||
{
|
||||
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
|
||||
SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
|
||||
SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
|
||||
}
|
||||
#else
|
||||
{
|
||||
$&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
|
||||
memcpy(resultobj, &$1, sizeof($1_type));
|
||||
SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(directorin) SWIGTYPE
|
||||
%{
|
||||
SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2);
|
||||
%}
|
||||
|
||||
%typemap(out) void "";
|
||||
|
||||
%typemap(out) char [ANY]
|
||||
{
|
||||
int len = 0;
|
||||
while (len < $1_dim0 && $1[len]) ++len;
|
||||
RETVAL_STRINGL($1, len);
|
||||
}
|
||||
|
||||
// This typecheck does hard checking for proper argument type. If you want
|
||||
// an argument to be converted from a different PHP type, you must convert
|
||||
// it yourself before passing it (e.g. (string)4.7 or (int)"6").
|
||||
%define %php_typecheck(_type,_prec,is)
|
||||
%typemap(typecheck,precedence=_prec) _type, const _type &
|
||||
" $1 = (Z_TYPE($input) == is);"
|
||||
%enddef
|
||||
|
||||
// Like %php_typecheck but allows either of two values.
|
||||
%define %php_typecheck2(_type,_prec,is1,is2)
|
||||
%typemap(typecheck,precedence=_prec) _type, const _type &
|
||||
" $1 = (Z_TYPE($input) == is1 || Z_TYPE($input) == is2);"
|
||||
%enddef
|
||||
|
||||
%php_typecheck(int,SWIG_TYPECHECK_INTEGER,IS_LONG)
|
||||
%php_typecheck(unsigned int,SWIG_TYPECHECK_UINT32,IS_LONG)
|
||||
%php_typecheck(short,SWIG_TYPECHECK_INT16,IS_LONG)
|
||||
%php_typecheck(unsigned short,SWIG_TYPECHECK_UINT16,IS_LONG)
|
||||
%php_typecheck(long,SWIG_TYPECHECK_INT32,IS_LONG)
|
||||
%php_typecheck(unsigned long,SWIG_TYPECHECK_UINT32,IS_LONG)
|
||||
%php_typecheck(long long,SWIG_TYPECHECK_INT64,IS_LONG)
|
||||
%php_typecheck(unsigned long long,SWIG_TYPECHECK_UINT64,IS_LONG)
|
||||
%php_typecheck(signed char,SWIG_TYPECHECK_INT8,IS_LONG)
|
||||
%php_typecheck(unsigned char,SWIG_TYPECHECK_UINT8,IS_LONG)
|
||||
%php_typecheck(size_t,SWIG_TYPECHECK_SIZE,IS_LONG)
|
||||
%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG)
|
||||
%php_typecheck2(bool,SWIG_TYPECHECK_BOOL,IS_TRUE,IS_FALSE)
|
||||
%php_typecheck(float,SWIG_TYPECHECK_FLOAT,IS_DOUBLE)
|
||||
%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE)
|
||||
%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING)
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char []
|
||||
" $1 = (Z_TYPE($input) == IS_STRING); "
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
|
||||
{
|
||||
void *tmp;
|
||||
$1 = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER)
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
$1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER)
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
{
|
||||
void *tmp;
|
||||
$1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
$1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||
{
|
||||
void *tmp;
|
||||
$1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0);
|
||||
}
|
||||
|
||||
/* Exception handling */
|
||||
|
||||
%typemap(throws) int,
|
||||
long,
|
||||
short,
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
unsigned short %{
|
||||
zend_throw_exception(NULL, "C++ $1_type exception thrown", $1);
|
||||
return;
|
||||
%}
|
||||
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
|
||||
(void)$1;
|
||||
zend_throw_exception(NULL, "C++ $1_type exception thrown", 0);
|
||||
return;
|
||||
%}
|
||||
|
||||
%typemap(throws) char * %{
|
||||
zend_throw_exception(NULL, $1, 0);
|
||||
return;
|
||||
%}
|
||||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* php keywords */
|
||||
%include <phpkw.swg>
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* The start of the PHP initialization function
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
SWIG_php_minit {
|
||||
SWIG_InitializeModule((void*)&module_number);
|
||||
%}
|
||||
|
||||
%fragment("swig_php_init_member_ptr2", "header") %{
|
||||
#define SWIG_MEMBER_PTR "CLASS::*"
|
||||
|
||||
static void swig_member_ptr_dtor(zend_resource *res) {
|
||||
efree(res->ptr);
|
||||
}
|
||||
|
||||
static int swig_member_ptr = 0;
|
||||
%}
|
||||
|
||||
%fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") %{
|
||||
swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number);
|
||||
%}
|
||||
@@ -1,46 +0,0 @@
|
||||
%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
|
||||
%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp),
|
||||
TYPE &REF ($*1_ltype tmp)
|
||||
%{
|
||||
/* First Check for SWIG wrapped type */
|
||||
if (Z_ISNULL($input)) {
|
||||
$1 = 0;
|
||||
} else if (Z_ISREF($input)) {
|
||||
/* Not swig wrapped type, so we check if it's a PHP reference type */
|
||||
CONVERT_IN(tmp, $*1_ltype, $input);
|
||||
$1 = &tmp;
|
||||
} else {
|
||||
SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference));
|
||||
}
|
||||
%}
|
||||
%typemap(argout) TYPE *REF,
|
||||
TYPE &REF
|
||||
%{
|
||||
if (Z_ISREF($input)) {
|
||||
CONVERT_OUT(Z_REFVAL($input), tmp$argnum);
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
|
||||
|
||||
%pass_by_ref( signed int, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( int, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( unsigned int, CONVERT_INT_IN, ZVAL_LONG );
|
||||
|
||||
%pass_by_ref( signed short, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( short, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( unsigned short, CONVERT_INT_IN, ZVAL_LONG );
|
||||
|
||||
%pass_by_ref( signed long, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( long, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( unsigned long, CONVERT_INT_IN, ZVAL_LONG );
|
||||
|
||||
%pass_by_ref( signed char, CONVERT_INT_IN, ZVAL_LONG );
|
||||
%pass_by_ref( char, CONVERT_CHAR_IN, ZVAL_STRING );
|
||||
%pass_by_ref( unsigned char, CONVERT_INT_IN, ZVAL_LONG );
|
||||
|
||||
%pass_by_ref( float, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
|
||||
%pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
|
||||
|
||||
%pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING );
|
||||
@@ -1,246 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* phprun.swg
|
||||
*
|
||||
* PHP runtime library
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "php.h"
|
||||
|
||||
#if PHP_MAJOR_VERSION != 7
|
||||
# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||
#endif
|
||||
|
||||
#include "ext/standard/php_string.h"
|
||||
#include <stdlib.h> /* for abort(), used in generated code. */
|
||||
|
||||
/* This indirection is to work around const correctness issues in older PHP.
|
||||
* FIXME: Remove for PHP7? Or might user code be using it? */
|
||||
#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A)
|
||||
|
||||
#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT)
|
||||
#define SWIG_CHAR_CONSTANT(N, V) do {\
|
||||
char swig_char = (V);\
|
||||
REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\
|
||||
} while (0)
|
||||
|
||||
/* ZEND_CONSTANT_SET_FLAGS is new in PHP 7.3. */
|
||||
#ifdef ZEND_CONSTANT_SET_FLAGS
|
||||
# define SWIG_ZEND_CONSTANT_SET_FLAGS ZEND_CONSTANT_SET_FLAGS
|
||||
#else
|
||||
# define SWIG_ZEND_CONSTANT_SET_FLAGS(C, F, N) do { (C)->flags = (F); (C)->module_number = (N); } while (0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SWIG_fail goto fail
|
||||
|
||||
static const char *default_error_msg = "Unknown error occurred";
|
||||
static int default_error_code = E_ERROR;
|
||||
|
||||
#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg
|
||||
|
||||
#define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0)
|
||||
|
||||
#define SWIG_contract_assert(expr,msg) \
|
||||
if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else
|
||||
|
||||
/* Standard SWIG API */
|
||||
#define SWIG_GetModule(clientdata) SWIG_Php_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer, *(int*)clientdata)
|
||||
|
||||
/* used to wrap returned objects in so we know whether they are newobject
|
||||
and need freeing, or not */
|
||||
typedef struct {
|
||||
void * ptr;
|
||||
int newobject;
|
||||
} swig_object_wrapper;
|
||||
|
||||
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
|
||||
|
||||
static void
|
||||
SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
|
||||
/*
|
||||
* First test for Null pointers. Return those as PHP native NULL
|
||||
*/
|
||||
if (!ptr ) {
|
||||
ZVAL_NULL(z);
|
||||
return;
|
||||
}
|
||||
if (type->clientdata) {
|
||||
swig_object_wrapper *value;
|
||||
if (! (*(int *)(type->clientdata)))
|
||||
zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
|
||||
value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
|
||||
value->ptr=ptr;
|
||||
value->newobject=(newobject & 1);
|
||||
if ((newobject & 2) == 0) {
|
||||
/* Just register the pointer as a resource. */
|
||||
ZVAL_RES(z, zend_register_resource(value, *(int *)(type->clientdata)));
|
||||
} else {
|
||||
/*
|
||||
* Wrap the resource in an object, the resource will be accessible
|
||||
* via the "_cPtr" member. This is currently only used by
|
||||
* directorin typemaps.
|
||||
*/
|
||||
zval resource;
|
||||
zend_class_entry *ce = NULL;
|
||||
const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */
|
||||
size_t type_name_len;
|
||||
const char * p;
|
||||
HashTable * ht;
|
||||
|
||||
/* Namespace__Foo -> Foo */
|
||||
/* FIXME: ugly and goes wrong for classes with __ in their names. */
|
||||
while ((p = strstr(type_name, "__")) != NULL) {
|
||||
type_name = p + 2;
|
||||
}
|
||||
type_name_len = strlen(type_name);
|
||||
|
||||
ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata)));
|
||||
if (SWIG_PREFIX_LEN > 0) {
|
||||
zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0);
|
||||
memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN);
|
||||
memcpy(classname->val + SWIG_PREFIX_LEN, type_name, type_name_len);
|
||||
ce = zend_lookup_class(classname);
|
||||
zend_string_release(classname);
|
||||
} else {
|
||||
zend_string * classname = zend_string_init(type_name, type_name_len, 0);
|
||||
ce = zend_lookup_class(classname);
|
||||
zend_string_release(classname);
|
||||
}
|
||||
if (ce == NULL) {
|
||||
/* class does not exist */
|
||||
ce = zend_standard_class_def;
|
||||
}
|
||||
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, 1, NULL, NULL, 0);
|
||||
zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource);
|
||||
object_and_properties_init(z, ce, ht);
|
||||
}
|
||||
return;
|
||||
}
|
||||
zend_error(E_ERROR, "Type: %s not registered with zend",type->name);
|
||||
}
|
||||
|
||||
/* This pointer conversion routine takes the native pointer p (along with
|
||||
its type name) and converts it by calling appropriate casting functions
|
||||
according to ty. The resultant pointer is returned, or NULL is returned
|
||||
if the pointer can't be cast.
|
||||
|
||||
Sadly PHP has no API to find a type name from a type id, only from an
|
||||
instance of a resource of the type id, so we have to pass type_name as well.
|
||||
|
||||
The two functions which might call this are:
|
||||
SWIG_ConvertResourcePtr which gets the type name from the resource
|
||||
and the registered zend destructors for which we have one per type each
|
||||
with the type name hard wired in. */
|
||||
static void *
|
||||
SWIG_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty) {
|
||||
swig_cast_info *tc;
|
||||
void *result = 0;
|
||||
|
||||
if (!ty) {
|
||||
/* They don't care about the target type, so just pass on the pointer! */
|
||||
return p;
|
||||
}
|
||||
|
||||
if (! type_name) {
|
||||
/* can't convert p to ptr type ty if we don't know what type p is */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* convert and cast p from type_name to ptr as ty. */
|
||||
tc = SWIG_TypeCheck(type_name, ty);
|
||||
if (tc) {
|
||||
int newmemory = 0;
|
||||
result = SWIG_TypeCast(tc, p, &newmemory);
|
||||
assert(!newmemory); /* newmemory handling not yet implemented */
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This function returns a pointer of type ty by extracting the pointer
|
||||
and type info from the resource in z. z must be a resource.
|
||||
If it fails, NULL is returned.
|
||||
It uses SWIG_ConvertResourceData to do the real work. */
|
||||
static void *
|
||||
SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) {
|
||||
swig_object_wrapper *value;
|
||||
void *p;
|
||||
const char *type_name;
|
||||
|
||||
if (Z_RES_TYPE_P(z) == -1) return NULL;
|
||||
value = (swig_object_wrapper *) Z_RES_VAL_P(z);
|
||||
if (flags & SWIG_POINTER_DISOWN) {
|
||||
value->newobject = 0;
|
||||
}
|
||||
p = value->ptr;
|
||||
|
||||
type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z));
|
||||
|
||||
return SWIG_ConvertResourceData(p, type_name, ty);
|
||||
}
|
||||
|
||||
/* We allow passing of a RESOURCE pointing to the object or an OBJECT whose
|
||||
_cPtr is a resource pointing to the object */
|
||||
static int
|
||||
SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
|
||||
if (z == NULL) {
|
||||
*ptr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (Z_TYPE_P(z)) {
|
||||
case IS_OBJECT: {
|
||||
HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z);
|
||||
if (ht) {
|
||||
zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1);
|
||||
if (_cPtr) {
|
||||
if (Z_TYPE_P(_cPtr) == IS_INDIRECT) {
|
||||
_cPtr = Z_INDIRECT_P(_cPtr);
|
||||
}
|
||||
if (Z_TYPE_P(_cPtr) == IS_RESOURCE) {
|
||||
*ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags);
|
||||
return (*ptr == NULL ? -1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IS_RESOURCE:
|
||||
*ptr = SWIG_ConvertResourcePtr(z, ty, flags);
|
||||
return (*ptr == NULL ? -1 : 0);
|
||||
case IS_NULL:
|
||||
*ptr = 0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char const_name[] = "swig_runtime_data_type_pointer";
|
||||
static swig_module_info *SWIG_Php_GetModule() {
|
||||
zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1);
|
||||
if (pointer) {
|
||||
if (Z_TYPE_P(pointer) == IS_LONG) {
|
||||
return (swig_module_info *) pointer->value.lval;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void SWIG_Php_SetModule(swig_module_info *pointer, int module_number) {
|
||||
REGISTER_LONG_CONSTANT(const_name, (long) pointer, CONST_CS | CONST_PERSISTENT);
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_string.i
|
||||
*
|
||||
* SWIG typemaps for std::string types
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::string is typemapped by value
|
||||
// This can prevent exporting methods which return a string
|
||||
// in order for the user to modify it.
|
||||
// However, I think I'll wait until someone asks for it...
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%include <exception.i>
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
%naturalvar string;
|
||||
|
||||
class string;
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) string, const string& %{
|
||||
$1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0;
|
||||
%}
|
||||
|
||||
%typemap(in) string %{
|
||||
convert_to_string(&$input);
|
||||
$1.assign(Z_STRVAL($input), Z_STRLEN($input));
|
||||
%}
|
||||
|
||||
%typemap(directorout) string %{
|
||||
if (!EG(exception)) {
|
||||
convert_to_string($input);
|
||||
$result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input));
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(out) string %{
|
||||
ZVAL_STRINGL($result, $1.data(), $1.size());
|
||||
%}
|
||||
|
||||
%typemap(directorin) string, const string& %{
|
||||
ZVAL_STRINGL($input, $1.data(), $1.size());
|
||||
%}
|
||||
|
||||
%typemap(out) const string & %{
|
||||
ZVAL_STRINGL($result, $1->data(), $1->size());
|
||||
%}
|
||||
|
||||
%typemap(throws) string, const string& %{
|
||||
zend_throw_exception(NULL, $1.c_str(), 0);
|
||||
return;
|
||||
%}
|
||||
|
||||
%typemap(in) const string & ($*1_ltype temp) %{
|
||||
convert_to_string(&$input);
|
||||
temp.assign(Z_STRVAL($input), Z_STRLEN($input));
|
||||
$1 = &temp;
|
||||
%}
|
||||
|
||||
/* These next two handle a function which takes a non-const reference to
|
||||
* a std::string and modifies the string. */
|
||||
%typemap(in,byref=1) string & ($*1_ltype temp) %{
|
||||
{
|
||||
zval * p = Z_ISREF($input) ? Z_REFVAL($input) : &$input;
|
||||
convert_to_string(p);
|
||||
temp.assign(Z_STRVAL_P(p), Z_STRLEN_P(p));
|
||||
$1 = &temp;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(directorout) string & ($*1_ltype *temp) %{
|
||||
if (!EG(exception)) {
|
||||
convert_to_string($input);
|
||||
temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input));
|
||||
swig_acquire_ownership(temp);
|
||||
$result = temp;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(argout) string & %{
|
||||
if (Z_ISREF($input)) {
|
||||
ZVAL_STRINGL(Z_REFVAL($input), $1->data(), $1->size());
|
||||
}
|
||||
%}
|
||||
|
||||
/* SWIG will apply the non-const typemap above to const string& without
|
||||
* this more specific typemap. */
|
||||
%typemap(argout) const string & "";
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,37 +0,0 @@
|
||||
/* This file defines an internal function for processing default arguments
|
||||
with proxy classes.
|
||||
|
||||
There seems to be no straightforward way to write proxy functions
|
||||
involving default arguments. For example :
|
||||
|
||||
def foo(arg1,arg2,*args):
|
||||
proxyc.foo(arg1,arg2,args)
|
||||
|
||||
This fails because args is now a tuple and SWIG doesn't know what to
|
||||
do with it.
|
||||
|
||||
This file allows a different approach :
|
||||
|
||||
def foo(arg1,arg2,*args):
|
||||
proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args)
|
||||
|
||||
Basically, we form a new tuple from the object, call this special
|
||||
__call_defarg method and it passes control to the real wrapper function.
|
||||
An ugly hack, but it works.
|
||||
*/
|
||||
|
||||
SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) {
|
||||
PyObject *func;
|
||||
PyObject *parms;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO", &func, &parms))
|
||||
return NULL;
|
||||
|
||||
if (!PyCallable_Check(func)) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
return PyEval_CallObject(func,parms);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
%define %pythonabc(Type, Abc)
|
||||
%feature("python:abc", #Abc) Type;
|
||||
%enddef
|
||||
%pythoncode %{import collections.abc%}
|
||||
%pythonabc(std::vector, collections.abc.MutableSequence);
|
||||
%pythonabc(std::list, collections.abc.MutableSequence);
|
||||
%pythonabc(std::map, collections.abc.MutableMapping);
|
||||
%pythonabc(std::multimap, collections.abc.MutableMapping);
|
||||
%pythonabc(std::set, collections.abc.MutableSet);
|
||||
%pythonabc(std::multiset, collections.abc.MutableSet);
|
||||
@@ -1,45 +0,0 @@
|
||||
|
||||
// Documentation for use with the autodoc feature.
|
||||
|
||||
#ifdef SWIG_DOC_DOXYGEN_STYLE
|
||||
%typemap(doc) SWIGTYPE "@param $1_name $1_type";
|
||||
%typemap(doc) SWIGTYPE * "@param $1_name $1_type";
|
||||
%typemap(doc) const SWIGTYPE & "@param $1_name $1_type";
|
||||
%typemap(doc) const SWIGTYPE && "@param $1_name $1_type";
|
||||
%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type";
|
||||
|
||||
%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)";
|
||||
%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)";
|
||||
%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)";
|
||||
#else
|
||||
%typemap(doc) SWIGTYPE "$1_name: $1_type";
|
||||
%typemap(doc) SWIGTYPE * "$1_name: $1_type";
|
||||
%typemap(doc) const SWIGTYPE & "$1_name: $1_type";
|
||||
%typemap(doc) const SWIGTYPE && "$1_name: $1_type";
|
||||
%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type";
|
||||
|
||||
%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)";
|
||||
%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)";
|
||||
%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)";
|
||||
#endif
|
||||
|
||||
|
||||
// Types to use in Python documentation for the parameters of the given C++ type.
|
||||
%typemap(doctype) bool "boolean";
|
||||
|
||||
%define int_doctype_for_cppint_type(cppint_type)
|
||||
%typemap(doctype) cppint_type, unsigned cppint_type "int";
|
||||
%enddef
|
||||
%formacro(int_doctype_for_cppint_type, short, int, long, long long)
|
||||
|
||||
%typemap(doctype) size_t "int";
|
||||
|
||||
%typemap(doctype) enum SWIGTYPE "int";
|
||||
|
||||
%typemap(doctype) float, double, long double "float";
|
||||
|
||||
%typemap(doctype) char*, std::string "string";
|
||||
|
||||
%typemap(doctype) SWIGTYPE "$1_basetype"
|
||||
%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)"
|
||||
%typemap(doctype) SWIGTYPE & "$typemap(doctype, $*1_ltype)"
|
||||
@@ -1,87 +0,0 @@
|
||||
/* Compatibility macros for Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
|
||||
#define PyInt_Check(x) PyLong_Check(x)
|
||||
#define PyInt_AsLong(x) PyLong_AsLong(x)
|
||||
#define PyInt_FromLong(x) PyLong_FromLong(x)
|
||||
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
|
||||
#define PyString_Check(name) PyBytes_Check(name)
|
||||
#define PyString_FromString(x) PyUnicode_FromString(x)
|
||||
#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
|
||||
#define PyString_AsString(str) PyBytes_AsString(str)
|
||||
#define PyString_Size(str) PyBytes_Size(str)
|
||||
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
|
||||
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
|
||||
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
|
||||
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef Py_TYPE
|
||||
# define Py_TYPE(op) ((op)->ob_type)
|
||||
#endif
|
||||
|
||||
/* SWIG APIs for compatibility of both Python 2 & 3 */
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
# define SWIG_Python_str_FromFormat PyUnicode_FromFormat
|
||||
#else
|
||||
# define SWIG_Python_str_FromFormat PyString_FromFormat
|
||||
#endif
|
||||
|
||||
|
||||
/* Warning: This function will allocate a new string in Python 3,
|
||||
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
|
||||
*/
|
||||
SWIGINTERN char*
|
||||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
char *newstr = 0;
|
||||
str = PyUnicode_AsUTF8String(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);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#else
|
||||
# define SWIG_Python_str_DelForPy3(x)
|
||||
#endif
|
||||
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SWIG_Python_str_FromChar(const char *c)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_FromString(c);
|
||||
#else
|
||||
return PyString_FromString(c);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef PyObject_DEL
|
||||
# define PyObject_DEL PyObject_Del
|
||||
#endif
|
||||
|
||||
// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
|
||||
// interface files check for it.
|
||||
# define SWIGPY_USE_CAPSULE
|
||||
# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
|
||||
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||
#define Py_hash_t long
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
%insert(runtime) %{
|
||||
#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
|
||||
/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
||||
/* Use debug wrappers with the Python release dll */
|
||||
# undef _DEBUG
|
||||
# include <Python.h>
|
||||
# define _DEBUG 1
|
||||
#else
|
||||
# include <Python.h>
|
||||
#endif
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||
%insert(runtime) "swigerrors.swg"; /* SWIG errors */
|
||||
%insert(runtime) "pyhead.swg"; /* Python includes and fixes */
|
||||
%insert(runtime) "pyerrors.swg"; /* Python errors */
|
||||
%insert(runtime) "pythreads.swg"; /* Python thread code */
|
||||
%insert(runtime) "pyapi.swg"; /* Python API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
Helper function to return output types, now we need to use a list
|
||||
instead of a tuple since all the other types
|
||||
(std::pair,std::vector,std::list,etc) return tuples.
|
||||
*/
|
||||
|
||||
#warning "Deprecated file: Don't use t_output_helper anymore,"
|
||||
#warning "use SWIG_Python_AppendOutput or %append_output instead."
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
The typemaps here allow to handle functions returning std::auto_ptr<>,
|
||||
which is the most common use of this type. If you have functions taking it
|
||||
as parameter, these typemaps can't be used for them and you need to do
|
||||
something else (e.g. use shared_ptr<> which SWIG supports fully).
|
||||
*/
|
||||
|
||||
%define %auto_ptr(TYPE)
|
||||
%typemap (out) std::auto_ptr<TYPE > %{
|
||||
%set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags));
|
||||
%}
|
||||
%template() std::auto_ptr<TYPE >;
|
||||
%enddef
|
||||
|
||||
namespace std {
|
||||
template <class T> class auto_ptr {};
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
%include <pycontainer.swg>
|
||||
|
||||
|
||||
%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class T, size_t S>
|
||||
struct traits_asptr<std::carray<T, S> > {
|
||||
static int asptr(PyObject *obj, std::carray<T, S> **array) {
|
||||
return traits_asptr_stdseq<std::carray<T, S> >::asptr(obj, array);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[];
|
||||
|
||||
%extend std::carray {
|
||||
%fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header",
|
||||
fragment="SwigPyIterator_T",
|
||||
fragment=SWIG_Traits_frag(_Type),
|
||||
fragment="StdCarrayTraits") {
|
||||
namespace swig {
|
||||
template <> struct traits<std::carray<_Type, _Size > > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() {
|
||||
return "std::carray<" #_Type "," #_Size " >";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr,
|
||||
SWIG_Traits_frag(std::carray<_Type, _Size >),
|
||||
std::carray<_Type, _Size >);
|
||||
|
||||
%typemap(out,noblock=1) iterator, const_iterator {
|
||||
$result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1),
|
||||
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
|
||||
}
|
||||
|
||||
inline size_t __len__() const { return self->size(); }
|
||||
|
||||
inline const _Type& __getitem__(size_t i) const { return (*self)[i]; }
|
||||
|
||||
inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; }
|
||||
|
||||
|
||||
swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
%include <std/std_carray.swg>
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1 +0,0 @@
|
||||
%include<std/std_deque.i>
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,64 +0,0 @@
|
||||
%{
|
||||
#include <algorithm>
|
||||
%}
|
||||
|
||||
//
|
||||
// std::carray - is really an extension to the 'std' namespace.
|
||||
//
|
||||
// A simple fix C array wrapper, more or less as presented in
|
||||
//
|
||||
// "The C++ Standarf Library", by Nicolai M. Josuttis
|
||||
//
|
||||
// which is also derived from the example in
|
||||
//
|
||||
// "The C++ Programming Language", by Bjarne Stroustup.
|
||||
//
|
||||
|
||||
%inline %{
|
||||
namespace std {
|
||||
template <class _Type, size_t _Size>
|
||||
class carray
|
||||
{
|
||||
public:
|
||||
typedef _Type value_type;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef _Type * iterator;
|
||||
typedef const _Type * const_iterator;
|
||||
|
||||
carray() { }
|
||||
|
||||
carray(const carray& other) {
|
||||
std::copy(other.v, other.v + size(), v);
|
||||
}
|
||||
|
||||
template <class _Iterator>
|
||||
carray(_Iterator first, _Iterator last) {
|
||||
assign(first, last);
|
||||
}
|
||||
|
||||
iterator begin() { return v; }
|
||||
iterator end() { return v + _Size; }
|
||||
|
||||
const_iterator begin() const { return v; }
|
||||
const_iterator end() const { return v + _Size; }
|
||||
|
||||
_Type& operator[](size_t i) { return v[i]; }
|
||||
const _Type& operator[](size_t i) const { return v[i]; }
|
||||
|
||||
static size_t size() { return _Size; }
|
||||
|
||||
template <class _Iterator>
|
||||
void assign(_Iterator first, _Iterator last) {
|
||||
if (std::distance(first,last) == size()) {
|
||||
std::copy(first, last, v);
|
||||
} else {
|
||||
throw std::length_error("bad range length");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
_Type v[_Size];
|
||||
};
|
||||
}
|
||||
%}
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* swigarch.i
|
||||
*
|
||||
* SWIG library file for 32bit/64bit code specialization and checking.
|
||||
*
|
||||
* Use only in extreme cases, when no arch. independent code can be
|
||||
* generated
|
||||
*
|
||||
* To activate architecture specific code, use
|
||||
*
|
||||
* swig -DSWIGWORDSIZE32
|
||||
*
|
||||
* or
|
||||
*
|
||||
* swig -DSWIGWORDSIZE64
|
||||
*
|
||||
* Note that extra checking code will be added to the wrapped code,
|
||||
* which will prevent the compilation in a different architecture.
|
||||
*
|
||||
* If you don't specify the SWIGWORDSIZE (the default case), swig will
|
||||
* generate architecture independent and/or 32bits code, with no extra
|
||||
* checking code added.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64)
|
||||
# if (__WORDSIZE == 32)
|
||||
# define SWIGWORDSIZE32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32)
|
||||
# if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64)
|
||||
# define SWIGWORDSIZE64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SWIGWORDSIZE32
|
||||
%{
|
||||
#define SWIGWORDSIZE32
|
||||
#ifndef LONG_MAX
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX)
|
||||
# error "SWIG wrapped code invalid in 64 bit architecture, regenerate code using -DSWIGWORDSIZE64"
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
||||
#ifdef SWIGWORDSIZE64
|
||||
%{
|
||||
#define SWIGWORDSIZE64
|
||||
#ifndef LONG_MAX
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
|
||||
# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
%include <typemaps/cdata.swg>
|
||||
@@ -1,85 +0,0 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* tclsh.i
|
||||
*
|
||||
* SWIG File for building new tclsh program
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef AUTODOC
|
||||
%subsection "tclsh.i"
|
||||
%text %{
|
||||
This module provides the Tcl_AppInit() function needed to build a
|
||||
new version of the tclsh executable. This file should not be used
|
||||
when using dynamic loading. To make an interface file work with
|
||||
both static and dynamic loading, put something like this in your
|
||||
interface file :
|
||||
|
||||
#ifdef STATIC
|
||||
%include <tclsh.i>
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
||||
%{
|
||||
|
||||
/* A TCL_AppInit() function that lets you build a new copy
|
||||
* of tclsh.
|
||||
*
|
||||
* The macro SWIG_init contains the name of the initialization
|
||||
* function in the wrapper file.
|
||||
*/
|
||||
|
||||
#ifndef SWIG_RcFileName
|
||||
char *SWIG_RcFileName = "~/.myapprc";
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MAC_TCL
|
||||
extern int MacintoshInit _ANSI_ARGS_((void));
|
||||
#endif
|
||||
|
||||
int Tcl_AppInit(Tcl_Interp *interp){
|
||||
|
||||
if (Tcl_Init(interp) == TCL_ERROR)
|
||||
return TCL_ERROR;
|
||||
|
||||
/* Now initialize our functions */
|
||||
|
||||
if (SWIG_init(interp) == TCL_ERROR)
|
||||
return TCL_ERROR;
|
||||
#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
|
||||
Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
tcl_RcFileName = SWIG_RcFileName;
|
||||
#endif
|
||||
#ifdef SWIG_RcRsrcName
|
||||
Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL);
|
||||
#endif
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef MAC_TCL
|
||||
char *newArgv[2];
|
||||
|
||||
if (MacintoshInit() != TCL_OK) {
|
||||
Tcl_Exit(1);
|
||||
}
|
||||
|
||||
argc = 1;
|
||||
newArgv[0] = "tclsh";
|
||||
newArgv[1] = NULL;
|
||||
argv = newArgv;
|
||||
#endif
|
||||
|
||||
Tcl_Main(argc, argv, Tcl_AppInit);
|
||||
return(0);
|
||||
|
||||
}
|
||||
#else
|
||||
extern int main();
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef __Lib_allkw_swg__
|
||||
#define __Lib_allkw_swg__
|
||||
#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG
|
||||
#define SWIG_INCLUDED_LIB_ALLKW_SWG
|
||||
|
||||
|
||||
/*
|
||||
@@ -20,6 +20,7 @@
|
||||
%include <d/dkw.swg>
|
||||
%include <go/gokw.swg>
|
||||
%include <java/javakw.swg>
|
||||
%include <javascript/javascriptkw.swg>
|
||||
%include <lua/luakw.swg>
|
||||
%include <ocaml/ocamlkw.swg>
|
||||
%include <perl5/perlkw.swg>
|
||||
@@ -30,4 +31,4 @@
|
||||
%include <tcl/tclkw.swg>
|
||||
|
||||
|
||||
#endif //__Lib_allkw_swg__
|
||||
#endif // SWIG_INCLUDED_LIB_ALLKW_SWG
|
||||
5
linx64/bin/swig/share/swig/4.3.0/c/boost_shared_ptr.i
Normal file
5
linx64/bin/swig/share/swig/4.3.0/c/boost_shared_ptr.i
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef SWIG_SHARED_PTR_NAMESPACE
|
||||
#define SWIG_SHARED_PTR_NAMESPACE boost
|
||||
#endif
|
||||
|
||||
%include <std_shared_ptr.i>
|
||||
359
linx64/bin/swig/share/swig/4.3.0/c/c.swg
Normal file
359
linx64/bin/swig/share/swig/4.3.0/c/c.swg
Normal file
@@ -0,0 +1,359 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* c.swg
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <cheader.swg>
|
||||
|
||||
%insert("runtime") "clabels.swg"
|
||||
|
||||
%insert("runtime") %{
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) if(!(expr)) { printf("%s\n", msg); SWIG_exit(0); } else
|
||||
%}
|
||||
|
||||
%fragment("stdbool_inc", "cheader") {#include <stdbool.h>}
|
||||
|
||||
%define same_macro_all_primitive_types_but_void(macro_name, TM)
|
||||
macro_name(TM, short);
|
||||
macro_name(TM, unsigned short);
|
||||
macro_name(TM, int);
|
||||
macro_name(TM, unsigned int);
|
||||
macro_name(TM, long);
|
||||
macro_name(TM, unsigned long);
|
||||
macro_name(TM, long long);
|
||||
macro_name(TM, unsigned long long);
|
||||
macro_name(TM, char);
|
||||
macro_name(TM, signed char);
|
||||
macro_name(TM, unsigned char);
|
||||
macro_name(TM, float);
|
||||
macro_name(TM, double);
|
||||
macro_name(TM, size_t);
|
||||
%enddef
|
||||
|
||||
// This is used to handle all primitive types as just themselves.
|
||||
// This macro doesn't cover const references, use either cref_as_value or
|
||||
// cref_as_ptr below in addition to it.
|
||||
// Notice that const pointers are mapped to non-const ones as we need to
|
||||
// declare variables of this type when it's used as a return type, and top
|
||||
// level const doesn't matter anyhow in the function declarations.
|
||||
%define same_type(TM, T)
|
||||
%typemap(TM) T, const T "T"
|
||||
%typemap(TM) T*, T&, T[ANY], T[] "T *"
|
||||
%typemap(TM) const T*, const T[ANY], const T[] "const T *"
|
||||
%typemap(TM) T**, T*&, T*[ANY], T[ANY][ANY] "T **"
|
||||
%typemap(TM) const T**, const T*&, T *const &, const T*[ANY], const T[ANY][ANY] "const T **"
|
||||
// constant pointers
|
||||
%typemap(TM) T * const "T *"
|
||||
%typemap(TM) T* * const "T* *"
|
||||
%typemap(TM) const T* * const "const T* *"
|
||||
%enddef
|
||||
|
||||
%define cref_as_value(TM, T)
|
||||
%typemap(TM) const T& "T"
|
||||
%enddef
|
||||
|
||||
%define cref_as_ptr(TM, T)
|
||||
%typemap(TM) const T& "T *"
|
||||
%enddef
|
||||
|
||||
%define same_type_all_primitive_types_but_void(TM)
|
||||
%enddef
|
||||
|
||||
//Used by 'in' and 'out' typemaps
|
||||
%define same_action(TM, T, ACTION, ACTION_CREF)
|
||||
%typemap(TM) T, const T ACTION
|
||||
%typemap(TM) const T& ACTION_CREF
|
||||
%typemap(TM) T*, T&, T[ANY], T[] ACTION
|
||||
%typemap(TM) const T*, const T[ANY], const T[] ACTION
|
||||
%typemap(TM) T**, T*&, T*[ANY], T[ANY][ANY] ACTION
|
||||
%typemap(TM) const T**, const T*&, const T*[ANY], const T[ANY][ANY] ACTION
|
||||
// constant pointers
|
||||
%typemap(TM) T * const ACTION
|
||||
%typemap(TM) T* * const ACTION
|
||||
%typemap(TM) const T* * const ACTION
|
||||
%enddef
|
||||
|
||||
%define same_action_all_primitive_types(TM, ACTION, ACTION_CREF)
|
||||
same_action(TM, short, ACTION, ACTION_CREF);
|
||||
same_action(TM, unsigned short, ACTION, ACTION_CREF);
|
||||
same_action(TM, int, ACTION, ACTION_CREF);
|
||||
same_action(TM, unsigned int, ACTION, ACTION_CREF);
|
||||
same_action(TM, long, ACTION, ACTION_CREF);
|
||||
same_action(TM, unsigned long, ACTION, ACTION_CREF);
|
||||
same_action(TM, long long, ACTION, ACTION_CREF);
|
||||
same_action(TM, unsigned long long, ACTION, ACTION_CREF);
|
||||
same_action(TM, char, ACTION, ACTION_CREF);
|
||||
same_action(TM, signed char, ACTION, ACTION_CREF);
|
||||
same_action(TM, unsigned char, ACTION, ACTION_CREF);
|
||||
//unsigned only
|
||||
same_action(TM, float, ACTION, ACTION_CREF);
|
||||
same_action(TM, double, ACTION, ACTION_CREF);
|
||||
same_action(TM, size_t, ACTION, ACTION_CREF);
|
||||
%typemap(TM) void*, void const* ACTION
|
||||
%enddef
|
||||
|
||||
// "ctype" is the type used with C wrapper functions.
|
||||
// void
|
||||
%typemap(ctype) void "void"
|
||||
%typemap(ctype) void*, void& "void *"
|
||||
%typemap(ctype) const void&, const void* "const void *"
|
||||
%typemap(ctype) void**, void*& "void **"
|
||||
%typemap(ctype) const void**, const void*& "const void **"
|
||||
// constant pointers
|
||||
%typemap(ctype) void* * const "void* * const"
|
||||
%typemap(ctype) const void* * const "const void* * const"
|
||||
|
||||
same_macro_all_primitive_types_but_void(same_type,ctype);
|
||||
same_macro_all_primitive_types_but_void(cref_as_value,ctype);
|
||||
|
||||
// trivial typemap for arrays of void pointers to avoid applying the object typemaps to them
|
||||
%typemap(ctype) void*[ANY] "void **"
|
||||
|
||||
// objects
|
||||
%typemap(ctype) SWIGTYPE "$&resolved_type*"
|
||||
%typemap(ctype) SWIGTYPE * "$resolved_type*"
|
||||
%typemap(ctype) SWIGTYPE * const & "$resolved_type*"
|
||||
%typemap(ctype) SWIGTYPE & "$*resolved_type*"
|
||||
%typemap(ctype) SWIGTYPE [ANY] "$resolved_type*"
|
||||
%typemap(ctype) SWIGTYPE * [ANY] "$resolved_type**"
|
||||
|
||||
// enums
|
||||
%typemap(ctype) enum SWIGTYPE "$resolved_type"
|
||||
%typemap(ctype) enum SWIGTYPE * "$resolved_type*"
|
||||
%typemap(ctype) enum SWIGTYPE & "$*resolved_type*"
|
||||
%typemap(ctype) enum SWIGTYPE [ANY] "$resolved_type*"
|
||||
|
||||
%typemap(ctype, fragment="stdbool_inc") bool, const bool, const bool & "bool"
|
||||
%typemap(ctype, fragment="stdbool_inc") bool *, const bool *, bool & "bool *"
|
||||
|
||||
// Typemaps for assigning wrapper parameters to local variables
|
||||
same_action_all_primitive_types(in, "$1 = ($1_ltype) $input;", "$1 = &$input;")
|
||||
|
||||
%typemap(in) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY] "$1 = ($1_basetype *) $input;"
|
||||
%typemap(in) short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$1 = ($1_basetype *) $input;"
|
||||
|
||||
%typemap(in, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool * "$1 = ($1_ltype) $input;"
|
||||
%typemap(in, fragment="stdbool_inc") bool & "$1 = ($1_basetype *) $input;"
|
||||
%typemap(in, fragment="stdbool_inc") const bool &, const bool * "$1 = ($1_basetype *) $input;"
|
||||
|
||||
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) $input;"
|
||||
%typemap(in) enum SWIGTYPE &,enum SWIGTYPE * "$1 = ($1_ltype) $input;"
|
||||
|
||||
%typemap(in) SWIGTYPE [] "$1 = ($1_ltype) $input;"
|
||||
%typemap(in) SWIGTYPE ((&)[ANY]) "$1 = ($1_ltype) $input;"
|
||||
|
||||
%typemap(in) SWIGTYPE (CLASS::*) {
|
||||
if ($input)
|
||||
$1 = *($&1_ltype) &$input;
|
||||
}
|
||||
|
||||
%typemap(in) SWIGTYPE "$1 = *($1_ltype *)$input;"
|
||||
|
||||
%typemap(in) SWIGTYPE * "$1 = ($1_ltype) $input;"
|
||||
|
||||
%typemap(in) SWIGTYPE *[ANY] {
|
||||
if ($input) {
|
||||
$1 = ($1_ltype) malloc($1_dim0 * sizeof($1_basetype));
|
||||
size_t i = 0;
|
||||
for ( ; i < $1_dim0; ++i)
|
||||
if ($input[i])
|
||||
$1[i] = ($*1_ltype) $input[i];
|
||||
else
|
||||
$1[i] = ($*1_ltype) 0;
|
||||
}
|
||||
else
|
||||
$1 = ($1_ltype) 0;
|
||||
}
|
||||
|
||||
%typemap(in) SWIGTYPE [ANY][ANY] {
|
||||
if ($input) {
|
||||
$1 = ($1_ltype) malloc($1_dim0 * $1_dim1 * sizeof($1_basetype));
|
||||
size_t i = 0, j = 0;
|
||||
for ( ; i < $1_dim0; ++i) {
|
||||
for ( ; j < $1_dim1; ++j) {
|
||||
if ($input[i][j])
|
||||
$1[i][j] = * ($*1_ltype) $input[i][j];
|
||||
else
|
||||
$1[i][j] = * ($*1_ltype) 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$1 = ($1_ltype) 0;
|
||||
}
|
||||
|
||||
%typemap(freearg) SWIGTYPE * [ANY], SWIGTYPE * [ANY][ANY] {
|
||||
if ($input)
|
||||
free($input);
|
||||
}
|
||||
|
||||
%typemap(in) SWIGTYPE & %{
|
||||
$1 = ($1_ltype) $input;
|
||||
%}
|
||||
|
||||
// Typemaps for assigning result values to a special return variable
|
||||
same_action_all_primitive_types(out, "$result = $1;", "$result = *$1;")
|
||||
|
||||
%typemap(out) void ""
|
||||
|
||||
%typemap(out, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$result = ($1_ltype) $1;"
|
||||
%typemap(out, fragment="stdbool_inc") bool &, const bool & "$result = $1;"
|
||||
|
||||
%typemap(out) enum SWIGTYPE "$result = (int) $1;"
|
||||
%typemap(out) enum SWIGTYPE &, enum SWIGTYPE * "$result = $1;"
|
||||
|
||||
%typemap(out) SWIGTYPE (CLASS::*) {
|
||||
*($&1_ltype) &$result = $1;
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE "$result = (SwigObj*)new $1_ltype($1);"
|
||||
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE & "$result = (SwigObj*) $1;"
|
||||
|
||||
%typemap(out) SWIGTYPE * [ANY], SWIGTYPE [ANY][ANY] {
|
||||
static SwigObj **_temp = 0;
|
||||
if ($1) {
|
||||
size_t i = 0;
|
||||
if (_temp) {
|
||||
for ( ; i < $1_dim0; ++i)
|
||||
delete ($1_ltype *)_temp[i];
|
||||
free(_temp);
|
||||
}
|
||||
_temp = (SwigObj**) malloc($1_dim0 * sizeof(SwigObj*));
|
||||
for (i = 0 ; i < $1_dim0; ++i) {
|
||||
if ($1[i]) {
|
||||
_temp[i] = $1[i];
|
||||
}
|
||||
else
|
||||
_temp[i] = (SwigObj*) 0;
|
||||
}
|
||||
$result = ($1_ltype) _temp;
|
||||
}
|
||||
else
|
||||
$result = ($1_ltype) 0;
|
||||
}
|
||||
|
||||
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
|
||||
* that cannot be overloaded in the wrappers as more than one C++ type maps to a single C type */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL)
|
||||
bool,
|
||||
const bool &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_CHAR)
|
||||
char,
|
||||
const char &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT8)
|
||||
signed char,
|
||||
const signed char &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_UINT8)
|
||||
unsigned char,
|
||||
const unsigned char &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT16)
|
||||
short,
|
||||
const short &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_UINT16)
|
||||
unsigned short,
|
||||
const unsigned short &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT32)
|
||||
int,
|
||||
long,
|
||||
const int &,
|
||||
const long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_UINT32)
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
const unsigned int &,
|
||||
const unsigned long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT64)
|
||||
long long,
|
||||
const long long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_UINT64)
|
||||
unsigned long long,
|
||||
const unsigned long long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_FLOAT)
|
||||
float,
|
||||
const float &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE)
|
||||
double,
|
||||
const double &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_STRING)
|
||||
char *,
|
||||
char *&,
|
||||
char[ANY],
|
||||
char[]
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER)
|
||||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE *const&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
||||
#ifdef SWIG_CPPMODE
|
||||
|
||||
%insert("runtime") %{
|
||||
typedef struct SwigObj SwigObj;
|
||||
%}
|
||||
|
||||
%insert("cheader") %{
|
||||
typedef struct SwigObj SwigObj;
|
||||
%}
|
||||
|
||||
#endif // SWIG_CPPMODE
|
||||
|
||||
#ifdef SWIG_C_EXCEPT
|
||||
%include "cexcept.swg"
|
||||
#else // !SWIG_C_EXCEPT
|
||||
// Still define the macro used in some standard typemaps, but we can't
|
||||
// implement it in C, so just allow the user predefining their own version.
|
||||
%insert("runtime") %{
|
||||
#ifndef SWIG_exception
|
||||
#define SWIG_exception(code, msg)
|
||||
#endif
|
||||
%}
|
||||
#endif // SWIG_C_EXCEPT/!SWIG_C_EXCEPT
|
||||
|
||||
%insert("runtime") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
SWIGEXPORTC int SWIG_exit(int code) { exit(code); }
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
29
linx64/bin/swig/share/swig/4.3.0/c/cdata.i
Normal file
29
linx64/bin/swig/share/swig/4.3.0/c/cdata.i
Normal file
@@ -0,0 +1,29 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cdata.i
|
||||
*
|
||||
* SWIG library file containing macros for manipulating raw C data.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <typemaps/cdata_begin.swg>
|
||||
|
||||
%insert("cheader") {
|
||||
typedef struct SWIGCDATA {
|
||||
char *data;
|
||||
size_t len;
|
||||
} SWIGCDATA;
|
||||
}
|
||||
|
||||
%typemap(ctype) SWIGCDATA "SWIGCDATA"
|
||||
%typemap(cppouttype) SWIGCDATA "SWIGCDATA"
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
$result = $1;
|
||||
}
|
||||
|
||||
%typemap(ctype) (const void* BYTES, size_t LENGTH) "const SWIGCDATA*"
|
||||
%typemap(in) (const void* BYTES, size_t LENGTH) {
|
||||
$1 = $input->data;
|
||||
$2 = $input->len;
|
||||
}
|
||||
|
||||
%include <typemaps/cdata_end.swg>
|
||||
109
linx64/bin/swig/share/swig/4.3.0/c/cexcept.swg
Normal file
109
linx64/bin/swig/share/swig/4.3.0/c/cexcept.swg
Normal file
@@ -0,0 +1,109 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* clabels.swg
|
||||
*
|
||||
* Exception handling code and typemaps for C module.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// This function is special: it's used by various typemaps (via SWIG_exception
|
||||
// macro below) and needs to be defined, but we don't want to export it.
|
||||
%ignore SWIG_CException_Raise;
|
||||
%{
|
||||
extern "C" SWIGEXPORTC void SWIG_CException_Raise(int code, const char* msg);
|
||||
%}
|
||||
|
||||
// This class is special too because its name is used in c.cxx source. It is
|
||||
// only defined if the code there didn't predefine SWIG_CException_DEFINED
|
||||
// because the class is already defined in another module.
|
||||
//
|
||||
// It has to be seen by SWIG because we want to generate wrappers for its
|
||||
// public functions to be able to use it from the application code.
|
||||
%inline %{
|
||||
#ifndef SWIG_CException_DEFINED
|
||||
class SWIG_CException {
|
||||
public:
|
||||
SWIG_CException(const SWIG_CException& ex) throw() : code(ex.code), msg(strdup(ex.msg)) { }
|
||||
~SWIG_CException() { free(const_cast<char*>(msg)); }
|
||||
|
||||
const int code;
|
||||
const char* const msg;
|
||||
|
||||
static SWIG_CException* get_pending() throw() {
|
||||
return PendingException;
|
||||
}
|
||||
|
||||
static void reset_pending() throw() {
|
||||
if (PendingException) {
|
||||
delete PendingException;
|
||||
PendingException = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
friend void SWIG_CException_Raise(int code, const char* msg);
|
||||
|
||||
static thread_local SWIG_CException* PendingException;
|
||||
|
||||
SWIG_CException(int code, const char* msg) : code(code), msg(strdup(msg)) { }
|
||||
|
||||
SWIG_CException& operator=(const SWIG_CException& ex);
|
||||
};
|
||||
#endif // SWIG_CException_DEFINED
|
||||
%}
|
||||
|
||||
// This part is implementation only and doesn't need to be seen by SWIG.
|
||||
%{
|
||||
#ifndef SWIG_CException_DEFINED
|
||||
thread_local SWIG_CException *SWIG_CException::PendingException = 0;
|
||||
|
||||
SWIGEXPORTC void SWIG_CException_Raise(int code, const char* msg) {
|
||||
delete SWIG_CException::PendingException;
|
||||
SWIG_CException::PendingException = new SWIG_CException(code, msg);
|
||||
}
|
||||
#endif // SWIG_CException_DEFINED
|
||||
%}
|
||||
|
||||
#ifdef SWIG_CXX_WRAPPERS
|
||||
|
||||
// This is somewhat of a hack, but our generated header may include another
|
||||
// generated header, when using multiple modules, and defining swig_check() in
|
||||
// all of them would result in errors, so we use SWIG_swig_check_DEFINED to
|
||||
// prevent this from happening.
|
||||
//
|
||||
// This also has a nice side effect of allowing the user code to predefine this
|
||||
// symbol and provide their own SWIG_swig_check_DEFINED implementation to
|
||||
// customize exception handling.
|
||||
%insert("cxxcode") %{
|
||||
#ifndef SWIG_swig_check_DEFINED
|
||||
#define SWIG_swig_check_DEFINED 1
|
||||
|
||||
inline void swig_check() {
|
||||
if (SWIG_CException* swig_ex = SWIG_CException::get_pending()) {
|
||||
SWIG_CException swig_ex_copy{*swig_ex};
|
||||
delete swig_ex;
|
||||
SWIG_CException::reset_pending();
|
||||
throw swig_ex_copy;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> T swig_check(T x) {
|
||||
swig_check();
|
||||
return x;
|
||||
}
|
||||
|
||||
#endif // SWIG_swig_check_DEFINED
|
||||
%}
|
||||
|
||||
#endif // SWIG_CXX_WRAPPERS
|
||||
|
||||
%insert("runtime") "swigerrors.swg"
|
||||
|
||||
#define SWIG_exception(code, msg)\
|
||||
SWIG_CException_Raise(code, msg)
|
||||
|
||||
%typemap(throws, noblock="1") char *, const char * {
|
||||
SWIG_exception(SWIG_RuntimeError, $1);
|
||||
}
|
||||
|
||||
%typemap(throws, noblock="1") SWIGTYPE {
|
||||
SWIG_exception(SWIG_UnknownError, "exception of type $1_type");
|
||||
}
|
||||
20
linx64/bin/swig/share/swig/4.3.0/c/cheader.swg
Normal file
20
linx64/bin/swig/share/swig/4.3.0/c/cheader.swg
Normal file
@@ -0,0 +1,20 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cheader.swg
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%insert("cheader") %{
|
||||
#ifndef SWIGIMPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGDLLIMPORT
|
||||
# else
|
||||
# define SWIGDLLIMPORT __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define SWIGDLLIMPORT
|
||||
# endif
|
||||
# define SWIGIMPORT extern SWIGDLLIMPORT
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
%}
|
||||
23
linx64/bin/swig/share/swig/4.3.0/c/clabels.swg
Normal file
23
linx64/bin/swig/share/swig/4.3.0/c/clabels.swg
Normal file
@@ -0,0 +1,23 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* clabels.swg
|
||||
*
|
||||
* Definitions of C specific preprocessor symbols.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// this is used instead of default SWIGEXPORT symbol
|
||||
|
||||
#ifndef SWIGEXPORTC
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORTC
|
||||
# else
|
||||
# define SWIGEXPORTC __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORTC __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORTC
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
4
linx64/bin/swig/share/swig/4.3.0/c/std_common.i
Normal file
4
linx64/bin/swig/share/swig/4.3.0/c/std_common.i
Normal file
@@ -0,0 +1,4 @@
|
||||
%include <std_except.i>
|
||||
|
||||
%apply size_t { std::size_t };
|
||||
%apply const size_t& { const std::size_t & };
|
||||
20
linx64/bin/swig/share/swig/4.3.0/c/std_except.i
Normal file
20
linx64/bin/swig/share/swig/4.3.0/c/std_except.i
Normal file
@@ -0,0 +1,20 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* std_except.i
|
||||
*
|
||||
* Typemaps used by the STL wrappers that throw exceptions.
|
||||
* These typemaps are used when methods are declared with an STL exception specification, such as
|
||||
* size_t at() const throw (std::out_of_range);
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std
|
||||
{
|
||||
%ignore exception;
|
||||
struct exception {};
|
||||
}
|
||||
61
linx64/bin/swig/share/swig/4.3.0/c/std_map.i
Normal file
61
linx64/bin/swig/share/swig/4.3.0/c/std_map.i
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_map.i
|
||||
*
|
||||
* SWIG typemaps for std::map
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::map
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
template<class K, class T, class C = std::less<K> > class map {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
map();
|
||||
map(const map& other);
|
||||
|
||||
size_t size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
const T& get(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
void set(const K& key, const T& x) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
void del(const K& key) throw (std::out_of_range) {
|
||||
std::map< K, T, C >::iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
self->erase(i);
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
bool has_key(const K& key) const {
|
||||
std::map< K, T, C >::const_iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
24
linx64/bin/swig/share/swig/4.3.0/c/std_pair.i
Normal file
24
linx64/bin/swig/share/swig/4.3.0/c/std_pair.i
Normal file
@@ -0,0 +1,24 @@
|
||||
%{
|
||||
#include <utility>
|
||||
%}
|
||||
|
||||
// Ideal, especially for the simple/primitive types, would be to represent
|
||||
// pair<T,U> as a C struct with the 2 fields, but for now we use the simplest
|
||||
// possible implementation, with the accessor functions required to work with
|
||||
// the fields.
|
||||
|
||||
namespace std {
|
||||
template <class T, class U> struct pair {
|
||||
typedef T first_type;
|
||||
typedef U second_type;
|
||||
|
||||
pair();
|
||||
pair(T first, U second);
|
||||
pair(const pair& other);
|
||||
|
||||
template <class T2, class U2> pair(const pair<T2, U2> &other);
|
||||
|
||||
T first;
|
||||
U second;
|
||||
};
|
||||
}
|
||||
48
linx64/bin/swig/share/swig/4.3.0/c/std_set.i
Normal file
48
linx64/bin/swig/share/swig/4.3.0/c/std_set.i
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_set.i
|
||||
*
|
||||
* SWIG typesets for std::set
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::set
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
template<class T> class set {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T key_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
set();
|
||||
set(const set& other);
|
||||
|
||||
size_t size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%extend {
|
||||
bool add(const T& item) {
|
||||
return self->insert(item).second;
|
||||
}
|
||||
bool del(const T& item) {
|
||||
return self->erase(item) != 0;
|
||||
}
|
||||
bool has(const T& item) const {
|
||||
return self->count(item) != 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
84
linx64/bin/swig/share/swig/4.3.0/c/std_shared_ptr.i
Normal file
84
linx64/bin/swig/share/swig/4.3.0/c/std_shared_ptr.i
Normal file
@@ -0,0 +1,84 @@
|
||||
// This could be predefined in e.g. our own boost_shared_ptr.i
|
||||
#ifndef SWIG_SHARED_PTR_NAMESPACE
|
||||
#define SWIG_SHARED_PTR_NAMESPACE std
|
||||
#endif
|
||||
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
|
||||
%naturalvar TYPE;
|
||||
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
||||
// Replace the default "delete arg1" with the code destroying the smart pointer itself instead.
|
||||
%feature("unref") TYPE "(void)arg1; delete smartarg1;"
|
||||
|
||||
// All smart pointers look like normal objects to the code using the interface.
|
||||
%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 >*
|
||||
"$typemap(ctype, TYPE)";
|
||||
|
||||
// Typemap for smart pointer type itself: these are somewhat special because we represent empty shared pointers as null pointers at C level because there is
|
||||
// no advantage in using a non-null pointer in this case, while testing for NULL is much simpler than testing whether a shared pointer is empty.
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > empty) %{
|
||||
$1 = $input ? *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE>*)$input : empty; %}
|
||||
|
||||
%typemap(in) const SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > empty) %{
|
||||
$1 = $input ? (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE>*)$input : ∅ %}
|
||||
|
||||
// Note that "&" here is required because "$1" ends up being SwigValueWrapper and not the shared pointer itself. This is wrong and should be fixed by disabling
|
||||
// the use of SwigValueWrapper for shared pointers entirely, as it's never needed for them.
|
||||
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > %{ $result = (&$1 ? new $1_ltype($1) : 0); %}
|
||||
|
||||
// Use of "*" here is due to the fact that "$1" is a pointer, but we want to test the smart pointer itself.
|
||||
%typemap(out) const SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE>& %{ $result = (*$1 ? $1 : 0); %}
|
||||
|
||||
// And for the plain type.
|
||||
%typemap(in) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE > *)$input;
|
||||
if (!smartarg || !smartarg->get()) {
|
||||
SWIG_exception(SWIG_RuntimeError, "$1_type value is null");
|
||||
return $null;
|
||||
}
|
||||
$1 = **smartarg;%}
|
||||
%typemap(out) CONST TYPE %{
|
||||
$result = (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE >(new $1_ltype($1));%}
|
||||
|
||||
// Plain type 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;
|
||||
$1 = (TYPE *)(smartarg ? smartarg->get() : 0);%}
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{
|
||||
$result = $1 ? (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;%}
|
||||
|
||||
// Plain type references.
|
||||
%typemap(in) CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE > *)$input;
|
||||
if (!smartarg || !smartarg->get()) {
|
||||
SWIG_exception(SWIG_RuntimeError, "$1_type reference is null");
|
||||
return $null;
|
||||
}
|
||||
$1 = (TYPE *)smartarg->get();%}
|
||||
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & %{
|
||||
$result = (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr<CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner);%}
|
||||
|
||||
// Allow creating null shared pointers and testing them for validity.
|
||||
%typemap(cxxcode) TYPE %{
|
||||
static $cxxclassname null() { return $cxxclassname{($cclassptrname)nullptr, false}; }
|
||||
explicit operator bool() const { return swig_self_ != nullptr; }
|
||||
%}
|
||||
|
||||
// This is required to handle overloads on shared_ptr/normal type correctly.
|
||||
%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 > *&
|
||||
""
|
||||
|
||||
%enddef
|
||||
|
||||
%include <shared_ptr.i>
|
||||
90
linx64/bin/swig/share/swig/4.3.0/c/std_string.i
Normal file
90
linx64/bin/swig/share/swig/4.3.0/c/std_string.i
Normal file
@@ -0,0 +1,90 @@
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%fragment("SwigStrInOut", "header") {
|
||||
class SwigStrInOut {
|
||||
std::string str_;
|
||||
char* ptr_;
|
||||
size_t len_;
|
||||
public:
|
||||
void init(char* ptr) {
|
||||
ptr_ = ptr;
|
||||
if (ptr_) {
|
||||
str_ = ptr_;
|
||||
len_ = str_.length();
|
||||
}
|
||||
}
|
||||
|
||||
std::string* str() { return &str_; }
|
||||
|
||||
~SwigStrInOut() {
|
||||
if (ptr_) {
|
||||
memcpy(ptr_, str_.c_str(), len_);
|
||||
ptr_[len_] = '\0';
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
%fragment("include_string", "cxxheader") %{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
// use "const string &" typemaps for wrapping member strings
|
||||
%naturalvar string;
|
||||
|
||||
class string;
|
||||
|
||||
%typemap(ctype) string, const string & "const char *"
|
||||
%typemap(ctype) string * "char *"
|
||||
%typemap(ctype) string & "char *"
|
||||
|
||||
%typemap(in) string %{
|
||||
if ($input)
|
||||
$1 = $input;
|
||||
%}
|
||||
|
||||
%typemap(in) const string & (std::string temp) %{
|
||||
if ($input)
|
||||
temp = $input;
|
||||
$1 = &temp;
|
||||
%}
|
||||
|
||||
%typemap(in, fragment="SwigStrInOut") string * (SwigStrInOut temp), string & (SwigStrInOut temp) %{
|
||||
temp.init($input);
|
||||
$1 = temp.str();
|
||||
%}
|
||||
|
||||
// Note that we don't support strings with embedded NULs, as there is no way to
|
||||
// return their length to C code anyhow.
|
||||
%typemap(out) string %{
|
||||
$result = strdup(cppresult.c_str());
|
||||
%}
|
||||
|
||||
%typemap(out) const string &, string *, string & %{
|
||||
$result = strdup(cppresult->c_str());
|
||||
%}
|
||||
|
||||
// This is required to warn about clashes between the overloaded functions
|
||||
// taking strings and raw pointers in the generated wrappers.
|
||||
%typemap(typecheck) string, const string &, string *, string & = char *;
|
||||
|
||||
|
||||
// Define typemaps for wrapping strings back into std::string in C++ wrappers
|
||||
// and accepting strings directly.
|
||||
|
||||
%typemap(cxxintype, fragment="include_string") string, const string & "std::string const&"
|
||||
|
||||
%typemap(cxxin) string, const string & "$1.c_str()"
|
||||
|
||||
%typemap(cxxouttype, fragment="include_string") string, const string & "std::string"
|
||||
|
||||
%typemap(cxxout, noblock="1") string, const string & %{
|
||||
$result = std::string($cresult);
|
||||
free(const_cast<char*>($cresult));
|
||||
%}
|
||||
|
||||
}
|
||||
91
linx64/bin/swig/share/swig/4.3.0/c/std_vector.i
Normal file
91
linx64/bin/swig/share/swig/4.3.0/c/std_vector.i
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_vector.i
|
||||
*
|
||||
* SWIG typemaps for std::vector
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
%{
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
vector();
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
bool empty() const;
|
||||
void clear();
|
||||
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");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// bool specialization
|
||||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef bool const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
bool empty() const;
|
||||
void clear();
|
||||
void push_back(bool 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, bool 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");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
12
linx64/bin/swig/share/swig/4.3.0/c/stl.i
Normal file
12
linx64/bin/swig/share/swig/4.3.0/c/stl.i
Normal file
@@ -0,0 +1,12 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* stl.i
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
%include <std_string.i>
|
||||
%include <std_vector.i>
|
||||
%include <std_map.i>
|
||||
%include <std_pair.i>
|
||||
12
linx64/bin/swig/share/swig/4.3.0/c/typemaps.i
Normal file
12
linx64/bin/swig/share/swig/4.3.0/c/typemaps.i
Normal file
@@ -0,0 +1,12 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* typemaps.i
|
||||
*
|
||||
* Pointer handling
|
||||
* These mappings provide support for input/output arguments and common
|
||||
* uses for C/C++ pointers.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <typemaps/typemaps.swg>
|
||||
@@ -5,22 +5,28 @@
|
||||
* pointers as arrays.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __cplusplus
|
||||
// C uses free/calloc/malloc
|
||||
%include "swigfragments.swg"
|
||||
%fragment("<stdlib.h>");
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %array_functions(TYPE,NAME)
|
||||
*
|
||||
* Generates functions for creating and accessing elements of a C array
|
||||
* (as pointers). Creates the following functions:
|
||||
*
|
||||
* TYPE *new_NAME(int nelements)
|
||||
* TYPE *new_NAME(size_t nelements)
|
||||
* void delete_NAME(TYPE *);
|
||||
* TYPE NAME_getitem(TYPE *, int index);
|
||||
* void NAME_setitem(TYPE *, int index, TYPE value);
|
||||
* TYPE NAME_getitem(TYPE *, size_t index);
|
||||
* void NAME_setitem(TYPE *, size_t index, TYPE value);
|
||||
*
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %array_functions(TYPE,NAME)
|
||||
%{
|
||||
static TYPE *new_##NAME(int nelements) { %}
|
||||
static TYPE *new_##NAME(size_t nelements) { %}
|
||||
#ifdef __cplusplus
|
||||
%{ return new TYPE[nelements](); %}
|
||||
#else
|
||||
@@ -36,18 +42,18 @@ static void delete_##NAME(TYPE *ary) { %}
|
||||
#endif
|
||||
%{}
|
||||
|
||||
static TYPE NAME##_getitem(TYPE *ary, int index) {
|
||||
static TYPE NAME##_getitem(TYPE *ary, size_t index) {
|
||||
return ary[index];
|
||||
}
|
||||
static void NAME##_setitem(TYPE *ary, int index, TYPE value) {
|
||||
static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) {
|
||||
ary[index] = value;
|
||||
}
|
||||
%}
|
||||
|
||||
TYPE *new_##NAME(int nelements);
|
||||
TYPE *new_##NAME(size_t nelements);
|
||||
void delete_##NAME(TYPE *ary);
|
||||
TYPE NAME##_getitem(TYPE *ary, int index);
|
||||
void NAME##_setitem(TYPE *ary, int index, TYPE value);
|
||||
TYPE NAME##_getitem(TYPE *ary, size_t index);
|
||||
void NAME##_setitem(TYPE *ary, size_t index, TYPE value);
|
||||
|
||||
%enddef
|
||||
|
||||
@@ -59,10 +65,10 @@ void NAME##_setitem(TYPE *ary, int index, TYPE value);
|
||||
* interface:
|
||||
*
|
||||
* struct NAME {
|
||||
* NAME(int nelements);
|
||||
* NAME(size_t nelements);
|
||||
* ~NAME();
|
||||
* TYPE getitem(int index);
|
||||
* void setitem(int index, TYPE value);
|
||||
* TYPE getitem(size_t index);
|
||||
* void setitem(size_t index, TYPE value);
|
||||
* TYPE * cast();
|
||||
* static NAME *frompointer(TYPE *t);
|
||||
* }
|
||||
@@ -80,14 +86,14 @@ typedef struct {
|
||||
%extend NAME {
|
||||
|
||||
#ifdef __cplusplus
|
||||
NAME(int nelements) {
|
||||
NAME(size_t nelements) {
|
||||
return new TYPE[nelements]();
|
||||
}
|
||||
~NAME() {
|
||||
delete [] self;
|
||||
}
|
||||
#else
|
||||
NAME(int nelements) {
|
||||
NAME(size_t nelements) {
|
||||
return (TYPE *) calloc(nelements,sizeof(TYPE));
|
||||
}
|
||||
~NAME() {
|
||||
@@ -95,10 +101,10 @@ NAME(int nelements) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TYPE getitem(int index) {
|
||||
TYPE getitem(size_t index) {
|
||||
return self[index];
|
||||
}
|
||||
void setitem(int index, TYPE value) {
|
||||
void setitem(size_t index, TYPE value) {
|
||||
self[index] = value;
|
||||
}
|
||||
TYPE * cast() {
|
||||
50
linx64/bin/swig/share/swig/4.3.0/cdata.i
Normal file
50
linx64/bin/swig/share/swig/4.3.0/cdata.i
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cdata.i
|
||||
*
|
||||
* SWIG library file containing macros for manipulating raw C data.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%typemap(in,noblock=0,fragment="SWIG_AsCharPtrAndSize") (const void *BYTES, size_t LENGTH) (int res, void *buf = 0, size_t len = 0, int alloc = 0) {
|
||||
res = SWIG_AsCharPtrAndSize($input, (char **)&buf, &len, &alloc);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res,"$type",$symname, $argnum);
|
||||
}
|
||||
$1 = %reinterpret_cast(buf, $1_ltype);
|
||||
$2 = %numeric_cast(len, $2_ltype);
|
||||
}
|
||||
|
||||
%typemap(freearg,noblock=1,match="in") (const void *BYTES, size_t LENGTH) {
|
||||
if (alloc$argnum == SWIG_NEWOBJ) {
|
||||
%delete_array((char*)(buf$argnum));
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1,fragment="SWIG_FromCharPtrAndSize") (const void *BYTES, size_t LENGTH) {
|
||||
if ($1 && $2 > 0) {
|
||||
$input = SWIG_FromCharPtrAndSize((const char*)$1, (size_t)$2);
|
||||
} else {
|
||||
$input = SWIG_FromCharPtrAndSize("", 0);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(freearg) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(directorin) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(in) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(freearg) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(directorin) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(in) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH);
|
||||
%typemap(freearg) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH);
|
||||
%typemap(directorin) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH);
|
||||
%typemap(in) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(freearg) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH);
|
||||
%typemap(directorin) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH);
|
||||
#define SWIG_CDATA_APPLIED
|
||||
|
||||
%include <typemaps/cdata_begin.swg>
|
||||
|
||||
%typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") SWIGCDATA {
|
||||
%set_output(SWIG_FromCharPtrAndSize($1.data,$1.len));
|
||||
}
|
||||
|
||||
%include <typemaps/cdata_end.swg>
|
||||
@@ -8,67 +8,60 @@
|
||||
* errors in a language-independent manner.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef AUTODOC
|
||||
%text %{
|
||||
%include <constraints.i>
|
||||
|
||||
This library provides support for applying constraints to function
|
||||
arguments. Using a constraint, you can restrict arguments to be
|
||||
positive numbers, non-NULL pointers, and so on. The following
|
||||
constraints are available :
|
||||
|
||||
Number POSITIVE - Positive number (not zero)
|
||||
Number NEGATIVE - Negative number (not zero)
|
||||
Number NONZERO - Nonzero number
|
||||
Number NONNEGATIVE - Positive number (including zero)
|
||||
Number NONPOSITIVE - Negative number (including zero)
|
||||
Pointer NONNULL - Non-NULL pointer
|
||||
Pointer ALIGN8 - 8-byte aligned pointer
|
||||
Pointer ALIGN4 - 4-byte aligned pointer
|
||||
Pointer ALIGN2 - 2-byte aligned pointer
|
||||
|
||||
To use the constraints, you need to "apply" them to specific
|
||||
function arguments in your code. This is done using the %apply
|
||||
directive. For example :
|
||||
|
||||
%apply Number NONNEGATIVE { double nonneg };
|
||||
double sqrt(double nonneg); // Name of argument must match
|
||||
|
||||
%apply Pointer NONNULL { void *ptr };
|
||||
void *malloc(int POSITIVE); // May return a NULL pointer
|
||||
void free(void *ptr); // May not accept a NULL pointer
|
||||
|
||||
Any function argument of the type you specify with the %apply directive
|
||||
will be checked with the appropriate constraint. Multiple types may
|
||||
be specified as follows :
|
||||
|
||||
%apply Pointer NONNULL { void *, Vector *, List *, double *};
|
||||
|
||||
In this case, all of the types listed would be checked for non-NULL
|
||||
pointers.
|
||||
|
||||
The common datatypes of int, short, long, unsigned int, unsigned long,
|
||||
unsigned short, unsigned char, signed char, float, and double can be
|
||||
checked without using the %apply directive by simply using the
|
||||
constraint name as the parameter name. For example :
|
||||
|
||||
double sqrt(double NONNEGATIVE);
|
||||
double log(double POSITIVE);
|
||||
|
||||
If you have used typedef to change type-names, you can also do this :
|
||||
|
||||
%apply double { Real }; // Make everything defined for doubles
|
||||
// work for Reals.
|
||||
Real sqrt(Real NONNEGATIVE);
|
||||
Real log(Real POSITIVE);
|
||||
|
||||
%}
|
||||
#endif
|
||||
// This library provides support for applying constraints to function
|
||||
// arguments. Using a constraint, you can restrict arguments to be
|
||||
// positive numbers, non-NULL pointers, and so on. The following
|
||||
// constraints are available :
|
||||
//
|
||||
// Number POSITIVE - Positive number (not zero)
|
||||
// Number NEGATIVE - Negative number (not zero)
|
||||
// Number NONZERO - Nonzero number
|
||||
// Number NONNEGATIVE - Positive number (including zero)
|
||||
// Number NONPOSITIVE - Negative number (including zero)
|
||||
// Pointer NONNULL - Non-NULL pointer
|
||||
// Pointer ALIGN8 - 8-byte aligned pointer
|
||||
// Pointer ALIGN4 - 4-byte aligned pointer
|
||||
// Pointer ALIGN2 - 2-byte aligned pointer
|
||||
//
|
||||
// To use the constraints, you need to "apply" them to specific
|
||||
// function arguments in your code. This is done using the %apply
|
||||
// directive. For example :
|
||||
//
|
||||
// %apply Number NONNEGATIVE { double nonneg };
|
||||
// double sqrt(double nonneg); // Name of argument must match
|
||||
//
|
||||
// %apply Pointer NONNULL { FILE *stream };
|
||||
// FILE *fdopen(int NONNEGATIVE); // May return a NULL pointer
|
||||
// int fclose(void *stream); // Does not accept a NULL pointer
|
||||
//
|
||||
// Any function argument of the type you specify with the %apply directive
|
||||
// will be checked with the appropriate constraint. Multiple types may
|
||||
// be specified as follows :
|
||||
//
|
||||
// %apply Pointer NONNULL { void *, Vector *, List *, double *};
|
||||
//
|
||||
// In this case, all of the types listed would be checked for non-NULL
|
||||
// pointers.
|
||||
//
|
||||
// The common datatypes of int, short, long, unsigned int, unsigned long,
|
||||
// unsigned short, unsigned char, signed char, float, and double can be
|
||||
// checked without using the %apply directive by simply using the
|
||||
// constraint name as the parameter name. For example :
|
||||
//
|
||||
// double sqrt(double NONNEGATIVE);
|
||||
// double log(double POSITIVE);
|
||||
//
|
||||
// If you have used typedef to change type-names, you can also do this :
|
||||
//
|
||||
// %apply double { Real }; // Make everything defined for doubles
|
||||
// // work for Reals.
|
||||
// Real sqrt(Real NONNEGATIVE);
|
||||
// Real log(Real POSITIVE);
|
||||
|
||||
%include <exception.i>
|
||||
|
||||
#ifdef SWIGCSHARP
|
||||
// Required attribute for C# exception handling
|
||||
#if defined(SWIGCSHARP) || defined(SWIGD)
|
||||
// Required attribute for C# and D exception handling
|
||||
#define SWIGCSHARPCANTHROW , canthrow=1
|
||||
#else
|
||||
#define SWIGCSHARPCANTHROW
|
||||
@@ -182,7 +175,7 @@ If you have used typedef to change type-names, you can also do this :
|
||||
Pointer NONNULL
|
||||
{
|
||||
if (!$1) {
|
||||
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
|
||||
SWIG_exception(SWIG_NullReferenceError,"Received a NULL pointer.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
* pointer objects.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __cplusplus
|
||||
// C uses free/calloc/malloc
|
||||
%include "swigfragments.swg"
|
||||
%fragment("<stdlib.h>");
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %pointer_class(type,name)
|
||||
*
|
||||
@@ -55,14 +61,14 @@ NAME() {
|
||||
return new TYPE();
|
||||
}
|
||||
~NAME() {
|
||||
if ($self) delete $self;
|
||||
delete $self;
|
||||
}
|
||||
#else
|
||||
NAME() {
|
||||
return (TYPE *) calloc(1,sizeof(TYPE));
|
||||
}
|
||||
~NAME() {
|
||||
if ($self) free($self);
|
||||
free($self);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -114,7 +120,7 @@ static NAME * frompointer(TYPE *t) {
|
||||
|
||||
%define %pointer_functions(TYPE,NAME)
|
||||
%{
|
||||
static TYPE *new_##NAME() { %}
|
||||
static TYPE *new_##NAME(void) { %}
|
||||
#ifdef __cplusplus
|
||||
%{ return new TYPE(); %}
|
||||
#else
|
||||
@@ -134,9 +140,9 @@ static TYPE *copy_##NAME(TYPE value) { %}
|
||||
|
||||
static void delete_##NAME(TYPE *obj) { %}
|
||||
#ifdef __cplusplus
|
||||
%{ if (obj) delete obj; %}
|
||||
%{ delete obj; %}
|
||||
#else
|
||||
%{ if (obj) free(obj); %}
|
||||
%{ free(obj); %}
|
||||
#endif
|
||||
%{}
|
||||
|
||||
@@ -149,7 +155,7 @@ static TYPE NAME ##_value(TYPE *obj) {
|
||||
}
|
||||
%}
|
||||
|
||||
TYPE *new_##NAME();
|
||||
TYPE *new_##NAME(void);
|
||||
TYPE *copy_##NAME(TYPE value);
|
||||
void delete_##NAME(TYPE *obj);
|
||||
void NAME##_assign(TYPE *obj, TYPE value);
|
||||
76
linx64/bin/swig/share/swig/4.3.0/csharp/argcargv.i
Normal file
76
linx64/bin/swig/share/swig/4.3.0/csharp/argcargv.i
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -------------------------------------------------------------
|
||||
* SWIG library containing argc and argv multi-argument typemaps
|
||||
* ------------------------------------------------------------- */
|
||||
|
||||
%typemap(cstype) (int ARGC, char **ARGV) "string[]"
|
||||
%typemap(imtype) (int ARGC, char **ARGV) "global::System.IntPtr"
|
||||
%typemap(ctype) (int ARGC, char **ARGV) "void*"
|
||||
%typemap(csin) (int ARGC, char **ARGV) "$modulePINVOKE.SWIG_csharp_string_array_to_c($csinput.Length, $csinput)"
|
||||
%pragma(csharp) imclasscode=%{
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_array_to_c")]
|
||||
public static extern global::System.IntPtr SWIG_csharp_string_array_to_c(int len, [global::System.Runtime.InteropServices.In,global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray, ArraySubType=global::System.Runtime.InteropServices.UnmanagedType.LPStr, SizeParamIndex=0)] string[] array);
|
||||
%}
|
||||
%fragment("SWIG_csharp_string_array", "header") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct { int len; char* array[1]; } SWIG_csharp_string_array;
|
||||
|
||||
static void* SWIG_csharp_string_array_free(SWIG_csharp_string_array *arr) {
|
||||
if (arr != SWIG_NULLPTR) {
|
||||
int i;
|
||||
for(i = 0; i < arr->len; i++) {
|
||||
free(arr->array[i]);
|
||||
}
|
||||
free(arr);
|
||||
}
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
|
||||
SWIGEXPORT void* SWIGSTDCALL SWIG_csharp_string_array_to_c(int len, void *array) {
|
||||
int i;
|
||||
size_t alen, slen;
|
||||
char *p, **ptr;
|
||||
SWIG_csharp_string_array *ret;
|
||||
/* We don't need to add one to len for the terminating NULL here because
|
||||
* SWIG_csharp_string_array includes one element already.
|
||||
*/
|
||||
alen = sizeof(SWIG_csharp_string_array) + sizeof(char *) * len;
|
||||
ret = (SWIG_csharp_string_array *)malloc(alen);
|
||||
if (ret == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate array.");
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
memset(ret, 0, alen);
|
||||
ret->len = len;
|
||||
ptr = (char **)array;
|
||||
for(i = 0; i < len; i++) {
|
||||
slen = strlen(ptr[i]) + 1;
|
||||
p = (char*)malloc(slen);
|
||||
if (p == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to alloc a string.");
|
||||
return SWIG_csharp_string_array_free(ret);
|
||||
}
|
||||
memcpy(p, ptr[i], slen);
|
||||
ret->array[i] = p;
|
||||
}
|
||||
ret->array[i] = SWIG_NULLPTR;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
%typemap(in, canthrow=1, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{
|
||||
SWIG_csharp_string_array *arr = (SWIG_csharp_string_array*)$input;
|
||||
if (arr != SWIG_NULLPTR) {
|
||||
$1 = ($1_ltype)arr->len;
|
||||
$2 = ($2_ltype)arr->array;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(freearg, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{
|
||||
SWIG_csharp_string_array_free((SWIG_csharp_string_array*)$input);
|
||||
%}
|
||||
@@ -49,8 +49,17 @@
|
||||
* %csmethodmodifiers myArrayCopy "public unsafe";
|
||||
* void myArrayCopy( int *sourceArray, int* targetArray, int nitems );
|
||||
*
|
||||
* long type
|
||||
* ---------
|
||||
* Unlike other primitive types, the sizeof(long) varies considerably from one
|
||||
* platform to another. The sizeof(long) in the unmanaged layer must match the
|
||||
* number of bytes used in the managed layer. A check is implemented via the
|
||||
* "long_check_wordsize" fragment which results in a compile time error upon an
|
||||
* inconsistent match. Use the SWIGWORDSIZE64 macro to target 64-bit long.
|
||||
* For easiest portability, avoid using long!
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%define CSHARP_ARRAYS( CTYPE, CSTYPE )
|
||||
|
||||
// input only arrays
|
||||
@@ -94,16 +103,63 @@ CSHARP_ARRAYS(short, short)
|
||||
CSHARP_ARRAYS(unsigned short, ushort)
|
||||
CSHARP_ARRAYS(int, int)
|
||||
CSHARP_ARRAYS(unsigned int, uint)
|
||||
// FIXME - on Unix 64 bit, long is 8 bytes but is 4 bytes on Windows 64 bit.
|
||||
// How can this be handled sensibly?
|
||||
// See e.g. http://www.xml.com/ldd/chapter/book/ch10.html
|
||||
CSHARP_ARRAYS(long, int)
|
||||
CSHARP_ARRAYS(unsigned long, uint)
|
||||
CSHARP_ARRAYS(long long, long)
|
||||
CSHARP_ARRAYS(unsigned long long, ulong)
|
||||
CSHARP_ARRAYS(float, float)
|
||||
CSHARP_ARRAYS(double, double)
|
||||
CSHARP_ARRAYS(bool, bool)
|
||||
|
||||
// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side
|
||||
#if !defined(SWIGWORDSIZE64)
|
||||
CSHARP_ARRAYS(long, int)
|
||||
CSHARP_ARRAYS(unsigned long, uint)
|
||||
#else
|
||||
CSHARP_ARRAYS(long, long)
|
||||
CSHARP_ARRAYS(unsigned long, ulong)
|
||||
#endif
|
||||
%typemap(in, fragment="long_check_wordsize") long INPUT[], unsigned long INPUT[] "$1 = $input;"
|
||||
%typemap(in, fragment="long_check_wordsize") long OUTPUT[], unsigned long OUTPUT[] "$1 = $input;"
|
||||
%typemap(in, fragment="long_check_wordsize") long INOUT[], unsigned long INOUT[] "$1 = $input;"
|
||||
|
||||
// By default C# will marshal bools as 4 bytes
|
||||
// UnmanagedType.I1 will change this to 1 byte
|
||||
// FIXME - When running on mono ArraySubType appears to be ignored and bools will be marshalled as 4-byte
|
||||
// https://github.com/mono/mono/issues/15592
|
||||
|
||||
// input only arrays
|
||||
%typemap(ctype) bool INPUT[] "bool*"
|
||||
%typemap(cstype) bool INPUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INPUT[] "bool[]"
|
||||
%typemap(csin) bool INPUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool INPUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool INPUT[] ""
|
||||
%typemap(argout) bool INPUT[] ""
|
||||
|
||||
// output only arrays
|
||||
%typemap(ctype) bool OUTPUT[] "bool*"
|
||||
%typemap(cstype) bool OUTPUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool OUTPUT[] "bool[]"
|
||||
%typemap(csin) bool OUTPUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool OUTPUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool OUTPUT[] ""
|
||||
%typemap(argout) bool OUTPUT[] ""
|
||||
|
||||
// inout arrays
|
||||
%typemap(ctype) bool INOUT[] "bool*"
|
||||
%typemap(cstype) bool INOUT[] "bool[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INOUT[] "bool[]"
|
||||
%typemap(csin) bool INOUT[] "$csinput"
|
||||
|
||||
%typemap(in) bool INOUT[] %{
|
||||
$1 = $input;
|
||||
%}
|
||||
%typemap(freearg) bool INOUT[] ""
|
||||
%typemap(argout) bool INOUT[] ""
|
||||
|
||||
|
||||
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
|
||||
@@ -129,11 +185,18 @@ CSHARP_ARRAYS_FIXED(short, short)
|
||||
CSHARP_ARRAYS_FIXED(unsigned short, ushort)
|
||||
CSHARP_ARRAYS_FIXED(int, int)
|
||||
CSHARP_ARRAYS_FIXED(unsigned int, uint)
|
||||
CSHARP_ARRAYS_FIXED(long, int)
|
||||
CSHARP_ARRAYS_FIXED(unsigned long, uint)
|
||||
CSHARP_ARRAYS_FIXED(long long, long)
|
||||
CSHARP_ARRAYS_FIXED(unsigned long long, ulong)
|
||||
CSHARP_ARRAYS_FIXED(float, float)
|
||||
CSHARP_ARRAYS_FIXED(double, double)
|
||||
CSHARP_ARRAYS_FIXED(bool, bool)
|
||||
|
||||
// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side
|
||||
#ifdef !SWIGWORDSIZE64
|
||||
CSHARP_ARRAYS_FIXED(long, int)
|
||||
CSHARP_ARRAYS_FIXED(unsigned long, uint)
|
||||
#else
|
||||
CSHARP_ARRAYS_FIXED(long, long)
|
||||
CSHARP_ARRAYS_FIXED(unsigned long, ulong)
|
||||
#endif
|
||||
%typemap(in, fragment="long_check_wordsize") long FIXED[], unsigned long FIXED[] "$1 = $input;"
|
||||
@@ -32,7 +32,7 @@
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
|
||||
//plain value(out)
|
||||
$1_ltype* resultp = new $1_ltype(($1_ltype &)$1);
|
||||
$1_ltype* resultp = new $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 >());
|
||||
%}
|
||||
@@ -372,7 +372,7 @@
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%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)); %}
|
||||
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
|
||||
|
||||
// plain pointer
|
||||
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
|
||||
@@ -29,10 +29,10 @@
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%typemap(out) CONST TYPE
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
|
||||
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %}
|
||||
|
||||
%typemap(directorin) CONST TYPE
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
|
||||
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE
|
||||
%{ if (!$input) {
|
||||
@@ -122,7 +122,7 @@
|
||||
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
|
||||
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
|
||||
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
|
||||
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
|
||||
%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0;
|
||||
if ($owner) delete $1; %}
|
||||
|
||||
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
|
||||
124
linx64/bin/swig/share/swig/4.3.0/csharp/cdata.i
Normal file
124
linx64/bin/swig/share/swig/4.3.0/csharp/cdata.i
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* cdata.i
|
||||
*
|
||||
* SWIG library file containing macros for manipulating raw C data.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* Typemap for passing bytes with length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%pragma(csharp) imclasscode=%{
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_bytes_to_c")]
|
||||
public static extern global::System.IntPtr SWIG_csharp_bytes_to_c0(int len, byte[] ptr);
|
||||
public static global::System.IntPtr SWIG_csharp_bytes_to_c(byte[] ptr) {
|
||||
return SWIG_csharp_bytes_to_c0(ptr.Length, ptr);
|
||||
}
|
||||
%}
|
||||
|
||||
%fragment("SWIG_csharp_bytes", "header") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct { int len; void *ptr; } SWIG_csharp_bytes;
|
||||
|
||||
SWIGEXPORT void *SWIGSTDCALL SWIG_csharp_bytes_to_c(int len, void *ptr) {
|
||||
SWIG_csharp_bytes *ret = (SWIG_csharp_bytes *)malloc(sizeof(SWIG_csharp_bytes));
|
||||
if (ret == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate bytes container.");
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
if (len > 0) {
|
||||
ret->ptr = malloc(len);
|
||||
if (ret->ptr == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate bytes.");
|
||||
free(ret);
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
memcpy(ret->ptr, ptr, len);
|
||||
ret->len = len;
|
||||
} else {
|
||||
ret->ptr = SWIG_NULLPTR;
|
||||
ret->len = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
%typemap(cstype) (const void *BYTES, size_t LENGTH) "byte[]"
|
||||
%typemap(ctype) (const void *BYTES, size_t LENGTH) "void *"
|
||||
%typemap(imtype) (const void *BYTES, size_t LENGTH) "global::System.IntPtr"
|
||||
%typemap(csin) (const void *BYTES, size_t LENGTH) "$modulePINVOKE.SWIG_csharp_bytes_to_c($csinput)"
|
||||
%typemap(in, canthrow=1, fragment="SWIG_csharp_bytes") (const void *BYTES, size_t LENGTH) {
|
||||
SWIG_csharp_bytes *p = (SWIG_csharp_bytes *)$input;
|
||||
if (p != SWIG_NULLPTR) {
|
||||
$1 = ($1_ltype)p->ptr;
|
||||
$2 = ($2_ltype)p->len;
|
||||
} else {
|
||||
$1 = 0;
|
||||
$2 = 0;
|
||||
}
|
||||
}
|
||||
%typemap(freearg, fragment="SWIG_csharp_bytes") (const void *BYTES, size_t LENGTH) {
|
||||
SWIG_csharp_bytes *p = (SWIG_csharp_bytes *)$input;
|
||||
if (p != SWIG_NULLPTR) {
|
||||
free(p->ptr);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) }
|
||||
|
||||
%include <typemaps/cdata_begin.swg>
|
||||
|
||||
%pragma(csharp) imclasscode=%{
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_data")]
|
||||
public static extern int SWIG_csharp_data(global::System.IntPtr data, ref global::System.IntPtr m);
|
||||
%}
|
||||
|
||||
%fragment("SWIG_csharp_data", "header") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL SWIG_csharp_data(SWIGCDATA *d, void **ptr) {
|
||||
int ret = 0;
|
||||
if (d != SWIG_NULLPTR) {
|
||||
if (d->len > 0 && d->data != SWIG_NULLPTR) {
|
||||
*ptr = (void *)d->data;
|
||||
ret = (int)d->len;
|
||||
}
|
||||
free(d); /* allocated in 'out' typemap */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
%typemap(ctype) SWIGCDATA "SWIGCDATA *"
|
||||
%typemap(imtype) SWIGCDATA "global::System.IntPtr"
|
||||
%typemap(cstype) SWIGCDATA "byte[]"
|
||||
%typemap(out) SWIGCDATA %{
|
||||
$result = (SWIGCDATA*)malloc(sizeof($1));
|
||||
if ($result != SWIG_NULLPTR) {
|
||||
memcpy($result, &$1, sizeof($1));
|
||||
}
|
||||
%}
|
||||
%typemap(csout, fragment="SWIG_csharp_data") SWIGCDATA {
|
||||
global::System.IntPtr mm = global::System.IntPtr.Zero;
|
||||
int size = $modulePINVOKE.SWIG_csharp_data($imcall, ref mm);
|
||||
byte[] ret = new byte[size];
|
||||
if (size > 0) {
|
||||
System.Runtime.InteropServices.Marshal.Copy(mm, ret, 0, size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
%include <typemaps/cdata_end.swg>
|
||||
@@ -82,8 +82,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
|
||||
%typemap(ctype) int, const int & "int"
|
||||
%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
|
||||
%typemap(ctype) long, const long & "long"
|
||||
%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
|
||||
%typemap(ctype) long, const long & "int"
|
||||
%typemap(ctype) unsigned long, const unsigned long & "unsigned int"
|
||||
%typemap(ctype) long long, const long long & "long long"
|
||||
%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
|
||||
%typemap(ctype) float, const float & "float"
|
||||
@@ -201,9 +201,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(directorin) short "$input = $1;"
|
||||
%typemap(directorin) unsigned short "$input = $1;"
|
||||
%typemap(directorin) int "$input = $1;"
|
||||
%typemap(directorin) unsigned int "$input = $1;"
|
||||
%typemap(directorin) unsigned int "$input = (unsigned int)$1;"
|
||||
%typemap(directorin) long "$input = $1;"
|
||||
%typemap(directorin) unsigned long "$input = (unsigned long)$1;"
|
||||
%typemap(directorin) unsigned long "$input = $1;"
|
||||
%typemap(directorin) long long "$input = $1;"
|
||||
%typemap(directorin) unsigned long long "$input = $1;"
|
||||
%typemap(directorin) float "$input = $1;"
|
||||
@@ -246,9 +246,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(out) short %{ $result = $1; %}
|
||||
%typemap(out) unsigned short %{ $result = $1; %}
|
||||
%typemap(out) int %{ $result = $1; %}
|
||||
%typemap(out) unsigned int %{ $result = $1; %}
|
||||
%typemap(out) unsigned int %{ $result = (unsigned int)$1; %}
|
||||
%typemap(out) long %{ $result = $1; %}
|
||||
%typemap(out) unsigned long %{ $result = (unsigned long)$1; %}
|
||||
%typemap(out) unsigned long %{ $result = $1; %}
|
||||
%typemap(out) long long %{ $result = $1; %}
|
||||
%typemap(out) unsigned long long %{ $result = $1; %}
|
||||
%typemap(out) float %{ $result = $1; %}
|
||||
@@ -327,7 +327,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(directorin) const short & "$input = $1;"
|
||||
%typemap(directorin) const unsigned short & "$input = $1;"
|
||||
%typemap(directorin) const int & "$input = $1;"
|
||||
%typemap(directorin) const unsigned int & "$input = $1;"
|
||||
%typemap(directorin) const unsigned int & "$input = (unsigned int)$1;"
|
||||
%typemap(directorin) const long & "$input = $1;"
|
||||
%typemap(directorin) const unsigned long & "$input = $1;"
|
||||
%typemap(directorin) const long long & "$input = $1;"
|
||||
@@ -373,9 +373,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(out) const short & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned short & %{ $result = *$1; %}
|
||||
%typemap(out) const int & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned int & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned int & %{ $result = (unsigned int)*$1; %}
|
||||
%typemap(out) const long & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned long & %{ $result = (unsigned long)*$1; %}
|
||||
%typemap(out) const unsigned long & %{ $result = *$1; %}
|
||||
%typemap(out) const long long & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned long long & %{ $result = *$1; %}
|
||||
%typemap(out) const float & %{ $result = *$1; %}
|
||||
@@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{ $result = new $1_ltype((const $1_ltype &)$1); %}
|
||||
%{ $result = new $1_ltype($1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
@@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
#endif
|
||||
|
||||
%typemap(directorin) SWIGTYPE
|
||||
%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %}
|
||||
%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %}
|
||||
%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)"
|
||||
%typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle"
|
||||
|
||||
@@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%}
|
||||
%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
|
||||
if (!$1) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input;
|
||||
%typemap(in, canthrow=1, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input;
|
||||
if (!$1) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
|
||||
return $null;
|
||||
} %}
|
||||
}
|
||||
rvrdeleter.reset($1); %}
|
||||
%typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
|
||||
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
|
||||
char buf[128];
|
||||
@@ -578,7 +579,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
unsigned long,
|
||||
unsigned short
|
||||
%{ char error_msg[256];
|
||||
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
||||
SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1);
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
|
||||
return $null; %}
|
||||
|
||||
@@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
"$csinput"
|
||||
%typemap(csin) char *, char *&, char[ANY], char[] "$csinput"
|
||||
%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)"
|
||||
%typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
|
||||
|
||||
/* The csout typemap is used for converting function return types from the return type
|
||||
@@ -875,6 +877,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
global::System.IntPtr ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
|
||||
get {
|
||||
global::System.IntPtr ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
%typemap(csdirectorin) void *VOID_INT_PTR "$iminput"
|
||||
%typemap(csdirectorout) void *VOID_INT_PTR "$cscall"
|
||||
|
||||
@@ -885,6 +896,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
%typemap(csinterfaces) SWIGTYPE "global::System.IDisposable"
|
||||
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
|
||||
|
||||
|
||||
// csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
|
||||
@@ -903,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
|
||||
global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.Dispose();
|
||||
return ptr;
|
||||
} else {
|
||||
return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
@@ -916,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
|
||||
if (obj != null) {
|
||||
if (!obj.swigCMemOwn)
|
||||
throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
|
||||
global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
|
||||
obj.swigCMemOwn = false;
|
||||
obj.Dispose();
|
||||
return ptr;
|
||||
} else {
|
||||
return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
@@ -935,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) {
|
||||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csbody) TYPE (CLASS::*) %{
|
||||
@@ -1020,10 +1062,17 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
||||
%pragma(csharp) imclassclassmodifiers="class"
|
||||
%pragma(csharp) moduleclassmodifiers="public class"
|
||||
|
||||
/* Some ANSI C typemaps */
|
||||
/* 64-bit architecture specific typemaps */
|
||||
#if defined(SWIGWORDSIZE64)
|
||||
%apply long long { long };
|
||||
%apply unsigned long long { unsigned long };
|
||||
%apply const long long & { const long & };
|
||||
%apply const unsigned long long & { const unsigned long & };
|
||||
#endif
|
||||
|
||||
%apply unsigned long { size_t };
|
||||
%apply const unsigned long & { const size_t & };
|
||||
/* size_t maps to C# 32-bit uint type */
|
||||
%apply unsigned int { size_t };
|
||||
%apply const unsigned int & { const size_t & };
|
||||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
@@ -1034,6 +1083,100 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* String & length */
|
||||
%fragment("SWIG_csharp_string", "header") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct { int len; int size; char* str; } SWIG_csharp_string;
|
||||
|
||||
SWIGEXPORT void* SWIGSTDCALL SWIG_csharp_string_to_c(int size, int len, char *str) {
|
||||
SWIG_csharp_string *ret;
|
||||
ret = (SWIG_csharp_string *)malloc(sizeof(SWIG_csharp_string));
|
||||
if (ret == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate string container.");
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
if (size > 0) {
|
||||
/* The string is in UTF8 encoding */
|
||||
ret->str = (char *)malloc(size + 1);
|
||||
if (ret->str == SWIG_NULLPTR) {
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate string.");
|
||||
free(ret);
|
||||
return SWIG_NULLPTR;
|
||||
}
|
||||
memcpy(ret->str, str, size + 1);
|
||||
ret->size = size; /* number of bytes in the UTF8 encoding */
|
||||
ret->len = len; /* number of characters in string */
|
||||
} else {
|
||||
ret->str = SWIG_NULLPTR;
|
||||
ret->size = 0;
|
||||
ret->len = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
SWIGEXPORT int SWIGSTDCALL SWIG_csharp_string_size(SWIG_csharp_string *p) {
|
||||
if (p) {
|
||||
return p->size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) {
|
||||
if (p) {
|
||||
char *ret = p->str;
|
||||
free(p);
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* string & length typemap */
|
||||
|
||||
%typemap(cstype) (const char *STRING, size_t LENGTH) "string"
|
||||
%typemap(ctype) (const char *STRING, size_t LENGTH) "void *"
|
||||
%typemap(imtype) (const char *STRING, size_t LENGTH) "global::System.IntPtr"
|
||||
%typemap(csin) (const char *STRING, size_t LENGTH) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_csharp_string_to_c($csinput)"
|
||||
%typemap(in, canthrow=1, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) {
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
if (p != SWIG_NULLPTR) {
|
||||
$1 = ($1_ltype)p->str;
|
||||
$2 = ($2_ltype)p->size; /* We use number of bytes */
|
||||
} else {
|
||||
$1 = 0;
|
||||
$2 = 0;
|
||||
}
|
||||
}
|
||||
%typemap(freearg, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) {
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
if (p != SWIG_NULLPTR) {
|
||||
free(p->str);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(directorin) (const char *STRING, size_t LENGTH) %{
|
||||
if ($1 && $2 > 0) {
|
||||
$input = malloc(sizeof(SWIG_csharp_string));
|
||||
if ($input) {
|
||||
SWIG_csharp_string *p = (SWIG_csharp_string *)$input;
|
||||
p->str = (char *)$1;
|
||||
p->size = (int)$2;
|
||||
}
|
||||
}
|
||||
%}
|
||||
%typemap(csdirectorin) (const char *STRING, size_t LENGTH) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_c_to_csharp_string($iminput)"
|
||||
|
||||
%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) }
|
||||
%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) }
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
/* csharp keywords */
|
||||
%include <csharpkw.swg>
|
||||
|
||||
@@ -324,6 +324,41 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString
|
||||
%}
|
||||
#endif // SWIG_CSHARP_NO_STRING_HELPER
|
||||
|
||||
#if !defined(SWIG_CSHARP_NO_STRING_WITH_LENGTH_HELPER)
|
||||
%pragma(csharp) imclasscode=%{
|
||||
public class SWIGStringWithLengthHelper {
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_to_c")]
|
||||
private static extern global::System.IntPtr SWIG_csharp_string_to_c0(int size, int len, [global::System.Runtime.InteropServices.In,global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPStr, SizeParamIndex=0)] string str);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_size")]
|
||||
private static extern int SWIG_csharp_string_size(global::System.IntPtr str);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_str")]
|
||||
private static extern global::System.IntPtr SWIG_csharp_string_str(global::System.IntPtr str);
|
||||
|
||||
public static global::System.IntPtr SWIG_csharp_string_to_c(string str) {
|
||||
if (str == null)
|
||||
return global::System.IntPtr.Zero;
|
||||
global::System.Text.Encoding utf8 = global::System.Text.Encoding.UTF8;
|
||||
return SWIG_csharp_string_to_c0(utf8.GetByteCount(str), str.Length, str);
|
||||
}
|
||||
|
||||
public static string SWIG_c_to_csharp_string(global::System.IntPtr str) {
|
||||
int size = SWIG_csharp_string_size(str);
|
||||
if (size > 0) {
|
||||
global::System.IntPtr s = SWIG_csharp_string_str(str);
|
||||
byte[] b = new byte[size];
|
||||
global::System.Runtime.InteropServices.Marshal.Copy(s, b, 0, size);
|
||||
global::System.Text.Encoding utf8 = global::System.Text.Encoding.UTF8;
|
||||
return utf8.GetString(b);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
%}
|
||||
#endif // SWIG_CSHARP_NO_STRING_WITH_LENGTH_HELPER
|
||||
|
||||
#if !defined(SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR)
|
||||
// Ensure the class is not marked beforefieldinit
|
||||
%pragma(csharp) imclasscode=%{
|
||||
@@ -335,5 +370,5 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString
|
||||
%insert(runtime) %{
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } } while (0)
|
||||
%}
|
||||
@@ -2,9 +2,9 @@
|
||||
#define CSHARP_CSHARPKW_SWG_
|
||||
|
||||
/* Warnings for C# keywords */
|
||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x`
|
||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword",rename="%s_") `x`
|
||||
|
||||
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x`
|
||||
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes",%$isclass,rename="%s_") `x`
|
||||
|
||||
/*
|
||||
from
|
||||
@@ -6,37 +6,37 @@
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IReadOnlyList<> collection.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
|
||||
%define SWIG_STD_ARRAY_INTERNAL(T, N)
|
||||
%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n";
|
||||
%define SWIG_STD_ARRAY_INTERNAL(CTYPE, N)
|
||||
%typemap(csinterfaces) std::array< CTYPE, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>\n"
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
int end = global::System.Math.Min(this.Count, c.Count);
|
||||
int count = this.Count;
|
||||
int i = 0;
|
||||
foreach ($typemap(cstype, T) elem in c) {
|
||||
if (i >= end)
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
if (i >= count)
|
||||
break;
|
||||
this[i++] = elem;
|
||||
this[i++] = element;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
public bool IsFixedSize {
|
||||
get {
|
||||
return (int)size();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(cstype, T) this[int index] {
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public $typemap(cstype, CTYPE) this[int index] {
|
||||
get {
|
||||
return getitem(index);
|
||||
}
|
||||
@@ -51,17 +51,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array)
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSynchronized {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array)
|
||||
{
|
||||
CopyTo(0, array, 0, this.Count);
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array, int arrayIndex)
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
|
||||
{
|
||||
CopyTo(0, array, arrayIndex, this.Count);
|
||||
}
|
||||
|
||||
public void CopyTo(int index, $typemap(cstype, T)[] array, int arrayIndex, int count)
|
||||
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
|
||||
{
|
||||
if (array == null)
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
@@ -79,7 +91,13 @@
|
||||
array.SetValue(getitemcopy(index+i), arrayIndex+i);
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -97,7 +115,7 @@
|
||||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
|
||||
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)>
|
||||
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private int currentIndex;
|
||||
@@ -112,7 +130,7 @@
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public $typemap(cstype, T) Current {
|
||||
public $typemap(cstype, CTYPE) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
@@ -120,7 +138,7 @@
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return ($typemap(cstype, T))currentObject;
|
||||
return ($typemap(cstype, CTYPE))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +179,7 @@
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
@@ -180,7 +198,7 @@
|
||||
void swap(array& other);
|
||||
|
||||
%extend {
|
||||
T getitemcopy(int index) throw (std::out_of_range) {
|
||||
CTYPE getitemcopy(int index) throw (std::out_of_range) {
|
||||
if (index>=0 && index<(int)$self->size())
|
||||
return (*$self)[index];
|
||||
else
|
||||
@@ -213,6 +231,11 @@
|
||||
}
|
||||
%enddef
|
||||
|
||||
%{
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%csmethodmodifiers std::array::empty "private"
|
||||
%csmethodmodifiers std::array::getitemcopy "private"
|
||||
38
linx64/bin/swig/share/swig/4.3.0/csharp/std_auto_ptr.i
Normal file
38
linx64/bin/swig/share/swig/4.3.0/csharp/std_auto_ptr.i
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_auto_ptr.i
|
||||
*
|
||||
* SWIG library file for handling std::auto_ptr.
|
||||
* Memory ownership is passed from the std::auto_ptr C++ layer to the proxy
|
||||
* class when returning a std::auto_ptr from a function.
|
||||
* Memory ownership is passed from the proxy class to the std::auto_ptr in the
|
||||
* C++ layer when passed as a parameter to a wrapped function.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%define %auto_ptr(TYPE)
|
||||
%typemap (ctype) std::auto_ptr< TYPE > "void *"
|
||||
%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)"
|
||||
|
||||
%typemap(in) std::auto_ptr< TYPE >
|
||||
%{ $1.reset((TYPE *)$input); %}
|
||||
|
||||
%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)"
|
||||
|
||||
%typemap (out) std::auto_ptr< TYPE > %{
|
||||
$result = (void *)$1.release();
|
||||
%}
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > {
|
||||
System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > ""
|
||||
|
||||
%template() std::auto_ptr< TYPE >;
|
||||
%enddef
|
||||
|
||||
namespace std {
|
||||
template <class T> class auto_ptr {};
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
// MACRO for use within the std::list class body
|
||||
%define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...)
|
||||
%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"
|
||||
|
||||
%apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * };
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* K is the C++ key type, T is the C++ value type */
|
||||
%define SWIG_STD_MAP_INTERNAL(K, T, C)
|
||||
|
||||
%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
|
||||
%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"
|
||||
%proxycode %{
|
||||
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
@@ -48,6 +48,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsEmpty {
|
||||
get {
|
||||
return empty();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
@@ -236,7 +242,11 @@
|
||||
}
|
||||
|
||||
void setitem(const key_type& key, const mapped_type& x) {
|
||||
%#ifdef __cpp_lib_map_try_emplace
|
||||
(*$self).insert_or_assign(key, x);
|
||||
%#else
|
||||
(*$self)[key] = x;
|
||||
%#endif
|
||||
}
|
||||
|
||||
bool ContainsKey(const key_type& key) {
|
||||
@@ -269,12 +279,14 @@
|
||||
}
|
||||
|
||||
const key_type& get_next_key(std::map< K, T, C >::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
std::map< K, T, C >::iterator iter = *swigiterator;
|
||||
(*swigiterator)++;
|
||||
return (*iter).first;
|
||||
}
|
||||
|
||||
void destroy_iterator(std::map< K, T, C >::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
delete swigiterator;
|
||||
}
|
||||
}
|
||||
@@ -282,6 +294,7 @@
|
||||
|
||||
%enddef
|
||||
|
||||
%csmethodmodifiers std::map::empty "private"
|
||||
%csmethodmodifiers std::map::size "private"
|
||||
%csmethodmodifiers std::map::getitem "private"
|
||||
%csmethodmodifiers std::map::setitem "private"
|
||||
@@ -295,18 +308,3 @@ namespace std {
|
||||
SWIG_STD_MAP_INTERNAL(K, T, C)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Legacy macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
|
||||
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
|
||||
%enddef
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%csmethodmodifiers std::set::empty "private"
|
||||
%csmethodmodifiers std::set::size "private"
|
||||
%csmethodmodifiers std::set::getitem "private"
|
||||
%csmethodmodifiers std::set::create_iterator_begin "private"
|
||||
@@ -28,9 +29,9 @@ namespace std {
|
||||
template <class T>
|
||||
class set {
|
||||
|
||||
%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n";
|
||||
%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n"
|
||||
%proxycode %{
|
||||
void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add(string item) {
|
||||
void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) {
|
||||
((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item);
|
||||
}
|
||||
|
||||
@@ -44,6 +45,12 @@ class set {
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEmpty {
|
||||
get {
|
||||
return empty();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
@@ -192,7 +199,7 @@ class set {
|
||||
private $csclassname collectionRef;
|
||||
private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
|
||||
private int currentIndex;
|
||||
private $typemap(cstype, T) currentObject;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
@@ -212,7 +219,7 @@ class set {
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return currentObject;
|
||||
return ($typemap(cstype, T))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,12 +304,14 @@ class set {
|
||||
}
|
||||
|
||||
const key_type& get_next(std::set<T>::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
std::set<T>::iterator iter = *swigiterator;
|
||||
(*swigiterator)++;
|
||||
return *iter;
|
||||
}
|
||||
|
||||
void destroy_iterator(std::set<T>::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
delete swigiterator;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace std {
|
||||
class string;
|
||||
|
||||
// string
|
||||
%typemap(ctype) string "char *"
|
||||
%typemap(ctype) string "const char *"
|
||||
%typemap(imtype) string "string"
|
||||
%typemap(cstype) string "string"
|
||||
|
||||
@@ -42,7 +42,7 @@ class string;
|
||||
}
|
||||
$result.assign($input); %}
|
||||
|
||||
%typemap(directorin) string %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
|
||||
%typemap(directorin) string %{ $input = $1.c_str(); %}
|
||||
|
||||
%typemap(csin) string "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) string {
|
||||
@@ -57,7 +57,7 @@ class string;
|
||||
return $null; %}
|
||||
|
||||
// const string &
|
||||
%typemap(ctype) const string & "char *"
|
||||
%typemap(ctype) const string & "const char *"
|
||||
%typemap(imtype) const string & "string"
|
||||
%typemap(cstype) const string & "string"
|
||||
|
||||
@@ -89,7 +89,7 @@ class string;
|
||||
$1_str = $input;
|
||||
$result = &$1_str; %}
|
||||
|
||||
%typemap(directorin) const string & %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
|
||||
%typemap(directorin) const string & %{ $input = $1.c_str(); %}
|
||||
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) const string & %{
|
||||
set {
|
||||
116
linx64/bin/swig/share/swig/4.3.0/csharp/std_string_view.i
Normal file
116
linx64/bin/swig/share/swig/4.3.0/csharp/std_string_view.i
Normal file
@@ -0,0 +1,116 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_string_view.i
|
||||
*
|
||||
* Typemaps for std::string_view and const std::string_view&
|
||||
* These are mapped to a C# String and are passed around by value.
|
||||
*
|
||||
* To use non-const std::string_view references use the following %apply. Note
|
||||
* that they are passed by value.
|
||||
* %apply const std::string_view & {std::string_view &};
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
%naturalvar string_view;
|
||||
|
||||
class string_view;
|
||||
|
||||
// string_view
|
||||
%typemap(ctype) string_view "const char *"
|
||||
%typemap(imtype) string_view "string"
|
||||
%typemap(cstype) string_view "string"
|
||||
|
||||
%typemap(csdirectorin) string_view "$iminput"
|
||||
%typemap(csdirectorout) string_view "$cscall"
|
||||
|
||||
%typemap(in, canthrow=1) string_view
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
$1 = std::string_view($input); %}
|
||||
%typemap(out) string_view %{ $result = SWIG_csharp_string_callback(std::string($1).c_str()); %}
|
||||
|
||||
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) string_view
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
/* possible thread/reentrant code problem */
|
||||
static std::string $1_str;
|
||||
$1_str = $input;
|
||||
$result = std::string_view($1_str); %}
|
||||
|
||||
%typemap(directorin) string_view %{ $input = std::string($1).c_str(); %}
|
||||
|
||||
%typemap(csin) string_view "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) string_view {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(typecheck) string_view = char *;
|
||||
|
||||
%typemap(throws, canthrow=1) string_view
|
||||
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str());
|
||||
return $null; %}
|
||||
|
||||
// const string_view &
|
||||
%typemap(ctype) const string_view & "const char *"
|
||||
%typemap(imtype) const string_view & "string"
|
||||
%typemap(cstype) const string_view & "string"
|
||||
|
||||
%typemap(csdirectorin) const string_view & "$iminput"
|
||||
%typemap(csdirectorout) const string_view & "$cscall"
|
||||
|
||||
%typemap(in, canthrow=1) const string_view &
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
$*1_ltype $1_str($input);
|
||||
$1 = &$1_str; %}
|
||||
%typemap(out) const string_view & %{ $result = SWIG_csharp_string_callback(std::string(*$1).c_str()); %}
|
||||
|
||||
%typemap(csin) const string_view & "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) const string_view & {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string_view &
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
|
||||
return $null;
|
||||
}
|
||||
/* possible thread/reentrant code problem */
|
||||
static std::string $1_str;
|
||||
$1_str = $input;
|
||||
static $*1_ltype $1_strview;
|
||||
$1_strview = $1_str;
|
||||
$result = &$1_strview; %}
|
||||
|
||||
%typemap(directorin) const string_view & %{ $input = std::string($1).c_str(); %}
|
||||
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) const string_view & %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) const string_view & %{
|
||||
get {
|
||||
string ret = $imcall;$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(typecheck) const string_view & = char *;
|
||||
|
||||
%typemap(throws, canthrow=1) const string_view &
|
||||
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str());
|
||||
return $null; %}
|
||||
|
||||
}
|
||||
60
linx64/bin/swig/share/swig/4.3.0/csharp/std_unique_ptr.i
Normal file
60
linx64/bin/swig/share/swig/4.3.0/csharp/std_unique_ptr.i
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_unique_ptr.i
|
||||
*
|
||||
* SWIG library file for handling std::unique_ptr.
|
||||
*
|
||||
* Returning a std::unique_ptr from a wrapped function:
|
||||
* Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer
|
||||
* to the proxy class when returning a std::unique_ptr by value from a function.
|
||||
* Memory ownership is not moved when returning by any sort of reference.
|
||||
*
|
||||
* Passing a std::unique_ptr as a parameter to a wrapped function:
|
||||
* Memory ownership is passed from the proxy class to the std::unique_ptr in the
|
||||
* C++ layer when passed as a parameter by value, rvalue reference or non-const
|
||||
* lvalue reference. Memory ownership is not transferred when passing by const
|
||||
* lvalue reference.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <unique_ptr.swg>
|
||||
|
||||
%define %unique_ptr(TYPE)
|
||||
%typemap (ctype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "void *"
|
||||
%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap (cstype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(cstype, TYPE)"
|
||||
|
||||
%typemap(in) std::unique_ptr< TYPE >
|
||||
%{ $1.reset((TYPE *)$input); %}
|
||||
%typemap(in) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > &&
|
||||
%{ $*1_ltype $1_uptr((TYPE *)$input);
|
||||
$1 = &$1_uptr; %}
|
||||
%typemap(in, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > &
|
||||
%{ swig::NoDeleteUniquePtr< TYPE > $1_ndup((TYPE *)$input);
|
||||
$1 = &$1_ndup.uptr; %}
|
||||
|
||||
%typemap(csin) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(cstype, TYPE).swigRelease($csinput)"
|
||||
%typemap(csin) const std::unique_ptr< TYPE > & "$typemap(cstype, TYPE).getCPtr($csinput)"
|
||||
|
||||
%typemap (out) std::unique_ptr< TYPE > %{
|
||||
$result = (void *)$1.release();
|
||||
%}
|
||||
%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{
|
||||
$result = (void *)$1->get();
|
||||
%}
|
||||
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > {
|
||||
System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && {
|
||||
System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, false);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && ""
|
||||
|
||||
%template() std::unique_ptr< TYPE >;
|
||||
%enddef
|
||||
306
linx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_map.i
Normal file
306
linx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_map.i
Normal file
@@ -0,0 +1,306 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_unordered_map.i
|
||||
*
|
||||
* SWIG typemaps for std::unordered_map< K, T, H >
|
||||
*
|
||||
* 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 an unordered_map from integers to doubles use:
|
||||
*
|
||||
* %include <std_unordered_map.i>
|
||||
* %template(MapIntDouble) std::unordered_map<int, double>
|
||||
*
|
||||
* Notes:
|
||||
* 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::unordered_map wrappers.
|
||||
*
|
||||
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
/* K is the C++ key type, T is the C++ value type */
|
||||
%define SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H)
|
||||
|
||||
%typemap(csinterfaces) std::unordered_map< K, T, H > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"
|
||||
%proxycode %{
|
||||
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
get {
|
||||
return getitem(key);
|
||||
}
|
||||
|
||||
set {
|
||||
setitem(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetValue($typemap(cstype, K) key, out $typemap(cstype, T) value) {
|
||||
if (this.ContainsKey(key)) {
|
||||
value = this[key];
|
||||
return true;
|
||||
}
|
||||
value = default($typemap(cstype, T));
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsEmpty {
|
||||
get {
|
||||
return empty();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
||||
get {
|
||||
global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>();
|
||||
int size = this.Count;
|
||||
if (size > 0) {
|
||||
global::System.IntPtr iter = create_iterator_begin();
|
||||
for (int i = 0; i < size; i++) {
|
||||
keys.Add(get_next_key(iter));
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
|
||||
public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
|
||||
get {
|
||||
global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
|
||||
foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
|
||||
vals.Add(pair.Value);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (Contains(item)) {
|
||||
return Remove(item.Key);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (this[item.Key] == item.Value) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
|
||||
CopyTo(array, 0);
|
||||
}
|
||||
|
||||
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
|
||||
if (array == null)
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (arrayIndex < 0)
|
||||
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
if (arrayIndex+this.Count > array.Length)
|
||||
throw new global::System.ArgumentException("Number of elements to copy is too large.");
|
||||
|
||||
global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
|
||||
for (int i = 0; i < keyList.Count; i++) {
|
||||
$typemap(cstype, K) currentKey = keyList[i];
|
||||
array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
|
||||
}
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
public $csclassnameEnumerator GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
// Type-safe enumerator
|
||||
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
|
||||
/// whenever the collection is modified. This has been done for changes in the size of the
|
||||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
|
||||
private int currentIndex;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
collectionRef = collection;
|
||||
keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize - 1)
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Type-unsafe IEnumerator.Current
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
int size = collectionRef.Count;
|
||||
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
|
||||
if (moveOkay) {
|
||||
currentIndex++;
|
||||
$typemap(cstype, K) currentKey = keyCollection[currentIndex];
|
||||
currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
|
||||
} else {
|
||||
currentObject = null;
|
||||
}
|
||||
return moveOkay;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef std::pair< const K, T > value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
unordered_map();
|
||||
unordered_map(const unordered_map& other);
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%extend {
|
||||
const mapped_type& getitem(const key_type& key) throw (std::out_of_range) {
|
||||
std::unordered_map< K, T, H >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
return iter->second;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
|
||||
void setitem(const key_type& key, const mapped_type& x) {
|
||||
(*$self)[key] = x;
|
||||
}
|
||||
|
||||
bool ContainsKey(const key_type& key) {
|
||||
std::unordered_map< K, T, H >::iterator iter = $self->find(key);
|
||||
return iter != $self->end();
|
||||
}
|
||||
|
||||
void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) {
|
||||
std::unordered_map< K, T, H >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
throw std::out_of_range("key already exists");
|
||||
$self->insert(std::pair< K, T >(key, value));
|
||||
}
|
||||
|
||||
bool Remove(const key_type& key) {
|
||||
std::unordered_map< K, T, H >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end()) {
|
||||
$self->erase(iter);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// create_iterator_begin(), get_next_key() and destroy_iterator work together to provide a collection of keys to C#
|
||||
%apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *create_iterator_begin }
|
||||
%apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *swigiterator }
|
||||
|
||||
std::unordered_map< K, T, H >::iterator *create_iterator_begin() {
|
||||
return new std::unordered_map< K, T, H >::iterator($self->begin());
|
||||
}
|
||||
|
||||
const key_type& get_next_key(std::unordered_map< K, T, H >::iterator *swigiterator) {
|
||||
(void)self;
|
||||
std::unordered_map< K, T, H >::iterator iter = *swigiterator;
|
||||
(*swigiterator)++;
|
||||
return (*iter).first;
|
||||
}
|
||||
|
||||
void destroy_iterator(std::unordered_map< K, T, H >::iterator *swigiterator) {
|
||||
(void)self;
|
||||
delete swigiterator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%enddef
|
||||
|
||||
%csmethodmodifiers std::unordered_map::empty "private"
|
||||
%csmethodmodifiers std::unordered_map::size "private"
|
||||
%csmethodmodifiers std::unordered_map::getitem "private"
|
||||
%csmethodmodifiers std::unordered_map::setitem "private"
|
||||
%csmethodmodifiers std::unordered_map::create_iterator_begin "private"
|
||||
%csmethodmodifiers std::unordered_map::get_next_key "private"
|
||||
%csmethodmodifiers std::unordered_map::destroy_iterator "private"
|
||||
|
||||
// Default implementation
|
||||
namespace std {
|
||||
template<class K, class T, class H = std::hash<K> > class unordered_map {
|
||||
SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H)
|
||||
};
|
||||
}
|
||||
320
linx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_set.i
Normal file
320
linx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_set.i
Normal file
@@ -0,0 +1,320 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* std_unordered_set.i
|
||||
*
|
||||
* SWIG typemaps for std::unordered_set<T>.
|
||||
*
|
||||
* Note that ISet<> used here requires .NET 4 or later.
|
||||
*
|
||||
* The C# wrapper implements ISet<> interface and is similar in
|
||||
* characteristics to the C# System.Collections.Generic.HashSet<> class, but
|
||||
* doesn't provide quite all of its methods.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <unordered_set>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%csmethodmodifiers std::unordered_set::empty "private"
|
||||
%csmethodmodifiers std::unordered_set::size "private"
|
||||
%csmethodmodifiers std::unordered_set::getitem "private"
|
||||
%csmethodmodifiers std::unordered_set::create_iterator_begin "private"
|
||||
%csmethodmodifiers std::unordered_set::get_next "private"
|
||||
%csmethodmodifiers std::unordered_set::destroy_iterator "private"
|
||||
|
||||
namespace std {
|
||||
|
||||
// TODO: Add support for comparator and allocator template parameters.
|
||||
template <class T>
|
||||
class unordered_set {
|
||||
|
||||
%typemap(csinterfaces) std::unordered_set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n"
|
||||
%proxycode %{
|
||||
void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) {
|
||||
((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item);
|
||||
}
|
||||
|
||||
public bool TryGetValue($typemap(cstype, T) equalValue, out $typemap(cstype, T) actualValue) {
|
||||
try {
|
||||
actualValue = getitem(equalValue);
|
||||
return true;
|
||||
} catch {
|
||||
actualValue = default($typemap(cstype, T));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEmpty {
|
||||
get {
|
||||
return empty();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return (int)size();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array) {
|
||||
CopyTo(array, 0);
|
||||
}
|
||||
|
||||
public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) {
|
||||
if (array == null)
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (arrayIndex < 0)
|
||||
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
if (arrayIndex+this.Count > array.Length)
|
||||
throw new global::System.ArgumentException("Number of elements to copy is too large.");
|
||||
|
||||
foreach ($typemap(cstype, T) item in this) {
|
||||
array.SetValue(item, arrayIndex++);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void IntersectWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
$csclassname old = new $csclassname(this);
|
||||
|
||||
Clear();
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (old.Contains(item))
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private static int count_enum(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
int count = 0;
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public bool IsProperSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSubsetOf(other) && Count < count_enum(other);
|
||||
}
|
||||
|
||||
public bool IsProperSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSupersetOf(other) && Count > count_enum(other);
|
||||
}
|
||||
|
||||
public bool IsSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
int countContained = 0;
|
||||
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (Contains(item))
|
||||
countContained++;
|
||||
}
|
||||
|
||||
return countContained == Count;
|
||||
}
|
||||
|
||||
public bool IsSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (!Contains(item))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Overlaps(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (Contains(item))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetEquals(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
return IsSupersetOf(other) && Count == count_enum(other);
|
||||
}
|
||||
|
||||
public void SymmetricExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
if (!Remove(item))
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnionWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
|
||||
foreach ($typemap(cstype, T) item in other) {
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Items {
|
||||
get {
|
||||
global::System.Collections.Generic.ICollection<$typemap(cstype, T)> items = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
|
||||
int size = this.Count;
|
||||
if (size > 0) {
|
||||
global::System.IntPtr iter = create_iterator_begin();
|
||||
for (int i = 0; i < size; i++) {
|
||||
items.Add(get_next(iter));
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
public $csclassnameEnumerator GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
// Type-safe enumerator
|
||||
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
|
||||
/// whenever the collection is modified. This has been done for changes in the size of the
|
||||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
|
||||
private int currentIndex;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
collectionRef = collection;
|
||||
ItemsCollection = new global::System.Collections.Generic.List<$typemap(cstype, T)>(collection.Items);
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public $typemap(cstype, T) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize - 1)
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return ($typemap(cstype, T))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Type-unsafe IEnumerator.Current
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
int size = collectionRef.Count;
|
||||
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
|
||||
if (moveOkay) {
|
||||
currentIndex++;
|
||||
currentObject = ItemsCollection[currentIndex];
|
||||
} else {
|
||||
currentObject = null;
|
||||
}
|
||||
return moveOkay;
|
||||
}
|
||||
|
||||
public void Reset() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T key_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
unordered_set();
|
||||
unordered_set(const unordered_set& other);
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%extend {
|
||||
bool Add(const value_type& item) {
|
||||
return $self->insert(item).second;
|
||||
}
|
||||
|
||||
bool Contains(const value_type& item) {
|
||||
return $self->count(item) != 0;
|
||||
}
|
||||
|
||||
bool Remove(const value_type& item) {
|
||||
return $self->erase(item) != 0;
|
||||
}
|
||||
|
||||
const value_type& getitem(const value_type& item) throw (std::out_of_range) {
|
||||
std::unordered_set<T>::iterator iter = $self->find(item);
|
||||
if (iter == $self->end())
|
||||
throw std::out_of_range("item not found");
|
||||
|
||||
return *iter;
|
||||
}
|
||||
|
||||
// create_iterator_begin(), get_next() and destroy_iterator work together to provide a collection of items to C#
|
||||
%apply void *VOID_INT_PTR { std::unordered_set<T>::iterator *create_iterator_begin }
|
||||
%apply void *VOID_INT_PTR { std::unordered_set<T>::iterator *swigiterator }
|
||||
|
||||
std::unordered_set<T>::iterator *create_iterator_begin() {
|
||||
return new std::unordered_set<T>::iterator($self->begin());
|
||||
}
|
||||
|
||||
const key_type& get_next(std::unordered_set<T>::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
std::unordered_set<T>::iterator iter = *swigiterator;
|
||||
(*swigiterator)++;
|
||||
return *iter;
|
||||
}
|
||||
|
||||
void destroy_iterator(std::unordered_set<T>::iterator *swigiterator) {
|
||||
(void)$self;
|
||||
delete swigiterator;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user