Merge branch 'master' into tmp
Conflicts: .travis.yml Examples/Makefile.in Examples/test-suite/director_nspace.i Examples/test-suite/nspace.i Examples/test-suite/nspace_extend.i Source/Modules/lang.cxx configure.ac
This commit is contained in:
commit
a234542543
871 changed files with 29690 additions and 7800 deletions
|
|
@ -17,8 +17,7 @@
|
|||
enum SWIGTYPE "(cl::setq ACL_ffresult $body)";
|
||||
%typemap(lout) void "$body";
|
||||
#ifdef __cplusplus
|
||||
%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *,
|
||||
SWIGTYPE &
|
||||
%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
|
||||
%{ (cl:let* ((address $body)
|
||||
(new-inst (cl:make-instance '$lclass :foreign-address address)))
|
||||
(cl:when (cl:and $owner (cl:not (cl:zerop address)))
|
||||
|
|
@ -27,7 +26,7 @@
|
|||
|
||||
%typemap(lout) SWIGTYPE "(cl::let* ((address $body)\n (new-inst (cl::make-instance '$lclass :foreign-address address)))\n (cl::unless (cl::zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (cl::setq ACL_ffresult new-inst))";
|
||||
#else
|
||||
%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE
|
||||
%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE
|
||||
%{ (cl:let* ((address $body)
|
||||
(new-inst (cl:make-instance '$lclass :foreign-address address)))
|
||||
(cl:setq ACL_ffresult new-inst)) %}
|
||||
|
|
@ -67,6 +66,7 @@
|
|||
%typemap(ffitype) void ":void";
|
||||
%typemap(ffitype) enum SWIGTYPE ":int";
|
||||
%typemap(ffitype) SWIGTYPE & "(* :void)";
|
||||
%typemap(ffitype) SWIGTYPE && "(* :void)";
|
||||
|
||||
/* const typemaps
|
||||
idea: marshall all primitive c types to their respective lisp types
|
||||
|
|
@ -102,7 +102,7 @@ and error if a setf operation is performed on the address of this object.
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[],
|
||||
SWIGTYPE[ANY], SWIGTYPE &, const SWIGTYPE "$1_ltype";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE &&, const SWIGTYPE "$1_ltype";
|
||||
%typemap(ctype) SWIGTYPE "$&1_type";
|
||||
|
||||
%typemap(in) bool "$1 = (bool)$input;";
|
||||
|
|
@ -112,7 +112,7 @@ and error if a setf operation is performed on the address of this object.
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[],
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
|
||||
%typemap(in) SWIGTYPE "$1 = *$input;";
|
||||
|
||||
/* We don't need to do any actual C-side typechecking, but need to
|
||||
|
|
@ -167,7 +167,7 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
|
|||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
enum SWIGTYPE { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &,
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
|
||||
SWIGTYPE[], SWIGTYPE[ANY],
|
||||
SWIGTYPE { $1 = 1; };
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
%typemap(out) SWIGTYPE "$result = new $1_ltype($1);";
|
||||
#else
|
||||
|
|
@ -228,6 +228,7 @@ $body)"
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
/*
|
||||
Include all the known keyword warnings. Very useful for adding test
|
||||
files to the test-suite, or check if your own library is ok for all
|
||||
files to the test-suite, or checking if your own library is ok for all
|
||||
the swig supported languages.
|
||||
|
||||
Use as
|
||||
|
||||
swig -Wallkw ...
|
||||
|
||||
If you add a new language, remember to create a separete languagekw.swg
|
||||
If you add a new language, remember to create a separate languagekw.swg
|
||||
file, and add it here.
|
||||
|
||||
*/
|
||||
|
|
@ -19,14 +19,17 @@
|
|||
%include <chicken/chickenkw.swg>
|
||||
%include <csharp/csharpkw.swg>
|
||||
%include <d/dkw.swg>
|
||||
%include <go/gokw.swg>
|
||||
%include <java/javakw.swg>
|
||||
%include <lua/luakw.swg>
|
||||
%include <ocaml/ocamlkw.swg>
|
||||
%include <perl5/perlkw.swg>
|
||||
%include <php/phpkw.swg>
|
||||
%include <pike/pikekw.swg>
|
||||
%include <python/pythonkw.swg>
|
||||
%include <ocaml/ocamlkw.swg>
|
||||
%include <r/rkw.swg>
|
||||
%include <ruby/rubykw.swg>
|
||||
%include <tcl/tclkw.swg>
|
||||
%include <perl5/perlkw.swg>
|
||||
|
||||
|
||||
#endif //__Lib_allkw_swg__
|
||||
|
|
|
|||
33
Lib/cdata.i
33
Lib/cdata.i
|
|
@ -20,17 +20,50 @@ typedef struct SWIGCDATA {
|
|||
$result = scm_from_locale_stringn($1.data,$1.len);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGCHICKEN
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
C_word *string_space = C_alloc(C_SIZEOF_STRING($1.len));
|
||||
$result = C_string(&string_space, $1.len, $1.data);
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
#elif SWIGPHP
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
ZVAL_STRINGL($result, $1.data, $1.len, 1);
|
||||
}
|
||||
%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;
|
||||
}
|
||||
|
||||
#else
|
||||
%echo "cdata.i module not supported."
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$1_ltype";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype";
|
||||
%typemap(ctype) SWIGTYPE "$&1_type";
|
||||
|
||||
%typemap(in) bool "$1 = (bool)$input;";
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
|
||||
%typemap(in) SWIGTYPE "$1 = *$input;";
|
||||
|
||||
%typemap(out) void "";
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
%typemap(out) SWIGTYPE "$result = new $1_type($1);";
|
||||
#else
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
enum SWIGTYPE { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &,
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
|
||||
SWIGTYPE[ANY], SWIGTYPE { $1 = 1; };
|
||||
/* This maps C/C++ types to Lisp classes for overload dispatch */
|
||||
|
||||
|
|
@ -132,6 +132,7 @@
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
/* enum SWIGTYPE */
|
||||
%apply int { enum SWIGTYPE };
|
||||
%apply const int& { const enum SWIGTYPE& };
|
||||
%apply const int& { const enum SWIGTYPE&& };
|
||||
|
||||
%typemap(varin) enum SWIGTYPE
|
||||
{
|
||||
|
|
@ -178,7 +179,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
%typemap(freearg) char * "if ($1 != NULL) { free ($1); }"
|
||||
|
||||
/* Pointers, references, and arrays */
|
||||
%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE & {
|
||||
%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, SWIGTYPE && {
|
||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, $disown);
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +200,10 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE && {
|
||||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE [] {
|
||||
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "Type error");
|
||||
}
|
||||
|
|
@ -216,7 +221,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
$1 = SWIG_MustGetPtr($input, NULL, 1, 0);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
|
||||
$result = SWIG_NewPointerObj($1, $descriptor, $owner);
|
||||
}
|
||||
|
|
@ -237,6 +242,11 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
$result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE && {
|
||||
C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
|
||||
$result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
/* special typemaps for class pointers */
|
||||
%typemap(in) SWIGTYPE (CLASS::*) {
|
||||
char err_msg[256];
|
||||
|
|
@ -531,7 +541,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
%typemap(constcode) char *
|
||||
"static const char *$result = $value;"
|
||||
|
||||
%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
|
||||
%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE []
|
||||
"static const void *$result = (void*) $value;"
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
@ -607,7 +617,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
$1 = C_swig_is_string ($input);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
$1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
|
||||
}
|
||||
|
|
@ -628,6 +638,17 @@ $result = C_SCHEME_UNDEFINED;
|
|||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &&
|
||||
{
|
||||
void *ptr = 0;
|
||||
if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) {
|
||||
/* error */
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = (ptr != 0);
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
|
||||
{
|
||||
void *ptr = 0;
|
||||
|
|
@ -673,6 +694,12 @@ $result = C_SCHEME_UNDEFINED;
|
|||
SWIG_Chicken_ThrowException(ptr);
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE && {
|
||||
C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
|
||||
C_word ptr = SWIG_NewPointerObj((void *)&($1),$descriptor,0);
|
||||
SWIG_Chicken_ThrowException(ptr);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* ANSI C typemaps
|
||||
* ------------------------------------------------------------ */
|
||||
|
|
@ -685,6 +712,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ SWIG_Chicken_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
|||
swig_module_info *ret = 0;
|
||||
C_word sym;
|
||||
|
||||
/* lookup the type pointer... it is stored in it's own symbol table */
|
||||
/* lookup the type pointer... it is stored in its own symbol table */
|
||||
C_SYMBOL_TABLE *stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
|
||||
if (stable != NULL) {
|
||||
sym = SWIG_Chicken_LookupSymbol(chicken_runtimevar_name, stable);
|
||||
|
|
@ -333,7 +333,7 @@ SWIG_Chicken_SetModule(swig_module_info *module) {
|
|||
C_word pointer;
|
||||
static C_word *space = 0;
|
||||
|
||||
/* type pointer is stored in it's own symbol table */
|
||||
/* type pointer is stored in its own symbol table */
|
||||
stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION);
|
||||
if (stable == NULL) {
|
||||
stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
%typemap(ctype) CTYPE INPUT[] "CTYPE*"
|
||||
%typemap(cstype) CTYPE INPUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[In, MarshalAs(UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]"
|
||||
%typemap(csin) CTYPE INPUT[] "$csinput"
|
||||
|
||||
%typemap(in) CTYPE INPUT[] "$1 = $input;"
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
%typemap(ctype) CTYPE OUTPUT[] "CTYPE*"
|
||||
%typemap(cstype) CTYPE OUTPUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]"
|
||||
%typemap(csin) CTYPE OUTPUT[] "$csinput"
|
||||
|
||||
%typemap(in) CTYPE OUTPUT[] "$1 = $input;"
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
%typemap(ctype) CTYPE INOUT[] "CTYPE*"
|
||||
%typemap(cstype) CTYPE INOUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[In, Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]"
|
||||
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]"
|
||||
%typemap(csin) CTYPE INOUT[] "$csinput"
|
||||
|
||||
%typemap(in) CTYPE INOUT[] "$1 = $input;"
|
||||
|
|
@ -108,12 +108,12 @@ CSHARP_ARRAYS(double, double)
|
|||
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
|
||||
|
||||
%typemap(ctype) CTYPE FIXED[] "CTYPE*"
|
||||
%typemap(imtype) CTYPE FIXED[] "IntPtr"
|
||||
%typemap(imtype) CTYPE FIXED[] "global::System.IntPtr"
|
||||
%typemap(cstype) CTYPE FIXED[] "CSTYPE[]"
|
||||
%typemap(csin,
|
||||
pre= " fixed ( CSTYPE* swig_ptrTo_$csinput = $csinput ) {",
|
||||
terminator=" }")
|
||||
CTYPE FIXED[] "(IntPtr)swig_ptrTo_$csinput"
|
||||
CTYPE FIXED[] "(global::System.IntPtr)swig_ptrTo_$csinput"
|
||||
|
||||
%typemap(in) CTYPE FIXED[] "$1 = $input;"
|
||||
%typemap(freearg) CTYPE FIXED[] ""
|
||||
|
|
|
|||
|
|
@ -207,11 +207,11 @@
|
|||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *"
|
||||
%typemap (imtype, out="IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
|
||||
%typemap (imtype, out="global::System.IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "HandleRef"
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
|
||||
|
|
@ -224,28 +224,28 @@
|
|||
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
|
||||
|
|
@ -274,76 +274,76 @@
|
|||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Base proxy classes
|
||||
%typemap(csbody) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(csbody_derived) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
swigCMemOwnBase = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
swigCMemOwnDerived = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// CONST version needed ???? also for C#
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
|
@ -424,8 +424,8 @@
|
|||
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)"
|
||||
%typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)"
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
|
||||
IntPtr cPtr = $imcall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
}
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) CONST TYPE {
|
||||
|
|
@ -435,75 +435,75 @@
|
|||
return new $typemap(cstype, TYPE)($imcall, true);
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
|
||||
IntPtr cPtr = $imcall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
|
||||
IntPtr cPtr = $imcall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
|
||||
}
|
||||
|
||||
// Base proxy classes
|
||||
%typemap(csbody) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(csbody_derived) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
swigCMemOwnBase = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
swigCMemOwnDerived = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CONST version needed ???? also for C#
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
|
||||
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@
|
|||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
|
||||
%typemap (imtype, out="IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
%typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "HandleRef"
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
|
||||
|
|
@ -110,23 +110,23 @@
|
|||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
|
||||
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -140,13 +140,13 @@
|
|||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -157,78 +157,78 @@
|
|||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
|
||||
// Proxy classes (base classes, ie, not derived classes)
|
||||
%typemap(csbody) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(csbody_derived) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnBase) {
|
||||
swigCMemOwnBase = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwnDerived) {
|
||||
swigCMemOwnDerived = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,34 @@
|
|||
* The imtype typemap contains the C# type used in the intermediary class.
|
||||
* The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
|
||||
|
||||
/* SWIG 3 no longer inserts using directives into generated C# code. For backwards compatibility, the SWIG2_CSHARP
|
||||
macro can be defined to have SWIG 3 generate using directives similar to those generated by SWIG 2. */
|
||||
#ifdef SWIG2_CSHARP
|
||||
|
||||
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing global::System;\nusing global::System.Runtime.InteropServices;\n"
|
||||
|
||||
%pragma(csharp) moduleimports=%{
|
||||
using global::System;
|
||||
using global::System.Runtime.InteropServices;
|
||||
%}
|
||||
|
||||
%pragma(csharp) imclassimports=%{
|
||||
using global::System;
|
||||
using global::System.Runtime.InteropServices;
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Fragments */
|
||||
%fragment("SWIG_PackData", "header") {
|
||||
/* Pack binary data into a string */
|
||||
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
register const unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
const unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register unsigned char uu = *u;
|
||||
unsigned char uu = *u;
|
||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||
*(c++) = hex[uu & 0xf];
|
||||
}
|
||||
|
|
@ -31,11 +49,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|||
%fragment("SWIG_UnPackData", "header") {
|
||||
/* Unpack binary data from a string */
|
||||
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
register unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register char d = *(c++);
|
||||
register unsigned char uu;
|
||||
char d = *(c++);
|
||||
unsigned char uu;
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
uu = ((d - '0') << 4);
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
|
|
@ -110,21 +128,25 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
/* Non primitive types */
|
||||
%typemap(ctype) SWIGTYPE "void *"
|
||||
%typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE "$&csclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE [] "void *"
|
||||
%typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE [] "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE [] "$csclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE * "void *"
|
||||
%typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE * "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE * "$csclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE & "void *"
|
||||
%typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE & "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE & "$csclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE && "void *"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE && "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE && "$csclassname"
|
||||
|
||||
/* pointer to a class member */
|
||||
%typemap(ctype) SWIGTYPE (CLASS::*) "char *"
|
||||
%typemap(imtype) SWIGTYPE (CLASS::*) "string"
|
||||
|
|
@ -401,6 +423,11 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input;
|
||||
if (!$1) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
|
||||
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
|
||||
char buf[128];
|
||||
|
|
@ -409,6 +436,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$result = SWIG_csharp_string_callback(buf);
|
||||
%}
|
||||
%typemap(out) SWIGTYPE & %{ $result = (void *)$1; %}
|
||||
%typemap(out) SWIGTYPE && %{ $result = (void *)$1; %}
|
||||
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *
|
||||
%{ $result = ($1_ltype)$input; %}
|
||||
|
|
@ -421,6 +449,12 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%{ $input = (void *) $1; %}
|
||||
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
|
||||
return $null;
|
||||
}
|
||||
$result = ($1_ltype)$input; %}
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &&
|
||||
%{ if (!$input) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
|
||||
return $null;
|
||||
|
|
@ -428,10 +462,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$result = ($1_ltype)$input; %}
|
||||
%typemap(directorin) SWIGTYPE &
|
||||
%{ $input = ($1_ltype) &$1; %}
|
||||
%typemap(directorin) SWIGTYPE &&
|
||||
%{ $input = ($1_ltype) &$1; %}
|
||||
|
||||
%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == IntPtr.Zero) ? null : new $csclassname($iminput, false)"
|
||||
%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == global::System.IntPtr.Zero) ? null : new $csclassname($iminput, false)"
|
||||
%typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)"
|
||||
%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle"
|
||||
%typemap(csdirectorin) SWIGTYPE && "new $csclassname($iminput, false)"
|
||||
%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$csclassname.getCPtr($cscall).Handle"
|
||||
|
||||
/* Default array handling */
|
||||
%typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
|
||||
|
|
@ -526,6 +563,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE *const&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
|
|
@ -544,7 +582,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
|
||||
return $null; %}
|
||||
|
||||
%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY]
|
||||
%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [ANY]
|
||||
%{ (void)$1;
|
||||
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
|
||||
return $null; %}
|
||||
|
|
@ -575,7 +613,7 @@ 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 [] "$csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
|
||||
|
||||
/* The csout typemap is used for converting function return types from the return type
|
||||
|
|
@ -658,9 +696,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$csclassname ret = new $csclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE && {
|
||||
$csclassname ret = new $csclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] {
|
||||
IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
|
||||
|
|
@ -671,7 +713,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
|
||||
/* Properties */
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
set {
|
||||
$imcall;$excode
|
||||
} %}
|
||||
|
|
@ -772,10 +814,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$csclassname ret = new $csclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE && %{
|
||||
get {
|
||||
$csclassname ret = new $csclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
} %}
|
||||
|
||||
|
|
@ -788,12 +835,12 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
/* Pointer reference typemaps */
|
||||
%typemap(ctype) SWIGTYPE *const& "void *"
|
||||
%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE *const& "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(cstype) SWIGTYPE *const& "$*csclassname"
|
||||
%typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)"
|
||||
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& {
|
||||
IntPtr cPtr = $imcall;
|
||||
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
|
||||
global::System.IntPtr cPtr = $imcall;
|
||||
$*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
|
||||
|
|
@ -802,27 +849,26 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(out) SWIGTYPE *const&
|
||||
%{ $result = (void *)*$1; %}
|
||||
|
||||
/* Marshal C/C++ pointer to IntPtr */
|
||||
/* Marshal C/C++ pointer to global::System.IntPtr */
|
||||
%typemap(ctype) void *VOID_INT_PTR "void *"
|
||||
%typemap(imtype) void *VOID_INT_PTR "IntPtr"
|
||||
%typemap(cstype) void *VOID_INT_PTR "IntPtr"
|
||||
%typemap(imtype) void *VOID_INT_PTR "global::System.IntPtr"
|
||||
%typemap(cstype) void *VOID_INT_PTR "global::System.IntPtr"
|
||||
%typemap(in) void *VOID_INT_PTR %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) void *VOID_INT_PTR %{ $result = (void *)$1; %}
|
||||
%typemap(csin) void *VOID_INT_PTR "$csinput"
|
||||
%typemap(csout, excode=SWIGEXCODE) void *VOID_INT_PTR {
|
||||
IntPtr ret = $imcall;$excode
|
||||
global::System.IntPtr ret = $imcall;$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
|
||||
%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n"
|
||||
%typemap(csinterfaces) SWIGTYPE "IDisposable"
|
||||
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
|
||||
%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces) SWIGTYPE "global::System.IDisposable"
|
||||
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
|
||||
|
||||
// csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
|
||||
|
|
@ -830,48 +876,48 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%define SWIG_CSBODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Proxy classes (base classes, ie, not derived classes)
|
||||
%typemap(csbody) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
protected bool swigCMemOwn;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(csbody_derived) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%define SWIG_CSBODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Typewrapper classes
|
||||
%typemap(csbody) TYPE *, TYPE &, TYPE [] %{
|
||||
private HandleRef swigCPtr;
|
||||
%typemap(csbody) TYPE *, TYPE &, TYPE &&, TYPE [] %{
|
||||
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool futureUse) {
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool futureUse) {
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
DEFAULTCTOR_VISIBILITY $csclassname() {
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
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;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -909,27 +955,27 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
|
||||
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
|
||||
lock(this) {
|
||||
if (swigCPtr.Handle != IntPtr.Zero) {
|
||||
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
|
||||
if (swigCMemOwn) {
|
||||
swigCMemOwn = false;
|
||||
$imcall;
|
||||
}
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
@ -952,16 +998,6 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
%pragma(csharp) imclassclassmodifiers="class"
|
||||
%pragma(csharp) moduleclassmodifiers="public class"
|
||||
|
||||
%pragma(csharp) moduleimports=%{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
%}
|
||||
|
||||
%pragma(csharp) imclassimports=%{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
%}
|
||||
|
||||
/* Some ANSI C typemaps */
|
||||
|
||||
%apply unsigned long { size_t };
|
||||
|
|
@ -969,6 +1005,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
@ -985,23 +1022,23 @@ using System.Runtime.InteropServices;
|
|||
/*
|
||||
// Alternative char * typemaps.
|
||||
%pragma(csharp) imclasscode=%{
|
||||
public class SWIGStringMarshal : IDisposable {
|
||||
public readonly HandleRef swigCPtr;
|
||||
public class SWIGStringMarshal : global::System.IDisposable {
|
||||
public readonly global::System.Runtime.InteropServices.HandleRef swigCPtr;
|
||||
public SWIGStringMarshal(string str) {
|
||||
swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
|
||||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, global::System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
|
||||
}
|
||||
public virtual void Dispose() {
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
|
||||
GC.SuppressFinalize(this);
|
||||
global::System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
|
||||
global::System.GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef"
|
||||
%typemap(imtype, out="global::System.IntPtr") char *, char[ANY], char[] "global::System.Runtime.InteropServices.HandleRef"
|
||||
%typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
|
||||
%typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr"
|
||||
%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
|
||||
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
|
||||
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
|
||||
|
|
@ -1010,7 +1047,7 @@ using System.Runtime.InteropServices;
|
|||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
|
||||
get {
|
||||
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
|
||||
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
|
||||
return ret;
|
||||
} %}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
|
||||
static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
|
||||
|
||||
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")]
|
||||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")]
|
||||
public static extern void SWIGRegisterExceptionCallbacks_$module(
|
||||
ExceptionDelegate applicationDelegate,
|
||||
ExceptionDelegate arithmeticDelegate,
|
||||
|
|
@ -163,58 +163,58 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
ExceptionDelegate overflowDelegate,
|
||||
ExceptionDelegate systemExceptionDelegate);
|
||||
|
||||
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")]
|
||||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")]
|
||||
public static extern void SWIGRegisterExceptionCallbacksArgument_$module(
|
||||
ExceptionArgumentDelegate argumentDelegate,
|
||||
ExceptionArgumentDelegate argumentNullDelegate,
|
||||
ExceptionArgumentDelegate argumentOutOfRangeDelegate);
|
||||
|
||||
static void SetPendingApplicationException(string message) {
|
||||
SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingArithmeticException(string message) {
|
||||
SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingDivideByZeroException(string message) {
|
||||
SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingIndexOutOfRangeException(string message) {
|
||||
SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingInvalidCastException(string message) {
|
||||
SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingInvalidOperationException(string message) {
|
||||
SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingIOException(string message) {
|
||||
SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingNullReferenceException(string message) {
|
||||
SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingOutOfMemoryException(string message) {
|
||||
SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingOverflowException(string message) {
|
||||
SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingSystemException(string message) {
|
||||
SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
|
||||
static void SetPendingArgumentException(string message, string paramName) {
|
||||
SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
|
||||
SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
|
||||
}
|
||||
static void SetPendingArgumentNullException(string message, string paramName) {
|
||||
Exception e = SWIGPendingException.Retrieve();
|
||||
global::System.Exception e = SWIGPendingException.Retrieve();
|
||||
if (e != null) message = message + " Inner Exception: " + e.Message;
|
||||
SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
|
||||
SWIGPendingException.Set(new global::System.ArgumentNullException(paramName, message));
|
||||
}
|
||||
static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
|
||||
Exception e = SWIGPendingException.Retrieve();
|
||||
global::System.Exception e = SWIGPendingException.Retrieve();
|
||||
if (e != null) message = message + " Inner Exception: " + e.Message;
|
||||
SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
|
||||
SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message));
|
||||
}
|
||||
|
||||
static SWIGExceptionHelper() {
|
||||
|
|
@ -241,8 +241,8 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
|
||||
|
||||
public class SWIGPendingException {
|
||||
[ThreadStatic]
|
||||
private static Exception pendingException = null;
|
||||
[global::System.ThreadStatic]
|
||||
private static global::System.Exception pendingException = null;
|
||||
private static int numExceptionsPending = 0;
|
||||
|
||||
public static bool Pending {
|
||||
|
|
@ -255,17 +255,17 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
|||
}
|
||||
}
|
||||
|
||||
public static void Set(Exception e) {
|
||||
public static void Set(global::System.Exception e) {
|
||||
if (pendingException != null)
|
||||
throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
|
||||
throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
|
||||
pendingException = e;
|
||||
lock(typeof($imclassname)) {
|
||||
numExceptionsPending++;
|
||||
}
|
||||
}
|
||||
|
||||
public static Exception Retrieve() {
|
||||
Exception e = null;
|
||||
public static global::System.Exception Retrieve() {
|
||||
global::System.Exception e = null;
|
||||
if (numExceptionsPending > 0) {
|
||||
if (pendingException != null) {
|
||||
e = pendingException;
|
||||
|
|
@ -294,7 +294,7 @@ static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
|
|||
public delegate string SWIGStringDelegate(string message);
|
||||
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
|
||||
|
||||
[DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
|
||||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
|
||||
public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
|
||||
|
||||
static string CreateString(string cString) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
/* Warnings for C# keywords */
|
||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '_" `x` "'",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`
|
||||
|
||||
/*
|
||||
from
|
||||
http://www.jaggersoft.com/csharp_grammar.html#1.7%20Keywords
|
||||
|
|
@ -88,6 +90,7 @@ CSHARPKW(void);
|
|||
CSHARPKW(volatile);
|
||||
CSHARPKW(while);
|
||||
|
||||
CSHARPCLASSKW(delete);
|
||||
|
||||
#undef CSHARPKW
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes so that C# proxy
|
||||
* This file contains support for director classes so that C# proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(DEBUG_DIRECTOR_OWNED)
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
/* Director base class - not currently used in C# directors */
|
||||
|
|
@ -18,30 +17,30 @@ namespace Swig {
|
|||
};
|
||||
|
||||
/* Base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
|
||||
public:
|
||||
DirectorException(const char* msg) : swig_msg(msg) {
|
||||
DirectorException(const char *msg) : swig_msg(msg) {
|
||||
}
|
||||
|
||||
DirectorException(const std::string &msg) : swig_msg(msg) {
|
||||
}
|
||||
const std::string& what() const {
|
||||
return swig_msg;
|
||||
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
virtual ~DirectorException() {
|
||||
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
/* Pure virtual method exception */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException {
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
|
||||
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
|
||||
|
||||
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
|
||||
%{ static $*1_ltype temp = ($*1_ltype)$input;
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
%typemap(cstype) enum SWIGTYPE "$csclassname"
|
||||
|
||||
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
|
||||
|
||||
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
|
||||
%typemap(directorin) enum SWIGTYPE "$input = $1;"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
|
||||
|
||||
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
|
||||
%{ static $*1_ltype temp = ($*1_ltype)$input;
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
%typemap(cstype) enum SWIGTYPE "int"
|
||||
|
||||
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
|
||||
|
||||
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
|
||||
%typemap(directorin) enum SWIGTYPE "$input = $1;"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = &temp; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
|
||||
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
|
||||
|
||||
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
|
||||
%{ static $*1_ltype temp = ($*1_ltype)$input;
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
%typemap(cstype) enum SWIGTYPE "$csclassname"
|
||||
|
||||
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
|
||||
|
||||
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
|
||||
%typemap(directorin) enum SWIGTYPE "$input = $1;"
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
for (int i = 0; i < swigValues.Length; i++)
|
||||
if (swigValues[i].swigValue == swigValue)
|
||||
return swigValues[i];
|
||||
throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
|
||||
throw new global::System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
|
|
|
|||
25
Lib/csharp/std_auto_ptr.i
Normal file
25
Lib/csharp/std_auto_ptr.i
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
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 {};
|
||||
}
|
||||
|
|
@ -11,9 +11,7 @@
|
|||
* %template(MapIntDouble) std::map<int, double>
|
||||
*
|
||||
* Notes:
|
||||
* 1) For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code. In this case
|
||||
* the C# wrapper has only basic functionality.
|
||||
* 2) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::map wrappers.
|
||||
*
|
||||
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
|
||||
|
|
@ -28,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 > "IDisposable \n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n#endif\n";
|
||||
%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
|
||||
%typemap(cscode) std::map<K, T, C > %{
|
||||
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
|
|
@ -62,14 +60,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
#if !SWIG_DOTNET_1
|
||||
|
||||
public System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
||||
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
||||
get {
|
||||
System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new System.Collections.Generic.List<$typemap(cstype, K)>();
|
||||
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) {
|
||||
IntPtr iter = create_iterator_begin();
|
||||
global::System.IntPtr iter = create_iterator_begin();
|
||||
for (int i = 0; i < size; i++) {
|
||||
keys.Add(get_next_key(iter));
|
||||
}
|
||||
|
|
@ -79,21 +75,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
|
||||
public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
|
||||
get {
|
||||
System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new System.Collections.Generic.List<$typemap(cstype, T)>();
|
||||
foreach (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
|
||||
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(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
public bool Remove(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (Contains(item)) {
|
||||
return Remove(item.Key);
|
||||
} else {
|
||||
|
|
@ -101,7 +97,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
public bool Contains(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (this[item.Key] == item.Value) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -109,32 +105,32 @@
|
|||
}
|
||||
}
|
||||
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
|
||||
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
|
||||
CopyTo(array, 0);
|
||||
}
|
||||
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
|
||||
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
|
||||
if (array == null)
|
||||
throw new ArgumentNullException("array");
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (arrayIndex < 0)
|
||||
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new ArgumentException("Multi dimensional array.", "array");
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
if (arrayIndex+this.Count > array.Length)
|
||||
throw new ArgumentException("Number of elements to copy is too large.");
|
||||
throw new global::System.ArgumentException("Number of elements to copy is too large.");
|
||||
|
||||
System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
|
||||
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 System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
|
||||
array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
|
||||
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);
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
|
|
@ -147,38 +143,38 @@
|
|||
/// 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 : System.Collections.IEnumerator,
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
|
||||
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 System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
|
||||
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 System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
|
||||
keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
|
||||
public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new InvalidOperationException("Enumeration not started.");
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize - 1)
|
||||
throw new InvalidOperationException("Enumeration finished.");
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
return (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject;
|
||||
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 System.Collections.IEnumerator.Current {
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
|
|
@ -190,7 +186,7 @@
|
|||
if (moveOkay) {
|
||||
currentIndex++;
|
||||
$typemap(cstype, K) currentKey = keyCollection[currentIndex];
|
||||
currentObject = new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
|
||||
currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
|
||||
} else {
|
||||
currentObject = null;
|
||||
}
|
||||
|
|
@ -201,7 +197,7 @@
|
|||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +206,6 @@
|
|||
currentObject = null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
* SWIG typemaps for std::vector<T>
|
||||
* C# implementation
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
|
||||
* For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code; then the C# wrapper is
|
||||
* made to look and feel like a typesafe C# System.Collections.ArrayList.
|
||||
*
|
||||
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
|
||||
|
|
@ -26,11 +24,11 @@
|
|||
|
||||
// MACRO for use within the std::vector class body
|
||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
|
||||
%typemap(csinterfaces) std::vector< CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
|
||||
%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
%typemap(cscode) std::vector< CTYPE > %{
|
||||
public $csclassname(System.Collections.ICollection c) : this() {
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new ArgumentNullException("c");
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
this.Add(element);
|
||||
}
|
||||
|
|
@ -63,7 +61,7 @@
|
|||
}
|
||||
set {
|
||||
if (value < size())
|
||||
throw new ArgumentOutOfRangeException("Capacity");
|
||||
throw new global::System.ArgumentOutOfRangeException("Capacity");
|
||||
reserve((uint)value);
|
||||
}
|
||||
}
|
||||
|
|
@ -80,53 +78,39 @@
|
|||
}
|
||||
}
|
||||
|
||||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(System.Array array)
|
||||
#else
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array)
|
||||
#endif
|
||||
{
|
||||
CopyTo(0, array, 0, this.Count);
|
||||
}
|
||||
|
||||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(System.Array array, int arrayIndex)
|
||||
#else
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
|
||||
#endif
|
||||
{
|
||||
CopyTo(0, array, arrayIndex, this.Count);
|
||||
}
|
||||
|
||||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(int index, System.Array array, int arrayIndex, int count)
|
||||
#else
|
||||
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
|
||||
#endif
|
||||
{
|
||||
if (array == null)
|
||||
throw new ArgumentNullException("array");
|
||||
throw new global::System.ArgumentNullException("array");
|
||||
if (index < 0)
|
||||
throw new ArgumentOutOfRangeException("index", "Value is less than zero");
|
||||
throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
|
||||
if (arrayIndex < 0)
|
||||
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
||||
if (count < 0)
|
||||
throw new ArgumentOutOfRangeException("count", "Value is less than zero");
|
||||
throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
|
||||
if (array.Rank > 1)
|
||||
throw new ArgumentException("Multi dimensional array.", "array");
|
||||
throw new global::System.ArgumentException("Multi dimensional array.", "array");
|
||||
if (index+count > this.Count || arrayIndex+count > array.Length)
|
||||
throw new ArgumentException("Number of elements to copy is too large.");
|
||||
throw new global::System.ArgumentException("Number of elements to copy is too large.");
|
||||
for (int i=0; i<count; i++)
|
||||
array.SetValue(getitemcopy(index+i), arrayIndex+i);
|
||||
}
|
||||
|
||||
#if !SWIG_DOTNET_1
|
||||
System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
|
|
@ -139,10 +123,8 @@
|
|||
/// 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 : System.Collections.IEnumerator
|
||||
#if !SWIG_DOTNET_1
|
||||
, System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||
#endif
|
||||
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
|
||||
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private int currentIndex;
|
||||
|
|
@ -160,17 +142,17 @@
|
|||
public $typemap(cstype, CTYPE) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new InvalidOperationException("Enumeration not started.");
|
||||
throw new global::System.InvalidOperationException("Enumeration not started.");
|
||||
if (currentIndex > currentSize - 1)
|
||||
throw new InvalidOperationException("Enumeration finished.");
|
||||
throw new global::System.InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
return ($typemap(cstype, CTYPE))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Type-unsafe IEnumerator.Current
|
||||
object System.Collections.IEnumerator.Current {
|
||||
object global::System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return Current;
|
||||
}
|
||||
|
|
@ -192,16 +174,14 @@
|
|||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
if (collectionRef.Count != currentSize) {
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
throw new global::System.InvalidOperationException("Collection modified.");
|
||||
}
|
||||
}
|
||||
|
||||
#if !SWIG_DOTNET_1
|
||||
public void Dispose() {
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -237,7 +217,7 @@
|
|||
else
|
||||
throw std::out_of_range("index");
|
||||
}
|
||||
const_reference getitem(int index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getitem(int index) throw (std::out_of_range) {
|
||||
if (index>=0 && index<(int)$self->size())
|
||||
return (*$self)[index];
|
||||
else
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class wstring;
|
|||
|
||||
// wstring
|
||||
%typemap(ctype, out="void *") wstring "wchar_t *"
|
||||
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") wstring "string"
|
||||
%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"
|
||||
|
|
@ -60,7 +60,7 @@ class wstring;
|
|||
|
||||
// const wstring &
|
||||
%typemap(ctype, out="void *") const wstring & "wchar_t *"
|
||||
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") const wstring & "string"
|
||||
%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"
|
||||
|
|
|
|||
34
Lib/csharp/swigtype_inout.i
Normal file
34
Lib/csharp/swigtype_inout.i
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* swigtype_inout.i
|
||||
*
|
||||
* Pointer pointer and pointer reference handling typemap library for non-primitive types
|
||||
*
|
||||
* These mappings provide support for input/output arguments and common
|
||||
* uses for C/C++ pointer references and pointer to pointers.
|
||||
*
|
||||
* These are named typemaps (OUTPUT) and can be used like any named typemap.
|
||||
* Alternatively they can be made the default by using %apply:
|
||||
* %apply SWIGTYPE *& OUTPUT { SWIGTYPE *& }
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* OUTPUT typemaps. Example usage wrapping:
|
||||
*
|
||||
* void f(XXX *& x) { x = new XXX(111); }
|
||||
*
|
||||
* would be:
|
||||
*
|
||||
* XXX x = null;
|
||||
* f(out x);
|
||||
* // use x
|
||||
* x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector
|
||||
*/
|
||||
%typemap(ctype) SWIGTYPE *& OUTPUT "void **"
|
||||
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE *& OUTPUT "out global::System.IntPtr"
|
||||
%typemap(cstype) SWIGTYPE *& OUTPUT "out $*csclassname"
|
||||
%typemap(csin,
|
||||
pre=" global::System.IntPtr cPtr_$csinput = global::System.IntPtr.Zero;",
|
||||
post=" $csinput = (cPtr_$csinput == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr_$csinput, true);",
|
||||
cshin="out $csinput") SWIGTYPE *& OUTPUT "out cPtr_$csinput"
|
||||
%typemap(in) SWIGTYPE *& OUTPUT %{ $1 = ($1_ltype)$input; %}
|
||||
%typemap(freearg) SWIGTYPE *& OUTPUT ""
|
||||
|
|
@ -55,7 +55,7 @@ In C# you could then use it like this:
|
|||
|
||||
%define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE)
|
||||
%typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE"
|
||||
%typemap(imtype, out="IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(imtype, out="global::System.IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput"
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ value returned in the second output parameter. In C# you would use it like this:
|
|||
|
||||
%define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
|
||||
%typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
|
||||
%typemap(imtype, out="IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(imtype, out="global::System.IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput"
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ of the function return value.
|
|||
|
||||
%define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
|
||||
%typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *"
|
||||
%typemap(imtype, out="IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(imtype, out="global::System.IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
|
|||
%pragma(csharp) imclasscode=%{
|
||||
protected class SWIGWStringHelper {
|
||||
|
||||
public delegate string SWIGWStringDelegate(IntPtr message);
|
||||
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
|
||||
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
|
||||
|
||||
[DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
|
||||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
|
||||
public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
|
||||
|
||||
static string CreateWString([MarshalAs(UnmanagedType.LPWStr)]IntPtr cString) {
|
||||
return System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
|
||||
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() {
|
||||
|
|
@ -77,12 +77,12 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
|
|||
|
||||
// wchar_t *
|
||||
%typemap(ctype) wchar_t * "wchar_t *"
|
||||
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]", out="IntPtr" ) wchar_t * "string"
|
||||
%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 = System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
|
||||
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
|
||||
return ret;
|
||||
}
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
|
||||
|
|
|
|||
|
|
@ -5,42 +5,41 @@
|
|||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(DEBUG_DIRECTOR_OWNED)
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
// Director base class – not used in D directors.
|
||||
class Director {
|
||||
};
|
||||
|
||||
// Base class for director exceptions.
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
|
||||
public:
|
||||
DirectorException(const char* msg) : swig_msg(msg) {
|
||||
}
|
||||
DirectorException(const std::string &msg) : swig_msg(msg) {
|
||||
}
|
||||
const std::string& what() const {
|
||||
return swig_msg;
|
||||
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
virtual ~DirectorException() {
|
||||
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
// Exception which is thrown when attempting to call a pure virtual method
|
||||
// from D code thorugh the director layer.
|
||||
class DirectorPureVirtualException : public Swig::DirectorException {
|
||||
// from D code through the director layer.
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
|
||||
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@
|
|||
/* Pack binary data into a string */
|
||||
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
register const unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
const unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register unsigned char uu = *u;
|
||||
unsigned char uu = *u;
|
||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||
*(c++) = hex[uu & 0xf];
|
||||
}
|
||||
|
|
@ -67,11 +67,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|||
%fragment("SWIG_UnPackData", "header") {
|
||||
/* Unpack binary data from a string */
|
||||
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
register unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register char d = *(c++);
|
||||
register unsigned char uu;
|
||||
char d = *(c++);
|
||||
unsigned char uu;
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
uu = ((d - '0') << 4);
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public void capacity(size_t value) {
|
|||
return $self->capacity() - $self->size();
|
||||
}
|
||||
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ public void capacity(size_t value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public void capacity(size_t value) {
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
@ -464,7 +464,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return pv;
|
||||
}
|
||||
|
||||
const_reference remove() throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove() throw (std::out_of_range) {
|
||||
if ($self->empty()) {
|
||||
throw std::out_of_range("Tried to remove last element from empty vector.");
|
||||
}
|
||||
|
|
@ -474,7 +474,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
return value;
|
||||
}
|
||||
|
||||
const_reference remove(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE remove(size_type index) throw (std::out_of_range) {
|
||||
if (index >= $self->size()) {
|
||||
throw std::out_of_range("Tried to remove element with invalid index.");
|
||||
}
|
||||
|
|
@ -506,7 +506,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
|
|||
// Wrappers for setting/getting items with the possibly thrown exception
|
||||
// specified (important for SWIG wrapper generation).
|
||||
%extend {
|
||||
const_reference getElement(size_type index) throw (std::out_of_range) {
|
||||
CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) {
|
||||
if ((index < 0) || ($self->size() <= index)) {
|
||||
throw std::out_of_range("Tried to get value of element with invalid index.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
%{
|
||||
typedef struct SWIGCDATA {
|
||||
char *data;
|
||||
int len;
|
||||
intgo len;
|
||||
intgo cap;
|
||||
} SWIGCDATA;
|
||||
%}
|
||||
|
||||
|
|
@ -15,7 +16,8 @@ typedef struct SWIGCDATA {
|
|||
%typemap(out) SWIGCDATA %{
|
||||
$result.data = (char*)_swig_goallocate($1.len);
|
||||
memcpy($result.data, $1.data, $1.len);
|
||||
$result.len = (int)$1.len;
|
||||
$result.len = (intgo)$1.len;
|
||||
$result.cap = $result.len;
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
* Go configuration module.
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
/* Code insertion directives */
|
||||
#define %go_import(...) %insert(go_imports) %{__VA_ARGS__%}
|
||||
|
||||
/* Basic types */
|
||||
|
||||
%typemap(gotype) bool, const bool & "bool"
|
||||
|
|
@ -14,15 +17,8 @@
|
|||
%typemap(gotype) unsigned short, const unsigned short & "uint16"
|
||||
%typemap(gotype) int, const int & "int"
|
||||
%typemap(gotype) unsigned int, const unsigned int & "uint"
|
||||
#if SWIGGO_LONG_TYPE_SIZE == 32
|
||||
%typemap(gotype) long, const long & "int32"
|
||||
%typemap(gotype) unsigned long, const unsigned long & "uint32"
|
||||
#elif SWIGGO_LONG_TYPE_SIZE == 64
|
||||
%typemap(gotype) long, const long & "int64"
|
||||
%typemap(gotype) unsigned long, const unsigned long & "uint64"
|
||||
#else
|
||||
#error "SWIGGO_LONG_TYPE_SIZE not 32 or 64"
|
||||
#endif
|
||||
%typemap(gotype) long long, const long long & "int64"
|
||||
%typemap(gotype) unsigned long long, const unsigned long long & "uint64"
|
||||
%typemap(gotype) float, const float & "float32"
|
||||
|
|
@ -52,14 +48,17 @@
|
|||
const unsigned short &,
|
||||
const int &,
|
||||
const unsigned int &,
|
||||
const long &,
|
||||
const unsigned long &,
|
||||
const long long &,
|
||||
const unsigned long long &,
|
||||
const float &,
|
||||
const double &
|
||||
%{ $1 = ($1_ltype)&$input; %}
|
||||
|
||||
%typemap(in) const long & ($*1_ltype temp),
|
||||
const unsigned long & ($*1_ltype temp)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = ($1_ltype)&temp; %}
|
||||
|
||||
%typemap(out) bool,
|
||||
char,
|
||||
signed char,
|
||||
|
|
@ -163,11 +162,7 @@
|
|||
|
||||
/* The size_t type. */
|
||||
|
||||
#if SWIGGO_LONG_TYPE_SIZE == 32
|
||||
%typemap(gotype) size_t, const size_t & %{int%}
|
||||
#else
|
||||
%typemap(gotype) size_t, const size_t & %{int64%}
|
||||
#endif
|
||||
|
||||
%typemap(in) size_t
|
||||
%{ $1 = (size_t)$input; %}
|
||||
|
|
@ -273,6 +268,21 @@
|
|||
%typemap(directorout) SWIGTYPE &
|
||||
%{ *($&1_ltype)&$result = $input; %}
|
||||
|
||||
%typemap(gotype) SWIGTYPE &&
|
||||
%{$gotypename%}
|
||||
|
||||
%typemap(in) SWIGTYPE &&
|
||||
%{ $1 = *($&1_ltype)&$input; %}
|
||||
|
||||
%typemap(out) SWIGTYPE &&
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
%typemap(directorin) SWIGTYPE &&
|
||||
%{ $input = ($1_ltype)&$1_name; %}
|
||||
|
||||
%typemap(directorout) SWIGTYPE &&
|
||||
%{ *($&1_ltype)&$result = $input; %}
|
||||
|
||||
/* C arrays turn into Go pointers. If we know the length we can use a
|
||||
slice. */
|
||||
|
||||
|
|
@ -424,14 +434,14 @@
|
|||
%typemap(throws) char *
|
||||
%{ _swig_gopanic($1); %}
|
||||
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY]
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY]
|
||||
%{
|
||||
(void)$1;
|
||||
_swig_gopanic("C++ $1_type exception thrown");
|
||||
%}
|
||||
|
||||
/* Typecheck typemaps. The purpose of these is merely to issue a
|
||||
warning for overloaded C++ functions * that cannot be overloaded in
|
||||
warning for overloaded C++ functions that cannot be overloaded in
|
||||
Go as more than one C++ type maps to a single Go type. */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL) /* Go bool */
|
||||
|
|
@ -471,32 +481,16 @@
|
|||
const unsigned int &
|
||||
""
|
||||
|
||||
#if SWIGGO_LONG_TYPE_SIZE == 32
|
||||
%typecheck(SWIG_TYPECHECK_INT32) /* Go int32 */
|
||||
long,
|
||||
const long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT32) /* Go uint32 */
|
||||
unsigned long,
|
||||
const unsigned long &
|
||||
""
|
||||
#endif
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT64) /* Go int64 */
|
||||
#if SWIGGO_LONG_TYPE_SIZE == 64
|
||||
long,
|
||||
const long &,
|
||||
#endif
|
||||
long long,
|
||||
const long long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT64) /* Go uint64 */
|
||||
#if SWIGGO_LONG_TYPE_SIZE == 64
|
||||
unsigned long,
|
||||
const unsigned long &,
|
||||
#endif
|
||||
unsigned long long,
|
||||
const unsigned long long &
|
||||
""
|
||||
|
|
@ -530,6 +524,7 @@
|
|||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE *const&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
|
|
|
|||
|
|
@ -115,13 +115,6 @@ extern void _cgo_panic(const char *);
|
|||
version. We assume that the version of gcc used to compile this
|
||||
file is the same as the version of gccgo. */
|
||||
|
||||
#define SWIGCONCAT2(s1, s2) s1 ## s2
|
||||
#define SWIGCONCAT1(s1, s2) SWIGCONCAT2(s1, s2)
|
||||
#define SwigCgocall SWIGCONCAT1(SWIGMODULE, SwigCgocall)
|
||||
#define SwigCgocallDone SWIGCONCAT1(SWIGMODULE, SwigCgocallDone)
|
||||
#define SwigCgocallBack SWIGCONCAT1(SWIGMODULE, SwigCgocallBack)
|
||||
#define SwigCgocallBackDone SWIGCONCAT1(SWIGMODULE, SwigCgocallBackDone)
|
||||
|
||||
#define SWIG_GCC_VERSION \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC__PATH_LEVEL__)
|
||||
|
||||
|
|
@ -142,22 +135,36 @@ void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack");
|
|||
void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone");
|
||||
#endif
|
||||
|
||||
#define SWIGSTRINGIFY2(s) #s
|
||||
#define SWIGSTRINGIFY(s) SWIGSTRINGIFY2(s)
|
||||
|
||||
void SwigCgocall()
|
||||
__asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocall");
|
||||
void SwigCgocall() {
|
||||
SwigDoCgocall();
|
||||
}
|
||||
|
||||
void SwigCgocallDone()
|
||||
__asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallDone");
|
||||
void SwigCgocallDone() {
|
||||
SwigDoCgocallDone();
|
||||
}
|
||||
|
||||
void SwigCgocallBack()
|
||||
__asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBack");
|
||||
void SwigCgocallBack() {
|
||||
SwigDoCgocallBack();
|
||||
}
|
||||
|
||||
void SwigCgocallBackDone()
|
||||
__asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBackDone");
|
||||
void SwigCgocallBackDone() {
|
||||
SwigDoCgocallBackDone();
|
||||
}
|
||||
|
||||
#undef SWIGSTRINGIFY
|
||||
#undef SWIGSTRINGIFY2
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -185,30 +192,26 @@ static _gostring_ _swig_makegostring(const char *p, size_t l) {
|
|||
|
||||
#ifndef SWIGGO_GCCGO
|
||||
|
||||
%insert(go_header) %{
|
||||
|
||||
import _ "runtime/cgo"
|
||||
import "unsafe"
|
||||
|
||||
type _ unsafe.Pointer
|
||||
|
||||
%}
|
||||
%go_import("unsafe", _ "runtime/cgo")
|
||||
|
||||
#else
|
||||
|
||||
%go_import("syscall", "unsafe")
|
||||
|
||||
%insert(go_header) %{
|
||||
|
||||
import "syscall"
|
||||
import "unsafe"
|
||||
|
||||
type _ syscall.Sockaddr
|
||||
|
||||
type _ unsafe.Pointer
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
%insert(go_header) %{
|
||||
|
||||
type _ unsafe.Pointer
|
||||
|
||||
%}
|
||||
|
||||
/* Function pointers are translated by the code in go.cxx into
|
||||
_swig_fnptr. Member pointers are translated to _swig_memberptr. */
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -41,10 +41,14 @@ typedef struct swig_guile_clientdata {
|
|||
SCM goops_class;
|
||||
} swig_guile_clientdata;
|
||||
|
||||
#if SCM_MAJOR_VERSION <= 2
|
||||
#define scm_to_utf8_string scm_to_locale_string
|
||||
#define scm_from_utf8_string scm_from_locale_string
|
||||
#endif
|
||||
#define SWIG_scm2str(s) \
|
||||
SWIG_Guile_scm2newstr(s, NULL)
|
||||
#define SWIG_str02scm(str) \
|
||||
str ? scm_from_locale_string(str) : SCM_BOOL_F
|
||||
str ? scm_from_utf8_string(str) : SCM_BOOL_F
|
||||
# define SWIG_malloc(size) \
|
||||
scm_malloc(size)
|
||||
# define SWIG_free(mem) \
|
||||
|
|
@ -84,21 +88,13 @@ SWIGINTERN char *
|
|||
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
|
||||
#define FUNC_NAME "SWIG_Guile_scm2newstr"
|
||||
char *ret;
|
||||
char *tmp;
|
||||
size_t l;
|
||||
|
||||
SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);
|
||||
l = scm_c_string_length(str);
|
||||
|
||||
ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
|
||||
ret = scm_to_utf8_string(str);
|
||||
if (!ret) return NULL;
|
||||
|
||||
tmp = scm_to_locale_string(str);
|
||||
memcpy(ret, tmp, l);
|
||||
free(tmp);
|
||||
|
||||
ret[l] = '\0';
|
||||
if (len) *len = l;
|
||||
if (len) *len = strlen(ret) - 1;
|
||||
return ret;
|
||||
#undef FUNC_NAME
|
||||
}
|
||||
|
|
@ -446,13 +442,8 @@ SWIG_Guile_Init ()
|
|||
SWIGINTERN swig_module_info *
|
||||
SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
|
||||
{
|
||||
SCM module;
|
||||
SCM variable;
|
||||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
variable = scm_module_variable(module,
|
||||
scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME));
|
||||
SCM module = SWIG_Guile_Init();
|
||||
SCM variable = scm_module_variable(module, scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME));
|
||||
if (scm_is_false(variable)) {
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
@ -463,11 +454,7 @@ SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
|
|||
SWIGINTERN void
|
||||
SWIG_Guile_SetModule(swig_module_info *swig_module)
|
||||
{
|
||||
SCM module;
|
||||
SCM variable;
|
||||
|
||||
module = SWIG_Guile_Init();
|
||||
|
||||
SCM module = SWIG_Guile_Init();
|
||||
scm_module_define(module,
|
||||
scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
|
||||
scm_from_ulong((unsigned long) swig_module));
|
||||
|
|
@ -482,7 +469,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
int num_args_passed = 0;
|
||||
for (i = 0; i<reqargs; i++) {
|
||||
if (!SCM_CONSP(rest))
|
||||
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
|
||||
scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
|
||||
*dest++ = SCM_CAR(rest);
|
||||
rest = SCM_CDR(rest);
|
||||
num_args_passed++;
|
||||
|
|
@ -495,7 +482,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
|
|||
for (; i<optargs; i++)
|
||||
*dest++ = SCM_UNDEFINED;
|
||||
if (!SCM_NULLP(rest))
|
||||
scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
|
||||
scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
|
||||
return num_args_passed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,6 @@ namespace std {
|
|||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
$1 = CHECK(o) ? 1 : 0;
|
||||
}
|
||||
|
|
@ -315,7 +314,6 @@ namespace std {
|
|||
$1 = 1;
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = SCM_CAR($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
|
|
@ -335,7 +333,6 @@ namespace std {
|
|||
$1 = 1;
|
||||
} else {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM o = scm_vector_ref($input,scm_from_ulong(0));
|
||||
$1 = CHECK(o) ? 1 : 0;
|
||||
}
|
||||
|
|
@ -344,7 +341,6 @@ namespace std {
|
|||
$1 = 1;
|
||||
} else if (scm_is_pair($input)) {
|
||||
/* check the first element only */
|
||||
T* x;
|
||||
SCM head = SCM_CAR($input);
|
||||
$1 = CHECK(head) ? 1 : 0;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
/* Pointers */
|
||||
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "";
|
||||
%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "";
|
||||
|
||||
%typemap(in) void * {
|
||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0);
|
||||
|
|
@ -24,6 +24,10 @@
|
|||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE && {
|
||||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE [] {
|
||||
scm_wrong_type_arg((char *) FUNC_NAME, 1, $input);
|
||||
}
|
||||
|
|
@ -41,7 +45,7 @@
|
|||
$1 = SWIG_MustGetPtr($input, NULL, 1, 0);
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, $owner);
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +62,10 @@
|
|||
$result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE && {
|
||||
$result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE {
|
||||
$<ype temp = new $ltype($1);
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
|
|
@ -71,6 +79,12 @@
|
|||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE && {
|
||||
scm_throw(gh_symbol2scm((char *) "swig-exception"),
|
||||
gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1),
|
||||
SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE * {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_listify(SWIG_NewPointerObj($1, $descriptor, 1),
|
||||
|
|
@ -430,7 +444,7 @@ typedef unsigned long SCM;
|
|||
$1 = scm_is_string($input) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
|
|
@ -450,6 +464,7 @@ typedef unsigned long SCM;
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes that proxy
|
||||
* method calls from C++ to Java extensions.
|
||||
* This file contains support for director classes so that Java proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(DEBUG_DIRECTOR_OWNED)
|
||||
#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
/* Java object wrapper */
|
||||
class JObjectWrapper {
|
||||
public:
|
||||
|
|
@ -74,8 +75,7 @@ namespace Swig {
|
|||
}
|
||||
|
||||
/* Java proxy releases ownership of C++ object, C++ object is now
|
||||
responsible for destruction (creates NewGlobalRef to pin Java
|
||||
proxy) */
|
||||
responsible for destruction (creates NewGlobalRef to pin Java proxy) */
|
||||
void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) {
|
||||
if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */
|
||||
if (!weak_global_) {
|
||||
|
|
@ -83,7 +83,8 @@ namespace Swig {
|
|||
jthis_ = jenv->NewWeakGlobalRef(jself);
|
||||
weak_global_ = true;
|
||||
}
|
||||
} else { /* Java releases ownership of C++ object's lifetime */
|
||||
} else {
|
||||
/* Java releases ownership of C++ object's lifetime */
|
||||
if (weak_global_) {
|
||||
jenv->DeleteWeakGlobalRef((jweak)jthis_);
|
||||
jthis_ = jenv->NewGlobalRef(jself);
|
||||
|
|
@ -123,7 +124,7 @@ namespace Swig {
|
|||
#endif
|
||||
env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2);
|
||||
#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON)
|
||||
// Attach a daemon thread to the JVM. Useful when the JVM should not wait for
|
||||
// Attach a daemon thread to the JVM. Useful when the JVM should not wait for
|
||||
// the thread to exit upon shutdown. Only for jdk-1.4 and later.
|
||||
director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL);
|
||||
#else
|
||||
|
|
@ -191,8 +192,193 @@ namespace Swig {
|
|||
swig_self_.java_change_ownership(jenv, jself, take_or_release);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Utility classes and functions for exception handling.
|
||||
|
||||
// Simple holder for a Java string during exception handling, providing access to a c-style string
|
||||
class JavaString {
|
||||
public:
|
||||
JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) {
|
||||
if (jenv_ && jstr_)
|
||||
cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL);
|
||||
}
|
||||
|
||||
~JavaString() {
|
||||
if (jenv_ && jstr_ && cstr_)
|
||||
jenv_->ReleaseStringUTFChars(jstr_, cstr_);
|
||||
}
|
||||
|
||||
const char *c_str(const char *null_string = "null JavaString") const {
|
||||
return cstr_ ? cstr_ : null_string;
|
||||
}
|
||||
|
||||
private:
|
||||
// non-copyable
|
||||
JavaString(const JavaString &);
|
||||
JavaString &operator=(const JavaString &);
|
||||
|
||||
JNIEnv *jenv_;
|
||||
jstring jstr_;
|
||||
const char *cstr_;
|
||||
};
|
||||
|
||||
// Helper class to extract the exception message from a Java throwable
|
||||
class JavaExceptionMessage {
|
||||
public:
|
||||
JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) {
|
||||
}
|
||||
|
||||
const char *message() const {
|
||||
return message_.c_str("Could not get exception message in JavaExceptionMessage");
|
||||
}
|
||||
|
||||
private:
|
||||
// non-copyable
|
||||
JavaExceptionMessage(const JavaExceptionMessage &);
|
||||
JavaExceptionMessage &operator=(const JavaExceptionMessage &);
|
||||
|
||||
// Get exception message by calling Java method Throwable.getMessage()
|
||||
static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) {
|
||||
jstring jmsg = NULL;
|
||||
if (jenv && throwable) {
|
||||
jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
|
||||
jclass throwclz = jenv->GetObjectClass(throwable);
|
||||
if (throwclz) {
|
||||
// All Throwable classes have a getMessage() method, so call it to extract the exception message
|
||||
jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;");
|
||||
if (getMessageMethodID)
|
||||
jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID);
|
||||
}
|
||||
if (jmsg == NULL && jenv->ExceptionCheck())
|
||||
jenv->ExceptionClear();
|
||||
}
|
||||
return jmsg;
|
||||
}
|
||||
|
||||
JavaString message_;
|
||||
};
|
||||
|
||||
// C++ Exception class for handling Java exceptions thrown during a director method Java upcall
|
||||
class DirectorException : public std::exception {
|
||||
public:
|
||||
|
||||
// Construct exception from a Java throwable
|
||||
DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) {
|
||||
|
||||
// Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/')
|
||||
if (throwable) {
|
||||
jclass throwclz = jenv->GetObjectClass(throwable);
|
||||
if (throwclz) {
|
||||
jclass clzclz = jenv->GetObjectClass(throwclz);
|
||||
if (clzclz) {
|
||||
jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;");
|
||||
if (getNameMethodID) {
|
||||
jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID));
|
||||
// Copy strings, since there is no guarantee that jenv will be active when handled
|
||||
if (jstr_classname) {
|
||||
JavaString jsclassname(jenv, jstr_classname);
|
||||
const char *classname = jsclassname.c_str(0);
|
||||
if (classname)
|
||||
classname_ = copypath(classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JavaExceptionMessage exceptionmsg(jenv, throwable);
|
||||
msg_ = copystr(exceptionmsg.message());
|
||||
}
|
||||
|
||||
// More general constructor for handling as a java.lang.RuntimeException
|
||||
DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) {
|
||||
}
|
||||
|
||||
~DirectorException() throw() {
|
||||
delete[] classname_;
|
||||
delete[] msg_;
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return msg_;
|
||||
}
|
||||
|
||||
// Reconstruct and raise/throw the Java Exception that caused the DirectorException
|
||||
// Note that any error in the JNI exception handling results in a Java RuntimeException
|
||||
void raiseJavaException(JNIEnv *jenv) const {
|
||||
if (jenv) {
|
||||
jenv->ExceptionClear();
|
||||
|
||||
jmethodID ctorMethodID = 0;
|
||||
jclass throwableclass = 0;
|
||||
if (classname_) {
|
||||
throwableclass = jenv->FindClass(classname_);
|
||||
if (throwableclass)
|
||||
ctorMethodID = jenv->GetMethodID(throwableclass, "<init>", "(Ljava/lang/String;)V");
|
||||
}
|
||||
|
||||
if (ctorMethodID) {
|
||||
jenv->ThrowNew(throwableclass, what());
|
||||
} else {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static char *copypath(const char *srcmsg) {
|
||||
char *target = copystr(srcmsg);
|
||||
for (char *c=target; *c; ++c) {
|
||||
if ('.' == *c)
|
||||
*c = '/';
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
static char *copystr(const char *srcmsg) {
|
||||
char *target = 0;
|
||||
if (srcmsg) {
|
||||
int msglen = strlen(srcmsg) + 1;
|
||||
target = new char[msglen];
|
||||
strncpy(target, srcmsg, msglen);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
const char *classname_;
|
||||
const char *msg_;
|
||||
};
|
||||
|
||||
// Helper method to determine if a Java throwable matches a particular Java class type
|
||||
bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) {
|
||||
bool matches = false;
|
||||
|
||||
if (throwable && jenv && classname) {
|
||||
// Exceptions need to be cleared for correct behavior.
|
||||
// The caller of ExceptionMatches should restore pending exceptions if desired -
|
||||
// the caller already has the throwable.
|
||||
jenv->ExceptionClear();
|
||||
|
||||
jclass clz = jenv->FindClass(classname);
|
||||
if (clz) {
|
||||
jclass classclz = jenv->GetObjectClass(clz);
|
||||
jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z");
|
||||
if (isInstanceMethodID) {
|
||||
matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DEBUG_DIRECTOR_EXCEPTION)
|
||||
if (jenv->ExceptionCheck()) {
|
||||
// Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException
|
||||
JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred());
|
||||
std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
/* Pack binary data into a string */
|
||||
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
register const unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
const unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register unsigned char uu = *u;
|
||||
unsigned char uu = *u;
|
||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||
*(c++) = hex[uu & 0xf];
|
||||
}
|
||||
|
|
@ -30,11 +30,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|||
%fragment("SWIG_UnPackData", "header") {
|
||||
/* Unpack binary data from a string */
|
||||
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
register unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
unsigned char *u = (unsigned char *) ptr;
|
||||
const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register char d = *(c++);
|
||||
register unsigned char uu;
|
||||
char d = *(c++);
|
||||
unsigned char uu;
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
uu = ((d - '0') << 4);
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
|
|
@ -185,6 +185,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(jtype) SWIGTYPE & "long"
|
||||
%typemap(jstype) SWIGTYPE & "$javaclassname"
|
||||
|
||||
%typemap(jni) SWIGTYPE && "jlong"
|
||||
%typemap(jtype) SWIGTYPE && "long"
|
||||
%typemap(jstype) SWIGTYPE && "$javaclassname"
|
||||
|
||||
/* pointer to a class member */
|
||||
%typemap(jni) SWIGTYPE (CLASS::*) "jstring"
|
||||
%typemap(jtype) SWIGTYPE (CLASS::*) "String"
|
||||
|
|
@ -649,6 +653,11 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
|
||||
if (!$1) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE *
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) {
|
||||
|
|
@ -659,6 +668,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
}
|
||||
%typemap(out) SWIGTYPE &
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(out) SWIGTYPE &&
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *
|
||||
%{ $result = *($&1_ltype)&$input; %}
|
||||
|
|
@ -671,6 +682,12 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
|
||||
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
|
||||
%{ if (!$input) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type");
|
||||
return $null;
|
||||
}
|
||||
$result = *($&1_ltype)&$input; %}
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &&
|
||||
%{ if (!$input) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type");
|
||||
return $null;
|
||||
|
|
@ -678,10 +695,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
$result = *($&1_ltype)&$input; %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE &
|
||||
%{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE &&
|
||||
%{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
|
||||
|
||||
%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($jniinput == 0) ? null : new $javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorin) SWIGTYPE & "new $javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$javaclassname.getCPtr($javacall)"
|
||||
%typemap(javadirectorin) SWIGTYPE && "new $javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$javaclassname.getCPtr($javacall)"
|
||||
|
||||
/* Default array handling */
|
||||
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
|
||||
|
|
@ -959,6 +979,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE *const&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
|
|
@ -978,7 +999,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg);
|
||||
return $null; %}
|
||||
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY]
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY]
|
||||
%{ (void)$1;
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
|
||||
return $null; %}
|
||||
|
|
@ -1029,7 +1050,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
jobjectArray
|
||||
"$javainput"
|
||||
%typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)"
|
||||
%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)"
|
||||
%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)"
|
||||
%typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)"
|
||||
|
||||
/* The javaout typemap is used for converting function return types from the return type
|
||||
|
|
@ -1083,6 +1104,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(javaout) SWIGTYPE & {
|
||||
return new $javaclassname($jnicall, $owner);
|
||||
}
|
||||
%typemap(javaout) SWIGTYPE && {
|
||||
return new $javaclassname($jnicall, $owner);
|
||||
}
|
||||
%typemap(javaout) SWIGTYPE *, SWIGTYPE [] {
|
||||
long cPtr = $jnicall;
|
||||
return (cPtr == 0) ? null : new $javaclassname(cPtr, $owner);
|
||||
|
|
@ -1108,11 +1132,11 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%{ *($1_ltype)&$result = *$1; %}
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
|
||||
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
|
||||
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
|
||||
/* javabody typemaps */
|
||||
|
||||
|
|
@ -1151,7 +1175,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
%define SWIG_JAVABODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Typewrapper classes
|
||||
%typemap(javabody) TYPE *, TYPE &, TYPE [] %{
|
||||
%typemap(javabody) TYPE *, TYPE &, TYPE &&, TYPE [] %{
|
||||
private long swigCPtr;
|
||||
|
||||
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean futureUse) {
|
||||
|
|
@ -1290,6 +1314,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
27
Lib/java/std_auto_ptr.i
Normal file
27
Lib/java/std_auto_ptr.i
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 {};
|
||||
}
|
||||
|
|
@ -38,7 +38,9 @@ class string;
|
|||
|
||||
%typemap(directorout) string
|
||||
%{ if(!$input) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
|
||||
if (!jenv->ExceptionCheck()) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
|
||||
}
|
||||
return $null;
|
||||
}
|
||||
const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
%typemap(freearg) char **STRING_ARRAY {
|
||||
int i;
|
||||
for (i=0; i<size$argnum-1; i++)
|
||||
for (i=0; i<size$argnum; i++)
|
||||
#ifdef __cplusplus
|
||||
delete[] $1[i];
|
||||
delete[] $1;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
* includes
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <luatypemaps.swg> /* The typemaps */
|
||||
%include <luatypemaps.swg> /* The typemaps */
|
||||
%include <luaruntime.swg> /* The runtime stuff */
|
||||
%include <luakw.swg> /* Warnings for Lua keywords */
|
||||
|
||||
//%include <typemaps/swigmacros.swg>
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -40,12 +41,12 @@
|
|||
%typemap(consttab) long long, unsigned long long
|
||||
{SWIG_LUA_CONSTTAB_STRING("$symname", "$value")}
|
||||
|
||||
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
|
||||
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
|
||||
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE []
|
||||
{ SWIG_LUA_CONSTTAB_POINTER("$symname",$value, $1_descriptor) }
|
||||
|
||||
// member function pointers
|
||||
%typemap(consttab) SWIGTYPE (CLASS::*)
|
||||
{ SWIG_LUA_BINARY, (char *)"$symname", sizeof($type), 0, (void *)&$value, &$1_descriptor}
|
||||
{ SWIG_LUA_CONSTTAB_BINARY("$symname", sizeof($type),&$value, $1_descriptor) }
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
67
Lib/lua/luakw.swg
Normal file
67
Lib/lua/luakw.swg
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Warnings for Lua keywords, built-in names and bad names.
|
||||
*/
|
||||
|
||||
#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword, renaming to 'c_" `x` "'", rename="c_%s") `x`
|
||||
#define LUABN(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "'" `x` "' conflicts with a basic function in Lua"), %$not %$ismember) `x`
|
||||
|
||||
/*
|
||||
Warnings for Lua keywords
|
||||
http://www.lua.org/manual/5.2/manual.html#3.1
|
||||
*/
|
||||
|
||||
LUAKW(and);
|
||||
LUAKW(break);
|
||||
LUAKW(do);
|
||||
LUAKW(else);
|
||||
LUAKW(elseif);
|
||||
LUAKW(end);
|
||||
LUAKW(false);
|
||||
LUAKW(for);
|
||||
LUAKW(function);
|
||||
LUAKW(goto);
|
||||
LUAKW(if);
|
||||
LUAKW(in);
|
||||
LUAKW(local);
|
||||
LUAKW(nil);
|
||||
LUAKW(not);
|
||||
LUAKW(or);
|
||||
LUAKW(repeat);
|
||||
LUAKW(return);
|
||||
LUAKW(then);
|
||||
LUAKW(true);
|
||||
LUAKW(until);
|
||||
LUAKW(while);
|
||||
|
||||
/*
|
||||
Basic functions
|
||||
http://www.lua.org/manual/5.2/manual.html#6.1
|
||||
*/
|
||||
|
||||
LUABN(assert);
|
||||
LUABN(collectgarbage);
|
||||
LUABN(dofile);
|
||||
LUABN(error);
|
||||
LUABN(_G); // Not actually a function
|
||||
LUABN(getmetatable);
|
||||
LUABN(ipairs);
|
||||
LUABN(load);
|
||||
LUABN(loadfile);
|
||||
LUABN(next);
|
||||
LUABN(pairs);
|
||||
LUABN(pcall);
|
||||
LUABN(print);
|
||||
LUABN(rawequal);
|
||||
LUABN(rawget);
|
||||
LUABN(rawlen);
|
||||
LUABN(rawset);
|
||||
LUABN(select);
|
||||
LUABN(setmetatable);
|
||||
LUABN(tonumber);
|
||||
LUABN(tostring);
|
||||
LUABN(type);
|
||||
LUABN(_VERSION); // Not actually a function
|
||||
LUABN(xpcall);
|
||||
|
||||
#undef LUABN
|
||||
#undef LUAKW
|
||||
1217
Lib/lua/luarun.swg
1217
Lib/lua/luarun.swg
File diff suppressed because it is too large
Load diff
|
|
@ -31,25 +31,15 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|||
int i;
|
||||
/* start with global table */
|
||||
lua_pushglobaltable (L);
|
||||
/* SWIG's internal initalisation */
|
||||
/* SWIG's internal initialisation */
|
||||
SWIG_InitializeModule((void*)L);
|
||||
SWIG_PropagateClientData();
|
||||
#endif
|
||||
|
||||
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
||||
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
|
||||
/* add a global fn */
|
||||
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
||||
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
||||
/* begin the module (its a table with the same name as the module) */
|
||||
SWIG_Lua_module_begin(L,SWIG_name);
|
||||
/* add commands/functions */
|
||||
for (i = 0; swig_commands[i].name; i++){
|
||||
SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
|
||||
}
|
||||
/* add variables */
|
||||
for (i = 0; swig_variables[i].name; i++){
|
||||
SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
||||
|
|
@ -59,17 +49,35 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|||
SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
||||
}
|
||||
}
|
||||
/* additional registration structs & classes in lua */
|
||||
int globalRegister = 0;
|
||||
#ifdef SWIG_LUA_MODULE_GLOBAL
|
||||
globalRegister = 1;
|
||||
#endif
|
||||
|
||||
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
||||
SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister);
|
||||
#endif
|
||||
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
||||
for (i = 0; swig_types[i]; i++){
|
||||
if (swig_types[i]->clientdata){
|
||||
SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
||||
SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
||||
/* constants */
|
||||
SWIG_Lua_InstallConstants(L,swig_constants);
|
||||
#if defined(SWIG_LUA_ELUA_EMULATE)
|
||||
lua_newtable(L);
|
||||
SWIG_Lua_elua_emulate_register(L,swig___Module.ns_methods);
|
||||
SWIG_Lua_elua_emulate_register_clear(L);
|
||||
if(globalRegister) {
|
||||
lua_pushstring(L,swig___Module.name);
|
||||
lua_pushvalue(L,-2);
|
||||
lua_rawset(L,-4);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
||||
|
|
|
|||
|
|
@ -68,8 +68,12 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
|
|||
// and const refs
|
||||
%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &($basetype temp)
|
||||
%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%}
|
||||
%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &&($basetype temp)
|
||||
%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%}
|
||||
%typemap(out) const enum SWIGTYPE &
|
||||
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
|
||||
%typemap(out) const enum SWIGTYPE &&
|
||||
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
|
||||
|
||||
|
||||
// boolean (which is a special type in lua)
|
||||
|
|
@ -147,9 +151,18 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE&&
|
||||
%{
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,$input,(void**)&$1,$descriptor,$disown))){
|
||||
SWIG_fail_ptr("$symname",$argnum,$descriptor);
|
||||
}
|
||||
%}
|
||||
|
||||
// out is simple
|
||||
%typemap(out) SWIGTYPE*,SWIGTYPE&
|
||||
%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %}
|
||||
%typemap(out) SWIGTYPE*,SWIGTYPE&&
|
||||
%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %}
|
||||
|
||||
// dynamic casts
|
||||
// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is
|
||||
|
|
@ -284,7 +297,7 @@ parameters match which function
|
|||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const signed char&, const unsigned char&,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE, const enum SWIGTYPE&,
|
||||
enum SWIGTYPE, const enum SWIGTYPE&, const enum SWIGTYPE &&,
|
||||
float, double, const float &, const double&
|
||||
{
|
||||
$1 = lua_isnumber(L,$input);
|
||||
|
|
@ -323,6 +336,15 @@ parameters match which function
|
|||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && {
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
|
||||
$1 = 0;
|
||||
} else {
|
||||
$1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
||||
void *ptr;
|
||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) {
|
||||
|
|
@ -360,6 +382,7 @@ parameters match which function
|
|||
|
||||
// Array reference typemaps
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ wchar_t* str2wstr(const char *str, int len)
|
|||
{
|
||||
wchar_t* p;
|
||||
if (str==0 || len<1) return 0;
|
||||
p=(wchar *)malloc((len+1)*sizeof(wchar_t));
|
||||
p=(wchar_t *)malloc((len+1)*sizeof(wchar_t));
|
||||
if (p==0) return 0;
|
||||
if (mbstowcs(p, str, len)==-1)
|
||||
if (mbstowcs(p, str, len)==(size_t)-1)
|
||||
{
|
||||
free(p);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -344,6 +344,23 @@
|
|||
%typemap(m3wrapouttype) SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
|
||||
%typemap(ctype) SWIGTYPE && "$1_type"
|
||||
%typemap(m3rawtype) const SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawtype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawintype) const SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3rawinmode) const SWIGTYPE && "READONLY"
|
||||
%typemap(m3rawintype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3rawinmode) SWIGTYPE && "VAR"
|
||||
%typemap(m3rawrettype) const SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapintype) const SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapinmode) const SWIGTYPE && "READONLY"
|
||||
%typemap(m3wrapintype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapinmode) SWIGTYPE && "VAR"
|
||||
%typemap(m3wrapouttype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
|
||||
%typemap(ctype) enum SWIGTYPE "$1_type"
|
||||
%typemap(m3rawtype) enum SWIGTYPE "C.int"
|
||||
%typemap(m3rawintype) enum SWIGTYPE "C.int (* $1_type *)"
|
||||
|
|
@ -468,7 +485,12 @@ $1 = &temp; %}
|
|||
//SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
RETURN $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
|
||||
%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
|
||||
if(!$1) {
|
||||
//SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
RETURN $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
|
||||
/* Default array handling */
|
||||
|
|
@ -552,6 +574,7 @@ $1 = &temp; %}
|
|||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
|
@ -605,7 +628,7 @@ $1 = &temp; %}
|
|||
enum SWIGTYPE
|
||||
"$input"
|
||||
%typemap(m3in) SWIGTYPE "$&*1_type.getCPtr($input)"
|
||||
%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)"
|
||||
%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)"
|
||||
|
||||
/* The m3out typemap is used for converting function return types from the return type
|
||||
* used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */
|
||||
|
|
@ -636,13 +659,16 @@ $1 = &temp; %}
|
|||
%typemap(m3out) SWIGTYPE & %{
|
||||
RETURN NEW($1_basetype, $imcall, $owner);
|
||||
%}
|
||||
%typemap(m3out) SWIGTYPE && %{
|
||||
RETURN NEW($1_basetype, $imcall, $owner);
|
||||
%}
|
||||
%typemap(m3out) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
cPtr := $imcall;
|
||||
RETURN (cPtr = IntPtr.Zero) ? null : NEW($1_basetype, cPtr, $owner);
|
||||
%}
|
||||
|
||||
/* Properties */
|
||||
%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
PROCEDURE Set$var (value: $vartype) =
|
||||
BEGIN
|
||||
$imcall;
|
||||
|
|
@ -684,6 +710,10 @@ PROCEDURE Get$var (): $vartype =
|
|||
get {
|
||||
RETURN new $1_basetype($imcall, $owner);
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE && %{
|
||||
get {
|
||||
RETURN new $1_basetype($imcall, $owner);
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
|
|
@ -691,13 +721,13 @@ PROCEDURE Get$var (): $vartype =
|
|||
} %}
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||
%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||
%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||
%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||
%typemap(m3interfaces) SWIGTYPE "IDisposable"
|
||||
%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||
%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||
|
||||
%typemap(m3finalize) SWIGTYPE %{
|
||||
~$1_basetype() {
|
||||
|
|
@ -724,7 +754,7 @@ PROCEDURE Get$var (): $vartype =
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
internal static IntPtr getCPtr($1_basetype obj) {
|
||||
RETURN (obj == null) ? IntPtr.Zero : obj.swigCPtr;
|
||||
}
|
||||
|
|
@ -748,6 +778,7 @@ FROM BlaBla IMPORT Bla;
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE && {
|
||||
$1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE [ANY] {
|
||||
void *temp;
|
||||
int ii;
|
||||
|
|
@ -54,16 +58,20 @@
|
|||
$result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE && {
|
||||
$result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
/* C++ References */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
%typemap(in) SWIGTYPE &, const SWIGTYPE & {
|
||||
%typemap(in) SWIGTYPE &, SWIGTYPE && {
|
||||
$1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)");
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE &, const SWIGTYPE & {
|
||||
%typemap(out) SWIGTYPE &, SWIGTYPE && {
|
||||
$result = SWIG_NewPointerObj ($1, $descriptor, $owner);
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +329,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
|||
$1 = (SCHEME_STRINGP($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0)) {
|
||||
$1 = 0;
|
||||
|
|
@ -351,6 +359,7 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -1,45 +1,47 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes that proxy
|
||||
* method calls from C++ to Ocaml extensions.
|
||||
*
|
||||
* This file contains support for director classes so that Ocaml proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
|
||||
|
||||
namespace Swig {
|
||||
/* base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
public:
|
||||
DirectorException(const char* msg="") {
|
||||
}
|
||||
const char *getMessage() const {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
virtual ~DirectorException() {}
|
||||
};
|
||||
|
||||
/* type mismatch in the return value from a python method call */
|
||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||
public:
|
||||
DirectorTypeMismatchException(const char* msg="") {
|
||||
DirectorException(const char *msg="") : swig_msg(msg) {
|
||||
}
|
||||
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
/* any python exception that occurs during a director method call */
|
||||
class DirectorMethodException : public Swig::DirectorException {};
|
||||
/* type mismatch in the return value from a Ocaml method call */
|
||||
class DirectorTypeMismatchException : public DirectorException {
|
||||
public:
|
||||
DirectorTypeMismatchException(const char *msg="") : DirectorException(msg) {
|
||||
}
|
||||
};
|
||||
|
||||
/* any Ocaml exception that occurs during a director method call */
|
||||
class DirectorMethodException : public DirectorException {};
|
||||
|
||||
/* attempt to call a pure virtual method via a director method */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException {
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg="") {
|
||||
DirectorPureVirtualException(const char *msg="") : DirectorException(msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg) {
|
||||
|
|
@ -57,7 +59,7 @@ namespace Swig {
|
|||
#define MUTEX_INIT(var) CRITICAL_SECTION var
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER
|
||||
#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -78,25 +80,22 @@ namespace Swig {
|
|||
/* discard our reference at destruction */
|
||||
virtual ~Director() {
|
||||
remove_global_root(&swig_self);
|
||||
swig_disown();
|
||||
// Disown is safe here because we're just divorcing a reference that
|
||||
// points to us.
|
||||
swig_disown();
|
||||
// Disown is safe here because we're just divorcing a reference that points to us.
|
||||
}
|
||||
|
||||
/* return a pointer to the wrapped ocaml object */
|
||||
CAML_VALUE swig_get_self() const {
|
||||
CAML_VALUE swig_get_self() const {
|
||||
return swig_self;
|
||||
}
|
||||
|
||||
/* acquire ownership of the wrapped ocaml object (the sense of "disown"
|
||||
* is from ocaml) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
/* acquire ownership of the wrapped ocaml object (the sense of "disown" is from ocaml) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
swig_disown_flag=true;
|
||||
callback(*caml_named_value("caml_obj_disown"),swig_self);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
$1 = !caml_ptr_val_internal($input, &ptr,$descriptor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,21 @@
|
|||
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
|
||||
}
|
||||
|
||||
%typemap(in) SWIGTYPE && {
|
||||
/* %typemap(in) SWIGTYPE && */
|
||||
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE & {
|
||||
/* %typemap(varin) SWIGTYPE & */
|
||||
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE && {
|
||||
/* %typemap(varin) SWIGTYPE && */
|
||||
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE & {
|
||||
/* %typemap(out) SWIGTYPE & */
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
|
|
@ -49,6 +59,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE && {
|
||||
/* %typemap(out) SWIGTYPE && */
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
if( fromval ) {
|
||||
$result = callback(*fromval,caml_val_ptr((void *) &$1,$1_descriptor));
|
||||
} else {
|
||||
$result = caml_val_ptr ((void *) &$1,$1_descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
%typemap(argout) SWIGTYPE & {
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
|
|
@ -63,9 +83,23 @@
|
|||
caml_val_ptr ((void *) $1,$1_descriptor));
|
||||
}
|
||||
}
|
||||
%typemap(argout) SWIGTYPE && {
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
if( fromval ) {
|
||||
swig_result =
|
||||
caml_list_append(swig_result,
|
||||
callback(*fromval,caml_val_ptr((void *) $1,
|
||||
$1_descriptor)));
|
||||
} else {
|
||||
swig_result =
|
||||
caml_list_append(swig_result,
|
||||
caml_val_ptr ((void *) $1,$1_descriptor));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(argout) const SWIGTYPE & { }
|
||||
%typemap(argout) const SWIGTYPE && { }
|
||||
|
||||
%typemap(in) SWIGTYPE {
|
||||
$1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
|
||||
|
|
@ -112,6 +146,7 @@
|
|||
}
|
||||
|
||||
%apply SWIGTYPE { const SWIGTYPE & };
|
||||
%apply SWIGTYPE { const SWIGTYPE && };
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -329,6 +364,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes so that D proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
class Director {
|
||||
|
|
@ -62,7 +70,7 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
SWIGINTERN rtdir_map* get_rtdir_map() {
|
||||
SWIGINTERN rtdir_map *get_rtdir_map() {
|
||||
static swig_module_info *module = 0;
|
||||
if (!module)
|
||||
module = SWIG_GetModule(0);
|
||||
|
|
@ -74,19 +82,19 @@ namespace Swig {
|
|||
}
|
||||
|
||||
SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) {
|
||||
rtdir_map* rm = get_rtdir_map();
|
||||
rtdir_map *rm = get_rtdir_map();
|
||||
if (rm)
|
||||
(*rm)[vptr] = d;
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE void erase_rtdir(void *vptr) {
|
||||
rtdir_map* rm = get_rtdir_map();
|
||||
rtdir_map *rm = get_rtdir_map();
|
||||
if (rm)
|
||||
(*rm).erase(vptr);
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
|
||||
rtdir_map* rm = get_rtdir_map();
|
||||
rtdir_map *rm = get_rtdir_map();
|
||||
if (!rm)
|
||||
return 0;
|
||||
rtdir_map::const_iterator pos = rm->find(vptr);
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@
|
|||
|
||||
// The Octave C++ Wrap
|
||||
|
||||
%insert(header) %{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%include <std_except.i>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,88 @@
|
|||
|
||||
#include <octave/version.h>
|
||||
#ifndef OCTAVE_API_VERSION_NUMBER
|
||||
|
||||
// Hack to distinguish between Octave 3.2 and earlier versions before OCTAVE_API_VERSION_NUMBER existed
|
||||
#define ComplexLU __ignore
|
||||
#include <octave/CmplxLU.h>
|
||||
#undef ComplexLU
|
||||
#ifdef octave_Complex_LU_h
|
||||
# define OCTAVE_API_VERSION_NUMBER 36
|
||||
#else
|
||||
# define OCTAVE_API_VERSION_NUMBER 37
|
||||
#endif
|
||||
// Macro for enabling features which require Octave version >= major.minor.patch
|
||||
#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
|
||||
( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + OCTAVE_PATCH_VERSION >= ((major)<<16) + ((minor)<<8) + (patch) )
|
||||
|
||||
#endif
|
||||
// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1
|
||||
#if !defined(OCTAVE_MAJOR_VERSION)
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER < 37
|
||||
# if !defined(OCTAVE_API_VERSION_NUMBER)
|
||||
|
||||
// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet
|
||||
// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER
|
||||
# include <octave/ov.h>
|
||||
# if defined(octave_ov_h)
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 8
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
# else
|
||||
|
||||
// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
|
||||
# define ComplexLU __ignore
|
||||
# include <octave/CmplxLU.h>
|
||||
# undef ComplexLU
|
||||
# if defined(octave_Complex_LU_h)
|
||||
|
||||
// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 1
|
||||
# define OCTAVE_PATCH_VERSION 99
|
||||
|
||||
# else
|
||||
|
||||
// OCTAVE_API_VERSION_NUMBER == 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 2
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# endif // defined(octave_Complex_LU_h)
|
||||
|
||||
# endif // defined(octave_ov_h)
|
||||
|
||||
// Correlation between Octave API and version numbers extracted from Octave's
|
||||
// ChangeLogs; version is the *earliest* released Octave with that API number
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 48
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 6
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 45
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 4
|
||||
# define OCTAVE_PATCH_VERSION 1
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 42
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 54
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 41
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 53
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 40
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 52
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 39
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 51
|
||||
|
||||
# else // OCTAVE_API_VERSION_NUMBER == 38
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 50
|
||||
|
||||
# endif // !defined(OCTAVE_API_VERSION_NUMBER)
|
||||
|
||||
#endif // !defined(OCTAVE_MAJOR_VERSION)
|
||||
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
#define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, FS ## cname, args, nargout, doc)
|
||||
#else
|
||||
#define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, G ## cname, args, nargout, doc)
|
||||
|
|
@ -427,7 +495,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
if (error_state) return dim_vector(1,1);
|
||||
}
|
||||
return d;
|
||||
} else if (out.is_matrix_type() || out.is_real_nd_array() || out.is_numeric_type() ) {
|
||||
} else if (out.is_matrix_type() || out.is_numeric_type() ) {
|
||||
if (out.rows()==1 || out.columns()==1) {
|
||||
Array<int> a = out.int_vector_value();
|
||||
if (error_state) return dim_vector(1,1);
|
||||
|
|
@ -746,7 +814,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
return outarg(0).string_value();
|
||||
}
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER >= 40
|
||||
#if SWIG_OCTAVE_PREREQ(3,3,52)
|
||||
virtual octave_map map_value() const {
|
||||
return octave_map();
|
||||
}
|
||||
|
|
@ -982,7 +1050,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
virtual std::string string_value(bool force = false) const
|
||||
{ return ptr->string_value(force); }
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER >= 40
|
||||
#if SWIG_OCTAVE_PREREQ(3,3,52)
|
||||
virtual octave_map map_value() const
|
||||
{ return ptr->map_value(); }
|
||||
#else
|
||||
|
|
@ -1103,7 +1171,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
DEFINE_OCTAVE_ALLOCATOR(octave_swig_packed);
|
||||
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_packed, "swig_packed", "swig_packed");
|
||||
|
||||
static octave_value_list octave_set_immutable(const octave_value_list &args, int nargout) {
|
||||
SWIGRUNTIME octave_value_list octave_set_immutable(const octave_value_list &args, int nargout) {
|
||||
error("attempt to set immutable member variable");
|
||||
return octave_value_list();
|
||||
}
|
||||
|
|
@ -1293,10 +1361,12 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value
|
|||
}
|
||||
|
||||
SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
|
||||
#if OCTAVE_API_VERSION_NUMBER < 37
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
link_to_global_variable(curr_sym_tab->lookup(name, true));
|
||||
#else
|
||||
#if !SWIG_OCTAVE_PREREQ(3,8,0)
|
||||
symbol_table::varref(name);
|
||||
#endif
|
||||
symbol_table::mark_global(name);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static bool SWIG_init_user(octave_swig_type* module_ns);
|
|||
SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
||||
bool retn;
|
||||
{
|
||||
#if OCTAVE_API_VERSION_NUMBER < 38
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::begin_frame("SWIG_Octave_LoadModule");
|
||||
unwind_protect_int(error_state);
|
||||
unwind_protect_int(warning_state);
|
||||
|
|
@ -44,7 +44,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
|||
discard_warning_messages = true;
|
||||
feval(name, octave_value_list(), 0);
|
||||
retn = (error_state == 0);
|
||||
#if OCTAVE_API_VERSION_NUMBER < 38
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::run_frame("SWIG_Octave_LoadModule");
|
||||
#endif
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
|||
SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
|
||||
bool retn;
|
||||
{
|
||||
#if OCTAVE_API_VERSION_NUMBER < 38
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::begin_frame("SWIG_Octave_InstallFunction");
|
||||
unwind_protect_int(error_state);
|
||||
unwind_protect_int(warning_state);
|
||||
|
|
@ -80,7 +80,7 @@ SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::st
|
|||
error_state = 0;
|
||||
feval("autoload", args, 0);
|
||||
retn = (error_state == 0);
|
||||
#if OCTAVE_API_VERSION_NUMBER < 38
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::run_frame("SWIG_Octave_InstallFunction");
|
||||
#endif
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
// definitely affects version 3.2.*, not sure about 3.3.*, seems to be fixed in
|
||||
// version 3.4.* and above. can be turned off with macro definition.
|
||||
#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
|
||||
#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45
|
||||
#if SWIG_OCTAVE_PREREQ(3,2,0) && !SWIG_OCTAVE_PREREQ(3,4,1)
|
||||
octave_exit = ::_Exit;
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -212,7 +212,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
|
||||
// workaround bug in octave where installing global variable of custom type and then
|
||||
// exiting without explicitly clearing the variable causes octave to segfault.
|
||||
#if OCTAVE_API_VERSION_NUMBER > 36
|
||||
#if SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
octave_value_list eval_args;
|
||||
eval_args.append("base");
|
||||
eval_args.append("function __swig_atexit__; "
|
||||
|
|
@ -297,7 +297,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER < 37
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
mlock(me->name());
|
||||
#else
|
||||
mlock();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
// Include fundamental fragemt definitions
|
||||
// Include fundamental fragment definitions
|
||||
%include <typemaps/fragments.swg>
|
||||
|
||||
// Look for user fragments file.
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ SWIG = $(exec_prefix)/bin/swig
|
|||
SWIGOPT = -perl5
|
||||
SWIGCC = $(CC)
|
||||
|
||||
# SWIG Library files. Uncomment this to staticly rebuild Perl
|
||||
#SWIGLIB = -static -lperlmain.i
|
||||
# SWIG Library files. Uncomment this to statically rebuild Perl
|
||||
#SWIGLIBS = -static -lperlmain.i
|
||||
|
||||
# Rules for creating .o files from source.
|
||||
|
||||
|
|
@ -69,33 +69,21 @@ BUILD = @LDSHARED@
|
|||
#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
|
||||
-L/usr/local/lib -lg++ -lstdc++ -lgcc
|
||||
|
||||
# X11 installation (possibly needed if using Perl-Tk)
|
||||
|
||||
XLIB = @XLIBSW@
|
||||
XINCLUDE = @XINCLUDES@
|
||||
|
||||
# Perl installation
|
||||
|
||||
PERL_INCLUDE = -I@PERL5EXT@
|
||||
PERL_LIB = -L@PERL5EXT@ -lperl
|
||||
PERL_FLAGS = -Dbool=char -Dexplicit=
|
||||
|
||||
# Tcl installation. If using Tk you might need this
|
||||
|
||||
TCL_INCLUDE = @TCLINCLUDE@
|
||||
TCL_LIB = @TCLLIB@
|
||||
|
||||
# Build libraries (needed for static builds)
|
||||
|
||||
LIBM = @LIBM@
|
||||
LIBC = @LIBC@
|
||||
SYSLIBS = $(LIBM) $(LIBC) @LIBS@
|
||||
|
||||
# Build options (uncomment only one these)
|
||||
# Build options
|
||||
|
||||
#TK_LIB = $(TCL_LIB) -ltcl -ltk $(XLIB)
|
||||
BUILD_LIBS = $(LIBS) # Dynamic loading
|
||||
#BUILD_LIBS = $(PERL_LIB) $(TK_LIB) $(LIBS) $(SYSLIBS) # Static linking
|
||||
|
||||
# Compilation rules for non-SWIG components
|
||||
|
||||
|
|
@ -123,7 +111,7 @@ $(WRAPOBJ) : $(WRAPFILE)
|
|||
$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(PERL_INCLUDE) $(PERL_FLAGS) $(WRAPFILE)
|
||||
|
||||
$(WRAPFILE) : $(INTERFACE)
|
||||
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
|
||||
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIBS) $(INTERFACE)
|
||||
|
||||
$(TARGET): $(WRAPOBJ) $(ALLOBJS)
|
||||
$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)
|
||||
|
|
|
|||
318
Lib/perl5/director.swg
Normal file
318
Lib/perl5/director.swg
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes so that Perl proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SWIG_DIRECTOR_PERL_HEADER_
|
||||
#define SWIG_DIRECTOR_PERL_HEADER_
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
/*
|
||||
Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the
|
||||
native C++ RTTI and dynamic_cast<>. But be aware that directors
|
||||
could stop working when using this option.
|
||||
*/
|
||||
#ifdef SWIG_DIRECTOR_NORTTI
|
||||
/*
|
||||
When we don't use the native C++ RTTI, we implement a minimal one
|
||||
only for Directors.
|
||||
*/
|
||||
# ifndef SWIG_DIRECTOR_RTDIR
|
||||
# define SWIG_DIRECTOR_RTDIR
|
||||
|
||||
namespace Swig {
|
||||
class Director;
|
||||
SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
|
||||
static std::map<void *, Director *> rtdir_map;
|
||||
return rtdir_map;
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE void set_rtdir(void *vptr, Director *rtdir) {
|
||||
get_rtdir_map()[vptr] = rtdir;
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
|
||||
std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
|
||||
Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
|
||||
return rtdir;
|
||||
}
|
||||
}
|
||||
# endif /* SWIG_DIRECTOR_RTDIR */
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
|
||||
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
|
||||
|
||||
#else
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
|
||||
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2)
|
||||
|
||||
#endif /* SWIG_DIRECTOR_NORTTI */
|
||||
|
||||
extern "C" {
|
||||
struct swig_type_info;
|
||||
}
|
||||
|
||||
namespace Swig {
|
||||
|
||||
/* memory handler */
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {}
|
||||
|
||||
virtual int get_own() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem *operator->() const {
|
||||
return _item;
|
||||
}
|
||||
|
||||
private:
|
||||
GCItem *_item;
|
||||
};
|
||||
|
||||
struct GCItem_Object : GCItem {
|
||||
GCItem_Object(int own) : _own(own) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_Object() {
|
||||
}
|
||||
|
||||
int get_own() const {
|
||||
return _own;
|
||||
}
|
||||
|
||||
private:
|
||||
int _own;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCArray_T : GCItem {
|
||||
GCArray_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCArray_T() {
|
||||
delete[] _ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
||||
/* base class for director exceptions */
|
||||
class DirectorException : public std::exception {
|
||||
public:
|
||||
virtual SV *getNative() const = 0;
|
||||
};
|
||||
|
||||
/* exceptions emitted by Perl */
|
||||
class DirectorMethodException : public DirectorException {
|
||||
protected:
|
||||
SV *err;
|
||||
public:
|
||||
DirectorMethodException(SV *sv = sv_mortalcopy(ERRSV)) : err(sv) {
|
||||
SvREFCNT_inc(err);
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return SvPV_nolen(err);
|
||||
}
|
||||
|
||||
SV *getNative() const {
|
||||
return sv_2mortal(newSVsv(err));
|
||||
}
|
||||
|
||||
static void raise(SV *sv) {
|
||||
throw DirectorMethodException(sv);
|
||||
}
|
||||
};
|
||||
|
||||
/* exceptions emitted by wrap code */
|
||||
class DirectorWrapException : public DirectorException {
|
||||
protected:
|
||||
std::string msg;
|
||||
DirectorWrapException(const char *str) : msg(str) {
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~DirectorWrapException() throw() {
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return msg.c_str();
|
||||
}
|
||||
|
||||
virtual SV *getNative() const {
|
||||
return sv_2mortal(newSVpvn(msg.data(), msg.size()));
|
||||
}
|
||||
};
|
||||
|
||||
class DirectorTypeMismatchException : public DirectorWrapException {
|
||||
public:
|
||||
DirectorTypeMismatchException(const char *str) : DirectorWrapException(str) {
|
||||
}
|
||||
|
||||
static void raise(const char *type, const char *msg) {
|
||||
std::string err = std::string(type);
|
||||
err += ": ";
|
||||
err += msg;
|
||||
throw DirectorTypeMismatchException(err.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
class DirectorPureVirtualException : public DirectorWrapException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char *name)
|
||||
: DirectorWrapException("SWIG director pure virtual method called: ") {
|
||||
msg += name;
|
||||
}
|
||||
|
||||
static void raise(const char *name) {
|
||||
throw DirectorPureVirtualException(name);
|
||||
}
|
||||
};
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
private:
|
||||
/* pointer to the wrapped perl object */
|
||||
SV *swig_self;
|
||||
/* class of wrapped perl object */
|
||||
std::string swig_class;
|
||||
/* flag indicating whether the object is owned by perl or c++ */
|
||||
mutable bool swig_disown_flag;
|
||||
|
||||
/* decrement the reference count of the wrapped perl object */
|
||||
void swig_decref() const {
|
||||
if (swig_disown_flag) {
|
||||
SvREFCNT_dec(swig_self);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/* wrap a Perl object, optionally taking ownership */
|
||||
Director(SV *pkg) : swig_disown_flag(false) {
|
||||
STRLEN len;
|
||||
char *str = SvPV(pkg, len);
|
||||
swig_class = std::string(str, len);
|
||||
swig_self = newRV_inc((SV *)newHV());
|
||||
swig_incref();
|
||||
}
|
||||
|
||||
/* discard our reference at destruction */
|
||||
virtual ~Director() {
|
||||
swig_decref();
|
||||
}
|
||||
|
||||
/* return a pointer to the wrapped Perl object */
|
||||
SV *swig_get_self() const {
|
||||
return swig_self;
|
||||
}
|
||||
|
||||
const char *swig_get_class() const {
|
||||
return swig_class.c_str();
|
||||
}
|
||||
|
||||
/* acquire ownership of the wrapped Perl object (the sense of "disown" is from perl) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
swig_disown_flag=true;
|
||||
swig_incref();
|
||||
}
|
||||
}
|
||||
|
||||
/* increase the reference count of the wrapped Perl object */
|
||||
void swig_incref() const {
|
||||
if (swig_disown_flag) {
|
||||
SvREFCNT_inc(swig_self);
|
||||
}
|
||||
}
|
||||
|
||||
/* methods to implement pseudo protected director members */
|
||||
virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const {
|
||||
}
|
||||
|
||||
/* ownership management */
|
||||
private:
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership_array(Type *vptr) const {
|
||||
if (vptr) {
|
||||
swig_owner[vptr] = new GCArray_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership(Type *vptr) const {
|
||||
if (vptr) {
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
void swig_acquire_ownership_obj(void *vptr, int own) const {
|
||||
if (vptr && own) {
|
||||
swig_owner[vptr] = new GCItem_Object(own);
|
||||
}
|
||||
}
|
||||
|
||||
int swig_release_ownership(void *vptr) const {
|
||||
int own = 0;
|
||||
if (vptr) {
|
||||
swig_ownership_map::iterator iter = swig_owner.find(vptr);
|
||||
if (iter != swig_owner.end()) {
|
||||
own = iter->second->get_own();
|
||||
swig_owner.erase(iter);
|
||||
}
|
||||
}
|
||||
return own;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
|
||||
#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
|
||||
#define swig_owntype int
|
||||
|
||||
/* for raw packed data */
|
||||
#define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
|
||||
|
|
@ -288,7 +289,11 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
|
|||
/* Now see if the types match */
|
||||
char *_c = HvNAME(SvSTASH(SvRV(sv)));
|
||||
tc = SWIG_TypeProxyCheck(_c,_t);
|
||||
#ifdef SWIG_DIRECTORS
|
||||
if (!tc && !sv_derived_from(sv,SWIG_Perl_TypeProxyName(_t))) {
|
||||
#else
|
||||
if (!tc) {
|
||||
#endif
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#define SWIG_FROM_CALL_ARGS SWIG_PERL_CALL_ARGS_1
|
||||
|
||||
|
||||
/* Include fundamental fragemt definitions */
|
||||
/* Include fundamental fragment definitions */
|
||||
%include <typemaps/fragments.swg>
|
||||
|
||||
/* Look for user fragments file. */
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
* Unified typemap section
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
/* No director supported in Perl */
|
||||
#ifdef SWIG_DIRECTOR_TYPEMAPS
|
||||
#undef SWIG_DIRECTOR_TYPEMAPS
|
||||
/* director support in Perl is experimental */
|
||||
#ifndef SWIG_DIRECTOR_TYPEMAPS
|
||||
#define SWIG_DIRECTOR_TYPEMAPS
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -84,6 +84,9 @@
|
|||
%typemap(varout,type="$1_descriptor") SWIGTYPE &
|
||||
"sv_setiv(SvRV($result),PTR2IV(&$1));";
|
||||
|
||||
%typemap(varout,type="$1_descriptor") SWIGTYPE &&
|
||||
"sv_setiv(SvRV($result),PTR2IV(&$1));";
|
||||
|
||||
%typemap(varout,type="$&1_descriptor") SWIGTYPE
|
||||
"sv_setiv(SvRV($result), PTR2IV(&$1));";
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@
|
|||
|
||||
%apply size_t { std::size_t };
|
||||
|
||||
%fragment("<string>");
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
double SwigSvToNumber(SV* sv) {
|
||||
return SvIOK(sv) ? double(SvIVX(sv)) : SvNVX(sv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
%{
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<algorithm>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
// exported class
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
%{
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<algorithm>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
// exported class
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
|
||||
%{
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<algorithm>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
// exported class
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
%typemap(consttab) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE [] {
|
||||
zval *z_var;
|
||||
MAKE_STD_ZVAL(z_var);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes that proxy
|
||||
* method calls from C++ to PHP extensions.
|
||||
* This file contains support for director classes so that PHP proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SWIG_DIRECTOR_PHP_HEADER_
|
||||
#define SWIG_DIRECTOR_PHP_HEADER_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
|
||||
/*
|
||||
|
|
@ -23,38 +22,33 @@
|
|||
#endif
|
||||
|
||||
namespace Swig {
|
||||
/* memory handler */
|
||||
struct GCItem
|
||||
{
|
||||
virtual ~GCItem() {}
|
||||
|
||||
virtual int get_own() const
|
||||
{
|
||||
/* memory handler */
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {
|
||||
}
|
||||
|
||||
virtual int get_own() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct GCItem_var
|
||||
{
|
||||
GCItem_var(GCItem *item = 0) : _item(item)
|
||||
{
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item)
|
||||
{
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var()
|
||||
{
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem * operator->() const
|
||||
{
|
||||
GCItem * operator->() const {
|
||||
return _item;
|
||||
}
|
||||
|
||||
|
|
@ -62,18 +56,14 @@ namespace Swig {
|
|||
GCItem *_item;
|
||||
};
|
||||
|
||||
struct GCItem_Object : GCItem
|
||||
{
|
||||
GCItem_Object(int own) : _own(own)
|
||||
{
|
||||
struct GCItem_Object : GCItem {
|
||||
GCItem_Object(int own) : _own(own) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_Object()
|
||||
{
|
||||
virtual ~GCItem_Object() {
|
||||
}
|
||||
|
||||
int get_own() const
|
||||
{
|
||||
int get_own() const {
|
||||
return _own;
|
||||
}
|
||||
|
||||
|
|
@ -82,14 +72,11 @@ namespace Swig {
|
|||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem
|
||||
{
|
||||
GCItem_T(Type *ptr) : _ptr(ptr)
|
||||
{
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T()
|
||||
{
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
|
|
@ -100,14 +87,14 @@ namespace Swig {
|
|||
class Director {
|
||||
protected:
|
||||
zval *swig_self;
|
||||
typedef std::map<void*, GCItem_var> swig_ownership_map;
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef ZTS
|
||||
// Store the ZTS context so it's available when C++ calls back to PHP.
|
||||
void *** swig_zts_ctx;
|
||||
#endif
|
||||
#endif
|
||||
public:
|
||||
Director(zval* self TSRMLS_DC) : swig_self(self) {
|
||||
Director(zval *self TSRMLS_DC) : swig_self(self) {
|
||||
TSRMLS_SET_CTX(swig_zts_ctx);
|
||||
}
|
||||
|
||||
|
|
@ -115,12 +102,11 @@ namespace Swig {
|
|||
TSRMLS_FETCH_FROM_CTX(swig_zts_ctx);
|
||||
zend_class_entry **ce;
|
||||
zend_function *mptr;
|
||||
int name_len = strlen(lc_fname);
|
||||
|
||||
|
||||
if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
if (zend_hash_find(&(*ce)->function_table, lc_fname, name_len + 1, (void**) &mptr) != SUCCESS) {
|
||||
if (zend_hash_find(&(*ce)->function_table, lc_fname, strlen(lc_fname) + 1, (void **) &mptr) != SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
// common.scope points to the declaring class
|
||||
|
|
@ -128,8 +114,7 @@ namespace Swig {
|
|||
}
|
||||
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership(Type *vptr) const
|
||||
{
|
||||
void swig_acquire_ownership(Type *vptr) const {
|
||||
if (vptr) {
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
|
|
@ -137,14 +122,12 @@ namespace Swig {
|
|||
};
|
||||
|
||||
/* base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
public:
|
||||
DirectorException(int code, const char *hdr, const char* msg TSRMLS_DC)
|
||||
: swig_msg(hdr)
|
||||
{
|
||||
if (strlen(msg)) {
|
||||
DirectorException(int code, const char *hdr, const char *msg TSRMLS_DC) : swig_msg(hdr) {
|
||||
if (msg[0]) {
|
||||
swig_msg += " ";
|
||||
swig_msg += msg;
|
||||
}
|
||||
|
|
@ -152,37 +135,39 @@ namespace Swig {
|
|||
SWIG_ErrorMsg() = swig_msg.c_str();
|
||||
}
|
||||
|
||||
static void raise(int code, const char *hdr, const char* msg TSRMLS_DC)
|
||||
{
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
|
||||
static void raise(int code, const char *hdr, const char *msg TSRMLS_DC) {
|
||||
throw DirectorException(code, hdr, msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
|
||||
/* attempt to call a pure virtual method via a director method */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException
|
||||
{
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC)
|
||||
{
|
||||
DirectorPureVirtualException(const char *msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg TSRMLS_DC)
|
||||
{
|
||||
static void raise(const char *msg TSRMLS_DC) {
|
||||
throw DirectorPureVirtualException(msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
|
||||
/* any php exception that occurs during a director method call */
|
||||
class DirectorMethodException : public Swig::DirectorException
|
||||
class DirectorMethodException : public DirectorException
|
||||
{
|
||||
public:
|
||||
DirectorMethodException(const char* msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC)
|
||||
{
|
||||
DirectorMethodException(const char *msg TSRMLS_DC)
|
||||
: DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg TSRMLS_DC)
|
||||
{
|
||||
static void raise(const char *msg TSRMLS_DC) {
|
||||
throw DirectorMethodException(msg TSRMLS_CC);
|
||||
}
|
||||
};
|
||||
|
|
@ -192,6 +177,4 @@ namespace Swig {
|
|||
// so use a macro to insert TSRMLS_CC so any ZTS context gets passed.
|
||||
#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
sizeof(zval *), NULL);
|
||||
}
|
||||
|
||||
%typemap(varinit) SWIGTYPE, SWIGTYPE &
|
||||
%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval *z_var;
|
||||
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
convert_to_string_ex(z_var);
|
||||
s1 = Z_STRVAL_PP(z_var);
|
||||
if ((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
|
||||
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
|
||||
if (s1)
|
||||
$1 = estrdup(s1);
|
||||
else
|
||||
|
|
@ -190,9 +190,9 @@
|
|||
|
||||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
s1 = Z_STRVAL_PP(z_var);
|
||||
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
|
||||
if(s1)
|
||||
strncpy($1, s1, $1_dim0);
|
||||
if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
|
||||
if (s1)
|
||||
strncpy($1, s1, $1_dim0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,13 +210,13 @@
|
|||
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE *, SWIGTYPE &
|
||||
%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval **z_var;
|
||||
$1_ltype _temp;
|
||||
|
||||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
@ -288,12 +288,12 @@
|
|||
|
||||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
s1 = Z_STRVAL_PP(z_var);
|
||||
if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1) )) {
|
||||
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;
|
||||
(*z_var)->value.str.len = strlen($1) + 1;
|
||||
} else {
|
||||
(*z_var)->value.str.val = 0;
|
||||
(*z_var)->value.str.len = 0;
|
||||
|
|
@ -314,7 +314,7 @@
|
|||
zval **z_var;
|
||||
|
||||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
if($1)
|
||||
if($1)
|
||||
SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0);
|
||||
}
|
||||
|
||||
|
|
@ -325,10 +325,10 @@
|
|||
deliberate error cos this code looks bogus to me
|
||||
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
|
||||
s1 = Z_STRVAL_PP(z_var);
|
||||
if((s1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
|
||||
if((s1 == NULL) || strcmp(s1, $1)) {
|
||||
if($1) {
|
||||
(*z_var)->value.str.val = estrdup($1);
|
||||
(*z_var)->value.str.len = strlen($1)+1;
|
||||
(*z_var)->value.str.len = strlen($1) + 1;
|
||||
} else {
|
||||
(*z_var)->value.str.val = 0;
|
||||
(*z_var)->value.str.len = 0;
|
||||
|
|
@ -336,7 +336,7 @@ deliberate error cos this code looks bogus to me
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE *, SWIGTYPE &
|
||||
%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&
|
||||
{
|
||||
zval **z_var;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
|
||||
{
|
||||
if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
|
||||
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;
|
||||
|
|
@ -114,6 +114,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
%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) {
|
||||
|
|
@ -131,7 +138,8 @@
|
|||
|
||||
%typemap(argout) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE&;
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&;
|
||||
|
||||
%typemap(in) void *
|
||||
{
|
||||
|
|
@ -188,12 +196,16 @@
|
|||
signed char,
|
||||
unsigned char,
|
||||
bool,
|
||||
size_t,
|
||||
enum SWIGTYPE
|
||||
size_t
|
||||
{
|
||||
ZVAL_LONG(return_value,$1);
|
||||
}
|
||||
|
||||
%typemap(out) enum SWIGTYPE
|
||||
{
|
||||
ZVAL_LONG(return_value, (long)$1);
|
||||
}
|
||||
|
||||
%typemap(out) long long
|
||||
%{
|
||||
if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) {
|
||||
|
|
@ -226,12 +238,21 @@
|
|||
const signed char &,
|
||||
const unsigned char &,
|
||||
const bool &,
|
||||
const size_t &,
|
||||
const enum SWIGTYPE &
|
||||
const size_t &
|
||||
{
|
||||
ZVAL_LONG(return_value,*$1);
|
||||
}
|
||||
|
||||
%typemap(out) const enum SWIGTYPE &
|
||||
{
|
||||
ZVAL_LONG(return_value, (long)*$1);
|
||||
}
|
||||
|
||||
%typemap(out) const enum SWIGTYPE &&
|
||||
{
|
||||
ZVAL_LONG(return_value, (long)*$1);
|
||||
}
|
||||
|
||||
%typemap(out) const long long &
|
||||
%{
|
||||
if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) {
|
||||
|
|
@ -269,6 +290,11 @@
|
|||
ZVAL_LONG($input,$1);
|
||||
}
|
||||
|
||||
%typemap(directorin) enum SWIGTYPE
|
||||
{
|
||||
ZVAL_LONG($input, (long)$1_name);
|
||||
}
|
||||
|
||||
%typemap(directorin) char *, char []
|
||||
{
|
||||
if(!$1) {
|
||||
|
|
@ -342,7 +368,8 @@
|
|||
|
||||
%typemap(out) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
|
||||
%}
|
||||
|
|
@ -354,7 +381,8 @@
|
|||
|
||||
%typemap(directorin) SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2);
|
||||
%}
|
||||
|
|
@ -449,6 +477,7 @@
|
|||
SWIGTYPE *,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
|
|
@ -479,7 +508,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
|
||||
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
|
||||
(void)$1;
|
||||
zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), 0 TSRMLS_CC);
|
||||
return;
|
||||
|
|
@ -492,6 +521,7 @@
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -2,37 +2,41 @@
|
|||
* phpkw.swg
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
/* Keyword (case insensitive) */
|
||||
#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
|
||||
#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, class renamed as 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
/* Class (case insensitive) */
|
||||
#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
|
||||
#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP",sourcefmt="%(lower)s") `x`
|
||||
#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP") "::" `x`
|
||||
#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
|
||||
/* Constant (case insensitive) */
|
||||
#define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x`
|
||||
#define PHPBN1b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant,sourcefmt="%(lower)s") `x`
|
||||
%define PHPBN1(X)
|
||||
PHPBN1a(X); PHPBN1b(X)
|
||||
%enddef
|
||||
|
||||
/*
|
||||
From
|
||||
/* Constant (case sensitive) */
|
||||
#define PHPBN2a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem) `x`
|
||||
#define PHPBN2b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant) `x`
|
||||
%define PHPBN2(X)
|
||||
PHPBN2a(X); PHPBN2b(X)
|
||||
%enddef
|
||||
|
||||
http://aspn.activestate.com/ASPN/docs/PHP/reserved.html
|
||||
http://php.net/manual/en/reserved.keywords.php
|
||||
#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
|
||||
|
||||
and reviewed by Olly Betts.
|
||||
|
||||
Further updates from the PHP manual on php.net.
|
||||
*/
|
||||
|
||||
/* We classify these as kw since PHP will not run if used globally. */
|
||||
/* "You cannot use any of the following words as constants, class names,
|
||||
/* From: http://php.net/manual/en/reserved.keywords.php
|
||||
* "You cannot use any of the following words as constants, class names,
|
||||
* function or method names. Using them as variable names is generally OK, but
|
||||
* could lead to confusion."
|
||||
*/
|
||||
/* case insensitive */
|
||||
/* Check is case insensitive - these *MUST* be listed in lower case here */
|
||||
PHPKW(__halt_compiler);
|
||||
PHPKW(abstract);
|
||||
PHPKW(and);
|
||||
PHPKW(array);
|
||||
PHPKW(as);
|
||||
PHPKW(break);
|
||||
PHPKW(callable); // As of PHP 5.4
|
||||
PHPKW(case);
|
||||
PHPKW(catch);
|
||||
PHPKW(class);
|
||||
|
|
@ -57,20 +61,22 @@ PHPKW(eval); // "Language construct"
|
|||
PHPKW(exit); // "Language construct"
|
||||
PHPKW(extends);
|
||||
PHPKW(final);
|
||||
PHPKW(finally); // As of PHP 5.5
|
||||
PHPKW(for);
|
||||
PHPKW(foreach);
|
||||
PHPKW(function);
|
||||
PHPKW(global);
|
||||
PHPKW(goto); // As of PHP5.3
|
||||
PHPKW(goto); // As of PHP 5.3
|
||||
PHPKW(if);
|
||||
PHPKW(implements);
|
||||
PHPKW(include); // "Language construct"
|
||||
PHPKW(include_once); // "Language construct"
|
||||
PHPKW(instanceof);
|
||||
PHPKW(insteadof); // As of PHP 5.4
|
||||
PHPKW(interface);
|
||||
PHPKW(isset); // "Language construct"
|
||||
PHPKW(list); // "Language construct"
|
||||
PHPKW(namespace); // As of PHP5.3
|
||||
PHPKW(namespace); // As of PHP 5.3
|
||||
PHPKW(new);
|
||||
PHPKW(or);
|
||||
PHPKW(print); // "Language construct"
|
||||
|
|
@ -83,39 +89,70 @@ PHPKW(return); // "Language construct"
|
|||
PHPKW(static);
|
||||
PHPKW(switch);
|
||||
PHPKW(throw);
|
||||
PHPKW(trait); // As of PHP 5.4
|
||||
PHPKW(try);
|
||||
PHPKW(unset); // "Language construct"
|
||||
PHPKW(use);
|
||||
PHPKW(var);
|
||||
PHPKW(while);
|
||||
PHPKW(xor);
|
||||
// Compile-time constants
|
||||
PHPKW(__CLASS__);
|
||||
PHPKW(__DIR__); // As of PHP5.3
|
||||
PHPKW(__FILE__);
|
||||
PHPKW(__FUNCTION__);
|
||||
PHPKW(__METHOD__);
|
||||
PHPKW(__NAMESPACE__); // As of PHP5.3
|
||||
PHPKW(__LINE__);
|
||||
PHPKW(yield); // As of PHP 5.5
|
||||
|
||||
// Compile-time "magic" constants
|
||||
// From: http://php.net/manual/en/reserved.keywords.php
|
||||
// also at: http://php.net/manual/en/language.constants.predefined.php
|
||||
/* These *MUST* be listed in lower case here */
|
||||
PHPKW(__class__);
|
||||
PHPKW(__dir__); // As of PHP 5.3
|
||||
PHPKW(__file__);
|
||||
PHPKW(__function__);
|
||||
PHPKW(__line__);
|
||||
PHPKW(__method__);
|
||||
PHPKW(__namespace__); // As of PHP 5.3
|
||||
PHPKW(__trait__); // As of PHP 5.4
|
||||
|
||||
/* We classify these as built-in names since they conflict, but PHP still runs */
|
||||
|
||||
/* Type 1: case insensitive */
|
||||
PHPBN1(__sleep);
|
||||
PHPBN1(__wakeup);
|
||||
PHPBN1(not);
|
||||
PHPBN1(parent);
|
||||
PHPBN1(virtual);
|
||||
PHPBN1(NULL);
|
||||
PHPBN1(TRUE);
|
||||
PHPBN1(FALSE);
|
||||
/* Predefined case-insensitive constants */
|
||||
/* These *MUST* be listed in lower case here */
|
||||
PHPBN1(null);
|
||||
PHPBN1(true);
|
||||
PHPBN1(false);
|
||||
|
||||
/* Type 2: case sensitive */
|
||||
/* "Core Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
|
||||
PHPBN2(E_ALL);
|
||||
/* "Core Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
|
||||
/* These are case sensitive */
|
||||
PHPBN2(PHP_VERSION);
|
||||
PHPBN2(PHP_MAJOR_VERSION); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_MINOR_VERSION); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_RELEASE_VERSION); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_VERSION_ID); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_EXTRA_VERSION); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_ZTS); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_DEBUG); // As of PHP 5.2.7
|
||||
PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3.0
|
||||
PHPBN2(PHP_OS);
|
||||
PHPBN2(PHP_SAPI);
|
||||
PHPBN2(PHP_EOL); // As of PHP 5.0.2
|
||||
PHPBN2(PHP_INT_MAX); // As of PHP 5.0.5
|
||||
PHPBN2(PHP_INT_SIZE); // As of PHP 5.0.5
|
||||
PHPBN2(DEFAULT_INCLUDE_PATH);
|
||||
PHPBN2(PEAR_INSTALL_DIR);
|
||||
PHPBN2(PEAR_EXTENSION_DIR);
|
||||
PHPBN2(PHP_EXTENSION_DIR);
|
||||
PHPBN2(PHP_PREFIX);
|
||||
PHPBN2(PHP_BINDIR);
|
||||
PHPBN2(PHP_BINARY); // As of PHP 5.4
|
||||
PHPBN2(PHP_MANDIR); // As of PHP 5.3.7
|
||||
PHPBN2(PHP_LIBDIR);
|
||||
PHPBN2(PHP_DATADIR);
|
||||
PHPBN2(PHP_SYSCONFDIR);
|
||||
PHPBN2(PHP_LOCALSTATEDIR);
|
||||
PHPBN2(PHP_CONFIG_FILE_PATH);
|
||||
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
|
||||
PHPBN2(PHP_SHLIB_SUFFIX);
|
||||
PHPBN2(E_ERROR);
|
||||
PHPBN2(E_PARSE);
|
||||
PHPBN2(E_WARNING);
|
||||
PHPBN2(E_PARSE);
|
||||
PHPBN2(E_NOTICE);
|
||||
PHPBN2(E_CORE_ERROR);
|
||||
PHPBN2(E_CORE_WARNING);
|
||||
|
|
@ -124,31 +161,17 @@ PHPBN2(E_COMPILE_WARNING);
|
|||
PHPBN2(E_USER_ERROR);
|
||||
PHPBN2(E_USER_WARNING);
|
||||
PHPBN2(E_USER_NOTICE);
|
||||
PHPBN2(E_DEPRECATED); // As of PHP 5.3
|
||||
PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3
|
||||
PHPBN2(PHP_OS);
|
||||
PHPBN2(PHP_VERSION);
|
||||
PHPBN2(PHP_SAPI);
|
||||
PHPBN2(PHP_EOL);
|
||||
PHPBN2(PHP_INT_MAX);
|
||||
PHPBN2(PHP_INT_SIZE);
|
||||
PHPBN2(DEFAULT_INCLUDE_PATH);
|
||||
PHPBN2(PEAR_INSTALL_DIR);
|
||||
PHPBN2(PEAR_EXTENSION_DIR);
|
||||
PHPBN2(PHP_EXTENSION_DIR);
|
||||
PHPBN2(PHP_PREFIX);
|
||||
PHPBN2(PHP_BINDIR);
|
||||
PHPBN2(PHP_LIBDIR);
|
||||
PHPBN2(PHP_DATADIR);
|
||||
PHPBN2(PHP_SYSCONFDIR);
|
||||
PHPBN2(PHP_LOCALSTATEDIR);
|
||||
PHPBN2(PHP_CONFIG_FILE_PATH);
|
||||
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
|
||||
PHPBN2(PHP_SHLIB_SUFFIX);
|
||||
PHPBN2(E_DEPRECATED); // As of PHP 5.3.0
|
||||
PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3.0
|
||||
PHPBN2(E_ALL);
|
||||
PHPBN2(E_STRICT);
|
||||
PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0
|
||||
// TRUE, FALSE, NULL are listed on the same page, but are actually
|
||||
// case-insensitive, whereas all the other constants listed there seem to be
|
||||
// case-sensitive, so we handle TRUE, FALSE, NULL in PHPBN1.
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_START);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_CONT);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_END);
|
||||
PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3
|
||||
/* These don't actually seem to be set (tested on Linux, I guess they're
|
||||
* Windows only?) */
|
||||
PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3
|
||||
|
|
@ -162,7 +185,7 @@ PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3
|
|||
PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3
|
||||
PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3
|
||||
/* "Standard Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
|
||||
/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
|
||||
PHPBN2(EXTR_OVERWRITE);
|
||||
PHPBN2(EXTR_SKIP);
|
||||
PHPBN2(EXTR_PREFIX_SAME);
|
||||
|
|
@ -370,10 +393,6 @@ PHPBN2(LOG_NDELAY);
|
|||
PHPBN2(LOG_NOWAIT);
|
||||
PHPBN2(LOG_PERROR);
|
||||
|
||||
/* Added in PHP5 */
|
||||
PHPBN2(E_STRICT);
|
||||
PHPBN2(__COMPILER_HALT_OFFSET__);
|
||||
|
||||
/* Added in PHP 5.2 */
|
||||
PHPBN2(PREG_BACKTRACK_LIMIT_ERROR);
|
||||
PHPBN2(PREG_BAD_UTF8_ERROR);
|
||||
|
|
@ -485,17 +504,143 @@ PHPBN2(SIG_UNBLOCK);
|
|||
PHPBN2(TRAP_BRKPT);
|
||||
PHPBN2(TRAP_TRACE);
|
||||
|
||||
/* Class names reserved by PHP */
|
||||
/* case insensitive */
|
||||
/* Added in PHP 5.4 */
|
||||
PHPBN2(ENT_DISALLOWED);
|
||||
PHPBN2(ENT_HTML401);
|
||||
PHPBN2(ENT_HTML5);
|
||||
PHPBN2(ENT_SUBSTITUTE);
|
||||
PHPBN2(ENT_XML1);
|
||||
PHPBN2(ENT_XHTML);
|
||||
PHPBN2(IPPROTO_IP);
|
||||
PHPBN2(IPPROTO_IPV6);
|
||||
PHPBN2(IPV6_MULTICAST_HOPS);
|
||||
PHPBN2(IPV6_MULTICAST_IF);
|
||||
PHPBN2(IPV6_MULTICAST_LOOP);
|
||||
PHPBN2(IP_MULTICAST_IF);
|
||||
PHPBN2(IP_MULTICAST_LOOP);
|
||||
PHPBN2(IP_MULTICAST_TTL);
|
||||
PHPBN2(MCAST_JOIN_GROUP);
|
||||
PHPBN2(MCAST_LEAVE_GROUP);
|
||||
PHPBN2(MCAST_BLOCK_SOURCE);
|
||||
PHPBN2(MCAST_UNBLOCK_SOURCE);
|
||||
PHPBN2(MCAST_JOIN_SOURCE_GROUP);
|
||||
PHPBN2(MCAST_LEAVE_SOURCE_GROUP);
|
||||
PHPBN2(CURLOPT_MAX_RECV_SPEED_LARGE);
|
||||
PHPBN2(CURLOPT_MAX_SEND_SPEED_LARGE);
|
||||
PHPBN2(LIBXML_HTML_NODEFDTD);
|
||||
PHPBN2(LIBXML_HTML_NOIMPLIED);
|
||||
PHPBN2(LIBXML_PEDANTIC);
|
||||
PHPBN2(OPENSSL_CIPHER_AES_128_CBC);
|
||||
PHPBN2(OPENSSL_CIPHER_AES_192_CBC);
|
||||
PHPBN2(OPENSSL_CIPHER_AES_256_CBC);
|
||||
PHPBN2(OPENSSL_RAW_DATA);
|
||||
PHPBN2(OPENSSL_ZERO_PADDING);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_CLEAN);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_CLEANABLE);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_DISABLED);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_FINAL);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_FLUSH);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_FLUSHABLE);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_REMOVABLE);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_STARTED);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_STDFLAGS);
|
||||
PHPBN2(PHP_OUTPUT_HANDLER_WRITE);
|
||||
PHPBN2(PHP_SESSION_ACTIVE);
|
||||
PHPBN2(PHP_SESSION_DISABLED);
|
||||
PHPBN2(PHP_SESSION_NONE);
|
||||
PHPBN2(STREAM_META_ACCESS);
|
||||
PHPBN2(STREAM_META_GROUP);
|
||||
PHPBN2(STREAM_META_GROUP_NAME);
|
||||
PHPBN2(STREAM_META_OWNER);
|
||||
PHPBN2(STREAM_META_OWNER_NAME);
|
||||
PHPBN2(STREAM_META_TOUCH);
|
||||
PHPBN2(ZLIB_ENCODING_DEFLATE);
|
||||
PHPBN2(ZLIB_ENCODING_GZIP);
|
||||
PHPBN2(ZLIB_ENCODING_RAW);
|
||||
PHPBN2(U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR);
|
||||
PHPBN2(IDNA_CHECK_BIDI);
|
||||
PHPBN2(IDNA_CHECK_CONTEXTJ);
|
||||
PHPBN2(IDNA_NONTRANSITIONAL_TO_ASCII);
|
||||
PHPBN2(IDNA_NONTRANSITIONAL_TO_UNICODE);
|
||||
PHPBN2(INTL_IDNA_VARIANT_2003);
|
||||
PHPBN2(INTL_IDNA_VARIANT_UTS46);
|
||||
PHPBN2(IDNA_ERROR_EMPTY_LABEL);
|
||||
PHPBN2(IDNA_ERROR_LABEL_TOO_LONG);
|
||||
PHPBN2(IDNA_ERROR_DOMAIN_NAME_TOO_LONG);
|
||||
PHPBN2(IDNA_ERROR_LEADING_HYPHEN);
|
||||
PHPBN2(IDNA_ERROR_TRAILING_HYPHEN);
|
||||
PHPBN2(IDNA_ERROR_HYPHEN_3_4);
|
||||
PHPBN2(IDNA_ERROR_LEADING_COMBINING_MARK);
|
||||
PHPBN2(IDNA_ERROR_DISALLOWED);
|
||||
PHPBN2(IDNA_ERROR_PUNYCODE);
|
||||
PHPBN2(IDNA_ERROR_LABEL_HAS_DOT);
|
||||
PHPBN2(IDNA_ERROR_INVALID_ACE_LABEL);
|
||||
PHPBN2(IDNA_ERROR_BIDI);
|
||||
PHPBN2(IDNA_ERROR_CONTEXTJ);
|
||||
PHPBN2(JSON_PRETTY_PRINT);
|
||||
PHPBN2(JSON_UNESCAPED_SLASHES);
|
||||
PHPBN2(JSON_NUMERIC_CHECK);
|
||||
PHPBN2(JSON_UNESCAPED_UNICODE);
|
||||
PHPBN2(JSON_BIGINT_AS_STRING);
|
||||
|
||||
/* Added in PHP 5.5 */
|
||||
PHPBN2(IMG_AFFINE_TRANSLATE);
|
||||
PHPBN2(IMG_AFFINE_SCALE);
|
||||
PHPBN2(IMG_AFFINE_ROTATE);
|
||||
PHPBN2(IMG_AFFINE_SHEAR_HORIZONTAL);
|
||||
PHPBN2(IMG_AFFINE_SHEAR_VERTICAL);
|
||||
PHPBN2(IMG_CROP_DEFAULT);
|
||||
PHPBN2(IMG_CROP_TRANSPARENT);
|
||||
PHPBN2(IMG_CROP_BLACK);
|
||||
PHPBN2(IMG_CROP_WHITE);
|
||||
PHPBN2(IMG_CROP_SIDES);
|
||||
PHPBN2(IMG_FLIP_BOTH);
|
||||
PHPBN2(IMG_FLIP_HORIZONTAL);
|
||||
PHPBN2(IMG_FLIP_VERTICAL);
|
||||
PHPBN2(IMG_BELL);
|
||||
PHPBN2(IMG_BESSEL);
|
||||
PHPBN2(IMG_BICUBIC);
|
||||
PHPBN2(IMG_BICUBIC_FIXED);
|
||||
PHPBN2(IMG_BLACKMAN);
|
||||
PHPBN2(IMG_BOX);
|
||||
PHPBN2(IMG_BSPLINE);
|
||||
PHPBN2(IMG_CATMULLROM);
|
||||
PHPBN2(IMG_GAUSSIAN);
|
||||
PHPBN2(IMG_GENERALIZED_CUBIC);
|
||||
PHPBN2(IMG_HERMITE);
|
||||
PHPBN2(IMG_HAMMING);
|
||||
PHPBN2(IMG_HANNING);
|
||||
PHPBN2(IMG_MITCHELL);
|
||||
PHPBN2(IMG_POWER);
|
||||
PHPBN2(IMG_QUADRATIC);
|
||||
PHPBN2(IMG_SINC);
|
||||
PHPBN2(IMG_NEAREST_NEIGHBOUR);
|
||||
PHPBN2(IMG_WEIGHTED4);
|
||||
PHPBN2(IMG_TRIANGLE);
|
||||
PHPBN2(JSON_ERROR_RECURSION);
|
||||
PHPBN2(JSON_ERROR_INF_OR_NAN);
|
||||
PHPBN2(JSON_ERROR_UNSUPPORTED_TYPE);
|
||||
PHPBN2(MYSQLI_SERVER_PUBLIC_KEY);
|
||||
|
||||
/* Added in PHP 5.6 */
|
||||
PHPBN2(LDAP_ESCAPE_DN);
|
||||
PHPBN2(LDAP_ESCAPE_FILTER);
|
||||
|
||||
/* Class names reserved by PHP (case insensitive) */
|
||||
PHPCN(directory);
|
||||
PHPCN(stdclass);
|
||||
PHPCN(__php_incomplete_class);
|
||||
PHPCN(directory);
|
||||
/* Added in PHP5 (this list apparently depends which extensions you load by default). */
|
||||
PHPCN(parent);
|
||||
PHPCN(self);
|
||||
/* Added in PHP5. */
|
||||
PHPCN(exception);
|
||||
PHPCN(errorexception); // As of PHP 5.1
|
||||
PHPCN(php_user_filter);
|
||||
PHPCN(errorexception);
|
||||
PHPCN(closure); // As of PHP 5.3
|
||||
PHPCN(generator); // As of PHP 5.5
|
||||
PHPCN(self);
|
||||
PHPCN(static);
|
||||
PHPCN(parent);
|
||||
/* From extensions (which of these are actually predefined depends which
|
||||
* extensions are loaded by default). */
|
||||
PHPCN(xmlwriter);
|
||||
PHPCN(libxmlerror);
|
||||
PHPCN(simplexmlelement);
|
||||
|
|
@ -588,29 +733,112 @@ PHPCN(sqliteexception);
|
|||
PHPCN(datetime);
|
||||
|
||||
/* Built-in PHP functions (incomplete). */
|
||||
PHPFN(cos);
|
||||
PHPFN(sin);
|
||||
PHPFN(tan);
|
||||
/* Includes Array Functions - http://php.net/manual/en/ref.array.php */
|
||||
/* Check is case insensitive - these *MUST* be listed in lower case here */
|
||||
PHPFN(acos);
|
||||
PHPFN(array_change_key_case);
|
||||
PHPFN(array_chunk);
|
||||
PHPFN(array_column);
|
||||
PHPFN(array_combine);
|
||||
PHPFN(array_count_values);
|
||||
PHPFN(array_diff);
|
||||
PHPFN(array_diff_assoc);
|
||||
PHPFN(array_diff_key);
|
||||
PHPFN(array_diff_uassoc);
|
||||
PHPFN(array_diff_ukey);
|
||||
PHPFN(array_fill);
|
||||
PHPFN(array_fill_keys);
|
||||
PHPFN(array_filter);
|
||||
PHPFN(array_flip);
|
||||
PHPFN(array_intersect);
|
||||
PHPFN(array_intersect_assoc);
|
||||
PHPFN(array_intersect_key);
|
||||
PHPFN(array_intersect_uassoc);
|
||||
PHPFN(array_intersect_ukey);
|
||||
PHPFN(array_key_exists);
|
||||
PHPFN(array_keys);
|
||||
PHPFN(array_map);
|
||||
PHPFN(array_merge);
|
||||
PHPFN(array_merge_recursive);
|
||||
PHPFN(array_multisort);
|
||||
PHPFN(array_pad);
|
||||
PHPFN(array_pop);
|
||||
PHPFN(array_product);
|
||||
PHPFN(array_push);
|
||||
PHPFN(array_rand);
|
||||
PHPFN(array_reduce);
|
||||
PHPFN(array_replace);
|
||||
PHPFN(array_replace_recursive);
|
||||
PHPFN(array_reverse);
|
||||
PHPFN(array_search);
|
||||
PHPFN(array_shift);
|
||||
PHPFN(array_slice);
|
||||
PHPFN(array_splice);
|
||||
PHPFN(array_sum);
|
||||
PHPFN(array_udiff);
|
||||
PHPFN(array_udiff_assoc);
|
||||
PHPFN(array_udiff_uassoc);
|
||||
PHPFN(array_uintersect);
|
||||
PHPFN(array_uintersect_assoc);
|
||||
PHPFN(array_uintersect_uassoc);
|
||||
PHPFN(array_unique);
|
||||
PHPFN(array_unshift);
|
||||
PHPFN(array_values);
|
||||
PHPFN(array_walk);
|
||||
PHPFN(array_walk_recursive);
|
||||
PHPFN(arsort);
|
||||
PHPFN(asin);
|
||||
PHPFN(asort);
|
||||
PHPFN(atan);
|
||||
PHPFN(atan2);
|
||||
PHPFN(cosh);
|
||||
PHPFN(sinh);
|
||||
PHPFN(tanh);
|
||||
PHPFN(exp);
|
||||
PHPFN(log);
|
||||
PHPFN(log10);
|
||||
PHPFN(pow);
|
||||
PHPFN(sqrt);
|
||||
PHPFN(ceil);
|
||||
PHPFN(compact);
|
||||
PHPFN(cos);
|
||||
PHPFN(cosh);
|
||||
PHPFN(count);
|
||||
PHPFN(current);
|
||||
PHPFN(each);
|
||||
PHPFN(end);
|
||||
PHPFN(exp);
|
||||
PHPFN(extract);
|
||||
PHPFN(floor);
|
||||
PHPFN(fmod);
|
||||
PHPFN(min);
|
||||
PHPFN(in_array);
|
||||
PHPFN(key);
|
||||
PHPFN(key_exists);
|
||||
PHPFN(krsort);
|
||||
PHPFN(ksort);
|
||||
PHPFN(log);
|
||||
PHPFN(log10);
|
||||
PHPFN(max);
|
||||
PHPFN(min);
|
||||
PHPFN(natcasesort);
|
||||
PHPFN(natsort);
|
||||
PHPFN(next);
|
||||
PHPFN(pos);
|
||||
PHPFN(pow);
|
||||
PHPFN(prev);
|
||||
PHPFN(range);
|
||||
PHPFN(reset);
|
||||
PHPFN(rsort);
|
||||
PHPFN(shuffle);
|
||||
PHPFN(sin);
|
||||
PHPFN(sinh);
|
||||
PHPFN(sizeof);
|
||||
PHPFN(sort);
|
||||
PHPFN(sqrt);
|
||||
PHPFN(tan);
|
||||
PHPFN(tanh);
|
||||
PHPFN(uasort);
|
||||
PHPFN(uksort);
|
||||
PHPFN(usort);
|
||||
|
||||
#undef PHPKW
|
||||
#undef PHPBN1a
|
||||
#undef PHPBN1b
|
||||
#undef PHPBN1
|
||||
#undef PHPBN2a
|
||||
#undef PHPBN2b
|
||||
#undef PHPBN2
|
||||
#undef PHPCN
|
||||
#undef PHPFN
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
|
||||
%typemap(in) TYPE *REF ($*1_ltype tmp),
|
||||
%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp),
|
||||
TYPE &REF ($*1_ltype tmp)
|
||||
%{
|
||||
/* First Check for SWIG wrapped type */
|
||||
|
|
|
|||
|
|
@ -255,11 +255,10 @@ static char const_name[] = "swig_runtime_data_type_pointer";
|
|||
static swig_module_info *SWIG_Php_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
||||
zval *pointer;
|
||||
swig_module_info *ret = 0;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(pointer);
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) {
|
||||
if (pointer->type == IS_LONG) {
|
||||
ret = (swig_module_info *) pointer->value.lval;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ namespace std {
|
|||
%}
|
||||
|
||||
%typemap(directorout) string %{
|
||||
convert_to_string_ex($input);
|
||||
$result.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
|
||||
convert_to_string_ex(&$input);
|
||||
$result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input));
|
||||
%}
|
||||
|
||||
%typemap(out) string %{
|
||||
|
|
@ -63,8 +63,8 @@ namespace std {
|
|||
%}
|
||||
|
||||
%typemap(directorout) string & ($*1_ltype *temp) %{
|
||||
convert_to_string_ex($input);
|
||||
temp = new $*1_ltype(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
|
||||
convert_to_string_ex(&$input);
|
||||
temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input));
|
||||
swig_acquire_ownership(temp);
|
||||
$result = temp;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace std {
|
|||
self->pop_back();
|
||||
return x;
|
||||
}
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@
|
|||
%}
|
||||
%typemap(directorout) TYPE
|
||||
%{
|
||||
CONVERT_IN($result,$1_ltype,$input);
|
||||
CONVERT_IN($result,$1_ltype,&$input);
|
||||
%}
|
||||
%typemap(directorout) const TYPE & ($*1_ltype temp)
|
||||
%{
|
||||
CONVERT_IN(temp,$*1_ltype,$input);
|
||||
CONVERT_IN(temp,$*1_ltype,&$input);
|
||||
$result = &temp;
|
||||
%}
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ extern "C" {
|
|||
|
||||
%typemap(in) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE []
|
||||
"SWIG_ConvertPtr($input.u.object, (void **) &$1, $1_descriptor, 1);"
|
||||
|
||||
|
|
@ -79,7 +80,8 @@ extern "C" {
|
|||
const bool & (bool temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const unsigned long long & ($*1_ltype temp),
|
||||
const enum SWIGTYPE & ($*1_ltype temp)
|
||||
const enum SWIGTYPE & ($*1_ltype temp),
|
||||
const enum SWIGTYPE && ($*1_ltype temp)
|
||||
{
|
||||
if ($input.type != T_INT)
|
||||
Pike_error("Bad argument: Expected an integer.\n");
|
||||
|
|
@ -113,7 +115,7 @@ extern "C" {
|
|||
%typemap(out, pikedesc="tStr") char * "push_text($1);";
|
||||
|
||||
/* Pointers, references, and arrays */
|
||||
%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));";
|
||||
%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));";
|
||||
|
||||
/* Void return value; don't push anything */
|
||||
%typemap(out, pikedesc="tVoid") void "";
|
||||
|
|
@ -153,7 +155,8 @@ extern "C" {
|
|||
const char &, const signed char &, const unsigned char &,
|
||||
const bool &,
|
||||
const long long &, const unsigned long long &,
|
||||
const enum SWIGTYPE & ($*1_ltype temp)
|
||||
const enum SWIGTYPE & ($*1_ltype temp),
|
||||
const enum SWIGTYPE && ($*1_ltype temp)
|
||||
"push_int(*($1));";
|
||||
|
||||
%typemap(out, pikedesc="tFloat") const float &, const double & "push_float(*($1));";
|
||||
|
|
@ -216,7 +219,7 @@ extern "C" {
|
|||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE, enum SWIGTYPE &,
|
||||
enum SWIGTYPE, enum SWIGTYPE &, SWIGTYPE &&,
|
||||
bool, const bool &
|
||||
{
|
||||
$1 = ($input.type == T_INT) ? 1 : 0;
|
||||
|
|
@ -237,7 +240,7 @@ extern "C" {
|
|||
$1 = ($input.type == T_STRING) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, $1_descriptor, 0) == -1) {
|
||||
$1 = 0;
|
||||
|
|
@ -266,6 +269,7 @@ extern "C" {
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ SWIGOPT = -python
|
|||
SWIGCC = $(CC)
|
||||
|
||||
# SWIG Library files. Uncomment if rebuilding the Python interpreter
|
||||
#SWIGLIB = -lembed.i
|
||||
#SWIGLIBS = -lembed.i
|
||||
|
||||
# Rules for creating .o files from source.
|
||||
|
||||
|
|
@ -69,32 +69,20 @@ BUILD = @LDSHARED@
|
|||
#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
|
||||
-L/usr/local/lib -lg++ -lstdc++ -lgcc
|
||||
|
||||
# X11 installation (needed if rebuilding Python + tkinter)
|
||||
|
||||
XLIB = @XLIBSW@
|
||||
XINCLUDE = @XINCLUDES@
|
||||
|
||||
# Python installation
|
||||
|
||||
PY_INCLUDE = -DHAVE_CONFIG_H @PYINCLUDE@
|
||||
PY_LIB = @PYLIB@
|
||||
|
||||
# Tcl installation. Needed if rebuilding Python with tkinter.
|
||||
|
||||
TCL_INCLUDE = @TCLINCLUDE@
|
||||
TCL_LIB = @TCLLIB@
|
||||
|
||||
# Build libraries (needed for static builds)
|
||||
|
||||
LIBM = @LIBM@
|
||||
LIBC = @LIBC@
|
||||
SYSLIBS = $(LIBM) $(LIBC) @LIBS@
|
||||
|
||||
# Build options (uncomment only one these)
|
||||
# Build options
|
||||
|
||||
#TKINTER = $(TCL_LIB) -ltk -ltcl $(XLIB)
|
||||
BUILD_LIBS = $(LIBS) # Dynamic loading
|
||||
#BUILD_LIBS = $(PY_LIB) @PYLINK@ $(TKINTER) $(LIBS) $(SYSLIBS)
|
||||
|
||||
# Compilation rules for non-SWIG components
|
||||
|
||||
|
|
@ -122,7 +110,7 @@ $(WRAPOBJ) : $(WRAPFILE)
|
|||
$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(PY_INCLUDE)
|
||||
|
||||
$(WRAPFILE) : $(INTERFACE)
|
||||
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
|
||||
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIBS) $(INTERFACE)
|
||||
|
||||
$(TARGET): $(WRAPOBJ) $(ALLOBJS)
|
||||
$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes that proxy
|
||||
* method calls from C++ to Python extensions.
|
||||
* This file contains support for director classes so that Python proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SWIG_DIRECTOR_PYTHON_HEADER_
|
||||
#define SWIG_DIRECTOR_PYTHON_HEADER_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
|
@ -58,18 +56,17 @@
|
|||
could stop working when using this option.
|
||||
*/
|
||||
#ifdef SWIG_DIRECTOR_NORTTI
|
||||
/*
|
||||
/*
|
||||
When we don't use the native C++ RTTI, we implement a minimal one
|
||||
only for Directors.
|
||||
*/
|
||||
# ifndef SWIG_DIRECTOR_RTDIR
|
||||
# define SWIG_DIRECTOR_RTDIR
|
||||
#include <map>
|
||||
|
||||
namespace Swig {
|
||||
class Director;
|
||||
SWIGINTERN std::map<void*,Director*>& get_rtdir_map() {
|
||||
static std::map<void*,Director*> rtdir_map;
|
||||
SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
|
||||
static std::map<void *, Director *> rtdir_map;
|
||||
return rtdir_map;
|
||||
}
|
||||
|
||||
|
|
@ -78,15 +75,15 @@ namespace Swig {
|
|||
}
|
||||
|
||||
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
|
||||
std::map<void*,Director*>::const_iterator pos = get_rtdir_map().find(vptr);
|
||||
std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
|
||||
Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
|
||||
return rtdir;
|
||||
}
|
||||
}
|
||||
# endif /* SWIG_DIRECTOR_RTDIR */
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void*>(ARG))
|
||||
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void*>(ARG1), ARG2)
|
||||
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
|
||||
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -99,154 +96,139 @@ extern "C" {
|
|||
struct swig_type_info;
|
||||
}
|
||||
|
||||
namespace Swig {
|
||||
namespace Swig {
|
||||
|
||||
/* memory handler */
|
||||
struct GCItem
|
||||
{
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {}
|
||||
|
||||
virtual int get_own() const
|
||||
{
|
||||
virtual int get_own() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct GCItem_var
|
||||
{
|
||||
GCItem_var(GCItem *item = 0) : _item(item)
|
||||
{
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item)
|
||||
{
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var()
|
||||
{
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem * operator->() const
|
||||
{
|
||||
|
||||
GCItem * operator->() const {
|
||||
return _item;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
GCItem *_item;
|
||||
};
|
||||
|
||||
struct GCItem_Object : GCItem
|
||||
{
|
||||
GCItem_Object(int own) : _own(own)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~GCItem_Object()
|
||||
{
|
||||
|
||||
struct GCItem_Object : GCItem {
|
||||
GCItem_Object(int own) : _own(own) {
|
||||
}
|
||||
|
||||
int get_own() const
|
||||
{
|
||||
virtual ~GCItem_Object() {
|
||||
}
|
||||
|
||||
int get_own() const {
|
||||
return _own;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
int _own;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem
|
||||
{
|
||||
GCItem_T(Type *ptr) : _ptr(ptr)
|
||||
{
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T()
|
||||
{
|
||||
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct GCArray_T : GCItem
|
||||
{
|
||||
GCArray_T(Type *ptr) : _ptr(ptr)
|
||||
{
|
||||
struct GCArray_T : GCItem {
|
||||
GCArray_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCArray_T()
|
||||
{
|
||||
|
||||
virtual ~GCArray_T() {
|
||||
delete[] _ptr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
||||
/* base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
public:
|
||||
DirectorException(PyObject *error, const char* hdr ="", const char* msg ="")
|
||||
: swig_msg(hdr)
|
||||
{
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
if (strlen(msg)) {
|
||||
DirectorException(PyObject *error, const char *hdr ="", const char *msg ="") : swig_msg(hdr) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
if (msg[0]) {
|
||||
swig_msg += " ";
|
||||
swig_msg += msg;
|
||||
}
|
||||
if (!PyErr_Occurred()) {
|
||||
PyErr_SetString(error, getMessage());
|
||||
PyErr_SetString(error, what());
|
||||
}
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
}
|
||||
|
||||
const char *getMessage() const
|
||||
{
|
||||
return swig_msg.c_str();
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
|
||||
static void raise(PyObject *error, const char *msg)
|
||||
{
|
||||
/* Deprecated, use what() instead */
|
||||
const char *getMessage() const {
|
||||
return what();
|
||||
}
|
||||
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
|
||||
static void raise(PyObject *error, const char *msg) {
|
||||
throw DirectorException(error, msg);
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
static void raise(const char *msg) {
|
||||
raise(PyExc_RuntimeError, msg);
|
||||
}
|
||||
};
|
||||
|
||||
/* unknown exception handler */
|
||||
class UnknownExceptionHandler
|
||||
{
|
||||
class UnknownExceptionHandler {
|
||||
#ifdef SWIG_DIRECTOR_UEH
|
||||
static void handler() {
|
||||
static void handler() {
|
||||
try {
|
||||
throw;
|
||||
} catch (DirectorException& e) {
|
||||
std::cerr << "SWIG Director exception caught:" << std::endl
|
||||
<< e.getMessage() << std::endl;
|
||||
<< e.what() << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unknown exception caught." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
std::cerr << std::endl
|
||||
<< "Python interpreter traceback:" << std::endl;
|
||||
PyErr_Print();
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
||||
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
||||
<< std::endl
|
||||
|
|
@ -255,69 +237,58 @@ namespace Swig {
|
|||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
std::unexpected_handler old;
|
||||
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
||||
{
|
||||
UnknownExceptionHandler(std::unexpected_handler nh = handler) {
|
||||
old = std::set_unexpected(nh);
|
||||
}
|
||||
|
||||
~UnknownExceptionHandler()
|
||||
{
|
||||
~UnknownExceptionHandler() {
|
||||
std::set_unexpected(old);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
/* type mismatch in the return value from a python method call */
|
||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||
class DirectorTypeMismatchException : public DirectorException {
|
||||
public:
|
||||
DirectorTypeMismatchException(PyObject *error, const char* msg="")
|
||||
: Swig::DirectorException(error, "SWIG director type mismatch", msg)
|
||||
{
|
||||
DirectorTypeMismatchException(PyObject *error, const char *msg="")
|
||||
: DirectorException(error, "SWIG director type mismatch", msg) {
|
||||
}
|
||||
|
||||
DirectorTypeMismatchException(const char* msg="")
|
||||
: Swig::DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg)
|
||||
{
|
||||
DirectorTypeMismatchException(const char *msg="")
|
||||
: DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg) {
|
||||
}
|
||||
|
||||
static void raise(PyObject *error, const char *msg)
|
||||
{
|
||||
static void raise(PyObject *error, const char *msg) {
|
||||
throw DirectorTypeMismatchException(error, msg);
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorTypeMismatchException(msg);
|
||||
}
|
||||
};
|
||||
|
||||
/* any python exception that occurs during a director method call */
|
||||
class DirectorMethodException : public Swig::DirectorException {
|
||||
class DirectorMethodException : public DirectorException {
|
||||
public:
|
||||
DirectorMethodException(const char* msg = "")
|
||||
: DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg)
|
||||
{
|
||||
}
|
||||
DirectorMethodException(const char *msg = "")
|
||||
: DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorMethodException(msg);
|
||||
}
|
||||
};
|
||||
|
||||
/* attempt to call a pure virtual method via a director method */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException
|
||||
{
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg = "")
|
||||
: DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg)
|
||||
{
|
||||
DirectorPureVirtualException(const char *msg = "")
|
||||
: DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorPureVirtualException(msg);
|
||||
}
|
||||
};
|
||||
|
|
@ -332,88 +303,82 @@ namespace Swig {
|
|||
|
||||
#ifdef __THREAD__
|
||||
# include "pythread.h"
|
||||
class Guard
|
||||
{
|
||||
PyThread_type_lock & mutex_;
|
||||
|
||||
class Guard {
|
||||
PyThread_type_lock &mutex_;
|
||||
|
||||
public:
|
||||
Guard(PyThread_type_lock & mutex) : mutex_(mutex)
|
||||
{
|
||||
Guard(PyThread_type_lock & mutex) : mutex_(mutex) {
|
||||
PyThread_acquire_lock(mutex_, WAIT_LOCK);
|
||||
}
|
||||
|
||||
~Guard()
|
||||
{
|
||||
|
||||
~Guard() {
|
||||
PyThread_release_lock(mutex_);
|
||||
}
|
||||
};
|
||||
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
||||
#else
|
||||
# define SWIG_GUARD(mutex)
|
||||
# define SWIG_GUARD(mutex)
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
private:
|
||||
/* pointer to the wrapped python object */
|
||||
PyObject* swig_self;
|
||||
PyObject *swig_self;
|
||||
/* flag indicating whether the object is owned by python or c++ */
|
||||
mutable bool swig_disown_flag;
|
||||
|
||||
/* decrement the reference count of the wrapped python object */
|
||||
void swig_decref() const {
|
||||
void swig_decref() const {
|
||||
if (swig_disown_flag) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
Py_DECREF(swig_self);
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
Py_DECREF(swig_self);
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/* wrap a python object, optionally taking ownership */
|
||||
Director(PyObject* self) : swig_self(self), swig_disown_flag(false) {
|
||||
Director(PyObject *self) : swig_self(self), swig_disown_flag(false) {
|
||||
swig_incref();
|
||||
}
|
||||
|
||||
|
||||
/* discard our reference at destruction */
|
||||
virtual ~Director() {
|
||||
swig_decref();
|
||||
swig_decref();
|
||||
}
|
||||
|
||||
|
||||
/* return a pointer to the wrapped python object */
|
||||
PyObject *swig_get_self() const {
|
||||
return swig_self;
|
||||
PyObject *swig_get_self() const {
|
||||
return swig_self;
|
||||
}
|
||||
|
||||
/* acquire ownership of the wrapped python object (the sense of "disown"
|
||||
* is from python) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
/* acquire ownership of the wrapped python object (the sense of "disown" is from python) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
swig_disown_flag=true;
|
||||
swig_incref();
|
||||
}
|
||||
swig_incref();
|
||||
}
|
||||
}
|
||||
|
||||
/* increase the reference count of the wrapped python object */
|
||||
void swig_incref() const {
|
||||
void swig_incref() const {
|
||||
if (swig_disown_flag) {
|
||||
Py_INCREF(swig_self);
|
||||
Py_INCREF(swig_self);
|
||||
}
|
||||
}
|
||||
|
||||
/* methods to implement pseudo protected director members */
|
||||
virtual bool swig_get_inner(const char* /* swig_protected_method_name */) const {
|
||||
virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void swig_set_inner(const char* /* swig_protected_method_name */, bool /* swig_val */) const {
|
||||
|
||||
virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const {
|
||||
}
|
||||
|
||||
/* ownership management */
|
||||
private:
|
||||
typedef std::map<void*, GCItem_var> swig_ownership_map;
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef __THREAD__
|
||||
static PyThread_type_lock swig_mutex_own;
|
||||
|
|
@ -421,33 +386,29 @@ namespace Swig {
|
|||
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership_array(Type *vptr) const
|
||||
{
|
||||
void swig_acquire_ownership_array(Type *vptr) const {
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCArray_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership(Type *vptr) const
|
||||
{
|
||||
void swig_acquire_ownership(Type *vptr) const {
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
void swig_acquire_ownership_obj(void *vptr, int own) const
|
||||
{
|
||||
void swig_acquire_ownership_obj(void *vptr, int own) const {
|
||||
if (vptr && own) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_Object(own);
|
||||
}
|
||||
}
|
||||
|
||||
int swig_release_ownership(void *vptr) const
|
||||
{
|
||||
|
||||
int swig_release_ownership(void *vptr) const {
|
||||
int own = 0;
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
|
|
@ -461,8 +422,7 @@ namespace Swig {
|
|||
}
|
||||
|
||||
template <typename Type>
|
||||
static PyObject* swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
static PyObject *swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||
sobj->own = 0;
|
||||
Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<Type *>(sobj->ptr));
|
||||
|
|
@ -470,7 +430,6 @@ namespace Swig {
|
|||
d->swig_disown();
|
||||
return PyWeakref_NewProxy(pyobj, NULL);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#ifdef __THREAD__
|
||||
|
|
@ -478,7 +437,4 @@ namespace Swig {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
/**** The PySequence C++ Wrap ***/
|
||||
|
||||
%insert(header) %{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%include <std_except.i>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
%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)";
|
||||
|
|
@ -14,6 +15,7 @@
|
|||
%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)";
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%fragment("<stddef.h>"); // For offsetof
|
||||
#endif
|
||||
|
||||
%init %{
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -112,7 +116,7 @@ swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
|||
var = var->next;
|
||||
}
|
||||
if (res == NULL && !PyErr_Occurred()) {
|
||||
PyErr_SetString(PyExc_NameError,"Unknown C global variable");
|
||||
PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -129,7 +133,7 @@ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
|
|||
var = var->next;
|
||||
}
|
||||
if (res == 1 && !PyErr_Occurred()) {
|
||||
PyErr_SetString(PyExc_NameError,"Unknown C global variable");
|
||||
PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|||
}
|
||||
if (!PyTuple_Check(args)) {
|
||||
if (min <= 1 && max >= 1) {
|
||||
register int i;
|
||||
int i;
|
||||
objs[0] = args;
|
||||
for (i = 1; i < max; ++i) {
|
||||
objs[i] = 0;
|
||||
|
|
@ -185,7 +185,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|||
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
|
||||
return 0;
|
||||
} else {
|
||||
register Py_ssize_t l = PyTuple_GET_SIZE(args);
|
||||
Py_ssize_t l = PyTuple_GET_SIZE(args);
|
||||
if (l < min) {
|
||||
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
|
||||
name, (min == max ? "" : "at least "), (int)min, (int)l);
|
||||
|
|
@ -195,7 +195,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|||
name, (min == max ? "" : "at most "), (int)max, (int)l);
|
||||
return 0;
|
||||
} else {
|
||||
register int i;
|
||||
int i;
|
||||
for (i = 0; i < l; ++i) {
|
||||
objs[i] = PyTuple_GET_ITEM(args, i);
|
||||
}
|
||||
|
|
@ -1310,7 +1310,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
|
|||
}
|
||||
} else {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
|
||||
inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
|
||||
if (inst) {
|
||||
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||
|
|
|
|||
|
|
@ -195,9 +195,8 @@ namespace swig {
|
|||
//
|
||||
|
||||
#ifdef SWIG_PYTHON_BACKWARD_COMP
|
||||
%fragment("<string>");
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
PyObject* SwigInt_FromBool(bool b) {
|
||||
return PyInt_FromLong(b ? 1L : 0L);
|
||||
}
|
||||
|
|
@ -257,3 +256,5 @@ namespace swig {
|
|||
#define specialize_std_deque(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
|
||||
#define specialize_std_set(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
|
||||
#define specialize_std_multiset(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
|
||||
#define specialize_std_unordered_set(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
|
||||
#define specialize_std_unordered_multiset(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#undef SWIG_TYPECHECK_BOOL
|
||||
%define SWIG_TYPECHECK_BOOL 10000 %enddef
|
||||
|
||||
/* Include fundamental fragemt definitions */
|
||||
/* Include fundamental fragment definitions */
|
||||
%include <typemaps/fragments.swg>
|
||||
|
||||
/* Look for user fragments file. */
|
||||
|
|
|
|||
17
Lib/python/std_auto_ptr.i
Normal file
17
Lib/python/std_auto_ptr.i
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
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 {};
|
||||
}
|
||||
251
Lib/python/std_unordered_map.i
Normal file
251
Lib/python/std_unordered_map.i
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
Unordered Maps
|
||||
*/
|
||||
|
||||
%fragment("StdMapTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class SwigPySeq, class K, class T >
|
||||
inline void
|
||||
assign(const SwigPySeq& swigpyseq, std::unordered_map<K,T > *unordered_map) {
|
||||
typedef typename std::unordered_map<K,T>::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
unordered_map->insert(value_type(it->first, it->second));
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_asptr<std::unordered_map<K,T> > {
|
||||
typedef std::unordered_map<K,T> unordered_map_type;
|
||||
static int asptr(PyObject *obj, unordered_map_type **val) {
|
||||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
/* In Python 3.x the ".items()" method return a dict_items object */
|
||||
items = PySequence_Fast(items, ".items() havn't returned a sequence!");
|
||||
%#endif
|
||||
res = traits_asptr_stdseq<std::unordered_map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
unordered_map_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<unordered_map_type>(),0);
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <class K, class T >
|
||||
struct traits_from<std::unordered_map<K,T> > {
|
||||
typedef std::unordered_map<K,T> unordered_map_type;
|
||||
typedef typename unordered_map_type::const_iterator const_iterator;
|
||||
typedef typename unordered_map_type::size_type size_type;
|
||||
|
||||
static PyObject *from(const unordered_map_type& unordered_map) {
|
||||
swig_type_info *desc = swig::type_info<unordered_map_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new unordered_map_type(unordered_map), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = unordered_map.size();
|
||||
int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_map size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
PyObject *obj = PyDict_New();
|
||||
for (const_iterator i= unordered_map.begin(); i!= unordered_map.end(); ++i) {
|
||||
swig::SwigVar_PyObject key = swig::from(i->first);
|
||||
swig::SwigVar_PyObject val = swig::from(i->second);
|
||||
PyDict_SetItem(obj, key, val);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct from_key_oper
|
||||
{
|
||||
typedef const ValueType& argument_type;
|
||||
typedef PyObject *result_type;
|
||||
result_type operator()(argument_type v) const
|
||||
{
|
||||
return swig::from(v.first);
|
||||
}
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct from_value_oper
|
||||
{
|
||||
typedef const ValueType& argument_type;
|
||||
typedef PyObject *result_type;
|
||||
result_type operator()(argument_type v) const
|
||||
{
|
||||
return swig::from(v.second);
|
||||
}
|
||||
};
|
||||
|
||||
template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
|
||||
struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
|
||||
{
|
||||
SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_key_oper<typename OutIterator::value_type> >
|
||||
struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
|
||||
template<class OutIterator,
|
||||
class FromOper = from_value_oper<typename OutIterator::value_type> >
|
||||
struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
|
||||
{
|
||||
SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
|
||||
: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename OutIter>
|
||||
inline SwigPyIterator*
|
||||
make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
|
||||
{
|
||||
return new SwigPyMapValueITerator_T<OutIter>(current, begin, end, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%define %swig_unordered_map_common(Map...)
|
||||
%swig_sequence_iterator(Map);
|
||||
%swig_container_methods(Map)
|
||||
|
||||
%extend {
|
||||
mapped_type __getitem__(const key_type& key) const throw (std::out_of_range) {
|
||||
Map::const_iterator i = self->find(key);
|
||||
if (i != self->end())
|
||||
return i->second;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
|
||||
void __delitem__(const key_type& key) throw (std::out_of_range) {
|
||||
Map::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 key_type& key) const {
|
||||
Map::const_iterator i = self->find(key);
|
||||
return i != self->end();
|
||||
}
|
||||
|
||||
PyObject* keys() {
|
||||
Map::size_type size = self->size();
|
||||
int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_map size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
PyObject* keyList = PyList_New(pysize);
|
||||
Map::const_iterator i = self->begin();
|
||||
for (int j = 0; j < pysize; ++i, ++j) {
|
||||
PyList_SET_ITEM(keyList, j, swig::from(i->first));
|
||||
}
|
||||
return keyList;
|
||||
}
|
||||
|
||||
PyObject* values() {
|
||||
Map::size_type size = self->size();
|
||||
int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_map size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
PyObject* valList = PyList_New(pysize);
|
||||
Map::const_iterator i = self->begin();
|
||||
for (int j = 0; j < pysize; ++i, ++j) {
|
||||
PyList_SET_ITEM(valList, j, swig::from(i->second));
|
||||
}
|
||||
return valList;
|
||||
}
|
||||
|
||||
PyObject* items() {
|
||||
Map::size_type size = self->size();
|
||||
int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_map size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
PyObject* itemList = PyList_New(pysize);
|
||||
Map::const_iterator i = self->begin();
|
||||
for (int j = 0; j < pysize; ++i, ++j) {
|
||||
PyList_SET_ITEM(itemList, j, swig::from(*i));
|
||||
}
|
||||
return itemList;
|
||||
}
|
||||
|
||||
// Python 2.2 methods
|
||||
bool __contains__(const key_type& key) {
|
||||
return self->find(key) != self->end();
|
||||
}
|
||||
|
||||
%newobject key_iterator(PyObject **PYTHON_SELF);
|
||||
swig::SwigPyIterator* key_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%newobject value_iterator(PyObject **PYTHON_SELF);
|
||||
swig::SwigPyIterator* value_iterator(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
%pythoncode {def __iter__(self): return self.key_iterator()}
|
||||
%pythoncode {def iterkeys(self): return self.key_iterator()}
|
||||
%pythoncode {def itervalues(self): return self.value_iterator()}
|
||||
%pythoncode {def iteritems(self): return self.iterator()}
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define %swig_unordered_map_methods(Map...)
|
||||
%swig_unordered_map_common(Map)
|
||||
%extend {
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
%include <std/std_unordered_map.i>
|
||||
79
Lib/python/std_unordered_multimap.i
Normal file
79
Lib/python/std_unordered_multimap.i
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Unordered Multimaps
|
||||
*/
|
||||
%include <std_unordered_map.i>
|
||||
|
||||
%fragment("StdUnorderedMultimapTraits","header",fragment="StdSequenceTraits")
|
||||
{
|
||||
namespace swig {
|
||||
template <class SwigPySeq, class K, class T >
|
||||
inline void
|
||||
assign(const SwigPySeq& swigpyseq, std::unordered_multimap<K,T > *unordered_multimap) {
|
||||
typedef typename std::unordered_multimap<K,T>::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
unordered_multimap->insert(value_type(it->first, it->second));
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class T>
|
||||
struct traits_asptr<std::unordered_multimap<K,T> > {
|
||||
typedef std::unordered_multimap<K,T> unordered_multimap_type;
|
||||
static int asptr(PyObject *obj, std::unordered_multimap<K,T> **val) {
|
||||
int res = SWIG_ERROR;
|
||||
if (PyDict_Check(obj)) {
|
||||
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
|
||||
return traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
unordered_multimap_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<unordered_multimap_type>(),0);
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <class K, class T >
|
||||
struct traits_from<std::unordered_multimap<K,T> > {
|
||||
typedef std::unordered_multimap<K,T> unordered_multimap_type;
|
||||
typedef typename unordered_multimap_type::const_iterator const_iterator;
|
||||
typedef typename unordered_multimap_type::size_type size_type;
|
||||
|
||||
static PyObject *from(const unordered_multimap_type& unordered_multimap) {
|
||||
swig_type_info *desc = swig::type_info<unordered_multimap_type>();
|
||||
if (desc && desc->clientdata) {
|
||||
return SWIG_NewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = unordered_multimap.size();
|
||||
int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_multimap size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
PyObject *obj = PyDict_New();
|
||||
for (const_iterator i= unordered_multimap.begin(); i!= unordered_multimap.end(); ++i) {
|
||||
swig::SwigVar_PyObject key = swig::from(i->first);
|
||||
swig::SwigVar_PyObject val = swig::from(i->second);
|
||||
PyDict_SetItem(obj, key, val);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
%define %swig_unordered_multimap_methods(Type...)
|
||||
%swig_map_common(Type);
|
||||
%extend {
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
self->insert(Type::value_type(key,x));
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
%include <std/std_unordered_multimap.i>
|
||||
|
||||
41
Lib/python/std_unordered_multiset.i
Normal file
41
Lib/python/std_unordered_multiset.i
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Unordered Multisets
|
||||
*/
|
||||
|
||||
%include <std_unordered_set.i>
|
||||
|
||||
%fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class SwigPySeq, class T>
|
||||
inline void
|
||||
assign(const SwigPySeq& swigpyseq, std::unordered_multiset<T>* seq) {
|
||||
// seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
|
||||
typedef typename SwigPySeq::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct traits_asptr<std::unordered_multiset<T> > {
|
||||
static int asptr(PyObject *obj, std::unordered_multiset<T> **m) {
|
||||
return traits_asptr_stdseq<std::unordered_multiset<T> >::asptr(obj, m);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_from<std::unordered_multiset<T> > {
|
||||
static PyObject *from(const std::unordered_multiset<T>& vec) {
|
||||
return traits_from_stdseq<std::unordered_multiset<T> >::from(vec);
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
#define %swig_unordered_multiset_methods(Set...) %swig_set_methods(Set)
|
||||
|
||||
|
||||
|
||||
%include <std/std_unordered_multiset.i>
|
||||
55
Lib/python/std_unordered_set.i
Normal file
55
Lib/python/std_unordered_set.i
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Unordered Sets
|
||||
*/
|
||||
|
||||
%fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class SwigPySeq, class T>
|
||||
inline void
|
||||
assign(const SwigPySeq& swigpyseq, std::unordered_set<T>* seq) {
|
||||
// seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
|
||||
typedef typename SwigPySeq::value_type value_type;
|
||||
typename SwigPySeq::const_iterator it = swigpyseq.begin();
|
||||
for (;it != swigpyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct traits_asptr<std::unordered_set<T> > {
|
||||
static int asptr(PyObject *obj, std::unordered_set<T> **s) {
|
||||
return traits_asptr_stdseq<std::unordered_set<T> >::asptr(obj, s);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_from<std::unordered_set<T> > {
|
||||
static PyObject *from(const std::unordered_set<T>& vec) {
|
||||
return traits_from_stdseq<std::unordered_set<T> >::from(vec);
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%define %swig_unordered_set_methods(unordered_set...)
|
||||
%swig_sequence_iterator(unordered_set);
|
||||
%swig_container_methods(unordered_set);
|
||||
|
||||
%extend {
|
||||
void append(value_type x) {
|
||||
self->insert(x);
|
||||
}
|
||||
|
||||
bool __contains__(value_type x) {
|
||||
return self->find(x) != self->end();
|
||||
}
|
||||
|
||||
value_type __getitem__(difference_type i) const throw (std::out_of_range) {
|
||||
return *(swig::cgetpos(self, i));
|
||||
}
|
||||
|
||||
};
|
||||
%enddef
|
||||
|
||||
%include <std/std_unordered_set.i>
|
||||
|
|
@ -114,12 +114,19 @@ signed int *OUTPUT,
|
|||
unsigned int *OUTPUT,
|
||||
short *OUTPUT,
|
||||
signed short *OUTPUT,
|
||||
unsigned short *OUTPUT,
|
||||
long *OUTPUT,
|
||||
signed long *OUTPUT,
|
||||
unsigned long *OUTPUT,
|
||||
long long *OUTPUT,
|
||||
signed long long *OUTPUT,
|
||||
unsigned long long *OUTPUT,
|
||||
float *OUTPUT,
|
||||
double *OUTPUT {}
|
||||
double *OUTPUT,
|
||||
char *OUTPUT,
|
||||
signed char *OUTPUT,
|
||||
unsigned char *OUTPUT
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
#include <exception>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
|
@ -369,7 +370,6 @@ SWIG_R_ConvertPacked(SEXP obj, void *ptr, size_t sz, swig_type_info *ty) {
|
|||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <exception>
|
||||
#define SWIG_exception_noreturn(code, msg) do { throw std::runtime_error(msg); } while(0)
|
||||
#else
|
||||
#define SWIG_exception_noreturn(code, msg) do { return result; } while(0)
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@
|
|||
%typemap("rtype") enum SWIGTYPE * "character";
|
||||
%typemap("rtype") enum SWIGTYPE *const "character";
|
||||
%typemap("rtype") enum SWIGTYPE & "character";
|
||||
%typemap("rtype") enum SWIGTYPE && "character";
|
||||
%typemap("rtype") SWIGTYPE * "$R_class";
|
||||
%typemap("rtype") SWIGTYPE *const "$R_class";
|
||||
%typemap("rtype") SWIGTYPE & "$R_class";
|
||||
%typemap("rtype") SWIGTYPE && "$R_class";
|
||||
%typemap("rtype") SWIGTYPE "$&R_class";
|
||||
|
||||
%typemap("rtypecheck") int, int &, long, long &
|
||||
|
|
@ -85,12 +87,14 @@
|
|||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE &
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE &&
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE *
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE *const
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&
|
||||
%{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref") %}
|
||||
|
||||
/*
|
||||
|
|
@ -100,6 +104,9 @@
|
|||
%typemap(scoercein) SWIGTYPE &
|
||||
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE &&
|
||||
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE
|
||||
%{ $input = coerceIfNotSubclass($input, "$&R_class") %}
|
||||
*/
|
||||
|
|
@ -133,6 +140,9 @@ string &, std::string &
|
|||
%typemap(scoerceout) enum SWIGTYPE &
|
||||
%{ $result = enumFromInteger($result, "$R_class"); %}
|
||||
|
||||
%typemap(scoerceout) enum SWIGTYPE &&
|
||||
%{ $result = enumFromInteger($result, "$R_class"); %}
|
||||
|
||||
%typemap(scoerceout) enum SWIGTYPE *
|
||||
%{ $result = enumToInteger($result, "$R_class"); %}
|
||||
|
||||
|
|
@ -159,6 +169,9 @@ string &, std::string &
|
|||
%typemap(scoerceout) SWIGTYPE &
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE &&
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE *
|
||||
%{ $result <- new("$R_class", ref=$result) ; %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director.swg
|
||||
*
|
||||
* This file contains support for director classes that proxy
|
||||
* method calls from C++ to Ruby extensions.
|
||||
* This file contains support for director classes so that Ruby proxy
|
||||
* methods can be called from C++.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
|
|
@ -15,105 +15,86 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
|
||||
|
||||
namespace Swig {
|
||||
|
||||
/* memory handler */
|
||||
struct GCItem
|
||||
{
|
||||
virtual ~GCItem()
|
||||
{
|
||||
struct GCItem {
|
||||
virtual ~GCItem() {
|
||||
}
|
||||
|
||||
virtual ruby_owntype get_own() const
|
||||
{
|
||||
virtual ruby_owntype get_own() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct GCItem_var
|
||||
{
|
||||
GCItem_var(GCItem *item = 0) : _item(item)
|
||||
{
|
||||
|
||||
struct GCItem_var {
|
||||
GCItem_var(GCItem *item = 0) : _item(item) {
|
||||
}
|
||||
|
||||
GCItem_var& operator=(GCItem *item)
|
||||
{
|
||||
GCItem_var& operator=(GCItem *item) {
|
||||
GCItem *tmp = _item;
|
||||
_item = item;
|
||||
delete tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~GCItem_var()
|
||||
{
|
||||
|
||||
~GCItem_var() {
|
||||
delete _item;
|
||||
}
|
||||
|
||||
GCItem * operator->() const
|
||||
{
|
||||
|
||||
GCItem *operator->() const {
|
||||
return _item;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
GCItem *_item;
|
||||
};
|
||||
|
||||
|
||||
template <typename Type>
|
||||
struct GCItem_T : GCItem
|
||||
{
|
||||
GCItem_T(Type *ptr) : _ptr(ptr)
|
||||
{
|
||||
struct GCItem_T : GCItem {
|
||||
GCItem_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCItem_T()
|
||||
{
|
||||
|
||||
virtual ~GCItem_T() {
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
||||
struct GCItem_Object : GCItem
|
||||
{
|
||||
GCItem_Object(ruby_owntype own) : _own(own)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~GCItem_Object()
|
||||
{
|
||||
struct GCItem_Object : GCItem {
|
||||
GCItem_Object(ruby_owntype own) : _own(own) {
|
||||
}
|
||||
|
||||
ruby_owntype get_own() const
|
||||
{
|
||||
virtual ~GCItem_Object() {
|
||||
}
|
||||
|
||||
ruby_owntype get_own() const {
|
||||
return _own;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
ruby_owntype _own;
|
||||
};
|
||||
|
||||
|
||||
template <typename Type>
|
||||
struct GCArray_T : GCItem
|
||||
{
|
||||
GCArray_T(Type *ptr) : _ptr(ptr)
|
||||
{
|
||||
struct GCArray_T : GCItem {
|
||||
GCArray_T(Type *ptr) : _ptr(ptr) {
|
||||
}
|
||||
|
||||
virtual ~GCArray_T()
|
||||
{
|
||||
|
||||
virtual ~GCArray_T() {
|
||||
delete[] _ptr;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Type *_ptr;
|
||||
};
|
||||
|
|
@ -126,21 +107,18 @@ namespace Swig {
|
|||
int argc;
|
||||
VALUE *argv;
|
||||
};
|
||||
|
||||
|
||||
/* Base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
VALUE swig_error;
|
||||
std::string swig_msg;
|
||||
protected:
|
||||
DirectorException(VALUE error)
|
||||
: swig_error(error)
|
||||
{
|
||||
DirectorException(VALUE error) : swig_error(error) {
|
||||
}
|
||||
|
||||
DirectorException(VALUE error, const char* hdr, const char* msg ="")
|
||||
: swig_error(error), swig_msg(hdr) {
|
||||
if (strlen(msg)) {
|
||||
|
||||
DirectorException(VALUE error, const char *hdr, const char *msg ="") : swig_error(error), swig_msg(hdr) {
|
||||
if (msg[0]) {
|
||||
swig_msg += " ";
|
||||
swig_msg += msg;
|
||||
}
|
||||
|
|
@ -151,56 +129,60 @@ namespace Swig {
|
|||
swig_error = error;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
VALUE getType() const {
|
||||
return CLASS_OF(swig_error);
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
|
||||
VALUE getType() const {
|
||||
return CLASS_OF(swig_error);
|
||||
}
|
||||
|
||||
VALUE getError() const {
|
||||
return swig_error;
|
||||
}
|
||||
const std::string& getMessage() const
|
||||
{
|
||||
|
||||
/* Deprecated, use what() instead */
|
||||
const std::string& getMessage() const {
|
||||
return swig_msg;
|
||||
}
|
||||
|
||||
virtual ~DirectorException() {}
|
||||
};
|
||||
|
||||
/* unknown exception handler */
|
||||
|
||||
class UnknownExceptionHandler
|
||||
{
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
/* unknown exception handler */
|
||||
class UnknownExceptionHandler {
|
||||
#ifdef SWIG_DIRECTOR_UEH
|
||||
static void handler() {
|
||||
try {
|
||||
throw;
|
||||
} catch (DirectorException& e) {
|
||||
std::cerr << "SWIG Director exception caught:" << std::endl
|
||||
<< e.getMessage() << std::endl;
|
||||
<< e.what() << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unknown exception caught." << std::endl;
|
||||
}
|
||||
}
|
||||
std::cerr << std::endl
|
||||
<< "Ruby interpreter traceback:" << std::endl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
||||
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
||||
<< std::endl
|
||||
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
|
||||
throw;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
std::unexpected_handler old;
|
||||
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
||||
{
|
||||
UnknownExceptionHandler(std::unexpected_handler nh = handler) {
|
||||
old = std::set_unexpected(nh);
|
||||
}
|
||||
|
||||
~UnknownExceptionHandler()
|
||||
{
|
||||
~UnknownExceptionHandler() {
|
||||
std::set_unexpected(old);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -208,16 +190,14 @@ namespace Swig {
|
|||
|
||||
|
||||
/* Type mismatch in the return value from a Ruby method call */
|
||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||
class DirectorTypeMismatchException : public DirectorException {
|
||||
public:
|
||||
DirectorTypeMismatchException(VALUE error, const char *msg="")
|
||||
: Swig::DirectorException(error, "SWIG director type mismatch", msg)
|
||||
{
|
||||
: DirectorException(error, "SWIG director type mismatch", msg) {
|
||||
}
|
||||
|
||||
DirectorTypeMismatchException(const char *msg="")
|
||||
: Swig::DirectorException(rb_eTypeError, "SWIG director type mismatch", msg)
|
||||
{
|
||||
: DirectorException(rb_eTypeError, "SWIG director type mismatch", msg) {
|
||||
}
|
||||
|
||||
static void raise(VALUE error, const char *msg) {
|
||||
|
|
@ -230,33 +210,30 @@ namespace Swig {
|
|||
};
|
||||
|
||||
/* Any Ruby exception that occurs during a director method call */
|
||||
class DirectorMethodException : public Swig::DirectorException {
|
||||
class DirectorMethodException : public DirectorException {
|
||||
public:
|
||||
DirectorMethodException(VALUE error)
|
||||
: Swig::DirectorException(error) {
|
||||
DirectorMethodException(VALUE error)
|
||||
: DirectorException(error) {
|
||||
}
|
||||
|
||||
DirectorMethodException(const char* msg = "")
|
||||
: Swig::DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) {
|
||||
DirectorMethodException(const char *msg = "")
|
||||
: DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) {
|
||||
}
|
||||
|
||||
static void raise(VALUE error)
|
||||
{
|
||||
|
||||
static void raise(VALUE error) {
|
||||
throw DirectorMethodException(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Attempted to call a pure virtual method via a director method */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException
|
||||
class DirectorPureVirtualException : public DirectorException
|
||||
{
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg = "")
|
||||
: DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg)
|
||||
{
|
||||
DirectorPureVirtualException(const char *msg = "")
|
||||
: DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg) {
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
static void raise(const char *msg) {
|
||||
throw DirectorPureVirtualException(msg);
|
||||
}
|
||||
};
|
||||
|
|
@ -271,28 +248,25 @@ namespace Swig {
|
|||
# define SWIG_MUTEX_INIT(var) var
|
||||
# else
|
||||
# include <pthread.h>
|
||||
# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER
|
||||
# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __PTHREAD__
|
||||
struct Guard
|
||||
{
|
||||
struct Guard {
|
||||
pthread_mutex_t *_mutex;
|
||||
|
||||
Guard(pthread_mutex_t &mutex) : _mutex(&mutex)
|
||||
{
|
||||
|
||||
Guard(pthread_mutex_t &mutex) : _mutex(&mutex) {
|
||||
pthread_mutex_lock(_mutex);
|
||||
}
|
||||
|
||||
~Guard()
|
||||
{
|
||||
|
||||
~Guard() {
|
||||
pthread_mutex_unlock(_mutex);
|
||||
}
|
||||
};
|
||||
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
||||
#else
|
||||
# define SWIG_GUARD(mutex)
|
||||
# define SWIG_GUARD(mutex)
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
|
|
@ -313,21 +287,20 @@ namespace Swig {
|
|||
}
|
||||
|
||||
/* return a pointer to the wrapped Ruby object */
|
||||
VALUE swig_get_self() const {
|
||||
return swig_self;
|
||||
VALUE swig_get_self() const {
|
||||
return swig_self;
|
||||
}
|
||||
|
||||
/* acquire ownership of the wrapped Ruby object (the sense of "disown"
|
||||
* is from Ruby) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
/* acquire ownership of the wrapped Ruby object (the sense of "disown" is from Ruby) */
|
||||
void swig_disown() const {
|
||||
if (!swig_disown_flag) {
|
||||
swig_disown_flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ownership management */
|
||||
private:
|
||||
typedef std::map<void*, GCItem_var> swig_ownership_map;
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef __PTHREAD__
|
||||
static pthread_mutex_t swig_mutex_own;
|
||||
|
|
@ -335,33 +308,29 @@ namespace Swig {
|
|||
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership_array(Type *vptr) const
|
||||
{
|
||||
void swig_acquire_ownership_array(Type *vptr) const {
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCArray_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership(Type *vptr) const
|
||||
{
|
||||
void swig_acquire_ownership(Type *vptr) const {
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
||||
void swig_acquire_ownership_obj(void *vptr, ruby_owntype own) const
|
||||
{
|
||||
void swig_acquire_ownership_obj(void *vptr, ruby_owntype own) const {
|
||||
if (vptr && own) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_Object(own);
|
||||
}
|
||||
}
|
||||
|
||||
ruby_owntype swig_release_ownership(void *vptr) const
|
||||
{
|
||||
|
||||
ruby_owntype swig_release_ownership(void *vptr) const {
|
||||
ruby_owntype own = 0;
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
|
|
@ -376,6 +345,3 @@ namespace Swig {
|
|||
};
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@
|
|||
|
||||
/**** The RubySequence C++ Wrap ***/
|
||||
|
||||
%insert(header) %{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%include <std_except.i>
|
||||
|
||||
|
|
@ -805,7 +803,6 @@ namespace swig
|
|||
rb_raise( rb_eTypeError, "not a valid index or range" );
|
||||
}
|
||||
|
||||
VALUE r = Qnil;
|
||||
static ID id_end = rb_intern("end");
|
||||
static ID id_start = rb_intern("begin");
|
||||
static ID id_noend = rb_intern("exclude_end?");
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
|
|||
}
|
||||
|
||||
%fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") {
|
||||
%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj))
|
||||
%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj); (void)type)
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(double)(VALUE obj, double *val)
|
||||
|
|
|
|||
|
|
@ -151,14 +151,13 @@ SWIG_Ruby_InitRuntime(void)
|
|||
SWIGRUNTIME void
|
||||
SWIG_Ruby_define_class(swig_type_info *type)
|
||||
{
|
||||
VALUE klass;
|
||||
char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
|
||||
sprintf(klass_name, "TYPE%s", type->name);
|
||||
if (NIL_P(_cSWIG_Pointer)) {
|
||||
_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
|
||||
rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
|
||||
}
|
||||
klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
|
||||
rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
|
||||
free((void *) klass_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#undef SWIG_TYPECHECK_BOOL
|
||||
%define SWIG_TYPECHECK_BOOL 10000 %enddef
|
||||
|
||||
/* Include fundamental fragemt definitions */
|
||||
/* Include fundamental fragment definitions */
|
||||
%include <typemaps/fragments.swg>
|
||||
|
||||
/* Look for user fragments file. */
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@
|
|||
%include <std_alloc.i>
|
||||
%include <std_char_traits.i>
|
||||
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
%fragment("<string>");
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,11 +23,9 @@
|
|||
// Common code for supporting the C++ std namespace
|
||||
//
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <stddef.h>
|
||||
%}
|
||||
%fragment("<string>");
|
||||
%fragment("<stdexcept>");
|
||||
%fragment("<stddef.h>");
|
||||
|
||||
|
||||
%fragment("StdIteratorTraits","header",fragment="<stddef.h>") %{
|
||||
|
|
@ -73,7 +71,7 @@ namespace std {
|
|||
#endif
|
||||
%}
|
||||
|
||||
%fragment("StdTraitsCommon","header") %{
|
||||
%fragment("StdTraitsCommon","header",fragment="<string>") %{
|
||||
namespace swig {
|
||||
template <class Type>
|
||||
struct noconst_traits {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@
|
|||
void resize(size_type new_size);
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
iterator erase(iterator pos);
|
||||
iterator erase(iterator first, iterator last);
|
||||
%extend {
|
||||
// %extend wrapper used for differing definitions of these methods introduced in C++11
|
||||
iterator erase(iterator pos) { return $self->erase(pos); }
|
||||
iterator erase(iterator first, iterator last) { return $self->erase(first, last); }
|
||||
}
|
||||
#endif
|
||||
|
||||
%enddef
|
||||
|
|
@ -68,8 +71,11 @@
|
|||
void resize(size_type new_size, const value_type& x);
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
iterator insert(iterator pos, const value_type& x);
|
||||
void insert(iterator pos, size_type n, const value_type& x);
|
||||
%extend {
|
||||
// %extend wrapper used for differing definitions of these methods introduced in C++11
|
||||
iterator insert(iterator pos, const value_type& x) { return $self->insert(pos, x); }
|
||||
void insert(iterator pos, size_type n, const value_type& x) { $self->insert(pos, n, x); }
|
||||
}
|
||||
#endif
|
||||
|
||||
%enddef
|
||||
|
|
@ -89,8 +95,11 @@
|
|||
void resize(size_type new_size, value_type x);
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
iterator insert(iterator pos, value_type x);
|
||||
void insert(iterator pos, size_type n, value_type x);
|
||||
%extend {
|
||||
// %extend wrapper used for differing definitions of these methods introduced in C++11
|
||||
iterator insert(iterator pos, value_type x) { return $self->insert(pos, x); }
|
||||
void insert(iterator pos, size_type n, value_type x) { $self->insert(pos, n, x); }
|
||||
}
|
||||
#endif
|
||||
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@
|
|||
size_type count(const key_type& x) const;
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
// iterator insert(iterator position, const value_type& x);
|
||||
void erase(iterator position);
|
||||
void erase(iterator first, iterator last);
|
||||
%extend {
|
||||
// %extend wrapper used for differing definitions of these methods introduced in C++11
|
||||
void erase(iterator position) { $self->erase(position); }
|
||||
void erase(iterator first, iterator last) { $self->erase(first, last); }
|
||||
}
|
||||
|
||||
iterator find(const key_type& x);
|
||||
iterator lower_bound(const key_type& x);
|
||||
|
|
@ -55,9 +57,9 @@
|
|||
|
||||
%{
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<algorithm>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
// exported class
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue