diff --git a/linux/bin/swig/bin/swig b/linux/bin/swig/bin/swig index cdfcc0ab..fc5049cb 100755 Binary files a/linux/bin/swig/bin/swig and b/linux/bin/swig/bin/swig differ diff --git a/linux/bin/swig/share/swig/4.1.0/allkw.swg b/linux/bin/swig/share/swig/4.1.0/allkw.swg index 2d3cf6ea..5e4cb830 100755 --- a/linux/bin/swig/share/swig/4.1.0/allkw.swg +++ b/linux/bin/swig/share/swig/4.1.0/allkw.swg @@ -1,5 +1,5 @@ -#ifndef __Lib_allkw_swg__ -#define __Lib_allkw_swg__ +#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG +#define SWIG_INCLUDED_LIB_ALLKW_SWG /* @@ -30,4 +30,4 @@ %include -#endif //__Lib_allkw_swg__ +#endif // SWIG_INCLUDED_LIB_ALLKW_SWG diff --git a/linux/bin/swig/share/swig/4.1.0/cffi/cffi.swg b/linux/bin/swig/share/swig/4.1.0/cffi/cffi.swg deleted file mode 100755 index f7294956..00000000 --- a/linux/bin/swig/share/swig/4.1.0/cffi/cffi.swg +++ /dev/null @@ -1,294 +0,0 @@ -/* Define a C preprocessor symbol that can be used in interface files - to distinguish between the SWIG language modules. */ - -#define SWIG_CFFI - -/* Typespecs for basic types. */ - -%typemap(cin) void ":void"; - -%typemap(cin) char ":char"; -%typemap(cin) char * ":string"; -%typemap(cin) unsigned char ":unsigned-char"; -%typemap(cin) signed char ":char"; - -%typemap(cin) short ":short"; -%typemap(cin) signed short ":short"; -%typemap(cin) unsigned short ":unsigned-short"; - -%typemap(cin) int ":int"; -%typemap(cin) signed int ":int"; -%typemap(cin) unsigned int ":unsigned-int"; - -%typemap(cin) long ":long"; -%typemap(cin) signed long ":long"; -%typemap(cin) unsigned long ":unsigned-long"; - -%typemap(cin) long long ":long-long"; -%typemap(cin) signed long long ":long-long"; -%typemap(cin) unsigned long long ":unsigned-long-long"; - -%typemap(cin) float ":float"; -%typemap(cin) double ":double"; -%typemap(cin) SWIGTYPE ":pointer"; - -%typemap(cout) void ":void"; - -%typemap(cout) char ":char"; -%typemap(cout) char * ":string"; -%typemap(cout) unsigned char ":unsigned-char"; -%typemap(cout) signed char ":char"; - -%typemap(cout) short ":short"; -%typemap(cout) signed short ":short"; -%typemap(cout) unsigned short ":unsigned-short"; - -%typemap(cout) int ":int"; -%typemap(cout) signed int ":int"; -%typemap(cout) unsigned int ":unsigned-int"; - -%typemap(cout) long ":long"; -%typemap(cout) signed long ":long"; -%typemap(cout) unsigned long ":unsigned-long"; - -%typemap(cout) long long ":long-long"; -%typemap(cout) signed long long ":long-long"; -%typemap(cout) unsigned long long ":unsigned-long-long"; - -%typemap(cout) float ":float"; -%typemap(cout) double ":double"; -%typemap(cout) SWIGTYPE ":pointer"; - - -%typemap(ctype) bool "int"; -%typemap(ctype) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype"; -%typemap(ctype) SWIGTYPE "$&1_type"; - -%typemap(in) bool "$1 = (bool)$input;"; -%typemap(in) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; -%typemap(in) SWIGTYPE "$1 = *$input;"; - -%typemap(out) void ""; -%typemap(out) bool "$result = (int)$1;"; -%typemap(out) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_INTEGER) - unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, - SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; -/* This maps C/C++ types to Lisp classes for overload dispatch */ - -%typemap(lisptype) bool "cl:boolean"; -%typemap(lisptype) char "cl:character"; -%typemap(lisptype) unsigned char "cl:integer"; -%typemap(lisptype) signed char "cl:integer"; - -%typemap(lispclass) bool "t"; -%typemap(lispclass) char "cl:character"; -%typemap(lispclass) unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE "cl:integer"; -/* CLOS methods can't be specialized on single-float or double-float */ -%typemap(lispclass) float "cl:number"; -%typemap(lispclass) double "cl:number"; -%typemap(lispclass) char * "cl:string"; - -/* Array reference typemaps */ -%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } - -/* const pointers */ -%apply SWIGTYPE * { SWIGTYPE *const } -%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } -%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -%} - -%insert("swiglisp") %{ -;;;SWIG wrapper code starts here - -(cl:defmacro defanonenum (cl:&body enums) - "Converts anonymous enums to defconstants." - `(cl:progn ,@(cl:loop for value in enums - for index = 0 then (cl:1+ index) - when (cl:listp value) do (cl:setf index (cl:second value) - value (cl:first value)) - collect `(cl:defconstant ,value ,index)))) - -(cl:eval-when (:compile-toplevel :load-toplevel) - (cl:unless (cl:fboundp 'swig-lispify) - (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) - (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) - (cl:cond - ((cl:null lst) - rest) - ((cl:upper-case-p c) - (helper (cl:cdr lst) 'upper - (cl:case last - ((lower digit) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:lower-case-p c) - (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest))) - ((cl:digit-char-p c) - (helper (cl:cdr lst) 'digit - (cl:case last - ((upper lower) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:char-equal c #\_) - (helper (cl:cdr lst) '_ (cl:cons #\- rest))) - (cl:t - (cl:error "Invalid character: ~A" c))))) - (cl:let ((fix (cl:case flag - ((constant enumvalue) "+") - (variable "*") - (cl:t "")))) - (cl:intern - (cl:concatenate - 'cl:string - fix - (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil)) - fix) - package)))))) - -;;;SWIG wrapper code ends here -%} - -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -////////////////////////////////////////////////////////////// - -/* name conversion for overloaded operators. */ -#ifdef __cplusplus -%rename(__add__) *::operator+; -%rename(__pos__) *::operator+(); -%rename(__pos__) *::operator+() const; - -%rename(__sub__) *::operator-; -%rename(__neg__) *::operator-() const; -%rename(__neg__) *::operator-(); - -%rename(__mul__) *::operator*; -%rename(__deref__) *::operator*(); -%rename(__deref__) *::operator*() const; - -%rename(__div__) *::operator/; -%rename(__mod__) *::operator%; -%rename(__logxor__) *::operator^; -%rename(__logand__) *::operator&; -%rename(__logior__) *::operator|; -%rename(__lognot__) *::operator~(); -%rename(__lognot__) *::operator~() const; - -%rename(__not__) *::operator!(); -%rename(__not__) *::operator!() const; - -%rename(__assign__) *::operator=; - -%rename(__add_assign__) *::operator+=; -%rename(__sub_assign__) *::operator-=; -%rename(__mul_assign__) *::operator*=; -%rename(__div_assign__) *::operator/=; -%rename(__mod_assign__) *::operator%=; -%rename(__logxor_assign__) *::operator^=; -%rename(__logand_assign__) *::operator&=; -%rename(__logior_assign__) *::operator|=; - -%rename(__lshift__) *::operator<<; -%rename(__lshift_assign__) *::operator<<=; -%rename(__rshift__) *::operator>>; -%rename(__rshift_assign__) *::operator>>=; - -%rename(__eq__) *::operator==; -%rename(__ne__) *::operator!=; -%rename(__lt__) *::operator<; -%rename(__gt__) *::operator>; -%rename(__lte__) *::operator<=; -%rename(__gte__) *::operator>=; - -%rename(__and__) *::operator&&; -%rename(__or__) *::operator||; - -%rename(__preincr__) *::operator++(); -%rename(__postincr__) *::operator++(int); -%rename(__predecr__) *::operator--(); -%rename(__postdecr__) *::operator--(int); - -%rename(__comma__) *::operator,(); -%rename(__comma__) *::operator,() const; - -%rename(__member_ref__) *::operator->; -%rename(__member_func_ref__) *::operator->*; - -%rename(__funcall__) *::operator(); -%rename(__aref__) *::operator[]; -#endif - - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -#include -%} diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i b/linux/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i index fa3f53a2..355a910c 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i @@ -32,7 +32,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -372,7 +372,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i index 508c0ec1..d47fab55 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i @@ -29,10 +29,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -122,7 +122,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/csharp.swg b/linux/bin/swig/share/swig/4.1.0/csharp/csharp.swg index 0e180f57..1f80d12a 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/csharp.swg +++ b/linux/bin/swig/share/swig/4.1.0/csharp/csharp.swg @@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" @@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %} %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; } %} -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %} %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{ char buf[128]; @@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { "$csinput" %typemap(csin) char *, char *&, char[ANY], char[] "$csinput" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)" -%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)" %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)" /* The csout typemap is used for converting function return types from the return type @@ -913,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} // Derived proxy classes @@ -926,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} %enddef @@ -945,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } %} %typemap(csbody) TYPE (CLASS::*) %{ diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_array.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_array.i index a4f0f964..6e7fe9eb 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_array.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_array.i @@ -16,7 +16,7 @@ %define SWIG_STD_ARRAY_INTERNAL(T, N) -%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n" %proxycode %{ public $csclassname(global::System.Collections.ICollection c) : this() { if (c == null) diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i index 1d91c987..da15df3e 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i @@ -1,25 +1,38 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (ctype) std::auto_ptr "void *" -%typemap (imtype, out="System.IntPtr") std::auto_ptr "HandleRef" -%typemap (cstype) std::auto_ptr "$typemap(cstype, TYPE)" -%typemap (out) std::auto_ptr %{ - $result = (void *)$1.release(); +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); %} -%typemap(csout, excode=SWIGEXCODE) std::auto_ptr { - 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; + +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_list.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_list.i index 674aba0a..cf6f2023 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_list.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_list.i @@ -19,7 +19,7 @@ // MACRO for use within the std::list class body %define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...) -%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * }; diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_map.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_map.i index e538a03a..7a118569 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_map.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_map.i @@ -26,7 +26,7 @@ /* K is the C++ key type, T is the C++ value type */ %define SWIG_STD_MAP_INTERNAL(K, T, C) -%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n" %proxycode %{ public $typemap(cstype, T) this[$typemap(cstype, K) key] { diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_set.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_set.i index 82f010af..01215226 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_set.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_set.i @@ -28,7 +28,7 @@ namespace std { template class set { -%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n" %proxycode %{ void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) { ((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item); diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i new file mode 100755 index 00000000..0a4caafb --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::unique_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::unique_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_vector.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_vector.i index ecb10dfb..a2add584 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_vector.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_vector.i @@ -19,7 +19,7 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) -%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %proxycode %{ public $csclassname(global::System.Collections.IEnumerable c) : this() { if (c == null) diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/std_wstring.i b/linux/bin/swig/share/swig/4.1.0/csharp/std_wstring.i index 162b90e8..1d10ca80 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/std_wstring.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/std_wstring.i @@ -2,7 +2,9 @@ * std_wstring.i * * Typemaps for std::wstring and const std::wstring& - * These are mapped to a C# String and are passed around by value. + * std::wstring is mapped to a C# Unicode string (UTF16) and is passed around by value. + * std::wstring support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * To use non-const std::wstring references use the following %apply. Note * that they are passed by value. @@ -15,6 +17,28 @@ #include %} +%fragment("Swig_csharp_UTF16ToWString", "header") %{ +/* For converting from .NET UTF16 (2 byte unicode) strings. wchar_t is 2 bytes on Windows, 4 bytes on Linux. */ +static std::wstring Swig_csharp_UTF16ToWString(const unsigned short *str) { + if (sizeof(wchar_t) == 2) { + return std::wstring((wchar_t *)str); + } else { + const unsigned short *pBegin(str); + const unsigned short *ptr(pBegin); + + while (*ptr != 0) + ++ptr; + + std::wstring result; + result.reserve(ptr - pBegin); + while(pBegin != ptr) + result.push_back(*pBegin++); + + return result; + } +} +%} + namespace std { %naturalvar wstring; @@ -22,31 +46,33 @@ namespace std { class wstring; // wstring -%typemap(ctype, out="void *") wstring "wchar_t *" +%typemap(ctype, out="void *") wstring "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) wstring "string" %typemap(cstype) wstring "string" %typemap(csdirectorin) wstring "$iminput" %typemap(csdirectorout) wstring "$cscall" -%typemap(in, canthrow=1) wstring +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $1.assign($input); %} -%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %} + $1 = Swig_csharp_UTF16ToWString($input); %} +%typemap(out) wstring %{ $result = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} -%typemap(directorout, canthrow=1) wstring +%typemap(directorout, canthrow=1) wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $result.assign($input); %} + $result = Swig_csharp_UTF16ToWString($input); %} -%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csin) wstring "$csinput" %typemap(csout, excode=SWIGEXCODE) wstring { @@ -57,29 +83,30 @@ class wstring; %typemap(typecheck) wstring = wchar_t *; %typemap(throws, canthrow=1) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} // const wstring & -%typemap(ctype, out="void *") const wstring & "wchar_t *" +%typemap(ctype, out="void *") const wstring & "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) const wstring & "string" %typemap(cstype) const wstring & "string" %typemap(csdirectorin) const wstring & "$iminput" %typemap(csdirectorout) const wstring & "$cscall" -%typemap(in, canthrow=1) const wstring & +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") const wstring & %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - std::wstring $1_str($input); + std::wstring $1_str(Swig_csharp_UTF16ToWString($input)); $1 = &$1_str; %} -%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %} +%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_with_length_callback($1->c_str(), (int)$1->size()); %} %typemap(csin) const wstring & "$csinput" %typemap(csout, excode=SWIGEXCODE) const wstring & { @@ -94,10 +121,10 @@ class wstring; } /* possible thread/reentrant code problem */ static std::wstring $1_str; - $1_str = $input; + $1_str = Swig_csharp_UTF16ToWString($input); $result = &$1_str; %} -%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{ set { @@ -112,8 +139,7 @@ class wstring; %typemap(typecheck) const wstring & = wchar_t *; %typemap(throws, canthrow=1) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} } diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/swigmove.i b/linux/bin/swig/share/swig/4.1.0/csharp/swigmove.i new file mode 100755 index 00000000..2f21bd6f --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/csharp/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1, fragment="") SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(csin) SWIGTYPE MOVE "$&csclassname.swigRelease($csinput)" diff --git a/linux/bin/swig/share/swig/4.1.0/csharp/wchar.i b/linux/bin/swig/share/swig/4.1.0/csharp/wchar.i index 1ece767d..f1e0d5a2 100755 --- a/linux/bin/swig/share/swig/4.1.0/csharp/wchar.i +++ b/linux/bin/swig/share/swig/4.1.0/csharp/wchar.i @@ -2,37 +2,58 @@ * wchar.i * * Typemaps for the wchar_t type - * These are mapped to a C# String and are passed around by value. + * wchar_t * is mapped to a C# Unicode string (UTF16) and is passed around by value. + * wchar_t * support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER - * * ----------------------------------------------------------------------------- */ #if !defined(SWIG_CSHARP_NO_WSTRING_HELPER) #if !defined(SWIG_CSHARP_WSTRING_HELPER_) #define SWIG_CSHARP_WSTRING_HELPER_ + +%fragment(""); // TODO: %fragment("") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + delete [] $1; + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +#else +%typemap(memberin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} + +#endif diff --git a/linux/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i index 4a220a58..6d85c5ae 100755 --- a/linux/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i @@ -23,10 +23,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -116,7 +116,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/linux/bin/swig/share/swig/4.1.0/d/dclassgen.swg b/linux/bin/swig/share/swig/4.1.0/d/dclassgen.swg index 84fa03a0..e4ff8d5f 100755 --- a/linux/bin/swig/share/swig/4.1.0/d/dclassgen.swg +++ b/linux/bin/swig/share/swig/4.1.0/d/dclassgen.swg @@ -76,6 +76,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -92,6 +105,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -100,7 +126,7 @@ mixin $imdmodule.SwigOperatorDefinitions; * Type wrapper classes. */ -%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ +%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] %{ private void* swigCPtr; public this(void* cObject, bool futureUse) { @@ -115,6 +141,10 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + return (obj is null) ? null : obj.swigCPtr; +} + mixin $imdmodule.SwigOperatorDefinitions; %} diff --git a/linux/bin/swig/share/swig/4.1.0/d/dswigtype.swg b/linux/bin/swig/share/swig/4.1.0/d/dswigtype.swg index 1d97cb08..c227519e 100755 --- a/linux/bin/swig/share/swig/4.1.0/d/dswigtype.swg +++ b/linux/bin/swig/share/swig/4.1.0/d/dswigtype.swg @@ -52,7 +52,7 @@ %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -62,7 +62,7 @@ #endif %typemap(directorin) SWIGTYPE - "$input = (void *)new $1_ltype((const $1_ltype &)$1);" + "$input = (void *)new $1_ltype(SWIG_STD_MOVE($1));" %typemap(directorout) SWIGTYPE %{ if (!$input) { SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type"); @@ -122,7 +122,7 @@ %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; } %} %typemap(out) SWIGTYPE & "$result = (void *)$1;" @@ -157,11 +157,12 @@ * Rvalue reference conversion typemaps. */ -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && "$result = (void *)$1;" %typemap(directorin) SWIGTYPE && @@ -182,7 +183,7 @@ %typemap(din, nativepointer="cast(void*)$dinput" -) SWIGTYPE && "$dclassname.swigGetCPtr($dinput)" +) SWIGTYPE && "$dclassname.swigRelease($dinput)" %typemap(dout, excode=SWIGEXCODE, nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE && { $dclassname ret = new $dclassname($imcall, $owner);$excode diff --git a/linux/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i new file mode 100755 index 00000000..500b6115 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype) std::auto_ptr< TYPE > "void*" +%typemap (dtype) std::auto_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::auto_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::auto_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i new file mode 100755 index 00000000..9317a7e0 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype) std::unique_ptr< TYPE > "void*" +%typemap (dtype) std::unique_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::unique_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::unique_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/d/swigmove.i b/linux/bin/swig/share/swig/4.1.0/d/swigmove.i new file mode 100755 index 00000000..e2eb8340 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/d/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1) SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(din) SWIGTYPE MOVE "$dclassname.swigRelease($dinput)" diff --git a/linux/bin/swig/share/swig/4.1.0/go/go.swg b/linux/bin/swig/share/swig/4.1.0/go/go.swg index 6e415d2c..348ae5f0 100755 --- a/linux/bin/swig/share/swig/4.1.0/go/go.swg +++ b/linux/bin/swig/share/swig/4.1.0/go/go.swg @@ -388,8 +388,9 @@ %typemap(gotype) SWIGTYPE && %{$gotypename%} -%typemap(in) SWIGTYPE && -%{ $1 = *($&1_ltype)&$input; %} +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) +%{ $1 = *($&1_ltype)&$input; +rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && %{ *($&1_ltype)&$result = $1; %} @@ -625,7 +626,7 @@ %typemap(goout) SWIGTYPE "" %typemap(directorin) SWIGTYPE -%{ $input = new $1_ltype((const $1_ltype &)$1); %} +%{ $input = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(godirectorin) SWIGTYPE "" diff --git a/linux/bin/swig/share/swig/4.1.0/go/std_string.i b/linux/bin/swig/share/swig/4.1.0/go/std_string.i index c362f5c5..35b4a5e4 100755 --- a/linux/bin/swig/share/swig/4.1.0/go/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/go/std_string.i @@ -52,6 +52,9 @@ class string; %typemap(godirectorin,fragment="CopyString") string %{ $result = swigCopyString($input) %} +%typemap(throws) string +%{ _swig_gopanic($1.c_str()); %} + %typemap(in) const string & %{ $*1_ltype $1_str($input.p, $input.n); @@ -88,22 +91,30 @@ class string; %typemap(godirectorin,fragment="CopyString") const string & %{ $result = swigCopyString($input) %} +%typemap(throws) const string & +%{ _swig_gopanic($1.c_str()); %} + %typemap(gotype) string * "*string" %typemap(in) string * (string temp) %{ - temp.assign($input->p, $input->n); - $1 = &temp; + if ($input) { + temp.assign($input->p, $input->n); + $1 = &temp; + } else + $1 = 0; %} %typemap(godirectorout) string * %{ - { + if $input != nil { p := Swig_malloc(len(*$input)) s := (*[1<<30]byte)(unsafe.Pointer(p))[:len(*$input)] copy(s, *$input) $result = (*string)(unsafe.Pointer(&s)) + } else { + $result = nil } %} @@ -125,17 +136,27 @@ class string; %typemap(directorin,fragment="AllocateString") string * (_gostring_ temp) %{ - temp = Swig_AllocateString($1->data(), $1->length()); - $input = &temp; + if ($1) { + temp = Swig_AllocateString($1->data(), $1->length()); + $input = &temp; + } else + $input = 0; %} %typemap(godirectorin,fragment="CopyString") string * %{ *$result = swigCopyString(*$input); %} %typemap(argout,fragment="AllocateString") string * -%{ *$input = Swig_AllocateString($1->data(), $1->length()); %} +%{ + if ($1) + *$input = Swig_AllocateString($1->data(), $1->length()); +%} %typemap(goargout,fragment="CopyString") string * -%{ *$input = swigCopyString(*$1) %} +%{ + if $input != nil { + *$1 = swigCopyString(*$input) + } +%} } diff --git a/linux/bin/swig/share/swig/4.1.0/go/swigmove.i b/linux/bin/swig/share/swig/4.1.0/go/swigmove.i new file mode 100755 index 00000000..e1984b6e --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/go/swigmove.i @@ -0,0 +1,15 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ + argp = ($&1_ltype)$input; + if (argp == NULL) { + _swig_gopanic("Attempt to dereference null $1_type"); + } + SwigValueWrapper< $1_ltype >::reset($1, argp); +%} diff --git a/linux/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg b/linux/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg index 2e96184b..689a1060 100755 --- a/linux/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg +++ b/linux/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg @@ -2,6 +2,12 @@ * guile_scm_run.swg * ----------------------------------------------------------------------------- */ +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" /* For 'volatile SCM *' in at least Guile 3.0 and earlier */ +#endif +#endif + #include #include #include @@ -112,6 +118,8 @@ static SCM swig_symbol = SCM_EOL; ( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \ ? scm_slot_ref(x, swig_symbol) : (x) ) +SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s); + SWIGINTERN SCM SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) { @@ -125,7 +133,7 @@ SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) else SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type); - if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) { + if (!cdata || scm_is_null(cdata->goops_class) || swig_make_func == SCM_EOL ) { return smob; } else { /* the scm_make() C function only handles the creation of gf, @@ -145,7 +153,7 @@ SWIGINTERN unsigned long SWIG_Guile_PointerAddress(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return 0; + if (scm_is_null(smob)) return 0; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -158,7 +166,7 @@ SWIGINTERN swig_type_info * SWIG_Guile_PointerType(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return NULL; + if (scm_is_null(smob)) return NULL; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -185,8 +193,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) swig_cast_info *cast; swig_type_info *from; SCM smob = SWIG_Guile_GetSmob(s); + int ret = SWIG_ERROR; - if (SCM_NULLP(smob)) { + if (scm_is_null(smob)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; #if SCM_MAJOR_VERSION >= 2 @@ -197,22 +206,36 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) } else if (SWIG_Guile_IsValidSmob(smob)) { from = (swig_type_info *) SCM_CELL_WORD_2(smob); if (!from) return SWIG_ERROR; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) { + if ((SCM_CELL_TYPE(smob) == swig_collectable_tag && SCM_CELL_WORD_1(smob) == 0) || SCM_CELL_TYPE(smob) == swig_tag) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + } + if (type) { cast = SWIG_TypeCheckStruct(from, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; + ret = SWIG_OK; } else { return SWIG_ERROR; } } else { *result = (void *) SCM_CELL_WORD_1(smob); - return SWIG_OK; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Guile_MarkPointerNoncollectable(smob); + } + if (flags & SWIG_POINTER_CLEAR) { + SCM_SET_CELL_WORD_1(smob, 0); } } - return SWIG_ERROR; + return ret; } SWIGINTERNINLINE void * @@ -252,7 +275,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_tag); } @@ -265,7 +288,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerDestroyed(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_destroyed_tag); } @@ -486,20 +509,20 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest, int i; int num_args_passed = 0; for (i = 0; i (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/guile/std_string.i b/linux/bin/swig/share/swig/4.1.0/guile/std_string.i index fbd27547..c49bfcb0 100755 --- a/linux/bin/swig/share/swig/4.1.0/guile/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/guile/std_string.i @@ -83,4 +83,13 @@ namespace std { $result = SWIG_str02scm($1.c_str()); } + %typemap(throws) string { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } + + %typemap(throws) const string & { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } } diff --git a/linux/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i new file mode 100755 index 00000000..6f907e90 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/guile/swigmove.i b/linux/bin/swig/share/swig/4.1.0/guile/swigmove.i new file mode 100755 index 00000000..87ab91ea --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/guile/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/guile/swigrun.i b/linux/bin/swig/share/swig/4.1.0/guile/swigrun.i index 4b9ea2c7..e4573eb3 100755 --- a/linux/bin/swig/share/swig/4.1.0/guile/swigrun.i +++ b/linux/bin/swig/share/swig/4.1.0/guile/swigrun.i @@ -4,8 +4,6 @@ #ifdef SWIGGUILE_SCM -/* Hook the runtime module initialization - into the shared initialization function SWIG_Guile_Init. */ %runtime %{ /* Hook the runtime module initialization into the shared initialization function SWIG_Guile_Init. */ diff --git a/linux/bin/swig/share/swig/4.1.0/guile/typemaps.i b/linux/bin/swig/share/swig/4.1.0/guile/typemaps.i index f4d3a011..45a2208f 100755 --- a/linux/bin/swig/share/swig/4.1.0/guile/typemaps.i +++ b/linux/bin/swig/share/swig/4.1.0/guile/typemaps.i @@ -4,17 +4,43 @@ * Guile-specific typemaps * ----------------------------------------------------------------------------- */ +/* These are defined with a view to eventually merging with those defined for other target languages in swigtypemaps.swg and exception.swg */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(_code, _type, _name, _argn) scm_wrong_type_arg((char *) FUNC_NAME, _argn, $input) +#define %as_voidptr(ptr) (void*)(ptr) +#define %argument_nullref(_type, _name, _argn) scm_misc_error(FUNC_NAME, "invalid null reference for argument " #_argn " of type '" _type "'", SCM_EOL) +#define %releasenotowned_fail(_code, _type, _name, _argn) scm_misc_error(FUNC_NAME, "cannot release ownership as memory is not owned for argument " #_argn " of type '" _type "'", SCM_EOL) + /* Pointers */ -%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { +%typemap(in) SWIGTYPE *, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } -%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""; +%typemap(in) SWIGTYPE & ($1_ltype argp) { + argp = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = argp; +} +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +} +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "" %typemap(in) void * { $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0); } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(varin) SWIGTYPE * { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0); @@ -115,8 +141,9 @@ /* Pass-by-value */ -%typemap(in) SWIGTYPE($&1_ltype argp) { +%typemap(in) SWIGTYPE ($&1_ltype argp) { argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } $1 = *argp; } @@ -130,7 +157,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -145,8 +172,7 @@ %typemap(varout) SWIGTYPE #ifdef __cplusplus { - $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype&) $1); + $&1_ltype resultptr = ($&1_ltype)&$1; $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -322,14 +348,14 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* SWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after the function call. */ -%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);"; +%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);" %typemap (freearg) char **INPUT, char **BOTH "if (must_free$argnum) SWIG_free(*$1);" %typemap (freearg) char **OUTPUT "SWIG_free(*$1);" /* But this shall not apply if we try to pass a single char by reference. */ -%typemap (freearg) char *OUTPUT, char *BOTH ""; +%typemap (freearg) char *OUTPUT, char *BOTH "" /* If we set a string variable, delete the old result first, unless const. */ @@ -349,13 +375,13 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* Void */ -%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;"; +%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;" /* SCM is passed through */ typedef unsigned long SCM; -%typemap (in) SCM "$1=$input;"; -%typemap (out) SCM "$result=$1;"; +%typemap (in) SCM "$1=$input;" +%typemap (out) SCM "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) SCM "$1=1;"; /* ------------------------------------------------------------ @@ -373,11 +399,6 @@ typedef unsigned long SCM; * taken from typemaps/swigtype.swg * ------------------------------------------------------------ */ -#define %set_output(obj) $result = obj -#define %set_varoutput(obj) $result = obj -#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input); -#define %as_voidptr(ptr) (void*)(ptr) - %typemap(in) SWIGTYPE (CLASS::*) { int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { @@ -426,7 +447,7 @@ typedef unsigned long SCM; %typecheck(SWIG_TYPECHECK_BOOL) bool, bool&, const bool& { - $1 = SCM_BOOLP($input) ? 1 : 0; + $1 = scm_is_bool($input) ? 1 : 0; } %typecheck(SWIG_TYPECHECK_DOUBLE) diff --git a/linux/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i b/linux/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i index 3bc80b46..072a31e8 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i @@ -33,7 +33,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -342,7 +342,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/linux/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i index 325a6832..ce00162d 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i @@ -29,11 +29,11 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE %{ $input = 0; - *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} + *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { diff --git a/linux/bin/swig/share/swig/4.1.0/java/director.swg b/linux/bin/swig/share/swig/4.1.0/java/director.swg index e911a3da..53651355 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/director.swg +++ b/linux/bin/swig/share/swig/4.1.0/java/director.swg @@ -51,6 +51,10 @@ SWIGINTERN int Swig::GetThreadName(char *name, size_t len) { #endif +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) +#include +#endif + namespace Swig { /* Java object wrapper */ @@ -133,6 +137,19 @@ namespace Swig { } } +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + static void detach(void *jvm) { + static_cast(jvm)->DetachCurrentThread(); + } + + static void make_detach_key() { + pthread_key_create(&detach_key_, detach); + } + + /* thread-local key to register a destructor */ + static pthread_key_t detach_key_; +#endif + private: /* pointer to Java object */ jobject jthis_; @@ -140,6 +157,10 @@ namespace Swig { bool weak_global_; }; +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + pthread_key_t JObjectWrapper::detach_key_; +#endif + /* Local JNI reference deleter */ class LocalRefGuard { JNIEnv *jenv_; @@ -201,9 +222,19 @@ namespace Swig { #else director_->swig_jvm_->AttachCurrentThread(jenv, &args); #endif + +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + // At least on Android 6, detaching after every call causes a memory leak. + // Instead, register a thread desructor and detach only when the thread ends. + // See https://developer.android.com/training/articles/perf-jni#threads + static pthread_once_t once = PTHREAD_ONCE_INIT; + + pthread_once(&once, JObjectWrapper::make_detach_key); + pthread_setspecific(JObjectWrapper::detach_key_, director->swig_jvm_); +#endif } ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) +#if !defined(SWIG_JAVA_DETACH_ON_THREAD_END) && !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. if (env_status == JNI_EDETACHED) diff --git a/linux/bin/swig/share/swig/4.1.0/java/java.swg b/linux/bin/swig/share/swig/4.1.0/java/java.swg index 8f95f3a3..8719818b 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/java.swg +++ b/linux/bin/swig/share/swig/4.1.0/java/java.swg @@ -665,7 +665,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %} +%{ *($&1_ltype*)&$result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -676,7 +676,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)" %typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)" @@ -692,14 +692,15 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } } %typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; } %} -%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input; +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %} %typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) { @@ -1101,7 +1102,8 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } jobjectArray "$javainput" %typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)" -%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE && "$javaclassname.swigRelease($javainput)" %typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)" /* The javaout typemap is used for converting function return types from the return type @@ -1216,6 +1218,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} // Derived proxy classes @@ -1230,6 +1244,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} %enddef @@ -1249,6 +1275,10 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } %} %typemap(javabody) TYPE (CLASS::*) %{ diff --git a/linux/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i index 69ac2841..aee9b482 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i @@ -1,27 +1,41 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (jni) std::auto_ptr "jlong" -%typemap (jtype) std::auto_ptr "long" -%typemap (jstype) std::auto_ptr "$typemap(jstype, TYPE)" -%typemap (out) std::auto_ptr %{ - jlong lpp = 0; - *(TYPE**) &lpp = $1.release(); - $result = lpp; +%typemap (jni) std::auto_ptr< TYPE > "jlong" +%typemap (jtype) std::auto_ptr< TYPE > "long" +%typemap (jstype) std::auto_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > (TYPE *auto_temp) +%{ auto_temp = *(TYPE **)&$input; + $1.reset(auto_temp); %} + +%typemap(javain) std::auto_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; %} -%typemap(javaout) std::auto_ptr { - long cPtr = $jnicall; - return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); - } -%template() std::auto_ptr; + +%typemap(javaout) std::auto_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/java/std_set.i b/linux/bin/swig/share/swig/4.1.0/java/std_set.i index 73e0c2cf..053866bc 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/std_set.i +++ b/linux/bin/swig/share/swig/4.1.0/java/std_set.i @@ -96,6 +96,10 @@ class set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/linux/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i new file mode 100755 index 00000000..838ca495 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) + +%typemap (jni) std::unique_ptr< TYPE > "jlong" +%typemap (jtype) std::unique_ptr< TYPE > "long" +%typemap (jstype) std::unique_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > (TYPE *unique_temp) +%{ unique_temp = *(TYPE **)&$input; + $1.reset(unique_temp); %} + +%typemap(javain) std::unique_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; +%} + +%typemap(javaout) std::unique_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/java/std_unordered_set.i b/linux/bin/swig/share/swig/4.1.0/java/std_unordered_set.i index 59726e94..ddcedf05 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/std_unordered_set.i +++ b/linux/bin/swig/share/swig/4.1.0/java/std_unordered_set.i @@ -92,6 +92,10 @@ class unordered_set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/linux/bin/swig/share/swig/4.1.0/java/std_wstring.i b/linux/bin/swig/share/swig/4.1.0/java/std_wstring.i index 3e462256..efa9e63b 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/std_wstring.i +++ b/linux/bin/swig/share/swig/4.1.0/java/std_wstring.i @@ -88,9 +88,12 @@ class wstring; //%typemap(typecheck) wstring = wchar_t *; %typemap(throws) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} // const wstring & %typemap(jni) const wstring & "jstring" @@ -166,9 +169,12 @@ class wstring; //%typemap(typecheck) const wstring & = wchar_t *; %typemap(throws) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} } diff --git a/linux/bin/swig/share/swig/4.1.0/java/swiginterface.i b/linux/bin/swig/share/swig/4.1.0/java/swiginterface.i index 0a0f7806..c3ca97d3 100755 --- a/linux/bin/swig/share/swig/4.1.0/java/swiginterface.i +++ b/linux/bin/swig/share/swig/4.1.0/java/swiginterface.i @@ -40,7 +40,7 @@ %typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()" %typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE [] %{ *(($&1_ltype)&$input) = ($1_ltype) $1; %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE & diff --git a/linux/bin/swig/share/swig/4.1.0/java/swigmove.i b/linux/bin/swig/share/swig/4.1.0/java/swigmove.i new file mode 100755 index 00000000..671b988a --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/java/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ argp = *($&1_ltype*)&$input; + if (!argp) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(javain) SWIGTYPE MOVE "$&javaclassname.swigRelease($javainput)" diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg index 62f38397..e75ac001 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg @@ -1,6 +1,6 @@ %fragment ("js_check_arg_count", "templates") %{ if (argc != $jsargcount) { - SE_REPORT_ERROR("$jswrapper: wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); return false; }%} @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ %fragment ("js_ctor", "templates") %{ -// js_ctor static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; @@ -39,14 +38,9 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_ctor_dispatcher size_t argc = s.args().size(); bool ret = false; - - // switch all cases by means of series of if-returns. $jsdispatchcases - - // default: SE_REPORT_ERROR("Illegal arguments for construction of $jsname"); return false; } @@ -64,7 +58,6 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_overloaded_ctor const auto& args = s.args(); CC_UNUSED bool ok = true; $jslocals @@ -84,7 +77,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_ctor_dispatch_case", "templates") %{ - // js_ctor_dispatch_case if(argc == $jsargcount) { ret = $jswrapper(s); if (ret) { return ret; } /* reset exception and return */ @@ -99,7 +91,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_dtor", "templates") %{ -// js_dtor static bool $jswrapper(se::State& s) { return true; } @@ -114,7 +105,7 @@ SE_BIND_FINALIZE_FUNC($jswrapper) %} %fragment ("js_dtoroverride", "templates") %{ static bool $jswrapper(se::State& s) -{// js_dtoroverride +{ return true; } SE_BIND_FINALIZE_FUNC($jswrapper) %} @@ -169,7 +160,6 @@ SE_BIND_PROP_SET($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -196,7 +186,6 @@ SE_BIND_FUNC($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function_dispatcher CC_UNUSED bool ok = true; const auto& args = s.args(); size_t argc = args.size(); @@ -216,7 +205,7 @@ SE_BIND_FUNC($jswrapper) %} %fragment ("js_overloaded_function", "templates") %{ static bool $jswrapper(se::State& s) -{// js_overloaded_function +{ $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -233,7 +222,7 @@ static bool $jswrapper(se::State& s) * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function_dispatch_case", "templates") -%{// js_function_dispatch_case +%{ if (argc == $jsargcount) { ok = $jswrapper(s); if (ok) { return true; } diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg index bc2dc57a..22c59276 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg @@ -38,36 +38,32 @@ /* ----------------------------------------------------------------------------- * standard typemaps * ----------------------------------------------------------------------------- */ -/* NEW LANGUAGE NOTE: - the 'checkfn' param is something that I added for typemap(in) - it is an optional fn call to check the type of the lua object - the fn call must be of the form - int checkfn(lua_State *L, int index); - and return 1/0 depending upon if this is the correct type - For the typemap(out), an additional SWIG_arg parameter must be incremented - to reflect the number of values returned (normally SWIG_arg++; will do) -*/ // number - -%typemap(in) int, short, long, signed char, float, double -%{// %typemap(in) int, short, long, signed char, float, double - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +%typemap(in) char, int, short, long, signed char, float, double, int8_t, int16_t, int32_t, int64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // additional check for unsigned numbers, to not permit negative input -%typemap(in) unsigned int, unsigned short, unsigned long, unsigned char -%{// %typemap(in) unsigned int, unsigned short, unsigned long, unsigned char - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); +%typemap(in) unsigned char, unsigned int, unsigned short, unsigned long, unsigned char, uint8_t, uint16_t, uint32_t, uint64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) int,short,long, - unsigned int,unsigned short,unsigned long, +%typemap(out) char, int,short,long, + unsigned char, unsigned int,unsigned short,unsigned long, signed char,unsigned char, - float,double + float,double, + int8_t, int16_t, int32_t, int64_t, + uint8_t, uint16_t, uint32_t, uint64_t, + size_t, ssize_t %{ - // out 1 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); %} + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); %} + +%apply long {long long, signed long long, unsigned long long}; +// size_t (which is just a unsigned long) +%apply unsigned long { size_t }; // we must also provide typemaps for primitives by const reference: // given a function: @@ -75,27 +71,17 @@ // SWIG assumes that this code will need a pointer to int to be passed in // (this might be ok for objects by const ref, but not for numeric primitives) // therefore we add a set of typemaps to fix this (for both in & out) -%typemap(in,checkfn="lua_isnumber") const int& ($*1_ltype temp) +%typemap(in) const int& ($*1_ltype temp), const unsigned int& ($*1_ltype temp) %{ - //temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - $1 = &temp; -%} - -%typemap(in,checkfn="lua_isnumber") const unsigned int& //($*1_ltype temp) -%{ - //SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative"); - // temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + ok &= sevalue_to_native($input, &temp, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(out) const int&, const unsigned int& -%{ // out 2 - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // for the other numbers we can just use an apply statement to cover them @@ -105,192 +91,101 @@ %apply const unsigned int & {const unsigned short&,const unsigned long&, const unsigned char&}; -/* enums have to be handled slightly differently - VC++ .net will not allow a cast from lua_Number(double) to enum directly. -*/ -%typemap(in) enum SWIGTYPE (int32_t temp) -%{ // %typemap(in) enum SWIGTYPE (int32_t temp) - ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1 = ($ltype)temp;%} - -%typemap(out) enum SWIGTYPE (int32_t temp) -%{ // out 4 - s.rval().setInt32(static_cast($1));%} - -// and const refs -%typemap(in) const enum SWIGTYPE &($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE & - temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%} - -%typemap(in) const enum SWIGTYPE &&($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE && - 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++;%} +%apply const long& {const long long&, const signed long long&, const unsigned long long&}; +%apply const unsigned long & { const size_t & }; %typemap(in) bool -%{ // %typemap(in) bool +%{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(out) bool -%{// out 5 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/);%} +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject());%} -// for const bool&, SWIG treats this as a const bool* so we must dereference it -%typemap(in,checkfn="lua_isboolean") const bool& (bool temp) -%{temp=(lua_toboolean(L, $input)!=0); - $1=&temp;%} +%typemap(out) bool & +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject());%} -%typemap(out) const bool& -%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%} - -// strings (char * and char[]) - -%typemap(in) const char * (ccstd::string temp), char * (ccstd::string temp) -%{ +%typemap(in) const char * (ccstd::string temp) +%{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) temp.c_str(); %} -%typemap(in) const char[ANY], char[ANY] -%{$1 = ($ltype)lua_tostring(L, $input);%} - %typemap(out) const char *, char * -%{ // out 6 +%{ ok &= nativevalue_to_se($1, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) const char[ANY], char[ANY] -%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%} - -// char's -// currently treating chars as small strings, not as numbers -// (however signed & unsigned char's are numbers...) -%typemap(in) char -%{$1 = (lua_tostring(L, $input))[0];%} - -%typemap(out) char -%{ lua_pushlstring(L, &$1, 1); SWIG_arg++;%} - -// by const ref -%typemap(in) const char& (char temp) -%{temp = (lua_tostring(L, $input))[0]; $1=&temp;%} - -%typemap(out) const char& -%{ lua_pushlstring(L, $1, 1); SWIG_arg++;%} +%apply const char* {char*, const char[ANY], char[ANY]} // pointers and references -// under SWIG rules, it is ok, to have a pass in a lua nil, +// under SWIG rules, it is ok, to have a pass in a javascript null, // it should be converted to a SWIG NULL. // This will only be allowed for pointers & arrays, not refs or by value -// the checkfn lua_isuserdata will only work for userdata -// the checkfn SWIG_isptrtype will work for both userdata and nil %typemap(in) SWIGTYPE* -%{ // %typemap(in) SWIGTYPE* +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE[] -%{ // %typemap(in) SWIGTYPE[] +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE& ($*ltype temp) -%{// %typemap(in) SWIGTYPE& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(in) SWIGTYPE&& ($*ltype temp) -%{// %typemap(in) SWIGTYPE&& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} // out is simple %typemap(out) SWIGTYPE& -%{ // %typemap(out) SWIGTYPE& - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE(*$1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE* -%{ // %typemap(out) SWIGTYPE* - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE&& -%{ // %typemap(out) SWIGTYPE&& - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} -// dynamic casts -// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is -// the we return it as the correct type -%typemap(out) SWIGTYPE *DYNAMIC, - SWIGTYPE &DYNAMIC -{ - swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); - SWIG_NewPointerObj222(L,(void*)$1,ty,$owner); SWIG_arg++; -} - - // passing objects by value // SWIG_ConvertPtr wants an object pointer (the $<ype argp) // then dereferences it to get the object %typemap(in) SWIGTYPE //($<ype argp) %{ - // %typemap(in) SWIGTYPE value in ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} - -// Also needed for object ptrs by const ref -// eg A* const& ref_pointer(A* const& a); -// found in mixed_types.i -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE *const&($*ltype temp) -%{temp=($*ltype)SWIG_MustGetPtr111(L,$input,$*descriptor,0,$argnum,"$symname"); -$1=($1_ltype)&temp;%} - -%typemap(out) SWIGTYPE *const& -%{ // %typemap(out) SWIGTYPE *const& - SWIG_NewPointerObj333(L,*$1,$*descriptor,$owner); SWIG_arg++; %} - - -// DISOWN-ing typemaps -// if you have an object pointer which must be disowned, use this typemap -// eg. for void destroy_foo(Foo* toDie); -// use %apply SWIGTYPE* DISOWN {Foo* toDie}; -// you could just use %delobject, but this is more flexible -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] -%{ // %typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] - if (!SWIG_IsOK(SWIG_ConvertPtrIn222(L,$input,(void**)&$1,$descriptor,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("$symname",$argnum,$descriptor); - } -%} - - // Primitive types--return by value // must make a new object, copy the data & return the new object // Note: the brackets are {...} and not %{..%}, because we want them to be included in the wrapper // this is because typemap(out) does not support local variables, like in typemap(in) does // and we need the $&1_ltype resultptr; to be declared %typemap(out) SWIGTYPE -%{ // %typemap(out) SWIGTYPE +%{ ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} @@ -299,17 +194,14 @@ $1=($1_ltype)&temp;%} // so the standard wrapping cannot be done // nor can you cast a member function pointer to a void* (obviously) // therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written -%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) +%typemap(in) SWIGTYPE (CLASS::*) %{ - // %typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) - if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor))) - SWIG_fail_ptr("$symname",$argnum,$descriptor); + static_assert(false, "Binding member function pointer is not supported!"); %} %typemap(out) SWIGTYPE (CLASS::*) %{ - // %typemap(out) SWIGTYPE (CLASS::*) - SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++; + static_assert(false, "Returning member function pointer is not supported!"); %} @@ -320,20 +212,9 @@ $1=($1_ltype)&temp;%} A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) but if it's an output, then it should be wrapped like any other SWIG object (using default typemap) */ -%typemap(in,checkfn="SWIG_isptrtype") void* +%typemap(in) void* %{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor");%} - -/* long long is another special case: -as lua only supports one numeric type (lua_Number), we will just -cast it to that & accept the loss of precision. -An alternative solution would be a long long struct or class -with the relevant operators. -*/ -%apply long {long long, signed long long, unsigned long long}; -%apply const long& {const long long&, const signed long long&, const unsigned long long&}; - - + SE_PRECONDITION2(ok, false, "Error processing arguments");%} /* ----------------------------------------------------------------------------- * typecheck rules @@ -343,100 +224,10 @@ These define the detection routines which will spot what parameters match which function */ -// unfortunately lua only considers one type of number -// so all numbers (int,float,double) match -// you could add an advanced fn to get type & check if it's integral -%typecheck(SWIG_TYPECHECK_INTEGER) - int, short, long, - unsigned int, unsigned short, unsigned long, - signed char, unsigned char, - long long, unsigned long long, signed long long, - const int &, const short &, const long &, - 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&, const enum SWIGTYPE &&, - float, double, const float &, const double& -{ - $1 = lua_isnumber(L,$input); -} - -// %typecheck(SWIG_TYPECHECK_BOOL) -// bool, const bool & -// { -// $1 = lua_isboolean(L,$input); -// } - -// special check for a char (string of length 1) -// %typecheck(SWIG_TYPECHECK_CHAR,fragment="SWIG_lua_isnilstring") char, const char& { -// $1 = SWIG_lua_isnilstring(L,$input) && (lua_rawlen(L,$input)==1); -// } - -// %typecheck(SWIG_TYPECHECK_STRING,fragment="SWIG_lua_isnilstring") char *, char[] { -// $1 = SWIG_lua_isnilstring(L,$input); -// } - %typemap(in) SWIGTYPE *self %{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} + if (nullptr == $1) return true;%} -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr61(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_ConvertPtr62(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr63(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr64(L,$input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr65(L,$input, (void **) &ptr, 0, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// // Also needed for object pointers by const ref -// // eg const A* ref_pointer(A* const& a); -// // found in mixed_types.i -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& -// { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr66(L,$input, (void **) &ptr, $*descriptor, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } /* ----------------------------------------------------------------------------- * Others @@ -451,16 +242,14 @@ parameters match which function %apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } %apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } -// size_t (which is just a unsigned long) -%apply unsigned long { size_t }; -%apply const unsigned long & { const size_t & }; + /* ----------------------------------------------------------------------------- * Specials * ----------------------------------------------------------------------------- */ // swig::LANGUAGE_OBJ was added to allow containers of native objects -// however it's rather difficult to do this in lua, as you cannot hold pointers +// however it's rather difficult to do this in javascript, as you cannot hold pointers // to native objects (they are held in the interpreter) // therefore for now: just ignoring this feature #ifdef __cplusplus @@ -475,40 +264,16 @@ parameters match which function #endif // __cplusplus -// %typemap(memberin) float [ANY] { -// int i; -// for (i = 0; i < $1_dim0; i++) { -// $1[i] = $input[i]; -// } -// } - -// %typemap(out) float [ANY] { -// int i; -// $result = PyList_New($1_dim0); -// for (i = 0; i < $1_dim0; i++) { -// PyObject *o = PyFloat_FromDouble((double) $1[i]); -// PyList_SetItem($result, i, o); -// } -// } - -// %typemap(check) double %{ -// if ($1 < 0) { -// croak("hahaha Expecting a positive number"); -// } -// %} - // Cocos custom type %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ - // %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) &temp; %} %typemap(out) cc::Float32Array %{ - // %typemap(out) cc::Float32Array ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} \ No newline at end of file diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i index 17e6258a..3942d7a4 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i @@ -32,71 +32,71 @@ assert(s==s2) namespace std { -%naturalvar string; +// %naturalvar string; -%typemap(in) string -%{// string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +// %typemap(in) string +// %{// string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) string -%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string +// %{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in) string *self -%{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} +// %typemap(in) string *self +// %{ $1 = SE_THIS_OBJECT<$*ltype>(s); +// SE_PRECONDITION2($1, false, "Invalid Native Object"); %} -%typemap(in,checkfn="lua_isstring") string* -%{// string* - std::string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} +// %typemap(in,checkfn="lua_isstring") string* +// %{// string* +// std::string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); +// $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} -%typemap(out) string* -%{// out string* - lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string* +// %{// out string* +// lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) -%{ // const std::string& - temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} +// %typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) +// %{ // const std::string& +// temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} -%typemap(out) const string& -%{ // out const string& - lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(out) const string& +// %{ // out const string& +// lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -// %typecheck(SWIG_TYPECHECK_STRING) string, const string& { -// $1 = lua_isstring(L,$input); -// } +// // %typecheck(SWIG_TYPECHECK_STRING) string, const string& { +// // $1 = lua_isstring(L,$input); +// // } -/* -std::string& can be wrapped, but you must inform SWIG if it is in or out +// /* +// std::string& can be wrapped, but you must inform SWIG if it is in or out -eg: -void fn(std::string& str); -Is this an in/out/inout value? +// eg: +// void fn(std::string& str); +// Is this an in/out/inout value? -Therefore you need the usual -%apply (std::string& INOUT) {std::string& str}; -or -%apply std::string& INOUT {std::string& str}; -typemaps to tell SWIG what to do. -*/ +// Therefore you need the usual +// %apply (std::string& INOUT) {std::string& str}; +// or +// %apply std::string& INOUT {std::string& str}; +// typemaps to tell SWIG what to do. +// */ -%typemap(in) string &INPUT=const string &; +// %typemap(in) string &INPUT=const string &; -%typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) -%{ $1 = &temp; %} +// %typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) +// %{ $1 = &temp; %} -%typemap(argout) string &OUTPUT -%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(argout) string &OUTPUT +// %{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -%typemap(in) string &INOUT =const string &; -%typemap(in) string *INOUT %{ - // inout ... string* -%}; +// %typemap(in) string &INOUT =const string &; +// %typemap(in) string *INOUT %{ +// // inout ... string* +// %}; -%typemap(argout) string &INOUT = string &OUTPUT; +// %typemap(argout) string &INOUT = string &OUTPUT; /* A really cut down version of the string class diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg index 20e74787..4d5a9355 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg @@ -7,23 +7,27 @@ #define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0) #define SWIG_fail goto fail -SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) { - JSStringRef message = JSStringCreateWithUTF8CString(type); +SWIGRUNTIME void SWIG_Javascript_Raise_ValueRef(JSContextRef context, JSValueRef *exception, JSValueRef valRef) { JSValueRef error_arguments[1]; JSObjectRef exception_object; - JSValueRef exception_value; - exception_value = JSValueMakeString(context, message); /* Converting the result to an object will let JavascriptCore add "sourceURL" (file) and "line" (number) and "message" to the exception, instead of just returning a raw string. This is extremely important for debugging your errors. Using JSObjectMakeError is better than JSValueToObject because the latter only populates "sourceURL" and "line", but not "message" or any others I don't know about. */ - error_arguments[0] = exception_value; + error_arguments[0] = valRef; exception_object = JSObjectMakeError(context, 1, error_arguments, NULL); /* Return the exception_object */ *exception = exception_object; +} + +SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* msg) { + JSStringRef message = JSStringCreateWithUTF8CString(msg); + JSValueRef exception_value = JSValueMakeString(context, message); + + SWIG_Javascript_Raise_ValueRef(context, exception, exception_value); JSStringRelease(message); } @@ -135,8 +139,15 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob } } - if (flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg index 55c8e4b9..5c8081a8 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg @@ -75,6 +75,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz } %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -166,6 +167,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg index e8fbbeca..fd8e7aa2 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg @@ -41,7 +41,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type) +#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise_ValueRef(context, exception, obj) %insert("runtime") %{ #define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1) diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg index 0af406b9..8ed571df 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg @@ -81,7 +81,7 @@ int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } } @@ -149,7 +149,7 @@ int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } %#endif } diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg index 7e50a8b8..f7627085 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg @@ -96,6 +96,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) { SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); } +SWIGINTERN void SWIG_V8_Raise(SWIGV8_VALUE obj, const char *msg) { + SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_TO_STRING(obj))); +} + + /* Note: There are two contexts for handling errors. A static V8ErrorHandler is used in not overloaded methods. @@ -194,8 +199,15 @@ SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swi *ptr = cdata->swigCObject; } - if(flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; } diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg index cb31100c..c4d341be 100755 --- a/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg @@ -37,7 +37,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type) +#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(obj, type) /* Include the unified typemap library */ %include diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i b/linux/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/lua/argcargv.i b/linux/bin/swig/share/swig/4.1.0/lua/argcargv.i new file mode 100755 index 00000000..94cc8ed4 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/lua/argcargv.i @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + + Use it as follows: + + %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } + extern int mainApp(size_t argc, const char **argv); + + then from lua: + + args = { "arg0", "arg1" } + mainApp(args) + + * ------------------------------------------------------------ */ + +%{ +SWIGINTERN int SWIG_argv_size(lua_State* L, int index) { + int n=0; + while(1){ + lua_rawgeti(L,index,n+1); + if (lua_isnil(L,-1)) + break; + ++n; + lua_pop(L,1); + } + lua_pop(L,1); + return n; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + if (lua_istable(L,$input)) { + int i, size = SWIG_argv_size(L,$input); + $1 = ($1_ltype) size; + $2 = (char **) malloc((size+1)*sizeof(char *)); + for (i = 0; i < size; i++) { + lua_rawgeti(L,$input,i+1); + if (lua_isnil(L,-1)) + break; + $2[i] = (char *)lua_tostring(L, -1); + lua_pop(L,1); + } + $2[i]=NULL; + } else { + $1 = 0; $2 = 0; + lua_pushstring(L,"Expecting argv array"); + lua_error(L); + } +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = lua_istable(L,$input); +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((char *) $2); +} diff --git a/linux/bin/swig/share/swig/4.1.0/lua/lua.swg b/linux/bin/swig/share/swig/4.1.0/lua/lua.swg index 5144f601..12c635d7 100755 --- a/linux/bin/swig/share/swig/4.1.0/lua/lua.swg +++ b/linux/bin/swig/share/swig/4.1.0/lua/lua.swg @@ -213,7 +213,7 @@ SWIG_fail;%} // %apply SWIGTYPE EXCEPTION_BY_VAL {FooBar}; // %apply SWIGTYPE& EXCEPTION_BY_VAL {FooBar&}; // note: need & twice %typemap(throws) SWIGTYPE EXCEPTION_BY_VAL -%{SWIG_NewPointerObj(L,(void *)new $1_ltype(($1_ltype &) $1),$&1_descriptor,1); +%{SWIG_NewPointerObj(L,(void *)new $1_ltype($1),$&1_descriptor,1); SWIG_fail;%} // similar for object reference diff --git a/linux/bin/swig/share/swig/4.1.0/lua/luarun.swg b/linux/bin/swig/share/swig/4.1.0/lua/luarun.swg index 572da470..f47fd4fa 100755 --- a/linux/bin/swig/share/swig/4.1.0/lua/luarun.swg +++ b/linux/bin/swig/share/swig/4.1.0/lua/luarun.swg @@ -1757,6 +1757,7 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *t (if possible) */ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags) { + int ret = SWIG_ERROR; swig_lua_userdata *usr; swig_cast_info *cast; /* special case: lua nil => NULL pointer */ @@ -1773,25 +1774,36 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ if (usr) { + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own) + { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ { - usr->own=0; + usr->own = 0; } if (!type) /* special cast void*, no casting fn */ { *ptr=usr->ptr; - return SWIG_OK; /* ok */ + ret = SWIG_OK; } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) + else { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ + cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + ret = SWIG_OK; + } + } + if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR)) + { + usr->ptr = 0; } } - return SWIG_ERROR; /* error */ + return ret; } SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags, diff --git a/linux/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg b/linux/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg index f8e12846..7d23917e 100755 --- a/linux/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg @@ -151,11 +151,17 @@ 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); +%typemap(in,checkfn="lua_isuserdata",fragment="") SWIGTYPE&& (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor); + } } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); %} // out is simple @@ -217,7 +223,7 @@ $1=($1_ltype)&temp;%} #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultptr = new $1_ltype($1); SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++; } #else @@ -248,7 +254,7 @@ $1=($1_ltype)&temp;%} // void (must be empty without the SWIG_arg++) -%typemap(out) void ""; +%typemap(out) void "" /* void* is a special case A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) diff --git a/linux/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i new file mode 100755 index 00000000..b3b71d0f --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i new file mode 100755 index 00000000..ad08f3b0 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/lua/swigmove.i b/linux/bin/swig/share/swig/4.1.0/lua/swigmove.i new file mode 100755 index 00000000..d130e797 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/lua/swigmove.i @@ -0,0 +1,18 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, checkfn="lua_isuserdata", noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $&1_descriptor); + } + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg b/linux/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg index 27907311..57d04081 100755 --- a/linux/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg @@ -125,6 +125,7 @@ struct swig_mz_proxy { Scheme_Type mztype; swig_type_info *type; void *object; + int own; }; static Scheme_Type swig_type; @@ -135,7 +136,7 @@ mz_free_swig(void *p, void *data) { if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type) return; if (proxy->type) { - if (proxy->type->clientdata) { + if (proxy->type->clientdata && proxy->own) { ((Scheme_Prim *)proxy->type->clientdata)(1, (Scheme_Object **)&proxy); } } @@ -143,42 +144,61 @@ mz_free_swig(void *p, void *data) { static Scheme_Object * SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) { - struct swig_mz_proxy *new_proxy; - new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); - new_proxy->mztype = swig_type; - new_proxy->type = type; - new_proxy->object = ptr; - if (owner) { - scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + if (ptr) { + struct swig_mz_proxy *new_proxy; + new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); + new_proxy->mztype = swig_type; + new_proxy->type = type; + new_proxy->object = ptr; + new_proxy->own = owner & SWIG_POINTER_OWN; + if (new_proxy->own) { + scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + } + return (Scheme_Object *) new_proxy; + } else { + return scheme_make_null(); } - return (Scheme_Object *) new_proxy; } static int SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) { swig_cast_info *cast; + int ret = SWIG_ERROR; if (SCHEME_NULLP(s)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } else if (SCHEME_TYPE(s) == swig_type) { struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) s; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE && !proxy->own) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + if (type) { cast = SWIG_TypeCheckStruct(proxy->type, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, proxy->object, &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return 0; + ret = SWIG_OK; } else { - return 1; + return SWIG_ERROR; } } else { *result = proxy->object; - return 0; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + scheme_subtract_finalizer(proxy, mz_free_swig, NULL); + proxy->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + proxy->object = 0; } } - return 1; + return ret; } static SWIGINLINE void * diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i new file mode 100755 index 00000000..c61bc8b2 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/std_string.i b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_string.i index b19e8567..70673ead 100755 --- a/linux/bin/swig/share/swig/4.1.0/mzscheme/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_string.i @@ -52,6 +52,13 @@ namespace std { $result = scheme_make_string($1->c_str()); } + %typemap(throws) string { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } + + %typemap(throws) const string & { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } } diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i new file mode 100755 index 00000000..53cf4669 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i b/linux/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i new file mode 100755 index 00000000..bbfcdcb1 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i b/linux/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i index 09bda2cc..6c31aea5 100755 --- a/linux/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i +++ b/linux/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i @@ -2,6 +2,12 @@ * typemaps.i * ----------------------------------------------------------------------------- */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(code, type, name, argn) scheme_wrong_type(FUNC_NAME, type, argn, argc, argv) +#define %as_voidptr(ptr) (void*)(ptr) + + /* The MzScheme module handles all types uniformly via typemaps. Here are the definitions. */ @@ -66,9 +72,23 @@ #ifdef __cplusplus -%typemap(in) SWIGTYPE &, SWIGTYPE && { +%typemap(in) SWIGTYPE & { $1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0); - if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)"); + if ($1 == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); +} + +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); } %typemap(out) SWIGTYPE &, SWIGTYPE && { @@ -105,8 +125,8 @@ $1 = ($1_type) SWIG_convert_int($input); } -%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; -%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; +%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);" +%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);" /* Pass-by-value */ @@ -127,7 +147,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -143,7 +163,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -270,14 +290,18 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double, REF_MAP(double, SCHEME_REALP, scheme_real_to_double, scheme_make_double, real); +%typemap(throws) char * { + scheme_signal_error("%s: %s", FUNC_NAME, $1); +} + /* Void */ -%typemap(out) void "$result = scheme_void;"; +%typemap(out) void "$result = scheme_void;" /* Pass through Scheme_Object * */ -%typemap (in) Scheme_Object * "$1=$input;"; -%typemap (out) Scheme_Object * "$result=$1;"; +%typemap (in) Scheme_Object * "$1=$input;" +%typemap (out) Scheme_Object * "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) Scheme_Object * "$1=1;"; @@ -291,7 +315,6 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, // $2 = ($2_ltype) temp; //} - /* ------------------------------------------------------------ * Typechecking rules * ------------------------------------------------------------ */ diff --git a/linux/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg b/linux/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg index afb01dae..703b7e44 100755 --- a/linux/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg +++ b/linux/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg @@ -40,9 +40,10 @@ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); } -%typemap(in) SWIGTYPE && { +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); -} + rvrdeleter.reset($1); +%} %typemap(varin) SWIGTYPE & { $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); @@ -93,10 +94,14 @@ $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; } +%typemap(varout) SWIGTYPE { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)&$1, $&1_descriptor); +} + #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype temp = new $ltype((const $1_ltype &) $1); + $&1_ltype temp = new $1_ltype($1); $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)temp, $&1_descriptor); } @@ -110,8 +115,12 @@ #endif +%typemap(varout) SWIGTYPE * { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor); +} + %typemap(directorin) SWIGTYPE { - $<ype temp = new $ltype((const $ltype &)$1); + $<ype temp = new $1_ltype(SWIG_STD_MOVE($1)); swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)temp, $&1_descriptor); args = caml_list_append(args, swig_result); } @@ -180,12 +189,12 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Void */ -%typemap(out) void "$result = Val_unit;"; +%typemap(out) void "$result = Val_unit;" /* Pass through value */ -%typemap (in) CAML_VALUE "$1=$input;"; -%typemap (out) CAML_VALUE "$result=$1;"; +%typemap (in) CAML_VALUE "$1=$input;" +%typemap (out) CAML_VALUE "$result=$1;" #if 0 %include @@ -302,7 +311,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/linux/bin/swig/share/swig/4.1.0/ocaml/std_string.i b/linux/bin/swig/share/swig/4.1.0/ocaml/std_string.i index 712c3bb7..2564cfb3 100755 --- a/linux/bin/swig/share/swig/4.1.0/ocaml/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/ocaml/std_string.i @@ -83,10 +83,22 @@ class wstring; $result = caml_val_string_len($1.c_str(),$1.size()); } +%typemap(varout) string { + $result = caml_val_string_len($1.c_str(),$1.size()); +} + %typemap(out) string * { $result = caml_val_string_len((*$1).c_str(),(*$1).size()); } + +%typemap(varout) string * { + $result = caml_val_string_len((*$1).c_str(),(*$1).size()); +} + %typemap(typecheck) string, const string & = char *; + +%typemap(throws) string, const string & "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());" + } #ifdef ENABLE_CHARPTR_ARRAY diff --git a/linux/bin/swig/share/swig/4.1.0/ocaml/swigmove.i b/linux/bin/swig/share/swig/4.1.0/ocaml/swigmove.i new file mode 100755 index 00000000..32f9903b --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/ocaml/swigmove.i @@ -0,0 +1,11 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0) { + argp1 = ($&1_ltype) caml_ptr_val($input,$&1_descriptor); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/octave/argcargv.i b/linux/bin/swig/share/swig/4.1.0/octave/argcargv.i new file mode 100755 index 00000000..8d455e58 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/octave/argcargv.i @@ -0,0 +1,44 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + if ($input.is_scalar_type()) { + $1 = 0; $2 = NULL; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' is not a list", $symname, $argnum); + } + octave_value_list list = $input.list_value(); + int i, len = list.length(); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' use a non-string", $symname, $argnum); + } + $2[i] = (char *)list(i).string_value().c_str(); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = 0; + const octave_value& ov = $input; + if (!ov.is_scalar_type()) { + octave_value_list list = ov.list_value(); + int i, len = list.length(); + $1 = 1; + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + break; + } + } + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/linux/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i index 668bf435..87c89b5f 100755 --- a/linux/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/linux/bin/swig/share/swig/4.1.0/octave/octheaders.hpp b/linux/bin/swig/share/swig/4.1.0/octave/octheaders.hpp index abf6428e..26e5564d 100755 --- a/linux/bin/swig/share/swig/4.1.0/octave/octheaders.hpp +++ b/linux/bin/swig/share/swig/4.1.0/octave/octheaders.hpp @@ -9,8 +9,8 @@ // g++ -c -include octheaders.hpp ... // -#if !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) -#define _SWIG_OCTAVE_OCTHEADERS_HPP +#if !defined(SWIG_OCTAVE_OCTHEADERS_HPP) +#define SWIG_OCTAVE_OCTHEADERS_HPP // Required C++ headers #include @@ -127,4 +127,4 @@ #include #endif -#endif // !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) +#endif // !defined(SWIG_OCTAVE_OCTHEADERS_HPP) diff --git a/linux/bin/swig/share/swig/4.1.0/octave/octrun.swg b/linux/bin/swig/share/swig/4.1.0/octave/octrun.swg index d94056c8..2973318c 100755 --- a/linux/bin/swig/share/swig/4.1.0/octave/octrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/octave/octrun.swg @@ -232,7 +232,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); const swig_type_info *construct_type; // type of special type object std::vector < type_ptr_pair > types; // our c++ base classes - int own; // whether we call c++ destructors when we die + int thisown; // whether we call c++ destructors when we die typedef std::pair < const swig_octave_member *, octave_value > member_value_pair; typedef std::map < std::string, member_value_pair > member_map; @@ -412,7 +412,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0, bool _always_static = false) - : module(0), construct_type(_ptr ? 0 : _type), own(_own), + : module(0), construct_type(_ptr ? 0 : _type), thisown(_own), always_static(_always_static) { if (_type || _ptr) types.push_back(std::make_pair(_type, _ptr)); @@ -426,7 +426,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } ~octave_swig_type() { - if (own) { + if (thisown) { ++count; for (unsigned int j = 0; j < types.size(); ++j) { if (!types[j].first || !types[j].first->clientdata) @@ -559,7 +559,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } void merge(octave_swig_type &rhs) { - rhs.own = 0; + rhs.thisown = 0; for (unsigned int j = 0; j < rhs.types.size(); ++j) { assert(!rhs.types[j].second.destroyed); #ifdef SWIG_DIRECTORS @@ -582,35 +582,56 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); swig_member_const_iterator swig_members_begin() { return members.begin(); } swig_member_const_iterator swig_members_end() { return members.end(); } - int cast(void **vptr, swig_type_info *type, int *_own, int flags) { + int cast(void **vptr, swig_type_info *type, int *own, int flags) { int res = SWIG_ERROR; - if (_own) - *_own = own; - if (flags &SWIG_POINTER_DISOWN) - own = 0; + int clear_pointer = 0; + + if (own) + *own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !thisown) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | thisown; + if (flags & SWIG_POINTER_DISOWN) { + thisown = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + clear_pointer = 1; + } + } + if (!type && types.size()) { - if(vptr) + if (vptr) { *vptr = types[0].second.ptr; + if (clear_pointer) + types[0].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) if (type == types[j].first) { - if(vptr) + if (vptr) { *vptr = types[j].second.ptr; + if (clear_pointer) + types[j].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) { swig_cast_info *tc = SWIG_TypeCheck(types[j].first->name, type); if (!tc) continue; - if(vptr) { + if (vptr) { int newmemory = 0; *vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(_own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (_own) - *_own = *_own | SWIG_CAST_NEW_MEMORY; - } + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + if (clear_pointer) + types[j].second.ptr = 0; } res = SWIG_OK; break; @@ -619,7 +640,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } bool is_owned() const { - return own; + return thisown; } #ifdef SWIG_DIRECTORS @@ -1526,12 +1547,15 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *type, int flags) { int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (ptr) { #ifdef SWIG_DIRECTORS - Swig::Director *d = Swig::get_rtdir(ptr); - if (d && Swig::swig_director_get_self(d)) - return Swig::swig_director_get_self(d)->as_value(); + Swig::Director *d = Swig::get_rtdir(ptr); + if (d && Swig::swig_director_get_self(d)) + return Swig::swig_director_get_self(d)->as_value(); #endif - return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + } + return octave_value(Matrix()); // null matrix } SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) { diff --git a/linux/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg b/linux/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg index 4acf8e07..4984fddf 100755 --- a/linux/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg @@ -32,8 +32,15 @@ #define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj) // raise -#define SWIG_Octave_Raise(OBJ, TYPE, DESC) error("C++ side threw an exception of type " TYPE) -#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc) +%runtime %{ +SWIGINTERN void SWIG_Octave_Raise(const octave_value &obj, const char *type) { + if (obj.is_string()) + error("%s", obj.string_value().c_str()); + else + error("C++ side threw an exception of type %s", type); +} +%} +#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type) // Include the unified typemap library %include diff --git a/linux/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/octave/swigmove.i b/linux/bin/swig/share/swig/4.1.0/octave/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/octave/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/argcargv.i b/linux/bin/swig/share/swig/4.1.0/perl5/argcargv.i new file mode 100755 index 00000000..48a6047b --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/perl5/argcargv.i @@ -0,0 +1,32 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i; + I32 len; + AV *av = (AV *)SvRV($input); + if (SvTYPE(av) != SVt_PVAV) { + SWIG_croak("in method '$symname', Expecting reference to argv array"); + goto fail; + } + len = av_len(av) + 1; + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + SV **tv = av_fetch(av, i, 0); + $2[i] = SvPV_nolen(*tv); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + AV *av = (AV *)SvRV($input); + $1 = SvTYPE(av) == SVt_PVAV; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/perlhead.swg b/linux/bin/swig/share/swig/4.1.0/perl5/perlhead.swg index bb7c1741..773adee9 100755 --- a/linux/bin/swig/share/swig/4.1.0/perl5/perlhead.swg +++ b/linux/bin/swig/share/swig/4.1.0/perl5/perlhead.swg @@ -4,10 +4,21 @@ #include extern "C" { #endif + +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" +#endif +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" +#if __GNUC__ >= 10 +#pragma GCC diagnostic pop +#endif + /* PERL_REVISION was added in Perl 5.6. */ #if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8) # error SWIG requires Perl >= 5.8.0 diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/perlrun.swg b/linux/bin/swig/share/swig/4.1.0/perl5/perlrun.swg index 28703d1a..71f19cbf 100755 --- a/linux/bin/swig/share/swig/4.1.0/perl5/perlrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/perl5/perlrun.swg @@ -210,6 +210,7 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ swig_cast_info *tc; void *voidptr = (void *)0; SV *tsv = 0; + int check_owned_pointer_release = (flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE; if (own) *own = 0; @@ -286,13 +287,14 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ /* * DISOWN implementation: we need a perl guru to check this one. */ - if (tsv && (flags & SWIG_POINTER_DISOWN)) { + if (tsv && ((flags & SWIG_POINTER_DISOWN) || check_owned_pointer_release)) { /* * almost copy paste code from below SWIG_POINTER_OWN setting */ SV *obj = sv; HV *stash = SvSTASH(SvRV(obj)); GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE); + int owned = 0; if (isGV(gv)) { HV *hv = GvHVn(gv); /* @@ -300,10 +302,21 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ * Hence, to remove ownership, we delete the entry. */ if (hv_exists_ent(hv, obj, 0)) { - hv_delete_ent(hv, obj, 0, 0); + owned = 1; + if (flags & SWIG_POINTER_DISOWN) { + hv_delete_ent(hv, obj, 0, 0); + } } } + if (check_owned_pointer_release && !owned) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } } + + if (tsv && (flags & SWIG_POINTER_CLEAR)) { + SvIV_set(tsv, 0); + } + return SWIG_OK; } diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/perl5/swigmove.i b/linux/bin/swig/share/swig/4.1.0/perl5/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/perl5/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/php/argcargv.i b/linux/bin/swig/share/swig/4.1.0/php/argcargv.i new file mode 100755 index 00000000..e0093c21 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/php/argcargv.i @@ -0,0 +1,40 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int len, i; + zval *val; + zend_array *ar; + if (Z_TYPE($input) != IS_ARRAY) { + SWIG_PHP_Error(E_ERROR, "Type error in '$symname'. Expected array"); + goto fail; + } + ar = Z_ARR($input); + len = zend_array_count(ar); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + i = 0; + ZEND_HASH_FOREACH_VAL(ar, val) { + if (Z_TYPE(*val) != IS_STRING) { + SWIG_PHP_Error(E_ERROR, "Array must use strings only, in '$symname'."); + goto fail; + } + if (i == len) { + SWIG_PHP_Error(E_ERROR, "Array is bigger than zend report in '$symname'."); + goto fail; + } + $2[i++] = Z_STRVAL(*val); + } ZEND_HASH_FOREACH_END(); + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = Z_TYPE($input) == IS_ARRAY; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/linux/bin/swig/share/swig/4.1.0/php/const.i b/linux/bin/swig/share/swig/4.1.0/php/const.i index 6e83ffe8..a74af0d7 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/const.i +++ b/linux/bin/swig/share/swig/4.1.0/php/const.i @@ -12,11 +12,11 @@ unsigned char, signed char, enum SWIGTYPE %{ - zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) bool %{ - zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) float, @@ -48,13 +48,13 @@ { zval z; ZVAL_UNDEF(&z); - SWIG_SetPointerZval(&z, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&z, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&z); zend_declare_class_constant(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &z); } %} -%typemap(classconsttab) SWIGTYPE (CLASS::*) ""; +%typemap(classconsttab) SWIGTYPE (CLASS::*) "" %typemap(consttab) int, unsigned int, @@ -65,10 +65,10 @@ unsigned char, signed char, enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; + "SWIG_LONG_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) bool - "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);"; + "SWIG_BOOL_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) float, double @@ -92,7 +92,7 @@ SWIGTYPE [] { zend_constant c; ZVAL_UNDEF(&c.value); - SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&c.value); c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); @@ -100,4 +100,4 @@ } /* Handled as a global variable. */ -%typemap(consttab) SWIGTYPE (CLASS::*) ""; +%typemap(consttab) SWIGTYPE (CLASS::*) "" diff --git a/linux/bin/swig/share/swig/4.1.0/php/php.swg b/linux/bin/swig/share/swig/4.1.0/php/php.swg index bf388a75..fd092807 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/php.swg +++ b/linux/bin/swig/share/swig/4.1.0/php/php.swg @@ -125,14 +125,31 @@ swig_acquire_ownership_obj((void*)$result, own); %} -%typemap(in, phptype="SWIGTYPE") SWIGTYPE &, - SWIGTYPE && +%typemap(in, phptype="SWIGTYPE") SWIGTYPE & %{ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); return; } %} +%typemap(in, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(&$input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $1_descriptor of $symname"); + return; + } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +%} %typemap(directorout) SWIGTYPE & ($1_ltype tmp), SWIGTYPE && ($1_ltype tmp) @@ -240,9 +257,7 @@ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)$1)); } %} %typemap(out, phptype="int|string") unsigned long long @@ -250,9 +265,7 @@ if ($1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)$1)); } %} @@ -286,9 +299,7 @@ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)(*$1))); } %} %typemap(out, phptype="int|string") const unsigned long long & @@ -296,9 +307,7 @@ if (*$1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)(*$1))); } %} @@ -451,7 +460,7 @@ %typemap(out, phptype="SWIGTYPE") SWIGTYPE { #ifdef __cplusplus - $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultobj = new $1_ltype($1); #else $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type)); memcpy(resultobj, &$1, sizeof($1_type)); @@ -462,10 +471,10 @@ %typemap(directorin) SWIGTYPE %{ ZVAL_UNDEF($input); - SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1); + SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1); %} -%typemap(out, phptype="void") void ""; +%typemap(out, phptype="void") void "" %typemap(out, phptype="string") char [ANY] { diff --git a/linux/bin/swig/share/swig/4.1.0/php/phpinit.swg b/linux/bin/swig/share/swig/4.1.0/php/phpinit.swg index 40f7b076..ae72a10a 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/phpinit.swg +++ b/linux/bin/swig/share/swig/4.1.0/php/phpinit.swg @@ -9,4 +9,8 @@ SWIG_php_minit { zend_class_entry SWIGUNUSED internal_ce; SWIG_InitializeModule((void*)&module_number); +#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0 + /* This hack is needed to avoid segfaults. */ + EG(class_table) = CG(class_table); +#endif %} diff --git a/linux/bin/swig/share/swig/4.1.0/php/phprun.swg b/linux/bin/swig/share/swig/4.1.0/php/phprun.swg index a4968319..d3ad0d26 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/phprun.swg +++ b/linux/bin/swig/share/swig/4.1.0/php/phprun.swg @@ -10,8 +10,6 @@ extern "C" { #endif -#include "php.h" - #if PHP_MAJOR_VERSION < 7 # error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 #endif @@ -195,7 +193,7 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o /* They don't care about the target type, so just pass on the pointer! */ *ptr = value->ptr; } else { - swig_cast_info *tc = SWIG_TypeCheckStruct(value->type, ty); + swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc, value->ptr, &newmemory); @@ -208,10 +206,20 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o *ptr = NULL; } } - if (*ptr == NULL) return SWIG_ERROR; - if (flags & SWIG_POINTER_DISOWN) { - value->newobject = 0; + + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !value->newobject) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (*ptr == NULL) + return SWIG_ERROR; /* should be SWIG_NullReferenceError?? */ + if (flags & SWIG_POINTER_DISOWN) { + value->newobject = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + value->ptr = 0; + } } + return SWIG_OK; } case IS_NULL: diff --git a/linux/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i new file mode 100755 index 00000000..28409165 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/php/std_string.i b/linux/bin/swig/share/swig/4.1.0/php/std_string.i index 8882c0ab..b2039786 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/php/std_string.i @@ -86,5 +86,5 @@ namespace std { /* SWIG will apply the non-const typemap above to const string& without * this more specific typemap. */ - %typemap(argout) const string & ""; + %typemap(argout) const string & "" } diff --git a/linux/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i new file mode 100755 index 00000000..1bf31595 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/php/swigmove.i b/linux/bin/swig/share/swig/4.1.0/php/swigmove.i new file mode 100755 index 00000000..b16a3c54 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/php/swigmove.i @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $&1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $&1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $&1_descriptor of $symname"); + return; + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/php/typemaps.i b/linux/bin/swig/share/swig/4.1.0/php/typemaps.i index 321b1202..718469ed 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/typemaps.i +++ b/linux/bin/swig/share/swig/4.1.0/php/typemaps.i @@ -31,8 +31,8 @@ temp = (Z_TYPE($input) == IS_TRUE); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -57,8 +57,8 @@ temp = (TYPE) zval_get_double(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -82,8 +82,8 @@ temp = (TYPE) zval_get_long(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -122,9 +122,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&o, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%lld", (long long)temp$argnum)); } t_output_helper($result, &o); } @@ -138,9 +136,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= lvalue$argnum && lvalue$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&$arg, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)lvalue$argnum); - ZVAL_STRING(&$arg, temp); + ZVAL_NEW_STR(&$arg, zend_strpprintf(0, "%lld", (long long)lvalue$argnum)); } %} %typemap(argout) long long &OUTPUT @@ -148,9 +144,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= *arg$argnum && *arg$argnum <= (long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%lld", (long long)(*arg$argnum))); } %} @@ -161,9 +155,7 @@ INT_TYPEMAP(unsigned long long); if (temp$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG(&o, temp$argnum); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%llu", (unsigned long long)temp$argnum)); } t_output_helper($result, &o); } @@ -177,9 +169,7 @@ INT_TYPEMAP(unsigned long long); if (lvalue$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($arg, (long)(lvalue$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)lvalue$argnum); - ZVAL_STRING((*$arg), temp); + ZVAL_NEW_STR((*$arg), zend_strpprintf(0, "%llu", (unsigned long long)lvalue$argnum)); } %} %typemap(argout) unsigned long long &OUTPUT @@ -187,9 +177,7 @@ INT_TYPEMAP(unsigned long long); if (*arg$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%llu", (unsigned long long)(*arg$argnum))); } %} diff --git a/linux/bin/swig/share/swig/4.1.0/php/utils.i b/linux/bin/swig/share/swig/4.1.0/php/utils.i index 1343495e..33db942a 100755 --- a/linux/bin/swig/share/swig/4.1.0/php/utils.i +++ b/linux/bin/swig/share/swig/4.1.0/php/utils.i @@ -81,7 +81,7 @@ %{ $*1_ltype swig_val; CONVERT_IN(swig_val, $*1_ltype, *$input); - $1_ltype temp = new $*1_ltype(($*1_ltype)swig_val); + $1_ltype temp = new $*1_ltype(swig_val); swig_acquire_ownership(temp); $result = temp; %} diff --git a/linux/bin/swig/share/swig/4.1.0/pointer.i b/linux/bin/swig/share/swig/4.1.0/pointer.i index ea8e535a..9ac04ebf 100755 --- a/linux/bin/swig/share/swig/4.1.0/pointer.i +++ b/linux/bin/swig/share/swig/4.1.0/pointer.i @@ -4,7 +4,7 @@ %echo "pointer.i is deprecated. Use cpointer.i instead." -%echo "See http://www.swig.org/Doc3.0/Library.html" +%echo "See https://www.swig.org/Doc3.0/Library.html" diff --git a/linux/bin/swig/share/swig/4.1.0/python/README b/linux/bin/swig/share/swig/4.1.0/python/README index fa8ef61e..70968e7d 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/README +++ b/linux/bin/swig/share/swig/4.1.0/python/README @@ -101,4 +101,3 @@ std_container.i general common code for the STD/STL containers std_vectora.i vector + allocator (allocators are now supported in STD/STL) typemaps.i old in/out typemaps (doesn't need to be included) -defarg.swg for processing default arguments with shadow classes diff --git a/linux/bin/swig/share/swig/4.1.0/python/argcargv.i b/linux/bin/swig/share/swig/4.1.0/python/argcargv.i index 717fe733..419803a8 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/argcargv.i +++ b/linux/bin/swig/share/swig/4.1.0/python/argcargv.i @@ -1,13 +1,10 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- + * SWIG library containing argc and argv multi-argument typemaps * ------------------------------------------------------------ */ %fragment("SWIG_AsArgcArgv","header",fragment="SWIG_AsCharPtrAndSize") { SWIGINTERN int -SWIG_AsArgcArgv(PyObject *input, - swig_type_info *ppchar_info, - size_t *argc, char ***argv, int *owner) -{ +SWIG_AsArgcArgv(PyObject *input, swig_type_info *ppchar_info, size_t *argc, char ***argv, int *owner) { void *vptr; int res = SWIG_ConvertPtr(input, &vptr, ppchar_info, 0); if (!SWIG_IsOK(res)) { @@ -51,7 +48,7 @@ SWIG_AsArgcArgv(PyObject *input, } else { /* seems dangerous, but the user asked for it... */ size_t i = 0; - if (argv) { while (*argv[i] != 0) ++i;} + if (argv) { while (*argv[i] != 0) ++i;} if (argc) *argc = i; if (owner) *owner = 0; return SWIG_OK; @@ -66,10 +63,10 @@ SWIG_AsArgcArgv(PyObject *input, %typemap(in,noblock=0,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV) (int res,char **argv = 0, size_t argc = 0, int owner= 0) { res = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &argv, &owner); - if (!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { $1 = 0; $2 = 0; %argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum); - } else { + } else { $1 = %static_cast(argc,$1_ltype); $2 = %static_cast(argv, $2_ltype); } diff --git a/linux/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i index 709e7811..bfd8787c 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i @@ -39,7 +39,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -58,12 +58,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/linux/bin/swig/share/swig/4.1.0/python/builtin.swg b/linux/bin/swig/share/swig/4.1.0/python/builtin.swg index ec092233..5cff6835 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/builtin.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/builtin.swg @@ -6,7 +6,11 @@ SWIGINTERN Py_hash_t SwigPyObject_hash(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; void *ptr = sobj->ptr; +#if PY_VERSION_HEX < 0x03020000 + return (Py_hash_t)(Py_ssize_t)ptr; +#else return (Py_hash_t)ptr; +#endif } SWIGINTERN Py_hash_t @@ -211,7 +215,11 @@ SwigPyStaticVar_Type(void) { sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -295,7 +303,11 @@ SwigPyObjectType(void) { PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -414,7 +426,7 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { SWIGINTERN void SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) { -#if PY_VERSION_HEX >= 0x030900A4 +#if PY_VERSION_HEX >= 0x030900a4 Py_SET_TYPE(type, metatype); #else Py_TYPE(type) = metatype; diff --git a/linux/bin/swig/share/swig/4.1.0/python/defarg.swg b/linux/bin/swig/share/swig/4.1.0/python/defarg.swg deleted file mode 100755 index ba5ff43d..00000000 --- a/linux/bin/swig/share/swig/4.1.0/python/defarg.swg +++ /dev/null @@ -1,37 +0,0 @@ -/* This file defines an internal function for processing default arguments - with proxy classes. - - There seems to be no straightforward way to write proxy functions - involving default arguments. For example : - - def foo(arg1,arg2,*args): - proxyc.foo(arg1,arg2,args) - - This fails because args is now a tuple and SWIG doesn't know what to - do with it. - - This file allows a different approach : - - def foo(arg1,arg2,*args): - proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args) - - Basically, we form a new tuple from the object, call this special - __call_defarg method and it passes control to the real wrapper function. - An ugly hack, but it works. -*/ - -SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) { - PyObject *func; - PyObject *parms; - - if (!PyArg_ParseTuple(args, "OO", &func, &parms)) - return NULL; - - if (!PyCallable_Check(func)) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - return PyObject_Call(func, parms, NULL); -} diff --git a/linux/bin/swig/share/swig/4.1.0/python/embed.i b/linux/bin/swig/share/swig/4.1.0/python/embed.i index efd04878..3fc2d14e 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/embed.i +++ b/linux/bin/swig/share/swig/4.1.0/python/embed.i @@ -29,9 +29,23 @@ As far as I know, this module is C++ safe. #endif %wrapper %{ +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif +#endif #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + #ifdef __cplusplus extern "C" #endif diff --git a/linux/bin/swig/share/swig/4.1.0/python/pyclasses.swg b/linux/bin/swig/share/swig/4.1.0/python/pyclasses.swg index 9d6299ff..31ebdd2a 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pyclasses.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pyclasses.swg @@ -43,7 +43,7 @@ namespace swig { %apply PyObject * {SwigPtr_PyObject}; %apply PyObject * const& {SwigPtr_PyObject const&}; - %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);"; + %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);" /* For output */ diff --git a/linux/bin/swig/share/swig/4.1.0/python/pycontainer.swg b/linux/bin/swig/share/swig/4.1.0/python/pycontainer.swg index 2ddf4c37..d6fdff08 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pycontainer.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pycontainer.swg @@ -15,9 +15,9 @@ #include #if PY_VERSION_HEX >= 0x03020000 -# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj)) +# define SWIGPY_SLICEOBJECT PyObject #else -# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj)) +# define SWIGPY_SLICEOBJECT PySliceObject #endif %} @@ -781,7 +781,7 @@ namespace swig #if 1 %newobject __getslice__; #endif - %newobject __getitem__(PySliceObject *slice); + %newobject __getitem__(SWIGPY_SLICEOBJECT *slice); #if defined(SWIGPYTHON_BUILTIN) %feature("python:slot", "nb_nonzero", functype="inquiry") __nonzero__; @@ -829,13 +829,13 @@ namespace swig %extend { /* typemap for slice object support */ - %typemap(in) PySliceObject* { + %typemap(in) SWIGPY_SLICEOBJECT* { if (!PySlice_Check($input)) { %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); } - $1 = (PySliceObject *) $input; + $1 = (SWIGPY_SLICEOBJECT *) $input; } - %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* { + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) SWIGPY_SLICEOBJECT* { $1 = PySlice_Check($input); } @@ -865,49 +865,49 @@ namespace swig /* Overloaded methods for Python 3 compatibility * (Also useful in Python 2.x) */ - Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + Sequence* __getitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return NULL; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; return swig::getslice(self, id, jd, step); } - void __setitem__(PySliceObject *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::setslice(self, id, jd, step, v); } - void __setitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); } - void __delitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __delitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); diff --git a/linux/bin/swig/share/swig/4.1.0/python/pydocs.swg b/linux/bin/swig/share/swig/4.1.0/python/pydocs.swg index 1eea41b8..5a25423d 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pydocs.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pydocs.swg @@ -2,43 +2,43 @@ // Documentation for use with the autodoc feature. #ifdef SWIG_DOC_DOXYGEN_STYLE -%typemap(doc) SWIGTYPE "@param $1_name $1_type"; -%typemap(doc) SWIGTYPE * "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE & "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"; -%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"; +%typemap(doc) SWIGTYPE "@param $1_name $1_type" +%typemap(doc) SWIGTYPE * "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE & "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE && "@param $1_name $1_type" +%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)" #else -%typemap(doc) SWIGTYPE "$1_name: $1_type"; -%typemap(doc) SWIGTYPE * "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE & "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE && "$1_name: $1_type"; -%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"; +%typemap(doc) SWIGTYPE "$1_name: $1_type" +%typemap(doc) SWIGTYPE * "$1_name: $1_type" +%typemap(doc) const SWIGTYPE & "$1_name: $1_type" +%typemap(doc) const SWIGTYPE && "$1_name: $1_type" +%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)" #endif // Types to use in Python documentation for the parameters of the given C++ type. -%typemap(doctype) bool "boolean"; +%typemap(doctype) bool "boolean" %define int_doctype_for_cppint_type(cppint_type) - %typemap(doctype) cppint_type, unsigned cppint_type "int"; + %typemap(doctype) cppint_type, unsigned cppint_type "int" %enddef %formacro(int_doctype_for_cppint_type, short, int, long, long long) -%typemap(doctype) size_t "int"; +%typemap(doctype) size_t "int" -%typemap(doctype) enum SWIGTYPE "int"; +%typemap(doctype) enum SWIGTYPE "int" -%typemap(doctype) float, double, long double "float"; +%typemap(doctype) float, double, long double "float" -%typemap(doctype) char*, std::string "string"; +%typemap(doctype) char*, std::string "string" %typemap(doctype) SWIGTYPE "$1_basetype" %typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)" diff --git a/linux/bin/swig/share/swig/4.1.0/python/pyerrors.swg b/linux/bin/swig/share/swig/4.1.0/python/pyerrors.swg index 2628de8e..10b694cd 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pyerrors.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pyerrors.swg @@ -64,7 +64,6 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyErr_Format(type, "%s %s", tmp, mesg); else PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { diff --git a/linux/bin/swig/share/swig/4.1.0/python/pyhead.swg b/linux/bin/swig/share/swig/4.1.0/python/pyhead.swg index d3730a8f..6f37160b 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pyhead.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pyhead.swg @@ -30,38 +30,19 @@ #endif -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03030000 return (char *)PyUnicode_AsUTF8(str); -#elif PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) { - newstr = (char *) malloc(len+1); - if (newstr) - memcpy(newstr, cstr, len+1); - } - Py_XDECREF(str); - } - return newstr; #else return PyString_AsString(str); #endif } -#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000 -# define SWIG_Python_str_DelForPy3(x) -#else -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#endif +/* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility + * with any uses in user interface files. */ +#define SWIG_Python_str_DelForPy3(x) SWIGINTERN PyObject* diff --git a/linux/bin/swig/share/swig/4.1.0/python/pyrun.swg b/linux/bin/swig/share/swig/4.1.0/python/pyrun.swg index 081bb2cd..6b119be1 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pyrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pyrun.swg @@ -11,8 +11,8 @@ # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 -# error "This version of SWIG only supports Python 3 >= 3.2" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 +# error "This version of SWIG only supports Python 3 >= 3.3" #endif /* Common SWIG API */ @@ -240,7 +240,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -249,7 +249,8 @@ swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(swig_varlinkobject *v) { +swig_varlink_str(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; @@ -287,7 +288,8 @@ swig_varlink_str(swig_varlinkobject *v) { } SWIGINTERN void -swig_varlink_dealloc(swig_varlinkobject *v) { +swig_varlink_dealloc(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; @@ -298,7 +300,8 @@ swig_varlink_dealloc(swig_varlinkobject *v) { } SWIGINTERN PyObject * -swig_varlink_getattr(swig_varlinkobject *v, char *n) { +swig_varlink_getattr(PyObject *o, char *n) { + swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { @@ -315,7 +318,8 @@ swig_varlink_getattr(swig_varlinkobject *v, char *n) { } SWIGINTERN int -swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { +swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { + swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; while (var) { @@ -348,7 +352,11 @@ swig_varlink_type(void) { sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc) swig_varlink_getattr, /* tp_getattr */ (setattrfunc) swig_varlink_setattr, /* tp_setattr */ 0, /* tp_compare */ @@ -788,6 +796,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } + ((SwigPyObject *)next)->next = sobj->next; sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); @@ -914,7 +923,11 @@ SwigPyObject_TypeOnce(void) { sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 @@ -1090,7 +1103,11 @@ SwigPyPacked_TypeOnce(void) { sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 @@ -1345,12 +1362,19 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !sobj->own) { + res = SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + sobj->ptr = 0; + } + res = SWIG_OK; } - res = SWIG_OK; } else { if (implicit_conv) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; @@ -1495,7 +1519,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) Py_DECREF(inst); inst = 0; } else { - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + PyType_Modified(Py_TYPE(inst)); } } } @@ -1636,28 +1660,33 @@ SWIG_Python_TypeCache(void) { SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { +#ifdef SWIG_LINK_RUNTIME static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif } +#else + void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif return (swig_module_info *) type_pointer; } + +static int interpreter_counter = 0; // how many (sub-)interpreters are using swig_module's types + SWIGRUNTIME void SWIG_Python_DestroyModule(PyObject *obj) { swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); swig_type_info **types = swig_module->types; size_t i; + if (--interpreter_counter != 0) // another sub-interpreter may still be using the swig_module's types + return; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -1687,6 +1716,7 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + ++interpreter_counter; Swig_Capsule_global = pointer; } else { Py_DECREF(pointer); @@ -1746,7 +1776,6 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) } else { PyErr_Format(type, "%s %s", errmesg, mesg); } - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; @@ -1798,7 +1827,6 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); @@ -1820,12 +1848,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif } return result; } diff --git a/linux/bin/swig/share/swig/4.1.0/python/pyruntime.swg b/linux/bin/swig/share/swig/4.1.0/python/pyruntime.swg index 843fa6ce..1d028ada 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pyruntime.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pyruntime.swg @@ -4,21 +4,36 @@ # include #endif -#if defined(_MSC_VER) && _MSC_VER >= 1930 -/* Workaround what seems to be a bug in the Python headers with MSVC 2022. - * https://github.com/swig/swig/issues/2090 - */ -# include +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif #endif #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) /* Use debug wrappers with the Python release dll */ + +#if defined(_MSC_VER) && _MSC_VER >= 1929 +/* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later + * See https://github.com/swig/swig/issues/2090 */ +# include +#endif + # undef _DEBUG # include # define _DEBUG 1 #else # include #endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif %} %insert(runtime) "swigrun.swg"; /* SWIG API */ diff --git a/linux/bin/swig/share/swig/4.1.0/python/pytypemaps.swg b/linux/bin/swig/share/swig/4.1.0/python/pytypemaps.swg index 0eda17cd..0ae25a68 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/pytypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/python/pytypemaps.swg @@ -83,7 +83,7 @@ { SWIG_PY_POINTER, "$symname", 0, 0, (void *)($value), &$descriptor } %typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); -%typemap(constcode) SWIGTYPE ((*)(ANY)) ""; +%typemap(constcode) SWIGTYPE ((*)(ANY)) "" %typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); diff --git a/linux/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i index c94006a6..3d7ae8ba 100755 --- a/linux/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/python/swigmove.i b/linux/bin/swig/share/swig/4.1.0/python/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/python/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i index 668bf435..13f041fb 100755 --- a/linux/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { @@ -394,6 +394,25 @@ #error "typemaps for $1_type not available" %} +%typemap(rtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& + "$typemap(rtype, TYPE)" + +%typemap(scoercein) 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 > *& + %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} + +%typemap(scoerceout) 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 > *& + %{ $result <- if (is.null($result)) $result + else new("$typemap(rtype, TYPE)", ref=$result); %} + %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; diff --git a/linux/bin/swig/share/swig/4.1.0/r/r.swg b/linux/bin/swig/share/swig/4.1.0/r/r.swg index 8cf8cdf5..c1ce37c3 100755 --- a/linux/bin/swig/share/swig/4.1.0/r/r.swg +++ b/linux/bin/swig/share/swig/4.1.0/r/r.swg @@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) { assign(name, _obj); %end_block %enddef -%define %raise(obj,type,desc) -return R_NilValue; -%enddef +%runtime %{ +SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) { + Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); +} +%} + +#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue %insert("sinit") "srun.swg" @@ -53,7 +57,7 @@ SWIG_InitializeModule(0); assert(all(sapply($input, class) == "$R_class")); %} -%typemap(out) void ""; +%typemap(out) void "" %typemap(in) int *, int[ANY], signed int *, signed int[ANY], diff --git a/linux/bin/swig/share/swig/4.1.0/r/rtype.swg b/linux/bin/swig/share/swig/4.1.0/r/rtype.swg index 8fe12230..a9c06758 100755 --- a/linux/bin/swig/share/swig/4.1.0/r/rtype.swg +++ b/linux/bin/swig/share/swig/4.1.0/r/rtype.swg @@ -3,26 +3,27 @@ for use in class representations. */ -%typemap("rtype") int, int *, int & "integer"; -%typemap("rtype") long, long *, long & "integer"; -%typemap("rtype") float, float*, float & "numeric"; -%typemap("rtype") double, double*, double & "numeric"; -%typemap("rtype") char *, char ** "character"; -%typemap("rtype") char "character"; -%typemap("rtype") string, string *, string & "character"; -%typemap("rtype") std::string, std::string *, std::string & "character"; -%typemap("rtype") bool, bool * "logical"; -%typemap("rtype") enum SWIGTYPE "character"; -%typemap("rtype") enum SWIGTYPE * "character"; -%typemap("rtype") enum SWIGTYPE *const "character"; -%typemap("rtype") enum SWIGTYPE & "character"; -%typemap("rtype") const 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("rtype") int, int *, int & "integer" +%typemap("rtype") long, long *, long & "integer" +%typemap("rtype") float, float*, float & "numeric" +%typemap("rtype") double, double*, double & "numeric" +%typemap("rtype") char *, char ** "character" +%typemap("rtype") char "character" +%typemap("rtype") string, string *, string & "character" +%typemap("rtype") std::string, std::string *, std::string & "character" +%typemap("rtype") bool, bool * "logical" +%typemap("rtype") enum SWIGTYPE "character" +%typemap("rtype") enum SWIGTYPE * "character" +%typemap("rtype") enum SWIGTYPE *const& "character" +%typemap("rtype") enum SWIGTYPE & "character" +%typemap("rtype") const enum SWIGTYPE & "character" +%typemap("rtype") enum SWIGTYPE && "character" +%typemap("rtype") SWIGTYPE * "$R_class" +%typemap("rtype") SWIGTYPE *const "$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 & %{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %} @@ -93,7 +94,7 @@ %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} -%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE && +%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE && %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} /* @@ -172,6 +173,10 @@ string &, std::string & %{ $result <- if (is.null($result)) $result else new("$R_class", ref=$result); %} +%typemap(scoerceout) SWIGTYPE *const& + %{ $result <- if (is.null($result)) $result + else new("$*R_class", ref=$result); %} + /* Override the SWIGTYPE * above. */ %typemap(scoerceout) char, diff --git a/linux/bin/swig/share/swig/4.1.0/r/std_vector.i b/linux/bin/swig/share/swig/4.1.0/r/std_vector.i index 4ec51dc9..62478fe6 100755 --- a/linux/bin/swig/share/swig/4.1.0/r/std_vector.i +++ b/linux/bin/swig/share/swig/4.1.0/r/std_vector.i @@ -660,6 +660,27 @@ } }; + template <> + struct traits_from_ptr > > > { + static SEXP from (std::vector< std::vector > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(STRSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + CHARACTER_POINTER(VECTOR_ELT(result, pos))[vpos] = Rf_mkChar(val->at(pos).at(vpos).c_str()); + } + } + UNPROTECT(1); + return(result); + } + }; + template struct traits_from_ptr< std::vector < std::vector< T > > > { static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { @@ -841,7 +862,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.numeric($arg) %} %typemap("rtype") std::vector "numeric" -%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);"; +%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector) %traits_type_name(std::vector) @@ -857,7 +878,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.logical($arg) %} %typemap("rtype") std::vector "logical" -%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);"; +%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -866,7 +887,7 @@ %{ is.integer($arg) || is.numeric($arg) %} %typemap("rtype") std::vector "integer" -%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);"; +%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);" // strings %typemap("rtype") std::vector< std::basic_string >, @@ -887,8 +908,6 @@ std::vector< std::basic_string > *, std::vector< std::basic_string > & %{ %} -%apply std::vector< std::basic_string > { std::vector< std::string> }; - // all the related integer vectors // signed %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -974,21 +993,21 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); @@ -1003,7 +1022,14 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);" + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector > >); +%traits_type_name(std::vector< std::vector > >); +%typemap("rtypecheck") std::vector > >, std::vector > > *, std::vector > > & + %{ is.list($arg) && all(sapply($arg , is.character)) %} +%typemap("rtype") std::vector > >, std::vector > > *, std::vector > > & "list" +%typemap("scoercein") std::vector< std::vector > >, std::vector > > *, std::vector > > & "$input = lapply($input, as.character);" // we don't want these to be given R classes as they // have already been turned into R vectors. @@ -1049,7 +1075,10 @@ std::vector< std::basic_string > *, std::vector< std::vector >&, std::vector< std::vector >, std::vector< std::vector >*, - std::vector< std::vector >& + std::vector< std::vector >&, + std::vector< std::vector > >, + std::vector< std::vector > >*, + std::vector< std::vector > >& %{ %} #if defined(SWIGWORDSIZE64) @@ -1071,3 +1100,6 @@ std::vector< std::basic_string > *, %{ %} #endif + +%apply std::vector< std::basic_string > { std::vector }; +%apply std::vector< std::vector< std::basic_string > > { std::vector< std::vector > }; diff --git a/linux/bin/swig/share/swig/4.1.0/r/swigmove.i b/linux/bin/swig/share/swig/4.1.0/r/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/r/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/argcargv.i b/linux/bin/swig/share/swig/4.1.0/ruby/argcargv.i index fc0bc406..24df9c94 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/argcargv.i +++ b/linux/bin/swig/share/swig/4.1.0/ruby/argcargv.i @@ -1,24 +1,20 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- - * ------------------------------------------------------------ */ - -/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps - Use it as follow: + Use it as follows: %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } %inline %{ - int mainApp(size_t argc, const char **argv) - { + int mainApp(size_t argc, const char **argv) { return argc; } - then in the ruby side: + then from ruby: - args = ["asdf", "asdf2"] - mainApp(args); + $args = ["asdf", "asdf2"] + mainApp(args) * ------------------------------------------------------------ */ @@ -31,7 +27,7 @@ VALUE *ptr = RARRAY_PTR($input); for (i=0; i < size; i++, ptr++) { $2[i]= StringValuePtr(*ptr); - } + } $2[i]=NULL; } else { $1 = 0; $2 = 0; diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i index 9676bf9d..70deae4f 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg b/linux/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg index bf4e3624..e4d9e214 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg +++ b/linux/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg @@ -1,5 +1,22 @@ +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wregister" +#if __GNUC__ >= 10 +#pragma GCC diagnostic ignored "-Wvolatile" +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" +#endif +#endif +#endif +#endif + #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which * breaks using rb_intern as an lvalue, as SWIG does. We work around this * issue for now by disabling this. diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg b/linux/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg index 7c94c4e1..6cac4626 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg @@ -281,6 +281,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, own->own = 0; } + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE)) { + if (!RDATA(obj)->dfree) + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we need to reset the destructor since the Ruby object no @@ -292,7 +297,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_class *sklass = (swig_class *) ty->clientdata; track = sklass->trackObjects; } - + if (track) { /* We are tracking objects for this class. Thus we change the destructor * to SWIG_RubyRemoveTracking. This allows us to @@ -306,6 +311,10 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, } } + if (flags & SWIG_POINTER_CLEAR) { + DATA_PTR(obj) = 0; + } + /* Do type-checking if type info was provided */ if (ty) { if (ty->clientdata) { @@ -413,6 +422,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) { /* register a new class */ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); + rb_undef_alloc_func(cl); /* create and store the structure pointer to a global variable */ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i index eab8ec53..3d7ae8ba 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; + template class auto_ptr {}; } diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/std_set.i b/linux/bin/swig/share/swig/4.1.0/ruby/std_set.i index e38702ef..1b425c6b 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/std_set.i +++ b/linux/bin/swig/share/swig/4.1.0/ruby/std_set.i @@ -180,17 +180,14 @@ // Redefine std::set iterator/reverse_iterator typemap %typemap(out,noblock=1) iterator, reverse_iterator { - $result = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,const $type &), - self), - swig::Iterator::descriptor(),SWIG_POINTER_OWN); + $result = SWIG_NewPointerObj((swig::make_set_nonconst_iterator<$type>($1, self)), swig::Iterator::descriptor(), SWIG_POINTER_OWN); } // Redefine std::set std::pair typemap %typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator") std::pair { $result = rb_ary_new2(2); - rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first), - swig::Iterator::descriptor(),SWIG_POINTER_OWN)); + rb_ary_push($result, SWIG_NewPointerObj((swig::make_set_nonconst_iterator($1.first)), swig::Iterator::descriptor(), SWIG_POINTER_OWN)); rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second)); } diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/swigmove.i b/linux/bin/swig/share/swig/4.1.0/ruby/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/ruby/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/ruby/typemaps.i b/linux/bin/swig/share/swig/4.1.0/ruby/typemaps.i index 1d28b131..68343646 100755 --- a/linux/bin/swig/share/swig/4.1.0/ruby/typemaps.i +++ b/linux/bin/swig/share/swig/4.1.0/ruby/typemaps.i @@ -139,7 +139,7 @@ output values. */ %define OUTPUT_TYPEMAP(type, converter, convtype) -%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;"; +%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") type *OUTPUT, type &OUTPUT { VALUE o = converter(convtype (*$1)); $result = output_helper($result, o); @@ -161,7 +161,7 @@ OUTPUT_TYPEMAP(double, rb_float_new, (double)); #undef OUTPUT_TYPEMAP -%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;"; +%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") bool *OUTPUT, bool &OUTPUT { VALUE o = (*$1) ? Qtrue : Qfalse; $result = output_helper($result, o); diff --git a/linux/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i b/linux/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i index 668bf435..87c89b5f 100755 --- a/linux/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i +++ b/linux/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/linux/bin/swig/share/swig/4.1.0/scilab/std_string.i b/linux/bin/swig/share/swig/4.1.0/scilab/std_string.i index 71ac6d2f..8736c2a2 100755 --- a/linux/bin/swig/share/swig/4.1.0/scilab/std_string.i +++ b/linux/bin/swig/share/swig/4.1.0/scilab/std_string.i @@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) { } %include + +%typemap(throws, noblock=1) std::string { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $&descriptor); +} + +%typemap(throws, noblock=1) const std::string & { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $descriptor); +} diff --git a/linux/bin/swig/share/swig/4.1.0/scilab/swigmove.i b/linux/bin/swig/share/swig/4.1.0/scilab/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/scilab/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/std/std_basic_string.i b/linux/bin/swig/share/swig/4.1.0/std/std_basic_string.i index fb7afc1e..e95cb476 100755 --- a/linux/bin/swig/share/swig/4.1.0/std/std_basic_string.i +++ b/linux/bin/swig/share/swig/4.1.0/std/std_basic_string.i @@ -55,7 +55,16 @@ namespace std { size_type capacity() const; - void reserve(size_type __res_arg = 0); + void reserve(size_type __res_arg); + %extend { + void shrink_to_fit() { + %#if __cplusplus >= 202002L + self->shrink_to_fit(); + %#else + self->reserve(); + %#endif + } + } // Modifiers: diff --git a/linux/bin/swig/share/swig/4.1.0/swig.swg b/linux/bin/swig/share/swig/4.1.0/swig.swg index 54383ff6..13310cdf 100755 --- a/linux/bin/swig/share/swig/4.1.0/swig.swg +++ b/linux/bin/swig/share/swig/4.1.0/swig.swg @@ -450,9 +450,9 @@ namespace std { /* Set up the typemap for handling new return strings */ #ifdef __cplusplus -%typemap(newfree) char * "delete [] $1;"; +%typemap(newfree) char * "delete [] $1;" #else -%typemap(newfree) char * "free($1);"; +%typemap(newfree) char * "free($1);" #endif /* Default typemap for handling char * members */ @@ -603,6 +603,10 @@ namespace std { /* ----------------------------------------------------------------------------- * Runtime code * ----------------------------------------------------------------------------- */ +#ifndef SWIG_JAVASCRIPT_COCOS + +%insert("runtime") "swiglabels.swg" + /* The SwigValueWrapper class */ @@ -654,35 +658,54 @@ namespace std { * arg1 = *inarg1; // Assignment from a pointer * arg1 = Vector(1,2,3); // Assignment from a value * + * SwigValueWrapper is a drop in replacement to modify normal value semantics by + * using the heap instead of the stack to copy/move the underlying object it is + * managing. Smart pointers also manage an underlying object on the heap, so + * SwigValueWrapper has characteristics of a smart pointer. The reset function + * is specific smart pointer functionality, but cannot be a non-static member as + * when SWIG modifies typemap code it assumes non-static member function calls + * are routed to the underlying object, changing for example $1.f() to (&x)->f(). + * The reset function was added as an optimisation to avoid some copying/moving + * and to take ownership of an object already created on the heap. + * * The class offers a strong guarantee of exception safety. - * With regards to the implementation, the private SwigMovePointer nested class is - * a simple smart pointer with move semantics, much like std::auto_ptr. + * With regards to the implementation, the private SwigSmartPointer nested class is + * a simple smart pointer providing exception safety, much like std::auto_ptr. * * This wrapping technique was suggested by William Fulton and is henceforth * known as the "Fulton Transform" :-). */ -#ifndef SWIG_JAVASCRIPT_COCOS #ifdef __cplusplus -%insert("runtime") %{ +// Placed in the header section to ensure the language specific header files are +// the first included headers and not +%insert("header") %{ #ifdef __cplusplus +#include /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { - struct SwigMovePointer { + struct SwigSmartPointer { T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + SwigSmartPointer(T *p) : ptr(p) { } + ~SwigSmartPointer() { delete ptr; } + SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + void reset(T *p) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = p; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; } +#if __cplusplus >=201103L + SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; } + operator T&&() const { return std::move(*pointer.ptr); } +#else operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -};%} +#endif + T *operator&() const { return pointer.ptr; } + static void reset(SwigValueWrapper& t, T *p) { t.pointer.reset(p); } +}; /* * SwigValueInit() is a generic initialisation solution as the following approach: @@ -693,25 +716,26 @@ public: * * unsigned int c_result = unsigned int(); */ -%insert("runtime") %{ template T SwigValueInit() { return T(); } + +#if __cplusplus >=201103L +# define SWIG_STD_MOVE(OBJ) std::move(OBJ) +#else +# define SWIG_STD_MOVE(OBJ) OBJ +#endif + #endif %} #endif -/* The swiglabels */ - -%insert("runtime") "swiglabels.swg" - #else -%insert("runtime") %{ -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static -#endif +#ifdef __cplusplus +%insert("header") %{ +#define SWIG_STD_MOVE(OBJ) std::move(OBJ) %} +#endif // #ifdef __cplusplus -#endif // #ifndef SWIG_JAVASCRIPT_COCOS +#endif // #ifndef SWIG_JAVASCRIPT_COCOS \ No newline at end of file diff --git a/linux/bin/swig/share/swig/4.1.0/swigerrors.swg b/linux/bin/swig/share/swig/4.1.0/swigerrors.swg index 1a6d2036..4d5a8e47 100755 --- a/linux/bin/swig/share/swig/4.1.0/swigerrors.swg +++ b/linux/bin/swig/share/swig/4.1.0/swigerrors.swg @@ -1,4 +1,4 @@ -/* Errors in SWIG */ +/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 @@ -13,4 +13,3 @@ #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 - diff --git a/linux/bin/swig/share/swig/4.1.0/swigrun.swg b/linux/bin/swig/share/swig/4.1.0/swigrun.swg index de0db2dc..f632c4cb 100755 --- a/linux/bin/swig/share/swig/4.1.0/swigrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/swigrun.swg @@ -44,6 +44,8 @@ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 #define SWIG_POINTER_NO_NULL 0x4 +#define SWIG_POINTER_CLEAR 0x8 +#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN) /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -129,7 +131,13 @@ */ #define SWIG_OK (0) +/* Runtime errors are < 0 */ #define SWIG_ERROR (-1) +/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */ +/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */ +/* Errors < -200 are generic runtime specific errors */ +#define SWIG_ERROR_RELEASE_NOT_OWNED (-200) + #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) @@ -144,7 +152,7 @@ #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ +/* Check, add and del object mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) @@ -350,9 +358,9 @@ SWIG_TypeName(const swig_type_info *ty) { SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ + type, separated by vertical-bar characters. Choose the last + name. It should be the most specific; a fully resolved name + but not necessarily with default template parameters expanded. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; diff --git a/linux/bin/swig/share/swig/4.1.0/swigwarn.swg b/linux/bin/swig/share/swig/4.1.0/swigwarn.swg index 8d5b2cf3..821a9c8b 100755 --- a/linux/bin/swig/share/swig/4.1.0/swigwarn.swg +++ b/linux/bin/swig/share/swig/4.1.0/swigwarn.swg @@ -4,7 +4,7 @@ * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * and at https://www.swig.org/legal.html. * * swigwarn.h * @@ -22,8 +22,8 @@ * This file is used as the input for generating Lib/swigwarn.swg. * ----------------------------------------------------------------------------- */ -#ifndef SWIGWARN_H_ -#define SWIGWARN_H_ +#ifndef SWIG_SWIGWARN_H +#define SWIG_SWIGWARN_H %define SWIGWARN_NONE 0 %enddef @@ -147,6 +147,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR 394 %enddef /* new [] */ %define SWIGWARN_IGNORE_OPERATOR_DELARR 395 %enddef /* delete [] */ %define SWIGWARN_IGNORE_OPERATOR_REF 396 %enddef /* operator *() */ +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT 397 %enddef /* <=> */ /* please leave 350-399 free for WARN_IGNORE_OPERATOR_* */ @@ -163,6 +164,7 @@ %define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef /* No longer issued */ %define SWIGWARN_TYPEMAP_APPLY_UNDEF 453 %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK 454 %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK 455 %enddef %define SWIGWARN_TYPEMAP_IN_UNDEF 460 %enddef %define SWIGWARN_TYPEMAP_OUT_UNDEF 461 %enddef diff --git a/linux/bin/swig/share/swig/4.1.0/swigwarnings.swg b/linux/bin/swig/share/swig/4.1.0/swigwarnings.swg index 34c98fbd..63ae4c65 100755 --- a/linux/bin/swig/share/swig/4.1.0/swigwarnings.swg +++ b/linux/bin/swig/share/swig/4.1.0/swigwarnings.swg @@ -52,6 +52,7 @@ %define SWIGWARN_TYPEMAP_CHARLEAK_MSG "451:Setting a const char * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG "454:Setting a pointer/reference variable may leak memory." %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK_MSG "455:Setting a const wchar_t * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef %define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a pointer or reference in a director method is not recommended." %enddef %define SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG "476:Initialization using std::initializer_list." %enddef @@ -107,6 +108,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR_MSG "394:operator new[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_DELARR_MSG "395:operator delete[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_REF_MSG "396:operator*() ignored" %enddef +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT_MSG "397:operator<=> ignored" %enddef #define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG) diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/Makefile.in b/linux/bin/swig/share/swig/4.1.0/tcl/Makefile.in index 13d7d465..019091c9 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/Makefile.in +++ b/linux/bin/swig/share/swig/4.1.0/tcl/Makefile.in @@ -45,7 +45,7 @@ LIBS = # SWIGCC = Compiler used to compile the wrapper file SWIG = $(exec_prefix)/bin/swig -SWIGOPT = -tcl # use -tcl8 for Tcl 8.0 +SWIGOPT = -tcl SWIGCC = $(CC) # SWIG Library files. Uncomment if rebuilding tclsh diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/argcargv.i b/linux/bin/swig/share/swig/4.1.0/tcl/argcargv.i new file mode 100755 index 00000000..bbe149ef --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/tcl/argcargv.i @@ -0,0 +1,29 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i, nitems; + Tcl_Obj **listobjv; + if (Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) { + SWIG_exception_fail(SWIG_ValueError, "in method '$symname', Expecting list of argv"); + goto fail; + } + $1 = ($1_ltype) nitems; + $2 = (char **) malloc((nitems+1)*sizeof(char *)); + for (i = 0; i < nitems; i++) { + $2[i] = Tcl_GetStringFromObj(listobjv[i], NULL); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + int len; + $1 = Tcl_ListObjLength(interp, $input, &len) == TCL_OK; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/mactkinit.c b/linux/bin/swig/share/swig/4.1.0/tcl/mactkinit.c deleted file mode 100755 index 18f1f020..00000000 --- a/linux/bin/swig/share/swig/4.1.0/tcl/mactkinit.c +++ /dev/null @@ -1,233 +0,0 @@ -/* ----------------------------------------------------------------------------- - * mactkinit.c - * - * This is a support file needed to build a new version of Wish. - * Normally, this capability is found in TkAppInit.c, but this creates - * tons of namespace problems for many applications. - * ----------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include - -#include "tk.h" -#include "tkInt.h" -#include "tkMacInt.h" - -typedef int (*TclMacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr)); -Tcl_Interp *gStdoutInterp = NULL; - -void TclMacSetEventProc _ANSI_ARGS_((TclMacConvertEventPtr procPtr)); -int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr)); - -/* - * Prototypes for functions the ANSI library needs to link against. - */ -short InstallConsole _ANSI_ARGS_((short fd)); -void RemoveConsole _ANSI_ARGS_((void)); -long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); -long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); -char * __ttyname _ANSI_ARGS_((long fildes)); -short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); - -/* - * Forward declarations for procedures defined later in this file: - */ - -/* - *---------------------------------------------------------------------- - * - * MacintoshInit -- - * - * This procedure calls Mac specific initialization calls. Most of - * these calls must be made as soon as possible in the startup - * process. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * Inits the application. - * - *---------------------------------------------------------------------- - */ - -int -MacintoshInit() -{ - int i; - long result, mask = 0x0700; /* mask = system 7.x */ - - /* - * Tk needs us to set the qd pointer it uses. This is needed - * so Tk doesn't have to assume the availiblity of the qd global - * variable. Which in turn allows Tk to be used in code resources. - */ - tcl_macQdPtr = &qd; - - InitGraf(&tcl_macQdPtr->thePort); - InitFonts(); - InitWindows(); - InitMenus(); - InitDialogs((long) NULL); - InitCursor(); - - /* - * Make sure we are running on system 7 or higher - */ - - if ((NGetTrapAddress(_Gestalt, ToolTrap) == - NGetTrapAddress(_Unimplemented, ToolTrap)) - || (((Gestalt(gestaltSystemVersion, &result) != noErr) - || (mask != (result & mask))))) { - panic("Tcl/Tk requires System 7 or higher."); - } - - /* - * Make sure we have color quick draw - * (this means we can't run on 68000 macs) - */ - - if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) - || (result < gestalt32BitQD13))) { - panic("Tk requires Color QuickDraw."); - } - - - FlushEvents(everyEvent, 0); - SetEventMask(everyEvent); - - /* - * Set up stack & heap sizes - */ - /* TODO: stack size - size = StackSpace(); - SetAppLimit(GetAppLimit() - 8192); - */ - MaxApplZone(); - for (i = 0; i < 4; i++) { - (void) MoreMasters(); - } - - TclMacSetEventProc(TkMacConvertEvent); - TkConsoleCreate(); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * SetupMainInterp -- - * - * This procedure calls initialization routines require a Tcl - * interp as an argument. This call effectively makes the passed - * interpreter the "main" interpreter for the application. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * More initialization. - * - *---------------------------------------------------------------------- - */ - -int -SetupMainInterp( - Tcl_Interp *interp) -{ - /* - * Initialize the console only if we are running as an interactive - * application. - */ - - TkMacInitAppleEvents(interp); - TkMacInitMenus(interp); - - if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1") - == 0) { - if (TkConsoleInit(interp) == TCL_ERROR) { - goto error; - } - } - - /* - * Attach the global interpreter to tk's expected global console - */ - - gStdoutInterp = interp; - - return TCL_OK; - -error: - panic(interp->result); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * - * InstallConsole, RemoveConsole, etc. -- - * - * The following functions provide the UI for the console package. - * Users wishing to replace SIOUX with their own console package - * need only provide the four functions below in a library. - * - * Results: - * See SIOUX documentation for details. - * - * Side effects: - * See SIOUX documentation for details. - * - *---------------------------------------------------------------------- - */ - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buffer, long n) -{ - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; -} - -long -ReadCharsFromConsole(char *buffer, long n) -{ - return 0; -} - -extern char * -__ttyname(long fildes) -{ - static char *devicename = "null device"; - - if (fildes >= 0 && fildes <= 2) { - return (devicename); - } - - return (0L); -} - -short -SIOUXHandleOneEvent(EventRecord *event) -{ - return 0; -} diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i b/linux/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i new file mode 100755 index 00000000..b24809af --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i b/linux/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i new file mode 100755 index 00000000..0ea324cd --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/std_vector.i b/linux/bin/swig/share/swig/4.1.0/tcl/std_vector.i index 144788be..a74bf3a1 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/std_vector.i +++ b/linux/bin/swig/share/swig/4.1.0/tcl/std_vector.i @@ -34,11 +34,11 @@ %{ #include -Tcl_Obj* SwigString_FromString(const std::string &s) { +SWIGINTERN Tcl_Obj* SwigString_FromString(const std::string &s) { return Tcl_NewStringObj(s.data(), (int)s.length()); } -int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { +SWIGINTERN int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { int v; int res = Tcl_GetBooleanFromObj(interp, o, &v); if (res == TCL_OK) { @@ -47,7 +47,7 @@ int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { return res; } -int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { +SWIGINTERN int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { int len; const char* temp = Tcl_GetStringFromObj(o, &len); (void)interp; diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/swigmove.i b/linux/bin/swig/share/swig/4.1.0/tcl/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/tcl/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/tclinit.swg b/linux/bin/swig/share/swig/4.1.0/tcl/tclinit.swg index 3140bdcd..cf14de88 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/tclinit.swg +++ b/linux/bin/swig/share/swig/4.1.0/tcl/tclinit.swg @@ -24,7 +24,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *); /* Compatibility version for TCL stubs */ #ifndef SWIG_TCL_STUBS_VERSION -#define SWIG_TCL_STUBS_VERSION "8.1" +#define SWIG_TCL_STUBS_VERSION "8.4" #endif %} @@ -100,8 +100,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) { size_t i; if (interp == 0) return TCL_ERROR; #ifdef USE_TCL_STUBS - /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */ - if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, SWIG_TCL_STUBS_VERSION, 0) == NULL) { return TCL_ERROR; } #endif diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg b/linux/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg index 3b6d04f5..febbffb7 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg +++ b/linux/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg @@ -136,30 +136,13 @@ SWIG_From_dec(long long)(long long value) SWIGINTERN int SWIG_AsVal_dec(long long)(Tcl_Obj *obj, long long *val) { - long v; - if (Tcl_GetLongFromObj(0,obj, &v) == TCL_OK) { + Tcl_WideInt v; + if (Tcl_GetWideIntFromObj(0, obj, &v) == TCL_OK) { + if (sizeof(v) > sizeof(*val) && (v < LLONG_MIN || v > LLONG_MAX)) { + return SWIG_OverflowError; + } if (val) *val = v; return SWIG_OK; - } else { - int len = 0; - const char *nptr = Tcl_GetStringFromObj(obj, &len); - if (nptr && len > 0) { - char *endptr; - long long v; - errno = 0; - v = strtoll(nptr, &endptr,0); - if (nptr[0] == '\0' || *endptr != '\0') - return SWIG_TypeError; - if ((v == LLONG_MAX || v == LLONG_MIN) && errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_OK; - } - } - } } return SWIG_TypeError; } diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/tclrun.swg b/linux/bin/swig/share/swig/4.1.0/tcl/tclrun.swg index 938ec985..e8136051 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/tclrun.swg +++ b/linux/bin/swig/share/swig/4.1.0/tcl/tclrun.swg @@ -122,6 +122,7 @@ SWIG_Tcl_Disown(void *ptr) { SWIGRUNTIME int SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) { swig_cast_info *tc; + const char *cmd_name; /* Pointer values must start with leading underscore */ while (*c != '_') { *ptr = (void *) 0; @@ -157,23 +158,42 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL); } + cmd_name = c; c++; c = SWIG_UnpackData(c,ptr,sizeof(void *)); + if (ty) { tc = c ? SWIG_TypeCheck(c,ty) : 0; - if (!tc) { + if (tc) { + Tcl_CmdInfo info; + if (Tcl_GetCommandInfo(interp, cmd_name, &info)) { + swig_instance *inst = (swig_instance *)info.objClientData; + if (!inst->thisvalue) { + *ptr = 0; + } + assert(inst->thisvalue == *ptr); + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !SWIG_Thisown(inst->thisvalue)) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Disown((void *) *ptr); + } + if (flags & SWIG_POINTER_CLEAR) { + inst->thisvalue = 0; + } + { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + } + } + } else { return SWIG_ERROR; } - if (flags & SWIG_POINTER_DISOWN) { - SWIG_Disown((void *) *ptr); - } - { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } } + return SWIG_OK; } @@ -490,9 +510,11 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ /* Check to see if this pointer belongs to a class or not */ if (thisvalue && (type->clientdata) && (interp)) { Tcl_CmdInfo ci; + int has_command; char *name; name = Tcl_GetStringFromObj(robj,NULL); - if (!Tcl_GetCommandInfo(interp,name, &ci) || (flags)) { + has_command = Tcl_GetCommandInfo(interp, name, &ci); + if (!has_command || flags) { swig_instance *newinst = (swig_instance *) malloc(sizeof(swig_instance)); newinst->thisptr = Tcl_DuplicateObj(robj); Tcl_IncrRefCount(newinst->thisptr); @@ -503,6 +525,15 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ if (flags) { SWIG_Acquire(thisvalue); } + } else { + swig_instance *inst = (swig_instance *)ci.objClientData; + /* Restore thisvalue as SWIG_POINTER_CLEAR may have been used to set it to zero. + Occurs when the C pointer is re-used by the memory allocator and the command has + been created and not destroyed - bug?? - see cpp11_std_unique_ptr_runme.tcl test. */ + if (inst->thisvalue != thisvalue) { + assert(inst->thisvalue == 0); + inst->thisvalue = thisvalue; + } } } return robj; diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/tclsh.i b/linux/bin/swig/share/swig/4.1.0/tcl/tclsh.i index a119b93a..21dc35af 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/tclsh.i +++ b/linux/bin/swig/share/swig/4.1.0/tcl/tclsh.i @@ -33,10 +33,6 @@ char *SWIG_RcFileName = "~/.myapprc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -#endif - int Tcl_AppInit(Tcl_Interp *interp){ if (Tcl_Init(interp) == TCL_ERROR) @@ -47,27 +43,11 @@ int Tcl_AppInit(Tcl_Interp *interp){ if (SWIG_init(interp) == TCL_ERROR) return TCL_ERROR; Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); -#endif - + return TCL_OK; } int main(int argc, char **argv) { -#ifdef MAC_TCL - char *newArgv[2]; - - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - - argc = 1; - newArgv[0] = "tclsh"; - newArgv[1] = NULL; - argv = newArgv; -#endif - Tcl_Main(argc, argv, Tcl_AppInit); return(0); diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg b/linux/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg index ad31bcfc..66cce47e 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg @@ -77,11 +77,6 @@ #endif -%typemap(throws,noblock=1) SWIGTYPE CLASS { - SWIG_set_result(SWIG_NewInstanceObj(%as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1)); - SWIG_fail; -} - %typemap(out) SWIGTYPE = SWIGTYPE INSTANCE; %typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE; %typemap(out) SWIGTYPE *const = SWIGTYPE *; diff --git a/linux/bin/swig/share/swig/4.1.0/tcl/wish.i b/linux/bin/swig/share/swig/4.1.0/tcl/wish.i index bfd2c5fa..42902850 100755 --- a/linux/bin/swig/share/swig/4.1.0/tcl/wish.i +++ b/linux/bin/swig/share/swig/4.1.0/tcl/wish.i @@ -35,11 +35,6 @@ as follows (this should be included in a code-block) : char *SWIG_RcFileName = "~/.wishrc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); -#endif - /* *---------------------------------------------------------------------- * @@ -61,10 +56,9 @@ extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); int Tcl_AppInit(Tcl_Interp *interp) { -#ifndef MAC_TCL Tk_Window main; main = Tk_MainWindow(interp); -#endif + /* * Call the init procedures for included packages. Each call should * look like this: @@ -93,10 +87,6 @@ int Tcl_AppInit(Tcl_Interp *interp) return TCL_ERROR; } -#ifdef MAC_TCL - SetupMainInterp(interp); -#endif - /* * Specify a user-specific startup file to invoke if the application * is run interactively. Typically the startup file is "~/.apprc" @@ -104,31 +94,12 @@ int Tcl_AppInit(Tcl_Interp *interp) * then no user-specific startup file will be run under any conditions. */ - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); - -/* For Macintosh might also want this */ - -#ifdef MAC_TCL -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY); -#endif -#endif + Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); return TCL_OK; } #if TK_MAJOR_VERSION >= 4 int main(int argc, char **argv) { - -#ifdef MAC_TCL - char *newArgv[2]; - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - argc = 1; - newArgv[0] = "Wish"; - newArgv[1] = NULL; - argv = newArgv; -#endif Tk_Main(argc, argv, Tcl_AppInit); return(0); } diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg index 0aca6110..42ce4d9b 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg @@ -59,7 +59,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -85,7 +85,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP { %append_output(SWIG_FromCharPtrAndSize($1,SIZE)); } @@ -122,7 +122,7 @@ temp[n - 1] = 0; $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -160,7 +160,7 @@ if (alloc == SWIG_NEWOBJ) %delete_array(t); $1[n-1] = 0; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { %append_output(SWIG_FromCharPtr($1)); %delete_array($1); @@ -247,7 +247,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) { $1 = &temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { if (*$1) { %append_output(SWIG_FromCharPtr(*$1)); @@ -275,7 +275,7 @@ %typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) { $1 = &temp; $2 = &tempn; } -%typemap(freearg,match="in") (TYPEMAP,SIZE) ""; +%typemap(freearg,match="in") (TYPEMAP,SIZE) "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) { if (*$1) { %append_output(SWIG_FromCharPtrAndSize(*$1,*$2)); diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/exception.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/exception.swg index e48294c3..aece8326 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/exception.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/exception.swg @@ -19,6 +19,7 @@ #endif #define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name) #define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type) +#define %releasenotownedfail_fmt(_type,_name,_argn) "in method '" `_name` "', cannot release ownership as memory is not owned for argument " `_argn`" of type '" `_type`"'" /* setting an error */ #define %error(code,msg...) SWIG_Error(code, msg) diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg index e8439e6d..ca54fcdc 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg @@ -35,7 +35,7 @@ $1 = *ptr; if (SWIG_IsNewObj(res)) %delete(ptr); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) { Type *ptr = (Type *)0; res = asptr_meth($input, &ptr); diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/string.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/string.swg index 4b707236..72f4aa5b 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/string.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/string.swg @@ -30,6 +30,7 @@ SWIG_strnlen(const char* s, size_t maxlen) %include %typemaps_string(%checkcode(STRING), %checkcode(CHAR), + SWIGWARN_TYPEMAP_CHARLEAK_MSG, char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, strlen, SWIG_strnlen, "", CHAR_MIN, CHAR_MAX) diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/strings.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/strings.swg index 87e97dd7..1237d98d 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/strings.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/strings.swg @@ -19,6 +19,7 @@ %define %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -78,7 +79,7 @@ if (!SWIG_IsOK(res)) { %variable_fail(res,"$type","$name"); } - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if (alloc == SWIG_NEWOBJ) { $1 = cptr; } else { @@ -86,7 +87,7 @@ } } -%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=WarningLeakMsg) const Char * { Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ; int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc); if (!SWIG_IsOK(res)) { @@ -108,7 +109,7 @@ /* memberin */ %typemap(memberin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char); @@ -117,7 +118,7 @@ } } -%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(memberin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -129,7 +130,7 @@ /* globalin */ %typemap(globalin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -138,7 +139,7 @@ } } -%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(globalin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen($input) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -265,7 +266,7 @@ } $1 = %reinterpret_cast(temp, $1_ltype); } -%typemap(freearg) Char [ANY], const Char [ANY] ""; +%typemap(freearg) Char [ANY], const Char [ANY] "" %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0], int res) { @@ -275,7 +276,7 @@ } $1 = &temp; } -%typemap(freearg) const Char (&)[ANY] ""; +%typemap(freearg) const Char (&)[ANY] "" %typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen) Char [ANY], const Char[ANY] @@ -501,6 +502,7 @@ #ifndef %_typemap2_string %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -591,6 +593,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -609,6 +612,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -616,6 +620,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_CharBufLen, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -631,6 +636,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string_alloc(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -640,6 +646,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg index 9acd9140..53a64279 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg @@ -109,17 +109,6 @@ nocppval #endif %enddef -#ifndef SWIG_JAVASCRIPT_COCOS -/* insert the SWIGVERSION in the interface and the wrapper code */ -#if SWIG_VERSION -%insert("header") { -%define_as(SWIGVERSION, SWIG_VERSION) -%#define SWIG_VERSION SWIGVERSION -} -#endif -#endif // #ifndef SWIG_JAVASCRIPT_COCOS - - /* ----------------------------------------------------------------------------- * Casting operators * ----------------------------------------------------------------------------- */ diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg new file mode 100755 index 00000000..b0a29685 --- /dev/null +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.swg + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg index b1e6dc9d..26c6ba8e 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg @@ -2,7 +2,7 @@ * Language Object * - Just pass straight through unmodified * ------------------------------------------------------------ */ -%typemap(in) SWIG_Object "$1 = $input;"; +%typemap(in) SWIG_Object "$1 = $input;" %typemap(in,noblock=1) SWIG_Object const & ($*ltype temp) { @@ -30,8 +30,8 @@ #if defined(SWIG_DIRECTOR_TYPEMAPS) -%typemap(directorin) SWIG_Object "$input = $1;"; -%typemap(directorout) SWIG_Object "$result = $input;"; +%typemap(directorin) SWIG_Object "$input = $1;" +%typemap(directorout) SWIG_Object "$result = $input;" #endif /* SWIG_DIRECTOR_TYPEMAPS */ diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg index 64210ef6..69f83794 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg @@ -2,50 +2,50 @@ * --- Input arguments --- * ----------------------------------------------------------------------------- */ /* Pointers and arrays */ -%typemap(in, noblock=1) SWIGTYPE *(void *argp = nullptr, int res = 0) { - res = SWIG_ConvertPtr333($input, &argp,$descriptor, $disown | %convertptr_flags); +%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE * ""; +%typemap(freearg) SWIGTYPE * "" %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr4($input, &argp,$descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE [] ""; +%typemap(freearg) SWIGTYPE [] "" %typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) { - res = SWIG_ConvertPtr5($input, &argp, $*descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$*ltype", $symname, $argnum); } temp = %reinterpret_cast(argp, $*ltype); $1 = %reinterpret_cast(&temp, $1_ltype); } -%typemap(freearg) SWIGTYPE *const& ""; +%typemap(freearg) SWIGTYPE *const& "" /* Reference */ %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr6($input, &argp, $descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE & ""; +%typemap(freearg) SWIGTYPE & "" #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr7($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -56,56 +56,28 @@ { if (SWIG_IsNewObj(res$argnum)) %delete($1); } -#else -%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) { - res = SWIG_ConvertPtr8($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} #endif /* Rvalue reference */ -%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr9($input, &argp, $descriptor, %convertptr_flags); +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE | %convertptr_flags); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$type", $symname, $argnum); + } else { + %argument_fail(res, "$type", $symname, $argnum); + } } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); + rvrdeleter.reset($1); } -%typemap(freearg) SWIGTYPE && ""; - -#if defined(__cplusplus) && defined(%implicitconv_flag) -%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr10($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE && -{ - if (SWIG_IsNewObj(res$argnum)) %delete($1); -} -#else -%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) { - res = SWIG_ConvertPtr11($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -#endif +%typemap(freearg) SWIGTYPE && "" /* By value */ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr12($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -119,7 +91,7 @@ } #else %typemap(in) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr13($input, &argp, $&descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -146,9 +118,15 @@ } /* Return by value */ +#ifdef __cplusplus %typemap(out, noblock=1) SWIGTYPE { - %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); + %set_output(SWIG_NewPointerObj((new $1_ltype($1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); } +#else +%typemap(out, noblock=1) SWIGTYPE { + %set_output(SWIG_NewPointerObj(%new_copy($1, $1_ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); +} +#endif /* ----------------------------------------------------------------------------- * --- Variable input --- @@ -176,7 +154,7 @@ %typemap(varin) SWIGTYPE [ANY] { $basetype *inp = 0; - int res = SWIG_ConvertPtr14($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -224,7 +202,7 @@ %typemap(varin) SWIGTYPE [ANY][ANY] { $basetype (*inp)[$1_dim1] = 0; - int res = SWIG_ConvertPtr15($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -246,7 +224,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE * { void *argp = 0; - int res = SWIG_ConvertPtr16($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -260,7 +238,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE & { void *argp = 0; - int res = SWIG_ConvertPtr17($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -272,7 +250,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && { void *argp = 0; - int res = SWIG_ConvertPtr18($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -285,7 +263,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(varin,implicitconv=1) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr19($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -301,7 +279,7 @@ #else %typemap(varin) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr20($input, &argp, $&descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -346,58 +324,59 @@ %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * { void *vptr = 0; - int res = SWIG_ConvertPtr21($input, &vptr, $descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& { void *vptr = 0; - int res = SWIG_ConvertPtr22($input, &vptr, $*descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr23($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr24($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & { - int res = SWIG_ConvertPtr25($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && { - int res = SWIG_ConvertPtr26($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE { - int res = SWIG_ConvertPtr27($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } #else %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr28($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr29($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { void *vptr = 0; - int res = SWIG_ConvertPtr30($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #endif @@ -411,7 +390,7 @@ /* directorin */ %typemap(directorin,noblock=1) SWIGTYPE { - $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); + $input = SWIG_NewPointerObj((new $1_ltype(SWIG_STD_MOVE($1))), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); } %typemap(directorin,noblock=1) SWIGTYPE * { @@ -434,7 +413,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr31($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -443,7 +422,7 @@ } #else %typemap(directorout,noblock=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr32($input,&swig_argp,$&descriptor, %convertptr_flags); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -534,7 +513,7 @@ * ------------------------------------------------------------ */ %typemap(throws,noblock=1) SWIGTYPE { - %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); + %raise(SWIG_NewPointerObj(%new_copy($1, $1_ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); } %typemap(throws,noblock=1) SWIGTYPE * { @@ -680,7 +659,7 @@ /* DISOWN typemap */ %typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) { - res = SWIG_ConvertPtr111($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + res = SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type", $symname, $argnum); } @@ -688,7 +667,7 @@ %typemap(varin) SWIGTYPE *DISOWN { void *temp = 0; - int res = SWIG_ConvertPtr222($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + int res = SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -703,9 +682,15 @@ /* INSTANCE typemap */ +#ifdef __cplusplus +%typemap(out,noblock=1) SWIGTYPE INSTANCE { + %set_output(SWIG_NewInstanceObj((new $1_ltype($1)), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); +} +#else %typemap(out,noblock=1) SWIGTYPE INSTANCE { %set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); } +#endif %typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] { %set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags)); diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg index 4e5bb2b0..733e5acd 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg @@ -140,6 +140,7 @@ #define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn)) #define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name)) #define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name)) +#define %releasenotowned_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %releasenotownedfail_fmt(type, name, argn)) #if defined(SWIG_DIRECTOR_TYPEMAPS) #define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type)) diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg index 11eac598..f2f34acf 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg @@ -38,7 +38,7 @@ } $1 = %static_cast(val,$ltype); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) { ecode = asval_meth($input, &val); if (!SWIG_IsOK(ecode)) { @@ -47,7 +47,7 @@ temp = %static_cast(val, $*ltype); $1 = &temp; } - %typemap(freearg) const Type& ""; + %typemap(freearg) const Type& "" %enddef /* out */ diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/void.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/void.swg index bbd68ed8..795992bf 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/void.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/void.swg @@ -10,7 +10,7 @@ %argument_fail(res, "$type", $symname, $argnum); } } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) { res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown); @@ -19,7 +19,7 @@ } $1 = &temp; } -%typemap(freearg) void * const& ""; +%typemap(freearg) void * const& "" /* out */ diff --git a/linux/bin/swig/share/swig/4.1.0/typemaps/wstring.swg b/linux/bin/swig/share/swig/4.1.0/typemaps/wstring.swg index cd409d1c..d99c0bb3 100755 --- a/linux/bin/swig/share/swig/4.1.0/typemaps/wstring.swg +++ b/linux/bin/swig/share/swig/4.1.0/typemaps/wstring.swg @@ -31,6 +31,7 @@ SWIG_wcsnlen(const wchar_t* s, size_t maxlen) %include %typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR), + SWIGWARN_TYPEMAP_WCHARLEAK_MSG, wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, wcslen, SWIG_wcsnlen, "", WCHAR_MIN, WCHAR_MAX) diff --git a/mac/bin/swig/bin/swig b/mac/bin/swig/bin/swig index 6da311d5..df3a3968 100755 Binary files a/mac/bin/swig/bin/swig and b/mac/bin/swig/bin/swig differ diff --git a/mac/bin/swig/share/swig/4.1.0/allkw.swg b/mac/bin/swig/share/swig/4.1.0/allkw.swg index 2d3cf6ea..5e4cb830 100755 --- a/mac/bin/swig/share/swig/4.1.0/allkw.swg +++ b/mac/bin/swig/share/swig/4.1.0/allkw.swg @@ -1,5 +1,5 @@ -#ifndef __Lib_allkw_swg__ -#define __Lib_allkw_swg__ +#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG +#define SWIG_INCLUDED_LIB_ALLKW_SWG /* @@ -30,4 +30,4 @@ %include -#endif //__Lib_allkw_swg__ +#endif // SWIG_INCLUDED_LIB_ALLKW_SWG diff --git a/mac/bin/swig/share/swig/4.1.0/cffi/cffi.swg b/mac/bin/swig/share/swig/4.1.0/cffi/cffi.swg deleted file mode 100755 index f7294956..00000000 --- a/mac/bin/swig/share/swig/4.1.0/cffi/cffi.swg +++ /dev/null @@ -1,294 +0,0 @@ -/* Define a C preprocessor symbol that can be used in interface files - to distinguish between the SWIG language modules. */ - -#define SWIG_CFFI - -/* Typespecs for basic types. */ - -%typemap(cin) void ":void"; - -%typemap(cin) char ":char"; -%typemap(cin) char * ":string"; -%typemap(cin) unsigned char ":unsigned-char"; -%typemap(cin) signed char ":char"; - -%typemap(cin) short ":short"; -%typemap(cin) signed short ":short"; -%typemap(cin) unsigned short ":unsigned-short"; - -%typemap(cin) int ":int"; -%typemap(cin) signed int ":int"; -%typemap(cin) unsigned int ":unsigned-int"; - -%typemap(cin) long ":long"; -%typemap(cin) signed long ":long"; -%typemap(cin) unsigned long ":unsigned-long"; - -%typemap(cin) long long ":long-long"; -%typemap(cin) signed long long ":long-long"; -%typemap(cin) unsigned long long ":unsigned-long-long"; - -%typemap(cin) float ":float"; -%typemap(cin) double ":double"; -%typemap(cin) SWIGTYPE ":pointer"; - -%typemap(cout) void ":void"; - -%typemap(cout) char ":char"; -%typemap(cout) char * ":string"; -%typemap(cout) unsigned char ":unsigned-char"; -%typemap(cout) signed char ":char"; - -%typemap(cout) short ":short"; -%typemap(cout) signed short ":short"; -%typemap(cout) unsigned short ":unsigned-short"; - -%typemap(cout) int ":int"; -%typemap(cout) signed int ":int"; -%typemap(cout) unsigned int ":unsigned-int"; - -%typemap(cout) long ":long"; -%typemap(cout) signed long ":long"; -%typemap(cout) unsigned long ":unsigned-long"; - -%typemap(cout) long long ":long-long"; -%typemap(cout) signed long long ":long-long"; -%typemap(cout) unsigned long long ":unsigned-long-long"; - -%typemap(cout) float ":float"; -%typemap(cout) double ":double"; -%typemap(cout) SWIGTYPE ":pointer"; - - -%typemap(ctype) bool "int"; -%typemap(ctype) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype"; -%typemap(ctype) SWIGTYPE "$&1_type"; - -%typemap(in) bool "$1 = (bool)$input;"; -%typemap(in) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; -%typemap(in) SWIGTYPE "$1 = *$input;"; - -%typemap(out) void ""; -%typemap(out) bool "$result = (int)$1;"; -%typemap(out) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_INTEGER) - unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, - SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; -/* This maps C/C++ types to Lisp classes for overload dispatch */ - -%typemap(lisptype) bool "cl:boolean"; -%typemap(lisptype) char "cl:character"; -%typemap(lisptype) unsigned char "cl:integer"; -%typemap(lisptype) signed char "cl:integer"; - -%typemap(lispclass) bool "t"; -%typemap(lispclass) char "cl:character"; -%typemap(lispclass) unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE "cl:integer"; -/* CLOS methods can't be specialized on single-float or double-float */ -%typemap(lispclass) float "cl:number"; -%typemap(lispclass) double "cl:number"; -%typemap(lispclass) char * "cl:string"; - -/* Array reference typemaps */ -%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } - -/* const pointers */ -%apply SWIGTYPE * { SWIGTYPE *const } -%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } -%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -%} - -%insert("swiglisp") %{ -;;;SWIG wrapper code starts here - -(cl:defmacro defanonenum (cl:&body enums) - "Converts anonymous enums to defconstants." - `(cl:progn ,@(cl:loop for value in enums - for index = 0 then (cl:1+ index) - when (cl:listp value) do (cl:setf index (cl:second value) - value (cl:first value)) - collect `(cl:defconstant ,value ,index)))) - -(cl:eval-when (:compile-toplevel :load-toplevel) - (cl:unless (cl:fboundp 'swig-lispify) - (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) - (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) - (cl:cond - ((cl:null lst) - rest) - ((cl:upper-case-p c) - (helper (cl:cdr lst) 'upper - (cl:case last - ((lower digit) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:lower-case-p c) - (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest))) - ((cl:digit-char-p c) - (helper (cl:cdr lst) 'digit - (cl:case last - ((upper lower) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:char-equal c #\_) - (helper (cl:cdr lst) '_ (cl:cons #\- rest))) - (cl:t - (cl:error "Invalid character: ~A" c))))) - (cl:let ((fix (cl:case flag - ((constant enumvalue) "+") - (variable "*") - (cl:t "")))) - (cl:intern - (cl:concatenate - 'cl:string - fix - (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil)) - fix) - package)))))) - -;;;SWIG wrapper code ends here -%} - -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -////////////////////////////////////////////////////////////// - -/* name conversion for overloaded operators. */ -#ifdef __cplusplus -%rename(__add__) *::operator+; -%rename(__pos__) *::operator+(); -%rename(__pos__) *::operator+() const; - -%rename(__sub__) *::operator-; -%rename(__neg__) *::operator-() const; -%rename(__neg__) *::operator-(); - -%rename(__mul__) *::operator*; -%rename(__deref__) *::operator*(); -%rename(__deref__) *::operator*() const; - -%rename(__div__) *::operator/; -%rename(__mod__) *::operator%; -%rename(__logxor__) *::operator^; -%rename(__logand__) *::operator&; -%rename(__logior__) *::operator|; -%rename(__lognot__) *::operator~(); -%rename(__lognot__) *::operator~() const; - -%rename(__not__) *::operator!(); -%rename(__not__) *::operator!() const; - -%rename(__assign__) *::operator=; - -%rename(__add_assign__) *::operator+=; -%rename(__sub_assign__) *::operator-=; -%rename(__mul_assign__) *::operator*=; -%rename(__div_assign__) *::operator/=; -%rename(__mod_assign__) *::operator%=; -%rename(__logxor_assign__) *::operator^=; -%rename(__logand_assign__) *::operator&=; -%rename(__logior_assign__) *::operator|=; - -%rename(__lshift__) *::operator<<; -%rename(__lshift_assign__) *::operator<<=; -%rename(__rshift__) *::operator>>; -%rename(__rshift_assign__) *::operator>>=; - -%rename(__eq__) *::operator==; -%rename(__ne__) *::operator!=; -%rename(__lt__) *::operator<; -%rename(__gt__) *::operator>; -%rename(__lte__) *::operator<=; -%rename(__gte__) *::operator>=; - -%rename(__and__) *::operator&&; -%rename(__or__) *::operator||; - -%rename(__preincr__) *::operator++(); -%rename(__postincr__) *::operator++(int); -%rename(__predecr__) *::operator--(); -%rename(__postdecr__) *::operator--(int); - -%rename(__comma__) *::operator,(); -%rename(__comma__) *::operator,() const; - -%rename(__member_ref__) *::operator->; -%rename(__member_func_ref__) *::operator->*; - -%rename(__funcall__) *::operator(); -%rename(__aref__) *::operator[]; -#endif - - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -#include -%} diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i b/mac/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i index fa3f53a2..355a910c 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i @@ -32,7 +32,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -372,7 +372,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i index 508c0ec1..d47fab55 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i @@ -29,10 +29,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -122,7 +122,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/csharp.swg b/mac/bin/swig/share/swig/4.1.0/csharp/csharp.swg index 0e180f57..1f80d12a 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/csharp.swg +++ b/mac/bin/swig/share/swig/4.1.0/csharp/csharp.swg @@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" @@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %} %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; } %} -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %} %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{ char buf[128]; @@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { "$csinput" %typemap(csin) char *, char *&, char[ANY], char[] "$csinput" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)" -%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)" %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)" /* The csout typemap is used for converting function return types from the return type @@ -913,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} // Derived proxy classes @@ -926,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} %enddef @@ -945,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } %} %typemap(csbody) TYPE (CLASS::*) %{ diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_array.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_array.i index a4f0f964..6e7fe9eb 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_array.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_array.i @@ -16,7 +16,7 @@ %define SWIG_STD_ARRAY_INTERNAL(T, N) -%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n" %proxycode %{ public $csclassname(global::System.Collections.ICollection c) : this() { if (c == null) diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i index 1d91c987..da15df3e 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i @@ -1,25 +1,38 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (ctype) std::auto_ptr "void *" -%typemap (imtype, out="System.IntPtr") std::auto_ptr "HandleRef" -%typemap (cstype) std::auto_ptr "$typemap(cstype, TYPE)" -%typemap (out) std::auto_ptr %{ - $result = (void *)$1.release(); +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); %} -%typemap(csout, excode=SWIGEXCODE) std::auto_ptr { - 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; + +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_list.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_list.i index 674aba0a..cf6f2023 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_list.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_list.i @@ -19,7 +19,7 @@ // MACRO for use within the std::list class body %define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...) -%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * }; diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_map.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_map.i index e538a03a..7a118569 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_map.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_map.i @@ -26,7 +26,7 @@ /* K is the C++ key type, T is the C++ value type */ %define SWIG_STD_MAP_INTERNAL(K, T, C) -%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n" %proxycode %{ public $typemap(cstype, T) this[$typemap(cstype, K) key] { diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_set.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_set.i index 82f010af..01215226 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_set.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_set.i @@ -28,7 +28,7 @@ namespace std { template class set { -%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n" %proxycode %{ void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) { ((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item); diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i new file mode 100755 index 00000000..0a4caafb --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::unique_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::unique_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_vector.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_vector.i index ecb10dfb..a2add584 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_vector.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_vector.i @@ -19,7 +19,7 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) -%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %proxycode %{ public $csclassname(global::System.Collections.IEnumerable c) : this() { if (c == null) diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/std_wstring.i b/mac/bin/swig/share/swig/4.1.0/csharp/std_wstring.i index 162b90e8..1d10ca80 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/std_wstring.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/std_wstring.i @@ -2,7 +2,9 @@ * std_wstring.i * * Typemaps for std::wstring and const std::wstring& - * These are mapped to a C# String and are passed around by value. + * std::wstring is mapped to a C# Unicode string (UTF16) and is passed around by value. + * std::wstring support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * To use non-const std::wstring references use the following %apply. Note * that they are passed by value. @@ -15,6 +17,28 @@ #include %} +%fragment("Swig_csharp_UTF16ToWString", "header") %{ +/* For converting from .NET UTF16 (2 byte unicode) strings. wchar_t is 2 bytes on Windows, 4 bytes on Linux. */ +static std::wstring Swig_csharp_UTF16ToWString(const unsigned short *str) { + if (sizeof(wchar_t) == 2) { + return std::wstring((wchar_t *)str); + } else { + const unsigned short *pBegin(str); + const unsigned short *ptr(pBegin); + + while (*ptr != 0) + ++ptr; + + std::wstring result; + result.reserve(ptr - pBegin); + while(pBegin != ptr) + result.push_back(*pBegin++); + + return result; + } +} +%} + namespace std { %naturalvar wstring; @@ -22,31 +46,33 @@ namespace std { class wstring; // wstring -%typemap(ctype, out="void *") wstring "wchar_t *" +%typemap(ctype, out="void *") wstring "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) wstring "string" %typemap(cstype) wstring "string" %typemap(csdirectorin) wstring "$iminput" %typemap(csdirectorout) wstring "$cscall" -%typemap(in, canthrow=1) wstring +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $1.assign($input); %} -%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %} + $1 = Swig_csharp_UTF16ToWString($input); %} +%typemap(out) wstring %{ $result = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} -%typemap(directorout, canthrow=1) wstring +%typemap(directorout, canthrow=1) wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $result.assign($input); %} + $result = Swig_csharp_UTF16ToWString($input); %} -%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csin) wstring "$csinput" %typemap(csout, excode=SWIGEXCODE) wstring { @@ -57,29 +83,30 @@ class wstring; %typemap(typecheck) wstring = wchar_t *; %typemap(throws, canthrow=1) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} // const wstring & -%typemap(ctype, out="void *") const wstring & "wchar_t *" +%typemap(ctype, out="void *") const wstring & "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) const wstring & "string" %typemap(cstype) const wstring & "string" %typemap(csdirectorin) const wstring & "$iminput" %typemap(csdirectorout) const wstring & "$cscall" -%typemap(in, canthrow=1) const wstring & +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") const wstring & %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - std::wstring $1_str($input); + std::wstring $1_str(Swig_csharp_UTF16ToWString($input)); $1 = &$1_str; %} -%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %} +%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_with_length_callback($1->c_str(), (int)$1->size()); %} %typemap(csin) const wstring & "$csinput" %typemap(csout, excode=SWIGEXCODE) const wstring & { @@ -94,10 +121,10 @@ class wstring; } /* possible thread/reentrant code problem */ static std::wstring $1_str; - $1_str = $input; + $1_str = Swig_csharp_UTF16ToWString($input); $result = &$1_str; %} -%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{ set { @@ -112,8 +139,7 @@ class wstring; %typemap(typecheck) const wstring & = wchar_t *; %typemap(throws, canthrow=1) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} } diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/swigmove.i b/mac/bin/swig/share/swig/4.1.0/csharp/swigmove.i new file mode 100755 index 00000000..2f21bd6f --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/csharp/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1, fragment="") SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(csin) SWIGTYPE MOVE "$&csclassname.swigRelease($csinput)" diff --git a/mac/bin/swig/share/swig/4.1.0/csharp/wchar.i b/mac/bin/swig/share/swig/4.1.0/csharp/wchar.i index 1ece767d..f1e0d5a2 100755 --- a/mac/bin/swig/share/swig/4.1.0/csharp/wchar.i +++ b/mac/bin/swig/share/swig/4.1.0/csharp/wchar.i @@ -2,37 +2,58 @@ * wchar.i * * Typemaps for the wchar_t type - * These are mapped to a C# String and are passed around by value. + * wchar_t * is mapped to a C# Unicode string (UTF16) and is passed around by value. + * wchar_t * support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER - * * ----------------------------------------------------------------------------- */ #if !defined(SWIG_CSHARP_NO_WSTRING_HELPER) #if !defined(SWIG_CSHARP_WSTRING_HELPER_) #define SWIG_CSHARP_WSTRING_HELPER_ + +%fragment(""); // TODO: %fragment("") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + delete [] $1; + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +#else +%typemap(memberin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} + +#endif diff --git a/mac/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i index 4a220a58..6d85c5ae 100755 --- a/mac/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i @@ -23,10 +23,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -116,7 +116,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/mac/bin/swig/share/swig/4.1.0/d/dclassgen.swg b/mac/bin/swig/share/swig/4.1.0/d/dclassgen.swg index 84fa03a0..e4ff8d5f 100755 --- a/mac/bin/swig/share/swig/4.1.0/d/dclassgen.swg +++ b/mac/bin/swig/share/swig/4.1.0/d/dclassgen.swg @@ -76,6 +76,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -92,6 +105,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -100,7 +126,7 @@ mixin $imdmodule.SwigOperatorDefinitions; * Type wrapper classes. */ -%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ +%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] %{ private void* swigCPtr; public this(void* cObject, bool futureUse) { @@ -115,6 +141,10 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + return (obj is null) ? null : obj.swigCPtr; +} + mixin $imdmodule.SwigOperatorDefinitions; %} diff --git a/mac/bin/swig/share/swig/4.1.0/d/dswigtype.swg b/mac/bin/swig/share/swig/4.1.0/d/dswigtype.swg index 1d97cb08..c227519e 100755 --- a/mac/bin/swig/share/swig/4.1.0/d/dswigtype.swg +++ b/mac/bin/swig/share/swig/4.1.0/d/dswigtype.swg @@ -52,7 +52,7 @@ %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -62,7 +62,7 @@ #endif %typemap(directorin) SWIGTYPE - "$input = (void *)new $1_ltype((const $1_ltype &)$1);" + "$input = (void *)new $1_ltype(SWIG_STD_MOVE($1));" %typemap(directorout) SWIGTYPE %{ if (!$input) { SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type"); @@ -122,7 +122,7 @@ %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; } %} %typemap(out) SWIGTYPE & "$result = (void *)$1;" @@ -157,11 +157,12 @@ * Rvalue reference conversion typemaps. */ -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && "$result = (void *)$1;" %typemap(directorin) SWIGTYPE && @@ -182,7 +183,7 @@ %typemap(din, nativepointer="cast(void*)$dinput" -) SWIGTYPE && "$dclassname.swigGetCPtr($dinput)" +) SWIGTYPE && "$dclassname.swigRelease($dinput)" %typemap(dout, excode=SWIGEXCODE, nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE && { $dclassname ret = new $dclassname($imcall, $owner);$excode diff --git a/mac/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i new file mode 100755 index 00000000..500b6115 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype) std::auto_ptr< TYPE > "void*" +%typemap (dtype) std::auto_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::auto_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::auto_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i new file mode 100755 index 00000000..9317a7e0 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype) std::unique_ptr< TYPE > "void*" +%typemap (dtype) std::unique_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::unique_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::unique_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/d/swigmove.i b/mac/bin/swig/share/swig/4.1.0/d/swigmove.i new file mode 100755 index 00000000..e2eb8340 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/d/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1) SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(din) SWIGTYPE MOVE "$dclassname.swigRelease($dinput)" diff --git a/mac/bin/swig/share/swig/4.1.0/go/go.swg b/mac/bin/swig/share/swig/4.1.0/go/go.swg index 6e415d2c..348ae5f0 100755 --- a/mac/bin/swig/share/swig/4.1.0/go/go.swg +++ b/mac/bin/swig/share/swig/4.1.0/go/go.swg @@ -388,8 +388,9 @@ %typemap(gotype) SWIGTYPE && %{$gotypename%} -%typemap(in) SWIGTYPE && -%{ $1 = *($&1_ltype)&$input; %} +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) +%{ $1 = *($&1_ltype)&$input; +rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && %{ *($&1_ltype)&$result = $1; %} @@ -625,7 +626,7 @@ %typemap(goout) SWIGTYPE "" %typemap(directorin) SWIGTYPE -%{ $input = new $1_ltype((const $1_ltype &)$1); %} +%{ $input = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(godirectorin) SWIGTYPE "" diff --git a/mac/bin/swig/share/swig/4.1.0/go/std_string.i b/mac/bin/swig/share/swig/4.1.0/go/std_string.i index c362f5c5..35b4a5e4 100755 --- a/mac/bin/swig/share/swig/4.1.0/go/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/go/std_string.i @@ -52,6 +52,9 @@ class string; %typemap(godirectorin,fragment="CopyString") string %{ $result = swigCopyString($input) %} +%typemap(throws) string +%{ _swig_gopanic($1.c_str()); %} + %typemap(in) const string & %{ $*1_ltype $1_str($input.p, $input.n); @@ -88,22 +91,30 @@ class string; %typemap(godirectorin,fragment="CopyString") const string & %{ $result = swigCopyString($input) %} +%typemap(throws) const string & +%{ _swig_gopanic($1.c_str()); %} + %typemap(gotype) string * "*string" %typemap(in) string * (string temp) %{ - temp.assign($input->p, $input->n); - $1 = &temp; + if ($input) { + temp.assign($input->p, $input->n); + $1 = &temp; + } else + $1 = 0; %} %typemap(godirectorout) string * %{ - { + if $input != nil { p := Swig_malloc(len(*$input)) s := (*[1<<30]byte)(unsafe.Pointer(p))[:len(*$input)] copy(s, *$input) $result = (*string)(unsafe.Pointer(&s)) + } else { + $result = nil } %} @@ -125,17 +136,27 @@ class string; %typemap(directorin,fragment="AllocateString") string * (_gostring_ temp) %{ - temp = Swig_AllocateString($1->data(), $1->length()); - $input = &temp; + if ($1) { + temp = Swig_AllocateString($1->data(), $1->length()); + $input = &temp; + } else + $input = 0; %} %typemap(godirectorin,fragment="CopyString") string * %{ *$result = swigCopyString(*$input); %} %typemap(argout,fragment="AllocateString") string * -%{ *$input = Swig_AllocateString($1->data(), $1->length()); %} +%{ + if ($1) + *$input = Swig_AllocateString($1->data(), $1->length()); +%} %typemap(goargout,fragment="CopyString") string * -%{ *$input = swigCopyString(*$1) %} +%{ + if $input != nil { + *$1 = swigCopyString(*$input) + } +%} } diff --git a/mac/bin/swig/share/swig/4.1.0/go/swigmove.i b/mac/bin/swig/share/swig/4.1.0/go/swigmove.i new file mode 100755 index 00000000..e1984b6e --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/go/swigmove.i @@ -0,0 +1,15 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ + argp = ($&1_ltype)$input; + if (argp == NULL) { + _swig_gopanic("Attempt to dereference null $1_type"); + } + SwigValueWrapper< $1_ltype >::reset($1, argp); +%} diff --git a/mac/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg b/mac/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg index 2e96184b..689a1060 100755 --- a/mac/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg +++ b/mac/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg @@ -2,6 +2,12 @@ * guile_scm_run.swg * ----------------------------------------------------------------------------- */ +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" /* For 'volatile SCM *' in at least Guile 3.0 and earlier */ +#endif +#endif + #include #include #include @@ -112,6 +118,8 @@ static SCM swig_symbol = SCM_EOL; ( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \ ? scm_slot_ref(x, swig_symbol) : (x) ) +SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s); + SWIGINTERN SCM SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) { @@ -125,7 +133,7 @@ SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) else SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type); - if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) { + if (!cdata || scm_is_null(cdata->goops_class) || swig_make_func == SCM_EOL ) { return smob; } else { /* the scm_make() C function only handles the creation of gf, @@ -145,7 +153,7 @@ SWIGINTERN unsigned long SWIG_Guile_PointerAddress(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return 0; + if (scm_is_null(smob)) return 0; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -158,7 +166,7 @@ SWIGINTERN swig_type_info * SWIG_Guile_PointerType(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return NULL; + if (scm_is_null(smob)) return NULL; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -185,8 +193,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) swig_cast_info *cast; swig_type_info *from; SCM smob = SWIG_Guile_GetSmob(s); + int ret = SWIG_ERROR; - if (SCM_NULLP(smob)) { + if (scm_is_null(smob)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; #if SCM_MAJOR_VERSION >= 2 @@ -197,22 +206,36 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) } else if (SWIG_Guile_IsValidSmob(smob)) { from = (swig_type_info *) SCM_CELL_WORD_2(smob); if (!from) return SWIG_ERROR; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) { + if ((SCM_CELL_TYPE(smob) == swig_collectable_tag && SCM_CELL_WORD_1(smob) == 0) || SCM_CELL_TYPE(smob) == swig_tag) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + } + if (type) { cast = SWIG_TypeCheckStruct(from, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; + ret = SWIG_OK; } else { return SWIG_ERROR; } } else { *result = (void *) SCM_CELL_WORD_1(smob); - return SWIG_OK; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Guile_MarkPointerNoncollectable(smob); + } + if (flags & SWIG_POINTER_CLEAR) { + SCM_SET_CELL_WORD_1(smob, 0); } } - return SWIG_ERROR; + return ret; } SWIGINTERNINLINE void * @@ -252,7 +275,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_tag); } @@ -265,7 +288,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerDestroyed(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_destroyed_tag); } @@ -486,20 +509,20 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest, int i; int num_args_passed = 0; for (i = 0; i (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/guile/std_string.i b/mac/bin/swig/share/swig/4.1.0/guile/std_string.i index fbd27547..c49bfcb0 100755 --- a/mac/bin/swig/share/swig/4.1.0/guile/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/guile/std_string.i @@ -83,4 +83,13 @@ namespace std { $result = SWIG_str02scm($1.c_str()); } + %typemap(throws) string { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } + + %typemap(throws) const string & { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } } diff --git a/mac/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i new file mode 100755 index 00000000..6f907e90 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/guile/swigmove.i b/mac/bin/swig/share/swig/4.1.0/guile/swigmove.i new file mode 100755 index 00000000..87ab91ea --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/guile/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/guile/swigrun.i b/mac/bin/swig/share/swig/4.1.0/guile/swigrun.i index 4b9ea2c7..e4573eb3 100755 --- a/mac/bin/swig/share/swig/4.1.0/guile/swigrun.i +++ b/mac/bin/swig/share/swig/4.1.0/guile/swigrun.i @@ -4,8 +4,6 @@ #ifdef SWIGGUILE_SCM -/* Hook the runtime module initialization - into the shared initialization function SWIG_Guile_Init. */ %runtime %{ /* Hook the runtime module initialization into the shared initialization function SWIG_Guile_Init. */ diff --git a/mac/bin/swig/share/swig/4.1.0/guile/typemaps.i b/mac/bin/swig/share/swig/4.1.0/guile/typemaps.i index f4d3a011..45a2208f 100755 --- a/mac/bin/swig/share/swig/4.1.0/guile/typemaps.i +++ b/mac/bin/swig/share/swig/4.1.0/guile/typemaps.i @@ -4,17 +4,43 @@ * Guile-specific typemaps * ----------------------------------------------------------------------------- */ +/* These are defined with a view to eventually merging with those defined for other target languages in swigtypemaps.swg and exception.swg */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(_code, _type, _name, _argn) scm_wrong_type_arg((char *) FUNC_NAME, _argn, $input) +#define %as_voidptr(ptr) (void*)(ptr) +#define %argument_nullref(_type, _name, _argn) scm_misc_error(FUNC_NAME, "invalid null reference for argument " #_argn " of type '" _type "'", SCM_EOL) +#define %releasenotowned_fail(_code, _type, _name, _argn) scm_misc_error(FUNC_NAME, "cannot release ownership as memory is not owned for argument " #_argn " of type '" _type "'", SCM_EOL) + /* Pointers */ -%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { +%typemap(in) SWIGTYPE *, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } -%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""; +%typemap(in) SWIGTYPE & ($1_ltype argp) { + argp = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = argp; +} +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +} +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "" %typemap(in) void * { $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0); } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(varin) SWIGTYPE * { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0); @@ -115,8 +141,9 @@ /* Pass-by-value */ -%typemap(in) SWIGTYPE($&1_ltype argp) { +%typemap(in) SWIGTYPE ($&1_ltype argp) { argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } $1 = *argp; } @@ -130,7 +157,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -145,8 +172,7 @@ %typemap(varout) SWIGTYPE #ifdef __cplusplus { - $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype&) $1); + $&1_ltype resultptr = ($&1_ltype)&$1; $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -322,14 +348,14 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* SWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after the function call. */ -%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);"; +%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);" %typemap (freearg) char **INPUT, char **BOTH "if (must_free$argnum) SWIG_free(*$1);" %typemap (freearg) char **OUTPUT "SWIG_free(*$1);" /* But this shall not apply if we try to pass a single char by reference. */ -%typemap (freearg) char *OUTPUT, char *BOTH ""; +%typemap (freearg) char *OUTPUT, char *BOTH "" /* If we set a string variable, delete the old result first, unless const. */ @@ -349,13 +375,13 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* Void */ -%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;"; +%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;" /* SCM is passed through */ typedef unsigned long SCM; -%typemap (in) SCM "$1=$input;"; -%typemap (out) SCM "$result=$1;"; +%typemap (in) SCM "$1=$input;" +%typemap (out) SCM "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) SCM "$1=1;"; /* ------------------------------------------------------------ @@ -373,11 +399,6 @@ typedef unsigned long SCM; * taken from typemaps/swigtype.swg * ------------------------------------------------------------ */ -#define %set_output(obj) $result = obj -#define %set_varoutput(obj) $result = obj -#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input); -#define %as_voidptr(ptr) (void*)(ptr) - %typemap(in) SWIGTYPE (CLASS::*) { int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { @@ -426,7 +447,7 @@ typedef unsigned long SCM; %typecheck(SWIG_TYPECHECK_BOOL) bool, bool&, const bool& { - $1 = SCM_BOOLP($input) ? 1 : 0; + $1 = scm_is_bool($input) ? 1 : 0; } %typecheck(SWIG_TYPECHECK_DOUBLE) diff --git a/mac/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i b/mac/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i index 3bc80b46..072a31e8 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i @@ -33,7 +33,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -342,7 +342,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/mac/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i index 325a6832..ce00162d 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i @@ -29,11 +29,11 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE %{ $input = 0; - *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} + *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { diff --git a/mac/bin/swig/share/swig/4.1.0/java/director.swg b/mac/bin/swig/share/swig/4.1.0/java/director.swg index e911a3da..53651355 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/director.swg +++ b/mac/bin/swig/share/swig/4.1.0/java/director.swg @@ -51,6 +51,10 @@ SWIGINTERN int Swig::GetThreadName(char *name, size_t len) { #endif +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) +#include +#endif + namespace Swig { /* Java object wrapper */ @@ -133,6 +137,19 @@ namespace Swig { } } +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + static void detach(void *jvm) { + static_cast(jvm)->DetachCurrentThread(); + } + + static void make_detach_key() { + pthread_key_create(&detach_key_, detach); + } + + /* thread-local key to register a destructor */ + static pthread_key_t detach_key_; +#endif + private: /* pointer to Java object */ jobject jthis_; @@ -140,6 +157,10 @@ namespace Swig { bool weak_global_; }; +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + pthread_key_t JObjectWrapper::detach_key_; +#endif + /* Local JNI reference deleter */ class LocalRefGuard { JNIEnv *jenv_; @@ -201,9 +222,19 @@ namespace Swig { #else director_->swig_jvm_->AttachCurrentThread(jenv, &args); #endif + +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + // At least on Android 6, detaching after every call causes a memory leak. + // Instead, register a thread desructor and detach only when the thread ends. + // See https://developer.android.com/training/articles/perf-jni#threads + static pthread_once_t once = PTHREAD_ONCE_INIT; + + pthread_once(&once, JObjectWrapper::make_detach_key); + pthread_setspecific(JObjectWrapper::detach_key_, director->swig_jvm_); +#endif } ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) +#if !defined(SWIG_JAVA_DETACH_ON_THREAD_END) && !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. if (env_status == JNI_EDETACHED) diff --git a/mac/bin/swig/share/swig/4.1.0/java/java.swg b/mac/bin/swig/share/swig/4.1.0/java/java.swg index 8f95f3a3..8719818b 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/java.swg +++ b/mac/bin/swig/share/swig/4.1.0/java/java.swg @@ -665,7 +665,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %} +%{ *($&1_ltype*)&$result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -676,7 +676,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)" %typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)" @@ -692,14 +692,15 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } } %typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; } %} -%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input; +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %} %typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) { @@ -1101,7 +1102,8 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } jobjectArray "$javainput" %typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)" -%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE && "$javaclassname.swigRelease($javainput)" %typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)" /* The javaout typemap is used for converting function return types from the return type @@ -1216,6 +1218,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} // Derived proxy classes @@ -1230,6 +1244,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} %enddef @@ -1249,6 +1275,10 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } %} %typemap(javabody) TYPE (CLASS::*) %{ diff --git a/mac/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i index 69ac2841..aee9b482 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i @@ -1,27 +1,41 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (jni) std::auto_ptr "jlong" -%typemap (jtype) std::auto_ptr "long" -%typemap (jstype) std::auto_ptr "$typemap(jstype, TYPE)" -%typemap (out) std::auto_ptr %{ - jlong lpp = 0; - *(TYPE**) &lpp = $1.release(); - $result = lpp; +%typemap (jni) std::auto_ptr< TYPE > "jlong" +%typemap (jtype) std::auto_ptr< TYPE > "long" +%typemap (jstype) std::auto_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > (TYPE *auto_temp) +%{ auto_temp = *(TYPE **)&$input; + $1.reset(auto_temp); %} + +%typemap(javain) std::auto_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; %} -%typemap(javaout) std::auto_ptr { - long cPtr = $jnicall; - return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); - } -%template() std::auto_ptr; + +%typemap(javaout) std::auto_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/java/std_set.i b/mac/bin/swig/share/swig/4.1.0/java/std_set.i index 73e0c2cf..053866bc 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/std_set.i +++ b/mac/bin/swig/share/swig/4.1.0/java/std_set.i @@ -96,6 +96,10 @@ class set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/mac/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i new file mode 100755 index 00000000..838ca495 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) + +%typemap (jni) std::unique_ptr< TYPE > "jlong" +%typemap (jtype) std::unique_ptr< TYPE > "long" +%typemap (jstype) std::unique_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > (TYPE *unique_temp) +%{ unique_temp = *(TYPE **)&$input; + $1.reset(unique_temp); %} + +%typemap(javain) std::unique_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; +%} + +%typemap(javaout) std::unique_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/java/std_unordered_set.i b/mac/bin/swig/share/swig/4.1.0/java/std_unordered_set.i index 59726e94..ddcedf05 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/std_unordered_set.i +++ b/mac/bin/swig/share/swig/4.1.0/java/std_unordered_set.i @@ -92,6 +92,10 @@ class unordered_set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/mac/bin/swig/share/swig/4.1.0/java/std_wstring.i b/mac/bin/swig/share/swig/4.1.0/java/std_wstring.i index 3e462256..efa9e63b 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/std_wstring.i +++ b/mac/bin/swig/share/swig/4.1.0/java/std_wstring.i @@ -88,9 +88,12 @@ class wstring; //%typemap(typecheck) wstring = wchar_t *; %typemap(throws) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} // const wstring & %typemap(jni) const wstring & "jstring" @@ -166,9 +169,12 @@ class wstring; //%typemap(typecheck) const wstring & = wchar_t *; %typemap(throws) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} } diff --git a/mac/bin/swig/share/swig/4.1.0/java/swiginterface.i b/mac/bin/swig/share/swig/4.1.0/java/swiginterface.i index 0a0f7806..c3ca97d3 100755 --- a/mac/bin/swig/share/swig/4.1.0/java/swiginterface.i +++ b/mac/bin/swig/share/swig/4.1.0/java/swiginterface.i @@ -40,7 +40,7 @@ %typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()" %typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE [] %{ *(($&1_ltype)&$input) = ($1_ltype) $1; %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE & diff --git a/mac/bin/swig/share/swig/4.1.0/java/swigmove.i b/mac/bin/swig/share/swig/4.1.0/java/swigmove.i new file mode 100755 index 00000000..671b988a --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/java/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ argp = *($&1_ltype*)&$input; + if (!argp) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(javain) SWIGTYPE MOVE "$&javaclassname.swigRelease($javainput)" diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg index 62f38397..e75ac001 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg @@ -1,6 +1,6 @@ %fragment ("js_check_arg_count", "templates") %{ if (argc != $jsargcount) { - SE_REPORT_ERROR("$jswrapper: wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); return false; }%} @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ %fragment ("js_ctor", "templates") %{ -// js_ctor static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; @@ -39,14 +38,9 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_ctor_dispatcher size_t argc = s.args().size(); bool ret = false; - - // switch all cases by means of series of if-returns. $jsdispatchcases - - // default: SE_REPORT_ERROR("Illegal arguments for construction of $jsname"); return false; } @@ -64,7 +58,6 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_overloaded_ctor const auto& args = s.args(); CC_UNUSED bool ok = true; $jslocals @@ -84,7 +77,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_ctor_dispatch_case", "templates") %{ - // js_ctor_dispatch_case if(argc == $jsargcount) { ret = $jswrapper(s); if (ret) { return ret; } /* reset exception and return */ @@ -99,7 +91,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_dtor", "templates") %{ -// js_dtor static bool $jswrapper(se::State& s) { return true; } @@ -114,7 +105,7 @@ SE_BIND_FINALIZE_FUNC($jswrapper) %} %fragment ("js_dtoroverride", "templates") %{ static bool $jswrapper(se::State& s) -{// js_dtoroverride +{ return true; } SE_BIND_FINALIZE_FUNC($jswrapper) %} @@ -169,7 +160,6 @@ SE_BIND_PROP_SET($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -196,7 +186,6 @@ SE_BIND_FUNC($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function_dispatcher CC_UNUSED bool ok = true; const auto& args = s.args(); size_t argc = args.size(); @@ -216,7 +205,7 @@ SE_BIND_FUNC($jswrapper) %} %fragment ("js_overloaded_function", "templates") %{ static bool $jswrapper(se::State& s) -{// js_overloaded_function +{ $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -233,7 +222,7 @@ static bool $jswrapper(se::State& s) * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function_dispatch_case", "templates") -%{// js_function_dispatch_case +%{ if (argc == $jsargcount) { ok = $jswrapper(s); if (ok) { return true; } diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg index bc2dc57a..22c59276 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg @@ -38,36 +38,32 @@ /* ----------------------------------------------------------------------------- * standard typemaps * ----------------------------------------------------------------------------- */ -/* NEW LANGUAGE NOTE: - the 'checkfn' param is something that I added for typemap(in) - it is an optional fn call to check the type of the lua object - the fn call must be of the form - int checkfn(lua_State *L, int index); - and return 1/0 depending upon if this is the correct type - For the typemap(out), an additional SWIG_arg parameter must be incremented - to reflect the number of values returned (normally SWIG_arg++; will do) -*/ // number - -%typemap(in) int, short, long, signed char, float, double -%{// %typemap(in) int, short, long, signed char, float, double - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +%typemap(in) char, int, short, long, signed char, float, double, int8_t, int16_t, int32_t, int64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // additional check for unsigned numbers, to not permit negative input -%typemap(in) unsigned int, unsigned short, unsigned long, unsigned char -%{// %typemap(in) unsigned int, unsigned short, unsigned long, unsigned char - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); +%typemap(in) unsigned char, unsigned int, unsigned short, unsigned long, unsigned char, uint8_t, uint16_t, uint32_t, uint64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) int,short,long, - unsigned int,unsigned short,unsigned long, +%typemap(out) char, int,short,long, + unsigned char, unsigned int,unsigned short,unsigned long, signed char,unsigned char, - float,double + float,double, + int8_t, int16_t, int32_t, int64_t, + uint8_t, uint16_t, uint32_t, uint64_t, + size_t, ssize_t %{ - // out 1 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); %} + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); %} + +%apply long {long long, signed long long, unsigned long long}; +// size_t (which is just a unsigned long) +%apply unsigned long { size_t }; // we must also provide typemaps for primitives by const reference: // given a function: @@ -75,27 +71,17 @@ // SWIG assumes that this code will need a pointer to int to be passed in // (this might be ok for objects by const ref, but not for numeric primitives) // therefore we add a set of typemaps to fix this (for both in & out) -%typemap(in,checkfn="lua_isnumber") const int& ($*1_ltype temp) +%typemap(in) const int& ($*1_ltype temp), const unsigned int& ($*1_ltype temp) %{ - //temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - $1 = &temp; -%} - -%typemap(in,checkfn="lua_isnumber") const unsigned int& //($*1_ltype temp) -%{ - //SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative"); - // temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + ok &= sevalue_to_native($input, &temp, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(out) const int&, const unsigned int& -%{ // out 2 - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // for the other numbers we can just use an apply statement to cover them @@ -105,192 +91,101 @@ %apply const unsigned int & {const unsigned short&,const unsigned long&, const unsigned char&}; -/* enums have to be handled slightly differently - VC++ .net will not allow a cast from lua_Number(double) to enum directly. -*/ -%typemap(in) enum SWIGTYPE (int32_t temp) -%{ // %typemap(in) enum SWIGTYPE (int32_t temp) - ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1 = ($ltype)temp;%} - -%typemap(out) enum SWIGTYPE (int32_t temp) -%{ // out 4 - s.rval().setInt32(static_cast($1));%} - -// and const refs -%typemap(in) const enum SWIGTYPE &($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE & - temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%} - -%typemap(in) const enum SWIGTYPE &&($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE && - 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++;%} +%apply const long& {const long long&, const signed long long&, const unsigned long long&}; +%apply const unsigned long & { const size_t & }; %typemap(in) bool -%{ // %typemap(in) bool +%{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(out) bool -%{// out 5 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/);%} +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject());%} -// for const bool&, SWIG treats this as a const bool* so we must dereference it -%typemap(in,checkfn="lua_isboolean") const bool& (bool temp) -%{temp=(lua_toboolean(L, $input)!=0); - $1=&temp;%} +%typemap(out) bool & +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject());%} -%typemap(out) const bool& -%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%} - -// strings (char * and char[]) - -%typemap(in) const char * (ccstd::string temp), char * (ccstd::string temp) -%{ +%typemap(in) const char * (ccstd::string temp) +%{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) temp.c_str(); %} -%typemap(in) const char[ANY], char[ANY] -%{$1 = ($ltype)lua_tostring(L, $input);%} - %typemap(out) const char *, char * -%{ // out 6 +%{ ok &= nativevalue_to_se($1, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) const char[ANY], char[ANY] -%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%} - -// char's -// currently treating chars as small strings, not as numbers -// (however signed & unsigned char's are numbers...) -%typemap(in) char -%{$1 = (lua_tostring(L, $input))[0];%} - -%typemap(out) char -%{ lua_pushlstring(L, &$1, 1); SWIG_arg++;%} - -// by const ref -%typemap(in) const char& (char temp) -%{temp = (lua_tostring(L, $input))[0]; $1=&temp;%} - -%typemap(out) const char& -%{ lua_pushlstring(L, $1, 1); SWIG_arg++;%} +%apply const char* {char*, const char[ANY], char[ANY]} // pointers and references -// under SWIG rules, it is ok, to have a pass in a lua nil, +// under SWIG rules, it is ok, to have a pass in a javascript null, // it should be converted to a SWIG NULL. // This will only be allowed for pointers & arrays, not refs or by value -// the checkfn lua_isuserdata will only work for userdata -// the checkfn SWIG_isptrtype will work for both userdata and nil %typemap(in) SWIGTYPE* -%{ // %typemap(in) SWIGTYPE* +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE[] -%{ // %typemap(in) SWIGTYPE[] +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE& ($*ltype temp) -%{// %typemap(in) SWIGTYPE& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(in) SWIGTYPE&& ($*ltype temp) -%{// %typemap(in) SWIGTYPE&& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} // out is simple %typemap(out) SWIGTYPE& -%{ // %typemap(out) SWIGTYPE& - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE(*$1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE* -%{ // %typemap(out) SWIGTYPE* - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE&& -%{ // %typemap(out) SWIGTYPE&& - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} -// dynamic casts -// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is -// the we return it as the correct type -%typemap(out) SWIGTYPE *DYNAMIC, - SWIGTYPE &DYNAMIC -{ - swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); - SWIG_NewPointerObj222(L,(void*)$1,ty,$owner); SWIG_arg++; -} - - // passing objects by value // SWIG_ConvertPtr wants an object pointer (the $<ype argp) // then dereferences it to get the object %typemap(in) SWIGTYPE //($<ype argp) %{ - // %typemap(in) SWIGTYPE value in ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} - -// Also needed for object ptrs by const ref -// eg A* const& ref_pointer(A* const& a); -// found in mixed_types.i -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE *const&($*ltype temp) -%{temp=($*ltype)SWIG_MustGetPtr111(L,$input,$*descriptor,0,$argnum,"$symname"); -$1=($1_ltype)&temp;%} - -%typemap(out) SWIGTYPE *const& -%{ // %typemap(out) SWIGTYPE *const& - SWIG_NewPointerObj333(L,*$1,$*descriptor,$owner); SWIG_arg++; %} - - -// DISOWN-ing typemaps -// if you have an object pointer which must be disowned, use this typemap -// eg. for void destroy_foo(Foo* toDie); -// use %apply SWIGTYPE* DISOWN {Foo* toDie}; -// you could just use %delobject, but this is more flexible -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] -%{ // %typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] - if (!SWIG_IsOK(SWIG_ConvertPtrIn222(L,$input,(void**)&$1,$descriptor,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("$symname",$argnum,$descriptor); - } -%} - - // Primitive types--return by value // must make a new object, copy the data & return the new object // Note: the brackets are {...} and not %{..%}, because we want them to be included in the wrapper // this is because typemap(out) does not support local variables, like in typemap(in) does // and we need the $&1_ltype resultptr; to be declared %typemap(out) SWIGTYPE -%{ // %typemap(out) SWIGTYPE +%{ ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} @@ -299,17 +194,14 @@ $1=($1_ltype)&temp;%} // so the standard wrapping cannot be done // nor can you cast a member function pointer to a void* (obviously) // therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written -%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) +%typemap(in) SWIGTYPE (CLASS::*) %{ - // %typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) - if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor))) - SWIG_fail_ptr("$symname",$argnum,$descriptor); + static_assert(false, "Binding member function pointer is not supported!"); %} %typemap(out) SWIGTYPE (CLASS::*) %{ - // %typemap(out) SWIGTYPE (CLASS::*) - SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++; + static_assert(false, "Returning member function pointer is not supported!"); %} @@ -320,20 +212,9 @@ $1=($1_ltype)&temp;%} A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) but if it's an output, then it should be wrapped like any other SWIG object (using default typemap) */ -%typemap(in,checkfn="SWIG_isptrtype") void* +%typemap(in) void* %{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor");%} - -/* long long is another special case: -as lua only supports one numeric type (lua_Number), we will just -cast it to that & accept the loss of precision. -An alternative solution would be a long long struct or class -with the relevant operators. -*/ -%apply long {long long, signed long long, unsigned long long}; -%apply const long& {const long long&, const signed long long&, const unsigned long long&}; - - + SE_PRECONDITION2(ok, false, "Error processing arguments");%} /* ----------------------------------------------------------------------------- * typecheck rules @@ -343,100 +224,10 @@ These define the detection routines which will spot what parameters match which function */ -// unfortunately lua only considers one type of number -// so all numbers (int,float,double) match -// you could add an advanced fn to get type & check if it's integral -%typecheck(SWIG_TYPECHECK_INTEGER) - int, short, long, - unsigned int, unsigned short, unsigned long, - signed char, unsigned char, - long long, unsigned long long, signed long long, - const int &, const short &, const long &, - 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&, const enum SWIGTYPE &&, - float, double, const float &, const double& -{ - $1 = lua_isnumber(L,$input); -} - -// %typecheck(SWIG_TYPECHECK_BOOL) -// bool, const bool & -// { -// $1 = lua_isboolean(L,$input); -// } - -// special check for a char (string of length 1) -// %typecheck(SWIG_TYPECHECK_CHAR,fragment="SWIG_lua_isnilstring") char, const char& { -// $1 = SWIG_lua_isnilstring(L,$input) && (lua_rawlen(L,$input)==1); -// } - -// %typecheck(SWIG_TYPECHECK_STRING,fragment="SWIG_lua_isnilstring") char *, char[] { -// $1 = SWIG_lua_isnilstring(L,$input); -// } - %typemap(in) SWIGTYPE *self %{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} + if (nullptr == $1) return true;%} -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr61(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_ConvertPtr62(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr63(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr64(L,$input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr65(L,$input, (void **) &ptr, 0, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// // Also needed for object pointers by const ref -// // eg const A* ref_pointer(A* const& a); -// // found in mixed_types.i -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& -// { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr66(L,$input, (void **) &ptr, $*descriptor, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } /* ----------------------------------------------------------------------------- * Others @@ -451,16 +242,14 @@ parameters match which function %apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } %apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } -// size_t (which is just a unsigned long) -%apply unsigned long { size_t }; -%apply const unsigned long & { const size_t & }; + /* ----------------------------------------------------------------------------- * Specials * ----------------------------------------------------------------------------- */ // swig::LANGUAGE_OBJ was added to allow containers of native objects -// however it's rather difficult to do this in lua, as you cannot hold pointers +// however it's rather difficult to do this in javascript, as you cannot hold pointers // to native objects (they are held in the interpreter) // therefore for now: just ignoring this feature #ifdef __cplusplus @@ -475,40 +264,16 @@ parameters match which function #endif // __cplusplus -// %typemap(memberin) float [ANY] { -// int i; -// for (i = 0; i < $1_dim0; i++) { -// $1[i] = $input[i]; -// } -// } - -// %typemap(out) float [ANY] { -// int i; -// $result = PyList_New($1_dim0); -// for (i = 0; i < $1_dim0; i++) { -// PyObject *o = PyFloat_FromDouble((double) $1[i]); -// PyList_SetItem($result, i, o); -// } -// } - -// %typemap(check) double %{ -// if ($1 < 0) { -// croak("hahaha Expecting a positive number"); -// } -// %} - // Cocos custom type %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ - // %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) &temp; %} %typemap(out) cc::Float32Array %{ - // %typemap(out) cc::Float32Array ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} \ No newline at end of file diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i index 17e6258a..3942d7a4 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i @@ -32,71 +32,71 @@ assert(s==s2) namespace std { -%naturalvar string; +// %naturalvar string; -%typemap(in) string -%{// string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +// %typemap(in) string +// %{// string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) string -%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string +// %{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in) string *self -%{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} +// %typemap(in) string *self +// %{ $1 = SE_THIS_OBJECT<$*ltype>(s); +// SE_PRECONDITION2($1, false, "Invalid Native Object"); %} -%typemap(in,checkfn="lua_isstring") string* -%{// string* - std::string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} +// %typemap(in,checkfn="lua_isstring") string* +// %{// string* +// std::string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); +// $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} -%typemap(out) string* -%{// out string* - lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string* +// %{// out string* +// lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) -%{ // const std::string& - temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} +// %typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) +// %{ // const std::string& +// temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} -%typemap(out) const string& -%{ // out const string& - lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(out) const string& +// %{ // out const string& +// lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -// %typecheck(SWIG_TYPECHECK_STRING) string, const string& { -// $1 = lua_isstring(L,$input); -// } +// // %typecheck(SWIG_TYPECHECK_STRING) string, const string& { +// // $1 = lua_isstring(L,$input); +// // } -/* -std::string& can be wrapped, but you must inform SWIG if it is in or out +// /* +// std::string& can be wrapped, but you must inform SWIG if it is in or out -eg: -void fn(std::string& str); -Is this an in/out/inout value? +// eg: +// void fn(std::string& str); +// Is this an in/out/inout value? -Therefore you need the usual -%apply (std::string& INOUT) {std::string& str}; -or -%apply std::string& INOUT {std::string& str}; -typemaps to tell SWIG what to do. -*/ +// Therefore you need the usual +// %apply (std::string& INOUT) {std::string& str}; +// or +// %apply std::string& INOUT {std::string& str}; +// typemaps to tell SWIG what to do. +// */ -%typemap(in) string &INPUT=const string &; +// %typemap(in) string &INPUT=const string &; -%typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) -%{ $1 = &temp; %} +// %typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) +// %{ $1 = &temp; %} -%typemap(argout) string &OUTPUT -%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(argout) string &OUTPUT +// %{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -%typemap(in) string &INOUT =const string &; -%typemap(in) string *INOUT %{ - // inout ... string* -%}; +// %typemap(in) string &INOUT =const string &; +// %typemap(in) string *INOUT %{ +// // inout ... string* +// %}; -%typemap(argout) string &INOUT = string &OUTPUT; +// %typemap(argout) string &INOUT = string &OUTPUT; /* A really cut down version of the string class diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg index 20e74787..4d5a9355 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg @@ -7,23 +7,27 @@ #define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0) #define SWIG_fail goto fail -SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) { - JSStringRef message = JSStringCreateWithUTF8CString(type); +SWIGRUNTIME void SWIG_Javascript_Raise_ValueRef(JSContextRef context, JSValueRef *exception, JSValueRef valRef) { JSValueRef error_arguments[1]; JSObjectRef exception_object; - JSValueRef exception_value; - exception_value = JSValueMakeString(context, message); /* Converting the result to an object will let JavascriptCore add "sourceURL" (file) and "line" (number) and "message" to the exception, instead of just returning a raw string. This is extremely important for debugging your errors. Using JSObjectMakeError is better than JSValueToObject because the latter only populates "sourceURL" and "line", but not "message" or any others I don't know about. */ - error_arguments[0] = exception_value; + error_arguments[0] = valRef; exception_object = JSObjectMakeError(context, 1, error_arguments, NULL); /* Return the exception_object */ *exception = exception_object; +} + +SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* msg) { + JSStringRef message = JSStringCreateWithUTF8CString(msg); + JSValueRef exception_value = JSValueMakeString(context, message); + + SWIG_Javascript_Raise_ValueRef(context, exception, exception_value); JSStringRelease(message); } @@ -135,8 +139,15 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob } } - if (flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg index 55c8e4b9..5c8081a8 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg @@ -75,6 +75,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz } %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -166,6 +167,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg index e8fbbeca..fd8e7aa2 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg @@ -41,7 +41,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type) +#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise_ValueRef(context, exception, obj) %insert("runtime") %{ #define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1) diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg index 0af406b9..8ed571df 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg @@ -81,7 +81,7 @@ int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } } @@ -149,7 +149,7 @@ int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } %#endif } diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg index 7e50a8b8..f7627085 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg @@ -96,6 +96,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) { SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); } +SWIGINTERN void SWIG_V8_Raise(SWIGV8_VALUE obj, const char *msg) { + SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_TO_STRING(obj))); +} + + /* Note: There are two contexts for handling errors. A static V8ErrorHandler is used in not overloaded methods. @@ -194,8 +199,15 @@ SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swi *ptr = cdata->swigCObject; } - if(flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; } diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg index cb31100c..c4d341be 100755 --- a/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg @@ -37,7 +37,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type) +#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(obj, type) /* Include the unified typemap library */ %include diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i b/mac/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/lua/argcargv.i b/mac/bin/swig/share/swig/4.1.0/lua/argcargv.i new file mode 100755 index 00000000..94cc8ed4 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/lua/argcargv.i @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + + Use it as follows: + + %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } + extern int mainApp(size_t argc, const char **argv); + + then from lua: + + args = { "arg0", "arg1" } + mainApp(args) + + * ------------------------------------------------------------ */ + +%{ +SWIGINTERN int SWIG_argv_size(lua_State* L, int index) { + int n=0; + while(1){ + lua_rawgeti(L,index,n+1); + if (lua_isnil(L,-1)) + break; + ++n; + lua_pop(L,1); + } + lua_pop(L,1); + return n; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + if (lua_istable(L,$input)) { + int i, size = SWIG_argv_size(L,$input); + $1 = ($1_ltype) size; + $2 = (char **) malloc((size+1)*sizeof(char *)); + for (i = 0; i < size; i++) { + lua_rawgeti(L,$input,i+1); + if (lua_isnil(L,-1)) + break; + $2[i] = (char *)lua_tostring(L, -1); + lua_pop(L,1); + } + $2[i]=NULL; + } else { + $1 = 0; $2 = 0; + lua_pushstring(L,"Expecting argv array"); + lua_error(L); + } +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = lua_istable(L,$input); +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((char *) $2); +} diff --git a/mac/bin/swig/share/swig/4.1.0/lua/lua.swg b/mac/bin/swig/share/swig/4.1.0/lua/lua.swg index 5144f601..12c635d7 100755 --- a/mac/bin/swig/share/swig/4.1.0/lua/lua.swg +++ b/mac/bin/swig/share/swig/4.1.0/lua/lua.swg @@ -213,7 +213,7 @@ SWIG_fail;%} // %apply SWIGTYPE EXCEPTION_BY_VAL {FooBar}; // %apply SWIGTYPE& EXCEPTION_BY_VAL {FooBar&}; // note: need & twice %typemap(throws) SWIGTYPE EXCEPTION_BY_VAL -%{SWIG_NewPointerObj(L,(void *)new $1_ltype(($1_ltype &) $1),$&1_descriptor,1); +%{SWIG_NewPointerObj(L,(void *)new $1_ltype($1),$&1_descriptor,1); SWIG_fail;%} // similar for object reference diff --git a/mac/bin/swig/share/swig/4.1.0/lua/luarun.swg b/mac/bin/swig/share/swig/4.1.0/lua/luarun.swg index 572da470..f47fd4fa 100755 --- a/mac/bin/swig/share/swig/4.1.0/lua/luarun.swg +++ b/mac/bin/swig/share/swig/4.1.0/lua/luarun.swg @@ -1757,6 +1757,7 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *t (if possible) */ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags) { + int ret = SWIG_ERROR; swig_lua_userdata *usr; swig_cast_info *cast; /* special case: lua nil => NULL pointer */ @@ -1773,25 +1774,36 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ if (usr) { + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own) + { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ { - usr->own=0; + usr->own = 0; } if (!type) /* special cast void*, no casting fn */ { *ptr=usr->ptr; - return SWIG_OK; /* ok */ + ret = SWIG_OK; } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) + else { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ + cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + ret = SWIG_OK; + } + } + if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR)) + { + usr->ptr = 0; } } - return SWIG_ERROR; /* error */ + return ret; } SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags, diff --git a/mac/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg b/mac/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg index f8e12846..7d23917e 100755 --- a/mac/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg @@ -151,11 +151,17 @@ 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); +%typemap(in,checkfn="lua_isuserdata",fragment="") SWIGTYPE&& (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor); + } } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); %} // out is simple @@ -217,7 +223,7 @@ $1=($1_ltype)&temp;%} #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultptr = new $1_ltype($1); SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++; } #else @@ -248,7 +254,7 @@ $1=($1_ltype)&temp;%} // void (must be empty without the SWIG_arg++) -%typemap(out) void ""; +%typemap(out) void "" /* void* is a special case A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) diff --git a/mac/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i new file mode 100755 index 00000000..b3b71d0f --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i new file mode 100755 index 00000000..ad08f3b0 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/lua/swigmove.i b/mac/bin/swig/share/swig/4.1.0/lua/swigmove.i new file mode 100755 index 00000000..d130e797 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/lua/swigmove.i @@ -0,0 +1,18 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, checkfn="lua_isuserdata", noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $&1_descriptor); + } + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg b/mac/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg index 27907311..57d04081 100755 --- a/mac/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg @@ -125,6 +125,7 @@ struct swig_mz_proxy { Scheme_Type mztype; swig_type_info *type; void *object; + int own; }; static Scheme_Type swig_type; @@ -135,7 +136,7 @@ mz_free_swig(void *p, void *data) { if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type) return; if (proxy->type) { - if (proxy->type->clientdata) { + if (proxy->type->clientdata && proxy->own) { ((Scheme_Prim *)proxy->type->clientdata)(1, (Scheme_Object **)&proxy); } } @@ -143,42 +144,61 @@ mz_free_swig(void *p, void *data) { static Scheme_Object * SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) { - struct swig_mz_proxy *new_proxy; - new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); - new_proxy->mztype = swig_type; - new_proxy->type = type; - new_proxy->object = ptr; - if (owner) { - scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + if (ptr) { + struct swig_mz_proxy *new_proxy; + new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); + new_proxy->mztype = swig_type; + new_proxy->type = type; + new_proxy->object = ptr; + new_proxy->own = owner & SWIG_POINTER_OWN; + if (new_proxy->own) { + scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + } + return (Scheme_Object *) new_proxy; + } else { + return scheme_make_null(); } - return (Scheme_Object *) new_proxy; } static int SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) { swig_cast_info *cast; + int ret = SWIG_ERROR; if (SCHEME_NULLP(s)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } else if (SCHEME_TYPE(s) == swig_type) { struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) s; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE && !proxy->own) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + if (type) { cast = SWIG_TypeCheckStruct(proxy->type, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, proxy->object, &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return 0; + ret = SWIG_OK; } else { - return 1; + return SWIG_ERROR; } } else { *result = proxy->object; - return 0; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + scheme_subtract_finalizer(proxy, mz_free_swig, NULL); + proxy->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + proxy->object = 0; } } - return 1; + return ret; } static SWIGINLINE void * diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i new file mode 100755 index 00000000..c61bc8b2 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/std_string.i b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_string.i index b19e8567..70673ead 100755 --- a/mac/bin/swig/share/swig/4.1.0/mzscheme/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_string.i @@ -52,6 +52,13 @@ namespace std { $result = scheme_make_string($1->c_str()); } + %typemap(throws) string { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } + + %typemap(throws) const string & { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } } diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i new file mode 100755 index 00000000..53cf4669 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i b/mac/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i new file mode 100755 index 00000000..bbfcdcb1 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i b/mac/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i index 09bda2cc..6c31aea5 100755 --- a/mac/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i +++ b/mac/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i @@ -2,6 +2,12 @@ * typemaps.i * ----------------------------------------------------------------------------- */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(code, type, name, argn) scheme_wrong_type(FUNC_NAME, type, argn, argc, argv) +#define %as_voidptr(ptr) (void*)(ptr) + + /* The MzScheme module handles all types uniformly via typemaps. Here are the definitions. */ @@ -66,9 +72,23 @@ #ifdef __cplusplus -%typemap(in) SWIGTYPE &, SWIGTYPE && { +%typemap(in) SWIGTYPE & { $1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0); - if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)"); + if ($1 == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); +} + +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); } %typemap(out) SWIGTYPE &, SWIGTYPE && { @@ -105,8 +125,8 @@ $1 = ($1_type) SWIG_convert_int($input); } -%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; -%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; +%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);" +%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);" /* Pass-by-value */ @@ -127,7 +147,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -143,7 +163,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -270,14 +290,18 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double, REF_MAP(double, SCHEME_REALP, scheme_real_to_double, scheme_make_double, real); +%typemap(throws) char * { + scheme_signal_error("%s: %s", FUNC_NAME, $1); +} + /* Void */ -%typemap(out) void "$result = scheme_void;"; +%typemap(out) void "$result = scheme_void;" /* Pass through Scheme_Object * */ -%typemap (in) Scheme_Object * "$1=$input;"; -%typemap (out) Scheme_Object * "$result=$1;"; +%typemap (in) Scheme_Object * "$1=$input;" +%typemap (out) Scheme_Object * "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) Scheme_Object * "$1=1;"; @@ -291,7 +315,6 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, // $2 = ($2_ltype) temp; //} - /* ------------------------------------------------------------ * Typechecking rules * ------------------------------------------------------------ */ diff --git a/mac/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg b/mac/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg index afb01dae..703b7e44 100755 --- a/mac/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg +++ b/mac/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg @@ -40,9 +40,10 @@ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); } -%typemap(in) SWIGTYPE && { +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); -} + rvrdeleter.reset($1); +%} %typemap(varin) SWIGTYPE & { $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); @@ -93,10 +94,14 @@ $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; } +%typemap(varout) SWIGTYPE { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)&$1, $&1_descriptor); +} + #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype temp = new $ltype((const $1_ltype &) $1); + $&1_ltype temp = new $1_ltype($1); $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)temp, $&1_descriptor); } @@ -110,8 +115,12 @@ #endif +%typemap(varout) SWIGTYPE * { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor); +} + %typemap(directorin) SWIGTYPE { - $<ype temp = new $ltype((const $ltype &)$1); + $<ype temp = new $1_ltype(SWIG_STD_MOVE($1)); swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)temp, $&1_descriptor); args = caml_list_append(args, swig_result); } @@ -180,12 +189,12 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Void */ -%typemap(out) void "$result = Val_unit;"; +%typemap(out) void "$result = Val_unit;" /* Pass through value */ -%typemap (in) CAML_VALUE "$1=$input;"; -%typemap (out) CAML_VALUE "$result=$1;"; +%typemap (in) CAML_VALUE "$1=$input;" +%typemap (out) CAML_VALUE "$result=$1;" #if 0 %include @@ -302,7 +311,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/mac/bin/swig/share/swig/4.1.0/ocaml/std_string.i b/mac/bin/swig/share/swig/4.1.0/ocaml/std_string.i index 712c3bb7..2564cfb3 100755 --- a/mac/bin/swig/share/swig/4.1.0/ocaml/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/ocaml/std_string.i @@ -83,10 +83,22 @@ class wstring; $result = caml_val_string_len($1.c_str(),$1.size()); } +%typemap(varout) string { + $result = caml_val_string_len($1.c_str(),$1.size()); +} + %typemap(out) string * { $result = caml_val_string_len((*$1).c_str(),(*$1).size()); } + +%typemap(varout) string * { + $result = caml_val_string_len((*$1).c_str(),(*$1).size()); +} + %typemap(typecheck) string, const string & = char *; + +%typemap(throws) string, const string & "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());" + } #ifdef ENABLE_CHARPTR_ARRAY diff --git a/mac/bin/swig/share/swig/4.1.0/ocaml/swigmove.i b/mac/bin/swig/share/swig/4.1.0/ocaml/swigmove.i new file mode 100755 index 00000000..32f9903b --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/ocaml/swigmove.i @@ -0,0 +1,11 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0) { + argp1 = ($&1_ltype) caml_ptr_val($input,$&1_descriptor); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/octave/argcargv.i b/mac/bin/swig/share/swig/4.1.0/octave/argcargv.i new file mode 100755 index 00000000..8d455e58 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/octave/argcargv.i @@ -0,0 +1,44 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + if ($input.is_scalar_type()) { + $1 = 0; $2 = NULL; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' is not a list", $symname, $argnum); + } + octave_value_list list = $input.list_value(); + int i, len = list.length(); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' use a non-string", $symname, $argnum); + } + $2[i] = (char *)list(i).string_value().c_str(); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = 0; + const octave_value& ov = $input; + if (!ov.is_scalar_type()) { + octave_value_list list = ov.list_value(); + int i, len = list.length(); + $1 = 1; + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + break; + } + } + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/mac/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i index 668bf435..87c89b5f 100755 --- a/mac/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/mac/bin/swig/share/swig/4.1.0/octave/octheaders.hpp b/mac/bin/swig/share/swig/4.1.0/octave/octheaders.hpp index abf6428e..26e5564d 100755 --- a/mac/bin/swig/share/swig/4.1.0/octave/octheaders.hpp +++ b/mac/bin/swig/share/swig/4.1.0/octave/octheaders.hpp @@ -9,8 +9,8 @@ // g++ -c -include octheaders.hpp ... // -#if !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) -#define _SWIG_OCTAVE_OCTHEADERS_HPP +#if !defined(SWIG_OCTAVE_OCTHEADERS_HPP) +#define SWIG_OCTAVE_OCTHEADERS_HPP // Required C++ headers #include @@ -127,4 +127,4 @@ #include #endif -#endif // !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) +#endif // !defined(SWIG_OCTAVE_OCTHEADERS_HPP) diff --git a/mac/bin/swig/share/swig/4.1.0/octave/octrun.swg b/mac/bin/swig/share/swig/4.1.0/octave/octrun.swg index d94056c8..2973318c 100755 --- a/mac/bin/swig/share/swig/4.1.0/octave/octrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/octave/octrun.swg @@ -232,7 +232,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); const swig_type_info *construct_type; // type of special type object std::vector < type_ptr_pair > types; // our c++ base classes - int own; // whether we call c++ destructors when we die + int thisown; // whether we call c++ destructors when we die typedef std::pair < const swig_octave_member *, octave_value > member_value_pair; typedef std::map < std::string, member_value_pair > member_map; @@ -412,7 +412,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0, bool _always_static = false) - : module(0), construct_type(_ptr ? 0 : _type), own(_own), + : module(0), construct_type(_ptr ? 0 : _type), thisown(_own), always_static(_always_static) { if (_type || _ptr) types.push_back(std::make_pair(_type, _ptr)); @@ -426,7 +426,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } ~octave_swig_type() { - if (own) { + if (thisown) { ++count; for (unsigned int j = 0; j < types.size(); ++j) { if (!types[j].first || !types[j].first->clientdata) @@ -559,7 +559,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } void merge(octave_swig_type &rhs) { - rhs.own = 0; + rhs.thisown = 0; for (unsigned int j = 0; j < rhs.types.size(); ++j) { assert(!rhs.types[j].second.destroyed); #ifdef SWIG_DIRECTORS @@ -582,35 +582,56 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); swig_member_const_iterator swig_members_begin() { return members.begin(); } swig_member_const_iterator swig_members_end() { return members.end(); } - int cast(void **vptr, swig_type_info *type, int *_own, int flags) { + int cast(void **vptr, swig_type_info *type, int *own, int flags) { int res = SWIG_ERROR; - if (_own) - *_own = own; - if (flags &SWIG_POINTER_DISOWN) - own = 0; + int clear_pointer = 0; + + if (own) + *own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !thisown) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | thisown; + if (flags & SWIG_POINTER_DISOWN) { + thisown = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + clear_pointer = 1; + } + } + if (!type && types.size()) { - if(vptr) + if (vptr) { *vptr = types[0].second.ptr; + if (clear_pointer) + types[0].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) if (type == types[j].first) { - if(vptr) + if (vptr) { *vptr = types[j].second.ptr; + if (clear_pointer) + types[j].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) { swig_cast_info *tc = SWIG_TypeCheck(types[j].first->name, type); if (!tc) continue; - if(vptr) { + if (vptr) { int newmemory = 0; *vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(_own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (_own) - *_own = *_own | SWIG_CAST_NEW_MEMORY; - } + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + if (clear_pointer) + types[j].second.ptr = 0; } res = SWIG_OK; break; @@ -619,7 +640,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } bool is_owned() const { - return own; + return thisown; } #ifdef SWIG_DIRECTORS @@ -1526,12 +1547,15 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *type, int flags) { int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (ptr) { #ifdef SWIG_DIRECTORS - Swig::Director *d = Swig::get_rtdir(ptr); - if (d && Swig::swig_director_get_self(d)) - return Swig::swig_director_get_self(d)->as_value(); + Swig::Director *d = Swig::get_rtdir(ptr); + if (d && Swig::swig_director_get_self(d)) + return Swig::swig_director_get_self(d)->as_value(); #endif - return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + } + return octave_value(Matrix()); // null matrix } SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) { diff --git a/mac/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg b/mac/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg index 4acf8e07..4984fddf 100755 --- a/mac/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg @@ -32,8 +32,15 @@ #define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj) // raise -#define SWIG_Octave_Raise(OBJ, TYPE, DESC) error("C++ side threw an exception of type " TYPE) -#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc) +%runtime %{ +SWIGINTERN void SWIG_Octave_Raise(const octave_value &obj, const char *type) { + if (obj.is_string()) + error("%s", obj.string_value().c_str()); + else + error("C++ side threw an exception of type %s", type); +} +%} +#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type) // Include the unified typemap library %include diff --git a/mac/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/octave/swigmove.i b/mac/bin/swig/share/swig/4.1.0/octave/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/octave/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/argcargv.i b/mac/bin/swig/share/swig/4.1.0/perl5/argcargv.i new file mode 100755 index 00000000..48a6047b --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/perl5/argcargv.i @@ -0,0 +1,32 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i; + I32 len; + AV *av = (AV *)SvRV($input); + if (SvTYPE(av) != SVt_PVAV) { + SWIG_croak("in method '$symname', Expecting reference to argv array"); + goto fail; + } + len = av_len(av) + 1; + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + SV **tv = av_fetch(av, i, 0); + $2[i] = SvPV_nolen(*tv); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + AV *av = (AV *)SvRV($input); + $1 = SvTYPE(av) == SVt_PVAV; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/perlhead.swg b/mac/bin/swig/share/swig/4.1.0/perl5/perlhead.swg index bb7c1741..773adee9 100755 --- a/mac/bin/swig/share/swig/4.1.0/perl5/perlhead.swg +++ b/mac/bin/swig/share/swig/4.1.0/perl5/perlhead.swg @@ -4,10 +4,21 @@ #include extern "C" { #endif + +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" +#endif +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" +#if __GNUC__ >= 10 +#pragma GCC diagnostic pop +#endif + /* PERL_REVISION was added in Perl 5.6. */ #if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8) # error SWIG requires Perl >= 5.8.0 diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/perlrun.swg b/mac/bin/swig/share/swig/4.1.0/perl5/perlrun.swg index 28703d1a..71f19cbf 100755 --- a/mac/bin/swig/share/swig/4.1.0/perl5/perlrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/perl5/perlrun.swg @@ -210,6 +210,7 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ swig_cast_info *tc; void *voidptr = (void *)0; SV *tsv = 0; + int check_owned_pointer_release = (flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE; if (own) *own = 0; @@ -286,13 +287,14 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ /* * DISOWN implementation: we need a perl guru to check this one. */ - if (tsv && (flags & SWIG_POINTER_DISOWN)) { + if (tsv && ((flags & SWIG_POINTER_DISOWN) || check_owned_pointer_release)) { /* * almost copy paste code from below SWIG_POINTER_OWN setting */ SV *obj = sv; HV *stash = SvSTASH(SvRV(obj)); GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE); + int owned = 0; if (isGV(gv)) { HV *hv = GvHVn(gv); /* @@ -300,10 +302,21 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ * Hence, to remove ownership, we delete the entry. */ if (hv_exists_ent(hv, obj, 0)) { - hv_delete_ent(hv, obj, 0, 0); + owned = 1; + if (flags & SWIG_POINTER_DISOWN) { + hv_delete_ent(hv, obj, 0, 0); + } } } + if (check_owned_pointer_release && !owned) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } } + + if (tsv && (flags & SWIG_POINTER_CLEAR)) { + SvIV_set(tsv, 0); + } + return SWIG_OK; } diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i new file mode 100755 index 00000000..3d7ae8ba --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/perl5/swigmove.i b/mac/bin/swig/share/swig/4.1.0/perl5/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/perl5/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/php/argcargv.i b/mac/bin/swig/share/swig/4.1.0/php/argcargv.i new file mode 100755 index 00000000..e0093c21 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/php/argcargv.i @@ -0,0 +1,40 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int len, i; + zval *val; + zend_array *ar; + if (Z_TYPE($input) != IS_ARRAY) { + SWIG_PHP_Error(E_ERROR, "Type error in '$symname'. Expected array"); + goto fail; + } + ar = Z_ARR($input); + len = zend_array_count(ar); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + i = 0; + ZEND_HASH_FOREACH_VAL(ar, val) { + if (Z_TYPE(*val) != IS_STRING) { + SWIG_PHP_Error(E_ERROR, "Array must use strings only, in '$symname'."); + goto fail; + } + if (i == len) { + SWIG_PHP_Error(E_ERROR, "Array is bigger than zend report in '$symname'."); + goto fail; + } + $2[i++] = Z_STRVAL(*val); + } ZEND_HASH_FOREACH_END(); + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = Z_TYPE($input) == IS_ARRAY; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/mac/bin/swig/share/swig/4.1.0/php/const.i b/mac/bin/swig/share/swig/4.1.0/php/const.i index 6e83ffe8..a74af0d7 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/const.i +++ b/mac/bin/swig/share/swig/4.1.0/php/const.i @@ -12,11 +12,11 @@ unsigned char, signed char, enum SWIGTYPE %{ - zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) bool %{ - zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) float, @@ -48,13 +48,13 @@ { zval z; ZVAL_UNDEF(&z); - SWIG_SetPointerZval(&z, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&z, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&z); zend_declare_class_constant(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &z); } %} -%typemap(classconsttab) SWIGTYPE (CLASS::*) ""; +%typemap(classconsttab) SWIGTYPE (CLASS::*) "" %typemap(consttab) int, unsigned int, @@ -65,10 +65,10 @@ unsigned char, signed char, enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; + "SWIG_LONG_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) bool - "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);"; + "SWIG_BOOL_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) float, double @@ -92,7 +92,7 @@ SWIGTYPE [] { zend_constant c; ZVAL_UNDEF(&c.value); - SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&c.value); c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); @@ -100,4 +100,4 @@ } /* Handled as a global variable. */ -%typemap(consttab) SWIGTYPE (CLASS::*) ""; +%typemap(consttab) SWIGTYPE (CLASS::*) "" diff --git a/mac/bin/swig/share/swig/4.1.0/php/php.swg b/mac/bin/swig/share/swig/4.1.0/php/php.swg index bf388a75..fd092807 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/php.swg +++ b/mac/bin/swig/share/swig/4.1.0/php/php.swg @@ -125,14 +125,31 @@ swig_acquire_ownership_obj((void*)$result, own); %} -%typemap(in, phptype="SWIGTYPE") SWIGTYPE &, - SWIGTYPE && +%typemap(in, phptype="SWIGTYPE") SWIGTYPE & %{ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); return; } %} +%typemap(in, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(&$input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $1_descriptor of $symname"); + return; + } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +%} %typemap(directorout) SWIGTYPE & ($1_ltype tmp), SWIGTYPE && ($1_ltype tmp) @@ -240,9 +257,7 @@ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)$1)); } %} %typemap(out, phptype="int|string") unsigned long long @@ -250,9 +265,7 @@ if ($1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)$1)); } %} @@ -286,9 +299,7 @@ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)(*$1))); } %} %typemap(out, phptype="int|string") const unsigned long long & @@ -296,9 +307,7 @@ if (*$1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)(*$1))); } %} @@ -451,7 +460,7 @@ %typemap(out, phptype="SWIGTYPE") SWIGTYPE { #ifdef __cplusplus - $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultobj = new $1_ltype($1); #else $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type)); memcpy(resultobj, &$1, sizeof($1_type)); @@ -462,10 +471,10 @@ %typemap(directorin) SWIGTYPE %{ ZVAL_UNDEF($input); - SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1); + SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1); %} -%typemap(out, phptype="void") void ""; +%typemap(out, phptype="void") void "" %typemap(out, phptype="string") char [ANY] { diff --git a/mac/bin/swig/share/swig/4.1.0/php/phpinit.swg b/mac/bin/swig/share/swig/4.1.0/php/phpinit.swg index 40f7b076..ae72a10a 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/phpinit.swg +++ b/mac/bin/swig/share/swig/4.1.0/php/phpinit.swg @@ -9,4 +9,8 @@ SWIG_php_minit { zend_class_entry SWIGUNUSED internal_ce; SWIG_InitializeModule((void*)&module_number); +#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0 + /* This hack is needed to avoid segfaults. */ + EG(class_table) = CG(class_table); +#endif %} diff --git a/mac/bin/swig/share/swig/4.1.0/php/phprun.swg b/mac/bin/swig/share/swig/4.1.0/php/phprun.swg index a4968319..d3ad0d26 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/phprun.swg +++ b/mac/bin/swig/share/swig/4.1.0/php/phprun.swg @@ -10,8 +10,6 @@ extern "C" { #endif -#include "php.h" - #if PHP_MAJOR_VERSION < 7 # error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 #endif @@ -195,7 +193,7 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o /* They don't care about the target type, so just pass on the pointer! */ *ptr = value->ptr; } else { - swig_cast_info *tc = SWIG_TypeCheckStruct(value->type, ty); + swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc, value->ptr, &newmemory); @@ -208,10 +206,20 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o *ptr = NULL; } } - if (*ptr == NULL) return SWIG_ERROR; - if (flags & SWIG_POINTER_DISOWN) { - value->newobject = 0; + + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !value->newobject) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (*ptr == NULL) + return SWIG_ERROR; /* should be SWIG_NullReferenceError?? */ + if (flags & SWIG_POINTER_DISOWN) { + value->newobject = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + value->ptr = 0; + } } + return SWIG_OK; } case IS_NULL: diff --git a/mac/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i new file mode 100755 index 00000000..28409165 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/php/std_string.i b/mac/bin/swig/share/swig/4.1.0/php/std_string.i index 8882c0ab..b2039786 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/php/std_string.i @@ -86,5 +86,5 @@ namespace std { /* SWIG will apply the non-const typemap above to const string& without * this more specific typemap. */ - %typemap(argout) const string & ""; + %typemap(argout) const string & "" } diff --git a/mac/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i new file mode 100755 index 00000000..1bf31595 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/php/swigmove.i b/mac/bin/swig/share/swig/4.1.0/php/swigmove.i new file mode 100755 index 00000000..b16a3c54 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/php/swigmove.i @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $&1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $&1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $&1_descriptor of $symname"); + return; + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/php/typemaps.i b/mac/bin/swig/share/swig/4.1.0/php/typemaps.i index 321b1202..718469ed 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/typemaps.i +++ b/mac/bin/swig/share/swig/4.1.0/php/typemaps.i @@ -31,8 +31,8 @@ temp = (Z_TYPE($input) == IS_TRUE); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -57,8 +57,8 @@ temp = (TYPE) zval_get_double(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -82,8 +82,8 @@ temp = (TYPE) zval_get_long(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -122,9 +122,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&o, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%lld", (long long)temp$argnum)); } t_output_helper($result, &o); } @@ -138,9 +136,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= lvalue$argnum && lvalue$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&$arg, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)lvalue$argnum); - ZVAL_STRING(&$arg, temp); + ZVAL_NEW_STR(&$arg, zend_strpprintf(0, "%lld", (long long)lvalue$argnum)); } %} %typemap(argout) long long &OUTPUT @@ -148,9 +144,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= *arg$argnum && *arg$argnum <= (long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%lld", (long long)(*arg$argnum))); } %} @@ -161,9 +155,7 @@ INT_TYPEMAP(unsigned long long); if (temp$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG(&o, temp$argnum); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%llu", (unsigned long long)temp$argnum)); } t_output_helper($result, &o); } @@ -177,9 +169,7 @@ INT_TYPEMAP(unsigned long long); if (lvalue$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($arg, (long)(lvalue$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)lvalue$argnum); - ZVAL_STRING((*$arg), temp); + ZVAL_NEW_STR((*$arg), zend_strpprintf(0, "%llu", (unsigned long long)lvalue$argnum)); } %} %typemap(argout) unsigned long long &OUTPUT @@ -187,9 +177,7 @@ INT_TYPEMAP(unsigned long long); if (*arg$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%llu", (unsigned long long)(*arg$argnum))); } %} diff --git a/mac/bin/swig/share/swig/4.1.0/php/utils.i b/mac/bin/swig/share/swig/4.1.0/php/utils.i index 1343495e..33db942a 100755 --- a/mac/bin/swig/share/swig/4.1.0/php/utils.i +++ b/mac/bin/swig/share/swig/4.1.0/php/utils.i @@ -81,7 +81,7 @@ %{ $*1_ltype swig_val; CONVERT_IN(swig_val, $*1_ltype, *$input); - $1_ltype temp = new $*1_ltype(($*1_ltype)swig_val); + $1_ltype temp = new $*1_ltype(swig_val); swig_acquire_ownership(temp); $result = temp; %} diff --git a/mac/bin/swig/share/swig/4.1.0/pointer.i b/mac/bin/swig/share/swig/4.1.0/pointer.i index ea8e535a..9ac04ebf 100755 --- a/mac/bin/swig/share/swig/4.1.0/pointer.i +++ b/mac/bin/swig/share/swig/4.1.0/pointer.i @@ -4,7 +4,7 @@ %echo "pointer.i is deprecated. Use cpointer.i instead." -%echo "See http://www.swig.org/Doc3.0/Library.html" +%echo "See https://www.swig.org/Doc3.0/Library.html" diff --git a/mac/bin/swig/share/swig/4.1.0/python/README b/mac/bin/swig/share/swig/4.1.0/python/README index fa8ef61e..70968e7d 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/README +++ b/mac/bin/swig/share/swig/4.1.0/python/README @@ -101,4 +101,3 @@ std_container.i general common code for the STD/STL containers std_vectora.i vector + allocator (allocators are now supported in STD/STL) typemaps.i old in/out typemaps (doesn't need to be included) -defarg.swg for processing default arguments with shadow classes diff --git a/mac/bin/swig/share/swig/4.1.0/python/argcargv.i b/mac/bin/swig/share/swig/4.1.0/python/argcargv.i index 717fe733..419803a8 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/argcargv.i +++ b/mac/bin/swig/share/swig/4.1.0/python/argcargv.i @@ -1,13 +1,10 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- + * SWIG library containing argc and argv multi-argument typemaps * ------------------------------------------------------------ */ %fragment("SWIG_AsArgcArgv","header",fragment="SWIG_AsCharPtrAndSize") { SWIGINTERN int -SWIG_AsArgcArgv(PyObject *input, - swig_type_info *ppchar_info, - size_t *argc, char ***argv, int *owner) -{ +SWIG_AsArgcArgv(PyObject *input, swig_type_info *ppchar_info, size_t *argc, char ***argv, int *owner) { void *vptr; int res = SWIG_ConvertPtr(input, &vptr, ppchar_info, 0); if (!SWIG_IsOK(res)) { @@ -51,7 +48,7 @@ SWIG_AsArgcArgv(PyObject *input, } else { /* seems dangerous, but the user asked for it... */ size_t i = 0; - if (argv) { while (*argv[i] != 0) ++i;} + if (argv) { while (*argv[i] != 0) ++i;} if (argc) *argc = i; if (owner) *owner = 0; return SWIG_OK; @@ -66,10 +63,10 @@ SWIG_AsArgcArgv(PyObject *input, %typemap(in,noblock=0,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV) (int res,char **argv = 0, size_t argc = 0, int owner= 0) { res = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &argv, &owner); - if (!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { $1 = 0; $2 = 0; %argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum); - } else { + } else { $1 = %static_cast(argc,$1_ltype); $2 = %static_cast(argv, $2_ltype); } diff --git a/mac/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i index 709e7811..bfd8787c 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i @@ -39,7 +39,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -58,12 +58,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/mac/bin/swig/share/swig/4.1.0/python/builtin.swg b/mac/bin/swig/share/swig/4.1.0/python/builtin.swg index ec092233..5cff6835 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/builtin.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/builtin.swg @@ -6,7 +6,11 @@ SWIGINTERN Py_hash_t SwigPyObject_hash(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; void *ptr = sobj->ptr; +#if PY_VERSION_HEX < 0x03020000 + return (Py_hash_t)(Py_ssize_t)ptr; +#else return (Py_hash_t)ptr; +#endif } SWIGINTERN Py_hash_t @@ -211,7 +215,11 @@ SwigPyStaticVar_Type(void) { sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -295,7 +303,11 @@ SwigPyObjectType(void) { PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -414,7 +426,7 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { SWIGINTERN void SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) { -#if PY_VERSION_HEX >= 0x030900A4 +#if PY_VERSION_HEX >= 0x030900a4 Py_SET_TYPE(type, metatype); #else Py_TYPE(type) = metatype; diff --git a/mac/bin/swig/share/swig/4.1.0/python/defarg.swg b/mac/bin/swig/share/swig/4.1.0/python/defarg.swg deleted file mode 100755 index ba5ff43d..00000000 --- a/mac/bin/swig/share/swig/4.1.0/python/defarg.swg +++ /dev/null @@ -1,37 +0,0 @@ -/* This file defines an internal function for processing default arguments - with proxy classes. - - There seems to be no straightforward way to write proxy functions - involving default arguments. For example : - - def foo(arg1,arg2,*args): - proxyc.foo(arg1,arg2,args) - - This fails because args is now a tuple and SWIG doesn't know what to - do with it. - - This file allows a different approach : - - def foo(arg1,arg2,*args): - proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args) - - Basically, we form a new tuple from the object, call this special - __call_defarg method and it passes control to the real wrapper function. - An ugly hack, but it works. -*/ - -SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) { - PyObject *func; - PyObject *parms; - - if (!PyArg_ParseTuple(args, "OO", &func, &parms)) - return NULL; - - if (!PyCallable_Check(func)) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - return PyObject_Call(func, parms, NULL); -} diff --git a/mac/bin/swig/share/swig/4.1.0/python/embed.i b/mac/bin/swig/share/swig/4.1.0/python/embed.i index efd04878..3fc2d14e 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/embed.i +++ b/mac/bin/swig/share/swig/4.1.0/python/embed.i @@ -29,9 +29,23 @@ As far as I know, this module is C++ safe. #endif %wrapper %{ +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif +#endif #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + #ifdef __cplusplus extern "C" #endif diff --git a/mac/bin/swig/share/swig/4.1.0/python/pyclasses.swg b/mac/bin/swig/share/swig/4.1.0/python/pyclasses.swg index 9d6299ff..31ebdd2a 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pyclasses.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pyclasses.swg @@ -43,7 +43,7 @@ namespace swig { %apply PyObject * {SwigPtr_PyObject}; %apply PyObject * const& {SwigPtr_PyObject const&}; - %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);"; + %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);" /* For output */ diff --git a/mac/bin/swig/share/swig/4.1.0/python/pycontainer.swg b/mac/bin/swig/share/swig/4.1.0/python/pycontainer.swg index 2ddf4c37..d6fdff08 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pycontainer.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pycontainer.swg @@ -15,9 +15,9 @@ #include #if PY_VERSION_HEX >= 0x03020000 -# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj)) +# define SWIGPY_SLICEOBJECT PyObject #else -# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj)) +# define SWIGPY_SLICEOBJECT PySliceObject #endif %} @@ -781,7 +781,7 @@ namespace swig #if 1 %newobject __getslice__; #endif - %newobject __getitem__(PySliceObject *slice); + %newobject __getitem__(SWIGPY_SLICEOBJECT *slice); #if defined(SWIGPYTHON_BUILTIN) %feature("python:slot", "nb_nonzero", functype="inquiry") __nonzero__; @@ -829,13 +829,13 @@ namespace swig %extend { /* typemap for slice object support */ - %typemap(in) PySliceObject* { + %typemap(in) SWIGPY_SLICEOBJECT* { if (!PySlice_Check($input)) { %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); } - $1 = (PySliceObject *) $input; + $1 = (SWIGPY_SLICEOBJECT *) $input; } - %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* { + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) SWIGPY_SLICEOBJECT* { $1 = PySlice_Check($input); } @@ -865,49 +865,49 @@ namespace swig /* Overloaded methods for Python 3 compatibility * (Also useful in Python 2.x) */ - Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + Sequence* __getitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return NULL; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; return swig::getslice(self, id, jd, step); } - void __setitem__(PySliceObject *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::setslice(self, id, jd, step, v); } - void __setitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); } - void __delitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __delitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); diff --git a/mac/bin/swig/share/swig/4.1.0/python/pydocs.swg b/mac/bin/swig/share/swig/4.1.0/python/pydocs.swg index 1eea41b8..5a25423d 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pydocs.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pydocs.swg @@ -2,43 +2,43 @@ // Documentation for use with the autodoc feature. #ifdef SWIG_DOC_DOXYGEN_STYLE -%typemap(doc) SWIGTYPE "@param $1_name $1_type"; -%typemap(doc) SWIGTYPE * "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE & "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"; -%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"; +%typemap(doc) SWIGTYPE "@param $1_name $1_type" +%typemap(doc) SWIGTYPE * "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE & "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE && "@param $1_name $1_type" +%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)" #else -%typemap(doc) SWIGTYPE "$1_name: $1_type"; -%typemap(doc) SWIGTYPE * "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE & "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE && "$1_name: $1_type"; -%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"; +%typemap(doc) SWIGTYPE "$1_name: $1_type" +%typemap(doc) SWIGTYPE * "$1_name: $1_type" +%typemap(doc) const SWIGTYPE & "$1_name: $1_type" +%typemap(doc) const SWIGTYPE && "$1_name: $1_type" +%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)" #endif // Types to use in Python documentation for the parameters of the given C++ type. -%typemap(doctype) bool "boolean"; +%typemap(doctype) bool "boolean" %define int_doctype_for_cppint_type(cppint_type) - %typemap(doctype) cppint_type, unsigned cppint_type "int"; + %typemap(doctype) cppint_type, unsigned cppint_type "int" %enddef %formacro(int_doctype_for_cppint_type, short, int, long, long long) -%typemap(doctype) size_t "int"; +%typemap(doctype) size_t "int" -%typemap(doctype) enum SWIGTYPE "int"; +%typemap(doctype) enum SWIGTYPE "int" -%typemap(doctype) float, double, long double "float"; +%typemap(doctype) float, double, long double "float" -%typemap(doctype) char*, std::string "string"; +%typemap(doctype) char*, std::string "string" %typemap(doctype) SWIGTYPE "$1_basetype" %typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)" diff --git a/mac/bin/swig/share/swig/4.1.0/python/pyerrors.swg b/mac/bin/swig/share/swig/4.1.0/python/pyerrors.swg index 2628de8e..10b694cd 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pyerrors.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pyerrors.swg @@ -64,7 +64,6 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyErr_Format(type, "%s %s", tmp, mesg); else PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { diff --git a/mac/bin/swig/share/swig/4.1.0/python/pyhead.swg b/mac/bin/swig/share/swig/4.1.0/python/pyhead.swg index d3730a8f..6f37160b 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pyhead.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pyhead.swg @@ -30,38 +30,19 @@ #endif -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03030000 return (char *)PyUnicode_AsUTF8(str); -#elif PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) { - newstr = (char *) malloc(len+1); - if (newstr) - memcpy(newstr, cstr, len+1); - } - Py_XDECREF(str); - } - return newstr; #else return PyString_AsString(str); #endif } -#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000 -# define SWIG_Python_str_DelForPy3(x) -#else -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#endif +/* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility + * with any uses in user interface files. */ +#define SWIG_Python_str_DelForPy3(x) SWIGINTERN PyObject* diff --git a/mac/bin/swig/share/swig/4.1.0/python/pyrun.swg b/mac/bin/swig/share/swig/4.1.0/python/pyrun.swg index 081bb2cd..6b119be1 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pyrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pyrun.swg @@ -11,8 +11,8 @@ # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 -# error "This version of SWIG only supports Python 3 >= 3.2" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 +# error "This version of SWIG only supports Python 3 >= 3.3" #endif /* Common SWIG API */ @@ -240,7 +240,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -249,7 +249,8 @@ swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(swig_varlinkobject *v) { +swig_varlink_str(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; @@ -287,7 +288,8 @@ swig_varlink_str(swig_varlinkobject *v) { } SWIGINTERN void -swig_varlink_dealloc(swig_varlinkobject *v) { +swig_varlink_dealloc(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; @@ -298,7 +300,8 @@ swig_varlink_dealloc(swig_varlinkobject *v) { } SWIGINTERN PyObject * -swig_varlink_getattr(swig_varlinkobject *v, char *n) { +swig_varlink_getattr(PyObject *o, char *n) { + swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { @@ -315,7 +318,8 @@ swig_varlink_getattr(swig_varlinkobject *v, char *n) { } SWIGINTERN int -swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { +swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { + swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; while (var) { @@ -348,7 +352,11 @@ swig_varlink_type(void) { sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc) swig_varlink_getattr, /* tp_getattr */ (setattrfunc) swig_varlink_setattr, /* tp_setattr */ 0, /* tp_compare */ @@ -788,6 +796,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } + ((SwigPyObject *)next)->next = sobj->next; sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); @@ -914,7 +923,11 @@ SwigPyObject_TypeOnce(void) { sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 @@ -1090,7 +1103,11 @@ SwigPyPacked_TypeOnce(void) { sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 @@ -1345,12 +1362,19 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !sobj->own) { + res = SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + sobj->ptr = 0; + } + res = SWIG_OK; } - res = SWIG_OK; } else { if (implicit_conv) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; @@ -1495,7 +1519,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) Py_DECREF(inst); inst = 0; } else { - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + PyType_Modified(Py_TYPE(inst)); } } } @@ -1636,28 +1660,33 @@ SWIG_Python_TypeCache(void) { SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { +#ifdef SWIG_LINK_RUNTIME static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif } +#else + void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif return (swig_module_info *) type_pointer; } + +static int interpreter_counter = 0; // how many (sub-)interpreters are using swig_module's types + SWIGRUNTIME void SWIG_Python_DestroyModule(PyObject *obj) { swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); swig_type_info **types = swig_module->types; size_t i; + if (--interpreter_counter != 0) // another sub-interpreter may still be using the swig_module's types + return; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -1687,6 +1716,7 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + ++interpreter_counter; Swig_Capsule_global = pointer; } else { Py_DECREF(pointer); @@ -1746,7 +1776,6 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) } else { PyErr_Format(type, "%s %s", errmesg, mesg); } - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; @@ -1798,7 +1827,6 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); @@ -1820,12 +1848,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif } return result; } diff --git a/mac/bin/swig/share/swig/4.1.0/python/pyruntime.swg b/mac/bin/swig/share/swig/4.1.0/python/pyruntime.swg index 843fa6ce..1d028ada 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pyruntime.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pyruntime.swg @@ -4,21 +4,36 @@ # include #endif -#if defined(_MSC_VER) && _MSC_VER >= 1930 -/* Workaround what seems to be a bug in the Python headers with MSVC 2022. - * https://github.com/swig/swig/issues/2090 - */ -# include +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif #endif #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) /* Use debug wrappers with the Python release dll */ + +#if defined(_MSC_VER) && _MSC_VER >= 1929 +/* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later + * See https://github.com/swig/swig/issues/2090 */ +# include +#endif + # undef _DEBUG # include # define _DEBUG 1 #else # include #endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif %} %insert(runtime) "swigrun.swg"; /* SWIG API */ diff --git a/mac/bin/swig/share/swig/4.1.0/python/pytypemaps.swg b/mac/bin/swig/share/swig/4.1.0/python/pytypemaps.swg index 0eda17cd..0ae25a68 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/pytypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/python/pytypemaps.swg @@ -83,7 +83,7 @@ { SWIG_PY_POINTER, "$symname", 0, 0, (void *)($value), &$descriptor } %typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); -%typemap(constcode) SWIGTYPE ((*)(ANY)) ""; +%typemap(constcode) SWIGTYPE ((*)(ANY)) "" %typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); diff --git a/mac/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i index c94006a6..3d7ae8ba 100755 --- a/mac/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/python/swigmove.i b/mac/bin/swig/share/swig/4.1.0/python/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/python/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i index 668bf435..13f041fb 100755 --- a/mac/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { @@ -394,6 +394,25 @@ #error "typemaps for $1_type not available" %} +%typemap(rtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& + "$typemap(rtype, TYPE)" + +%typemap(scoercein) 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 > *& + %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} + +%typemap(scoerceout) 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 > *& + %{ $result <- if (is.null($result)) $result + else new("$typemap(rtype, TYPE)", ref=$result); %} + %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; diff --git a/mac/bin/swig/share/swig/4.1.0/r/r.swg b/mac/bin/swig/share/swig/4.1.0/r/r.swg index 8cf8cdf5..c1ce37c3 100755 --- a/mac/bin/swig/share/swig/4.1.0/r/r.swg +++ b/mac/bin/swig/share/swig/4.1.0/r/r.swg @@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) { assign(name, _obj); %end_block %enddef -%define %raise(obj,type,desc) -return R_NilValue; -%enddef +%runtime %{ +SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) { + Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); +} +%} + +#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue %insert("sinit") "srun.swg" @@ -53,7 +57,7 @@ SWIG_InitializeModule(0); assert(all(sapply($input, class) == "$R_class")); %} -%typemap(out) void ""; +%typemap(out) void "" %typemap(in) int *, int[ANY], signed int *, signed int[ANY], diff --git a/mac/bin/swig/share/swig/4.1.0/r/rtype.swg b/mac/bin/swig/share/swig/4.1.0/r/rtype.swg index 8fe12230..a9c06758 100755 --- a/mac/bin/swig/share/swig/4.1.0/r/rtype.swg +++ b/mac/bin/swig/share/swig/4.1.0/r/rtype.swg @@ -3,26 +3,27 @@ for use in class representations. */ -%typemap("rtype") int, int *, int & "integer"; -%typemap("rtype") long, long *, long & "integer"; -%typemap("rtype") float, float*, float & "numeric"; -%typemap("rtype") double, double*, double & "numeric"; -%typemap("rtype") char *, char ** "character"; -%typemap("rtype") char "character"; -%typemap("rtype") string, string *, string & "character"; -%typemap("rtype") std::string, std::string *, std::string & "character"; -%typemap("rtype") bool, bool * "logical"; -%typemap("rtype") enum SWIGTYPE "character"; -%typemap("rtype") enum SWIGTYPE * "character"; -%typemap("rtype") enum SWIGTYPE *const "character"; -%typemap("rtype") enum SWIGTYPE & "character"; -%typemap("rtype") const 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("rtype") int, int *, int & "integer" +%typemap("rtype") long, long *, long & "integer" +%typemap("rtype") float, float*, float & "numeric" +%typemap("rtype") double, double*, double & "numeric" +%typemap("rtype") char *, char ** "character" +%typemap("rtype") char "character" +%typemap("rtype") string, string *, string & "character" +%typemap("rtype") std::string, std::string *, std::string & "character" +%typemap("rtype") bool, bool * "logical" +%typemap("rtype") enum SWIGTYPE "character" +%typemap("rtype") enum SWIGTYPE * "character" +%typemap("rtype") enum SWIGTYPE *const& "character" +%typemap("rtype") enum SWIGTYPE & "character" +%typemap("rtype") const enum SWIGTYPE & "character" +%typemap("rtype") enum SWIGTYPE && "character" +%typemap("rtype") SWIGTYPE * "$R_class" +%typemap("rtype") SWIGTYPE *const "$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 & %{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %} @@ -93,7 +94,7 @@ %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} -%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE && +%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE && %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} /* @@ -172,6 +173,10 @@ string &, std::string & %{ $result <- if (is.null($result)) $result else new("$R_class", ref=$result); %} +%typemap(scoerceout) SWIGTYPE *const& + %{ $result <- if (is.null($result)) $result + else new("$*R_class", ref=$result); %} + /* Override the SWIGTYPE * above. */ %typemap(scoerceout) char, diff --git a/mac/bin/swig/share/swig/4.1.0/r/std_vector.i b/mac/bin/swig/share/swig/4.1.0/r/std_vector.i index 4ec51dc9..62478fe6 100755 --- a/mac/bin/swig/share/swig/4.1.0/r/std_vector.i +++ b/mac/bin/swig/share/swig/4.1.0/r/std_vector.i @@ -660,6 +660,27 @@ } }; + template <> + struct traits_from_ptr > > > { + static SEXP from (std::vector< std::vector > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(STRSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + CHARACTER_POINTER(VECTOR_ELT(result, pos))[vpos] = Rf_mkChar(val->at(pos).at(vpos).c_str()); + } + } + UNPROTECT(1); + return(result); + } + }; + template struct traits_from_ptr< std::vector < std::vector< T > > > { static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { @@ -841,7 +862,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.numeric($arg) %} %typemap("rtype") std::vector "numeric" -%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);"; +%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector) %traits_type_name(std::vector) @@ -857,7 +878,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.logical($arg) %} %typemap("rtype") std::vector "logical" -%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);"; +%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -866,7 +887,7 @@ %{ is.integer($arg) || is.numeric($arg) %} %typemap("rtype") std::vector "integer" -%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);"; +%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);" // strings %typemap("rtype") std::vector< std::basic_string >, @@ -887,8 +908,6 @@ std::vector< std::basic_string > *, std::vector< std::basic_string > & %{ %} -%apply std::vector< std::basic_string > { std::vector< std::string> }; - // all the related integer vectors // signed %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -974,21 +993,21 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); @@ -1003,7 +1022,14 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);" + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector > >); +%traits_type_name(std::vector< std::vector > >); +%typemap("rtypecheck") std::vector > >, std::vector > > *, std::vector > > & + %{ is.list($arg) && all(sapply($arg , is.character)) %} +%typemap("rtype") std::vector > >, std::vector > > *, std::vector > > & "list" +%typemap("scoercein") std::vector< std::vector > >, std::vector > > *, std::vector > > & "$input = lapply($input, as.character);" // we don't want these to be given R classes as they // have already been turned into R vectors. @@ -1049,7 +1075,10 @@ std::vector< std::basic_string > *, std::vector< std::vector >&, std::vector< std::vector >, std::vector< std::vector >*, - std::vector< std::vector >& + std::vector< std::vector >&, + std::vector< std::vector > >, + std::vector< std::vector > >*, + std::vector< std::vector > >& %{ %} #if defined(SWIGWORDSIZE64) @@ -1071,3 +1100,6 @@ std::vector< std::basic_string > *, %{ %} #endif + +%apply std::vector< std::basic_string > { std::vector }; +%apply std::vector< std::vector< std::basic_string > > { std::vector< std::vector > }; diff --git a/mac/bin/swig/share/swig/4.1.0/r/swigmove.i b/mac/bin/swig/share/swig/4.1.0/r/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/r/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/argcargv.i b/mac/bin/swig/share/swig/4.1.0/ruby/argcargv.i index fc0bc406..24df9c94 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/argcargv.i +++ b/mac/bin/swig/share/swig/4.1.0/ruby/argcargv.i @@ -1,24 +1,20 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- - * ------------------------------------------------------------ */ - -/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps - Use it as follow: + Use it as follows: %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } %inline %{ - int mainApp(size_t argc, const char **argv) - { + int mainApp(size_t argc, const char **argv) { return argc; } - then in the ruby side: + then from ruby: - args = ["asdf", "asdf2"] - mainApp(args); + $args = ["asdf", "asdf2"] + mainApp(args) * ------------------------------------------------------------ */ @@ -31,7 +27,7 @@ VALUE *ptr = RARRAY_PTR($input); for (i=0; i < size; i++, ptr++) { $2[i]= StringValuePtr(*ptr); - } + } $2[i]=NULL; } else { $1 = 0; $2 = 0; diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i index 9676bf9d..70deae4f 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg b/mac/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg index bf4e3624..e4d9e214 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg +++ b/mac/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg @@ -1,5 +1,22 @@ +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wregister" +#if __GNUC__ >= 10 +#pragma GCC diagnostic ignored "-Wvolatile" +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" +#endif +#endif +#endif +#endif + #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which * breaks using rb_intern as an lvalue, as SWIG does. We work around this * issue for now by disabling this. diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg b/mac/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg index 7c94c4e1..6cac4626 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg @@ -281,6 +281,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, own->own = 0; } + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE)) { + if (!RDATA(obj)->dfree) + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we need to reset the destructor since the Ruby object no @@ -292,7 +297,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_class *sklass = (swig_class *) ty->clientdata; track = sklass->trackObjects; } - + if (track) { /* We are tracking objects for this class. Thus we change the destructor * to SWIG_RubyRemoveTracking. This allows us to @@ -306,6 +311,10 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, } } + if (flags & SWIG_POINTER_CLEAR) { + DATA_PTR(obj) = 0; + } + /* Do type-checking if type info was provided */ if (ty) { if (ty->clientdata) { @@ -413,6 +422,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) { /* register a new class */ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); + rb_undef_alloc_func(cl); /* create and store the structure pointer to a global variable */ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i index eab8ec53..3d7ae8ba 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; + template class auto_ptr {}; } diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/std_set.i b/mac/bin/swig/share/swig/4.1.0/ruby/std_set.i index e38702ef..1b425c6b 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/std_set.i +++ b/mac/bin/swig/share/swig/4.1.0/ruby/std_set.i @@ -180,17 +180,14 @@ // Redefine std::set iterator/reverse_iterator typemap %typemap(out,noblock=1) iterator, reverse_iterator { - $result = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,const $type &), - self), - swig::Iterator::descriptor(),SWIG_POINTER_OWN); + $result = SWIG_NewPointerObj((swig::make_set_nonconst_iterator<$type>($1, self)), swig::Iterator::descriptor(), SWIG_POINTER_OWN); } // Redefine std::set std::pair typemap %typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator") std::pair { $result = rb_ary_new2(2); - rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first), - swig::Iterator::descriptor(),SWIG_POINTER_OWN)); + rb_ary_push($result, SWIG_NewPointerObj((swig::make_set_nonconst_iterator($1.first)), swig::Iterator::descriptor(), SWIG_POINTER_OWN)); rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second)); } diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i new file mode 100755 index 00000000..f988714d --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/swigmove.i b/mac/bin/swig/share/swig/4.1.0/ruby/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/ruby/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/ruby/typemaps.i b/mac/bin/swig/share/swig/4.1.0/ruby/typemaps.i index 1d28b131..68343646 100755 --- a/mac/bin/swig/share/swig/4.1.0/ruby/typemaps.i +++ b/mac/bin/swig/share/swig/4.1.0/ruby/typemaps.i @@ -139,7 +139,7 @@ output values. */ %define OUTPUT_TYPEMAP(type, converter, convtype) -%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;"; +%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") type *OUTPUT, type &OUTPUT { VALUE o = converter(convtype (*$1)); $result = output_helper($result, o); @@ -161,7 +161,7 @@ OUTPUT_TYPEMAP(double, rb_float_new, (double)); #undef OUTPUT_TYPEMAP -%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;"; +%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") bool *OUTPUT, bool &OUTPUT { VALUE o = (*$1) ? Qtrue : Qfalse; $result = output_helper($result, o); diff --git a/mac/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i b/mac/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i index 668bf435..87c89b5f 100755 --- a/mac/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i +++ b/mac/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/mac/bin/swig/share/swig/4.1.0/scilab/std_string.i b/mac/bin/swig/share/swig/4.1.0/scilab/std_string.i index 71ac6d2f..8736c2a2 100755 --- a/mac/bin/swig/share/swig/4.1.0/scilab/std_string.i +++ b/mac/bin/swig/share/swig/4.1.0/scilab/std_string.i @@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) { } %include + +%typemap(throws, noblock=1) std::string { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $&descriptor); +} + +%typemap(throws, noblock=1) const std::string & { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $descriptor); +} diff --git a/mac/bin/swig/share/swig/4.1.0/scilab/swigmove.i b/mac/bin/swig/share/swig/4.1.0/scilab/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/scilab/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/std/std_basic_string.i b/mac/bin/swig/share/swig/4.1.0/std/std_basic_string.i index fb7afc1e..e95cb476 100755 --- a/mac/bin/swig/share/swig/4.1.0/std/std_basic_string.i +++ b/mac/bin/swig/share/swig/4.1.0/std/std_basic_string.i @@ -55,7 +55,16 @@ namespace std { size_type capacity() const; - void reserve(size_type __res_arg = 0); + void reserve(size_type __res_arg); + %extend { + void shrink_to_fit() { + %#if __cplusplus >= 202002L + self->shrink_to_fit(); + %#else + self->reserve(); + %#endif + } + } // Modifiers: diff --git a/mac/bin/swig/share/swig/4.1.0/swig.swg b/mac/bin/swig/share/swig/4.1.0/swig.swg index 54383ff6..13310cdf 100755 --- a/mac/bin/swig/share/swig/4.1.0/swig.swg +++ b/mac/bin/swig/share/swig/4.1.0/swig.swg @@ -450,9 +450,9 @@ namespace std { /* Set up the typemap for handling new return strings */ #ifdef __cplusplus -%typemap(newfree) char * "delete [] $1;"; +%typemap(newfree) char * "delete [] $1;" #else -%typemap(newfree) char * "free($1);"; +%typemap(newfree) char * "free($1);" #endif /* Default typemap for handling char * members */ @@ -603,6 +603,10 @@ namespace std { /* ----------------------------------------------------------------------------- * Runtime code * ----------------------------------------------------------------------------- */ +#ifndef SWIG_JAVASCRIPT_COCOS + +%insert("runtime") "swiglabels.swg" + /* The SwigValueWrapper class */ @@ -654,35 +658,54 @@ namespace std { * arg1 = *inarg1; // Assignment from a pointer * arg1 = Vector(1,2,3); // Assignment from a value * + * SwigValueWrapper is a drop in replacement to modify normal value semantics by + * using the heap instead of the stack to copy/move the underlying object it is + * managing. Smart pointers also manage an underlying object on the heap, so + * SwigValueWrapper has characteristics of a smart pointer. The reset function + * is specific smart pointer functionality, but cannot be a non-static member as + * when SWIG modifies typemap code it assumes non-static member function calls + * are routed to the underlying object, changing for example $1.f() to (&x)->f(). + * The reset function was added as an optimisation to avoid some copying/moving + * and to take ownership of an object already created on the heap. + * * The class offers a strong guarantee of exception safety. - * With regards to the implementation, the private SwigMovePointer nested class is - * a simple smart pointer with move semantics, much like std::auto_ptr. + * With regards to the implementation, the private SwigSmartPointer nested class is + * a simple smart pointer providing exception safety, much like std::auto_ptr. * * This wrapping technique was suggested by William Fulton and is henceforth * known as the "Fulton Transform" :-). */ -#ifndef SWIG_JAVASCRIPT_COCOS #ifdef __cplusplus -%insert("runtime") %{ +// Placed in the header section to ensure the language specific header files are +// the first included headers and not +%insert("header") %{ #ifdef __cplusplus +#include /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { - struct SwigMovePointer { + struct SwigSmartPointer { T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + SwigSmartPointer(T *p) : ptr(p) { } + ~SwigSmartPointer() { delete ptr; } + SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + void reset(T *p) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = p; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; } +#if __cplusplus >=201103L + SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; } + operator T&&() const { return std::move(*pointer.ptr); } +#else operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -};%} +#endif + T *operator&() const { return pointer.ptr; } + static void reset(SwigValueWrapper& t, T *p) { t.pointer.reset(p); } +}; /* * SwigValueInit() is a generic initialisation solution as the following approach: @@ -693,25 +716,26 @@ public: * * unsigned int c_result = unsigned int(); */ -%insert("runtime") %{ template T SwigValueInit() { return T(); } + +#if __cplusplus >=201103L +# define SWIG_STD_MOVE(OBJ) std::move(OBJ) +#else +# define SWIG_STD_MOVE(OBJ) OBJ +#endif + #endif %} #endif -/* The swiglabels */ - -%insert("runtime") "swiglabels.swg" - #else -%insert("runtime") %{ -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static -#endif +#ifdef __cplusplus +%insert("header") %{ +#define SWIG_STD_MOVE(OBJ) std::move(OBJ) %} +#endif // #ifdef __cplusplus -#endif // #ifndef SWIG_JAVASCRIPT_COCOS +#endif // #ifndef SWIG_JAVASCRIPT_COCOS \ No newline at end of file diff --git a/mac/bin/swig/share/swig/4.1.0/swigerrors.swg b/mac/bin/swig/share/swig/4.1.0/swigerrors.swg index 1a6d2036..4d5a8e47 100755 --- a/mac/bin/swig/share/swig/4.1.0/swigerrors.swg +++ b/mac/bin/swig/share/swig/4.1.0/swigerrors.swg @@ -1,4 +1,4 @@ -/* Errors in SWIG */ +/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 @@ -13,4 +13,3 @@ #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 - diff --git a/mac/bin/swig/share/swig/4.1.0/swigrun.swg b/mac/bin/swig/share/swig/4.1.0/swigrun.swg index de0db2dc..f632c4cb 100755 --- a/mac/bin/swig/share/swig/4.1.0/swigrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/swigrun.swg @@ -44,6 +44,8 @@ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 #define SWIG_POINTER_NO_NULL 0x4 +#define SWIG_POINTER_CLEAR 0x8 +#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN) /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -129,7 +131,13 @@ */ #define SWIG_OK (0) +/* Runtime errors are < 0 */ #define SWIG_ERROR (-1) +/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */ +/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */ +/* Errors < -200 are generic runtime specific errors */ +#define SWIG_ERROR_RELEASE_NOT_OWNED (-200) + #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) @@ -144,7 +152,7 @@ #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ +/* Check, add and del object mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) @@ -350,9 +358,9 @@ SWIG_TypeName(const swig_type_info *ty) { SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ + type, separated by vertical-bar characters. Choose the last + name. It should be the most specific; a fully resolved name + but not necessarily with default template parameters expanded. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; diff --git a/mac/bin/swig/share/swig/4.1.0/swigwarn.swg b/mac/bin/swig/share/swig/4.1.0/swigwarn.swg index 8d5b2cf3..821a9c8b 100755 --- a/mac/bin/swig/share/swig/4.1.0/swigwarn.swg +++ b/mac/bin/swig/share/swig/4.1.0/swigwarn.swg @@ -4,7 +4,7 @@ * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * and at https://www.swig.org/legal.html. * * swigwarn.h * @@ -22,8 +22,8 @@ * This file is used as the input for generating Lib/swigwarn.swg. * ----------------------------------------------------------------------------- */ -#ifndef SWIGWARN_H_ -#define SWIGWARN_H_ +#ifndef SWIG_SWIGWARN_H +#define SWIG_SWIGWARN_H %define SWIGWARN_NONE 0 %enddef @@ -147,6 +147,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR 394 %enddef /* new [] */ %define SWIGWARN_IGNORE_OPERATOR_DELARR 395 %enddef /* delete [] */ %define SWIGWARN_IGNORE_OPERATOR_REF 396 %enddef /* operator *() */ +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT 397 %enddef /* <=> */ /* please leave 350-399 free for WARN_IGNORE_OPERATOR_* */ @@ -163,6 +164,7 @@ %define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef /* No longer issued */ %define SWIGWARN_TYPEMAP_APPLY_UNDEF 453 %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK 454 %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK 455 %enddef %define SWIGWARN_TYPEMAP_IN_UNDEF 460 %enddef %define SWIGWARN_TYPEMAP_OUT_UNDEF 461 %enddef diff --git a/mac/bin/swig/share/swig/4.1.0/swigwarnings.swg b/mac/bin/swig/share/swig/4.1.0/swigwarnings.swg index 34c98fbd..63ae4c65 100755 --- a/mac/bin/swig/share/swig/4.1.0/swigwarnings.swg +++ b/mac/bin/swig/share/swig/4.1.0/swigwarnings.swg @@ -52,6 +52,7 @@ %define SWIGWARN_TYPEMAP_CHARLEAK_MSG "451:Setting a const char * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG "454:Setting a pointer/reference variable may leak memory." %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK_MSG "455:Setting a const wchar_t * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef %define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a pointer or reference in a director method is not recommended." %enddef %define SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG "476:Initialization using std::initializer_list." %enddef @@ -107,6 +108,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR_MSG "394:operator new[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_DELARR_MSG "395:operator delete[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_REF_MSG "396:operator*() ignored" %enddef +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT_MSG "397:operator<=> ignored" %enddef #define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG) diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/Makefile.in b/mac/bin/swig/share/swig/4.1.0/tcl/Makefile.in index 13d7d465..019091c9 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/Makefile.in +++ b/mac/bin/swig/share/swig/4.1.0/tcl/Makefile.in @@ -45,7 +45,7 @@ LIBS = # SWIGCC = Compiler used to compile the wrapper file SWIG = $(exec_prefix)/bin/swig -SWIGOPT = -tcl # use -tcl8 for Tcl 8.0 +SWIGOPT = -tcl SWIGCC = $(CC) # SWIG Library files. Uncomment if rebuilding tclsh diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/argcargv.i b/mac/bin/swig/share/swig/4.1.0/tcl/argcargv.i new file mode 100755 index 00000000..bbe149ef --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/tcl/argcargv.i @@ -0,0 +1,29 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i, nitems; + Tcl_Obj **listobjv; + if (Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) { + SWIG_exception_fail(SWIG_ValueError, "in method '$symname', Expecting list of argv"); + goto fail; + } + $1 = ($1_ltype) nitems; + $2 = (char **) malloc((nitems+1)*sizeof(char *)); + for (i = 0; i < nitems; i++) { + $2[i] = Tcl_GetStringFromObj(listobjv[i], NULL); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + int len; + $1 = Tcl_ListObjLength(interp, $input, &len) == TCL_OK; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/mactkinit.c b/mac/bin/swig/share/swig/4.1.0/tcl/mactkinit.c deleted file mode 100755 index 18f1f020..00000000 --- a/mac/bin/swig/share/swig/4.1.0/tcl/mactkinit.c +++ /dev/null @@ -1,233 +0,0 @@ -/* ----------------------------------------------------------------------------- - * mactkinit.c - * - * This is a support file needed to build a new version of Wish. - * Normally, this capability is found in TkAppInit.c, but this creates - * tons of namespace problems for many applications. - * ----------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include - -#include "tk.h" -#include "tkInt.h" -#include "tkMacInt.h" - -typedef int (*TclMacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr)); -Tcl_Interp *gStdoutInterp = NULL; - -void TclMacSetEventProc _ANSI_ARGS_((TclMacConvertEventPtr procPtr)); -int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr)); - -/* - * Prototypes for functions the ANSI library needs to link against. - */ -short InstallConsole _ANSI_ARGS_((short fd)); -void RemoveConsole _ANSI_ARGS_((void)); -long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); -long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); -char * __ttyname _ANSI_ARGS_((long fildes)); -short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); - -/* - * Forward declarations for procedures defined later in this file: - */ - -/* - *---------------------------------------------------------------------- - * - * MacintoshInit -- - * - * This procedure calls Mac specific initialization calls. Most of - * these calls must be made as soon as possible in the startup - * process. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * Inits the application. - * - *---------------------------------------------------------------------- - */ - -int -MacintoshInit() -{ - int i; - long result, mask = 0x0700; /* mask = system 7.x */ - - /* - * Tk needs us to set the qd pointer it uses. This is needed - * so Tk doesn't have to assume the availiblity of the qd global - * variable. Which in turn allows Tk to be used in code resources. - */ - tcl_macQdPtr = &qd; - - InitGraf(&tcl_macQdPtr->thePort); - InitFonts(); - InitWindows(); - InitMenus(); - InitDialogs((long) NULL); - InitCursor(); - - /* - * Make sure we are running on system 7 or higher - */ - - if ((NGetTrapAddress(_Gestalt, ToolTrap) == - NGetTrapAddress(_Unimplemented, ToolTrap)) - || (((Gestalt(gestaltSystemVersion, &result) != noErr) - || (mask != (result & mask))))) { - panic("Tcl/Tk requires System 7 or higher."); - } - - /* - * Make sure we have color quick draw - * (this means we can't run on 68000 macs) - */ - - if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) - || (result < gestalt32BitQD13))) { - panic("Tk requires Color QuickDraw."); - } - - - FlushEvents(everyEvent, 0); - SetEventMask(everyEvent); - - /* - * Set up stack & heap sizes - */ - /* TODO: stack size - size = StackSpace(); - SetAppLimit(GetAppLimit() - 8192); - */ - MaxApplZone(); - for (i = 0; i < 4; i++) { - (void) MoreMasters(); - } - - TclMacSetEventProc(TkMacConvertEvent); - TkConsoleCreate(); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * SetupMainInterp -- - * - * This procedure calls initialization routines require a Tcl - * interp as an argument. This call effectively makes the passed - * interpreter the "main" interpreter for the application. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * More initialization. - * - *---------------------------------------------------------------------- - */ - -int -SetupMainInterp( - Tcl_Interp *interp) -{ - /* - * Initialize the console only if we are running as an interactive - * application. - */ - - TkMacInitAppleEvents(interp); - TkMacInitMenus(interp); - - if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1") - == 0) { - if (TkConsoleInit(interp) == TCL_ERROR) { - goto error; - } - } - - /* - * Attach the global interpreter to tk's expected global console - */ - - gStdoutInterp = interp; - - return TCL_OK; - -error: - panic(interp->result); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * - * InstallConsole, RemoveConsole, etc. -- - * - * The following functions provide the UI for the console package. - * Users wishing to replace SIOUX with their own console package - * need only provide the four functions below in a library. - * - * Results: - * See SIOUX documentation for details. - * - * Side effects: - * See SIOUX documentation for details. - * - *---------------------------------------------------------------------- - */ - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buffer, long n) -{ - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; -} - -long -ReadCharsFromConsole(char *buffer, long n) -{ - return 0; -} - -extern char * -__ttyname(long fildes) -{ - static char *devicename = "null device"; - - if (fildes >= 0 && fildes <= 2) { - return (devicename); - } - - return (0L); -} - -short -SIOUXHandleOneEvent(EventRecord *event) -{ - return 0; -} diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i b/mac/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i new file mode 100755 index 00000000..b24809af --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i b/mac/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i new file mode 100755 index 00000000..0ea324cd --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/std_vector.i b/mac/bin/swig/share/swig/4.1.0/tcl/std_vector.i index 144788be..a74bf3a1 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/std_vector.i +++ b/mac/bin/swig/share/swig/4.1.0/tcl/std_vector.i @@ -34,11 +34,11 @@ %{ #include -Tcl_Obj* SwigString_FromString(const std::string &s) { +SWIGINTERN Tcl_Obj* SwigString_FromString(const std::string &s) { return Tcl_NewStringObj(s.data(), (int)s.length()); } -int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { +SWIGINTERN int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { int v; int res = Tcl_GetBooleanFromObj(interp, o, &v); if (res == TCL_OK) { @@ -47,7 +47,7 @@ int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { return res; } -int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { +SWIGINTERN int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { int len; const char* temp = Tcl_GetStringFromObj(o, &len); (void)interp; diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/swigmove.i b/mac/bin/swig/share/swig/4.1.0/tcl/swigmove.i new file mode 100755 index 00000000..62ecca76 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/tcl/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/tclinit.swg b/mac/bin/swig/share/swig/4.1.0/tcl/tclinit.swg index 3140bdcd..cf14de88 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/tclinit.swg +++ b/mac/bin/swig/share/swig/4.1.0/tcl/tclinit.swg @@ -24,7 +24,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *); /* Compatibility version for TCL stubs */ #ifndef SWIG_TCL_STUBS_VERSION -#define SWIG_TCL_STUBS_VERSION "8.1" +#define SWIG_TCL_STUBS_VERSION "8.4" #endif %} @@ -100,8 +100,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) { size_t i; if (interp == 0) return TCL_ERROR; #ifdef USE_TCL_STUBS - /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */ - if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, SWIG_TCL_STUBS_VERSION, 0) == NULL) { return TCL_ERROR; } #endif diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg b/mac/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg index 3b6d04f5..febbffb7 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg +++ b/mac/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg @@ -136,30 +136,13 @@ SWIG_From_dec(long long)(long long value) SWIGINTERN int SWIG_AsVal_dec(long long)(Tcl_Obj *obj, long long *val) { - long v; - if (Tcl_GetLongFromObj(0,obj, &v) == TCL_OK) { + Tcl_WideInt v; + if (Tcl_GetWideIntFromObj(0, obj, &v) == TCL_OK) { + if (sizeof(v) > sizeof(*val) && (v < LLONG_MIN || v > LLONG_MAX)) { + return SWIG_OverflowError; + } if (val) *val = v; return SWIG_OK; - } else { - int len = 0; - const char *nptr = Tcl_GetStringFromObj(obj, &len); - if (nptr && len > 0) { - char *endptr; - long long v; - errno = 0; - v = strtoll(nptr, &endptr,0); - if (nptr[0] == '\0' || *endptr != '\0') - return SWIG_TypeError; - if ((v == LLONG_MAX || v == LLONG_MIN) && errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_OK; - } - } - } } return SWIG_TypeError; } diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/tclrun.swg b/mac/bin/swig/share/swig/4.1.0/tcl/tclrun.swg index 938ec985..e8136051 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/tclrun.swg +++ b/mac/bin/swig/share/swig/4.1.0/tcl/tclrun.swg @@ -122,6 +122,7 @@ SWIG_Tcl_Disown(void *ptr) { SWIGRUNTIME int SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) { swig_cast_info *tc; + const char *cmd_name; /* Pointer values must start with leading underscore */ while (*c != '_') { *ptr = (void *) 0; @@ -157,23 +158,42 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL); } + cmd_name = c; c++; c = SWIG_UnpackData(c,ptr,sizeof(void *)); + if (ty) { tc = c ? SWIG_TypeCheck(c,ty) : 0; - if (!tc) { + if (tc) { + Tcl_CmdInfo info; + if (Tcl_GetCommandInfo(interp, cmd_name, &info)) { + swig_instance *inst = (swig_instance *)info.objClientData; + if (!inst->thisvalue) { + *ptr = 0; + } + assert(inst->thisvalue == *ptr); + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !SWIG_Thisown(inst->thisvalue)) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Disown((void *) *ptr); + } + if (flags & SWIG_POINTER_CLEAR) { + inst->thisvalue = 0; + } + { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + } + } + } else { return SWIG_ERROR; } - if (flags & SWIG_POINTER_DISOWN) { - SWIG_Disown((void *) *ptr); - } - { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } } + return SWIG_OK; } @@ -490,9 +510,11 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ /* Check to see if this pointer belongs to a class or not */ if (thisvalue && (type->clientdata) && (interp)) { Tcl_CmdInfo ci; + int has_command; char *name; name = Tcl_GetStringFromObj(robj,NULL); - if (!Tcl_GetCommandInfo(interp,name, &ci) || (flags)) { + has_command = Tcl_GetCommandInfo(interp, name, &ci); + if (!has_command || flags) { swig_instance *newinst = (swig_instance *) malloc(sizeof(swig_instance)); newinst->thisptr = Tcl_DuplicateObj(robj); Tcl_IncrRefCount(newinst->thisptr); @@ -503,6 +525,15 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ if (flags) { SWIG_Acquire(thisvalue); } + } else { + swig_instance *inst = (swig_instance *)ci.objClientData; + /* Restore thisvalue as SWIG_POINTER_CLEAR may have been used to set it to zero. + Occurs when the C pointer is re-used by the memory allocator and the command has + been created and not destroyed - bug?? - see cpp11_std_unique_ptr_runme.tcl test. */ + if (inst->thisvalue != thisvalue) { + assert(inst->thisvalue == 0); + inst->thisvalue = thisvalue; + } } } return robj; diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/tclsh.i b/mac/bin/swig/share/swig/4.1.0/tcl/tclsh.i index a119b93a..21dc35af 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/tclsh.i +++ b/mac/bin/swig/share/swig/4.1.0/tcl/tclsh.i @@ -33,10 +33,6 @@ char *SWIG_RcFileName = "~/.myapprc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -#endif - int Tcl_AppInit(Tcl_Interp *interp){ if (Tcl_Init(interp) == TCL_ERROR) @@ -47,27 +43,11 @@ int Tcl_AppInit(Tcl_Interp *interp){ if (SWIG_init(interp) == TCL_ERROR) return TCL_ERROR; Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); -#endif - + return TCL_OK; } int main(int argc, char **argv) { -#ifdef MAC_TCL - char *newArgv[2]; - - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - - argc = 1; - newArgv[0] = "tclsh"; - newArgv[1] = NULL; - argv = newArgv; -#endif - Tcl_Main(argc, argv, Tcl_AppInit); return(0); diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg b/mac/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg index ad31bcfc..66cce47e 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg @@ -77,11 +77,6 @@ #endif -%typemap(throws,noblock=1) SWIGTYPE CLASS { - SWIG_set_result(SWIG_NewInstanceObj(%as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1)); - SWIG_fail; -} - %typemap(out) SWIGTYPE = SWIGTYPE INSTANCE; %typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE; %typemap(out) SWIGTYPE *const = SWIGTYPE *; diff --git a/mac/bin/swig/share/swig/4.1.0/tcl/wish.i b/mac/bin/swig/share/swig/4.1.0/tcl/wish.i index bfd2c5fa..42902850 100755 --- a/mac/bin/swig/share/swig/4.1.0/tcl/wish.i +++ b/mac/bin/swig/share/swig/4.1.0/tcl/wish.i @@ -35,11 +35,6 @@ as follows (this should be included in a code-block) : char *SWIG_RcFileName = "~/.wishrc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); -#endif - /* *---------------------------------------------------------------------- * @@ -61,10 +56,9 @@ extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); int Tcl_AppInit(Tcl_Interp *interp) { -#ifndef MAC_TCL Tk_Window main; main = Tk_MainWindow(interp); -#endif + /* * Call the init procedures for included packages. Each call should * look like this: @@ -93,10 +87,6 @@ int Tcl_AppInit(Tcl_Interp *interp) return TCL_ERROR; } -#ifdef MAC_TCL - SetupMainInterp(interp); -#endif - /* * Specify a user-specific startup file to invoke if the application * is run interactively. Typically the startup file is "~/.apprc" @@ -104,31 +94,12 @@ int Tcl_AppInit(Tcl_Interp *interp) * then no user-specific startup file will be run under any conditions. */ - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); - -/* For Macintosh might also want this */ - -#ifdef MAC_TCL -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY); -#endif -#endif + Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); return TCL_OK; } #if TK_MAJOR_VERSION >= 4 int main(int argc, char **argv) { - -#ifdef MAC_TCL - char *newArgv[2]; - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - argc = 1; - newArgv[0] = "Wish"; - newArgv[1] = NULL; - argv = newArgv; -#endif Tk_Main(argc, argv, Tcl_AppInit); return(0); } diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg index 0aca6110..42ce4d9b 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg @@ -59,7 +59,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -85,7 +85,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP { %append_output(SWIG_FromCharPtrAndSize($1,SIZE)); } @@ -122,7 +122,7 @@ temp[n - 1] = 0; $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -160,7 +160,7 @@ if (alloc == SWIG_NEWOBJ) %delete_array(t); $1[n-1] = 0; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { %append_output(SWIG_FromCharPtr($1)); %delete_array($1); @@ -247,7 +247,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) { $1 = &temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { if (*$1) { %append_output(SWIG_FromCharPtr(*$1)); @@ -275,7 +275,7 @@ %typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) { $1 = &temp; $2 = &tempn; } -%typemap(freearg,match="in") (TYPEMAP,SIZE) ""; +%typemap(freearg,match="in") (TYPEMAP,SIZE) "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) { if (*$1) { %append_output(SWIG_FromCharPtrAndSize(*$1,*$2)); diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/exception.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/exception.swg index e48294c3..aece8326 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/exception.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/exception.swg @@ -19,6 +19,7 @@ #endif #define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name) #define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type) +#define %releasenotownedfail_fmt(_type,_name,_argn) "in method '" `_name` "', cannot release ownership as memory is not owned for argument " `_argn`" of type '" `_type`"'" /* setting an error */ #define %error(code,msg...) SWIG_Error(code, msg) diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg index e8439e6d..ca54fcdc 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg @@ -35,7 +35,7 @@ $1 = *ptr; if (SWIG_IsNewObj(res)) %delete(ptr); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) { Type *ptr = (Type *)0; res = asptr_meth($input, &ptr); diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/string.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/string.swg index 4b707236..72f4aa5b 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/string.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/string.swg @@ -30,6 +30,7 @@ SWIG_strnlen(const char* s, size_t maxlen) %include %typemaps_string(%checkcode(STRING), %checkcode(CHAR), + SWIGWARN_TYPEMAP_CHARLEAK_MSG, char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, strlen, SWIG_strnlen, "", CHAR_MIN, CHAR_MAX) diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/strings.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/strings.swg index 87e97dd7..1237d98d 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/strings.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/strings.swg @@ -19,6 +19,7 @@ %define %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -78,7 +79,7 @@ if (!SWIG_IsOK(res)) { %variable_fail(res,"$type","$name"); } - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if (alloc == SWIG_NEWOBJ) { $1 = cptr; } else { @@ -86,7 +87,7 @@ } } -%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=WarningLeakMsg) const Char * { Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ; int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc); if (!SWIG_IsOK(res)) { @@ -108,7 +109,7 @@ /* memberin */ %typemap(memberin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char); @@ -117,7 +118,7 @@ } } -%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(memberin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -129,7 +130,7 @@ /* globalin */ %typemap(globalin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -138,7 +139,7 @@ } } -%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(globalin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen($input) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -265,7 +266,7 @@ } $1 = %reinterpret_cast(temp, $1_ltype); } -%typemap(freearg) Char [ANY], const Char [ANY] ""; +%typemap(freearg) Char [ANY], const Char [ANY] "" %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0], int res) { @@ -275,7 +276,7 @@ } $1 = &temp; } -%typemap(freearg) const Char (&)[ANY] ""; +%typemap(freearg) const Char (&)[ANY] "" %typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen) Char [ANY], const Char[ANY] @@ -501,6 +502,7 @@ #ifndef %_typemap2_string %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -591,6 +593,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -609,6 +612,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -616,6 +620,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_CharBufLen, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -631,6 +636,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string_alloc(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -640,6 +646,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg index 9acd9140..53a64279 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg @@ -109,17 +109,6 @@ nocppval #endif %enddef -#ifndef SWIG_JAVASCRIPT_COCOS -/* insert the SWIGVERSION in the interface and the wrapper code */ -#if SWIG_VERSION -%insert("header") { -%define_as(SWIGVERSION, SWIG_VERSION) -%#define SWIG_VERSION SWIGVERSION -} -#endif -#endif // #ifndef SWIG_JAVASCRIPT_COCOS - - /* ----------------------------------------------------------------------------- * Casting operators * ----------------------------------------------------------------------------- */ diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg new file mode 100755 index 00000000..b0a29685 --- /dev/null +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.swg + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg index b1e6dc9d..26c6ba8e 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg @@ -2,7 +2,7 @@ * Language Object * - Just pass straight through unmodified * ------------------------------------------------------------ */ -%typemap(in) SWIG_Object "$1 = $input;"; +%typemap(in) SWIG_Object "$1 = $input;" %typemap(in,noblock=1) SWIG_Object const & ($*ltype temp) { @@ -30,8 +30,8 @@ #if defined(SWIG_DIRECTOR_TYPEMAPS) -%typemap(directorin) SWIG_Object "$input = $1;"; -%typemap(directorout) SWIG_Object "$result = $input;"; +%typemap(directorin) SWIG_Object "$input = $1;" +%typemap(directorout) SWIG_Object "$result = $input;" #endif /* SWIG_DIRECTOR_TYPEMAPS */ diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg index 64210ef6..69f83794 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg @@ -2,50 +2,50 @@ * --- Input arguments --- * ----------------------------------------------------------------------------- */ /* Pointers and arrays */ -%typemap(in, noblock=1) SWIGTYPE *(void *argp = nullptr, int res = 0) { - res = SWIG_ConvertPtr333($input, &argp,$descriptor, $disown | %convertptr_flags); +%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE * ""; +%typemap(freearg) SWIGTYPE * "" %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr4($input, &argp,$descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE [] ""; +%typemap(freearg) SWIGTYPE [] "" %typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) { - res = SWIG_ConvertPtr5($input, &argp, $*descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$*ltype", $symname, $argnum); } temp = %reinterpret_cast(argp, $*ltype); $1 = %reinterpret_cast(&temp, $1_ltype); } -%typemap(freearg) SWIGTYPE *const& ""; +%typemap(freearg) SWIGTYPE *const& "" /* Reference */ %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr6($input, &argp, $descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE & ""; +%typemap(freearg) SWIGTYPE & "" #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr7($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -56,56 +56,28 @@ { if (SWIG_IsNewObj(res$argnum)) %delete($1); } -#else -%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) { - res = SWIG_ConvertPtr8($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} #endif /* Rvalue reference */ -%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr9($input, &argp, $descriptor, %convertptr_flags); +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE | %convertptr_flags); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$type", $symname, $argnum); + } else { + %argument_fail(res, "$type", $symname, $argnum); + } } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); + rvrdeleter.reset($1); } -%typemap(freearg) SWIGTYPE && ""; - -#if defined(__cplusplus) && defined(%implicitconv_flag) -%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr10($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE && -{ - if (SWIG_IsNewObj(res$argnum)) %delete($1); -} -#else -%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) { - res = SWIG_ConvertPtr11($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -#endif +%typemap(freearg) SWIGTYPE && "" /* By value */ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr12($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -119,7 +91,7 @@ } #else %typemap(in) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr13($input, &argp, $&descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -146,9 +118,15 @@ } /* Return by value */ +#ifdef __cplusplus %typemap(out, noblock=1) SWIGTYPE { - %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); + %set_output(SWIG_NewPointerObj((new $1_ltype($1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); } +#else +%typemap(out, noblock=1) SWIGTYPE { + %set_output(SWIG_NewPointerObj(%new_copy($1, $1_ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); +} +#endif /* ----------------------------------------------------------------------------- * --- Variable input --- @@ -176,7 +154,7 @@ %typemap(varin) SWIGTYPE [ANY] { $basetype *inp = 0; - int res = SWIG_ConvertPtr14($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -224,7 +202,7 @@ %typemap(varin) SWIGTYPE [ANY][ANY] { $basetype (*inp)[$1_dim1] = 0; - int res = SWIG_ConvertPtr15($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -246,7 +224,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE * { void *argp = 0; - int res = SWIG_ConvertPtr16($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -260,7 +238,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE & { void *argp = 0; - int res = SWIG_ConvertPtr17($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -272,7 +250,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && { void *argp = 0; - int res = SWIG_ConvertPtr18($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -285,7 +263,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(varin,implicitconv=1) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr19($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -301,7 +279,7 @@ #else %typemap(varin) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr20($input, &argp, $&descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -346,58 +324,59 @@ %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * { void *vptr = 0; - int res = SWIG_ConvertPtr21($input, &vptr, $descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& { void *vptr = 0; - int res = SWIG_ConvertPtr22($input, &vptr, $*descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr23($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr24($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & { - int res = SWIG_ConvertPtr25($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && { - int res = SWIG_ConvertPtr26($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE { - int res = SWIG_ConvertPtr27($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } #else %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr28($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr29($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { void *vptr = 0; - int res = SWIG_ConvertPtr30($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #endif @@ -411,7 +390,7 @@ /* directorin */ %typemap(directorin,noblock=1) SWIGTYPE { - $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); + $input = SWIG_NewPointerObj((new $1_ltype(SWIG_STD_MOVE($1))), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); } %typemap(directorin,noblock=1) SWIGTYPE * { @@ -434,7 +413,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr31($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -443,7 +422,7 @@ } #else %typemap(directorout,noblock=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr32($input,&swig_argp,$&descriptor, %convertptr_flags); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -534,7 +513,7 @@ * ------------------------------------------------------------ */ %typemap(throws,noblock=1) SWIGTYPE { - %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); + %raise(SWIG_NewPointerObj(%new_copy($1, $1_ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); } %typemap(throws,noblock=1) SWIGTYPE * { @@ -680,7 +659,7 @@ /* DISOWN typemap */ %typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) { - res = SWIG_ConvertPtr111($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + res = SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type", $symname, $argnum); } @@ -688,7 +667,7 @@ %typemap(varin) SWIGTYPE *DISOWN { void *temp = 0; - int res = SWIG_ConvertPtr222($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + int res = SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -703,9 +682,15 @@ /* INSTANCE typemap */ +#ifdef __cplusplus +%typemap(out,noblock=1) SWIGTYPE INSTANCE { + %set_output(SWIG_NewInstanceObj((new $1_ltype($1)), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); +} +#else %typemap(out,noblock=1) SWIGTYPE INSTANCE { %set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); } +#endif %typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] { %set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags)); diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg index 4e5bb2b0..733e5acd 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg @@ -140,6 +140,7 @@ #define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn)) #define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name)) #define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name)) +#define %releasenotowned_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %releasenotownedfail_fmt(type, name, argn)) #if defined(SWIG_DIRECTOR_TYPEMAPS) #define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type)) diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg index 11eac598..f2f34acf 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg @@ -38,7 +38,7 @@ } $1 = %static_cast(val,$ltype); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) { ecode = asval_meth($input, &val); if (!SWIG_IsOK(ecode)) { @@ -47,7 +47,7 @@ temp = %static_cast(val, $*ltype); $1 = &temp; } - %typemap(freearg) const Type& ""; + %typemap(freearg) const Type& "" %enddef /* out */ diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/void.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/void.swg index bbd68ed8..795992bf 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/void.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/void.swg @@ -10,7 +10,7 @@ %argument_fail(res, "$type", $symname, $argnum); } } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) { res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown); @@ -19,7 +19,7 @@ } $1 = &temp; } -%typemap(freearg) void * const& ""; +%typemap(freearg) void * const& "" /* out */ diff --git a/mac/bin/swig/share/swig/4.1.0/typemaps/wstring.swg b/mac/bin/swig/share/swig/4.1.0/typemaps/wstring.swg index cd409d1c..d99c0bb3 100755 --- a/mac/bin/swig/share/swig/4.1.0/typemaps/wstring.swg +++ b/mac/bin/swig/share/swig/4.1.0/typemaps/wstring.swg @@ -31,6 +31,7 @@ SWIG_wcsnlen(const wchar_t* s, size_t maxlen) %include %typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR), + SWIGWARN_TYPEMAP_WCHARLEAK_MSG, wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, wcslen, SWIG_wcsnlen, "", WCHAR_MIN, WCHAR_MAX) diff --git a/win64/bin/swig/bin/swig.exe b/win64/bin/swig/bin/swig.exe index 6eddef91..e67670a2 100755 Binary files a/win64/bin/swig/bin/swig.exe and b/win64/bin/swig/bin/swig.exe differ diff --git a/win64/bin/swig/share/swig/4.1.0/allkw.swg b/win64/bin/swig/share/swig/4.1.0/allkw.swg index 19f06c30..f3f88558 100755 --- a/win64/bin/swig/share/swig/4.1.0/allkw.swg +++ b/win64/bin/swig/share/swig/4.1.0/allkw.swg @@ -1,5 +1,5 @@ -#ifndef __Lib_allkw_swg__ -#define __Lib_allkw_swg__ +#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG +#define SWIG_INCLUDED_LIB_ALLKW_SWG /* @@ -30,4 +30,4 @@ %include -#endif //__Lib_allkw_swg__ +#endif // SWIG_INCLUDED_LIB_ALLKW_SWG diff --git a/win64/bin/swig/share/swig/4.1.0/cffi/cffi.swg b/win64/bin/swig/share/swig/4.1.0/cffi/cffi.swg deleted file mode 100755 index e9c8f650..00000000 --- a/win64/bin/swig/share/swig/4.1.0/cffi/cffi.swg +++ /dev/null @@ -1,294 +0,0 @@ -/* Define a C preprocessor symbol that can be used in interface files - to distinguish between the SWIG language modules. */ - -#define SWIG_CFFI - -/* Typespecs for basic types. */ - -%typemap(cin) void ":void"; - -%typemap(cin) char ":char"; -%typemap(cin) char * ":string"; -%typemap(cin) unsigned char ":unsigned-char"; -%typemap(cin) signed char ":char"; - -%typemap(cin) short ":short"; -%typemap(cin) signed short ":short"; -%typemap(cin) unsigned short ":unsigned-short"; - -%typemap(cin) int ":int"; -%typemap(cin) signed int ":int"; -%typemap(cin) unsigned int ":unsigned-int"; - -%typemap(cin) long ":long"; -%typemap(cin) signed long ":long"; -%typemap(cin) unsigned long ":unsigned-long"; - -%typemap(cin) long long ":long-long"; -%typemap(cin) signed long long ":long-long"; -%typemap(cin) unsigned long long ":unsigned-long-long"; - -%typemap(cin) float ":float"; -%typemap(cin) double ":double"; -%typemap(cin) SWIGTYPE ":pointer"; - -%typemap(cout) void ":void"; - -%typemap(cout) char ":char"; -%typemap(cout) char * ":string"; -%typemap(cout) unsigned char ":unsigned-char"; -%typemap(cout) signed char ":char"; - -%typemap(cout) short ":short"; -%typemap(cout) signed short ":short"; -%typemap(cout) unsigned short ":unsigned-short"; - -%typemap(cout) int ":int"; -%typemap(cout) signed int ":int"; -%typemap(cout) unsigned int ":unsigned-int"; - -%typemap(cout) long ":long"; -%typemap(cout) signed long ":long"; -%typemap(cout) unsigned long ":unsigned-long"; - -%typemap(cout) long long ":long-long"; -%typemap(cout) signed long long ":long-long"; -%typemap(cout) unsigned long long ":unsigned-long-long"; - -%typemap(cout) float ":float"; -%typemap(cout) double ":double"; -%typemap(cout) SWIGTYPE ":pointer"; - - -%typemap(ctype) bool "int"; -%typemap(ctype) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype"; -%typemap(ctype) SWIGTYPE "$&1_type"; - -%typemap(in) bool "$1 = (bool)$input;"; -%typemap(in) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, void, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; -%typemap(in) SWIGTYPE "$1 = *$input;"; - -%typemap(out) void ""; -%typemap(out) bool "$result = (int)$1;"; -%typemap(out) char, unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - float, double, long double, char *, void *, - enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_INTEGER) - unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, - SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; -/* This maps C/C++ types to Lisp classes for overload dispatch */ - -%typemap(lisptype) bool "cl:boolean"; -%typemap(lisptype) char "cl:character"; -%typemap(lisptype) unsigned char "cl:integer"; -%typemap(lisptype) signed char "cl:integer"; - -%typemap(lispclass) bool "t"; -%typemap(lispclass) char "cl:character"; -%typemap(lispclass) unsigned char, signed char, - short, signed short, unsigned short, - int, signed int, unsigned int, - long, signed long, unsigned long, - enum SWIGTYPE "cl:integer"; -/* CLOS methods can't be specialized on single-float or double-float */ -%typemap(lispclass) float "cl:number"; -%typemap(lispclass) double "cl:number"; -%typemap(lispclass) char * "cl:string"; - -/* Array reference typemaps */ -%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } - -/* const pointers */ -%apply SWIGTYPE * { SWIGTYPE *const } -%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } -%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -%} - -%insert("swiglisp") %{ -;;;SWIG wrapper code starts here - -(cl:defmacro defanonenum (cl:&body enums) - "Converts anonymous enums to defconstants." - `(cl:progn ,@(cl:loop for value in enums - for index = 0 then (cl:1+ index) - when (cl:listp value) do (cl:setf index (cl:second value) - value (cl:first value)) - collect `(cl:defconstant ,value ,index)))) - -(cl:eval-when (:compile-toplevel :load-toplevel) - (cl:unless (cl:fboundp 'swig-lispify) - (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) - (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) - (cl:cond - ((cl:null lst) - rest) - ((cl:upper-case-p c) - (helper (cl:cdr lst) 'upper - (cl:case last - ((lower digit) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:lower-case-p c) - (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest))) - ((cl:digit-char-p c) - (helper (cl:cdr lst) 'digit - (cl:case last - ((upper lower) (cl:list* c #\- rest)) - (cl:t (cl:cons c rest))))) - ((cl:char-equal c #\_) - (helper (cl:cdr lst) '_ (cl:cons #\- rest))) - (cl:t - (cl:error "Invalid character: ~A" c))))) - (cl:let ((fix (cl:case flag - ((constant enumvalue) "+") - (variable "*") - (cl:t "")))) - (cl:intern - (cl:concatenate - 'cl:string - fix - (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil)) - fix) - package)))))) - -;;;SWIG wrapper code ends here -%} - -#ifdef __cplusplus -%typemap(out) SWIGTYPE "$result = new $1_type($1);"; -#else -%typemap(out) SWIGTYPE { - $result = ($&1_ltype) malloc(sizeof($1_type)); - memmove($result, &$1, sizeof($1_type)); -} -#endif - -////////////////////////////////////////////////////////////// - -/* name conversion for overloaded operators. */ -#ifdef __cplusplus -%rename(__add__) *::operator+; -%rename(__pos__) *::operator+(); -%rename(__pos__) *::operator+() const; - -%rename(__sub__) *::operator-; -%rename(__neg__) *::operator-() const; -%rename(__neg__) *::operator-(); - -%rename(__mul__) *::operator*; -%rename(__deref__) *::operator*(); -%rename(__deref__) *::operator*() const; - -%rename(__div__) *::operator/; -%rename(__mod__) *::operator%; -%rename(__logxor__) *::operator^; -%rename(__logand__) *::operator&; -%rename(__logior__) *::operator|; -%rename(__lognot__) *::operator~(); -%rename(__lognot__) *::operator~() const; - -%rename(__not__) *::operator!(); -%rename(__not__) *::operator!() const; - -%rename(__assign__) *::operator=; - -%rename(__add_assign__) *::operator+=; -%rename(__sub_assign__) *::operator-=; -%rename(__mul_assign__) *::operator*=; -%rename(__div_assign__) *::operator/=; -%rename(__mod_assign__) *::operator%=; -%rename(__logxor_assign__) *::operator^=; -%rename(__logand_assign__) *::operator&=; -%rename(__logior_assign__) *::operator|=; - -%rename(__lshift__) *::operator<<; -%rename(__lshift_assign__) *::operator<<=; -%rename(__rshift__) *::operator>>; -%rename(__rshift_assign__) *::operator>>=; - -%rename(__eq__) *::operator==; -%rename(__ne__) *::operator!=; -%rename(__lt__) *::operator<; -%rename(__gt__) *::operator>; -%rename(__lte__) *::operator<=; -%rename(__gte__) *::operator>=; - -%rename(__and__) *::operator&&; -%rename(__or__) *::operator||; - -%rename(__preincr__) *::operator++(); -%rename(__postincr__) *::operator++(int); -%rename(__predecr__) *::operator--(); -%rename(__postdecr__) *::operator--(int); - -%rename(__comma__) *::operator,(); -%rename(__comma__) *::operator,() const; - -%rename(__member_ref__) *::operator->; -%rename(__member_func_ref__) *::operator->*; - -%rename(__funcall__) *::operator(); -%rename(__aref__) *::operator[]; -#endif - - -%{ - -#ifdef __cplusplus -# define EXTERN extern "C" -#else -# define EXTERN extern -#endif - -#define EXPORT EXTERN SWIGEXPORT - -#include -#include -%} diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i b/win64/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i index 43e121fa..ec2fee93 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/boost_intrusive_ptr.i @@ -32,7 +32,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -372,7 +372,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i index 2a629f0c..d53dd3c0 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/boost_shared_ptr.i @@ -29,10 +29,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -122,7 +122,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/csharp.swg b/win64/bin/swig/share/swig/4.1.0/csharp/csharp.swg index de24538a..ede9a28f 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/csharp.swg +++ b/win64/bin/swig/share/swig/4.1.0/csharp/csharp.swg @@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" @@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %} %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; } %} -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %} %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{ char buf[128]; @@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { "$csinput" %typemap(csin) char *, char *&, char[ANY], char[] "$csinput" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)" -%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)" %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)" /* The csout typemap is used for converting function return types from the return type @@ -913,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} // Derived proxy classes @@ -926,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} %enddef @@ -945,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } %} %typemap(csbody) TYPE (CLASS::*) %{ diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_array.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_array.i index 75428dd5..6c5bc19b 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_array.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_array.i @@ -16,7 +16,7 @@ %define SWIG_STD_ARRAY_INTERNAL(T, N) -%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n" %proxycode %{ public $csclassname(global::System.Collections.ICollection c) : this() { if (c == null) diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i index 027d18e2..59a47b62 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_auto_ptr.i @@ -1,25 +1,38 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (ctype) std::auto_ptr "void *" -%typemap (imtype, out="System.IntPtr") std::auto_ptr "HandleRef" -%typemap (cstype) std::auto_ptr "$typemap(cstype, TYPE)" -%typemap (out) std::auto_ptr %{ - $result = (void *)$1.release(); +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); %} -%typemap(csout, excode=SWIGEXCODE) std::auto_ptr { - 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; + +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_list.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_list.i index 2bd7f792..f8c632df 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_list.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_list.i @@ -19,7 +19,7 @@ // MACRO for use within the std::list class body %define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...) -%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * }; diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_map.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_map.i index 94603cf2..b6369c7a 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_map.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_map.i @@ -26,7 +26,7 @@ /* K is the C++ key type, T is the C++ value type */ %define SWIG_STD_MAP_INTERNAL(K, T, C) -%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n" %proxycode %{ public $typemap(cstype, T) this[$typemap(cstype, K) key] { diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_set.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_set.i index f20c68d6..f21e3073 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_set.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_set.i @@ -28,7 +28,7 @@ namespace std { template class set { -%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n"; +%typemap(csinterfaces) std::set "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n" %proxycode %{ void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) { ((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item); diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i new file mode 100755 index 00000000..fcf5797d --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_unique_ptr.i @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::unique_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::unique_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_vector.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_vector.i index 00f76a80..4fdd26aa 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_vector.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_vector.i @@ -19,7 +19,7 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) -%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n" %proxycode %{ public $csclassname(global::System.Collections.IEnumerable c) : this() { if (c == null) diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/std_wstring.i b/win64/bin/swig/share/swig/4.1.0/csharp/std_wstring.i index f825a569..b65f7323 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/std_wstring.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/std_wstring.i @@ -2,7 +2,9 @@ * std_wstring.i * * Typemaps for std::wstring and const std::wstring& - * These are mapped to a C# String and are passed around by value. + * std::wstring is mapped to a C# Unicode string (UTF16) and is passed around by value. + * std::wstring support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * To use non-const std::wstring references use the following %apply. Note * that they are passed by value. @@ -15,6 +17,28 @@ #include %} +%fragment("Swig_csharp_UTF16ToWString", "header") %{ +/* For converting from .NET UTF16 (2 byte unicode) strings. wchar_t is 2 bytes on Windows, 4 bytes on Linux. */ +static std::wstring Swig_csharp_UTF16ToWString(const unsigned short *str) { + if (sizeof(wchar_t) == 2) { + return std::wstring((wchar_t *)str); + } else { + const unsigned short *pBegin(str); + const unsigned short *ptr(pBegin); + + while (*ptr != 0) + ++ptr; + + std::wstring result; + result.reserve(ptr - pBegin); + while(pBegin != ptr) + result.push_back(*pBegin++); + + return result; + } +} +%} + namespace std { %naturalvar wstring; @@ -22,31 +46,33 @@ namespace std { class wstring; // wstring -%typemap(ctype, out="void *") wstring "wchar_t *" +%typemap(ctype, out="void *") wstring "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) wstring "string" %typemap(cstype) wstring "string" %typemap(csdirectorin) wstring "$iminput" %typemap(csdirectorout) wstring "$cscall" -%typemap(in, canthrow=1) wstring +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $1.assign($input); %} -%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %} + $1 = Swig_csharp_UTF16ToWString($input); %} +%typemap(out) wstring %{ $result = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} -%typemap(directorout, canthrow=1) wstring +%typemap(directorout, canthrow=1) wstring %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - $result.assign($input); %} + $result = Swig_csharp_UTF16ToWString($input); %} -%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csin) wstring "$csinput" %typemap(csout, excode=SWIGEXCODE) wstring { @@ -57,29 +83,30 @@ class wstring; %typemap(typecheck) wstring = wchar_t *; %typemap(throws, canthrow=1) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} // const wstring & -%typemap(ctype, out="void *") const wstring & "wchar_t *" +%typemap(ctype, out="void *") const wstring & "unsigned short *" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", - outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" + outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directorinattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", + directoroutattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]" ) const wstring & "string" %typemap(cstype) const wstring & "string" %typemap(csdirectorin) const wstring & "$iminput" %typemap(csdirectorout) const wstring & "$cscall" -%typemap(in, canthrow=1) const wstring & +%typemap(in, canthrow=1, fragment="Swig_csharp_UTF16ToWString") const wstring & %{ if (!$input) { SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); return $null; } - std::wstring $1_str($input); + std::wstring $1_str(Swig_csharp_UTF16ToWString($input)); $1 = &$1_str; %} -%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %} +%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_with_length_callback($1->c_str(), (int)$1->size()); %} %typemap(csin) const wstring & "$csinput" %typemap(csout, excode=SWIGEXCODE) const wstring & { @@ -94,10 +121,10 @@ class wstring; } /* possible thread/reentrant code problem */ static std::wstring $1_str; - $1_str = $input; + $1_str = Swig_csharp_UTF16ToWString($input); $result = &$1_str; %} -%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} +%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_with_length_callback($1.c_str(), (int)$1.size()); %} %typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{ set { @@ -112,8 +139,7 @@ class wstring; %typemap(typecheck) const wstring & = wchar_t *; %typemap(throws, canthrow=1) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); +%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size()); return $null; %} } diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/swigmove.i b/win64/bin/swig/share/swig/4.1.0/csharp/swigmove.i new file mode 100755 index 00000000..564c47fa --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/csharp/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1, fragment="") SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(csin) SWIGTYPE MOVE "$&csclassname.swigRelease($csinput)" diff --git a/win64/bin/swig/share/swig/4.1.0/csharp/wchar.i b/win64/bin/swig/share/swig/4.1.0/csharp/wchar.i index 8c487d6a..5616ab9f 100755 --- a/win64/bin/swig/share/swig/4.1.0/csharp/wchar.i +++ b/win64/bin/swig/share/swig/4.1.0/csharp/wchar.i @@ -2,37 +2,58 @@ * wchar.i * * Typemaps for the wchar_t type - * These are mapped to a C# String and are passed around by value. + * wchar_t * is mapped to a C# Unicode string (UTF16) and is passed around by value. + * wchar_t * support includes wchar_t as a 2 byte type (Windows) and a 4 byte type + * (most Unix systems). * * Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER - * * ----------------------------------------------------------------------------- */ #if !defined(SWIG_CSHARP_NO_WSTRING_HELPER) #if !defined(SWIG_CSHARP_WSTRING_HELPER_) #define SWIG_CSHARP_WSTRING_HELPER_ + +%fragment(""); // TODO: %fragment("") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + delete [] $1; + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +#else +%typemap(memberin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,fragment="") wchar_t * { + free($1); + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} +%typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { + if ($input && sizeof(wchar_t) == 2) { + $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); + wcscpy((wchar_t *)$1, (const wchar_t *)$input); + } else { + $1 = $input; + $input = 0; + } +} + +#endif diff --git a/win64/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i index 0b4fddbd..9a664157 100755 --- a/win64/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/d/boost_shared_ptr.i @@ -23,10 +23,10 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin) CONST TYPE -%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} +%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { @@ -116,7 +116,7 @@ %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull) %{ $1 = $input ? ($1_ltype)$input : &tempnull; %} %typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * -%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0; +%{ $result = ($1 && *$1) ? new $*1_ltype(*$1) : 0; if ($owner) delete $1; %} %typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * diff --git a/win64/bin/swig/share/swig/4.1.0/d/dclassgen.swg b/win64/bin/swig/share/swig/4.1.0/d/dclassgen.swg index 75521ba4..7b419b89 100755 --- a/win64/bin/swig/share/swig/4.1.0/d/dclassgen.swg +++ b/win64/bin/swig/share/swig/4.1.0/d/dclassgen.swg @@ -76,6 +76,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -92,6 +105,19 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + if (obj !is null) { + if (!obj.swigCMemOwn) + throw new Exception("Cannot release ownership as memory is not owned"); + void* ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.dispose(); + return ptr; + } else { + return null; + } +} + mixin $imdmodule.SwigOperatorDefinitions; %} @@ -100,7 +126,7 @@ mixin $imdmodule.SwigOperatorDefinitions; * Type wrapper classes. */ -%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ +%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] %{ private void* swigCPtr; public this(void* cObject, bool futureUse) { @@ -115,6 +141,10 @@ public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } +public static void* swigRelease(typeof(this) obj) { + return (obj is null) ? null : obj.swigCPtr; +} + mixin $imdmodule.SwigOperatorDefinitions; %} diff --git a/win64/bin/swig/share/swig/4.1.0/d/dswigtype.swg b/win64/bin/swig/share/swig/4.1.0/d/dswigtype.swg index f4248bb4..7ff9f20a 100755 --- a/win64/bin/swig/share/swig/4.1.0/d/dswigtype.swg +++ b/win64/bin/swig/share/swig/4.1.0/d/dswigtype.swg @@ -52,7 +52,7 @@ %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -62,7 +62,7 @@ #endif %typemap(directorin) SWIGTYPE - "$input = (void *)new $1_ltype((const $1_ltype &)$1);" + "$input = (void *)new $1_ltype(SWIG_STD_MOVE($1));" %typemap(directorout) SWIGTYPE %{ if (!$input) { SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type"); @@ -122,7 +122,7 @@ %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; } %} %typemap(out) SWIGTYPE & "$result = (void *)$1;" @@ -157,11 +157,12 @@ * Rvalue reference conversion typemaps. */ -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null"); + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && "$result = (void *)$1;" %typemap(directorin) SWIGTYPE && @@ -182,7 +183,7 @@ %typemap(din, nativepointer="cast(void*)$dinput" -) SWIGTYPE && "$dclassname.swigGetCPtr($dinput)" +) SWIGTYPE && "$dclassname.swigRelease($dinput)" %typemap(dout, excode=SWIGEXCODE, nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE && { $dclassname ret = new $dclassname($imcall, $owner);$excode diff --git a/win64/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i new file mode 100755 index 00000000..84c819fa --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/d/std_auto_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype) std::auto_ptr< TYPE > "void*" +%typemap (dtype) std::auto_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::auto_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::auto_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i new file mode 100755 index 00000000..908258bc --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/d/std_unique_ptr.i @@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE > "void *" +%typemap (imtype) std::unique_ptr< TYPE > "void*" +%typemap (dtype) std::unique_ptr< TYPE > "$typemap(dtype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::unique_ptr< TYPE > "$typemap(dtype, TYPE).swigRelease($dinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::unique_ptr< TYPE > { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode + return ret; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/d/swigmove.i b/win64/bin/swig/share/swig/4.1.0/d/swigmove.i new file mode 100755 index 00000000..897b0795 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/d/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, canthrow=1) SWIGTYPE MOVE ($&1_type argp) +%{ argp = ($&1_ltype)$input; + if (!argp) { + SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(din) SWIGTYPE MOVE "$dclassname.swigRelease($dinput)" diff --git a/win64/bin/swig/share/swig/4.1.0/go/go.swg b/win64/bin/swig/share/swig/4.1.0/go/go.swg index e7fa2f29..67f49c7f 100755 --- a/win64/bin/swig/share/swig/4.1.0/go/go.swg +++ b/win64/bin/swig/share/swig/4.1.0/go/go.swg @@ -388,8 +388,9 @@ %typemap(gotype) SWIGTYPE && %{$gotypename%} -%typemap(in) SWIGTYPE && -%{ $1 = *($&1_ltype)&$input; %} +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) +%{ $1 = *($&1_ltype)&$input; +rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE && %{ *($&1_ltype)&$result = $1; %} @@ -625,7 +626,7 @@ %typemap(goout) SWIGTYPE "" %typemap(directorin) SWIGTYPE -%{ $input = new $1_ltype((const $1_ltype &)$1); %} +%{ $input = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(godirectorin) SWIGTYPE "" diff --git a/win64/bin/swig/share/swig/4.1.0/go/std_string.i b/win64/bin/swig/share/swig/4.1.0/go/std_string.i index 1710999d..9ee86ef9 100755 --- a/win64/bin/swig/share/swig/4.1.0/go/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/go/std_string.i @@ -52,6 +52,9 @@ class string; %typemap(godirectorin,fragment="CopyString") string %{ $result = swigCopyString($input) %} +%typemap(throws) string +%{ _swig_gopanic($1.c_str()); %} + %typemap(in) const string & %{ $*1_ltype $1_str($input.p, $input.n); @@ -88,22 +91,30 @@ class string; %typemap(godirectorin,fragment="CopyString") const string & %{ $result = swigCopyString($input) %} +%typemap(throws) const string & +%{ _swig_gopanic($1.c_str()); %} + %typemap(gotype) string * "*string" %typemap(in) string * (string temp) %{ - temp.assign($input->p, $input->n); - $1 = &temp; + if ($input) { + temp.assign($input->p, $input->n); + $1 = &temp; + } else + $1 = 0; %} %typemap(godirectorout) string * %{ - { + if $input != nil { p := Swig_malloc(len(*$input)) s := (*[1<<30]byte)(unsafe.Pointer(p))[:len(*$input)] copy(s, *$input) $result = (*string)(unsafe.Pointer(&s)) + } else { + $result = nil } %} @@ -125,17 +136,27 @@ class string; %typemap(directorin,fragment="AllocateString") string * (_gostring_ temp) %{ - temp = Swig_AllocateString($1->data(), $1->length()); - $input = &temp; + if ($1) { + temp = Swig_AllocateString($1->data(), $1->length()); + $input = &temp; + } else + $input = 0; %} %typemap(godirectorin,fragment="CopyString") string * %{ *$result = swigCopyString(*$input); %} %typemap(argout,fragment="AllocateString") string * -%{ *$input = Swig_AllocateString($1->data(), $1->length()); %} +%{ + if ($1) + *$input = Swig_AllocateString($1->data(), $1->length()); +%} %typemap(goargout,fragment="CopyString") string * -%{ *$input = swigCopyString(*$1) %} +%{ + if $input != nil { + *$1 = swigCopyString(*$input) + } +%} } diff --git a/win64/bin/swig/share/swig/4.1.0/go/swigmove.i b/win64/bin/swig/share/swig/4.1.0/go/swigmove.i new file mode 100755 index 00000000..ef2f65e3 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/go/swigmove.i @@ -0,0 +1,15 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ + argp = ($&1_ltype)$input; + if (argp == NULL) { + _swig_gopanic("Attempt to dereference null $1_type"); + } + SwigValueWrapper< $1_ltype >::reset($1, argp); +%} diff --git a/win64/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg b/win64/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg index 1a2bc19b..0ed17ee6 100755 --- a/win64/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg +++ b/win64/bin/swig/share/swig/4.1.0/guile/guile_scm_run.swg @@ -2,6 +2,12 @@ * guile_scm_run.swg * ----------------------------------------------------------------------------- */ +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" /* For 'volatile SCM *' in at least Guile 3.0 and earlier */ +#endif +#endif + #include #include #include @@ -112,6 +118,8 @@ static SCM swig_symbol = SCM_EOL; ( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \ ? scm_slot_ref(x, swig_symbol) : (x) ) +SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s); + SWIGINTERN SCM SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) { @@ -125,7 +133,7 @@ SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) else SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type); - if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) { + if (!cdata || scm_is_null(cdata->goops_class) || swig_make_func == SCM_EOL ) { return smob; } else { /* the scm_make() C function only handles the creation of gf, @@ -145,7 +153,7 @@ SWIGINTERN unsigned long SWIG_Guile_PointerAddress(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return 0; + if (scm_is_null(smob)) return 0; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -158,7 +166,7 @@ SWIGINTERN swig_type_info * SWIG_Guile_PointerType(SCM object) { SCM smob = SWIG_Guile_GetSmob(object); - if (SCM_NULLP(smob)) return NULL; + if (scm_is_null(smob)) return NULL; else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob) || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) { @@ -185,8 +193,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) swig_cast_info *cast; swig_type_info *from; SCM smob = SWIG_Guile_GetSmob(s); + int ret = SWIG_ERROR; - if (SCM_NULLP(smob)) { + if (scm_is_null(smob)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; #if SCM_MAJOR_VERSION >= 2 @@ -197,22 +206,36 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) } else if (SWIG_Guile_IsValidSmob(smob)) { from = (swig_type_info *) SCM_CELL_WORD_2(smob); if (!from) return SWIG_ERROR; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) { + if ((SCM_CELL_TYPE(smob) == swig_collectable_tag && SCM_CELL_WORD_1(smob) == 0) || SCM_CELL_TYPE(smob) == swig_tag) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + } + if (type) { cast = SWIG_TypeCheckStruct(from, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; + ret = SWIG_OK; } else { return SWIG_ERROR; } } else { *result = (void *) SCM_CELL_WORD_1(smob); - return SWIG_OK; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Guile_MarkPointerNoncollectable(smob); + } + if (flags & SWIG_POINTER_CLEAR) { + SCM_SET_CELL_WORD_1(smob, 0); } } - return SWIG_ERROR; + return ret; } SWIGINTERNINLINE void * @@ -252,7 +275,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerNoncollectable(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_tag); } @@ -265,7 +288,7 @@ SWIGINTERN void SWIG_Guile_MarkPointerDestroyed(SCM s) { SCM smob = SWIG_Guile_GetSmob(s); - if (!SCM_NULLP(smob)) { + if (!scm_is_null(smob)) { if (SWIG_Guile_IsValidSmob(smob)) { SCM_SET_CELL_TYPE(smob, swig_destroyed_tag); } @@ -486,20 +509,20 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest, int i; int num_args_passed = 0; for (i = 0; i (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/guile/std_string.i b/win64/bin/swig/share/swig/4.1.0/guile/std_string.i index ace68d45..33f42822 100755 --- a/win64/bin/swig/share/swig/4.1.0/guile/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/guile/std_string.i @@ -83,4 +83,13 @@ namespace std { $result = SWIG_str02scm($1.c_str()); } + %typemap(throws) string { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } + + %typemap(throws) const string & { + scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } } diff --git a/win64/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i new file mode 100755 index 00000000..cc517682 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/guile/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scm_misc_error(FUNC_NAME, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'", SCM_EOL); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/guile/swigmove.i b/win64/bin/swig/share/swig/4.1.0/guile/swigmove.i new file mode 100755 index 00000000..72848b60 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/guile/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/guile/swigrun.i b/win64/bin/swig/share/swig/4.1.0/guile/swigrun.i index 72858d5d..309dc408 100755 --- a/win64/bin/swig/share/swig/4.1.0/guile/swigrun.i +++ b/win64/bin/swig/share/swig/4.1.0/guile/swigrun.i @@ -4,8 +4,6 @@ #ifdef SWIGGUILE_SCM -/* Hook the runtime module initialization - into the shared initialization function SWIG_Guile_Init. */ %runtime %{ /* Hook the runtime module initialization into the shared initialization function SWIG_Guile_Init. */ diff --git a/win64/bin/swig/share/swig/4.1.0/guile/typemaps.i b/win64/bin/swig/share/swig/4.1.0/guile/typemaps.i index aedd80e2..5ef1081d 100755 --- a/win64/bin/swig/share/swig/4.1.0/guile/typemaps.i +++ b/win64/bin/swig/share/swig/4.1.0/guile/typemaps.i @@ -4,17 +4,43 @@ * Guile-specific typemaps * ----------------------------------------------------------------------------- */ +/* These are defined with a view to eventually merging with those defined for other target languages in swigtypemaps.swg and exception.swg */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(_code, _type, _name, _argn) scm_wrong_type_arg((char *) FUNC_NAME, _argn, $input) +#define %as_voidptr(ptr) (void*)(ptr) +#define %argument_nullref(_type, _name, _argn) scm_misc_error(FUNC_NAME, "invalid null reference for argument " #_argn " of type '" _type "'", SCM_EOL) +#define %releasenotowned_fail(_code, _type, _name, _argn) scm_misc_error(FUNC_NAME, "cannot release ownership as memory is not owned for argument " #_argn " of type '" _type "'", SCM_EOL) + /* Pointers */ -%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { +%typemap(in) SWIGTYPE *, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } -%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""; +%typemap(in) SWIGTYPE & ($1_ltype argp) { + argp = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = argp; +} +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +} +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "" %typemap(in) void * { $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0); } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(varin) SWIGTYPE * { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0); @@ -115,8 +141,9 @@ /* Pass-by-value */ -%typemap(in) SWIGTYPE($&1_ltype argp) { +%typemap(in) SWIGTYPE ($&1_ltype argp) { argp = ($&1_ltype)SWIG_MustGetPtr($input, $&1_descriptor, $argnum, 0); + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } $1 = *argp; } @@ -130,7 +157,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -145,8 +172,7 @@ %typemap(varout) SWIGTYPE #ifdef __cplusplus { - $&1_ltype resultptr; - resultptr = new $1_ltype((const $1_ltype&) $1); + $&1_ltype resultptr = ($&1_ltype)&$1; $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -322,14 +348,14 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* SWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after the function call. */ -%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);"; +%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);" %typemap (freearg) char **INPUT, char **BOTH "if (must_free$argnum) SWIG_free(*$1);" %typemap (freearg) char **OUTPUT "SWIG_free(*$1);" /* But this shall not apply if we try to pass a single char by reference. */ -%typemap (freearg) char *OUTPUT, char *BOTH ""; +%typemap (freearg) char *OUTPUT, char *BOTH "" /* If we set a string variable, delete the old result first, unless const. */ @@ -349,13 +375,13 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); /* Void */ -%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;"; +%typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;" /* SCM is passed through */ typedef unsigned long SCM; -%typemap (in) SCM "$1=$input;"; -%typemap (out) SCM "$result=$1;"; +%typemap (in) SCM "$1=$input;" +%typemap (out) SCM "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) SCM "$1=1;"; /* ------------------------------------------------------------ @@ -373,11 +399,6 @@ typedef unsigned long SCM; * taken from typemaps/swigtype.swg * ------------------------------------------------------------ */ -#define %set_output(obj) $result = obj -#define %set_varoutput(obj) $result = obj -#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input); -#define %as_voidptr(ptr) (void*)(ptr) - %typemap(in) SWIGTYPE (CLASS::*) { int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { @@ -426,7 +447,7 @@ typedef unsigned long SCM; %typecheck(SWIG_TYPECHECK_BOOL) bool, bool&, const bool& { - $1 = SCM_BOOLP($input) ? 1 : 0; + $1 = scm_is_bool($input) ? 1 : 0; } %typecheck(SWIG_TYPECHECK_DOUBLE) diff --git a/win64/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i b/win64/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i index e993fec6..af9a4ba2 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/java/boost_intrusive_ptr.i @@ -33,7 +33,7 @@ %} %typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + $1_ltype* resultp = new $1_ltype($1); intrusive_ptr_add_ref(resultp); *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); %} @@ -342,7 +342,7 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} // plain pointer %typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ diff --git a/win64/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i index 56c93d0c..70dcfc2a 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/java/boost_shared_ptr.i @@ -29,11 +29,11 @@ } $1 = *argp; %} %typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %} %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE %{ $input = 0; - *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %} + *((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %} %typemap(directorout) CONST TYPE %{ if (!$input) { diff --git a/win64/bin/swig/share/swig/4.1.0/java/director.swg b/win64/bin/swig/share/swig/4.1.0/java/director.swg index 6aa0503b..f87c6f7c 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/director.swg +++ b/win64/bin/swig/share/swig/4.1.0/java/director.swg @@ -51,6 +51,10 @@ SWIGINTERN int Swig::GetThreadName(char *name, size_t len) { #endif +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) +#include +#endif + namespace Swig { /* Java object wrapper */ @@ -133,6 +137,19 @@ namespace Swig { } } +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + static void detach(void *jvm) { + static_cast(jvm)->DetachCurrentThread(); + } + + static void make_detach_key() { + pthread_key_create(&detach_key_, detach); + } + + /* thread-local key to register a destructor */ + static pthread_key_t detach_key_; +#endif + private: /* pointer to Java object */ jobject jthis_; @@ -140,6 +157,10 @@ namespace Swig { bool weak_global_; }; +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + pthread_key_t JObjectWrapper::detach_key_; +#endif + /* Local JNI reference deleter */ class LocalRefGuard { JNIEnv *jenv_; @@ -201,9 +222,19 @@ namespace Swig { #else director_->swig_jvm_->AttachCurrentThread(jenv, &args); #endif + +#if defined(SWIG_JAVA_DETACH_ON_THREAD_END) + // At least on Android 6, detaching after every call causes a memory leak. + // Instead, register a thread desructor and detach only when the thread ends. + // See https://developer.android.com/training/articles/perf-jni#threads + static pthread_once_t once = PTHREAD_ONCE_INIT; + + pthread_once(&once, JObjectWrapper::make_detach_key); + pthread_setspecific(JObjectWrapper::detach_key_, director->swig_jvm_); +#endif } ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) +#if !defined(SWIG_JAVA_DETACH_ON_THREAD_END) && !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. if (env_status == JNI_EDETACHED) diff --git a/win64/bin/swig/share/swig/4.1.0/java/java.swg b/win64/bin/swig/share/swig/4.1.0/java/java.swg index 26f9739d..08a1d032 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/java.swg +++ b/win64/bin/swig/share/swig/4.1.0/java/java.swg @@ -665,7 +665,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %} +%{ *($&1_ltype*)&$result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -676,7 +676,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)" %typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)" @@ -692,14 +692,15 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } } %typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; } %} -%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input; +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = *($&1_ltype)&$input; if (!$1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type is null"); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %} %typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) { @@ -1101,7 +1102,8 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } jobjectArray "$javainput" %typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)" -%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE && "$javaclassname.swigRelease($javainput)" %typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)" /* The javaout typemap is used for converting function return types from the return type @@ -1216,6 +1218,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} // Derived proxy classes @@ -1230,6 +1244,18 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + long ptr = 0; + if (obj != null) { + if (!obj.swigCMemOwn) + throw new RuntimeException("Cannot release ownership as memory is not owned"); + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.delete(); + } + return ptr; + } %} %enddef @@ -1249,6 +1275,10 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } CPTR_VISIBILITY static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } + + CPTR_VISIBILITY static long swigRelease($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } %} %typemap(javabody) TYPE (CLASS::*) %{ diff --git a/win64/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i index 3cecb202..65b45807 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/java/std_auto_ptr.i @@ -1,27 +1,41 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (jni) std::auto_ptr "jlong" -%typemap (jtype) std::auto_ptr "long" -%typemap (jstype) std::auto_ptr "$typemap(jstype, TYPE)" -%typemap (out) std::auto_ptr %{ - jlong lpp = 0; - *(TYPE**) &lpp = $1.release(); - $result = lpp; +%typemap (jni) std::auto_ptr< TYPE > "jlong" +%typemap (jtype) std::auto_ptr< TYPE > "long" +%typemap (jstype) std::auto_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > (TYPE *auto_temp) +%{ auto_temp = *(TYPE **)&$input; + $1.reset(auto_temp); %} + +%typemap(javain) std::auto_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; %} -%typemap(javaout) std::auto_ptr { - long cPtr = $jnicall; - return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); - } -%template() std::auto_ptr; + +%typemap(javaout) std::auto_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/java/std_set.i b/win64/bin/swig/share/swig/4.1.0/java/std_set.i index bc6f0aa6..6326cd00 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/std_set.i +++ b/win64/bin/swig/share/swig/4.1.0/java/std_set.i @@ -96,6 +96,10 @@ class set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/win64/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i new file mode 100755 index 00000000..debfc179 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/java/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) + +%typemap (jni) std::unique_ptr< TYPE > "jlong" +%typemap (jtype) std::unique_ptr< TYPE > "long" +%typemap (jstype) std::unique_ptr< TYPE > "$typemap(jstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > (TYPE *unique_temp) +%{ unique_temp = *(TYPE **)&$input; + $1.reset(unique_temp); %} + +%typemap(javain) std::unique_ptr< TYPE > "$typemap(jstype, TYPE).swigRelease($javainput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; +%} + +%typemap(javaout) std::unique_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/java/std_unordered_set.i b/win64/bin/swig/share/swig/4.1.0/java/std_unordered_set.i index d92f1a34..97250ada 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/std_unordered_set.i +++ b/win64/bin/swig/share/swig/4.1.0/java/std_unordered_set.i @@ -92,6 +92,10 @@ class unordered_set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } diff --git a/win64/bin/swig/share/swig/4.1.0/java/std_wstring.i b/win64/bin/swig/share/swig/4.1.0/java/std_wstring.i index d5fb1ec4..c24baaa3 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/std_wstring.i +++ b/win64/bin/swig/share/swig/4.1.0/java/std_wstring.i @@ -88,9 +88,12 @@ class wstring; //%typemap(typecheck) wstring = wchar_t *; %typemap(throws) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} // const wstring & %typemap(jni) const wstring & "jstring" @@ -166,9 +169,12 @@ class wstring; //%typemap(typecheck) const wstring & = wchar_t *; %typemap(throws) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); - return $null; %} +%{std::string message($1.size(), '\0'); + for (size_t i = 0; i < $1.size(); ++i) { + message[i] = (char)$1[i]; + } + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str()); + return $null; %} } diff --git a/win64/bin/swig/share/swig/4.1.0/java/swiginterface.i b/win64/bin/swig/share/swig/4.1.0/java/swiginterface.i index 80652fd5..81dd6d62 100755 --- a/win64/bin/swig/share/swig/4.1.0/java/swiginterface.i +++ b/win64/bin/swig/share/swig/4.1.0/java/swiginterface.i @@ -40,7 +40,7 @@ %typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()" %typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} + *(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE [] %{ *(($&1_ltype)&$input) = ($1_ltype) $1; %} %typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE & diff --git a/win64/bin/swig/share/swig/4.1.0/java/swigmove.i b/win64/bin/swig/share/swig/4.1.0/java/swigmove.i new file mode 100755 index 00000000..28897eee --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/java/swigmove.i @@ -0,0 +1,16 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in) SWIGTYPE MOVE ($&1_type argp) +%{ argp = *($&1_ltype*)&$input; + if (!argp) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(javain) SWIGTYPE MOVE "$&javaclassname.swigRelease($javainput)" diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg index 0c52fe96..ed663639 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascriptcode.swg @@ -1,6 +1,6 @@ %fragment ("js_check_arg_count", "templates") %{ if (argc != $jsargcount) { - SE_REPORT_ERROR("$jswrapper: wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, $jsargcount); return false; }%} @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ %fragment ("js_ctor", "templates") %{ -// js_ctor static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; @@ -39,14 +38,9 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_ctor_dispatcher size_t argc = s.args().size(); bool ret = false; - - // switch all cases by means of series of if-returns. $jsdispatchcases - - // default: SE_REPORT_ERROR("Illegal arguments for construction of $jsname"); return false; } @@ -64,7 +58,6 @@ SE_BIND_CTOR($jswrapper, __jsb_$jsmangledname_class, js_delete_$jsdtor)%} %{ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) { - // js_overloaded_ctor const auto& args = s.args(); CC_UNUSED bool ok = true; $jslocals @@ -84,7 +77,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_ctor_dispatch_case", "templates") %{ - // js_ctor_dispatch_case if(argc == $jsargcount) { ret = $jswrapper(s); if (ret) { return ret; } /* reset exception and return */ @@ -99,7 +91,6 @@ static bool $jswrapper(se::State& s) // NOLINT(readability-identifier-naming) * ----------------------------------------------------------------------------- */ %fragment ("js_dtor", "templates") %{ -// js_dtor static bool $jswrapper(se::State& s) { return true; } @@ -114,7 +105,7 @@ SE_BIND_FINALIZE_FUNC($jswrapper) %} %fragment ("js_dtoroverride", "templates") %{ static bool $jswrapper(se::State& s) -{// js_dtoroverride +{ return true; } SE_BIND_FINALIZE_FUNC($jswrapper) %} @@ -169,7 +160,6 @@ SE_BIND_PROP_SET($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -196,7 +186,6 @@ SE_BIND_FUNC($jswrapper) %} %{ static bool $jswrapper(se::State& s) { - // js_function_dispatcher CC_UNUSED bool ok = true; const auto& args = s.args(); size_t argc = args.size(); @@ -216,7 +205,7 @@ SE_BIND_FUNC($jswrapper) %} %fragment ("js_overloaded_function", "templates") %{ static bool $jswrapper(se::State& s) -{// js_overloaded_function +{ $js_func_begin CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -233,7 +222,7 @@ static bool $jswrapper(se::State& s) * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function_dispatch_case", "templates") -%{// js_function_dispatch_case +%{ if (argc == $jsargcount) { ok = $jswrapper(s); if (ok) { return true; } diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg index b822648f..88a077b2 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/javascripttypemaps.swg @@ -38,36 +38,32 @@ /* ----------------------------------------------------------------------------- * standard typemaps * ----------------------------------------------------------------------------- */ -/* NEW LANGUAGE NOTE: - the 'checkfn' param is something that I added for typemap(in) - it is an optional fn call to check the type of the lua object - the fn call must be of the form - int checkfn(lua_State *L, int index); - and return 1/0 depending upon if this is the correct type - For the typemap(out), an additional SWIG_arg parameter must be incremented - to reflect the number of values returned (normally SWIG_arg++; will do) -*/ // number - -%typemap(in) int, short, long, signed char, float, double -%{// %typemap(in) int, short, long, signed char, float, double - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +%typemap(in) char, int, short, long, signed char, float, double, int8_t, int16_t, int32_t, int64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // additional check for unsigned numbers, to not permit negative input -%typemap(in) unsigned int, unsigned short, unsigned long, unsigned char -%{// %typemap(in) unsigned int, unsigned short, unsigned long, unsigned char - ok &= sevalue_to_native($input, &$1, nullptr); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); +%typemap(in) unsigned char, unsigned int, unsigned short, unsigned long, unsigned char, uint8_t, uint16_t, uint32_t, uint64_t, size_t, ssize_t +%{ + ok &= sevalue_to_native($input, &$1, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) int,short,long, - unsigned int,unsigned short,unsigned long, +%typemap(out) char, int,short,long, + unsigned char, unsigned int,unsigned short,unsigned long, signed char,unsigned char, - float,double + float,double, + int8_t, int16_t, int32_t, int64_t, + uint8_t, uint16_t, uint32_t, uint64_t, + size_t, ssize_t %{ - // out 1 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); %} + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); %} + +%apply long {long long, signed long long, unsigned long long}; +// size_t (which is just a unsigned long) +%apply unsigned long { size_t }; // we must also provide typemaps for primitives by const reference: // given a function: @@ -75,27 +71,17 @@ // SWIG assumes that this code will need a pointer to int to be passed in // (this might be ok for objects by const ref, but not for numeric primitives) // therefore we add a set of typemaps to fix this (for both in & out) -%typemap(in,checkfn="lua_isnumber") const int& ($*1_ltype temp) +%typemap(in) const int& ($*1_ltype temp), const unsigned int& ($*1_ltype temp) %{ - //temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - $1 = &temp; -%} - -%typemap(in,checkfn="lua_isnumber") const unsigned int& //($*1_ltype temp) -%{ - //SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative"); - // temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp; - ok &= sevalue_to_native($input, &temp, nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + ok &= sevalue_to_native($input, &temp, s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(out) const int&, const unsigned int& -%{ // out 2 - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} // for the other numbers we can just use an apply statement to cover them @@ -105,192 +91,101 @@ %apply const unsigned int & {const unsigned short&,const unsigned long&, const unsigned char&}; -/* enums have to be handled slightly differently - VC++ .net will not allow a cast from lua_Number(double) to enum directly. -*/ -%typemap(in) enum SWIGTYPE (int32_t temp) -%{ // %typemap(in) enum SWIGTYPE (int32_t temp) - ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1 = ($ltype)temp;%} - -%typemap(out) enum SWIGTYPE (int32_t temp) -%{ // out 4 - s.rval().setInt32(static_cast($1));%} - -// and const refs -%typemap(in) const enum SWIGTYPE &($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE & - temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%} - -%typemap(in) const enum SWIGTYPE &&($basetype temp) -%{ // %typemap(in) const enum SWIGTYPE && - 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++;%} +%apply const long& {const long long&, const signed long long&, const unsigned long long&}; +%apply const unsigned long & { const size_t & }; %typemap(in) bool -%{ // %typemap(in) bool +%{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(out) bool -%{// out 5 - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/);%} +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject());%} -// for const bool&, SWIG treats this as a const bool* so we must dereference it -%typemap(in,checkfn="lua_isboolean") const bool& (bool temp) -%{temp=(lua_toboolean(L, $input)!=0); - $1=&temp;%} +%typemap(out) bool & +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject());%} -%typemap(out) const bool& -%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%} - -// strings (char * and char[]) - -%typemap(in) const char * (ccstd::string temp), char * (ccstd::string temp) -%{ +%typemap(in) const char * (ccstd::string temp) +%{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) temp.c_str(); %} -%typemap(in) const char[ANY], char[ANY] -%{$1 = ($ltype)lua_tostring(L, $input);%} - %typemap(out) const char *, char * -%{ // out 6 +%{ ok &= nativevalue_to_se($1, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); - SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) const char[ANY], char[ANY] -%{ lua_pushstring(L,(const char *)$1); SWIG_arg++;%} - -// char's -// currently treating chars as small strings, not as numbers -// (however signed & unsigned char's are numbers...) -%typemap(in) char -%{$1 = (lua_tostring(L, $input))[0];%} - -%typemap(out) char -%{ lua_pushlstring(L, &$1, 1); SWIG_arg++;%} - -// by const ref -%typemap(in) const char& (char temp) -%{temp = (lua_tostring(L, $input))[0]; $1=&temp;%} - -%typemap(out) const char& -%{ lua_pushlstring(L, $1, 1); SWIG_arg++;%} +%apply const char* {char*, const char[ANY], char[ANY]} // pointers and references -// under SWIG rules, it is ok, to have a pass in a lua nil, +// under SWIG rules, it is ok, to have a pass in a javascript null, // it should be converted to a SWIG NULL. // This will only be allowed for pointers & arrays, not refs or by value -// the checkfn lua_isuserdata will only work for userdata -// the checkfn SWIG_isptrtype will work for both userdata and nil %typemap(in) SWIGTYPE* -%{ // %typemap(in) SWIGTYPE* +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE[] -%{ // %typemap(in) SWIGTYPE[] +%{ ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} %typemap(in) SWIGTYPE& ($*ltype temp) -%{// %typemap(in) SWIGTYPE& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} %typemap(in) SWIGTYPE&& ($*ltype temp) -%{// %typemap(in) SWIGTYPE&& +%{ ok &= sevalue_to_native($input, &temp, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = &temp; %} // out is simple %typemap(out) SWIGTYPE& -%{ // %typemap(out) SWIGTYPE& - ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se(*$1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE(*$1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE* -%{ // %typemap(out) SWIGTYPE* - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} %typemap(out) SWIGTYPE&& -%{ // %typemap(out) SWIGTYPE&& - ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); +%{ + ok &= nativevalue_to_se($1, s.rval(), s.thisObject()); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} -// dynamic casts -// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is -// the we return it as the correct type -%typemap(out) SWIGTYPE *DYNAMIC, - SWIGTYPE &DYNAMIC -{ - swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); - SWIG_NewPointerObj222(L,(void*)$1,ty,$owner); SWIG_arg++; -} - - // passing objects by value // SWIG_ConvertPtr wants an object pointer (the $<ype argp) // then dereferences it to get the object %typemap(in) SWIGTYPE //($<ype argp) %{ - // %typemap(in) SWIGTYPE value in ok &= sevalue_to_native($input, &$1, s.thisObject()); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); %} - -// Also needed for object ptrs by const ref -// eg A* const& ref_pointer(A* const& a); -// found in mixed_types.i -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE *const&($*ltype temp) -%{temp=($*ltype)SWIG_MustGetPtr111(L,$input,$*descriptor,0,$argnum,"$symname"); -$1=($1_ltype)&temp;%} - -%typemap(out) SWIGTYPE *const& -%{ // %typemap(out) SWIGTYPE *const& - SWIG_NewPointerObj333(L,*$1,$*descriptor,$owner); SWIG_arg++; %} - - -// DISOWN-ing typemaps -// if you have an object pointer which must be disowned, use this typemap -// eg. for void destroy_foo(Foo* toDie); -// use %apply SWIGTYPE* DISOWN {Foo* toDie}; -// you could just use %delobject, but this is more flexible -%typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] -%{ // %typemap(in,checkfn="SWIG_isptrtype") SWIGTYPE* DISOWN,SWIGTYPE DISOWN[] - if (!SWIG_IsOK(SWIG_ConvertPtrIn222(L,$input,(void**)&$1,$descriptor,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("$symname",$argnum,$descriptor); - } -%} - - // Primitive types--return by value // must make a new object, copy the data & return the new object // Note: the brackets are {...} and not %{..%}, because we want them to be included in the wrapper // this is because typemap(out) does not support local variables, like in typemap(in) does // and we need the $&1_ltype resultptr; to be declared %typemap(out) SWIGTYPE -%{ // %typemap(out) SWIGTYPE +%{ ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} @@ -299,17 +194,14 @@ $1=($1_ltype)&temp;%} // so the standard wrapping cannot be done // nor can you cast a member function pointer to a void* (obviously) // therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written -%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) +%typemap(in) SWIGTYPE (CLASS::*) %{ - // %typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) - if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor))) - SWIG_fail_ptr("$symname",$argnum,$descriptor); + static_assert(false, "Binding member function pointer is not supported!"); %} %typemap(out) SWIGTYPE (CLASS::*) %{ - // %typemap(out) SWIGTYPE (CLASS::*) - SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++; + static_assert(false, "Returning member function pointer is not supported!"); %} @@ -320,20 +212,9 @@ $1=($1_ltype)&temp;%} A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) but if it's an output, then it should be wrapped like any other SWIG object (using default typemap) */ -%typemap(in,checkfn="SWIG_isptrtype") void* +%typemap(in) void* %{ ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor");%} - -/* long long is another special case: -as lua only supports one numeric type (lua_Number), we will just -cast it to that & accept the loss of precision. -An alternative solution would be a long long struct or class -with the relevant operators. -*/ -%apply long {long long, signed long long, unsigned long long}; -%apply const long& {const long long&, const signed long long&, const unsigned long long&}; - - + SE_PRECONDITION2(ok, false, "Error processing arguments");%} /* ----------------------------------------------------------------------------- * typecheck rules @@ -343,100 +224,10 @@ These define the detection routines which will spot what parameters match which function */ -// unfortunately lua only considers one type of number -// so all numbers (int,float,double) match -// you could add an advanced fn to get type & check if it's integral -%typecheck(SWIG_TYPECHECK_INTEGER) - int, short, long, - unsigned int, unsigned short, unsigned long, - signed char, unsigned char, - long long, unsigned long long, signed long long, - const int &, const short &, const long &, - 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&, const enum SWIGTYPE &&, - float, double, const float &, const double& -{ - $1 = lua_isnumber(L,$input); -} - -// %typecheck(SWIG_TYPECHECK_BOOL) -// bool, const bool & -// { -// $1 = lua_isboolean(L,$input); -// } - -// special check for a char (string of length 1) -// %typecheck(SWIG_TYPECHECK_CHAR,fragment="SWIG_lua_isnilstring") char, const char& { -// $1 = SWIG_lua_isnilstring(L,$input) && (lua_rawlen(L,$input)==1); -// } - -// %typecheck(SWIG_TYPECHECK_STRING,fragment="SWIG_lua_isnilstring") char *, char[] { -// $1 = SWIG_lua_isnilstring(L,$input); -// } - %typemap(in) SWIGTYPE *self %{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} + if (nullptr == $1) return true;%} -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr61(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_ConvertPtr62(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr63(L,$input, (void **) &ptr, $1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { -// void *ptr; -// if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr64(L,$input, (void **) &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr65(L,$input, (void **) &ptr, 0, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } - -// // Also needed for object pointers by const ref -// // eg const A* ref_pointer(A* const& a); -// // found in mixed_types.i -// %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& -// { -// void *ptr; -// if (SWIG_isptrtype(L,$input)==0 || SWIG_ConvertPtr66(L,$input, (void **) &ptr, $*descriptor, 0)) { -// $1 = 0; -// } else { -// $1 = 1; -// } -// } /* ----------------------------------------------------------------------------- * Others @@ -451,16 +242,14 @@ parameters match which function %apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } %apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } -// size_t (which is just a unsigned long) -%apply unsigned long { size_t }; -%apply const unsigned long & { const size_t & }; + /* ----------------------------------------------------------------------------- * Specials * ----------------------------------------------------------------------------- */ // swig::LANGUAGE_OBJ was added to allow containers of native objects -// however it's rather difficult to do this in lua, as you cannot hold pointers +// however it's rather difficult to do this in javascript, as you cannot hold pointers // to native objects (they are held in the interpreter) // therefore for now: just ignoring this feature #ifdef __cplusplus @@ -475,40 +264,16 @@ parameters match which function #endif // __cplusplus -// %typemap(memberin) float [ANY] { -// int i; -// for (i = 0; i < $1_dim0; i++) { -// $1[i] = $input[i]; -// } -// } - -// %typemap(out) float [ANY] { -// int i; -// $result = PyList_New($1_dim0); -// for (i = 0; i < $1_dim0; i++) { -// PyObject *o = PyFloat_FromDouble((double) $1[i]); -// PyList_SetItem($result, i, o); -// } -// } - -// %typemap(check) double %{ -// if ($1 < 0) { -// croak("hahaha Expecting a positive number"); -// } -// %} - // Cocos custom type %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ - // %typemap(in) cc::Mat4* (cc::Mat4 temp) %{ ok &= sevalue_to_native($input, &temp); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); $1 = ($ltype) &temp; %} %typemap(out) cc::Float32Array %{ - // %typemap(out) cc::Float32Array ok &= nativevalue_to_se($1, s.rval(), s.thisObject() /*ctx*/); - SE_PRECONDITION2(ok, false, "$symname, Error processing arguments"); + SE_PRECONDITION2(ok, false, "Error processing arguments"); SE_HOLD_RETURN_VALUE($1, s.thisObject(), s.rval()); %} \ No newline at end of file diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i index c6c86412..886cc03b 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/javascript/cocos/std_string.i @@ -32,71 +32,71 @@ assert(s==s2) namespace std { -%naturalvar string; +// %naturalvar string; -%typemap(in) string -%{// string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); %} +// %typemap(in) string +// %{// string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); %} -%typemap(out) string -%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string +// %{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in) string *self -%{ $1 = SE_THIS_OBJECT<$*ltype>(s); - SE_PRECONDITION2($1, false, "%s: Invalid Native Object", __FUNCTION__); %} +// %typemap(in) string *self +// %{ $1 = SE_THIS_OBJECT<$*ltype>(s); +// SE_PRECONDITION2($1, false, "Invalid Native Object"); %} -%typemap(in,checkfn="lua_isstring") string* -%{// string* - std::string - ok &= sevalue_to_native($input, &$1); - SE_PRECONDITION2(ok, false, "$symname,$argnum,$descriptor"); - $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} +// %typemap(in,checkfn="lua_isstring") string* +// %{// string* +// std::string +// ok &= sevalue_to_native($input, &$1); +// SE_PRECONDITION2(ok, false, "Error processing arguments"); +// $1.assign(lua_tostringxxx(L,$input),lua_rawlen(L,$input));%} -%typemap(out) string* -%{// out string* - lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} +// %typemap(out) string* +// %{// out string* +// lua_pushlstringxxx(L,$1.data(),$1.size()); SWIG_arg++;%} -%typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) -%{ // const std::string& - temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} +// %typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) +// %{ // const std::string& +// temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} -%typemap(out) const string& -%{ // out const string& - lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(out) const string& +// %{ // out const string& +// lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -// %typecheck(SWIG_TYPECHECK_STRING) string, const string& { -// $1 = lua_isstring(L,$input); -// } +// // %typecheck(SWIG_TYPECHECK_STRING) string, const string& { +// // $1 = lua_isstring(L,$input); +// // } -/* -std::string& can be wrapped, but you must inform SWIG if it is in or out +// /* +// std::string& can be wrapped, but you must inform SWIG if it is in or out -eg: -void fn(std::string& str); -Is this an in/out/inout value? +// eg: +// void fn(std::string& str); +// Is this an in/out/inout value? -Therefore you need the usual -%apply (std::string& INOUT) {std::string& str}; -or -%apply std::string& INOUT {std::string& str}; -typemaps to tell SWIG what to do. -*/ +// Therefore you need the usual +// %apply (std::string& INOUT) {std::string& str}; +// or +// %apply std::string& INOUT {std::string& str}; +// typemaps to tell SWIG what to do. +// */ -%typemap(in) string &INPUT=const string &; +// %typemap(in) string &INPUT=const string &; -%typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) -%{ $1 = &temp; %} +// %typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) +// %{ $1 = &temp; %} -%typemap(argout) string &OUTPUT -%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} +// %typemap(argout) string &OUTPUT +// %{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} -%typemap(in) string &INOUT =const string &; -%typemap(in) string *INOUT %{ - // inout ... string* -%}; +// %typemap(in) string &INOUT =const string &; +// %typemap(in) string *INOUT %{ +// // inout ... string* +// %}; -%typemap(argout) string &INOUT = string &OUTPUT; +// %typemap(argout) string &INOUT = string &OUTPUT; /* A really cut down version of the string class diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg index 51e85c17..2a212890 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptrun.swg @@ -7,23 +7,27 @@ #define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0) #define SWIG_fail goto fail -SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) { - JSStringRef message = JSStringCreateWithUTF8CString(type); +SWIGRUNTIME void SWIG_Javascript_Raise_ValueRef(JSContextRef context, JSValueRef *exception, JSValueRef valRef) { JSValueRef error_arguments[1]; JSObjectRef exception_object; - JSValueRef exception_value; - exception_value = JSValueMakeString(context, message); /* Converting the result to an object will let JavascriptCore add "sourceURL" (file) and "line" (number) and "message" to the exception, instead of just returning a raw string. This is extremely important for debugging your errors. Using JSObjectMakeError is better than JSValueToObject because the latter only populates "sourceURL" and "line", but not "message" or any others I don't know about. */ - error_arguments[0] = exception_value; + error_arguments[0] = valRef; exception_object = JSObjectMakeError(context, 1, error_arguments, NULL); /* Return the exception_object */ *exception = exception_object; +} + +SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* msg) { + JSStringRef message = JSStringCreateWithUTF8CString(msg); + JSValueRef exception_value = JSValueMakeString(context, message); + + SWIG_Javascript_Raise_ValueRef(context, exception, exception_value); JSStringRelease(message); } @@ -135,8 +139,15 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob } } - if (flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg index 290246f8..87a6e7ce 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascriptstrings.swg @@ -75,6 +75,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz } %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -166,6 +167,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg index e30d58c9..8adf21bb 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/javascripttypemaps.swg @@ -41,7 +41,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type) +#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise_ValueRef(context, exception, obj) %insert("runtime") %{ #define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1) diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i new file mode 100755 index 00000000..304f1fc9 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/jsc/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg index b68de378..fd8e46e8 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptprimtypes.swg @@ -81,7 +81,7 @@ int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } } @@ -149,7 +149,7 @@ int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val) SWIGINTERNINLINE SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value) { - return SWIGV8_INTEGER_NEW_UNS(value); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } %#endif } diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg index a8668e9f..4c3d9983 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascriptrun.swg @@ -96,6 +96,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) { SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); } +SWIGINTERN void SWIG_V8_Raise(SWIGV8_VALUE obj, const char *msg) { + SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_TO_STRING(obj))); +} + + /* Note: There are two contexts for handling errors. A static V8ErrorHandler is used in not overloaded methods. @@ -194,8 +199,15 @@ SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swi *ptr = cdata->swigCObject; } - if(flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !cdata->swigCMemOwn) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + if (flags & SWIG_POINTER_CLEAR) { + cdata->swigCObject = 0; + } } return SWIG_OK; } diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg index b256b54a..34764730 100755 --- a/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/javascripttypemaps.swg @@ -37,7 +37,7 @@ #define SWIG_SetConstant(name, obj) /* raise */ -#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type) +#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(obj, type) /* Include the unified typemap library */ %include diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i new file mode 100755 index 00000000..304f1fc9 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i b/win64/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/javascript/v8/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/lua/argcargv.i b/win64/bin/swig/share/swig/4.1.0/lua/argcargv.i new file mode 100755 index 00000000..dc96d215 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/lua/argcargv.i @@ -0,0 +1,57 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + + Use it as follows: + + %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } + extern int mainApp(size_t argc, const char **argv); + + then from lua: + + args = { "arg0", "arg1" } + mainApp(args) + + * ------------------------------------------------------------ */ + +%{ +SWIGINTERN int SWIG_argv_size(lua_State* L, int index) { + int n=0; + while(1){ + lua_rawgeti(L,index,n+1); + if (lua_isnil(L,-1)) + break; + ++n; + lua_pop(L,1); + } + lua_pop(L,1); + return n; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + if (lua_istable(L,$input)) { + int i, size = SWIG_argv_size(L,$input); + $1 = ($1_ltype) size; + $2 = (char **) malloc((size+1)*sizeof(char *)); + for (i = 0; i < size; i++) { + lua_rawgeti(L,$input,i+1); + if (lua_isnil(L,-1)) + break; + $2[i] = (char *)lua_tostring(L, -1); + lua_pop(L,1); + } + $2[i]=NULL; + } else { + $1 = 0; $2 = 0; + lua_pushstring(L,"Expecting argv array"); + lua_error(L); + } +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = lua_istable(L,$input); +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((char *) $2); +} diff --git a/win64/bin/swig/share/swig/4.1.0/lua/lua.swg b/win64/bin/swig/share/swig/4.1.0/lua/lua.swg index e3be26e7..2cd5a224 100755 --- a/win64/bin/swig/share/swig/4.1.0/lua/lua.swg +++ b/win64/bin/swig/share/swig/4.1.0/lua/lua.swg @@ -213,7 +213,7 @@ SWIG_fail;%} // %apply SWIGTYPE EXCEPTION_BY_VAL {FooBar}; // %apply SWIGTYPE& EXCEPTION_BY_VAL {FooBar&}; // note: need & twice %typemap(throws) SWIGTYPE EXCEPTION_BY_VAL -%{SWIG_NewPointerObj(L,(void *)new $1_ltype(($1_ltype &) $1),$&1_descriptor,1); +%{SWIG_NewPointerObj(L,(void *)new $1_ltype($1),$&1_descriptor,1); SWIG_fail;%} // similar for object reference diff --git a/win64/bin/swig/share/swig/4.1.0/lua/luarun.swg b/win64/bin/swig/share/swig/4.1.0/lua/luarun.swg index e224fa6e..dd64a13d 100755 --- a/win64/bin/swig/share/swig/4.1.0/lua/luarun.swg +++ b/win64/bin/swig/share/swig/4.1.0/lua/luarun.swg @@ -1757,6 +1757,7 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *t (if possible) */ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags) { + int ret = SWIG_ERROR; swig_lua_userdata *usr; swig_cast_info *cast; /* special case: lua nil => NULL pointer */ @@ -1773,25 +1774,36 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ if (usr) { + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own) + { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ { - usr->own=0; + usr->own = 0; } if (!type) /* special cast void*, no casting fn */ { *ptr=usr->ptr; - return SWIG_OK; /* ok */ + ret = SWIG_OK; } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) + else { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ + cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + ret = SWIG_OK; + } + } + if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR)) + { + usr->ptr = 0; } } - return SWIG_ERROR; /* error */ + return ret; } SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags, diff --git a/win64/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg b/win64/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg index 531e7cf5..ce963a20 100755 --- a/win64/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/lua/luatypemaps.swg @@ -151,11 +151,17 @@ 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); +%typemap(in,checkfn="lua_isuserdata",fragment="") SWIGTYPE&& (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor); + } } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); %} // out is simple @@ -217,7 +223,7 @@ $1=($1_ltype)&temp;%} #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultptr = new $1_ltype($1); SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++; } #else @@ -248,7 +254,7 @@ $1=($1_ltype)&temp;%} // void (must be empty without the SWIG_arg++) -%typemap(out) void ""; +%typemap(out) void "" /* void* is a special case A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does) diff --git a/win64/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i new file mode 100755 index 00000000..b7ee2936 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/lua/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i new file mode 100755 index 00000000..424a53c2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/lua/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, checkfn="SWIG_isptrtype", noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/lua/swigmove.i b/win64/bin/swig/share/swig/4.1.0/lua/swigmove.i new file mode 100755 index 00000000..25cf4739 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/lua/swigmove.i @@ -0,0 +1,18 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, checkfn="lua_isuserdata", noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(L, $input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + lua_pushfstring(L, "Cannot release ownership as memory is not owned for argument $argnum of type '$1_type' in $symname"); SWIG_fail; + } else { + SWIG_fail_ptr("$symname", $argnum, $&1_descriptor); + } + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg b/win64/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg index 2904d0de..d8fc6cb5 100755 --- a/win64/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/mzrun.swg @@ -125,6 +125,7 @@ struct swig_mz_proxy { Scheme_Type mztype; swig_type_info *type; void *object; + int own; }; static Scheme_Type swig_type; @@ -135,7 +136,7 @@ mz_free_swig(void *p, void *data) { if (SCHEME_NULLP((Scheme_Object*)p) || SCHEME_TYPE((Scheme_Object*)p) != swig_type) return; if (proxy->type) { - if (proxy->type->clientdata) { + if (proxy->type->clientdata && proxy->own) { ((Scheme_Prim *)proxy->type->clientdata)(1, (Scheme_Object **)&proxy); } } @@ -143,42 +144,61 @@ mz_free_swig(void *p, void *data) { static Scheme_Object * SWIG_MzScheme_NewPointerObj(void *ptr, swig_type_info *type, int owner) { - struct swig_mz_proxy *new_proxy; - new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); - new_proxy->mztype = swig_type; - new_proxy->type = type; - new_proxy->object = ptr; - if (owner) { - scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + if (ptr) { + struct swig_mz_proxy *new_proxy; + new_proxy = (struct swig_mz_proxy *) scheme_malloc(sizeof(struct swig_mz_proxy)); + new_proxy->mztype = swig_type; + new_proxy->type = type; + new_proxy->object = ptr; + new_proxy->own = owner & SWIG_POINTER_OWN; + if (new_proxy->own) { + scheme_add_finalizer(new_proxy, mz_free_swig, NULL); + } + return (Scheme_Object *) new_proxy; + } else { + return scheme_make_null(); } - return (Scheme_Object *) new_proxy; } static int SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type, int flags) { swig_cast_info *cast; + int ret = SWIG_ERROR; if (SCHEME_NULLP(s)) { *result = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } else if (SCHEME_TYPE(s) == swig_type) { struct swig_mz_proxy *proxy = (struct swig_mz_proxy *) s; + + if ((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE && !proxy->own) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + if (type) { cast = SWIG_TypeCheckStruct(proxy->type, type); if (cast) { int newmemory = 0; *result = SWIG_TypeCast(cast, proxy->object, &newmemory); assert(!newmemory); /* newmemory handling not yet implemented */ - return 0; + ret = SWIG_OK; } else { - return 1; + return SWIG_ERROR; } } else { *result = proxy->object; - return 0; + ret = SWIG_OK; + } + + if (flags & SWIG_POINTER_DISOWN) { + scheme_subtract_finalizer(proxy, mz_free_swig, NULL); + proxy->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + proxy->object = 0; } } - return 1; + return ret; } static SWIGINLINE void * diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i new file mode 100755 index 00000000..f702b703 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/std_string.i b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_string.i index 761d7fad..73f995e1 100755 --- a/win64/bin/swig/share/swig/4.1.0/mzscheme/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_string.i @@ -52,6 +52,13 @@ namespace std { $result = scheme_make_string($1->c_str()); } + %typemap(throws) string { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } + + %typemap(throws) const string & { + scheme_signal_error("%s: %s", FUNC_NAME, $1.c_str()); + } } diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i new file mode 100755 index 00000000..0d721b23 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type 'TYPE *'"); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i b/win64/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i new file mode 100755 index 00000000..baf5c1c7 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/swigmove.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i b/win64/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i index 6c496b16..f1ddca87 100755 --- a/win64/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i +++ b/win64/bin/swig/share/swig/4.1.0/mzscheme/typemaps.i @@ -2,6 +2,12 @@ * typemaps.i * ----------------------------------------------------------------------------- */ +#define %set_output(obj) $result = obj +#define %set_varoutput(obj) $result = obj +#define %argument_fail(code, type, name, argn) scheme_wrong_type(FUNC_NAME, type, argn, argc, argv) +#define %as_voidptr(ptr) (void*)(ptr) + + /* The MzScheme module handles all types uniformly via typemaps. Here are the definitions. */ @@ -66,9 +72,23 @@ #ifdef __cplusplus -%typemap(in) SWIGTYPE &, SWIGTYPE && { +%typemap(in) SWIGTYPE & { $1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0); - if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)"); + if ($1 == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); +} + +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + scheme_signal_error(FUNC_NAME ": cannot release ownership as memory is not owned for argument $argnum of type '$1_type'"); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (argp == NULL) scheme_signal_error(FUNC_NAME ": swig-type-error (null reference)"); + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); } %typemap(out) SWIGTYPE &, SWIGTYPE && { @@ -105,8 +125,8 @@ $1 = ($1_type) SWIG_convert_int($input); } -%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; -%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);"; +%typemap(out) enum SWIGTYPE "$result = scheme_make_integer_value($1);" +%typemap(varout) enum SWIGTYPE "$result = scheme_make_integer_value($1);" /* Pass-by-value */ @@ -127,7 +147,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1); } #else @@ -143,7 +163,7 @@ #ifdef __cplusplus { $&1_ltype resultptr; - resultptr = new $1_ltype(($1_ltype &) $1); + resultptr = new $1_ltype($1); $result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0); } #else @@ -270,14 +290,18 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double, REF_MAP(double, SCHEME_REALP, scheme_real_to_double, scheme_make_double, real); +%typemap(throws) char * { + scheme_signal_error("%s: %s", FUNC_NAME, $1); +} + /* Void */ -%typemap(out) void "$result = scheme_void;"; +%typemap(out) void "$result = scheme_void;" /* Pass through Scheme_Object * */ -%typemap (in) Scheme_Object * "$1=$input;"; -%typemap (out) Scheme_Object * "$result=$1;"; +%typemap (in) Scheme_Object * "$1=$input;" +%typemap (out) Scheme_Object * "$result=$1;" %typecheck(SWIG_TYPECHECK_POINTER) Scheme_Object * "$1=1;"; @@ -291,7 +315,6 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, // $2 = ($2_ltype) temp; //} - /* ------------------------------------------------------------ * Typechecking rules * ------------------------------------------------------------ */ diff --git a/win64/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg b/win64/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg index 273c724a..bb8c89ae 100755 --- a/win64/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg +++ b/win64/bin/swig/share/swig/4.1.0/ocaml/ocaml.swg @@ -40,9 +40,10 @@ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); } -%typemap(in) SWIGTYPE && { +%typemap(in, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); -} + rvrdeleter.reset($1); +%} %typemap(varin) SWIGTYPE & { $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); @@ -93,10 +94,14 @@ $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; } +%typemap(varout) SWIGTYPE { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)&$1, $&1_descriptor); +} + #ifdef __cplusplus %typemap(out) SWIGTYPE { - $&1_ltype temp = new $ltype((const $1_ltype &) $1); + $&1_ltype temp = new $1_ltype($1); $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)temp, $&1_descriptor); } @@ -110,8 +115,12 @@ #endif +%typemap(varout) SWIGTYPE * { + $result = SWIG_Ocaml_ptr_to_val("create_$ntype_from_ptr", (void *)$1, $1_descriptor); +} + %typemap(directorin) SWIGTYPE { - $<ype temp = new $ltype((const $ltype &)$1); + $<ype temp = new $1_ltype(SWIG_STD_MOVE($1)); swig_result = SWIG_Ocaml_ptr_to_val("create_$ltype_from_ptr", (void *)temp, $&1_descriptor); args = caml_list_append(args, swig_result); } @@ -180,12 +189,12 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Void */ -%typemap(out) void "$result = Val_unit;"; +%typemap(out) void "$result = Val_unit;" /* Pass through value */ -%typemap (in) CAML_VALUE "$1=$input;"; -%typemap (out) CAML_VALUE "$result=$1;"; +%typemap (in) CAML_VALUE "$1=$input;" +%typemap (out) CAML_VALUE "$result=$1;" #if 0 %include @@ -302,7 +311,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } diff --git a/win64/bin/swig/share/swig/4.1.0/ocaml/std_string.i b/win64/bin/swig/share/swig/4.1.0/ocaml/std_string.i index d9e651b9..56423ccd 100755 --- a/win64/bin/swig/share/swig/4.1.0/ocaml/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/ocaml/std_string.i @@ -83,10 +83,22 @@ class wstring; $result = caml_val_string_len($1.c_str(),$1.size()); } +%typemap(varout) string { + $result = caml_val_string_len($1.c_str(),$1.size()); +} + %typemap(out) string * { $result = caml_val_string_len((*$1).c_str(),(*$1).size()); } + +%typemap(varout) string * { + $result = caml_val_string_len((*$1).c_str(),(*$1).size()); +} + %typemap(typecheck) string, const string & = char *; + +%typemap(throws) string, const string & "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());" + } #ifdef ENABLE_CHARPTR_ARRAY diff --git a/win64/bin/swig/share/swig/4.1.0/ocaml/swigmove.i b/win64/bin/swig/share/swig/4.1.0/ocaml/swigmove.i new file mode 100755 index 00000000..11db3298 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/ocaml/swigmove.i @@ -0,0 +1,11 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0) { + argp1 = ($&1_ltype) caml_ptr_val($input,$&1_descriptor); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/octave/argcargv.i b/win64/bin/swig/share/swig/4.1.0/octave/argcargv.i new file mode 100755 index 00000000..6d6ba0fa --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/octave/argcargv.i @@ -0,0 +1,44 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + if ($input.is_scalar_type()) { + $1 = 0; $2 = NULL; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' is not a list", $symname, $argnum); + } + octave_value_list list = $input.list_value(); + int i, len = list.length(); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + %argument_fail(SWIG_TypeError, "'int ARGC, char **ARGV' use a non-string", $symname, $argnum); + } + $2[i] = (char *)list(i).string_value().c_str(); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = 0; + const octave_value& ov = $input; + if (!ov.is_scalar_type()) { + octave_value_list list = ov.list_value(); + int i, len = list.length(); + $1 = 1; + for (i = 0; i < len; i++) { + if (!list(i).is_string()) { + $1 = 0; + break; + } + } + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/win64/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i index d5fbb814..96cadd42 100755 --- a/win64/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/octave/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/win64/bin/swig/share/swig/4.1.0/octave/octheaders.hpp b/win64/bin/swig/share/swig/4.1.0/octave/octheaders.hpp index 24b70f63..a103ebb8 100755 --- a/win64/bin/swig/share/swig/4.1.0/octave/octheaders.hpp +++ b/win64/bin/swig/share/swig/4.1.0/octave/octheaders.hpp @@ -9,8 +9,8 @@ // g++ -c -include octheaders.hpp ... // -#if !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) -#define _SWIG_OCTAVE_OCTHEADERS_HPP +#if !defined(SWIG_OCTAVE_OCTHEADERS_HPP) +#define SWIG_OCTAVE_OCTHEADERS_HPP // Required C++ headers #include @@ -127,4 +127,4 @@ #include #endif -#endif // !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) +#endif // !defined(SWIG_OCTAVE_OCTHEADERS_HPP) diff --git a/win64/bin/swig/share/swig/4.1.0/octave/octrun.swg b/win64/bin/swig/share/swig/4.1.0/octave/octrun.swg index 4c188b4f..aab557cd 100755 --- a/win64/bin/swig/share/swig/4.1.0/octave/octrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/octave/octrun.swg @@ -232,7 +232,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); const swig_type_info *construct_type; // type of special type object std::vector < type_ptr_pair > types; // our c++ base classes - int own; // whether we call c++ destructors when we die + int thisown; // whether we call c++ destructors when we die typedef std::pair < const swig_octave_member *, octave_value > member_value_pair; typedef std::map < std::string, member_value_pair > member_map; @@ -412,7 +412,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0, bool _always_static = false) - : module(0), construct_type(_ptr ? 0 : _type), own(_own), + : module(0), construct_type(_ptr ? 0 : _type), thisown(_own), always_static(_always_static) { if (_type || _ptr) types.push_back(std::make_pair(_type, _ptr)); @@ -426,7 +426,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } ~octave_swig_type() { - if (own) { + if (thisown) { ++count; for (unsigned int j = 0; j < types.size(); ++j) { if (!types[j].first || !types[j].first->clientdata) @@ -559,7 +559,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } void merge(octave_swig_type &rhs) { - rhs.own = 0; + rhs.thisown = 0; for (unsigned int j = 0; j < rhs.types.size(); ++j) { assert(!rhs.types[j].second.destroyed); #ifdef SWIG_DIRECTORS @@ -582,35 +582,56 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); swig_member_const_iterator swig_members_begin() { return members.begin(); } swig_member_const_iterator swig_members_end() { return members.end(); } - int cast(void **vptr, swig_type_info *type, int *_own, int flags) { + int cast(void **vptr, swig_type_info *type, int *own, int flags) { int res = SWIG_ERROR; - if (_own) - *_own = own; - if (flags &SWIG_POINTER_DISOWN) - own = 0; + int clear_pointer = 0; + + if (own) + *own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !thisown) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | thisown; + if (flags & SWIG_POINTER_DISOWN) { + thisown = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + clear_pointer = 1; + } + } + if (!type && types.size()) { - if(vptr) + if (vptr) { *vptr = types[0].second.ptr; + if (clear_pointer) + types[0].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) if (type == types[j].first) { - if(vptr) + if (vptr) { *vptr = types[j].second.ptr; + if (clear_pointer) + types[j].second.ptr = 0; + } return SWIG_OK; } for (unsigned int j = 0; j < types.size(); ++j) { swig_cast_info *tc = SWIG_TypeCheck(types[j].first->name, type); if (!tc) continue; - if(vptr) { + if (vptr) { int newmemory = 0; *vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(_own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (_own) - *_own = *_own | SWIG_CAST_NEW_MEMORY; - } + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + if (clear_pointer) + types[j].second.ptr = 0; } res = SWIG_OK; break; @@ -619,7 +640,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } bool is_owned() const { - return own; + return thisown; } #ifdef SWIG_DIRECTORS @@ -1526,12 +1547,15 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *type, int flags) { int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (ptr) { #ifdef SWIG_DIRECTORS - Swig::Director *d = Swig::get_rtdir(ptr); - if (d && Swig::swig_director_get_self(d)) - return Swig::swig_director_get_self(d)->as_value(); + Swig::Director *d = Swig::get_rtdir(ptr); + if (d && Swig::swig_director_get_self(d)) + return Swig::swig_director_get_self(d)->as_value(); #endif - return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + return Swig::swig_value_ref(new octave_swig_type(ptr, type, own)); + } + return octave_value(Matrix()); // null matrix } SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(octave_value ov, void **ptr, swig_type_info *type, int flags, int *own) { diff --git a/win64/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg b/win64/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg index ed189ac5..2321f378 100755 --- a/win64/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/octave/octtypemaps.swg @@ -32,8 +32,15 @@ #define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj) // raise -#define SWIG_Octave_Raise(OBJ, TYPE, DESC) error("C++ side threw an exception of type " TYPE) -#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc) +%runtime %{ +SWIGINTERN void SWIG_Octave_Raise(const octave_value &obj, const char *type) { + if (obj.is_string()) + error("%s", obj.string_value().c_str()); + else + error("C++ side threw an exception of type %s", type); +} +%} +#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type) // Include the unified typemap library %include diff --git a/win64/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i new file mode 100755 index 00000000..304f1fc9 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/octave/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/octave/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/octave/swigmove.i b/win64/bin/swig/share/swig/4.1.0/octave/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/octave/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/argcargv.i b/win64/bin/swig/share/swig/4.1.0/perl5/argcargv.i new file mode 100755 index 00000000..e558a6c5 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/perl5/argcargv.i @@ -0,0 +1,32 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i; + I32 len; + AV *av = (AV *)SvRV($input); + if (SvTYPE(av) != SVt_PVAV) { + SWIG_croak("in method '$symname', Expecting reference to argv array"); + goto fail; + } + len = av_len(av) + 1; + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + for (i = 0; i < len; i++) { + SV **tv = av_fetch(av, i, 0); + $2[i] = SvPV_nolen(*tv); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + AV *av = (AV *)SvRV($input); + $1 = SvTYPE(av) == SVt_PVAV; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/perlhead.swg b/win64/bin/swig/share/swig/4.1.0/perl5/perlhead.swg index 642b3b54..ee355265 100755 --- a/win64/bin/swig/share/swig/4.1.0/perl5/perlhead.swg +++ b/win64/bin/swig/share/swig/4.1.0/perl5/perlhead.swg @@ -4,10 +4,21 @@ #include extern "C" { #endif + +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wvolatile" +#endif +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" +#if __GNUC__ >= 10 +#pragma GCC diagnostic pop +#endif + /* PERL_REVISION was added in Perl 5.6. */ #if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8) # error SWIG requires Perl >= 5.8.0 diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/perlrun.swg b/win64/bin/swig/share/swig/4.1.0/perl5/perlrun.swg index 712ff718..2c8c4466 100755 --- a/win64/bin/swig/share/swig/4.1.0/perl5/perlrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/perl5/perlrun.swg @@ -210,6 +210,7 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ swig_cast_info *tc; void *voidptr = (void *)0; SV *tsv = 0; + int check_owned_pointer_release = (flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE; if (own) *own = 0; @@ -286,13 +287,14 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ /* * DISOWN implementation: we need a perl guru to check this one. */ - if (tsv && (flags & SWIG_POINTER_DISOWN)) { + if (tsv && ((flags & SWIG_POINTER_DISOWN) || check_owned_pointer_release)) { /* * almost copy paste code from below SWIG_POINTER_OWN setting */ SV *obj = sv; HV *stash = SvSTASH(SvRV(obj)); GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE); + int owned = 0; if (isGV(gv)) { HV *hv = GvHVn(gv); /* @@ -300,10 +302,21 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_ * Hence, to remove ownership, we delete the entry. */ if (hv_exists_ent(hv, obj, 0)) { - hv_delete_ent(hv, obj, 0, 0); + owned = 1; + if (flags & SWIG_POINTER_DISOWN) { + hv_delete_ent(hv, obj, 0, 0); + } } } + if (check_owned_pointer_release && !owned) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } } + + if (tsv && (flags & SWIG_POINTER_CLEAR)) { + SvIV_set(tsv, 0); + } + return SWIG_OK; } diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i new file mode 100755 index 00000000..304f1fc9 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/perl5/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/perl5/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/perl5/swigmove.i b/win64/bin/swig/share/swig/4.1.0/perl5/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/perl5/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/php/argcargv.i b/win64/bin/swig/share/swig/4.1.0/php/argcargv.i new file mode 100755 index 00000000..95f87b85 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/php/argcargv.i @@ -0,0 +1,40 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int len, i; + zval *val; + zend_array *ar; + if (Z_TYPE($input) != IS_ARRAY) { + SWIG_PHP_Error(E_ERROR, "Type error in '$symname'. Expected array"); + goto fail; + } + ar = Z_ARR($input); + len = zend_array_count(ar); + $1 = ($1_ltype) len; + $2 = (char **) malloc((len+1)*sizeof(char *)); + i = 0; + ZEND_HASH_FOREACH_VAL(ar, val) { + if (Z_TYPE(*val) != IS_STRING) { + SWIG_PHP_Error(E_ERROR, "Array must use strings only, in '$symname'."); + goto fail; + } + if (i == len) { + SWIG_PHP_Error(E_ERROR, "Array is bigger than zend report in '$symname'."); + goto fail; + } + $2[i++] = Z_STRVAL(*val); + } ZEND_HASH_FOREACH_END(); + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + $1 = Z_TYPE($input) == IS_ARRAY; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/win64/bin/swig/share/swig/4.1.0/php/const.i b/win64/bin/swig/share/swig/4.1.0/php/const.i index b67375c1..99e59c9d 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/const.i +++ b/win64/bin/swig/share/swig/4.1.0/php/const.i @@ -12,11 +12,11 @@ unsigned char, signed char, enum SWIGTYPE %{ - zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_long(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) bool %{ - zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)$value); + zend_declare_class_constant_bool(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, ($1_type)($value)); %} %typemap(classconsttab) float, @@ -48,13 +48,13 @@ { zval z; ZVAL_UNDEF(&z); - SWIG_SetPointerZval(&z, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&z, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&z); zend_declare_class_constant(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &z); } %} -%typemap(classconsttab) SWIGTYPE (CLASS::*) ""; +%typemap(classconsttab) SWIGTYPE (CLASS::*) "" %typemap(consttab) int, unsigned int, @@ -65,10 +65,10 @@ unsigned char, signed char, enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; + "SWIG_LONG_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) bool - "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);"; + "SWIG_BOOL_CONSTANT($symname, ($1_type)($value));"; %typemap(consttab) float, double @@ -92,7 +92,7 @@ SWIGTYPE [] { zend_constant c; ZVAL_UNDEF(&c.value); - SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); + SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&c.value); c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); @@ -100,4 +100,4 @@ } /* Handled as a global variable. */ -%typemap(consttab) SWIGTYPE (CLASS::*) ""; +%typemap(consttab) SWIGTYPE (CLASS::*) "" diff --git a/win64/bin/swig/share/swig/4.1.0/php/php.swg b/win64/bin/swig/share/swig/4.1.0/php/php.swg index 82dabcf1..4abb3e93 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/php.swg +++ b/win64/bin/swig/share/swig/4.1.0/php/php.swg @@ -125,14 +125,31 @@ swig_acquire_ownership_obj((void*)$result, own); %} -%typemap(in, phptype="SWIGTYPE") SWIGTYPE &, - SWIGTYPE && +%typemap(in, phptype="SWIGTYPE") SWIGTYPE & %{ if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); return; } %} +%typemap(in, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) %{ + res = SWIG_ConvertPtr(&$input, &argp, $descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $1_descriptor of $symname"); + return; + } + $1 = ($1_ltype)argp; + rvrdeleter.reset($1); +%} %typemap(directorout) SWIGTYPE & ($1_ltype tmp), SWIGTYPE && ($1_ltype tmp) @@ -240,9 +257,7 @@ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)$1)); } %} %typemap(out, phptype="int|string") unsigned long long @@ -250,9 +265,7 @@ if ($1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)($1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)$1); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)$1)); } %} @@ -286,9 +299,7 @@ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)(*$1))); } %} %typemap(out, phptype="int|string") const unsigned long long & @@ -296,9 +307,7 @@ if (*$1 <= (unsigned long long)LONG_MAX) { RETVAL_LONG((long)(*$1)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*$1)); - RETVAL_STRING(temp); + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)(*$1))); } %} @@ -451,7 +460,7 @@ %typemap(out, phptype="SWIGTYPE") SWIGTYPE { #ifdef __cplusplus - $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1); + $&1_ltype resultobj = new $1_ltype($1); #else $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type)); memcpy(resultobj, &$1, sizeof($1_type)); @@ -462,10 +471,10 @@ %typemap(directorin) SWIGTYPE %{ ZVAL_UNDEF($input); - SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1); + SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1); %} -%typemap(out, phptype="void") void ""; +%typemap(out, phptype="void") void "" %typemap(out, phptype="string") char [ANY] { diff --git a/win64/bin/swig/share/swig/4.1.0/php/phpinit.swg b/win64/bin/swig/share/swig/4.1.0/php/phpinit.swg index 825f8264..41d84238 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/phpinit.swg +++ b/win64/bin/swig/share/swig/4.1.0/php/phpinit.swg @@ -9,4 +9,8 @@ SWIG_php_minit { zend_class_entry SWIGUNUSED internal_ce; SWIG_InitializeModule((void*)&module_number); +#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0 + /* This hack is needed to avoid segfaults. */ + EG(class_table) = CG(class_table); +#endif %} diff --git a/win64/bin/swig/share/swig/4.1.0/php/phprun.swg b/win64/bin/swig/share/swig/4.1.0/php/phprun.swg index 6d503c31..108f0ba0 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/phprun.swg +++ b/win64/bin/swig/share/swig/4.1.0/php/phprun.swg @@ -10,8 +10,6 @@ extern "C" { #endif -#include "php.h" - #if PHP_MAJOR_VERSION < 7 # error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 #endif @@ -195,7 +193,7 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o /* They don't care about the target type, so just pass on the pointer! */ *ptr = value->ptr; } else { - swig_cast_info *tc = SWIG_TypeCheckStruct(value->type, ty); + swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty); if (tc) { int newmemory = 0; *ptr = SWIG_TypeCast(tc, value->ptr, &newmemory); @@ -208,10 +206,20 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o *ptr = NULL; } } - if (*ptr == NULL) return SWIG_ERROR; - if (flags & SWIG_POINTER_DISOWN) { - value->newobject = 0; + + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !value->newobject) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (*ptr == NULL) + return SWIG_ERROR; /* should be SWIG_NullReferenceError?? */ + if (flags & SWIG_POINTER_DISOWN) { + value->newobject = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + value->ptr = 0; + } } + return SWIG_OK; } case IS_NULL: diff --git a/win64/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i new file mode 100755 index 00000000..c4d20245 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/php/std_auto_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/php/std_string.i b/win64/bin/swig/share/swig/4.1.0/php/std_string.i index e3e7f7a6..7d812e23 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/php/std_string.i @@ -86,5 +86,5 @@ namespace std { /* SWIG will apply the non-const typemap above to const string& without * this more specific typemap. */ - %typemap(argout) const string & ""; + %typemap(argout) const string & "" } diff --git a/win64/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i new file mode 100755 index 00000000..8e511301 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/php/std_unique_ptr.i @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $descriptor(TYPE *) of $symname"); + return; + } else { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + return; + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/php/swigmove.i b/win64/bin/swig/share/swig/4.1.0/php/swigmove.i new file mode 100755 index 00000000..44e592fc --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/php/swigmove.i @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr(&$input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + zend_type_error("Cannot release ownership as memory is not owned for argument $argnum of $&1_descriptor of $symname"); + return; + } else { + zend_type_error("Expected $&1_descriptor for argument $argnum of $symname"); + return; + } + } + if (!argp) { + zend_type_error("Invalid null reference for argument $argnum of $&1_descriptor of $symname"); + return; + } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/php/typemaps.i b/win64/bin/swig/share/swig/4.1.0/php/typemaps.i index 5e1314a2..b281cd0b 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/typemaps.i +++ b/win64/bin/swig/share/swig/4.1.0/php/typemaps.i @@ -31,8 +31,8 @@ temp = (Z_TYPE($input) == IS_TRUE); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -57,8 +57,8 @@ temp = (TYPE) zval_get_double(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -82,8 +82,8 @@ temp = (TYPE) zval_get_long(&$input); $1 = &temp; %} -%typemap(argout) TYPE *INPUT, TYPE &INPUT ""; -%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { zval o; @@ -122,9 +122,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&o, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%lld", (long long)temp$argnum)); } t_output_helper($result, &o); } @@ -138,9 +136,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= lvalue$argnum && lvalue$argnum <= (long long)LONG_MAX) { ZVAL_LONG(&$arg, (long)temp$argnum); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)lvalue$argnum); - ZVAL_STRING(&$arg, temp); + ZVAL_NEW_STR(&$arg, zend_strpprintf(0, "%lld", (long long)lvalue$argnum)); } %} %typemap(argout) long long &OUTPUT @@ -148,9 +144,7 @@ INT_TYPEMAP(long long); if ((long long)LONG_MIN <= *arg$argnum && *arg$argnum <= (long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%lld", (long long)(*arg$argnum))); } %} @@ -161,9 +155,7 @@ INT_TYPEMAP(unsigned long long); if (temp$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG(&o, temp$argnum); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)temp$argnum); - ZVAL_STRING(&o, temp); + ZVAL_NEW_STR(&o, zend_strpprintf(0, "%llu", (unsigned long long)temp$argnum)); } t_output_helper($result, &o); } @@ -177,9 +169,7 @@ INT_TYPEMAP(unsigned long long); if (lvalue$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($arg, (long)(lvalue$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)lvalue$argnum); - ZVAL_STRING((*$arg), temp); + ZVAL_NEW_STR((*$arg), zend_strpprintf(0, "%llu", (unsigned long long)lvalue$argnum)); } %} %typemap(argout) unsigned long long &OUTPUT @@ -187,9 +177,7 @@ INT_TYPEMAP(unsigned long long); if (*arg$argnum <= (unsigned long long)LONG_MAX) { ZVAL_LONG($result, (long)(*arg$argnum)); } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*arg$argnum)); - ZVAL_STRING($result, temp); + ZVAL_NEW_STR($result, zend_strpprintf(0, "%llu", (unsigned long long)(*arg$argnum))); } %} diff --git a/win64/bin/swig/share/swig/4.1.0/php/utils.i b/win64/bin/swig/share/swig/4.1.0/php/utils.i index c6e63359..f3f66462 100755 --- a/win64/bin/swig/share/swig/4.1.0/php/utils.i +++ b/win64/bin/swig/share/swig/4.1.0/php/utils.i @@ -81,7 +81,7 @@ %{ $*1_ltype swig_val; CONVERT_IN(swig_val, $*1_ltype, *$input); - $1_ltype temp = new $*1_ltype(($*1_ltype)swig_val); + $1_ltype temp = new $*1_ltype(swig_val); swig_acquire_ownership(temp); $result = temp; %} diff --git a/win64/bin/swig/share/swig/4.1.0/pointer.i b/win64/bin/swig/share/swig/4.1.0/pointer.i index ccd3bc43..85e0f06a 100755 --- a/win64/bin/swig/share/swig/4.1.0/pointer.i +++ b/win64/bin/swig/share/swig/4.1.0/pointer.i @@ -4,7 +4,7 @@ %echo "pointer.i is deprecated. Use cpointer.i instead." -%echo "See http://www.swig.org/Doc3.0/Library.html" +%echo "See https://www.swig.org/Doc3.0/Library.html" diff --git a/win64/bin/swig/share/swig/4.1.0/python/README b/win64/bin/swig/share/swig/4.1.0/python/README index 0d556f1d..28605a16 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/README +++ b/win64/bin/swig/share/swig/4.1.0/python/README @@ -101,4 +101,3 @@ std_container.i general common code for the STD/STL containers std_vectora.i vector + allocator (allocators are now supported in STD/STL) typemaps.i old in/out typemaps (doesn't need to be included) -defarg.swg for processing default arguments with shadow classes diff --git a/win64/bin/swig/share/swig/4.1.0/python/argcargv.i b/win64/bin/swig/share/swig/4.1.0/python/argcargv.i index c6ffc948..c0c65f0a 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/argcargv.i +++ b/win64/bin/swig/share/swig/4.1.0/python/argcargv.i @@ -1,13 +1,10 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- + * SWIG library containing argc and argv multi-argument typemaps * ------------------------------------------------------------ */ %fragment("SWIG_AsArgcArgv","header",fragment="SWIG_AsCharPtrAndSize") { SWIGINTERN int -SWIG_AsArgcArgv(PyObject *input, - swig_type_info *ppchar_info, - size_t *argc, char ***argv, int *owner) -{ +SWIG_AsArgcArgv(PyObject *input, swig_type_info *ppchar_info, size_t *argc, char ***argv, int *owner) { void *vptr; int res = SWIG_ConvertPtr(input, &vptr, ppchar_info, 0); if (!SWIG_IsOK(res)) { @@ -51,7 +48,7 @@ SWIG_AsArgcArgv(PyObject *input, } else { /* seems dangerous, but the user asked for it... */ size_t i = 0; - if (argv) { while (*argv[i] != 0) ++i;} + if (argv) { while (*argv[i] != 0) ++i;} if (argc) *argc = i; if (owner) *owner = 0; return SWIG_OK; @@ -66,10 +63,10 @@ SWIG_AsArgcArgv(PyObject *input, %typemap(in,noblock=0,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV) (int res,char **argv = 0, size_t argc = 0, int owner= 0) { res = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &argv, &owner); - if (!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { $1 = 0; $2 = 0; %argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum); - } else { + } else { $1 = %static_cast(argc,$1_ltype); $2 = %static_cast(argv, $2_ltype); } diff --git a/win64/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i index 55ec36bc..2cfaf3ec 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/python/boost_shared_ptr.i @@ -39,7 +39,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -58,12 +58,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/win64/bin/swig/share/swig/4.1.0/python/builtin.swg b/win64/bin/swig/share/swig/4.1.0/python/builtin.swg index 27931dc1..237417dd 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/builtin.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/builtin.swg @@ -6,7 +6,11 @@ SWIGINTERN Py_hash_t SwigPyObject_hash(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; void *ptr = sobj->ptr; +#if PY_VERSION_HEX < 0x03020000 + return (Py_hash_t)(Py_ssize_t)ptr; +#else return (Py_hash_t)ptr; +#endif } SWIGINTERN Py_hash_t @@ -211,7 +215,11 @@ SwigPyStaticVar_Type(void) { sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -295,7 +303,11 @@ SwigPyObjectType(void) { PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /* tp_print */ +#else + (Py_ssize_t)0, /* tp_vectorcall_offset */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -414,7 +426,7 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { SWIGINTERN void SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) { -#if PY_VERSION_HEX >= 0x030900A4 +#if PY_VERSION_HEX >= 0x030900a4 Py_SET_TYPE(type, metatype); #else Py_TYPE(type) = metatype; diff --git a/win64/bin/swig/share/swig/4.1.0/python/defarg.swg b/win64/bin/swig/share/swig/4.1.0/python/defarg.swg deleted file mode 100755 index bdc41cf1..00000000 --- a/win64/bin/swig/share/swig/4.1.0/python/defarg.swg +++ /dev/null @@ -1,37 +0,0 @@ -/* This file defines an internal function for processing default arguments - with proxy classes. - - There seems to be no straightforward way to write proxy functions - involving default arguments. For example : - - def foo(arg1,arg2,*args): - proxyc.foo(arg1,arg2,args) - - This fails because args is now a tuple and SWIG doesn't know what to - do with it. - - This file allows a different approach : - - def foo(arg1,arg2,*args): - proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args) - - Basically, we form a new tuple from the object, call this special - __call_defarg method and it passes control to the real wrapper function. - An ugly hack, but it works. -*/ - -SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) { - PyObject *func; - PyObject *parms; - - if (!PyArg_ParseTuple(args, "OO", &func, &parms)) - return NULL; - - if (!PyCallable_Check(func)) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - return PyObject_Call(func, parms, NULL); -} diff --git a/win64/bin/swig/share/swig/4.1.0/python/embed.i b/win64/bin/swig/share/swig/4.1.0/python/embed.i index 664276c9..242e55af 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/embed.i +++ b/win64/bin/swig/share/swig/4.1.0/python/embed.i @@ -29,9 +29,23 @@ As far as I know, this module is C++ safe. #endif %wrapper %{ +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif +#endif #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + #ifdef __cplusplus extern "C" #endif diff --git a/win64/bin/swig/share/swig/4.1.0/python/pyclasses.swg b/win64/bin/swig/share/swig/4.1.0/python/pyclasses.swg index 25384794..a59a13de 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pyclasses.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pyclasses.swg @@ -43,7 +43,7 @@ namespace swig { %apply PyObject * {SwigPtr_PyObject}; %apply PyObject * const& {SwigPtr_PyObject const&}; - %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);"; + %typemap(typecheck,precedence=SWIG_TYPECHECK_SWIGOBJECT,noblock=1) SwigPtr_PyObject const& "$1 = ($input != 0);" /* For output */ diff --git a/win64/bin/swig/share/swig/4.1.0/python/pycontainer.swg b/win64/bin/swig/share/swig/4.1.0/python/pycontainer.swg index 94b16db4..b2cac287 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pycontainer.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pycontainer.swg @@ -15,9 +15,9 @@ #include #if PY_VERSION_HEX >= 0x03020000 -# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj)) +# define SWIGPY_SLICEOBJECT PyObject #else -# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj)) +# define SWIGPY_SLICEOBJECT PySliceObject #endif %} @@ -781,7 +781,7 @@ namespace swig #if 1 %newobject __getslice__; #endif - %newobject __getitem__(PySliceObject *slice); + %newobject __getitem__(SWIGPY_SLICEOBJECT *slice); #if defined(SWIGPYTHON_BUILTIN) %feature("python:slot", "nb_nonzero", functype="inquiry") __nonzero__; @@ -829,13 +829,13 @@ namespace swig %extend { /* typemap for slice object support */ - %typemap(in) PySliceObject* { + %typemap(in) SWIGPY_SLICEOBJECT* { if (!PySlice_Check($input)) { %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); } - $1 = (PySliceObject *) $input; + $1 = (SWIGPY_SLICEOBJECT *) $input; } - %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* { + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) SWIGPY_SLICEOBJECT* { $1 = PySlice_Check($input); } @@ -865,49 +865,49 @@ namespace swig /* Overloaded methods for Python 3 compatibility * (Also useful in Python 2.x) */ - Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + Sequence* __getitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return NULL; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; return swig::getslice(self, id, jd, step); } - void __setitem__(PySliceObject *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::setslice(self, id, jd, step, v); } - void __setitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __setitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); } - void __delitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) { + void __delitem__(SWIGPY_SLICEOBJECT *slice) throw (std::out_of_range, std::invalid_argument) { Py_ssize_t i, j, step; if( !PySlice_Check(slice) ) { SWIG_Error(SWIG_TypeError, "Slice object expected."); return; } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); + PySlice_GetIndices(slice, (Py_ssize_t)self->size(), &i, &j, &step); Sequence::difference_type id = i; Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); diff --git a/win64/bin/swig/share/swig/4.1.0/python/pydocs.swg b/win64/bin/swig/share/swig/4.1.0/python/pydocs.swg index b66c56b0..0c9197ba 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pydocs.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pydocs.swg @@ -2,43 +2,43 @@ // Documentation for use with the autodoc feature. #ifdef SWIG_DOC_DOXYGEN_STYLE -%typemap(doc) SWIGTYPE "@param $1_name $1_type"; -%typemap(doc) SWIGTYPE * "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE & "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"; -%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"; +%typemap(doc) SWIGTYPE "@param $1_name $1_type" +%typemap(doc) SWIGTYPE * "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE & "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE && "@param $1_name $1_type" +%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)" #else -%typemap(doc) SWIGTYPE "$1_name: $1_type"; -%typemap(doc) SWIGTYPE * "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE & "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE && "$1_name: $1_type"; -%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"; +%typemap(doc) SWIGTYPE "$1_name: $1_type" +%typemap(doc) SWIGTYPE * "$1_name: $1_type" +%typemap(doc) const SWIGTYPE & "$1_name: $1_type" +%typemap(doc) const SWIGTYPE && "$1_name: $1_type" +%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type" -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)"; +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)" #endif // Types to use in Python documentation for the parameters of the given C++ type. -%typemap(doctype) bool "boolean"; +%typemap(doctype) bool "boolean" %define int_doctype_for_cppint_type(cppint_type) - %typemap(doctype) cppint_type, unsigned cppint_type "int"; + %typemap(doctype) cppint_type, unsigned cppint_type "int" %enddef %formacro(int_doctype_for_cppint_type, short, int, long, long long) -%typemap(doctype) size_t "int"; +%typemap(doctype) size_t "int" -%typemap(doctype) enum SWIGTYPE "int"; +%typemap(doctype) enum SWIGTYPE "int" -%typemap(doctype) float, double, long double "float"; +%typemap(doctype) float, double, long double "float" -%typemap(doctype) char*, std::string "string"; +%typemap(doctype) char*, std::string "string" %typemap(doctype) SWIGTYPE "$1_basetype" %typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)" diff --git a/win64/bin/swig/share/swig/4.1.0/python/pyerrors.swg b/win64/bin/swig/share/swig/4.1.0/python/pyerrors.swg index 2fb2feaf..793bc228 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pyerrors.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pyerrors.swg @@ -64,7 +64,6 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyErr_Format(type, "%s %s", tmp, mesg); else PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); Py_DECREF(value); } else { diff --git a/win64/bin/swig/share/swig/4.1.0/python/pyhead.swg b/win64/bin/swig/share/swig/4.1.0/python/pyhead.swg index d1c220b7..3886365a 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pyhead.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pyhead.swg @@ -30,38 +30,19 @@ #endif -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ SWIGINTERN char* SWIG_Python_str_AsChar(PyObject *str) { #if PY_VERSION_HEX >= 0x03030000 return (char *)PyUnicode_AsUTF8(str); -#elif PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) { - newstr = (char *) malloc(len+1); - if (newstr) - memcpy(newstr, cstr, len+1); - } - Py_XDECREF(str); - } - return newstr; #else return PyString_AsString(str); #endif } -#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000 -# define SWIG_Python_str_DelForPy3(x) -#else -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#endif +/* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility + * with any uses in user interface files. */ +#define SWIG_Python_str_DelForPy3(x) SWIGINTERN PyObject* diff --git a/win64/bin/swig/share/swig/4.1.0/python/pyrun.swg b/win64/bin/swig/share/swig/4.1.0/python/pyrun.swg index 3bd0845c..a3839cec 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pyrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pyrun.swg @@ -11,8 +11,8 @@ # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 -# error "This version of SWIG only supports Python 3 >= 3.2" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 +# error "This version of SWIG only supports Python 3 >= 3.3" #endif /* Common SWIG API */ @@ -240,7 +240,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -249,7 +249,8 @@ swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(swig_varlinkobject *v) { +swig_varlink_str(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); PyObject *tail; @@ -287,7 +288,8 @@ swig_varlink_str(swig_varlinkobject *v) { } SWIGINTERN void -swig_varlink_dealloc(swig_varlinkobject *v) { +swig_varlink_dealloc(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { swig_globalvar *n = var->next; @@ -298,7 +300,8 @@ swig_varlink_dealloc(swig_varlinkobject *v) { } SWIGINTERN PyObject * -swig_varlink_getattr(swig_varlinkobject *v, char *n) { +swig_varlink_getattr(PyObject *o, char *n) { + swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; while (var) { @@ -315,7 +318,8 @@ swig_varlink_getattr(swig_varlinkobject *v, char *n) { } SWIGINTERN int -swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { +swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { + swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; while (var) { @@ -348,7 +352,11 @@ swig_varlink_type(void) { sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc) swig_varlink_getattr, /* tp_getattr */ (setattrfunc) swig_varlink_setattr, /* tp_setattr */ 0, /* tp_compare */ @@ -788,6 +796,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } + ((SwigPyObject *)next)->next = sobj->next; sobj->next = next; Py_INCREF(next); return SWIG_Py_Void(); @@ -914,7 +923,11 @@ SwigPyObject_TypeOnce(void) { sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 @@ -1090,7 +1103,11 @@ SwigPyPacked_TypeOnce(void) { sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - 0, /* tp_print */ +#if PY_VERSION_HEX < 0x030800b4 + (printfunc)0, /*tp_print*/ +#else + (Py_ssize_t)0, /*tp_vectorcall_offset*/ +#endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX>=0x03000000 @@ -1345,12 +1362,19 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !sobj->own) { + res = SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + if (flags & SWIG_POINTER_CLEAR) { + sobj->ptr = 0; + } + res = SWIG_OK; } - res = SWIG_OK; } else { if (implicit_conv) { SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; @@ -1495,7 +1519,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) Py_DECREF(inst); inst = 0; } else { - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + PyType_Modified(Py_TYPE(inst)); } } } @@ -1636,28 +1660,33 @@ SWIG_Python_TypeCache(void) { SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { +#ifdef SWIG_LINK_RUNTIME static void *type_pointer = (void *)0; /* first check if module already created */ if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif } +#else + void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif return (swig_module_info *) type_pointer; } + +static int interpreter_counter = 0; // how many (sub-)interpreters are using swig_module's types + SWIGRUNTIME void SWIG_Python_DestroyModule(PyObject *obj) { swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); swig_type_info **types = swig_module->types; size_t i; + if (--interpreter_counter != 0) // another sub-interpreter may still be using the swig_module's types + return; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -1687,6 +1716,7 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + ++interpreter_counter; Swig_Capsule_global = pointer; } else { Py_DECREF(pointer); @@ -1746,7 +1776,6 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) } else { PyErr_Format(type, "%s %s", errmesg, mesg); } - SWIG_Python_str_DelForPy3(tmp); Py_DECREF(old_str); } return 1; @@ -1798,7 +1827,6 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); } else { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype); @@ -1820,12 +1848,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg void *result; if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif } return result; } diff --git a/win64/bin/swig/share/swig/4.1.0/python/pyruntime.swg b/win64/bin/swig/share/swig/4.1.0/python/pyruntime.swg index 71663aef..1a6b72c5 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pyruntime.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pyruntime.swg @@ -4,21 +4,36 @@ # include #endif -#if defined(_MSC_VER) && _MSC_VER >= 1930 -/* Workaround what seems to be a bug in the Python headers with MSVC 2022. - * https://github.com/swig/swig/issues/2090 - */ -# include +#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) +#define PY_SSIZE_T_CLEAN +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) && __cplusplus >=201703L +#pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ +#endif #endif #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) /* Use debug wrappers with the Python release dll */ + +#if defined(_MSC_VER) && _MSC_VER >= 1929 +/* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later + * See https://github.com/swig/swig/issues/2090 */ +# include +#endif + # undef _DEBUG # include # define _DEBUG 1 #else # include #endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif %} %insert(runtime) "swigrun.swg"; /* SWIG API */ diff --git a/win64/bin/swig/share/swig/4.1.0/python/pytypemaps.swg b/win64/bin/swig/share/swig/4.1.0/python/pytypemaps.swg index f0f55d16..9c35a41e 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/pytypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/python/pytypemaps.swg @@ -83,7 +83,7 @@ { SWIG_PY_POINTER, "$symname", 0, 0, (void *)($value), &$descriptor } %typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); -%typemap(constcode) SWIGTYPE ((*)(ANY)) ""; +%typemap(constcode) SWIGTYPE ((*)(ANY)) "" %typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); diff --git a/win64/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i index f52f8a15..304f1fc9 100755 --- a/win64/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/python/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; -} + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/python/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/python/swigmove.i b/win64/bin/swig/share/swig/4.1.0/python/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/python/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i index d5fbb814..8942403a 100755 --- a/win64/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/r/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { @@ -394,6 +394,25 @@ #error "typemaps for $1_type not available" %} +%typemap(rtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& + "$typemap(rtype, TYPE)" + +%typemap(scoercein) 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 > *& + %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} + +%typemap(scoerceout) 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 > *& + %{ $result <- if (is.null($result)) $result + else new("$typemap(rtype, TYPE)", ref=$result); %} + %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; diff --git a/win64/bin/swig/share/swig/4.1.0/r/r.swg b/win64/bin/swig/share/swig/4.1.0/r/r.swg index bfc0d994..c555a7de 100755 --- a/win64/bin/swig/share/swig/4.1.0/r/r.swg +++ b/win64/bin/swig/share/swig/4.1.0/r/r.swg @@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) { assign(name, _obj); %end_block %enddef -%define %raise(obj,type,desc) -return R_NilValue; -%enddef +%runtime %{ +SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) { + Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); +} +%} + +#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue %insert("sinit") "srun.swg" @@ -53,7 +57,7 @@ SWIG_InitializeModule(0); assert(all(sapply($input, class) == "$R_class")); %} -%typemap(out) void ""; +%typemap(out) void "" %typemap(in) int *, int[ANY], signed int *, signed int[ANY], diff --git a/win64/bin/swig/share/swig/4.1.0/r/rtype.swg b/win64/bin/swig/share/swig/4.1.0/r/rtype.swg index 05a21530..021ce043 100755 --- a/win64/bin/swig/share/swig/4.1.0/r/rtype.swg +++ b/win64/bin/swig/share/swig/4.1.0/r/rtype.swg @@ -3,26 +3,27 @@ for use in class representations. */ -%typemap("rtype") int, int *, int & "integer"; -%typemap("rtype") long, long *, long & "integer"; -%typemap("rtype") float, float*, float & "numeric"; -%typemap("rtype") double, double*, double & "numeric"; -%typemap("rtype") char *, char ** "character"; -%typemap("rtype") char "character"; -%typemap("rtype") string, string *, string & "character"; -%typemap("rtype") std::string, std::string *, std::string & "character"; -%typemap("rtype") bool, bool * "logical"; -%typemap("rtype") enum SWIGTYPE "character"; -%typemap("rtype") enum SWIGTYPE * "character"; -%typemap("rtype") enum SWIGTYPE *const "character"; -%typemap("rtype") enum SWIGTYPE & "character"; -%typemap("rtype") const 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("rtype") int, int *, int & "integer" +%typemap("rtype") long, long *, long & "integer" +%typemap("rtype") float, float*, float & "numeric" +%typemap("rtype") double, double*, double & "numeric" +%typemap("rtype") char *, char ** "character" +%typemap("rtype") char "character" +%typemap("rtype") string, string *, string & "character" +%typemap("rtype") std::string, std::string *, std::string & "character" +%typemap("rtype") bool, bool * "logical" +%typemap("rtype") enum SWIGTYPE "character" +%typemap("rtype") enum SWIGTYPE * "character" +%typemap("rtype") enum SWIGTYPE *const& "character" +%typemap("rtype") enum SWIGTYPE & "character" +%typemap("rtype") const enum SWIGTYPE & "character" +%typemap("rtype") enum SWIGTYPE && "character" +%typemap("rtype") SWIGTYPE * "$R_class" +%typemap("rtype") SWIGTYPE *const "$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 & %{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %} @@ -93,7 +94,7 @@ %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} -%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE && +%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE && %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} /* @@ -172,6 +173,10 @@ string &, std::string & %{ $result <- if (is.null($result)) $result else new("$R_class", ref=$result); %} +%typemap(scoerceout) SWIGTYPE *const& + %{ $result <- if (is.null($result)) $result + else new("$*R_class", ref=$result); %} + /* Override the SWIGTYPE * above. */ %typemap(scoerceout) char, diff --git a/win64/bin/swig/share/swig/4.1.0/r/std_vector.i b/win64/bin/swig/share/swig/4.1.0/r/std_vector.i index 053a58e3..8c11af18 100755 --- a/win64/bin/swig/share/swig/4.1.0/r/std_vector.i +++ b/win64/bin/swig/share/swig/4.1.0/r/std_vector.i @@ -660,6 +660,27 @@ } }; + template <> + struct traits_from_ptr > > > { + static SEXP from (std::vector< std::vector > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(STRSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + CHARACTER_POINTER(VECTOR_ELT(result, pos))[vpos] = Rf_mkChar(val->at(pos).at(vpos).c_str()); + } + } + UNPROTECT(1); + return(result); + } + }; + template struct traits_from_ptr< std::vector < std::vector< T > > > { static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { @@ -841,7 +862,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.numeric($arg) %} %typemap("rtype") std::vector "numeric" -%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);"; +%typemap("scoercein") std::vector, std::vector *, std::vector & "$input = as.numeric($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector) %traits_type_name(std::vector) @@ -857,7 +878,7 @@ %typemap("rtypecheck") std::vector, std::vector *, std::vector & %{ is.logical($arg) %} %typemap("rtype") std::vector "logical" -%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);"; +%typemap("scoercein") std::vector , std::vector & "$input = as.logical($input);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -866,7 +887,7 @@ %{ is.integer($arg) || is.numeric($arg) %} %typemap("rtype") std::vector "integer" -%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);"; +%typemap("scoercein") std::vector , std::vector *, std::vector & "$input = as.integer($input);" // strings %typemap("rtype") std::vector< std::basic_string >, @@ -887,8 +908,6 @@ std::vector< std::basic_string > *, std::vector< std::basic_string > & %{ %} -%apply std::vector< std::basic_string > { std::vector< std::string> }; - // all the related integer vectors // signed %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -974,21 +993,21 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.integer);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.numeric);" %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector >); %traits_type_name(std::vector< std::vector >); @@ -1003,7 +1022,14 @@ std::vector< std::basic_string > *, %typemap("rtypecheck") std::vector >, std::vector > *, std::vector > & %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} %typemap("rtype") std::vector >, std::vector > *, std::vector > & "list" -%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);"; +%typemap("scoercein") std::vector< std::vector >, std::vector > *, std::vector > & "$input = lapply($input, as.logical);" + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector > >); +%traits_type_name(std::vector< std::vector > >); +%typemap("rtypecheck") std::vector > >, std::vector > > *, std::vector > > & + %{ is.list($arg) && all(sapply($arg , is.character)) %} +%typemap("rtype") std::vector > >, std::vector > > *, std::vector > > & "list" +%typemap("scoercein") std::vector< std::vector > >, std::vector > > *, std::vector > > & "$input = lapply($input, as.character);" // we don't want these to be given R classes as they // have already been turned into R vectors. @@ -1049,7 +1075,10 @@ std::vector< std::basic_string > *, std::vector< std::vector >&, std::vector< std::vector >, std::vector< std::vector >*, - std::vector< std::vector >& + std::vector< std::vector >&, + std::vector< std::vector > >, + std::vector< std::vector > >*, + std::vector< std::vector > >& %{ %} #if defined(SWIGWORDSIZE64) @@ -1071,3 +1100,6 @@ std::vector< std::basic_string > *, %{ %} #endif + +%apply std::vector< std::basic_string > { std::vector }; +%apply std::vector< std::vector< std::basic_string > > { std::vector< std::vector > }; diff --git a/win64/bin/swig/share/swig/4.1.0/r/swigmove.i b/win64/bin/swig/share/swig/4.1.0/r/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/r/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/argcargv.i b/win64/bin/swig/share/swig/4.1.0/ruby/argcargv.i index d9aac36f..32b7f600 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/argcargv.i +++ b/win64/bin/swig/share/swig/4.1.0/ruby/argcargv.i @@ -1,24 +1,20 @@ /* ------------------------------------------------------------ - * --- Argc & Argv --- - * ------------------------------------------------------------ */ - -/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps - Use it as follow: + Use it as follows: %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } %inline %{ - int mainApp(size_t argc, const char **argv) - { + int mainApp(size_t argc, const char **argv) { return argc; } - then in the ruby side: + then from ruby: - args = ["asdf", "asdf2"] - mainApp(args); + $args = ["asdf", "asdf2"] + mainApp(args) * ------------------------------------------------------------ */ @@ -31,7 +27,7 @@ VALUE *ptr = RARRAY_PTR($input); for (i=0; i < size; i++, ptr++) { $2[i]= StringValuePtr(*ptr); - } + } $2[i]=NULL; } else { $1 = 0; $2 = 0; diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i index a864f714..971a52d4 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/ruby/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg b/win64/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg index 1fe776e1..d75d4f41 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg +++ b/win64/bin/swig/share/swig/4.1.0/ruby/rubyhead.swg @@ -1,5 +1,22 @@ +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wregister" +#if __GNUC__ >= 10 +#pragma GCC diagnostic ignored "-Wvolatile" +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" +#endif +#endif +#endif +#endif + #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which * breaks using rb_intern as an lvalue, as SWIG does. We work around this * issue for now by disabling this. diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg b/win64/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg index 347dd2e1..982b2551 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/ruby/rubyrun.swg @@ -281,6 +281,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, own->own = 0; } + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE)) { + if (!RDATA(obj)->dfree) + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we need to reset the destructor since the Ruby object no @@ -292,7 +297,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_class *sklass = (swig_class *) ty->clientdata; track = sklass->trackObjects; } - + if (track) { /* We are tracking objects for this class. Thus we change the destructor * to SWIG_RubyRemoveTracking. This allows us to @@ -306,6 +311,10 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, } } + if (flags & SWIG_POINTER_CLEAR) { + DATA_PTR(obj) = 0; + } + /* Do type-checking if type info was provided */ if (ty) { if (ty->clientdata) { @@ -413,6 +422,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) { /* register a new class */ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); + rb_undef_alloc_func(cl); /* create and store the structure pointer to a global variable */ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i index 52c0b16d..304f1fc9 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/ruby/std_auto_ptr.i @@ -1,17 +1,39 @@ -/* - The typemaps here allow handling 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). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; %enddef namespace std { - template class auto_ptr {}; + template class auto_ptr {}; } diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/std_set.i b/win64/bin/swig/share/swig/4.1.0/ruby/std_set.i index bc6294fb..1d96a65e 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/std_set.i +++ b/win64/bin/swig/share/swig/4.1.0/ruby/std_set.i @@ -180,17 +180,14 @@ // Redefine std::set iterator/reverse_iterator typemap %typemap(out,noblock=1) iterator, reverse_iterator { - $result = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,const $type &), - self), - swig::Iterator::descriptor(),SWIG_POINTER_OWN); + $result = SWIG_NewPointerObj((swig::make_set_nonconst_iterator<$type>($1, self)), swig::Iterator::descriptor(), SWIG_POINTER_OWN); } // Redefine std::set std::pair typemap %typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator") std::pair { $result = rb_ary_new2(2); - rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first), - swig::Iterator::descriptor(),SWIG_POINTER_OWN)); + rb_ary_push($result, SWIG_NewPointerObj((swig::make_set_nonconst_iterator($1.first)), swig::Iterator::descriptor(), SWIG_POINTER_OWN)); rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second)); } diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i new file mode 100755 index 00000000..79320de6 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/ruby/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/swigmove.i b/win64/bin/swig/share/swig/4.1.0/ruby/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/ruby/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/ruby/typemaps.i b/win64/bin/swig/share/swig/4.1.0/ruby/typemaps.i index ef6f7c32..84090727 100755 --- a/win64/bin/swig/share/swig/4.1.0/ruby/typemaps.i +++ b/win64/bin/swig/share/swig/4.1.0/ruby/typemaps.i @@ -139,7 +139,7 @@ output values. */ %define OUTPUT_TYPEMAP(type, converter, convtype) -%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;"; +%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") type *OUTPUT, type &OUTPUT { VALUE o = converter(convtype (*$1)); $result = output_helper($result, o); @@ -161,7 +161,7 @@ OUTPUT_TYPEMAP(double, rb_float_new, (double)); #undef OUTPUT_TYPEMAP -%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;"; +%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;" %typemap(argout, fragment="output_helper") bool *OUTPUT, bool &OUTPUT { VALUE o = (*$1) ? Qtrue : Qfalse; $result = output_helper($result, o); diff --git a/win64/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i b/win64/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i index d5fbb814..96cadd42 100755 --- a/win64/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i +++ b/win64/bin/swig/share/swig/4.1.0/scilab/boost_shared_ptr.i @@ -35,7 +35,7 @@ } } %typemap(out) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } @@ -54,12 +54,12 @@ } } %typemap(varout) CONST TYPE { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1)); %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1))); $input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags); %} %typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) { diff --git a/win64/bin/swig/share/swig/4.1.0/scilab/std_string.i b/win64/bin/swig/share/swig/4.1.0/scilab/std_string.i index 8af32e24..62a65e9f 100755 --- a/win64/bin/swig/share/swig/4.1.0/scilab/std_string.i +++ b/win64/bin/swig/share/swig/4.1.0/scilab/std_string.i @@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) { } %include + +%typemap(throws, noblock=1) std::string { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $&descriptor); +} + +%typemap(throws, noblock=1) const std::string & { + SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $descriptor); +} diff --git a/win64/bin/swig/share/swig/4.1.0/scilab/swigmove.i b/win64/bin/swig/share/swig/4.1.0/scilab/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/scilab/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/std/std_basic_string.i b/win64/bin/swig/share/swig/4.1.0/std/std_basic_string.i index 4ed9d012..8254e0b2 100755 --- a/win64/bin/swig/share/swig/4.1.0/std/std_basic_string.i +++ b/win64/bin/swig/share/swig/4.1.0/std/std_basic_string.i @@ -55,7 +55,16 @@ namespace std { size_type capacity() const; - void reserve(size_type __res_arg = 0); + void reserve(size_type __res_arg); + %extend { + void shrink_to_fit() { + %#if __cplusplus >= 202002L + self->shrink_to_fit(); + %#else + self->reserve(); + %#endif + } + } // Modifiers: diff --git a/win64/bin/swig/share/swig/4.1.0/swig.swg b/win64/bin/swig/share/swig/4.1.0/swig.swg index bfbefd3c..203c14fa 100755 --- a/win64/bin/swig/share/swig/4.1.0/swig.swg +++ b/win64/bin/swig/share/swig/4.1.0/swig.swg @@ -450,9 +450,9 @@ namespace std { /* Set up the typemap for handling new return strings */ #ifdef __cplusplus -%typemap(newfree) char * "delete [] $1;"; +%typemap(newfree) char * "delete [] $1;" #else -%typemap(newfree) char * "free($1);"; +%typemap(newfree) char * "free($1);" #endif /* Default typemap for handling char * members */ @@ -603,6 +603,10 @@ namespace std { /* ----------------------------------------------------------------------------- * Runtime code * ----------------------------------------------------------------------------- */ +#ifndef SWIG_JAVASCRIPT_COCOS + +%insert("runtime") "swiglabels.swg" + /* The SwigValueWrapper class */ @@ -654,35 +658,54 @@ namespace std { * arg1 = *inarg1; // Assignment from a pointer * arg1 = Vector(1,2,3); // Assignment from a value * + * SwigValueWrapper is a drop in replacement to modify normal value semantics by + * using the heap instead of the stack to copy/move the underlying object it is + * managing. Smart pointers also manage an underlying object on the heap, so + * SwigValueWrapper has characteristics of a smart pointer. The reset function + * is specific smart pointer functionality, but cannot be a non-static member as + * when SWIG modifies typemap code it assumes non-static member function calls + * are routed to the underlying object, changing for example $1.f() to (&x)->f(). + * The reset function was added as an optimisation to avoid some copying/moving + * and to take ownership of an object already created on the heap. + * * The class offers a strong guarantee of exception safety. - * With regards to the implementation, the private SwigMovePointer nested class is - * a simple smart pointer with move semantics, much like std::auto_ptr. + * With regards to the implementation, the private SwigSmartPointer nested class is + * a simple smart pointer providing exception safety, much like std::auto_ptr. * * This wrapping technique was suggested by William Fulton and is henceforth * known as the "Fulton Transform" :-). */ -#ifndef SWIG_JAVASCRIPT_COCOS #ifdef __cplusplus -%insert("runtime") %{ +// Placed in the header section to ensure the language specific header files are +// the first included headers and not +%insert("header") %{ #ifdef __cplusplus +#include /* SwigValueWrapper is described in swig.swg */ template class SwigValueWrapper { - struct SwigMovePointer { + struct SwigSmartPointer { T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + SwigSmartPointer(T *p) : ptr(p) { } + ~SwigSmartPointer() { delete ptr; } + SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + void reset(T *p) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = p; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper& rhs); SwigValueWrapper(const SwigValueWrapper& rhs); public: SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; } +#if __cplusplus >=201103L + SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; } + operator T&&() const { return std::move(*pointer.ptr); } +#else operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -};%} +#endif + T *operator&() const { return pointer.ptr; } + static void reset(SwigValueWrapper& t, T *p) { t.pointer.reset(p); } +}; /* * SwigValueInit() is a generic initialisation solution as the following approach: @@ -693,25 +716,26 @@ public: * * unsigned int c_result = unsigned int(); */ -%insert("runtime") %{ template T SwigValueInit() { return T(); } + +#if __cplusplus >=201103L +# define SWIG_STD_MOVE(OBJ) std::move(OBJ) +#else +# define SWIG_STD_MOVE(OBJ) OBJ +#endif + #endif %} #endif -/* The swiglabels */ - -%insert("runtime") "swiglabels.swg" - #else -%insert("runtime") %{ -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static -#endif +#ifdef __cplusplus +%insert("header") %{ +#define SWIG_STD_MOVE(OBJ) std::move(OBJ) %} +#endif // #ifdef __cplusplus -#endif // #ifndef SWIG_JAVASCRIPT_COCOS +#endif // #ifndef SWIG_JAVASCRIPT_COCOS \ No newline at end of file diff --git a/win64/bin/swig/share/swig/4.1.0/swigerrors.swg b/win64/bin/swig/share/swig/4.1.0/swigerrors.swg index a84bd5c5..611ea681 100755 --- a/win64/bin/swig/share/swig/4.1.0/swigerrors.swg +++ b/win64/bin/swig/share/swig/4.1.0/swigerrors.swg @@ -1,4 +1,4 @@ -/* Errors in SWIG */ +/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 @@ -13,4 +13,3 @@ #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 - diff --git a/win64/bin/swig/share/swig/4.1.0/swigrun.swg b/win64/bin/swig/share/swig/4.1.0/swigrun.swg index 70d4fc29..5ef7b324 100755 --- a/win64/bin/swig/share/swig/4.1.0/swigrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/swigrun.swg @@ -44,6 +44,8 @@ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 #define SWIG_POINTER_NO_NULL 0x4 +#define SWIG_POINTER_CLEAR 0x8 +#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN) /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -129,7 +131,13 @@ */ #define SWIG_OK (0) +/* Runtime errors are < 0 */ #define SWIG_ERROR (-1) +/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */ +/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */ +/* Errors < -200 are generic runtime specific errors */ +#define SWIG_ERROR_RELEASE_NOT_OWNED (-200) + #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) @@ -144,7 +152,7 @@ #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ +/* Check, add and del object mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) @@ -350,9 +358,9 @@ SWIG_TypeName(const swig_type_info *ty) { SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ + type, separated by vertical-bar characters. Choose the last + name. It should be the most specific; a fully resolved name + but not necessarily with default template parameters expanded. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; diff --git a/win64/bin/swig/share/swig/4.1.0/swigwarn.swg b/win64/bin/swig/share/swig/4.1.0/swigwarn.swg index 95bc5a3a..da97f542 100755 --- a/win64/bin/swig/share/swig/4.1.0/swigwarn.swg +++ b/win64/bin/swig/share/swig/4.1.0/swigwarn.swg @@ -4,7 +4,7 @@ * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * and at https://www.swig.org/legal.html. * * swigwarn.h * @@ -22,8 +22,8 @@ * This file is used as the input for generating Lib/swigwarn.swg. * ----------------------------------------------------------------------------- */ -#ifndef SWIGWARN_H_ -#define SWIGWARN_H_ +#ifndef SWIG_SWIGWARN_H +#define SWIG_SWIGWARN_H %define SWIGWARN_NONE 0 %enddef @@ -147,6 +147,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR 394 %enddef /* new [] */ %define SWIGWARN_IGNORE_OPERATOR_DELARR 395 %enddef /* delete [] */ %define SWIGWARN_IGNORE_OPERATOR_REF 396 %enddef /* operator *() */ +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT 397 %enddef /* <=> */ /* please leave 350-399 free for WARN_IGNORE_OPERATOR_* */ @@ -163,6 +164,7 @@ %define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef /* No longer issued */ %define SWIGWARN_TYPEMAP_APPLY_UNDEF 453 %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK 454 %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK 455 %enddef %define SWIGWARN_TYPEMAP_IN_UNDEF 460 %enddef %define SWIGWARN_TYPEMAP_OUT_UNDEF 461 %enddef diff --git a/win64/bin/swig/share/swig/4.1.0/swigwarnings.swg b/win64/bin/swig/share/swig/4.1.0/swigwarnings.swg index 37af0e0f..f6f585ce 100755 --- a/win64/bin/swig/share/swig/4.1.0/swigwarnings.swg +++ b/win64/bin/swig/share/swig/4.1.0/swigwarnings.swg @@ -52,6 +52,7 @@ %define SWIGWARN_TYPEMAP_CHARLEAK_MSG "451:Setting a const char * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG "454:Setting a pointer/reference variable may leak memory." %enddef +%define SWIGWARN_TYPEMAP_WCHARLEAK_MSG "455:Setting a const wchar_t * variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef %define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a pointer or reference in a director method is not recommended." %enddef %define SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG "476:Initialization using std::initializer_list." %enddef @@ -107,6 +108,7 @@ %define SWIGWARN_IGNORE_OPERATOR_NEWARR_MSG "394:operator new[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_DELARR_MSG "395:operator delete[] ignored" %enddef %define SWIGWARN_IGNORE_OPERATOR_REF_MSG "396:operator*() ignored" %enddef +%define SWIGWARN_IGNORE_OPERATOR_LTEQUALGT_MSG "397:operator<=> ignored" %enddef #define %ignoreoperator(Oper) %ignorewarn(SWIGWARN_IGNORE_OPERATOR_##Oper##_MSG) diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/Makefile.in b/win64/bin/swig/share/swig/4.1.0/tcl/Makefile.in index ce2c401d..d1b6468e 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/Makefile.in +++ b/win64/bin/swig/share/swig/4.1.0/tcl/Makefile.in @@ -45,7 +45,7 @@ LIBS = # SWIGCC = Compiler used to compile the wrapper file SWIG = $(exec_prefix)/bin/swig -SWIGOPT = -tcl # use -tcl8 for Tcl 8.0 +SWIGOPT = -tcl SWIGCC = $(CC) # SWIG Library files. Uncomment if rebuilding tclsh diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/argcargv.i b/win64/bin/swig/share/swig/4.1.0/tcl/argcargv.i new file mode 100755 index 00000000..988c2766 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/tcl/argcargv.i @@ -0,0 +1,29 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%typemap(in) (int ARGC, char **ARGV) { + int i, nitems; + Tcl_Obj **listobjv; + if (Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) { + SWIG_exception_fail(SWIG_ValueError, "in method '$symname', Expecting list of argv"); + goto fail; + } + $1 = ($1_ltype) nitems; + $2 = (char **) malloc((nitems+1)*sizeof(char *)); + for (i = 0; i < nitems; i++) { + $2[i] = Tcl_GetStringFromObj(listobjv[i], NULL); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + int len; + $1 = Tcl_ListObjLength(interp, $input, &len) == TCL_OK; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + free((void *)$2); + } +} diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/mactkinit.c b/win64/bin/swig/share/swig/4.1.0/tcl/mactkinit.c deleted file mode 100755 index 4efa7559..00000000 --- a/win64/bin/swig/share/swig/4.1.0/tcl/mactkinit.c +++ /dev/null @@ -1,233 +0,0 @@ -/* ----------------------------------------------------------------------------- - * mactkinit.c - * - * This is a support file needed to build a new version of Wish. - * Normally, this capability is found in TkAppInit.c, but this creates - * tons of namespace problems for many applications. - * ----------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include - -#include "tk.h" -#include "tkInt.h" -#include "tkMacInt.h" - -typedef int (*TclMacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr)); -Tcl_Interp *gStdoutInterp = NULL; - -void TclMacSetEventProc _ANSI_ARGS_((TclMacConvertEventPtr procPtr)); -int TkMacConvertEvent _ANSI_ARGS_((EventRecord *eventPtr)); - -/* - * Prototypes for functions the ANSI library needs to link against. - */ -short InstallConsole _ANSI_ARGS_((short fd)); -void RemoveConsole _ANSI_ARGS_((void)); -long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); -long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); -char * __ttyname _ANSI_ARGS_((long fildes)); -short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); - -/* - * Forward declarations for procedures defined later in this file: - */ - -/* - *---------------------------------------------------------------------- - * - * MacintoshInit -- - * - * This procedure calls Mac specific initialization calls. Most of - * these calls must be made as soon as possible in the startup - * process. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * Inits the application. - * - *---------------------------------------------------------------------- - */ - -int -MacintoshInit() -{ - int i; - long result, mask = 0x0700; /* mask = system 7.x */ - - /* - * Tk needs us to set the qd pointer it uses. This is needed - * so Tk doesn't have to assume the availiblity of the qd global - * variable. Which in turn allows Tk to be used in code resources. - */ - tcl_macQdPtr = &qd; - - InitGraf(&tcl_macQdPtr->thePort); - InitFonts(); - InitWindows(); - InitMenus(); - InitDialogs((long) NULL); - InitCursor(); - - /* - * Make sure we are running on system 7 or higher - */ - - if ((NGetTrapAddress(_Gestalt, ToolTrap) == - NGetTrapAddress(_Unimplemented, ToolTrap)) - || (((Gestalt(gestaltSystemVersion, &result) != noErr) - || (mask != (result & mask))))) { - panic("Tcl/Tk requires System 7 or higher."); - } - - /* - * Make sure we have color quick draw - * (this means we can't run on 68000 macs) - */ - - if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) - || (result < gestalt32BitQD13))) { - panic("Tk requires Color QuickDraw."); - } - - - FlushEvents(everyEvent, 0); - SetEventMask(everyEvent); - - /* - * Set up stack & heap sizes - */ - /* TODO: stack size - size = StackSpace(); - SetAppLimit(GetAppLimit() - 8192); - */ - MaxApplZone(); - for (i = 0; i < 4; i++) { - (void) MoreMasters(); - } - - TclMacSetEventProc(TkMacConvertEvent); - TkConsoleCreate(); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * SetupMainInterp -- - * - * This procedure calls initialization routines require a Tcl - * interp as an argument. This call effectively makes the passed - * interpreter the "main" interpreter for the application. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * More initialization. - * - *---------------------------------------------------------------------- - */ - -int -SetupMainInterp( - Tcl_Interp *interp) -{ - /* - * Initialize the console only if we are running as an interactive - * application. - */ - - TkMacInitAppleEvents(interp); - TkMacInitMenus(interp); - - if (strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "1") - == 0) { - if (TkConsoleInit(interp) == TCL_ERROR) { - goto error; - } - } - - /* - * Attach the global interpreter to tk's expected global console - */ - - gStdoutInterp = interp; - - return TCL_OK; - -error: - panic(interp->result); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * - * InstallConsole, RemoveConsole, etc. -- - * - * The following functions provide the UI for the console package. - * Users wishing to replace SIOUX with their own console package - * need only provide the four functions below in a library. - * - * Results: - * See SIOUX documentation for details. - * - * Side effects: - * See SIOUX documentation for details. - * - *---------------------------------------------------------------------- - */ - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buffer, long n) -{ - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; -} - -long -ReadCharsFromConsole(char *buffer, long n) -{ - return 0; -} - -extern char * -__ttyname(long fildes) -{ - static char *devicename = "null device"; - - if (fildes >= 0 && fildes <= 2) { - return (devicename); - } - - return (0L); -} - -short -SIOUXHandleOneEvent(EventRecord *event) -{ - return 0; -} diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i b/win64/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i new file mode 100755 index 00000000..77738159 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/tcl/std_auto_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap(in, noblock=1) std::auto_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::auto_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i b/win64/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i new file mode 100755 index 00000000..6609012a --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/tcl/std_unique_ptr.i @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * Memory ownership is passed from the std::unique_ptr C++ layer to the proxy + * class when returning a std::unique_ptr from a function. + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %unique_ptr(TYPE) +%typemap(in, noblock=1) std::unique_ptr< TYPE > (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), SWIG_POINTER_RELEASE | %convertptr_flags); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "TYPE *", $symname, $argnum); + } else { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + } + $1.reset((TYPE *)argp); +} + +%typemap (out) std::unique_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + +%template() std::unique_ptr< TYPE >; +%enddef + +namespace std { + template class unique_ptr {}; +} diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/std_vector.i b/win64/bin/swig/share/swig/4.1.0/tcl/std_vector.i index db2afb4c..cbcff732 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/std_vector.i +++ b/win64/bin/swig/share/swig/4.1.0/tcl/std_vector.i @@ -34,11 +34,11 @@ %{ #include -Tcl_Obj* SwigString_FromString(const std::string &s) { +SWIGINTERN Tcl_Obj* SwigString_FromString(const std::string &s) { return Tcl_NewStringObj(s.data(), (int)s.length()); } -int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { +SWIGINTERN int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { int v; int res = Tcl_GetBooleanFromObj(interp, o, &v); if (res == TCL_OK) { @@ -47,7 +47,7 @@ int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { return res; } -int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { +SWIGINTERN int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { int len; const char* temp = Tcl_GetStringFromObj(o, &len); (void)interp; diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/swigmove.i b/win64/bin/swig/share/swig/4.1.0/tcl/swigmove.i new file mode 100755 index 00000000..03e87fa2 --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/tcl/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/tclinit.swg b/win64/bin/swig/share/swig/4.1.0/tcl/tclinit.swg index 0851e257..7a08c377 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/tclinit.swg +++ b/win64/bin/swig/share/swig/4.1.0/tcl/tclinit.swg @@ -24,7 +24,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *); /* Compatibility version for TCL stubs */ #ifndef SWIG_TCL_STUBS_VERSION -#define SWIG_TCL_STUBS_VERSION "8.1" +#define SWIG_TCL_STUBS_VERSION "8.4" #endif %} @@ -100,8 +100,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) { size_t i; if (interp == 0) return TCL_ERROR; #ifdef USE_TCL_STUBS - /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */ - if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) { + if (Tcl_InitStubs(interp, SWIG_TCL_STUBS_VERSION, 0) == NULL) { return TCL_ERROR; } #endif diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg b/win64/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg index 26e22dc9..615c324f 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg +++ b/win64/bin/swig/share/swig/4.1.0/tcl/tclprimtypes.swg @@ -136,30 +136,13 @@ SWIG_From_dec(long long)(long long value) SWIGINTERN int SWIG_AsVal_dec(long long)(Tcl_Obj *obj, long long *val) { - long v; - if (Tcl_GetLongFromObj(0,obj, &v) == TCL_OK) { + Tcl_WideInt v; + if (Tcl_GetWideIntFromObj(0, obj, &v) == TCL_OK) { + if (sizeof(v) > sizeof(*val) && (v < LLONG_MIN || v > LLONG_MAX)) { + return SWIG_OverflowError; + } if (val) *val = v; return SWIG_OK; - } else { - int len = 0; - const char *nptr = Tcl_GetStringFromObj(obj, &len); - if (nptr && len > 0) { - char *endptr; - long long v; - errno = 0; - v = strtoll(nptr, &endptr,0); - if (nptr[0] == '\0' || *endptr != '\0') - return SWIG_TypeError; - if ((v == LLONG_MAX || v == LLONG_MIN) && errno == ERANGE) { - errno = 0; - return SWIG_OverflowError; - } else { - if (*endptr == '\0') { - if (val) *val = v; - return SWIG_OK; - } - } - } } return SWIG_TypeError; } diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/tclrun.swg b/win64/bin/swig/share/swig/4.1.0/tcl/tclrun.swg index a8e76207..4decfdd1 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/tclrun.swg +++ b/win64/bin/swig/share/swig/4.1.0/tcl/tclrun.swg @@ -122,6 +122,7 @@ SWIG_Tcl_Disown(void *ptr) { SWIGRUNTIME int SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) { swig_cast_info *tc; + const char *cmd_name; /* Pointer values must start with leading underscore */ while (*c != '_') { *ptr = (void *) 0; @@ -157,23 +158,42 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL); } + cmd_name = c; c++; c = SWIG_UnpackData(c,ptr,sizeof(void *)); + if (ty) { tc = c ? SWIG_TypeCheck(c,ty) : 0; - if (!tc) { + if (tc) { + Tcl_CmdInfo info; + if (Tcl_GetCommandInfo(interp, cmd_name, &info)) { + swig_instance *inst = (swig_instance *)info.objClientData; + if (!inst->thisvalue) { + *ptr = 0; + } + assert(inst->thisvalue == *ptr); + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !SWIG_Thisown(inst->thisvalue)) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + SWIG_Disown((void *) *ptr); + } + if (flags & SWIG_POINTER_CLEAR) { + inst->thisvalue = 0; + } + { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + } + } + } else { return SWIG_ERROR; } - if (flags & SWIG_POINTER_DISOWN) { - SWIG_Disown((void *) *ptr); - } - { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } } + return SWIG_OK; } @@ -490,9 +510,11 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ /* Check to see if this pointer belongs to a class or not */ if (thisvalue && (type->clientdata) && (interp)) { Tcl_CmdInfo ci; + int has_command; char *name; name = Tcl_GetStringFromObj(robj,NULL); - if (!Tcl_GetCommandInfo(interp,name, &ci) || (flags)) { + has_command = Tcl_GetCommandInfo(interp, name, &ci); + if (!has_command || flags) { swig_instance *newinst = (swig_instance *) malloc(sizeof(swig_instance)); newinst->thisptr = Tcl_DuplicateObj(robj); Tcl_IncrRefCount(newinst->thisptr); @@ -503,6 +525,15 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ if (flags) { SWIG_Acquire(thisvalue); } + } else { + swig_instance *inst = (swig_instance *)ci.objClientData; + /* Restore thisvalue as SWIG_POINTER_CLEAR may have been used to set it to zero. + Occurs when the C pointer is re-used by the memory allocator and the command has + been created and not destroyed - bug?? - see cpp11_std_unique_ptr_runme.tcl test. */ + if (inst->thisvalue != thisvalue) { + assert(inst->thisvalue == 0); + inst->thisvalue = thisvalue; + } } } return robj; diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/tclsh.i b/win64/bin/swig/share/swig/4.1.0/tcl/tclsh.i index 17614041..2de5f814 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/tclsh.i +++ b/win64/bin/swig/share/swig/4.1.0/tcl/tclsh.i @@ -33,10 +33,6 @@ char *SWIG_RcFileName = "~/.myapprc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -#endif - int Tcl_AppInit(Tcl_Interp *interp){ if (Tcl_Init(interp) == TCL_ERROR) @@ -47,27 +43,11 @@ int Tcl_AppInit(Tcl_Interp *interp){ if (SWIG_init(interp) == TCL_ERROR) return TCL_ERROR; Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); -#endif - + return TCL_OK; } int main(int argc, char **argv) { -#ifdef MAC_TCL - char *newArgv[2]; - - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - - argc = 1; - newArgv[0] = "tclsh"; - newArgv[1] = NULL; - argv = newArgv; -#endif - Tcl_Main(argc, argv, Tcl_AppInit); return(0); diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg b/win64/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg index 41e3b1f7..5438e731 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/tcl/tcltypemaps.swg @@ -77,11 +77,6 @@ #endif -%typemap(throws,noblock=1) SWIGTYPE CLASS { - SWIG_set_result(SWIG_NewInstanceObj(%as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1)); - SWIG_fail; -} - %typemap(out) SWIGTYPE = SWIGTYPE INSTANCE; %typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE; %typemap(out) SWIGTYPE *const = SWIGTYPE *; diff --git a/win64/bin/swig/share/swig/4.1.0/tcl/wish.i b/win64/bin/swig/share/swig/4.1.0/tcl/wish.i index c3d2a66d..e10a92c5 100755 --- a/win64/bin/swig/share/swig/4.1.0/tcl/wish.i +++ b/win64/bin/swig/share/swig/4.1.0/tcl/wish.i @@ -35,11 +35,6 @@ as follows (this should be included in a code-block) : char *SWIG_RcFileName = "~/.wishrc"; #endif -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); -#endif - /* *---------------------------------------------------------------------- * @@ -61,10 +56,9 @@ extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); int Tcl_AppInit(Tcl_Interp *interp) { -#ifndef MAC_TCL Tk_Window main; main = Tk_MainWindow(interp); -#endif + /* * Call the init procedures for included packages. Each call should * look like this: @@ -93,10 +87,6 @@ int Tcl_AppInit(Tcl_Interp *interp) return TCL_ERROR; } -#ifdef MAC_TCL - SetupMainInterp(interp); -#endif - /* * Specify a user-specific startup file to invoke if the application * is run interactively. Typically the startup file is "~/.apprc" @@ -104,31 +94,12 @@ int Tcl_AppInit(Tcl_Interp *interp) * then no user-specific startup file will be run under any conditions. */ - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); - -/* For Macintosh might also want this */ - -#ifdef MAC_TCL -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY); -#endif -#endif + Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); return TCL_OK; } #if TK_MAJOR_VERSION >= 4 int main(int argc, char **argv) { - -#ifdef MAC_TCL - char *newArgv[2]; - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - argc = 1; - newArgv[0] = "Wish"; - newArgv[1] = NULL; - argv = newArgv; -#endif Tk_Main(argc, argv, Tcl_AppInit); return(0); } diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg index bc5e3574..6810d796 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/cstrings.swg @@ -59,7 +59,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP (Char temp[MAX+1]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtr ) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -85,7 +85,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP(Char temp[SIZE]) { $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment= #SWIG_FromCharPtrAndSize) TYPEMAP { %append_output(SWIG_FromCharPtrAndSize($1,SIZE)); } @@ -122,7 +122,7 @@ temp[n - 1] = 0; $1 = ($1_ltype) temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { $1[MAX] = 0; %append_output(SWIG_FromCharPtr($1)); @@ -160,7 +160,7 @@ if (alloc == SWIG_NEWOBJ) %delete_array(t); $1[n-1] = 0; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { %append_output(SWIG_FromCharPtr($1)); %delete_array($1); @@ -247,7 +247,7 @@ %typemap(in,noblock=1,numinputs=0) TYPEMAP($*1_ltype temp = 0) { $1 = &temp; } -%typemap(freearg,match="in") TYPEMAP ""; +%typemap(freearg,match="in") TYPEMAP "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtr) TYPEMAP { if (*$1) { %append_output(SWIG_FromCharPtr(*$1)); @@ -275,7 +275,7 @@ %typemap(in,noblock=1,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) { $1 = &temp; $2 = &tempn; } -%typemap(freearg,match="in") (TYPEMAP,SIZE) ""; +%typemap(freearg,match="in") (TYPEMAP,SIZE) "" %typemap(argout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)(TYPEMAP,SIZE) { if (*$1) { %append_output(SWIG_FromCharPtrAndSize(*$1,*$2)); diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/exception.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/exception.swg index d6f21bdc..292f8b66 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/exception.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/exception.swg @@ -19,6 +19,7 @@ #endif #define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name) #define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type) +#define %releasenotownedfail_fmt(_type,_name,_argn) "in method '" `_name` "', cannot release ownership as memory is not owned for argument " `_argn`" of type '" `_type`"'" /* setting an error */ #define %error(code,msg...) SWIG_Error(code, msg) diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg index 94fb8259..9c26abd0 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/ptrtypes.swg @@ -35,7 +35,7 @@ $1 = *ptr; if (SWIG_IsNewObj(res)) %delete(ptr); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) { Type *ptr = (Type *)0; res = asptr_meth($input, &ptr); diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/string.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/string.swg index 0cc48897..4c689a49 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/string.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/string.swg @@ -30,6 +30,7 @@ SWIG_strnlen(const char* s, size_t maxlen) %include %typemaps_string(%checkcode(STRING), %checkcode(CHAR), + SWIGWARN_TYPEMAP_CHARLEAK_MSG, char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, strlen, SWIG_strnlen, "", CHAR_MIN, CHAR_MAX) diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/strings.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/strings.swg index f9be829f..0776ea1c 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/strings.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/strings.swg @@ -19,6 +19,7 @@ %define %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -78,7 +79,7 @@ if (!SWIG_IsOK(res)) { %variable_fail(res,"$type","$name"); } - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if (alloc == SWIG_NEWOBJ) { $1 = cptr; } else { @@ -86,7 +87,7 @@ } } -%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=WarningLeakMsg) const Char * { Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ; int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc); if (!SWIG_IsOK(res)) { @@ -108,7 +109,7 @@ /* memberin */ %typemap(memberin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char); @@ -117,7 +118,7 @@ } } -%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(memberin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -129,7 +130,7 @@ /* globalin */ %typemap(globalin,noblock=1) Char * { - if ($1) SWIG_DeleteCharArray($1); + SWIG_DeleteCharArray($1); if ($input) { size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -138,7 +139,7 @@ } } -%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * { +%typemap(globalin,noblock=1,warning=WarningLeakMsg) const Char * { if ($input) { size_t size = SWIG_CharPtrLen($input) + 1; $1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char); @@ -265,7 +266,7 @@ } $1 = %reinterpret_cast(temp, $1_ltype); } -%typemap(freearg) Char [ANY], const Char [ANY] ""; +%typemap(freearg) Char [ANY], const Char [ANY] "" %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0], int res) { @@ -275,7 +276,7 @@ } $1 = &temp; } -%typemap(freearg) const Char (&)[ANY] ""; +%typemap(freearg) const Char (&)[ANY] "" %typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen) Char [ANY], const Char[ANY] @@ -501,6 +502,7 @@ #ifndef %_typemap2_string %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -591,6 +593,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -609,6 +612,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -616,6 +620,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_CharBufLen, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -631,6 +636,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string_alloc(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -640,6 +646,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg index 6c06c1c2..faf97f64 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/swigmacros.swg @@ -109,17 +109,6 @@ nocppval #endif %enddef -#ifndef SWIG_JAVASCRIPT_COCOS -/* insert the SWIGVERSION in the interface and the wrapper code */ -#if SWIG_VERSION -%insert("header") { -%define_as(SWIGVERSION, SWIG_VERSION) -%#define SWIG_VERSION SWIGVERSION -} -#endif -#endif // #ifndef SWIG_JAVASCRIPT_COCOS - - /* ----------------------------------------------------------------------------- * Casting operators * ----------------------------------------------------------------------------- */ diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg new file mode 100755 index 00000000..8362672c --- /dev/null +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/swigmove.swg @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * swigmove.swg + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $&1_descriptor, SWIG_POINTER_RELEASE); + if (!SWIG_IsOK(res)) { + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$1_type", $symname, $argnum); + } else { + %argument_fail(res, "$1_type", $symname, $argnum); + } + } + if (!argp) { %argument_nullref("$1_type", $symname, $argnum); } + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg index 6d0b6f93..992ea07a 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/swigobject.swg @@ -2,7 +2,7 @@ * Language Object * - Just pass straight through unmodified * ------------------------------------------------------------ */ -%typemap(in) SWIG_Object "$1 = $input;"; +%typemap(in) SWIG_Object "$1 = $input;" %typemap(in,noblock=1) SWIG_Object const & ($*ltype temp) { @@ -30,8 +30,8 @@ #if defined(SWIG_DIRECTOR_TYPEMAPS) -%typemap(directorin) SWIG_Object "$input = $1;"; -%typemap(directorout) SWIG_Object "$result = $input;"; +%typemap(directorin) SWIG_Object "$input = $1;" +%typemap(directorout) SWIG_Object "$result = $input;" #endif /* SWIG_DIRECTOR_TYPEMAPS */ diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg index 231d288d..59594b89 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/swigtype.swg @@ -2,50 +2,50 @@ * --- Input arguments --- * ----------------------------------------------------------------------------- */ /* Pointers and arrays */ -%typemap(in, noblock=1) SWIGTYPE *(void *argp = nullptr, int res = 0) { - res = SWIG_ConvertPtr333($input, &argp,$descriptor, $disown | %convertptr_flags); +%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE * ""; +%typemap(freearg) SWIGTYPE * "" %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr4($input, &argp,$descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE [] ""; +%typemap(freearg) SWIGTYPE [] "" %typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) { - res = SWIG_ConvertPtr5($input, &argp, $*descriptor, $disown | %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$*ltype", $symname, $argnum); } temp = %reinterpret_cast(argp, $*ltype); $1 = %reinterpret_cast(&temp, $1_ltype); } -%typemap(freearg) SWIGTYPE *const& ""; +%typemap(freearg) SWIGTYPE *const& "" /* Reference */ %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr6($input, &argp, $descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE & ""; +%typemap(freearg) SWIGTYPE & "" #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr7($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -56,56 +56,28 @@ { if (SWIG_IsNewObj(res$argnum)) %delete($1); } -#else -%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) { - res = SWIG_ConvertPtr8($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} #endif /* Rvalue reference */ -%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr9($input, &argp, $descriptor, %convertptr_flags); +%typemap(in, noblock=1, fragment="") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE | %convertptr_flags); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + if (res == SWIG_ERROR_RELEASE_NOT_OWNED) { + %releasenotowned_fail(res, "$type", $symname, $argnum); + } else { + %argument_fail(res, "$type", $symname, $argnum); + } } if (!argp) { %argument_nullref("$type", $symname, $argnum); } $1 = %reinterpret_cast(argp, $ltype); + rvrdeleter.reset($1); } -%typemap(freearg) SWIGTYPE && ""; - -#if defined(__cplusplus) && defined(%implicitconv_flag) -%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr10($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE && -{ - if (SWIG_IsNewObj(res$argnum)) %delete($1); -} -#else -%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) { - res = SWIG_ConvertPtr11($input, &argp, $descriptor, %convertptr_flags); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); - } - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - $1 = %reinterpret_cast(argp, $ltype); -} -#endif +%typemap(freearg) SWIGTYPE && "" /* By value */ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr12($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -119,7 +91,7 @@ } #else %typemap(in) SWIGTYPE (void *argp, int res = 0) { - res = SWIG_ConvertPtr13($input, &argp, $&descriptor, %convertptr_flags); + res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res, "$type", $symname, $argnum); } @@ -146,9 +118,15 @@ } /* Return by value */ +#ifdef __cplusplus %typemap(out, noblock=1) SWIGTYPE { - %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); + %set_output(SWIG_NewPointerObj((new $1_ltype($1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); } +#else +%typemap(out, noblock=1) SWIGTYPE { + %set_output(SWIG_NewPointerObj(%new_copy($1, $1_ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); +} +#endif /* ----------------------------------------------------------------------------- * --- Variable input --- @@ -176,7 +154,7 @@ %typemap(varin) SWIGTYPE [ANY] { $basetype *inp = 0; - int res = SWIG_ConvertPtr14($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -224,7 +202,7 @@ %typemap(varin) SWIGTYPE [ANY][ANY] { $basetype (*inp)[$1_dim1] = 0; - int res = SWIG_ConvertPtr15($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } else if (inp) { @@ -246,7 +224,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE * { void *argp = 0; - int res = SWIG_ConvertPtr16($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -260,7 +238,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE & { void *argp = 0; - int res = SWIG_ConvertPtr17($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -272,7 +250,7 @@ %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && { void *argp = 0; - int res = SWIG_ConvertPtr18($input, &argp, $descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -285,7 +263,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(varin,implicitconv=1) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr19($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -301,7 +279,7 @@ #else %typemap(varin) SWIGTYPE { void *argp = 0; - int res = SWIG_ConvertPtr20($input, &argp, $&descriptor, %convertptr_flags); + int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -346,58 +324,59 @@ %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * { void *vptr = 0; - int res = SWIG_ConvertPtr21($input, &vptr, $descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& { void *vptr = 0; - int res = SWIG_ConvertPtr22($input, &vptr, $*descriptor, 0); + int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr23($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr24($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & { - int res = SWIG_ConvertPtr25($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && { - int res = SWIG_ConvertPtr26($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE { - int res = SWIG_ConvertPtr27($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); + int res = SWIG_ConvertPtr($input, 0, $&descriptor, SWIG_POINTER_NO_NULL | %implicitconv_flag); $1 = SWIG_CheckState(res); } #else %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & { void *vptr = 0; - int res = SWIG_ConvertPtr28($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && { void *vptr = 0; - int res = SWIG_ConvertPtr29($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { void *vptr = 0; - int res = SWIG_ConvertPtr30($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, SWIG_POINTER_NO_NULL); $1 = SWIG_CheckState(res); } #endif @@ -411,7 +390,7 @@ /* directorin */ %typemap(directorin,noblock=1) SWIGTYPE { - $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); + $input = SWIG_NewPointerObj((new $1_ltype(SWIG_STD_MOVE($1))), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); } %typemap(directorin,noblock=1) SWIGTYPE * { @@ -434,7 +413,7 @@ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr31($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -443,7 +422,7 @@ } #else %typemap(directorout,noblock=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { - swig_res = SWIG_ConvertPtr32($input,&swig_argp,$&descriptor, %convertptr_flags); + swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -534,7 +513,7 @@ * ------------------------------------------------------------ */ %typemap(throws,noblock=1) SWIGTYPE { - %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); + %raise(SWIG_NewPointerObj(%new_copy($1, $1_ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); } %typemap(throws,noblock=1) SWIGTYPE * { @@ -680,7 +659,7 @@ /* DISOWN typemap */ %typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) { - res = SWIG_ConvertPtr111($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + res = SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type", $symname, $argnum); } @@ -688,7 +667,7 @@ %typemap(varin) SWIGTYPE *DISOWN { void *temp = 0; - int res = SWIG_ConvertPtr222($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); + int res = SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } @@ -703,9 +682,15 @@ /* INSTANCE typemap */ +#ifdef __cplusplus +%typemap(out,noblock=1) SWIGTYPE INSTANCE { + %set_output(SWIG_NewInstanceObj((new $1_ltype($1)), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); +} +#else %typemap(out,noblock=1) SWIGTYPE INSTANCE { %set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); } +#endif %typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] { %set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags)); diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg index 16ec1f3c..64941b8f 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/swigtypemaps.swg @@ -140,6 +140,7 @@ #define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn)) #define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name)) #define %variable_nullref(type, name) SWIG_exception_fail(SWIG_ValueError, %varnullref_fmt(type, name)) +#define %releasenotowned_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %releasenotownedfail_fmt(type, name, argn)) #if defined(SWIG_DIRECTOR_TYPEMAPS) #define %dirout_fail(code, type) SWIG_DirOutFail(%default_code(code), %outfail_fmt(type)) diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg index 7d13b6f4..93fddda7 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/valtypes.swg @@ -38,7 +38,7 @@ } $1 = %static_cast(val,$ltype); } - %typemap(freearg) Type ""; + %typemap(freearg) Type "" %typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) { ecode = asval_meth($input, &val); if (!SWIG_IsOK(ecode)) { @@ -47,7 +47,7 @@ temp = %static_cast(val, $*ltype); $1 = &temp; } - %typemap(freearg) const Type& ""; + %typemap(freearg) const Type& "" %enddef /* out */ diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/void.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/void.swg index aa0cb396..68246c90 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/void.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/void.swg @@ -10,7 +10,7 @@ %argument_fail(res, "$type", $symname, $argnum); } } -%typemap(freearg) void * ""; +%typemap(freearg) void * "" %typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) { res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown); @@ -19,7 +19,7 @@ } $1 = &temp; } -%typemap(freearg) void * const& ""; +%typemap(freearg) void * const& "" /* out */ diff --git a/win64/bin/swig/share/swig/4.1.0/typemaps/wstring.swg b/win64/bin/swig/share/swig/4.1.0/typemaps/wstring.swg index 891a0be4..d676d946 100755 --- a/win64/bin/swig/share/swig/4.1.0/typemaps/wstring.swg +++ b/win64/bin/swig/share/swig/4.1.0/typemaps/wstring.swg @@ -31,6 +31,7 @@ SWIG_wcsnlen(const wchar_t* s, size_t maxlen) %include %typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR), + SWIGWARN_TYPEMAP_WCHARLEAK_MSG, wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, wcslen, SWIG_wcsnlen, "", WCHAR_MIN, WCHAR_MAX)