diff --git a/macx64/bin/swig/bin/ccache-swig b/macx64/bin/swig/bin/ccache-swig index 772fb8d5..04831f9a 100755 Binary files a/macx64/bin/swig/bin/ccache-swig and b/macx64/bin/swig/bin/ccache-swig differ diff --git a/macx64/bin/swig/bin/swig b/macx64/bin/swig/bin/swig index 4740ece1..56b1de1c 100755 Binary files a/macx64/bin/swig/bin/swig and b/macx64/bin/swig/bin/swig differ diff --git a/macx64/bin/swig/share/swig/4.0.0/cdata.i b/macx64/bin/swig/share/swig/4.0.0/cdata.i deleted file mode 100644 index f18ed4af..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/cdata.i +++ /dev/null @@ -1,104 +0,0 @@ -/* ----------------------------------------------------------------------------- - * cdata.i - * - * SWIG library file containing macros for manipulating raw C data as strings. - * ----------------------------------------------------------------------------- */ - -%{ -typedef struct SWIGCDATA { - char *data; - int len; -} SWIGCDATA; -%} - -/* ----------------------------------------------------------------------------- - * Typemaps for returning binary data - * ----------------------------------------------------------------------------- */ - -#if SWIGGUILE -%typemap(out) SWIGCDATA { - $result = scm_from_locale_stringn($1.data,$1.len); -} -%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); - -#elif SWIGPHP7 - -%typemap(out) SWIGCDATA { - ZVAL_STRINGL($result, $1.data, $1.len); -} -%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); - -#elif SWIGJAVA - -%apply (char *STRING, int LENGTH) { (const void *indata, int inlen) } -%typemap(jni) SWIGCDATA "jbyteArray" -%typemap(jtype) SWIGCDATA "byte[]" -%typemap(jstype) SWIGCDATA "byte[]" -%fragment("SWIG_JavaArrayOutCDATA", "header") { -static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) { - jbyte *arr; - int i; - jbyteArray jresult = JCALL1(NewByteArray, jenv, sz); - if (!jresult) - return NULL; - arr = JCALL2(GetByteArrayElements, jenv, jresult, 0); - if (!arr) - return NULL; - for (i=0; i, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ - -%define %auto_ptr(TYPE) -%typemap (ctype) std::auto_ptr "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(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; -%enddef - -namespace std { - template class auto_ptr {}; -} diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_wstring.i b/macx64/bin/swig/share/swig/4.0.0/csharp/std_wstring.i deleted file mode 100644 index 09bdaaaa..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_wstring.i +++ /dev/null @@ -1,114 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_wstring.i - * - * Typemaps for std::wstring and const std::wstring& - * These are mapped to a C# String and are passed around by value. - * - * To use non-const std::wstring references use the following %apply. Note - * that they are passed by value. - * %apply const std::wstring & {std::wstring &}; - * ----------------------------------------------------------------------------- */ - -%include - -%{ -#include -%} - -namespace std { - -%naturalvar wstring; - -class wstring; - -// wstring -%typemap(ctype, out="void *") wstring "wchar_t *" -%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string" -%typemap(cstype) wstring "string" -%typemap(csdirectorin) wstring "$iminput" -%typemap(csdirectorout) wstring "$cscall" - -%typemap(in, canthrow=1) wstring -%{ if (!$input) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); - return $null; - } - $1.assign($input); %} -%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %} - -%typemap(directorout, canthrow=1) wstring -%{ if (!$input) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); - return $null; - } - $result.assign($input); %} - -%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} - -%typemap(csin) wstring "$csinput" -%typemap(csout, excode=SWIGEXCODE) wstring { - string ret = $imcall;$excode - return ret; - } - -%typemap(typecheck) wstring = wchar_t *; - -%typemap(throws, canthrow=1) wstring -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); - return $null; %} - -// const wstring & -%typemap(ctype, out="void *") const wstring & "wchar_t *" -%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string" -%typemap(cstype) const wstring & "string" - -%typemap(csdirectorin) const wstring & "$iminput" -%typemap(csdirectorout) const wstring & "$cscall" - -%typemap(in, canthrow=1) const wstring & -%{ if (!$input) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); - return $null; - } - std::wstring $1_str($input); - $1 = &$1_str; %} -%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %} - -%typemap(csin) const wstring & "$csinput" -%typemap(csout, excode=SWIGEXCODE) const wstring & { - string ret = $imcall;$excode - return ret; - } - -%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring & -%{ if (!$input) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); - return $null; - } - /* possible thread/reentrant code problem */ - static std::wstring $1_str; - $1_str = $input; - $result = &$1_str; %} - -%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %} - -%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{ - set { - $imcall;$excode - } %} -%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{ - get { - string ret = $imcall;$excode - return ret; - } %} - -%typemap(typecheck) const wstring & = wchar_t *; - -%typemap(throws, canthrow=1) const wstring & -%{ std::string message($1.begin(), $1.end()); - SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str()); - return $null; %} - -} - diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/wchar.i b/macx64/bin/swig/share/swig/4.0.0/csharp/wchar.i deleted file mode 100644 index 9361edf6..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/wchar.i +++ /dev/null @@ -1,102 +0,0 @@ -/* ----------------------------------------------------------------------------- - * wchar.i - * - * Typemaps for the wchar_t type - * These are mapped to a C# String and are passed around by value. - * - * Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER - * - * ----------------------------------------------------------------------------- */ - -#if !defined(SWIG_CSHARP_NO_WSTRING_HELPER) -#if !defined(SWIG_CSHARP_WSTRING_HELPER_) -#define SWIG_CSHARP_WSTRING_HELPER_ -%insert(runtime) %{ -/* Callback for returning strings to C# without leaking memory */ -typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *); -static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL; -%} - -%pragma(csharp) imclasscode=%{ - protected class SWIGWStringHelper { - - public delegate string SWIGWStringDelegate(global::System.IntPtr message); - static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString); - - [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")] - public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate); - - static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) { - return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString); - } - - static SWIGWStringHelper() { - SWIGRegisterWStringCallback_$module(wstringDelegate); - } - } - - static protected SWIGWStringHelper swigWStringHelper = new SWIGWStringHelper(); -%} - -%insert(runtime) %{ -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) { - SWIG_csharp_wstring_callback = callback; -} -%} -#endif // SWIG_CSHARP_WSTRING_HELPER_ -#endif // SWIG_CSHARP_NO_WSTRING_HELPER - - -// wchar_t -%typemap(ctype) wchar_t "wchar_t" -%typemap(imtype) wchar_t "char" -%typemap(cstype) wchar_t "char" - -%typemap(csin) wchar_t "$csinput" -%typemap(csout, excode=SWIGEXCODE) wchar_t { - char ret = $imcall;$excode - return ret; - } -%typemap(csvarin, excode=SWIGEXCODE2) wchar_t %{ - set { - $imcall;$excode - } %} -%typemap(csvarout, excode=SWIGEXCODE2) wchar_t %{ - get { - char ret = $imcall;$excode - return ret; - } %} - -%typemap(in) wchar_t %{ $1 = ($1_ltype)$input; %} -%typemap(out) wchar_t %{ $result = (wchar_t)$1; %} - -%typemap(typecheck) wchar_t = char; - -// wchar_t * -%typemap(ctype) wchar_t * "wchar_t *" -%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string" -%typemap(cstype) wchar_t * "string" - -%typemap(csin) wchar_t * "$csinput" -%typemap(csout, excode=SWIGEXCODE) wchar_t * { - string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode - return ret; - } -%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{ - set { - $imcall;$excode - } %} -%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{ - get { - string ret = $imcall;$excode - return ret; - } %} - -%typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %} -%typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %} - -%typemap(typecheck) wchar_t * = char *; - diff --git a/macx64/bin/swig/share/swig/4.0.0/go/cdata.i b/macx64/bin/swig/share/swig/4.0.0/go/cdata.i deleted file mode 100644 index b4411af9..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/go/cdata.i +++ /dev/null @@ -1,97 +0,0 @@ -/* ----------------------------------------------------------------------------- - * cdata.i - * - * SWIG library file containing macros for manipulating raw C data as strings. - * ----------------------------------------------------------------------------- */ - -%{ -typedef struct SWIGCDATA { - char *data; - intgo len; -} SWIGCDATA; -%} - -%fragment("cdata", "header") %{ -struct swigcdata { - intgo size; - void *data; -}; -%} - -%typemap(gotype) SWIGCDATA "[]byte" - -%typemap(imtype) SWIGCDATA "uint64" - -%typemap(out, fragment="cdata") SWIGCDATA(struct swigcdata *swig_out) %{ - swig_out = (struct swigcdata *)malloc(sizeof(*swig_out)); - if (swig_out) { - swig_out->size = $1.len; - swig_out->data = malloc(swig_out->size); - if (swig_out->data) { - memcpy(swig_out->data, $1.data, swig_out->size); - } - } - $result = *(long long *)(void **)&swig_out; -%} - -%typemap(goout) SWIGCDATA %{ - { - type swigcdata struct { size int; data uintptr } - p := (*swigcdata)(unsafe.Pointer(uintptr($1))) - if p == nil || p.data == 0 { - $result = nil - } else { - b := make([]byte, p.size) - a := (*[0x7fffffff]byte)(unsafe.Pointer(p.data))[:p.size] - copy(b, a) - Swig_free(p.data) - Swig_free(uintptr(unsafe.Pointer(p))) - $result = b - } - } -%} - -/* ----------------------------------------------------------------------------- - * %cdata(TYPE [, NAME]) - * - * Convert raw C data to a binary string. - * ----------------------------------------------------------------------------- */ - -%define %cdata(TYPE,NAME...) - -%insert("header") { -#if #NAME == "" -static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) { -#else -static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) { -#endif - SWIGCDATA d; - d.data = (char *) ptr; -#if #TYPE != "void" - d.len = nelements*sizeof(TYPE); -#else - d.len = nelements; -#endif - return d; -} -} - -%typemap(default) int nelements "$1 = 1;" - -#if #NAME == "" -SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements); -#else -SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements); -#endif -%enddef - -%typemap(default) int nelements; - -%rename(cdata) ::cdata_void(void *ptr, int nelements); - -%cdata(void); - -/* Memory move function. Due to multi-argument typemaps this appears - to be wrapped as - void memmove(void *data, const char *s); */ -void memmove(void *data, char *indata, int inlen); diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_map.i b/macx64/bin/swig/share/swig/4.0.0/guile/std_map.i deleted file mode 100644 index f84e78bc..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/guile/std_map.i +++ /dev/null @@ -1,1370 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_map.i - * - * SWIG typemaps for std::map - * ----------------------------------------------------------------------------- */ - -%include - -// ------------------------------------------------------------------------ -// std::map -// -// The aim of all that follows would be to integrate std::map with -// Guile as much as possible, namely, to allow the user to pass and -// be returned Scheme association lists. -// const declarations are used to guess the intent of the function being -// exported; therefore, the following rationale is applied: -// -// -- f(std::map), f(const std::map&), f(const std::map*): -// the parameter being read-only, either a Scheme alist or a -// previously wrapped std::map can be passed. -// -- f(std::map&), f(std::map*): -// the parameter must be modified; therefore, only a wrapped std::map -// can be passed. -// -- std::map f(): -// the map is returned by copy; therefore, a Scheme alist -// is returned which is most easily used in other Scheme functions -// -- std::map& f(), std::map* f(), const std::map& f(), -// const std::map* f(): -// the map is returned by reference; therefore, a wrapped std::map -// is returned -// ------------------------------------------------------------------------ - -%{ -#include -#include -#include -%} - -// exported class - -namespace std { - - template > class map { - %typemap(in) map< K, T, C > { - if (scm_is_null($input)) { - $1 = std::map< K, T, C >(); - } else if (scm_is_pair($input)) { - $1 = std::map< K, T, C >(); - SCM alist = $input; - while (!scm_is_null(alist)) { - K* k; - T* x; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != 0) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - (($1_type &)$1)[*k] = *x; - alist = SCM_CDR(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp), - const map< K, T, C >* (std::map< K, T, C > temp) { - if (scm_is_null($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (scm_is_pair($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - SCM alist = $input; - while (!scm_is_null(alist)) { - K* k; - T* x; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != 0) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - temp[*k] = *x; - alist = SCM_CDR(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - SCM alist = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { - K* key = new K(i->first); - T* val = new T(i->second); - SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1); - SCM entry = scm_cons(k,x); - alist = scm_cons(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - /* native sequence? */ - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - /* check the first element only */ - K* k; - T* x; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (SWIG_ConvertPtr(key,(void**) &k, - $descriptor(K *), 0) != 0) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - /* wrapped map? */ - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - /* native sequence? */ - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - /* check the first element only */ - K* k; - T* x; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (SWIG_ConvertPtr(key,(void**) &k, - $descriptor(K *), 0) != 0) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - /* wrapped map? */ - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - const T& __getitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(const K& key, const T& x) { - (*self)[key] = x; - } - void __delitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(const K& key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - SCM keys() { - SCM result = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { - K* key = new K(i->first); - SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - result = scm_cons(k,result); - } - return result; - } - } - }; - - - // specializations for built-ins - - %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) - - template class map< K, T, C > { - %typemap(in) map< K, T, C > { - if (scm_is_null($input)) { - $1 = std::map< K, T, C >(); - } else if (scm_is_pair($input)) { - $1 = std::map< K, T, C >(); - SCM alist = $input; - while (!scm_is_null(alist)) { - T* x; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - if (!CHECK(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != 0) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - (($1_type &)$1)[CONVERT_FROM(key)] = *x; - alist = SCM_CDR(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp), - const map< K, T, C >* (std::map< K, T, C > temp) { - if (scm_is_null($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (scm_is_pair($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - SCM alist = $input; - while (!scm_is_null(alist)) { - T* x; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - if (!CHECK(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != 0) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - temp[CONVERT_FROM(key)] = *x; - alist = SCM_CDR(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - SCM alist = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { - T* val = new T(i->second); - SCM k = CONVERT_TO(i->first); - SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1); - SCM entry = scm_cons(k,x); - alist = scm_cons(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - T* x; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (!CHECK(key)) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - T* x; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (!CHECK(key)) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == 0) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T& __getitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(K key, const T& x) { - (*self)[key] = x; - } - void __delitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(K key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - SCM keys() { - SCM result = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { - SCM k = CONVERT_TO(i->first); - result = scm_cons(k,result); - } - return result; - } - } - }; - %enddef - - %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) - template class map< K, T, C > { - %typemap(in) map< K, T, C > { - if (scm_is_null($input)) { - $1 = std::map< K, T, C >(); - } else if (scm_is_pair($input)) { - $1 = std::map< K, T, C >(); - SCM alist = $input; - while (!scm_is_null(alist)) { - K* k; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (!CHECK(val)) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - if (!CHECK(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - (($1_type &)$1)[*k] = CONVERT_FROM(val); - alist = SCM_CDR(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp), - const map< K, T, C >* (std::map< K, T, C > temp) { - if (scm_is_null($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (scm_is_pair($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - SCM alist = $input; - while (!scm_is_null(alist)) { - K* k; - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (!CHECK(val)) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - if (!CHECK(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - temp[*k] = CONVERT_FROM(val); - alist = SCM_CDR(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - SCM alist = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { - K* key = new K(i->first); - SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - SCM x = CONVERT_TO(i->second); - SCM entry = scm_cons(k,x); - alist = scm_cons(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - K* k; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM val = SCM_CDR(head); - if (SWIG_ConvertPtr(val,(void **) &k, - $descriptor(K *), 0) != 0) { - $1 = 0; - } else { - if (CHECK(val)) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (CHECK(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - K* k; - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM val = SCM_CDR(head); - if (SWIG_ConvertPtr(val,(void **) &k, - $descriptor(K *), 0) != 0) { - $1 = 0; - } else { - if (CHECK(val)) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (CHECK(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T __getitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(const K& key, T x) { - (*self)[key] = x; - } - void __delitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(const K& key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - SCM keys() { - SCM result = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { - K* key = new K(i->first); - SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - result = scm_cons(k,result); - } - return result; - } - } - }; - %enddef - - %define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, - T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) - template<> class map< K, T, C > { - %typemap(in) map< K, T, C > { - if (scm_is_null($input)) { - $1 = std::map< K, T, C >(); - } else if (scm_is_pair($input)) { - $1 = std::map< K, T, C >(); - SCM alist = $input; - while (!scm_is_null(alist)) { - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - if (!CHECK_K(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (!CHECK_T(val)) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - if (!CHECK_T(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - (($1_type &)$1)[CONVERT_K_FROM(key)] = - CONVERT_T_FROM(val); - alist = SCM_CDR(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp), - const map< K, T, C >* (std::map< K, T, C > temp) { - if (scm_is_null($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (scm_is_pair($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - SCM alist = $input; - while (!scm_is_null(alist)) { - SCM entry, key, val; - entry = SCM_CAR(alist); - if (!scm_is_pair(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = SCM_CAR(entry); - val = SCM_CDR(entry); - if (!CHECK_K(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (!CHECK_T(val)) { - if (!scm_is_pair(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = SCM_CAR(val); - if (!CHECK_T(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val); - alist = SCM_CDR(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - SCM alist = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { - SCM k = CONVERT_K_TO(i->first); - SCM x = CONVERT_T_TO(i->second); - SCM entry = scm_cons(k,x); - alist = scm_cons(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (!CHECK_K(key)) { - $1 = 0; - } else { - if (CHECK_T(val)) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (CHECK_T(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (scm_is_null($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (scm_is_pair($input)) { - // check the first element only - SCM head = SCM_CAR($input); - if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); - SCM val = SCM_CDR(head); - if (!CHECK_K(key)) { - $1 = 0; - } else { - if (CHECK_T(val)) { - $1 = 1; - } else if (scm_is_pair(val)) { - val = SCM_CAR(val); - if (CHECK_T(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) == 0) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T __getitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(K key, T x) { - (*self)[key] = x; - } - void __delitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(K key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - SCM keys() { - SCM result = SCM_EOL; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { - SCM k = CONVERT_K_TO(i->first); - result = scm_cons(k,result); - } - return result; - } - } - }; - %enddef - - - specialize_std_map_on_key(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_key(int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_key(short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_key(long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_key(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_key(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_key(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_key(double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_key(float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_key(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - - specialize_std_map_on_value(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_value(int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_value(short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_value(long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_value(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_value(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_value(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_value(double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_value(float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_value(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(bool,scm_is_bool, - scm_is_true,SWIG_bool2scm, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(int,scm_is_number, - scm_to_long,scm_from_long, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(short,scm_is_number, - scm_to_long,scm_from_long, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(long,scm_is_number, - scm_to_long,scm_from_long, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(double,scm_is_number, - scm_to_double,scm_from_double, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(float,scm_is_number, - scm_to_double,scm_from_double, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - bool,scm_is_bool, - scm_is_true,SWIG_bool2scm); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - int,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - short,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - long,scm_is_number, - scm_to_long,scm_from_long); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - unsigned int,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - unsigned short,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - unsigned long,scm_is_number, - scm_to_ulong,scm_from_ulong); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - double,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - float,scm_is_number, - scm_to_double,scm_from_double); - specialize_std_map_on_both(std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm, - std::string,scm_is_string, - SWIG_scm2string,SWIG_string2scm); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.0.0/java/std_auto_ptr.i deleted file mode 100644 index 9b3cd731..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_auto_ptr.i +++ /dev/null @@ -1,27 +0,0 @@ -/* - The typemaps here allow to handle functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ - -%define %auto_ptr(TYPE) -%typemap (jni) std::auto_ptr "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(javaout) std::auto_ptr { - long cPtr = $jnicall; - return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); - } -%template() std::auto_ptr; -%enddef - -namespace std { - template class auto_ptr {}; -} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/arrays_javascript.i b/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/arrays_javascript.i deleted file mode 100644 index b9199d86..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/arrays_javascript.i +++ /dev/null @@ -1,123 +0,0 @@ -/* ----------------------------------------------------------------------------- - * arrays_javascript.i - * - * These typemaps give more natural support for arrays. The typemaps are not efficient - * as there is a lot of copying of the array values whenever the array is passed to C/C++ - * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. - * An exception is thrown if they are not. - * - * Example usage: - * Wrapping: - * - * %include - * %inline %{ - * extern int FiddleSticks[3]; - * %} - * - * Use from JavaScript like this: - * - * var fs = [10, 11, 12]; - * example.FiddleSticks = fs; - * fs = example.FiddleSticks; - * ----------------------------------------------------------------------------- */ - -%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} -%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} - -%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY] - (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) { - if (JSValueIsObject(context, $input)) - { - // Convert into Array - array = JSValueToObject(context, $input, NULL); - - length = $1_dim0; - - $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); - - // Get each element from array - for (i = 0; i < length; i++) - { - jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL); - - // Get primitive value from JSObject - res = SWIG_AsVal(int)(jsvalue, &temp); - if (!SWIG_IsOK(res)) - { - SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); - } - arg$argnum[i] = temp; - } - - } - else - { - SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); - } -} - -%typemap(freearg) int[], int[ANY] { - free($1); -} - -%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0) -{ - length = $1_dim0; - JSValueRef values[length]; - - for (i = 0; i < length; i++) - { - values[i] = SWIG_From(int)($1[i]); - } - - $result = JSObjectMakeArray(context, length, values, NULL); -} - -%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY] - (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) { - if (JSValueIsObject(context, $input)) - { - // Convert into Array - array = JSValueToObject(context, $input, NULL); - - length = $1_dim0; - - $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); - - // Get each element from array - for (i = 0; i < length; i++) - { - jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL); - - // Get primitive value from JSObject - res = SWIG_AsVal(double)(jsvalue, &temp); - if (!SWIG_IsOK(res)) - { - SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); - } - arg$argnum[i] = temp; - } - - } - else - { - SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); - } -} - -%typemap(freearg) double[], double[ANY] { - free($1); -} - -%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0) -{ - length = $1_dim0; - JSValueRef values[length]; - - for (i = 0; i < length; i++) - { - values[i] = SWIG_From(double)($1[i]); - } - - $result = JSObjectMakeArray(context, length, values, NULL); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/cdata.i b/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptkw.swg b/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptkw.swg deleted file mode 100644 index c3c11839..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptkw.swg +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_ -#define JAVASCRIPT_JAVASCRIPTKW_SWG_ - -/* Warnings for Java keywords */ -#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x` - -/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */ - -JAVASCRIPTKW(break); -JAVASCRIPTKW(case); -JAVASCRIPTKW(catch); -JAVASCRIPTKW(continue); -JAVASCRIPTKW(default); -JAVASCRIPTKW(delete); -JAVASCRIPTKW(do); -JAVASCRIPTKW(else); -JAVASCRIPTKW(finally); -JAVASCRIPTKW(for); -JAVASCRIPTKW(function); -JAVASCRIPTKW(if); -JAVASCRIPTKW(in); -JAVASCRIPTKW(instanceof); -JAVASCRIPTKW(new); -JAVASCRIPTKW(return); -JAVASCRIPTKW(switch); -JAVASCRIPTKW(this); -JAVASCRIPTKW(throw); -JAVASCRIPTKW(try); -JAVASCRIPTKW(typeof); -JAVASCRIPTKW(var); -JAVASCRIPTKW(void); -JAVASCRIPTKW(while); -JAVASCRIPTKW(with); - -/* others bad names if any*/ -// for example %namewarn("321:clone() is a javascript bad method name") *::clone(); - -#undef JAVASCRIPTKW - -#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_ diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_map.i b/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_map.i deleted file mode 100644 index 9fa10880..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_map.i +++ /dev/null @@ -1,81 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_map.i - * - * SWIG typemaps for std::map - * ----------------------------------------------------------------------------- */ - -%include - -// ------------------------------------------------------------------------ -// std::map -// ------------------------------------------------------------------------ - -%{ -#include -#include -#include -%} - -// exported class - -namespace std { - - template > class map { - // add typemaps here - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - const T& get(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void set(const K& key, const T& x) { - (*self)[key] = x; - } - void del(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(const K& key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - } - }; - -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - -} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/arrays_javascript.i b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/arrays_javascript.i deleted file mode 100644 index 22b50be8..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/arrays_javascript.i +++ /dev/null @@ -1,125 +0,0 @@ -/* ----------------------------------------------------------------------------- - * arrays_javascript.i - * - * These typemaps give more natural support for arrays. The typemaps are not efficient - * as there is a lot of copying of the array values whenever the array is passed to C/C++ - * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. - * An exception is thrown if they are not. - * - * Example usage: - * Wrapping: - * - * %include - * %inline %{ - * extern int FiddleSticks[3]; - * %} - * - * Use from JavaScript like this: - * - * var fs = [10, 11, 12]; - * example.FiddleSticks = fs; - * fs = example.FiddleSticks; - * ----------------------------------------------------------------------------- */ - -%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} -%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} - -%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY] - (int length = 0, v8::Local array, v8::Local jsvalue, int i = 0, int res = 0, $*1_ltype temp) { - if ($input->IsArray()) - { - // Convert into Array - array = v8::Local::Cast($input); - - length = $1_dim0; - - $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); - - // Get each element from array - for (i = 0; i < length; i++) - { - jsvalue = array->Get(i); - - // Get primitive value from JSObject - res = SWIG_AsVal(int)(jsvalue, &temp); - if (!SWIG_IsOK(res)) - { - SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); - } - arg$argnum[i] = temp; - } - - } - else - { - SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); - } -} - -%typemap(freearg) int[], int[ANY] { - free($1); -} - -%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0) -{ - length = $1_dim0; - v8::Local array = v8::Array::New(length); - - for (i = 0; i < length; i++) - { - array->Set(i, SWIG_From(int)($1[i])); - } - - - $result = array; -} - -%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY] - (int length = 0, v8::Local array, v8::Local jsvalue, int i = 0, int res = 0, $*1_ltype temp) { - if ($input->IsArray()) - { - // Convert into Array - array = v8::Local::Cast($input); - - length = $1_dim0; - - $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); - - // Get each element from array - for (i = 0; i < length; i++) - { - jsvalue = array->Get(i); - - // Get primitive value from JSObject - res = SWIG_AsVal(double)(jsvalue, &temp); - if (!SWIG_IsOK(res)) - { - SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); - } - arg$argnum[i] = temp; - } - - } - else - { - SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); - } -} - -%typemap(freearg) double[], double[ANY] { - free($1); -} - -%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0) -{ - length = $1_dim0; - v8::Local array = v8::Array::New(length); - - for (i = 0; i < length; i++) - { - array->Set(i, SWIG_From(double)($1[i])); - } - - - $result = array; -} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/ccomplex.i b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/ccomplex.i deleted file mode 100644 index 8eda920b..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/ccomplex.i +++ /dev/null @@ -1,26 +0,0 @@ -/* ----------------------------------------------------------------------------- - * ccomplex.i - * - * C complex typemaps - * ISO C99: 7.3 Complex arithmetic - * ----------------------------------------------------------------------------- */ - - -%include - -%{ -#include -%} - - -/* C complex constructor */ -#define CCplxConst(r, i) ((r) + I*(i)) - -%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); - -/* declaring the typemaps */ -%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/cdata.i b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripthelpers.swg b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripthelpers.swg deleted file mode 100644 index 80fbd7aa..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripthelpers.swg +++ /dev/null @@ -1,112 +0,0 @@ -%insert(runtime) %{ - -// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) -typedef v8::InvocationCallback SwigV8FunctionCallback; -typedef v8::AccessorGetter SwigV8AccessorGetterCallback; -typedef v8::AccessorSetter SwigV8AccessorSetterCallback; -typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid; -#elif (V8_MAJOR_VERSION-0) < 5 -typedef v8::FunctionCallback SwigV8FunctionCallback; -typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback; -typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback; -typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfoVoid; -#else -typedef v8::FunctionCallback SwigV8FunctionCallback; -typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback; -typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback; -typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfoVoid; -#endif - -/** - * Creates a class template for a class with specified initialization function. - */ -SWIGRUNTIME v8::Handle SWIGV8_CreateClassTemplate(const char* symbol) { - SWIGV8_HANDLESCOPE_ESC(); - - v8::Local class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID(); - class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol)); - - v8::Handle inst_templ = class_templ->InstanceTemplate(); - inst_templ->SetInternalFieldCount(1); - - v8::Handle equals_templ = class_templ->PrototypeTemplate(); - equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals)); - - v8::Handle cptr_templ = class_templ->PrototypeTemplate(); - cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr)); - - SWIGV8_ESCAPE(class_templ); -} - -/** - * Registers a class method with given name for a given class template. - */ -SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle class_templ, const char* symbol, - SwigV8FunctionCallback _func) { - v8::Handle proto_templ = class_templ->PrototypeTemplate(); - proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)); -} - -/** - * Registers a class property with given name for a given class template. - */ -SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle class_templ, const char* symbol, - SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { - v8::Handle proto_templ = class_templ->InstanceTemplate(); - proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); -} - -/** - * Registers a class method with given name for a given object. - */ -SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle obj, const char* symbol, - const SwigV8FunctionCallback& _func) { - obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction()); -} - -/** - * Registers a class method with given name for a given object. - */ -SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle obj, const char* symbol, - SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { -#if (V8_MAJOR_VERSION-0) < 5 - obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); -#else - obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter); -#endif -} - -#if (V8_MAJOR_VERSION-0) < 5 -SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid& info) -#else -SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid& info) -#endif -{ - char buffer[256]; - char msg[512]; - int res; - -#if (V8_MAJOR_VERSION-0) < 5 - property->WriteUtf8(buffer, 256); - res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); -#else - v8::Local sproperty; - if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) { - SWIGV8_WRITE_UTF8(sproperty, buffer, 256); - res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); - } - else { - res = -1; - } -#endif - - if(res<0) { - SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); - } else { - SWIG_exception(SWIG_ERROR, msg); - } -fail: ; -} - -%} // v8_helper_functions diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptkw.swg b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptkw.swg deleted file mode 100644 index c3c11839..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptkw.swg +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_ -#define JAVASCRIPT_JAVASCRIPTKW_SWG_ - -/* Warnings for Java keywords */ -#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x` - -/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */ - -JAVASCRIPTKW(break); -JAVASCRIPTKW(case); -JAVASCRIPTKW(catch); -JAVASCRIPTKW(continue); -JAVASCRIPTKW(default); -JAVASCRIPTKW(delete); -JAVASCRIPTKW(do); -JAVASCRIPTKW(else); -JAVASCRIPTKW(finally); -JAVASCRIPTKW(for); -JAVASCRIPTKW(function); -JAVASCRIPTKW(if); -JAVASCRIPTKW(in); -JAVASCRIPTKW(instanceof); -JAVASCRIPTKW(new); -JAVASCRIPTKW(return); -JAVASCRIPTKW(switch); -JAVASCRIPTKW(this); -JAVASCRIPTKW(throw); -JAVASCRIPTKW(try); -JAVASCRIPTKW(typeof); -JAVASCRIPTKW(var); -JAVASCRIPTKW(void); -JAVASCRIPTKW(while); -JAVASCRIPTKW(with); - -/* others bad names if any*/ -// for example %namewarn("321:clone() is a javascript bad method name") *::clone(); - -#undef JAVASCRIPTKW - -#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_ diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptrun.swg b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptrun.swg deleted file mode 100644 index 2452f404..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptrun.swg +++ /dev/null @@ -1,675 +0,0 @@ -/* --------------------------------------------------------------------------- - * These typedefs and defines are used to deal with v8 API changes - * - * ---------------------------------------------------------------------------*/ - -// First v8 version that uses "SetWeak" and not "MakeWeak" - -#define SWIGV8_SETWEAK_VERSION 0x032224 - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803) -#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len) -#else -#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len) -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) -typedef v8::Handle SwigV8ReturnValue; -typedef v8::Arguments SwigV8Arguments; -typedef v8::AccessorInfo SwigV8PropertyCallbackInfo; -#define SWIGV8_RETURN(val) return scope.Close(val) -#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val) -#else -typedef void SwigV8ReturnValue; -typedef v8::FunctionCallbackInfo SwigV8Arguments; -typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfo; -#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return -#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117) -#define SWIGV8_HANDLESCOPE() v8::HandleScope scope -#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope -#define SWIGV8_ESCAPE(val) return scope.Close(val) -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224) -#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent()); -#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent()); -#define SWIGV8_ESCAPE(val) return scope.Close(val) -#else -#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent()); -#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()); -#define SWIGV8_ESCAPE(val) return scope.Escape(val) -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224) -#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size) -#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent() -#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err) -#define SWIGV8_STRING_NEW(str) v8::String::New(str) -#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym) -#else -#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size) -#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext() -#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err) -#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str) -#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym) -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318) -#define SWIGV8_ARRAY_NEW() v8::Array::New() -#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool) -#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val) -#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func) -#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New() -#define SWIGV8_INT32_NEW(num) v8::Int32::New(num) -#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num) -#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num) -#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num) -#define SWIGV8_OBJECT_NEW() v8::Object::New() -#define SWIGV8_UNDEFINED() v8::Undefined() -#define SWIGV8_NULL() v8::Null() -#else -#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent()) -#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool) -#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val) -#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func) -#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New(v8::Isolate::GetCurrent()) -#define SWIGV8_INT32_NEW(num) v8::Int32::New(v8::Isolate::GetCurrent(), num) -#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(v8::Isolate::GetCurrent(), num) -#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), num) -#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num) -#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent()) -#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent()) -#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent()) -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) -#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent::New(class); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) -#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent::New(v8::Isolate::GetCurrent(), class); -#else -#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class); -#endif - -#ifdef NODE_VERSION -#if NODE_VERSION_AT_LEAST(10, 12, 0) -#define SWIG_NODE_AT_LEAST_1012 -#endif -#endif - -//Necessary to check Node.js version because V8 API changes are backported in Node.js -#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \ - (!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7) -#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject() -#define SWIGV8_TO_STRING(handle) (handle)->ToString() -#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue() -#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue() -#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue() -#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len) -#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length() -#else -#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked() -#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked() -#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked() -#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked() -#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked() -#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len) -#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent()) -#endif - -/* --------------------------------------------------------------------------- - * Error handling - * - * ---------------------------------------------------------------------------*/ - -#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg) -#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0) -#define SWIG_fail goto fail -#define SWIGV8_OVERLOAD false - -SWIGINTERN void SWIG_V8_Raise(const char *msg) { - SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); -} - -/* - Note: There are two contexts for handling errors. - A static V8ErrorHandler is used in not overloaded methods. - For overloaded methods the throwing type checking mechanism is used - during dispatching. As V8 exceptions can not be reset properly - the trick is to use a dynamic ErrorHandler with same local name as the global - one. - - - See definition of SWIG_Error above. - - See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload', - and 'JS_function_dispatch_case' in javascriptcode.swg - -*/ -class V8ErrorHandler { -public: - virtual ~V8ErrorHandler() {} - virtual void error(int code, const char *msg) { - SWIG_V8_Raise(msg); - } -}; -// this is used in usually -SWIGRUNTIME V8ErrorHandler SWIGV8_ErrorHandler; - -// instances of this are used in overloaded functions -class OverloadErrorHandler: public V8ErrorHandler { -public: - virtual void error(int code, const char *msg) { - err = v8::Exception::Error(SWIGV8_STRING_NEW(msg)); - if(code != SWIG_TypeError) { - SWIGV8_THROW_EXCEPTION(err); - } - } - v8::Handle err; -}; - -/* --------------------------------------------------------------------------- - * Basic Proxy object - * - * ---------------------------------------------------------------------------*/ - -// Note: to trigger the v8 gc more often one can tell v8 about the memory consumption -// TODO: we could add a v8 specific parameter to control this value -#define SWIGV8_AVG_OBJ_SIZE 1000 - -class SWIGV8_Proxy { -public: - SWIGV8_Proxy(): swigCMemOwn(false), swigCObject(0), info(0) { - SWIGV8_ADJUST_MEMORY(SWIGV8_AVG_OBJ_SIZE); - }; - - ~SWIGV8_Proxy() { -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - handle.ClearWeak(); - handle.Dispose(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - handle.ClearWeak(v8::Isolate::GetCurrent()); - handle.Dispose(v8::Isolate::GetCurrent()); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - handle.ClearWeak(); - handle.Dispose(); -#else - handle.ClearWeak(); - handle.Reset(); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - handle.Clear(); -#endif - - SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE); - } - - bool swigCMemOwn; - void *swigCObject; - swig_type_info *info; - v8::Persistent handle; -}; - -class SWIGV8_ClientData { -public: - v8::Persistent class_templ; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - void (*dtor) (v8::Persistent< v8::Value> object, void *parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy); -#elif (V8_MAJOR_VERSION-0) < 5 - void (*dtor) (const v8::WeakCallbackData &data); -#else - void (*dtor) (const v8::WeakCallbackInfo &data); -#endif -}; - -SWIGRUNTIME v8::Persistent SWIGV8_SWIGTYPE_Proxy_class_templ; - -SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle objRef, void **ptr, swig_type_info *info, int flags) { - SWIGV8_HANDLESCOPE(); - - if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) - v8::Handle cdataRef = objRef->GetInternalField(0); - SWIGV8_Proxy *cdata = static_cast(v8::External::Unwrap(cdataRef)); -#else - SWIGV8_Proxy *cdata = static_cast(objRef->GetAlignedPointerFromInternalField(0)); -#endif - - if(cdata == NULL) { - return SWIG_ERROR; - } - if(cdata->info != info) { - swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info); - if (!tc && cdata->info->name) { - tc = SWIG_TypeCheck(cdata->info->name, info); - } - bool type_valid = tc != 0; - if(!type_valid) { - return SWIG_TypeError; - } - } - *ptr = cdata->swigCObject; - if(flags & SWIG_POINTER_DISOWN) { - cdata->swigCMemOwn = false; - } - return SWIG_OK; -} - - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) -SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) -SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) -SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 -SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData &data) { - SWIGV8_Proxy *proxy = data.GetParameter(); -#else -SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo &data) { - SWIGV8_Proxy *proxy = data.GetParameter(); -#endif - - delete proxy; -} - -SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle valRef, void **ptr) { - if(!valRef->IsObject()) { - return SWIG_TypeError; - } - v8::Handle objRef = SWIGV8_TO_OBJECT(valRef); - - if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) - v8::Handle cdataRef = objRef->GetInternalField(0); - SWIGV8_Proxy *cdata = static_cast(v8::External::Unwrap(cdataRef)); -#else - SWIGV8_Proxy *cdata = static_cast(objRef->GetAlignedPointerFromInternalField(0)); -#endif - - if(cdata == NULL) { - return SWIG_ERROR; - } - - *ptr = cdata->swigCObject; - - return SWIG_OK; -} - -SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle obj, void *ptr, swig_type_info *info, int flags) { - SWIGV8_Proxy *cdata = new SWIGV8_Proxy(); - cdata->swigCObject = ptr; - cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0; - cdata->info = info; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) - obj->SetPointerInInternalField(0, cdata); -#else - obj->SetAlignedPointerInInternalField(0, cdata); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - cdata->handle = v8::Persistent::New(obj); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - cdata->handle = v8::Persistent::New(v8::Isolate::GetCurrent(), obj); -#else - cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - // clientdata must be set for owned data as we need to register the dtor - if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { - cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); - } else { - cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); - } -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918) - if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { - cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); - } else { - cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor); - } -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { - cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); - } else { - cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); - } -#elif (V8_MAJOR_VERSION-0) < 5 - if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { - cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); - } else { - cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor); - } -#else - if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { - cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter); - } else { - cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter); - } -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - cdata->handle.MarkIndependent(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - cdata->handle.MarkIndependent(v8::Isolate::GetCurrent()); -#else - cdata->handle.MarkIndependent(); -#endif - -} - -SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle valRef, void **ptr, swig_type_info *info, int flags) { - SWIGV8_HANDLESCOPE(); - - /* special case: JavaScript null => C NULL pointer */ - if(valRef->IsNull()) { - *ptr=0; - return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; - } - if(!valRef->IsObject()) { - return SWIG_TypeError; - } - v8::Handle objRef = SWIGV8_TO_OBJECT(valRef); - return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags); -} - -SWIGRUNTIME v8::Handle SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) { - SWIGV8_HANDLESCOPE_ESC(); - - v8::Handle class_templ; - - if (ptr == NULL) { -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - SWIGV8_ESCAPE(SWIGV8_NULL()); -#else - v8::Local result = SWIGV8_NULL(); - SWIGV8_ESCAPE(result); -#endif - } - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - if(info->clientdata != 0) { - class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ; - } else { - class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ; - } -#else - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - - if(info->clientdata != 0) { - class_templ = v8::Local::New(isolate, ((SWIGV8_ClientData*) info->clientdata)->class_templ); - } else { - class_templ = v8::Local::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ); - } -#endif - -// v8::Handle result = class_templ->InstanceTemplate()->NewInstance(); - v8::Local result = class_templ->InstanceTemplate()->NewInstance(); - SWIGV8_SetPrivateData(result, ptr, info, flags); - - SWIGV8_ESCAPE(result); -} - -#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags) -#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags) - -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags) - -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_V8_ConvertPtr(obj, pptr, type, 0) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_V8_NewPointerObj(ptr, type, 0) - -#define SWIG_GetInstancePtr(obj, ptr) SWIG_V8_GetInstancePtr(obj, ptr) - -SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) { - SWIGV8_HANDLESCOPE(); - - v8::Handle jsresult; - void *arg1 = (void *) 0 ; - void *arg2 = (void *) 0 ; - bool result; - int res1; - int res2; - - if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for equals."); - - res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ERROR, "Could not get pointer from 'this' object for equals."); - } - res2 = SWIG_GetInstancePtr(args[0], &arg2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "1"" of type '" "void *""'"); - } - - result = (bool)(arg1 == arg2); - jsresult = SWIGV8_BOOLEAN_NEW(result); - - SWIGV8_RETURN(jsresult); - goto fail; -fail: - SWIGV8_RETURN(SWIGV8_UNDEFINED()); -} - -SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) { - SWIGV8_HANDLESCOPE(); - - v8::Handle jsresult; - void *arg1 = (void *) 0 ; - long result; - int res1; - - res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCPtr" "', argument " "1"" of type '" "void *""'"); - } - - result = (long)arg1; - jsresult = SWIGV8_NUMBER_NEW(result); - - SWIGV8_RETURN(jsresult); - goto fail; -fail: - SWIGV8_RETURN(SWIGV8_UNDEFINED()); -} - -/* --------------------------------------------------------------------------- - * PackedData object - * - * ---------------------------------------------------------------------------*/ - -class SwigV8PackedData { -public: - SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(data), size(size), type(type) {}; - - ~SwigV8PackedData() { - }; - - void *data; - size_t size; - swig_type_info *type; - - v8::Persistent handle; -}; - -SWIGRUNTIMEINLINE -int SwigV8Packed_Check(v8::Handle valRef) { - SWIGV8_HANDLESCOPE(); - - v8::Handle objRef = SWIGV8_TO_OBJECT(valRef); - if(objRef->InternalFieldCount() < 1) return false; -#if (V8_MAJOR_VERSION-0) < 5 - v8::Handle flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); -#else - v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); - v8::Local flag; - if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag)) - return false; -#endif - return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag)); -} - -SWIGRUNTIME -swig_type_info *SwigV8Packed_UnpackData(v8::Handle valRef, void *ptr, size_t size) { - if (SwigV8Packed_Check(valRef)) { - SWIGV8_HANDLESCOPE(); - - SwigV8PackedData *sobj; - - v8::Handle objRef = SWIGV8_TO_OBJECT(valRef); - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) - v8::Handle cdataRef = objRef->GetInternalField(0); - sobj = static_cast(v8::External::Unwrap(cdataRef)); -#else - sobj = static_cast(objRef->GetAlignedPointerFromInternalField(0)); -#endif - if (sobj == NULL || sobj->size != size) return 0; - memcpy(ptr, sobj->data, size); - return sobj->type; - } else { - return 0; - } -} - -SWIGRUNTIME -int SWIGV8_ConvertPacked(v8::Handle valRef, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) -SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) { - SwigV8PackedData *cdata = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) -SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent object, void *parameter) { - SwigV8PackedData *cdata = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) -SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent *object, SwigV8PackedData *cdata) { -#elif (V8_MAJOR_VERSION-0) < 5 -SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData &data) { - v8::Local object = data.GetValue(); - SwigV8PackedData *cdata = data.GetParameter(); -#else -SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo &data) { - SwigV8PackedData *cdata = data.GetParameter(); -#endif - - delete cdata; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - object.Clear(); - object.Dispose(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - object.Clear(); - object.Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - object->Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - object->Dispose(); -#elif (V8_MAJOR_VERSION-0) < 5 - object.Clear(); -#endif -} - -SWIGRUNTIME -v8::Handle SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) { - SWIGV8_HANDLESCOPE_ESC(); - - SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type); -// v8::Handle obj = SWIGV8_OBJECT_NEW(); - v8::Local obj = SWIGV8_OBJECT_NEW(); - -#if (V8_MAJOR_VERSION-0) < 5 - obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true)); -#else - v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); - obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true)); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) - obj->SetPointerInInternalField(0, cdata); -#else - obj->SetAlignedPointerInInternalField(0, cdata); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - cdata->handle = v8::Persistent::New(obj); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - cdata->handle = v8::Persistent::New(v8::Isolate::GetCurrent(), obj); -#else - cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); -#endif - - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918) - cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); -#elif (V8_MAJOR_VERSION-0) < 5 - cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete); -// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete); -#else - cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - cdata->handle.MarkIndependent(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - cdata->handle.MarkIndependent(v8::Isolate::GetCurrent()); -#else - cdata->handle.MarkIndependent(); -#endif - - SWIGV8_ESCAPE(obj); -} - -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIGV8_NewPackedObj(ptr, sz, type) - - -/* --------------------------------------------------------------------------- - * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg) - * - * ---------------------------------------------------------------------------*/ - -SWIGRUNTIME - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) -v8::Handle SWIGV8_AppendOutput(v8::Handle result, v8::Handle obj) { -#else -v8::Handle SWIGV8_AppendOutput(v8::Local result, v8::Handle obj) { -#endif - SWIGV8_HANDLESCOPE_ESC(); - - if (result->IsUndefined()) { - result = SWIGV8_ARRAY_NEW(); - } -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - v8::Handle arr = v8::Handle::Cast(result); -#else - v8::Local arr = v8::Local::Cast(result); -#endif - arr->Set(arr->Length(), obj); - - SWIGV8_ESCAPE(arr); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptruntime.swg b/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptruntime.swg deleted file mode 100644 index c78e04ef..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptruntime.swg +++ /dev/null @@ -1,68 +0,0 @@ -/* ----------------------------------------------------------------------------- - * javascriptruntime.swg - * - * ----------------------------------------------------------------------------- */ - -// V8 Version Macro -// ---------------- -// -// v8 added version macros V8_MAJOR_VERSION, V8_MINOR_VERSION, V8_BUILD_NUMBER -// and V8_PATCH_LEVEL in version 4.3.0. SWIG generated code uses these if -// they are defined - to support earlier versions you can specify the V8 version -// in use via the command line when you run SWIG: -// -// swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i -// -// Or code in the interface file using SWIG_V8_VERSION: -// -// %begin %{#define SWIG_V8_VERSION 0x031110%} -// -// This is specified as a hex constant, but the constant is read as pairs of -// decimal digits, so for V8 3.25.30 use constant 0x032530. This scheme can't -// represent components > 99, but this constant is only useful for V8 < 4.3.0, -// and no V8 versions from that era had a component > 99. - -%define %swig_v8_define_version(version) -%insert("runtime") %{ -#ifndef SWIG_V8_VERSION -#define SWIG_V8_VERSION version -#endif -%} -%enddef - -#ifdef V8_VERSION -%swig_v8_define_version(V8_VERSION) -#else -// HACK: defining a default version -%swig_v8_define_version(0x031110) -#endif - - -// Node support -// ------------ - -#ifdef BUILDING_NODE_EXTENSION -%insert("runtime") %{ -#include -//Older version of node.h does not include this -#include -%} -#endif - - -// V8 runtime -// ---------- - -%insert(runtime) %{ -#include - -#include -#include -#include -%} - -%insert(runtime) "swigrun.swg"; /* SWIG API */ -%insert(runtime) "swigerrors.swg"; /* SWIG errors */ - -%insert(runtime) "javascriptrun.swg" - diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_map.i b/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_map.i deleted file mode 100644 index 1d3eec24..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_map.i +++ /dev/null @@ -1,1388 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_map.i - * - * SWIG typemaps for std::map - * ----------------------------------------------------------------------------- */ - -%include - -// ------------------------------------------------------------------------ -// std::map -// -// The aim of all that follows would be to integrate std::map with -// MzScheme as much as possible, namely, to allow the user to pass and -// be returned Scheme association lists. -// const declarations are used to guess the intent of the function being -// exported; therefore, the following rationale is applied: -// -// -- f(std::map), f(const std::map&), f(const std::map*): -// the parameter being read-only, either a Scheme alist or a -// previously wrapped std::map can be passed. -// -- f(std::map&), f(std::map*): -// the parameter must be modified; therefore, only a wrapped std::map -// can be passed. -// -- std::map f(): -// the map is returned by copy; therefore, a Scheme alist -// is returned which is most easily used in other Scheme functions -// -- std::map& f(), std::map* f(), const std::map& f(), -// const std::map* f(): -// the map is returned by reference; therefore, a wrapped std::map -// is returned -// ------------------------------------------------------------------------ - -%{ -#include -#include -#include -%} - -// exported class - -namespace std { - - template > class map { - %typemap(in) map< K, T, C > (std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - $1 = std::map< K, T, C >(); - } else if (SCHEME_PAIRP($input)) { - $1 = std::map< K, T, C >(); - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - K* k; - T* x; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == -1) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - (($1_type &)$1)[*k] = *x; - alist = scheme_cdr(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp, - std::map< K, T, C >* m), - const map< K, T, C >* (std::map< K, T, C > temp, - std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (SCHEME_PAIRP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - K* k; - T* x; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == -1) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - temp[*k] = *x; - alist = scheme_cdr(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - Scheme_Object* alist = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { - K* key = new K(i->first); - T* val = new T(i->second); - Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - Scheme_Object* x = SWIG_NewPointerObj(val,$descriptor(T *), 1); - Scheme_Object* entry = scheme_make_pair(k,x); - alist = scheme_make_pair(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - /* native sequence? */ - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - /* check the first element only */ - K* k; - T* x; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (SWIG_ConvertPtr(key,(void**) &k, - $descriptor(K *), 0) == -1) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - /* wrapped map? */ - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - /* native sequence? */ - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - /* check the first element only */ - K* k; - T* x; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (SWIG_ConvertPtr(key,(void**) &k, - $descriptor(K *), 0) == -1) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - /* wrapped map? */ - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T& __getitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(const K& key, const T& x) { - (*self)[key] = x; - } - void __delitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(const K& key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - Scheme_Object* keys() { - Scheme_Object* result = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { - K* key = new K(i->first); - Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - result = scheme_make_pair(k,result); - } - return result; - } - } - }; - - - // specializations for built-ins - - %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) - - template class map< K, T, C > { - %typemap(in) map< K, T, C > (std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - $1 = std::map< K, T, C >(); - } else if (SCHEME_PAIRP($input)) { - $1 = std::map< K, T, C >(); - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - T* x; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - if (!CHECK(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == -1) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - (($1_type &)$1)[CONVERT_FROM(key)] = *x; - alist = scheme_cdr(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp, - std::map< K, T, C >* m), - const map< K, T, C >* (std::map< K, T, C > temp, - std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (SCHEME_PAIRP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - T* x; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - if (!CHECK(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) == -1) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); - } - temp[CONVERT_FROM(key)] = *x; - alist = scheme_cdr(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - Scheme_Object* alist = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { - T* val = new T(i->second); - Scheme_Object* k = CONVERT_TO(i->first); - Scheme_Object* x = SWIG_NewPointerObj(val,$descriptor(T *), 1); - Scheme_Object* entry = scheme_make_pair(k,x); - alist = scheme_make_pair(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - T* x; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (!CHECK(key)) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - T* x; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (!CHECK(key)) { - $1 = 0; - } else { - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (SWIG_ConvertPtr(val,(void**) &x, - $descriptor(T *), 0) != -1) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T& __getitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(K key, const T& x) { - (*self)[key] = x; - } - void __delitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(K key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - Scheme_Object* keys() { - Scheme_Object* result = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { - Scheme_Object* k = CONVERT_TO(i->first); - result = scheme_make_pair(k,result); - } - return result; - } - } - }; - %enddef - - %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) - template class map< K, T, C > { - %typemap(in) map< K, T, C > (std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - $1 = std::map< K, T, C >(); - } else if (SCHEME_PAIRP($input)) { - $1 = std::map< K, T, C >(); - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - K* k; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (!CHECK(val)) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - if (!CHECK(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - (($1_type &)$1)[*k] = CONVERT_FROM(val); - alist = scheme_cdr(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp, - std::map< K, T, C >* m), - const map< K, T, C >* (std::map< K, T, C > temp, - std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (SCHEME_PAIRP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - K* k; - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); - if (!CHECK(val)) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - if (!CHECK(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - temp[*k] = CONVERT_FROM(val); - alist = scheme_cdr(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - Scheme_Object* alist = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { - K* key = new K(i->first); - Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - Scheme_Object* x = CONVERT_TO(i->second); - Scheme_Object* entry = scheme_make_pair(k,x); - alist = scheme_make_pair(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - K* k; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (SWIG_ConvertPtr(val,(void **) &k, - $descriptor(K *), 0) == -1) { - $1 = 0; - } else { - if (CHECK(val)) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (CHECK(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - K* k; - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (SWIG_ConvertPtr(val,(void **) &k, - $descriptor(K *), 0) == -1) { - $1 = 0; - } else { - if (CHECK(val)) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (CHECK(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T __getitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(const K& key, T x) { - (*self)[key] = x; - } - void __delitem__(const K& key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(const K& key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - Scheme_Object* keys() { - Scheme_Object* result = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { - K* key = new K(i->first); - Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); - result = scheme_make_pair(k,result); - } - return result; - } - } - }; - %enddef - - %define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, - T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) - template<> class map< K, T, C > { - %typemap(in) map< K, T, C > (std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - $1 = std::map< K, T, C >(); - } else if (SCHEME_PAIRP($input)) { - $1 = std::map< K, T, C >(); - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - if (!CHECK_K(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (!CHECK_T(val)) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - if (!CHECK_T(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - (($1_type &)$1)[CONVERT_K_FROM(key)] = - CONVERT_T_FROM(val); - alist = scheme_cdr(alist); - } - } else { - $1 = *(($&1_type) - SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); - } - } - %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp, - std::map< K, T, C >* m), - const map< K, T, C >* (std::map< K, T, C > temp, - std::map< K, T, C >* m) { - if (SCHEME_NULLP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - } else if (SCHEME_PAIRP($input)) { - temp = std::map< K, T, C >(); - $1 = &temp; - Scheme_Object* alist = $input; - while (!SCHEME_NULLP(alist)) { - Scheme_Object *entry, *key, *val; - entry = scheme_car(alist); - if (!SCHEME_PAIRP(entry)) - SWIG_exception(SWIG_TypeError,"alist expected"); - key = scheme_car(entry); - val = scheme_cdr(entry); - if (!CHECK_K(key)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - if (!CHECK_T(val)) { - if (!SCHEME_PAIRP(val)) - SWIG_exception(SWIG_TypeError,"alist expected"); - val = scheme_car(val); - if (!CHECK_T(val)) - SWIG_exception(SWIG_TypeError, - "map<" #K "," #T "," #C "> expected"); - } - temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val); - alist = scheme_cdr(alist); - } - } else { - $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); - } - } - %typemap(out) map< K, T, C > { - Scheme_Object* alist = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { - Scheme_Object* k = CONVERT_K_TO(i->first); - Scheme_Object* x = CONVERT_T_TO(i->second); - Scheme_Object* entry = scheme_make_pair(k,x); - alist = scheme_make_pair(entry,alist); - } - $result = alist; - } - %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (!CHECK_K(key)) { - $1 = 0; - } else { - if (CHECK_T(val)) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (CHECK_T(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $&1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, - const map< K, T, C >* { - // native sequence? - if (SCHEME_NULLP($input)) { - /* an empty sequence can be of any type */ - $1 = 1; - } else if (SCHEME_PAIRP($input)) { - // check the first element only - Scheme_Object* head = scheme_car($input); - if (SCHEME_PAIRP(head)) { - Scheme_Object* key = scheme_car(head); - Scheme_Object* val = scheme_cdr(head); - if (!CHECK_K(key)) { - $1 = 0; - } else { - if (CHECK_T(val)) { - $1 = 1; - } else if (SCHEME_PAIRP(val)) { - val = scheme_car(val); - if (CHECK_T(val)) - $1 = 1; - else - $1 = 0; - } else { - $1 = 0; - } - } - } else { - $1 = 0; - } - } else { - // wrapped map? - std::map< K, T, C >* m; - if (SWIG_ConvertPtr($input,(void **) &m, - $1_descriptor, 0) != -1) - $1 = 1; - else - $1 = 0; - } - } - %rename("length") size; - %rename("null?") empty; - %rename("clear!") clear; - %rename("ref") __getitem__; - %rename("set!") __setitem__; - %rename("delete!") __delitem__; - %rename("has-key?") has_key; - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; - typedef std::pair< const K, T > value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - map(); - map(const map& other); - - unsigned int size() const; - bool empty() const; - void clear(); - %extend { - T __getitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } - void __setitem__(K key, T x) { - (*self)[key] = x; - } - void __delitem__(K key) throw (std::out_of_range) { - std::map< K, T, C >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } - bool has_key(K key) { - std::map< K, T, C >::iterator i = self->find(key); - return i != self->end(); - } - Scheme_Object* keys() { - Scheme_Object* result = scheme_null; - for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { - Scheme_Object* k = CONVERT_K_TO(i->first); - result = scheme_make_pair(k,result); - } - return result; - } - } - }; - %enddef - - - specialize_std_map_on_key(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_key(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_key(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_key(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_key(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - - specialize_std_map_on_value(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_value(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_value(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_value(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_value(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - bool,SCHEME_BOOLP, - SCHEME_TRUEP,swig_make_boolean); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - unsigned int,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - unsigned short,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - unsigned long,SCHEME_INTP, - SCHEME_INT_VAL,scheme_make_integer_value); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - double,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - float,SCHEME_REALP, - scheme_real_to_double,scheme_make_double); - specialize_std_map_on_both(std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string, - std::string,SCHEME_STRINGP, - swig_scm_to_string,swig_make_string); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocamldec.swg b/macx64/bin/swig/share/swig/4.0.0/ocaml/ocamldec.swg deleted file mode 100644 index 0c2faf77..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocamldec.swg +++ /dev/null @@ -1,212 +0,0 @@ -/* ----------------------------------------------------------------------------- - * ocamldec.swg - * - * Ocaml runtime code -- declarations - * ----------------------------------------------------------------------------- */ - -#include -#include -#include - -#ifdef __cplusplus -#define SWIGEXT extern "C" -SWIGEXT { -#else -#define SWIGEXT -#endif -#define value caml_value_t -#define CAML_VALUE caml_value_t -#define CAML_NAME_SPACE -#include -#include -#include -#include -#include -#include -#include - -#if defined(CAMLassert) -/* Both this macro and version.h were introduced in version 4.02.0 */ -#include -#else -#define OCAML_VERSION 0 /* Unknown, but < 40200 */ -#endif - -#define caml_array_set swig_caml_array_set - -/* Adapted from memory.h and mlvalues.h */ - -#define SWIG_CAMLlocal1(x) \ - caml_value_t x = 0; \ - CAMLxparam1 (x) - -#define SWIG_CAMLlocal2(x, y) \ - caml_value_t x = 0, y = 0; \ - CAMLxparam2 (x, y) - -#define SWIG_CAMLlocal3(x, y, z) \ - caml_value_t x = 0, y = 0, z = 0; \ - CAMLxparam3 (x, y, z) - -#define SWIG_CAMLlocal4(x, y, z, t) \ - caml_value_t x = 0, y = 0, z = 0, t = 0; \ - CAMLxparam4 (x, y, z, t) - -#define SWIG_CAMLlocal5(x, y, z, t, u) \ - caml_value_t x = 0, y = 0, z = 0, t = 0, u = 0; \ - CAMLxparam5 (x, y, z, t, u) - -#define SWIG_CAMLlocalN(x, size) \ - caml_value_t x [(size)] = { 0, /* 0, 0, ... */ }; \ - CAMLxparamN (x, (size)) - -#define SWIG_Field(x, i) (((caml_value_t *)(x)) [i]) /* Also an l-value. */ -#define SWIG_Store_field(block, offset, val) do{ \ - mlsize_t caml__temp_offset = (offset); \ - caml_value_t caml__temp_val = (val); \ - caml_modify (&SWIG_Field ((block), caml__temp_offset), caml__temp_val); \ -}while(0) - -#define SWIG_Data_custom_val(v) ((void *) &SWIG_Field((v), 1)) -#ifdef ARCH_BIG_ENDIAN -#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-1]) - /* Also an l-value. */ -#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [sizeof(caml_value_t)-1]) - /* Also an l-value. */ -#else -#define SWIG_Tag_val(val) (((unsigned char *) (val)) [-sizeof(caml_value_t)]) - /* Also an l-value. */ -#define SWIG_Tag_hp(hp) (((unsigned char *) (hp)) [0]) - /* Also an l-value. */ -#endif - -#ifdef CAMLreturn0 -#undef CAMLreturn0 -#endif -#define CAMLreturn0 do{ \ - caml_local_roots = caml__frame; \ - return; \ -}while (0) - -#ifdef CAMLreturn -#undef CAMLreturn -#endif -#define CAMLreturn(result) do{ \ - caml_value_t caml__temp_result = (result); \ - caml_local_roots = caml__frame; \ - return (caml__temp_result); \ -}while(0) - -#define CAMLreturn_type(result) do{ \ - caml_local_roots = caml__frame; \ - return result; \ -}while(0) - -#ifdef CAMLnoreturn -#undef CAMLnoreturn -#endif -#define CAMLnoreturn ((void) caml__frame) - - -#ifndef ARCH_ALIGN_INT64 -#if OCAML_VERSION >= 40300 -#define SWIG_Int64_val(v) (*((int64_t *) SWIG_Data_custom_val(v))) -#else -#define SWIG_Int64_val(v) (*((int64 *) SWIG_Data_custom_val(v))) -#endif -#else -#if OCAML_VERSION >= 40300 -CAMLextern int64_t Int64_val(caml_value_t v); -#else -CAMLextern int64 Int64_val(caml_value_t v); -#endif -#define SWIG_Int64_val(v) Int64_val(v) -#endif - -#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type) -#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer) - -typedef enum { - SWIG_OCamlArithmeticException, - SWIG_OCamlDirectorPureVirtual, - SWIG_OCamlOutOfMemoryError, - SWIG_OCamlOverflowException, - SWIG_OCamlIllegalArgumentException, - SWIG_OCamlIndexOutOfBoundsException, - SWIG_OCamlRuntimeException, - SWIG_OCamlSystemException, - SWIG_OCamlUnknownError -} SWIG_OCamlExceptionCodes; - -SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const char *msg) { - CAMLparam0(); - SWIG_CAMLlocal1(str); - - switch (code) { - case SWIG_OCamlIllegalArgumentException: - caml_invalid_argument(msg); - break; - case SWIG_OCamlSystemException: - str = caml_copy_string(msg); - caml_raise_sys_error(str); - break; - case SWIG_OCamlArithmeticException: - case SWIG_OCamlIndexOutOfBoundsException: - case SWIG_OCamlOutOfMemoryError: - case SWIG_OCamlOverflowException: - case SWIG_OCamlRuntimeException: - case SWIG_OCamlUnknownError: - default: - caml_failwith(msg); - break; - } - CAMLreturn0; -} - -#define SWIG_contract_assert(expr, msg) if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);} - - SWIGINTERN int - SWIG_GetPtr(void *source, void **result, swig_type_info *type, swig_type_info *result_type); - - SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n ); - SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt ); - SWIGINTERN int caml_list_length( CAML_VALUE lst ); - SWIGINTERN CAML_VALUE caml_array_new( int n ); - SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ); - SWIGINTERN CAML_VALUE caml_array_nth( CAML_VALUE arr, int n ); - SWIGINTERN int caml_array_len( CAML_VALUE arr ); - - SWIGINTERN CAML_VALUE caml_val_char( char c ); - SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char c ); - - SWIGINTERN CAML_VALUE caml_val_short( short s ); - SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short s ); - - SWIGINTERN CAML_VALUE caml_val_int( int x ); - SWIGINTERN CAML_VALUE caml_val_uint( unsigned int x ); - - SWIGINTERN CAML_VALUE caml_val_long( long x ); - SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long x ); - - SWIGINTERN CAML_VALUE caml_val_float( float f ); - SWIGINTERN CAML_VALUE caml_val_double( double d ); - - SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *descriptor ); - - SWIGINTERN CAML_VALUE caml_val_string( const char *str ); - SWIGINTERN CAML_VALUE caml_val_string_len( const char *str, int len ); - - SWIGINTERN long caml_long_val( CAML_VALUE v ); - SWIGINTERN double caml_double_val( CAML_VALUE v ); - - SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out, - swig_type_info *descriptor ); - SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor ); - - SWIGINTERN char *caml_string_val( CAML_VALUE v ); - SWIGINTERN int caml_string_len( CAML_VALUE v ); - -#ifdef __cplusplus -} -#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/cdata.i b/macx64/bin/swig/share/swig/4.0.0/octave/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/octave/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_carray.i b/macx64/bin/swig/share/swig/4.0.0/octave/std_carray.i deleted file mode 100644 index e69de29b..00000000 diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/cdata.i b/macx64/bin/swig/share/swig/4.0.0/perl5/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/php/const.i b/macx64/bin/swig/share/swig/4.0.0/php/const.i deleted file mode 100644 index 32b4b9b0..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/const.i +++ /dev/null @@ -1,47 +0,0 @@ -/* ----------------------------------------------------------------------------- - * const.i - * - * Typemaps for constants - * ----------------------------------------------------------------------------- */ - -%typemap(consttab) int, - unsigned int, - short, - unsigned short, - long, - unsigned long, - unsigned char, - signed char, - enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; - -%typemap(consttab) bool - "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);"; - -%typemap(consttab) float, - double - "SWIG_DOUBLE_CONSTANT($symname, $value);"; - -%typemap(consttab) char - "SWIG_CHAR_CONSTANT($symname, $value);"; - -%typemap(consttab) char *, - const char *, - char [], - const char [] - "SWIG_STRING_CONSTANT($symname, $value);"; - -%typemap(consttab) SWIGTYPE *, - SWIGTYPE &, - SWIGTYPE &&, - SWIGTYPE [] { - zend_constant c; - SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); - zval_copy_ctor(&c.value); - c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); - SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); - zend_register_constant(&c); -} - -/* Handled as a global variable. */ -%typemap(consttab) SWIGTYPE (CLASS::*) ""; diff --git a/macx64/bin/swig/share/swig/4.0.0/php/globalvar.i b/macx64/bin/swig/share/swig/4.0.0/php/globalvar.i deleted file mode 100644 index 6b31207a..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/globalvar.i +++ /dev/null @@ -1,293 +0,0 @@ -/* ----------------------------------------------------------------------------- - * globalvar.i - * - * Global variables - add the variable to PHP - * ----------------------------------------------------------------------------- */ - -%typemap(varinit) char * -{ - zval z_var; - if ($1) { - ZVAL_STRING(&z_var, $1); - } else { - ZVAL_STR(&z_var, ZSTR_EMPTY_ALLOC()); - } - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) char [] -{ - zval z_var; - ZVAL_STRING(&z_var, $1); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) int, - unsigned int, - unsigned short, - short, - unsigned short, - long, - unsigned long, - signed char, - unsigned char, - enum SWIGTYPE -{ - zval z_var; - ZVAL_LONG(&z_var, (long)$1); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) bool -{ - zval z_var; - ZVAL_BOOL(&z_var, ($1)?1:0); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) float, double -{ - zval z_var; - ZVAL_DOUBLE(&z_var, (double)$1); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) char -{ - zval z_var; - char c = $1; - ZVAL_STRINGL(&z_var, &c, 1); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) SWIGTYPE *, SWIGTYPE [] -{ - zval z_var; - SWIG_SetPointerZval(&z_var, (void*)$1, $1_descriptor, 0); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE && -{ - zval z_var; - SWIG_SetPointerZval(&z_var, (void*)&$1, $&1_descriptor, 0); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit) char [ANY] -{ - zval z_var; - /* varinit char [ANY] */ - ZVAL_STRINGL(&z_var, $1, $1_dim0); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); -} - -%typemap(varinit, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) -{ - zval resource; - void * p = emalloc(sizeof($1)); - memcpy(p, &$1, sizeof($1)); - ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr)); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource); -} - -%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - $1 = zval_get_long(z_var); -} - -%typemap(varin) bool -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - convert_to_boolean(z_var); - $1 = (Z_TYPE_P(z_var) == IS_TRUE); -} - -%typemap(varin) double,float -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - $1 = zval_get_double(z_var); -} - -%typemap(varin) char -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - convert_to_string(z_var); - if ($1 != Z_STRVAL_P(z_var)[0]) { - $1 = Z_STRVAL_P(z_var)[0]; - } -} - -%typemap(varin) char * -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - char *s1; - convert_to_string(z_var); - s1 = Z_STRVAL_P(z_var); - if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { - if (s1) - $1 = estrdup(s1); - else - $1 = NULL; - } -} - - -%typemap(varin) SWIGTYPE [] -{ - if ($1) { - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, $owner); - } -} - -%typemap(varin) char [ANY] -{ - zval **z_var; - char *s1; - - zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var); - s1 = Z_STRVAL_P(z_var); - if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { - if (s1) - strncpy($1, s1, $1_dim0); - } -} - -%typemap(varin) SWIGTYPE -{ - zval *z_var; - $&1_ltype _temp; - - z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - if (SWIG_ConvertPtr(z_var, (void**)&_temp, $&1_descriptor, 0) < 0) { - SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor"); - } - - $1 = *($&1_ltype)_temp; -} - -%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && -{ - zval *z_var; - $1_ltype _temp; - - z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - if (SWIG_ConvertPtr(z_var, (void **)&_temp, $1_descriptor, 0) < 0) { - SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor"); - } - - $1 = ($1_ltype)_temp; -} - -%typemap(varin, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - void * p = (void*)zend_fetch_resource_ex(z_var, SWIG_MEMBER_PTR, swig_member_ptr); - memcpy(&$1, p, sizeof($1)); -} - -%typemap(varout) int, - unsigned int, - unsigned short, - short, - long, - unsigned long, - signed char, - unsigned char, - enum SWIGTYPE -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - if ($1 != ($1_ltype)Z_LVAL_P(z_var)) { - z_var->value.lval = (long)$1; - } -} - -//SAMFIX need to cast zval->type, what if zend-hash_find fails? etc? -%typemap(varout) bool -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - if ($1 != ($1_ltype)Z_LVAL_P(z_var)) { - z_var->value.lval = (long)$1; - } -} - -%typemap(varout) double, float -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - if ($1 != ($1_ltype)Z_DVAL_P(z_var)) { - z_var->value.dval = (double)$1; - } -} - -%typemap(varout) char -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - char c = $1; - if ($1 != Z_STRVAL_P(z_val)[0]) { - ZVAL_STRING(z_var, &c); - } -} - -%typemap(varout) char * -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - const char *s1 = Z_STRVAL_P(z_var); - if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { - if (s1) - efree(s1); - if ($1) { - (z_var)->value.str.val = estrdup($1); - (z_var)->value.str.len = strlen($1) + 1; - } else { - (z_var)->value.str.val = 0; - (z_var)->value.str.len = 0; - } - } -} - -%typemap(varout) SWIGTYPE -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - SWIG_SetPointerZval(z_var, (void*)&$1, $&1_descriptor, 0); -} - -%typemap(varout) SWIGTYPE [] -{ - if($1) { - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0); - } -} - -%typemap(varout) char [ANY] -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - const char *s1 = Z_STRVAL_P(z_var); -deliberate error cos this code looks bogus to me - if ((s1 == NULL) || strcmp(s1, $1)) { - if ($1) { - (z_var)->value.str.val = estrdup($1); - (z_var)->value.str.len = strlen($1) + 1; - } else { - (z_var)->value.str.val = 0; - (z_var)->value.str.len = 0; - } - } -} - -%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && -{ - zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); - SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0); -} - -%typemap(varout, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) -{ - zval resource; - void * p = emalloc(sizeof($1)); - memcpy(p, &$1, sizeof($1)); - ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr)); - zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/php/php.swg b/macx64/bin/swig/share/swig/4.0.0/php/php.swg deleted file mode 100644 index 4eba6be2..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/php.swg +++ /dev/null @@ -1,539 +0,0 @@ -/* ----------------------------------------------------------------------------- - * php.swg - * - * PHP configuration file - * ----------------------------------------------------------------------------- */ - -%runtime "swigrun.swg" // Common C API type-checking code -%runtime "swigerrors.swg" // SWIG errors -%runtime "phprun.swg" // PHP runtime functions - -%include // PHP initialization routine. - -%include // Global variables. -%include - -// use %init %{ "/*code goes here*/ " %} -// or %minit %{ "/* code goes here*/ " %} to -// insert code in the PHP_MINIT_FUNCTION -#define %minit %insert("init") - -// use %rinit %{ "/* code goes here*/ " %} to -// insert code in the PHP_RINIT_FUNCTION -#define %rinit %insert("rinit") - -// use %shutdown %{ " /*code goes here*/ " %} to -// insert code in the PHP_MSHUTDOWN_FUNCTION -#define %shutdown %insert("shutdown") -#define %mshutdown %insert("shutdown") - -// use %rshutdown %{ " /*code goes here*/" %} to -// insert code in the PHP_RSHUTDOWN_FUNCTION -#define %rshutdown %insert("rshutdown") - -/* Typemaps for input parameters by value */ - -%include - -%pass_by_val(bool,CONVERT_BOOL_IN); - -%pass_by_val(size_t, CONVERT_INT_IN); - -%pass_by_val(enum SWIGTYPE, CONVERT_INT_IN); - -%pass_by_val(signed int, CONVERT_INT_IN); -%pass_by_val(int,CONVERT_INT_IN); -%pass_by_val(unsigned int,CONVERT_INT_IN); - -%pass_by_val(signed short, CONVERT_INT_IN); -%pass_by_val(short,CONVERT_INT_IN); -%pass_by_val(unsigned short, CONVERT_INT_IN); - -%pass_by_val(signed long, CONVERT_INT_IN); -%pass_by_val(long, CONVERT_INT_IN); -%pass_by_val(unsigned long, CONVERT_INT_IN); - -%pass_by_val(signed long long, CONVERT_LONG_LONG_IN); -%pass_by_val(long long, CONVERT_LONG_LONG_IN); -%pass_by_val(unsigned long long, CONVERT_UNSIGNED_LONG_LONG_IN); - -%pass_by_val(signed char, CONVERT_INT_IN); -%pass_by_val(char, CONVERT_CHAR_IN); -%pass_by_val(unsigned char, CONVERT_INT_IN); - -%pass_by_val(float, CONVERT_FLOAT_IN); - -%pass_by_val(double, CONVERT_FLOAT_IN); - -%pass_by_val(char *, CONVERT_STRING_IN); -%typemap(in) char *& = const char *&; -%typemap(directorout) char *& = const char *&; - -// char array can be in/out, though the passed string may not be big enough... -// so we have to size it -%typemap(in) char[ANY] -%{ - convert_to_string(&$input); - $1 = ($1_ltype) Z_STRVAL($input); -%} - -%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) %{ - convert_to_string(&$input); - $1 = ($1_ltype) Z_STRVAL($input); - $2 = ($2_ltype) Z_STRLEN($input); -%} - -/* Object passed by value. Convert to a pointer */ -%typemap(in) SWIGTYPE ($&1_ltype tmp) -%{ - if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); - } - $1 = *tmp; -%} - -%typemap(directorout) SWIGTYPE ($&1_ltype tmp) -%{ - /* If exit was via exception, PHP NULL is returned so skip the conversion. */ - if (!EG(exception)) { - if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); - $result = *tmp; - } -%} - -%typemap(in) SWIGTYPE *, - SWIGTYPE [] -%{ - if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); - } -%} - -%typemap(in) SWIGTYPE & -%{ - if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); - } -%} - -%typemap(in) SWIGTYPE && -%{ - if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); - } -%} - -%typemap(in) SWIGTYPE *const& ($*ltype temp) -%{ - if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor"); - } - $1 = ($1_ltype)&temp; -%} - -%typemap(in) SWIGTYPE *DISOWN -%{ - if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); - } -%} - -%typemap(argout) SWIGTYPE *, - SWIGTYPE [], - SWIGTYPE &, - SWIGTYPE &&; - -%typemap(in) void * -%{ - if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) { - /* Allow NULL from php for void* */ - if (Z_ISNULL($input)) $1=0; - else - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); - } -%} - -/* Special case when void* is passed by reference so it can be made to point - to opaque api structs */ -%typemap(in) void ** ($*1_ltype ptr, int force), - void *& ($*1_ltype ptr, int force) -{ - /* If they pass NULL by reference, make it into a void* - This bit should go in arginit if arginit support init-ing scripting args */ - if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { - /* So... we didn't get a ref or ptr, but we'll accept NULL by reference */ - if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) { - /* wasn't a pre/ref/thing, OR anything like an int thing */ - SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname."); - } - } - force=0; - if (arg1==NULL) { -#ifdef __cplusplus - ptr=new $*1_ltype(); -#else - ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); -#endif - $1=&ptr; - /* have to passback arg$arg too */ - force=1; - } -} -%typemap(argout) void **, - void *& -%{ - if (force$argnum) { - SWIG_SetPointerZval(&$input, (void*) ptr$argnum, $*1_descriptor, 1); - } -%} - -/* Typemap for output values */ - -%typemap(out) int, - unsigned int, - short, - unsigned short, - long, - unsigned long, - signed char, - unsigned char, - bool, - size_t -%{ - RETVAL_LONG($1); -%} - -%typemap(out) enum SWIGTYPE -%{ - RETVAL_LONG((long)$1); -%} - -%typemap(out) long long -%{ - if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { - RETVAL_LONG((long)($1)); - } else { - char temp[256]; - sprintf(temp, "%lld", (long long)$1); - RETVAL_STRING(temp); - } -%} -%typemap(out) unsigned long long -%{ - if ($1 <= (unsigned long long)LONG_MAX) { - RETVAL_LONG((long)($1)); - } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)$1); - RETVAL_STRING(temp); - } -%} - -%typemap(out) const int &, - const unsigned int &, - const short &, - const unsigned short &, - const long &, - const unsigned long &, - const signed char &, - const unsigned char &, - const bool &, - const size_t & -%{ - RETVAL_LONG(*$1); -%} - -%typemap(out) const enum SWIGTYPE & -%{ - RETVAL_LONG((long)*$1); -%} - -%typemap(out) const enum SWIGTYPE && -%{ - RETVAL_LONG((long)*$1); -%} - -%typemap(out) const long long & -%{ - if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { - RETVAL_LONG((long)(*$1)); - } else { - char temp[256]; - sprintf(temp, "%lld", (long long)(*$1)); - RETVAL_STRING(temp); - } -%} -%typemap(out) const unsigned long long & -%{ - if (*$1 <= (unsigned long long)LONG_MAX) { - RETVAL_LONG((long)(*$1)); - } else { - char temp[256]; - sprintf(temp, "%llu", (unsigned long long)(*$1)); - RETVAL_STRING(temp); - } -%} - -%typemap(directorin) int, - unsigned int, - short, - unsigned short, - long, - unsigned long, - signed char, - unsigned char, - size_t, - enum SWIGTYPE -%{ - ZVAL_LONG($input,$1); -%} - -%typemap(directorin) enum SWIGTYPE -%{ - ZVAL_LONG($input, (long)$1_name); -%} - -%typemap(directorin) char *, char [] -%{ - if(!$1) { - ZVAL_NULL($input); - } else { - ZVAL_STRING($input, (const char*)$1); - } -%} - -%typemap(out) bool -%{ - RETVAL_BOOL(($1) ? 1 : 0); -%} - -%typemap(out) const bool & -%{ - RETVAL_BOOL((*$1) ? 1 : 0); -%} - -%typemap(directorin) bool -%{ - ZVAL_BOOL($input, ($1) ? 1 : 0); -%} - -%typemap(out) float, - double -%{ - RETVAL_DOUBLE($1); -%} - -%typemap(out) const float &, - const double & -%{ - RETVAL_DOUBLE(*$1); -%} - -%typemap(directorin) float, - double -%{ - ZVAL_DOUBLE($input, $1); -%} - -%typemap(out) char -%{ - RETVAL_STRINGL(&$1, 1); -%} - -%typemap(out) const char & -%{ - RETVAL_STRINGL(&*$1, 1); -%} - -%typemap(out) char *, - char [] -%{ - if (!$1) { - RETVAL_NULL(); - } else { - RETVAL_STRING((const char *)$1); - } -%} - -%typemap(out) char *& -%{ - if (!*$1) { - RETVAL_NULL(); - } else { - RETVAL_STRING((const char *)*$1); - } -%} - -%typemap(out) SWIGTYPE *, - SWIGTYPE [], - SWIGTYPE &, - SWIGTYPE && -%{ - SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner); -%} - -%typemap(out) SWIGTYPE *const& -%{ - SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner); -%} - -%typemap(directorin) SWIGTYPE *, - SWIGTYPE [], - SWIGTYPE &, - SWIGTYPE && -%{ - SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2); -%} - -%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) -{ - void * p = emalloc(sizeof($1)); - memcpy(p, &$1, sizeof($1)); - RETVAL_RES(zend_register_resource(p, swig_member_ptr)); -} - -%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) -{ - void * p = (void*)zend_fetch_resource_ex(&$input, SWIG_MEMBER_PTR, swig_member_ptr); - memcpy(&$1, p, sizeof($1)); -} - -%typemap(out) SWIGTYPE *DYNAMIC, - SWIGTYPE &DYNAMIC -{ - swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); - SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner); -} - -%typemap(out) SWIGTYPE -#ifdef __cplusplus -{ - $&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1); - SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1); -} -#else -{ - $&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type)); - memcpy(resultobj, &$1, sizeof($1_type)); - SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1); -} -#endif - -%typemap(directorin) SWIGTYPE -%{ - SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2); -%} - -%typemap(out) void ""; - -%typemap(out) char [ANY] -{ - int len = 0; - while (len < $1_dim0 && $1[len]) ++len; - RETVAL_STRINGL($1, len); -} - -// This typecheck does hard checking for proper argument type. If you want -// an argument to be converted from a different PHP type, you must convert -// it yourself before passing it (e.g. (string)4.7 or (int)"6"). -%define %php_typecheck(_type,_prec,is) -%typemap(typecheck,precedence=_prec) _type, const _type & - " $1 = (Z_TYPE($input) == is);" -%enddef - -// Like %php_typecheck but allows either of two values. -%define %php_typecheck2(_type,_prec,is1,is2) -%typemap(typecheck,precedence=_prec) _type, const _type & - " $1 = (Z_TYPE($input) == is1 || Z_TYPE($input) == is2);" -%enddef - -%php_typecheck(int,SWIG_TYPECHECK_INTEGER,IS_LONG) -%php_typecheck(unsigned int,SWIG_TYPECHECK_UINT32,IS_LONG) -%php_typecheck(short,SWIG_TYPECHECK_INT16,IS_LONG) -%php_typecheck(unsigned short,SWIG_TYPECHECK_UINT16,IS_LONG) -%php_typecheck(long,SWIG_TYPECHECK_INT32,IS_LONG) -%php_typecheck(unsigned long,SWIG_TYPECHECK_UINT32,IS_LONG) -%php_typecheck(long long,SWIG_TYPECHECK_INT64,IS_LONG) -%php_typecheck(unsigned long long,SWIG_TYPECHECK_UINT64,IS_LONG) -%php_typecheck(signed char,SWIG_TYPECHECK_INT8,IS_LONG) -%php_typecheck(unsigned char,SWIG_TYPECHECK_UINT8,IS_LONG) -%php_typecheck(size_t,SWIG_TYPECHECK_SIZE,IS_LONG) -%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG) -%php_typecheck2(bool,SWIG_TYPECHECK_BOOL,IS_TRUE,IS_FALSE) -%php_typecheck(float,SWIG_TYPECHECK_FLOAT,IS_DOUBLE) -%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE) -%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING) - -%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char [] - " $1 = (Z_TYPE($input) == IS_STRING); " - -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE -{ - void *tmp; - $1 = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0); -} - -%typecheck(SWIG_TYPECHECK_POINTER) - SWIGTYPE *, - SWIGTYPE [], - SWIGTYPE *const& -{ - void *tmp; - $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0); -} - -%typecheck(SWIG_TYPECHECK_POINTER) - SWIGTYPE &, - SWIGTYPE && -{ - void *tmp; - $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0); -} - -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& -{ - void *tmp; - $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0); -} - -%typecheck(SWIG_TYPECHECK_VOIDPTR) void * -{ - void *tmp; - $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0); -} - -/* Exception handling */ - -%typemap(throws) int, - long, - short, - unsigned int, - unsigned long, - unsigned short %{ - zend_throw_exception(NULL, "C++ $1_type exception thrown", $1); - return; -%} - -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ - (void)$1; - zend_throw_exception(NULL, "C++ $1_type exception thrown", 0); - return; -%} - -%typemap(throws) char * %{ - zend_throw_exception(NULL, $1, 0); - return; -%} - -/* Array reference typemaps */ -%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } -%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } - -/* const pointers */ -%apply SWIGTYPE * { SWIGTYPE *const } -%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } -%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } - -/* php keywords */ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/php/phpinit.swg b/macx64/bin/swig/share/swig/4.0.0/php/phpinit.swg deleted file mode 100644 index 1665f5dc..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/phpinit.swg +++ /dev/null @@ -1,25 +0,0 @@ - -/* ------------------------------------------------------------ - * The start of the PHP initialization function - * ------------------------------------------------------------ */ - -%insert(init) "swiginit.swg" - -%init %{ -SWIG_php_minit { - SWIG_InitializeModule((void*)&module_number); -%} - -%fragment("swig_php_init_member_ptr2", "header") %{ -#define SWIG_MEMBER_PTR "CLASS::*" - -static void swig_member_ptr_dtor(zend_resource *res) { - efree(res->ptr); -} - -static int swig_member_ptr = 0; -%} - -%fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") %{ - swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number); -%} diff --git a/macx64/bin/swig/share/swig/4.0.0/php/phppointers.i b/macx64/bin/swig/share/swig/4.0.0/php/phppointers.i deleted file mode 100644 index d79697b5..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/phppointers.i +++ /dev/null @@ -1,46 +0,0 @@ -%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT ) -%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp), - TYPE &REF ($*1_ltype tmp) -%{ - /* First Check for SWIG wrapped type */ - if (Z_ISNULL($input)) { - $1 = 0; - } else if (Z_ISREF($input)) { - /* Not swig wrapped type, so we check if it's a PHP reference type */ - CONVERT_IN(tmp, $*1_ltype, $input); - $1 = &tmp; - } else { - SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference)); - } -%} -%typemap(argout) TYPE *REF, - TYPE &REF -%{ - if (Z_ISREF($input)) { - CONVERT_OUT(Z_REFVAL($input), tmp$argnum); - } -%} -%enddef - -%pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG ); - -%pass_by_ref( signed int, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( int, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( unsigned int, CONVERT_INT_IN, ZVAL_LONG ); - -%pass_by_ref( signed short, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( short, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( unsigned short, CONVERT_INT_IN, ZVAL_LONG ); - -%pass_by_ref( signed long, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( long, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( unsigned long, CONVERT_INT_IN, ZVAL_LONG ); - -%pass_by_ref( signed char, CONVERT_INT_IN, ZVAL_LONG ); -%pass_by_ref( char, CONVERT_CHAR_IN, ZVAL_STRING ); -%pass_by_ref( unsigned char, CONVERT_INT_IN, ZVAL_LONG ); - -%pass_by_ref( float, CONVERT_FLOAT_IN, ZVAL_DOUBLE ); -%pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE ); - -%pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING ); diff --git a/macx64/bin/swig/share/swig/4.0.0/php/phprun.swg b/macx64/bin/swig/share/swig/4.0.0/php/phprun.swg deleted file mode 100644 index a07a1b9f..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/phprun.swg +++ /dev/null @@ -1,246 +0,0 @@ -/* ----------------------------------------------------------------------------- - * phprun.swg - * - * PHP runtime library - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif -#include "zend.h" -#include "zend_API.h" -#include "zend_exceptions.h" -#include "php.h" - -#if PHP_MAJOR_VERSION != 7 -# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 -#endif - -#include "ext/standard/php_string.h" -#include /* for abort(), used in generated code. */ - -/* This indirection is to work around const correctness issues in older PHP. - * FIXME: Remove for PHP7? Or might user code be using it? */ -#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) - -#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) -#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) -#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) -#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT) -#define SWIG_CHAR_CONSTANT(N, V) do {\ - char swig_char = (V);\ - REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\ -} while (0) - -/* ZEND_CONSTANT_SET_FLAGS is new in PHP 7.3. */ -#ifdef ZEND_CONSTANT_SET_FLAGS -# define SWIG_ZEND_CONSTANT_SET_FLAGS ZEND_CONSTANT_SET_FLAGS -#else -# define SWIG_ZEND_CONSTANT_SET_FLAGS(C, F, N) do { (C)->flags = (F); (C)->module_number = (N); } while (0) -#endif - -#ifdef __cplusplus -} -#endif - -#define SWIG_fail goto fail - -static const char *default_error_msg = "Unknown error occurred"; -static int default_error_code = E_ERROR; - -#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg - -#define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0) - -#define SWIG_contract_assert(expr,msg) \ - if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else - -/* Standard SWIG API */ -#define SWIG_GetModule(clientdata) SWIG_Php_GetModule() -#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer, *(int*)clientdata) - -/* used to wrap returned objects in so we know whether they are newobject - and need freeing, or not */ -typedef struct { - void * ptr; - int newobject; -} swig_object_wrapper; - -#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) - -static void -SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) { - /* - * First test for Null pointers. Return those as PHP native NULL - */ - if (!ptr ) { - ZVAL_NULL(z); - return; - } - if (type->clientdata) { - swig_object_wrapper *value; - if (! (*(int *)(type->clientdata))) - zend_error(E_ERROR, "Type: %s failed to register with zend",type->name); - value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper)); - value->ptr=ptr; - value->newobject=(newobject & 1); - if ((newobject & 2) == 0) { - /* Just register the pointer as a resource. */ - ZVAL_RES(z, zend_register_resource(value, *(int *)(type->clientdata))); - } else { - /* - * Wrap the resource in an object, the resource will be accessible - * via the "_cPtr" member. This is currently only used by - * directorin typemaps. - */ - zval resource; - zend_class_entry *ce = NULL; - const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */ - size_t type_name_len; - const char * p; - HashTable * ht; - - /* Namespace__Foo -> Foo */ - /* FIXME: ugly and goes wrong for classes with __ in their names. */ - while ((p = strstr(type_name, "__")) != NULL) { - type_name = p + 2; - } - type_name_len = strlen(type_name); - - ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata))); - if (SWIG_PREFIX_LEN > 0) { - zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0); - memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN); - memcpy(classname->val + SWIG_PREFIX_LEN, type_name, type_name_len); - ce = zend_lookup_class(classname); - zend_string_release(classname); - } else { - zend_string * classname = zend_string_init(type_name, type_name_len, 0); - ce = zend_lookup_class(classname); - zend_string_release(classname); - } - if (ce == NULL) { - /* class does not exist */ - ce = zend_standard_class_def; - } - - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, 1, NULL, NULL, 0); - zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource); - object_and_properties_init(z, ce, ht); - } - return; - } - zend_error(E_ERROR, "Type: %s not registered with zend",type->name); -} - -/* This pointer conversion routine takes the native pointer p (along with - its type name) and converts it by calling appropriate casting functions - according to ty. The resultant pointer is returned, or NULL is returned - if the pointer can't be cast. - - Sadly PHP has no API to find a type name from a type id, only from an - instance of a resource of the type id, so we have to pass type_name as well. - - The two functions which might call this are: - SWIG_ConvertResourcePtr which gets the type name from the resource - and the registered zend destructors for which we have one per type each - with the type name hard wired in. */ -static void * -SWIG_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty) { - swig_cast_info *tc; - void *result = 0; - - if (!ty) { - /* They don't care about the target type, so just pass on the pointer! */ - return p; - } - - if (! type_name) { - /* can't convert p to ptr type ty if we don't know what type p is */ - return NULL; - } - - /* convert and cast p from type_name to ptr as ty. */ - tc = SWIG_TypeCheck(type_name, ty); - if (tc) { - int newmemory = 0; - result = SWIG_TypeCast(tc, p, &newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } - return result; -} - -/* This function returns a pointer of type ty by extracting the pointer - and type info from the resource in z. z must be a resource. - If it fails, NULL is returned. - It uses SWIG_ConvertResourceData to do the real work. */ -static void * -SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) { - swig_object_wrapper *value; - void *p; - const char *type_name; - - if (Z_RES_TYPE_P(z) == -1) return NULL; - value = (swig_object_wrapper *) Z_RES_VAL_P(z); - if (flags & SWIG_POINTER_DISOWN) { - value->newobject = 0; - } - p = value->ptr; - - type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z)); - - return SWIG_ConvertResourceData(p, type_name, ty); -} - -/* We allow passing of a RESOURCE pointing to the object or an OBJECT whose - _cPtr is a resource pointing to the object */ -static int -SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) { - if (z == NULL) { - *ptr = 0; - return 0; - } - - switch (Z_TYPE_P(z)) { - case IS_OBJECT: { - HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z); - if (ht) { - zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1); - if (_cPtr) { - if (Z_TYPE_P(_cPtr) == IS_INDIRECT) { - _cPtr = Z_INDIRECT_P(_cPtr); - } - if (Z_TYPE_P(_cPtr) == IS_RESOURCE) { - *ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags); - return (*ptr == NULL ? -1 : 0); - } - } - } - break; - } - case IS_RESOURCE: - *ptr = SWIG_ConvertResourcePtr(z, ty, flags); - return (*ptr == NULL ? -1 : 0); - case IS_NULL: - *ptr = 0; - return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; - } - - return -1; -} - -static const char const_name[] = "swig_runtime_data_type_pointer"; -static swig_module_info *SWIG_Php_GetModule() { - zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1); - if (pointer) { - if (Z_TYPE_P(pointer) == IS_LONG) { - return (swig_module_info *) pointer->value.lval; - } - } - return NULL; -} - -static void SWIG_Php_SetModule(swig_module_info *pointer, int module_number) { - REGISTER_LONG_CONSTANT(const_name, (long) pointer, CONST_CS | CONST_PERSISTENT); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/php/std_string.i b/macx64/bin/swig/share/swig/4.0.0/php/std_string.i deleted file mode 100644 index b55751f0..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/php/std_string.i +++ /dev/null @@ -1,94 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_string.i - * - * SWIG typemaps for std::string types - * ----------------------------------------------------------------------------- */ - -// ------------------------------------------------------------------------ -// std::string is typemapped by value -// This can prevent exporting methods which return a string -// in order for the user to modify it. -// However, I think I'll wait until someone asks for it... -// ------------------------------------------------------------------------ - -%include - -%{ -#include -%} - -namespace std { - - %naturalvar string; - - class string; - - %typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) string, const string& %{ - $1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0; - %} - - %typemap(in) string %{ - convert_to_string(&$input); - $1.assign(Z_STRVAL($input), Z_STRLEN($input)); - %} - - %typemap(directorout) string %{ - if (!EG(exception)) { - convert_to_string($input); - $result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input)); - } - %} - - %typemap(out) string %{ - ZVAL_STRINGL($result, $1.data(), $1.size()); - %} - - %typemap(directorin) string, const string& %{ - ZVAL_STRINGL($input, $1.data(), $1.size()); - %} - - %typemap(out) const string & %{ - ZVAL_STRINGL($result, $1->data(), $1->size()); - %} - - %typemap(throws) string, const string& %{ - zend_throw_exception(NULL, $1.c_str(), 0); - return; - %} - - %typemap(in) const string & ($*1_ltype temp) %{ - convert_to_string(&$input); - temp.assign(Z_STRVAL($input), Z_STRLEN($input)); - $1 = &temp; - %} - - /* These next two handle a function which takes a non-const reference to - * a std::string and modifies the string. */ - %typemap(in,byref=1) string & ($*1_ltype temp) %{ - { - zval * p = Z_ISREF($input) ? Z_REFVAL($input) : &$input; - convert_to_string(p); - temp.assign(Z_STRVAL_P(p), Z_STRLEN_P(p)); - $1 = &temp; - } - %} - - %typemap(directorout) string & ($*1_ltype *temp) %{ - if (!EG(exception)) { - convert_to_string($input); - temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input)); - swig_acquire_ownership(temp); - $result = temp; - } - %} - - %typemap(argout) string & %{ - if (Z_ISREF($input)) { - ZVAL_STRINGL(Z_REFVAL($input), $1->data(), $1->size()); - } - %} - - /* SWIG will apply the non-const typemap above to const string& without - * this more specific typemap. */ - %typemap(argout) const string & ""; -} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/cdata.i b/macx64/bin/swig/share/swig/4.0.0/python/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/python/defarg.swg b/macx64/bin/swig/share/swig/4.0.0/python/defarg.swg deleted file mode 100644 index 59450bd8..00000000 --- a/macx64/bin/swig/share/swig/4.0.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 PyEval_CallObject(func,parms); -} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyabc.i b/macx64/bin/swig/share/swig/4.0.0/python/pyabc.i deleted file mode 100644 index fbd91dce..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyabc.i +++ /dev/null @@ -1,10 +0,0 @@ -%define %pythonabc(Type, Abc) - %feature("python:abc", #Abc) Type; -%enddef -%pythoncode %{import collections.abc%} -%pythonabc(std::vector, collections.abc.MutableSequence); -%pythonabc(std::list, collections.abc.MutableSequence); -%pythonabc(std::map, collections.abc.MutableMapping); -%pythonabc(std::multimap, collections.abc.MutableMapping); -%pythonabc(std::set, collections.abc.MutableSet); -%pythonabc(std::multiset, collections.abc.MutableSet); diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pydocs.swg b/macx64/bin/swig/share/swig/4.0.0/python/pydocs.swg deleted file mode 100644 index 1eea41b8..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/pydocs.swg +++ /dev/null @@ -1,45 +0,0 @@ - -// Documentation for use with the autodoc feature. - -#ifdef SWIG_DOC_DOXYGEN_STYLE -%typemap(doc) SWIGTYPE "@param $1_name $1_type"; -%typemap(doc) SWIGTYPE * "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE & "@param $1_name $1_type"; -%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"; -%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"; - -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)"; -#else -%typemap(doc) SWIGTYPE "$1_name: $1_type"; -%typemap(doc) SWIGTYPE * "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE & "$1_name: $1_type"; -%typemap(doc) const SWIGTYPE && "$1_name: $1_type"; -%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"; - -%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)"; -%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)"; -%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)"; -#endif - - -// Types to use in Python documentation for the parameters of the given C++ type. -%typemap(doctype) bool "boolean"; - -%define int_doctype_for_cppint_type(cppint_type) - %typemap(doctype) cppint_type, unsigned cppint_type "int"; -%enddef -%formacro(int_doctype_for_cppint_type, short, int, long, long long) - -%typemap(doctype) size_t "int"; - -%typemap(doctype) enum SWIGTYPE "int"; - -%typemap(doctype) float, double, long double "float"; - -%typemap(doctype) char*, std::string "string"; - -%typemap(doctype) SWIGTYPE "$1_basetype" -%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)" -%typemap(doctype) SWIGTYPE & "$typemap(doctype, $*1_ltype)" diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyhead.swg b/macx64/bin/swig/share/swig/4.0.0/python/pyhead.swg deleted file mode 100644 index c820f901..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyhead.swg +++ /dev/null @@ -1,87 +0,0 @@ -/* Compatibility macros for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) -#define PyString_Check(name) PyBytes_Check(name) -#define PyString_FromString(x) PyUnicode_FromString(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) -#define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) -#define PyString_InternFromString(key) PyUnicode_InternFromString(key) -#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE -#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) -#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - - -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - PyBytes_AsStringAndSize(str, &cstr, &len); - newstr = (char *) malloc(len+1); - memcpy(newstr, cstr, len+1); - Py_XDECREF(str); - } - return newstr; -#else - return PyString_AsString(str); -#endif -} - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#else -# define SWIG_Python_str_DelForPy3(x) -#endif - - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} - -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user -// interface files check for it. -# define SWIGPY_USE_CAPSULE -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) - -#if PY_VERSION_HEX < 0x03020000 -#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#define Py_hash_t long -#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyruntime.swg b/macx64/bin/swig/share/swig/4.0.0/python/pyruntime.swg deleted file mode 100644 index 751bc8d5..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyruntime.swg +++ /dev/null @@ -1,27 +0,0 @@ -%insert(runtime) %{ -#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) -/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ -# include -#endif - -#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) -/* Use debug wrappers with the Python release dll */ -# undef _DEBUG -# include -# define _DEBUG 1 -#else -# include -#endif -%} - -%insert(runtime) "swigrun.swg"; /* SWIG API */ -%insert(runtime) "swigerrors.swg"; /* SWIG errors */ -%insert(runtime) "pyhead.swg"; /* Python includes and fixes */ -%insert(runtime) "pyerrors.swg"; /* Python errors */ -%insert(runtime) "pythreads.swg"; /* Python thread code */ -%insert(runtime) "pyapi.swg"; /* Python API */ -%insert(runtime) "pyrun.swg"; /* Python run-time code */ - -#if defined(SWIGPYTHON_BUILTIN) -%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */ -#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pytuplehlp.swg b/macx64/bin/swig/share/swig/4.0.0/python/pytuplehlp.swg deleted file mode 100644 index 32e15803..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/pytuplehlp.swg +++ /dev/null @@ -1,8 +0,0 @@ -/* - Helper function to return output types, now we need to use a list - instead of a tuple since all the other types - (std::pair,std::vector,std::list,etc) return tuples. -*/ - -#warning "Deprecated file: Don't use t_output_helper anymore," -#warning "use SWIG_Python_AppendOutput or %append_output instead." diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.0.0/python/std_auto_ptr.i deleted file mode 100644 index e310e00c..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_auto_ptr.i +++ /dev/null @@ -1,17 +0,0 @@ -/* - The typemaps here allow to handle functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ - -%define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ - %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); -%} -%template() std::auto_ptr; -%enddef - -namespace std { - template class auto_ptr {}; -} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_carray.i b/macx64/bin/swig/share/swig/4.0.0/python/std_carray.i deleted file mode 100644 index 680d6711..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_carray.i +++ /dev/null @@ -1,54 +0,0 @@ -%include - - -%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits") -{ -namespace swig { - template - struct traits_asptr > { - static int asptr(PyObject *obj, std::carray **array) { - return traits_asptr_stdseq >::asptr(obj, array); - } - }; -} -} - -%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[]; - -%extend std::carray { - %fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header", - fragment="SwigPyIterator_T", - fragment=SWIG_Traits_frag(_Type), - fragment="StdCarrayTraits") { - namespace swig { - template <> struct traits > { - typedef pointer_category category; - static const char* type_name() { - return "std::carray<" #_Type "," #_Size " >"; - } - }; - } - } - - %typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr, - SWIG_Traits_frag(std::carray<_Type, _Size >), - std::carray<_Type, _Size >); - - %typemap(out,noblock=1) iterator, const_iterator { - $result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - } - - inline size_t __len__() const { return self->size(); } - - inline const _Type& __getitem__(size_t i) const { return (*self)[i]; } - - inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; } - - - swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -} - -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/r/cdata.i b/macx64/bin/swig/share/swig/4.0.0/r/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/r/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_deque.i b/macx64/bin/swig/share/swig/4.0.0/r/std_deque.i deleted file mode 100644 index 0c757ab0..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/r/std_deque.i +++ /dev/null @@ -1 +0,0 @@ -%include \ No newline at end of file diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/cdata.i b/macx64/bin/swig/share/swig/4.0.0/ruby/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_carray.swg b/macx64/bin/swig/share/swig/4.0.0/std/std_carray.swg deleted file mode 100644 index de2a0762..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/std/std_carray.swg +++ /dev/null @@ -1,64 +0,0 @@ -%{ -#include -%} - -// -// std::carray - is really an extension to the 'std' namespace. -// -// A simple fix C array wrapper, more or less as presented in -// -// "The C++ Standarf Library", by Nicolai M. Josuttis -// -// which is also derived from the example in -// -// "The C++ Programming Language", by Bjarne Stroustup. -// - -%inline %{ -namespace std { - template - class carray - { - public: - typedef _Type value_type; - typedef size_t size_type; - - typedef _Type * iterator; - typedef const _Type * const_iterator; - - carray() { } - - carray(const carray& other) { - std::copy(other.v, other.v + size(), v); - } - - template - carray(_Iterator first, _Iterator last) { - assign(first, last); - } - - iterator begin() { return v; } - iterator end() { return v + _Size; } - - const_iterator begin() const { return v; } - const_iterator end() const { return v + _Size; } - - _Type& operator[](size_t i) { return v[i]; } - const _Type& operator[](size_t i) const { return v[i]; } - - static size_t size() { return _Size; } - - template - void assign(_Iterator first, _Iterator last) { - if (std::distance(first,last) == size()) { - std::copy(first, last, v); - } else { - throw std::length_error("bad range length"); - } - } - - private: - _Type v[_Size]; - }; -} -%} diff --git a/macx64/bin/swig/share/swig/4.0.0/swigarch.i b/macx64/bin/swig/share/swig/4.0.0/swigarch.i deleted file mode 100644 index bf4ee8ef..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/swigarch.i +++ /dev/null @@ -1,62 +0,0 @@ -/* ----------------------------------------------------------------------------- - * swigarch.i - * - * SWIG library file for 32bit/64bit code specialization and checking. - * - * Use only in extreme cases, when no arch. independent code can be - * generated - * - * To activate architecture specific code, use - * - * swig -DSWIGWORDSIZE32 - * - * or - * - * swig -DSWIGWORDSIZE64 - * - * Note that extra checking code will be added to the wrapped code, - * which will prevent the compilation in a different architecture. - * - * If you don't specify the SWIGWORDSIZE (the default case), swig will - * generate architecture independent and/or 32bits code, with no extra - * checking code added. - * ----------------------------------------------------------------------------- */ - -#if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64) -# if (__WORDSIZE == 32) -# define SWIGWORDSIZE32 -# endif -#endif - -#if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32) -# if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64) -# define SWIGWORDSIZE64 -# endif -#endif - - -#ifdef SWIGWORDSIZE32 -%{ -#define SWIGWORDSIZE32 -#ifndef LONG_MAX -#include -#endif -#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX) -# error "SWIG wrapped code invalid in 64 bit architecture, regenerate code using -DSWIGWORDSIZE64" -#endif -%} -#endif - -#ifdef SWIGWORDSIZE64 -%{ -#define SWIGWORDSIZE64 -#ifndef LONG_MAX -#include -#endif -#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX) -# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32" -#endif -%} -#endif - - diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/cdata.i b/macx64/bin/swig/share/swig/4.0.0/tcl/cdata.i deleted file mode 100644 index 36796599..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/cdata.i +++ /dev/null @@ -1 +0,0 @@ -%include diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclsh.i b/macx64/bin/swig/share/swig/4.0.0/tcl/tclsh.i deleted file mode 100644 index 160ba8d8..00000000 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclsh.i +++ /dev/null @@ -1,85 +0,0 @@ -/* ----------------------------------------------------------------------------- - * tclsh.i - * - * SWIG File for building new tclsh program - * ----------------------------------------------------------------------------- */ - -#ifdef AUTODOC -%subsection "tclsh.i" -%text %{ -This module provides the Tcl_AppInit() function needed to build a -new version of the tclsh executable. This file should not be used -when using dynamic loading. To make an interface file work with -both static and dynamic loading, put something like this in your -interface file : - - #ifdef STATIC - %include - #endif -%} -#endif - -%{ - -/* A TCL_AppInit() function that lets you build a new copy - * of tclsh. - * - * The macro SWIG_init contains the name of the initialization - * function in the wrapper file. - */ - -#ifndef SWIG_RcFileName -char *SWIG_RcFileName = "~/.myapprc"; -#endif - - -#ifdef MAC_TCL -extern int MacintoshInit _ANSI_ARGS_((void)); -#endif - -int Tcl_AppInit(Tcl_Interp *interp){ - - if (Tcl_Init(interp) == TCL_ERROR) - return TCL_ERROR; - - /* Now initialize our functions */ - - if (SWIG_init(interp) == TCL_ERROR) - return TCL_ERROR; -#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5 - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#else - tcl_RcFileName = SWIG_RcFileName; -#endif -#ifdef SWIG_RcRsrcName - Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); -#endif - - return TCL_OK; -} - -#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4 -int main(int argc, char **argv) { -#ifdef MAC_TCL - char *newArgv[2]; - - if (MacintoshInit() != TCL_OK) { - Tcl_Exit(1); - } - - argc = 1; - newArgv[0] = "tclsh"; - newArgv[1] = NULL; - argv = newArgv; -#endif - - Tcl_Main(argc, argv, Tcl_AppInit); - return(0); - -} -#else -extern int main(); -#endif - -%} - diff --git a/macx64/bin/swig/share/swig/4.0.0/allkw.swg b/macx64/bin/swig/share/swig/4.3.0/allkw.swg similarity index 81% rename from macx64/bin/swig/share/swig/4.0.0/allkw.swg rename to macx64/bin/swig/share/swig/4.3.0/allkw.swg index 2d3cf6ea..a549aec1 100644 --- a/macx64/bin/swig/share/swig/4.0.0/allkw.swg +++ b/macx64/bin/swig/share/swig/4.3.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 /* @@ -20,6 +20,7 @@ %include %include %include +%include %include %include %include @@ -30,4 +31,4 @@ %include -#endif //__Lib_allkw_swg__ +#endif // SWIG_INCLUDED_LIB_ALLKW_SWG diff --git a/macx64/bin/swig/share/swig/4.0.0/attribute.i b/macx64/bin/swig/share/swig/4.3.0/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/attribute.i diff --git a/macx64/bin/swig/share/swig/4.3.0/c/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/c/boost_shared_ptr.i new file mode 100644 index 00000000..bf4e0959 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/boost_shared_ptr.i @@ -0,0 +1,5 @@ +#ifndef SWIG_SHARED_PTR_NAMESPACE +#define SWIG_SHARED_PTR_NAMESPACE boost +#endif + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/c/c.swg b/macx64/bin/swig/share/swig/4.3.0/c/c.swg new file mode 100644 index 00000000..806ca5f1 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/c.swg @@ -0,0 +1,359 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * c.swg + * ----------------------------------------------------------------------------- */ + +%include + +%insert("runtime") "clabels.swg" + +%insert("runtime") %{ +#include +#include +#include +#include + +#define SWIG_contract_assert(expr, msg) if(!(expr)) { printf("%s\n", msg); SWIG_exit(0); } else +%} + +%fragment("stdbool_inc", "cheader") {#include } + +%define same_macro_all_primitive_types_but_void(macro_name, TM) +macro_name(TM, short); +macro_name(TM, unsigned short); +macro_name(TM, int); +macro_name(TM, unsigned int); +macro_name(TM, long); +macro_name(TM, unsigned long); +macro_name(TM, long long); +macro_name(TM, unsigned long long); +macro_name(TM, char); +macro_name(TM, signed char); +macro_name(TM, unsigned char); +macro_name(TM, float); +macro_name(TM, double); +macro_name(TM, size_t); +%enddef + +// This is used to handle all primitive types as just themselves. +// This macro doesn't cover const references, use either cref_as_value or +// cref_as_ptr below in addition to it. +// Notice that const pointers are mapped to non-const ones as we need to +// declare variables of this type when it's used as a return type, and top +// level const doesn't matter anyhow in the function declarations. +%define same_type(TM, T) +%typemap(TM) T, const T "T" +%typemap(TM) T*, T&, T[ANY], T[] "T *" +%typemap(TM) const T*, const T[ANY], const T[] "const T *" +%typemap(TM) T**, T*&, T*[ANY], T[ANY][ANY] "T **" +%typemap(TM) const T**, const T*&, T *const &, const T*[ANY], const T[ANY][ANY] "const T **" +// constant pointers +%typemap(TM) T * const "T *" +%typemap(TM) T* * const "T* *" +%typemap(TM) const T* * const "const T* *" +%enddef + +%define cref_as_value(TM, T) +%typemap(TM) const T& "T" +%enddef + +%define cref_as_ptr(TM, T) +%typemap(TM) const T& "T *" +%enddef + +%define same_type_all_primitive_types_but_void(TM) +%enddef + +//Used by 'in' and 'out' typemaps +%define same_action(TM, T, ACTION, ACTION_CREF) +%typemap(TM) T, const T ACTION +%typemap(TM) const T& ACTION_CREF +%typemap(TM) T*, T&, T[ANY], T[] ACTION +%typemap(TM) const T*, const T[ANY], const T[] ACTION +%typemap(TM) T**, T*&, T*[ANY], T[ANY][ANY] ACTION +%typemap(TM) const T**, const T*&, const T*[ANY], const T[ANY][ANY] ACTION +// constant pointers +%typemap(TM) T * const ACTION +%typemap(TM) T* * const ACTION +%typemap(TM) const T* * const ACTION +%enddef + +%define same_action_all_primitive_types(TM, ACTION, ACTION_CREF) +same_action(TM, short, ACTION, ACTION_CREF); +same_action(TM, unsigned short, ACTION, ACTION_CREF); +same_action(TM, int, ACTION, ACTION_CREF); +same_action(TM, unsigned int, ACTION, ACTION_CREF); +same_action(TM, long, ACTION, ACTION_CREF); +same_action(TM, unsigned long, ACTION, ACTION_CREF); +same_action(TM, long long, ACTION, ACTION_CREF); +same_action(TM, unsigned long long, ACTION, ACTION_CREF); +same_action(TM, char, ACTION, ACTION_CREF); +same_action(TM, signed char, ACTION, ACTION_CREF); +same_action(TM, unsigned char, ACTION, ACTION_CREF); +//unsigned only +same_action(TM, float, ACTION, ACTION_CREF); +same_action(TM, double, ACTION, ACTION_CREF); +same_action(TM, size_t, ACTION, ACTION_CREF); +%typemap(TM) void*, void const* ACTION +%enddef + +// "ctype" is the type used with C wrapper functions. +// void +%typemap(ctype) void "void" +%typemap(ctype) void*, void& "void *" +%typemap(ctype) const void&, const void* "const void *" +%typemap(ctype) void**, void*& "void **" +%typemap(ctype) const void**, const void*& "const void **" +// constant pointers +%typemap(ctype) void* * const "void* * const" +%typemap(ctype) const void* * const "const void* * const" + +same_macro_all_primitive_types_but_void(same_type,ctype); +same_macro_all_primitive_types_but_void(cref_as_value,ctype); + +// trivial typemap for arrays of void pointers to avoid applying the object typemaps to them +%typemap(ctype) void*[ANY] "void **" + +// objects +%typemap(ctype) SWIGTYPE "$&resolved_type*" +%typemap(ctype) SWIGTYPE * "$resolved_type*" +%typemap(ctype) SWIGTYPE * const & "$resolved_type*" +%typemap(ctype) SWIGTYPE & "$*resolved_type*" +%typemap(ctype) SWIGTYPE [ANY] "$resolved_type*" +%typemap(ctype) SWIGTYPE * [ANY] "$resolved_type**" + +// enums +%typemap(ctype) enum SWIGTYPE "$resolved_type" +%typemap(ctype) enum SWIGTYPE * "$resolved_type*" +%typemap(ctype) enum SWIGTYPE & "$*resolved_type*" +%typemap(ctype) enum SWIGTYPE [ANY] "$resolved_type*" + +%typemap(ctype, fragment="stdbool_inc") bool, const bool, const bool & "bool" +%typemap(ctype, fragment="stdbool_inc") bool *, const bool *, bool & "bool *" + +// Typemaps for assigning wrapper parameters to local variables +same_action_all_primitive_types(in, "$1 = ($1_ltype) $input;", "$1 = &$input;") + +%typemap(in) short [ANY], int [ANY], long [ANY], long long [ANY], char [ANY], float [ANY], double [ANY], unsigned char [ANY] "$1 = ($1_basetype *) $input;" +%typemap(in) short * [ANY], int * [ANY], long * [ANY], long long * [ANY], char * [ANY], float * [ANY], double * [ANY] "$1 = ($1_basetype *) $input;" + +%typemap(in, fragment="stdbool_inc") bool, bool *, bool **, const bool, const bool * "$1 = ($1_ltype) $input;" +%typemap(in, fragment="stdbool_inc") bool & "$1 = ($1_basetype *) $input;" +%typemap(in, fragment="stdbool_inc") const bool &, const bool * "$1 = ($1_basetype *) $input;" + +%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) $input;" +%typemap(in) enum SWIGTYPE &,enum SWIGTYPE * "$1 = ($1_ltype) $input;" + +%typemap(in) SWIGTYPE [] "$1 = ($1_ltype) $input;" +%typemap(in) SWIGTYPE ((&)[ANY]) "$1 = ($1_ltype) $input;" + +%typemap(in) SWIGTYPE (CLASS::*) { + if ($input) + $1 = *($&1_ltype) &$input; +} + +%typemap(in) SWIGTYPE "$1 = *($1_ltype *)$input;" + +%typemap(in) SWIGTYPE * "$1 = ($1_ltype) $input;" + +%typemap(in) SWIGTYPE *[ANY] { + if ($input) { + $1 = ($1_ltype) malloc($1_dim0 * sizeof($1_basetype)); + size_t i = 0; + for ( ; i < $1_dim0; ++i) + if ($input[i]) + $1[i] = ($*1_ltype) $input[i]; + else + $1[i] = ($*1_ltype) 0; + } + else + $1 = ($1_ltype) 0; +} + +%typemap(in) SWIGTYPE [ANY][ANY] { + if ($input) { + $1 = ($1_ltype) malloc($1_dim0 * $1_dim1 * sizeof($1_basetype)); + size_t i = 0, j = 0; + for ( ; i < $1_dim0; ++i) { + for ( ; j < $1_dim1; ++j) { + if ($input[i][j]) + $1[i][j] = * ($*1_ltype) $input[i][j]; + else + $1[i][j] = * ($*1_ltype) 0; + } + } + } + else + $1 = ($1_ltype) 0; +} + +%typemap(freearg) SWIGTYPE * [ANY], SWIGTYPE * [ANY][ANY] { + if ($input) + free($input); +} + +%typemap(in) SWIGTYPE & %{ + $1 = ($1_ltype) $input; +%} + +// Typemaps for assigning result values to a special return variable +same_action_all_primitive_types(out, "$result = $1;", "$result = *$1;") + +%typemap(out) void "" + +%typemap(out, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$result = ($1_ltype) $1;" +%typemap(out, fragment="stdbool_inc") bool &, const bool & "$result = $1;" + +%typemap(out) enum SWIGTYPE "$result = (int) $1;" +%typemap(out) enum SWIGTYPE &, enum SWIGTYPE * "$result = $1;" + +%typemap(out) SWIGTYPE (CLASS::*) { + *($&1_ltype) &$result = $1; +} + +%typemap(out) SWIGTYPE "$result = (SwigObj*)new $1_ltype($1);" + +%typemap(out) SWIGTYPE *, SWIGTYPE & "$result = (SwigObj*) $1;" + +%typemap(out) SWIGTYPE * [ANY], SWIGTYPE [ANY][ANY] { + static SwigObj **_temp = 0; + if ($1) { + size_t i = 0; + if (_temp) { + for ( ; i < $1_dim0; ++i) + delete ($1_ltype *)_temp[i]; + free(_temp); + } + _temp = (SwigObj**) malloc($1_dim0 * sizeof(SwigObj*)); + for (i = 0 ; i < $1_dim0; ++i) { + if ($1[i]) { + _temp[i] = $1[i]; + } + else + _temp[i] = (SwigObj*) 0; + } + $result = ($1_ltype) _temp; + } + else + $result = ($1_ltype) 0; +} + +/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions + * that cannot be overloaded in the wrappers as more than one C++ type maps to a single C type */ + +%typecheck(SWIG_TYPECHECK_BOOL) + bool, + const bool & + "" + +%typecheck(SWIG_TYPECHECK_CHAR) + char, + const char & + "" + +%typecheck(SWIG_TYPECHECK_INT8) + signed char, + const signed char & + "" + +%typecheck(SWIG_TYPECHECK_UINT8) + unsigned char, + const unsigned char & + "" + +%typecheck(SWIG_TYPECHECK_INT16) + short, + const short & + "" + +%typecheck(SWIG_TYPECHECK_UINT16) + unsigned short, + const unsigned short & + "" + +%typecheck(SWIG_TYPECHECK_INT32) + int, + long, + const int &, + const long & + "" + +%typecheck(SWIG_TYPECHECK_UINT32) + unsigned int, + unsigned long, + const unsigned int &, + const unsigned long & + "" + +%typecheck(SWIG_TYPECHECK_INT64) + long long, + const long long & + "" + +%typecheck(SWIG_TYPECHECK_UINT64) + unsigned long long, + const unsigned long long & + "" + +%typecheck(SWIG_TYPECHECK_FLOAT) + float, + const float & + "" + +%typecheck(SWIG_TYPECHECK_DOUBLE) + double, + const double & + "" + +%typecheck(SWIG_TYPECHECK_STRING) + char *, + char *&, + char[ANY], + char[] + "" + +%typecheck(SWIG_TYPECHECK_POINTER) + SWIGTYPE, + SWIGTYPE *, + SWIGTYPE &, + SWIGTYPE &&, + SWIGTYPE *const&, + SWIGTYPE [], + SWIGTYPE (CLASS::*) + "" + +#ifdef SWIG_CPPMODE + +%insert("runtime") %{ +typedef struct SwigObj SwigObj; +%} + +%insert("cheader") %{ +typedef struct SwigObj SwigObj; +%} + +#endif // SWIG_CPPMODE + +#ifdef SWIG_C_EXCEPT +%include "cexcept.swg" +#else // !SWIG_C_EXCEPT +// Still define the macro used in some standard typemaps, but we can't +// implement it in C, so just allow the user predefining their own version. +%insert("runtime") %{ +#ifndef SWIG_exception +#define SWIG_exception(code, msg) +#endif +%} +#endif // SWIG_C_EXCEPT/!SWIG_C_EXCEPT + +%insert("runtime") %{ +#ifdef __cplusplus +extern "C" { +#endif +SWIGEXPORTC int SWIG_exit(int code) { exit(code); } +#ifdef __cplusplus +} +#endif +%} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/cdata.i b/macx64/bin/swig/share/swig/4.3.0/c/cdata.i new file mode 100644 index 00000000..db0ef47d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/cdata.i @@ -0,0 +1,29 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +%include + +%insert("cheader") { +typedef struct SWIGCDATA { + char *data; + size_t len; +} SWIGCDATA; +} + +%typemap(ctype) SWIGCDATA "SWIGCDATA" +%typemap(cppouttype) SWIGCDATA "SWIGCDATA" + +%typemap(out) SWIGCDATA { + $result = $1; +} + +%typemap(ctype) (const void* BYTES, size_t LENGTH) "const SWIGCDATA*" +%typemap(in) (const void* BYTES, size_t LENGTH) { + $1 = $input->data; + $2 = $input->len; +} + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/c/cexcept.swg b/macx64/bin/swig/share/swig/4.3.0/c/cexcept.swg new file mode 100644 index 00000000..144e8e0d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/cexcept.swg @@ -0,0 +1,109 @@ +/* ----------------------------------------------------------------------------- + * clabels.swg + * + * Exception handling code and typemaps for C module. + * ----------------------------------------------------------------------------- */ + +// This function is special: it's used by various typemaps (via SWIG_exception +// macro below) and needs to be defined, but we don't want to export it. +%ignore SWIG_CException_Raise; +%{ +extern "C" SWIGEXPORTC void SWIG_CException_Raise(int code, const char* msg); +%} + +// This class is special too because its name is used in c.cxx source. It is +// only defined if the code there didn't predefine SWIG_CException_DEFINED +// because the class is already defined in another module. +// +// It has to be seen by SWIG because we want to generate wrappers for its +// public functions to be able to use it from the application code. +%inline %{ +#ifndef SWIG_CException_DEFINED +class SWIG_CException { +public: + SWIG_CException(const SWIG_CException& ex) throw() : code(ex.code), msg(strdup(ex.msg)) { } + ~SWIG_CException() { free(const_cast(msg)); } + + const int code; + const char* const msg; + + static SWIG_CException* get_pending() throw() { + return PendingException; + } + + static void reset_pending() throw() { + if (PendingException) { + delete PendingException; + PendingException = 0; + } + } + +private: + friend void SWIG_CException_Raise(int code, const char* msg); + + static thread_local SWIG_CException* PendingException; + + SWIG_CException(int code, const char* msg) : code(code), msg(strdup(msg)) { } + + SWIG_CException& operator=(const SWIG_CException& ex); +}; +#endif // SWIG_CException_DEFINED +%} + +// This part is implementation only and doesn't need to be seen by SWIG. +%{ +#ifndef SWIG_CException_DEFINED +thread_local SWIG_CException *SWIG_CException::PendingException = 0; + +SWIGEXPORTC void SWIG_CException_Raise(int code, const char* msg) { + delete SWIG_CException::PendingException; + SWIG_CException::PendingException = new SWIG_CException(code, msg); +} +#endif // SWIG_CException_DEFINED +%} + +#ifdef SWIG_CXX_WRAPPERS + +// This is somewhat of a hack, but our generated header may include another +// generated header, when using multiple modules, and defining swig_check() in +// all of them would result in errors, so we use SWIG_swig_check_DEFINED to +// prevent this from happening. +// +// This also has a nice side effect of allowing the user code to predefine this +// symbol and provide their own SWIG_swig_check_DEFINED implementation to +// customize exception handling. +%insert("cxxcode") %{ +#ifndef SWIG_swig_check_DEFINED +#define SWIG_swig_check_DEFINED 1 + +inline void swig_check() { + if (SWIG_CException* swig_ex = SWIG_CException::get_pending()) { + SWIG_CException swig_ex_copy{*swig_ex}; + delete swig_ex; + SWIG_CException::reset_pending(); + throw swig_ex_copy; + } +} + +template T swig_check(T x) { + swig_check(); + return x; +} + +#endif // SWIG_swig_check_DEFINED +%} + +#endif // SWIG_CXX_WRAPPERS + +%insert("runtime") "swigerrors.swg" + +#define SWIG_exception(code, msg)\ + SWIG_CException_Raise(code, msg) + +%typemap(throws, noblock="1") char *, const char * { + SWIG_exception(SWIG_RuntimeError, $1); +} + +%typemap(throws, noblock="1") SWIGTYPE { + SWIG_exception(SWIG_UnknownError, "exception of type $1_type"); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/cheader.swg b/macx64/bin/swig/share/swig/4.3.0/c/cheader.swg new file mode 100644 index 00000000..c162a826 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/cheader.swg @@ -0,0 +1,20 @@ +/* ----------------------------------------------------------------------------- + * cheader.swg + * ----------------------------------------------------------------------------- */ + +%insert("cheader") %{ +#ifndef SWIGIMPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGDLLIMPORT +# else +# define SWIGDLLIMPORT __declspec(dllimport) +# endif +# else +# define SWIGDLLIMPORT +# endif +# define SWIGIMPORT extern SWIGDLLIMPORT +#endif + +#include +%} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/clabels.swg b/macx64/bin/swig/share/swig/4.3.0/c/clabels.swg new file mode 100644 index 00000000..7fc2ba77 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/clabels.swg @@ -0,0 +1,23 @@ +/* ----------------------------------------------------------------------------- + * clabels.swg + * + * Definitions of C specific preprocessor symbols. + * ----------------------------------------------------------------------------- */ + +// this is used instead of default SWIGEXPORT symbol + +#ifndef SWIGEXPORTC +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORTC +# else +# define SWIGEXPORTC __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORTC __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORTC +# endif +# endif +#endif diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_common.i b/macx64/bin/swig/share/swig/4.3.0/c/std_common.i new file mode 100644 index 00000000..c21a2e56 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_common.i @@ -0,0 +1,4 @@ +%include + +%apply size_t { std::size_t }; +%apply const size_t& { const std::size_t & }; diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_except.i b/macx64/bin/swig/share/swig/4.3.0/c/std_except.i new file mode 100644 index 00000000..cc5a7fca --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_except.i @@ -0,0 +1,20 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * std_except.i + * + * Typemaps used by the STL wrappers that throw exceptions. + * These typemaps are used when methods are declared with an STL exception specification, such as + * size_t at() const throw (std::out_of_range); + * ----------------------------------------------------------------------------- */ + +%{ +#include +%} + +namespace std +{ + %ignore exception; + struct exception {}; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_map.i b/macx64/bin/swig/share/swig/4.3.0/c/std_map.i new file mode 100644 index 00000000..42d62082 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_map.i @@ -0,0 +1,61 @@ +/* ----------------------------------------------------------------------------- + * std_map.i + * + * SWIG typemaps for std::map + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::map +// ------------------------------------------------------------------------ + +%{ +#include +#include +%} + +namespace std { + template > class map { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + map(); + map(const map& other); + + size_t size() const; + bool empty() const; + void clear(); + %extend { + const T& get(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + void set(const K& key, const T& x) { + (*self)[key] = x; + } + void del(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + bool has_key(const K& key) const { + std::map< K, T, C >::const_iterator i = self->find(key); + return i != self->end(); + } + } + }; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/c/std_pair.i new file mode 100644 index 00000000..f6e1c7c8 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_pair.i @@ -0,0 +1,24 @@ +%{ +#include +%} + +// Ideal, especially for the simple/primitive types, would be to represent +// pair as a C struct with the 2 fields, but for now we use the simplest +// possible implementation, with the accessor functions required to work with +// the fields. + +namespace std { + template struct pair { + typedef T first_type; + typedef U second_type; + + pair(); + pair(T first, U second); + pair(const pair& other); + + template pair(const pair &other); + + T first; + U second; + }; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_set.i b/macx64/bin/swig/share/swig/4.3.0/c/std_set.i new file mode 100644 index 00000000..1127a0a5 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_set.i @@ -0,0 +1,48 @@ +/* ----------------------------------------------------------------------------- + * std_set.i + * + * SWIG typesets for std::set + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::set +// ------------------------------------------------------------------------ + +%{ +#include +#include +%} + +namespace std { + template class set { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T key_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + set(); + set(const set& other); + + size_t size() const; + bool empty() const; + void clear(); + %extend { + bool add(const T& item) { + return self->insert(item).second; + } + bool del(const T& item) { + return self->erase(item) != 0; + } + bool has(const T& item) const { + return self->count(item) != 0; + } + } + }; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/c/std_shared_ptr.i new file mode 100644 index 00000000..d2049f5f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_shared_ptr.i @@ -0,0 +1,84 @@ +// This could be predefined in e.g. our own boost_shared_ptr.i +#ifndef SWIG_SHARED_PTR_NAMESPACE +#define SWIG_SHARED_PTR_NAMESPACE std +#endif + +%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...) + +%naturalvar TYPE; +%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; + +// Replace the default "delete arg1" with the code destroying the smart pointer itself instead. +%feature("unref") TYPE "(void)arg1; delete smartarg1;" + +// All smart pointers look like normal objects to the code using the interface. +%typemap(ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >&, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >* + "$typemap(ctype, TYPE)"; + +// Typemap for smart pointer type itself: these are somewhat special because we represent empty shared pointers as null pointers at C level because there is +// no advantage in using a non-null pointer in this case, while testing for NULL is much simpler than testing whether a shared pointer is empty. +%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > empty) %{ + $1 = $input ? *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr*)$input : empty; %} + +%typemap(in) const SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > empty) %{ + $1 = $input ? (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr*)$input : ∅ %} + +// Note that "&" here is required because "$1" ends up being SwigValueWrapper and not the shared pointer itself. This is wrong and should be fixed by disabling +// the use of SwigValueWrapper for shared pointers entirely, as it's never needed for them. +%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > %{ $result = (&$1 ? new $1_ltype($1) : 0); %} + +// Use of "*" here is due to the fact that "$1" is a pointer, but we want to test the smart pointer itself. +%typemap(out) const SWIG_SHARED_PTR_QNAMESPACE::shared_ptr& %{ $result = (*$1 ? $1 : 0); %} + +// And for the plain type. +%typemap(in) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ + smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr *)$input; + if (!smartarg || !smartarg->get()) { + SWIG_exception(SWIG_RuntimeError, "$1_type value is null"); + return $null; + } + $1 = **smartarg;%} +%typemap(out) CONST TYPE %{ + $result = (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr(new $1_ltype($1));%} + +// Plain type pointer. +%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ + smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr *)$input; + $1 = (TYPE *)(smartarg ? smartarg->get() : 0);%} +%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{ + $result = $1 ? (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr($1 SWIG_NO_NULL_DELETER_$owner) : 0;%} + +// Plain type references. +%typemap(in) CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ + smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr *)$input; + if (!smartarg || !smartarg->get()) { + SWIG_exception(SWIG_RuntimeError, "$1_type reference is null"); + return $null; + } + $1 = (TYPE *)smartarg->get();%} +%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & %{ + $result = (SwigObj*) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr($1 SWIG_NO_NULL_DELETER_$owner);%} + +// Allow creating null shared pointers and testing them for validity. +%typemap(cxxcode) TYPE %{ + static $cxxclassname null() { return $cxxclassname{($cclassptrname)nullptr, false}; } + explicit operator bool() const { return swig_self_ != nullptr; } +%} + +// This is required to handle overloads on shared_ptr/normal type correctly. +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") + TYPE CONST, + TYPE CONST &, + TYPE CONST *, + TYPE *CONST&, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& + "" + +%enddef + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_string.i b/macx64/bin/swig/share/swig/4.3.0/c/std_string.i new file mode 100644 index 00000000..e97cad5f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_string.i @@ -0,0 +1,90 @@ +%{ +#include +%} + +%fragment("SwigStrInOut", "header") { +class SwigStrInOut { + std::string str_; + char* ptr_; + size_t len_; +public: + void init(char* ptr) { + ptr_ = ptr; + if (ptr_) { + str_ = ptr_; + len_ = str_.length(); + } + } + + std::string* str() { return &str_; } + + ~SwigStrInOut() { + if (ptr_) { + memcpy(ptr_, str_.c_str(), len_); + ptr_[len_] = '\0'; + } + } +}; +} + +%fragment("include_string", "cxxheader") %{ +#include +%} + +namespace std { + +// use "const string &" typemaps for wrapping member strings +%naturalvar string; + +class string; + +%typemap(ctype) string, const string & "const char *" +%typemap(ctype) string * "char *" +%typemap(ctype) string & "char *" + +%typemap(in) string %{ + if ($input) + $1 = $input; +%} + +%typemap(in) const string & (std::string temp) %{ + if ($input) + temp = $input; + $1 = &temp; +%} + +%typemap(in, fragment="SwigStrInOut") string * (SwigStrInOut temp), string & (SwigStrInOut temp) %{ + temp.init($input); + $1 = temp.str(); +%} + +// Note that we don't support strings with embedded NULs, as there is no way to +// return their length to C code anyhow. +%typemap(out) string %{ + $result = strdup(cppresult.c_str()); +%} + +%typemap(out) const string &, string *, string & %{ + $result = strdup(cppresult->c_str()); +%} + +// This is required to warn about clashes between the overloaded functions +// taking strings and raw pointers in the generated wrappers. +%typemap(typecheck) string, const string &, string *, string & = char *; + + +// Define typemaps for wrapping strings back into std::string in C++ wrappers +// and accepting strings directly. + +%typemap(cxxintype, fragment="include_string") string, const string & "std::string const&" + +%typemap(cxxin) string, const string & "$1.c_str()" + +%typemap(cxxouttype, fragment="include_string") string, const string & "std::string" + +%typemap(cxxout, noblock="1") string, const string & %{ + $result = std::string($cresult); + free(const_cast($cresult)); +%} + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/c/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/c/std_vector.i new file mode 100644 index 00000000..070814a1 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/std_vector.i @@ -0,0 +1,91 @@ +/* ----------------------------------------------------------------------------- + * std_vector.i + * + * SWIG typemaps for std::vector + * ----------------------------------------------------------------------------- */ + +%include + +%{ +#include +#include +%} + +namespace std { + + template class vector { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + vector(); + vector(const vector& other); + + size_type size() const; + size_type capacity() const; + void reserve(size_type n); + bool empty() const; + void clear(); + void push_back(const value_type& x); + %extend { + const_reference get(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i class vector { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef bool value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef bool const_reference; + + vector(); + vector(size_type n); + vector(const vector& other); + + size_type size() const; + size_type capacity() const; + void reserve(size_type n); + bool empty() const; + void clear(); + void push_back(bool x); + %extend { + bool get(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i +%include +%include +%include +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/c/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/c/typemaps.i new file mode 100644 index 00000000..10407cd2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/c/typemaps.i @@ -0,0 +1,12 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * typemaps.i + * + * Pointer handling + * These mappings provide support for input/output arguments and common + * uses for C/C++ pointers. + * ----------------------------------------------------------------------------- */ + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/carrays.i b/macx64/bin/swig/share/swig/4.3.0/carrays.i similarity index 69% rename from macx64/bin/swig/share/swig/4.0.0/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/carrays.i index 3a9c3cfe..71712c83 100644 --- a/macx64/bin/swig/share/swig/4.0.0/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/carrays.i @@ -5,22 +5,28 @@ * pointers as arrays. * ----------------------------------------------------------------------------- */ +#ifndef __cplusplus +// C uses free/calloc/malloc +%include "swigfragments.swg" +%fragment(""); +#endif + /* ----------------------------------------------------------------------------- * %array_functions(TYPE,NAME) * * Generates functions for creating and accessing elements of a C array * (as pointers). Creates the following functions: * - * TYPE *new_NAME(int nelements) + * TYPE *new_NAME(size_t nelements) * void delete_NAME(TYPE *); - * TYPE NAME_getitem(TYPE *, int index); - * void NAME_setitem(TYPE *, int index, TYPE value); - * + * TYPE NAME_getitem(TYPE *, size_t index); + * void NAME_setitem(TYPE *, size_t index, TYPE value); + * * ----------------------------------------------------------------------------- */ %define %array_functions(TYPE,NAME) %{ -static TYPE *new_##NAME(int nelements) { %} +static TYPE *new_##NAME(size_t nelements) { %} #ifdef __cplusplus %{ return new TYPE[nelements](); %} #else @@ -36,18 +42,18 @@ static void delete_##NAME(TYPE *ary) { %} #endif %{} -static TYPE NAME##_getitem(TYPE *ary, int index) { +static TYPE NAME##_getitem(TYPE *ary, size_t index) { return ary[index]; } -static void NAME##_setitem(TYPE *ary, int index, TYPE value) { +static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) { ary[index] = value; } %} -TYPE *new_##NAME(int nelements); +TYPE *new_##NAME(size_t nelements); void delete_##NAME(TYPE *ary); -TYPE NAME##_getitem(TYPE *ary, int index); -void NAME##_setitem(TYPE *ary, int index, TYPE value); +TYPE NAME##_getitem(TYPE *ary, size_t index); +void NAME##_setitem(TYPE *ary, size_t index, TYPE value); %enddef @@ -59,13 +65,13 @@ void NAME##_setitem(TYPE *ary, int index, TYPE value); * interface: * * struct NAME { - * NAME(int nelements); + * NAME(size_t nelements); * ~NAME(); - * TYPE getitem(int index); - * void setitem(int index, TYPE value); + * TYPE getitem(size_t index); + * void setitem(size_t index, TYPE value); * TYPE * cast(); * static NAME *frompointer(TYPE *t); - * } + * } * * ----------------------------------------------------------------------------- */ @@ -80,14 +86,14 @@ typedef struct { %extend NAME { #ifdef __cplusplus -NAME(int nelements) { +NAME(size_t nelements) { return new TYPE[nelements](); } ~NAME() { delete [] self; } #else -NAME(int nelements) { +NAME(size_t nelements) { return (TYPE *) calloc(nelements,sizeof(TYPE)); } ~NAME() { @@ -95,10 +101,10 @@ NAME(int nelements) { } #endif -TYPE getitem(int index) { +TYPE getitem(size_t index) { return self[index]; } -void setitem(int index, TYPE value) { +void setitem(size_t index, TYPE value) { self[index] = value; } TYPE * cast() { diff --git a/macx64/bin/swig/share/swig/4.3.0/cdata.i b/macx64/bin/swig/share/swig/4.3.0/cdata.i new file mode 100644 index 00000000..528e0d1e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/cdata.i @@ -0,0 +1,50 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +%typemap(in,noblock=0,fragment="SWIG_AsCharPtrAndSize") (const void *BYTES, size_t LENGTH) (int res, void *buf = 0, size_t len = 0, int alloc = 0) { + res = SWIG_AsCharPtrAndSize($input, (char **)&buf, &len, &alloc); + if (!SWIG_IsOK(res)) { + %argument_fail(res,"$type",$symname, $argnum); + } + $1 = %reinterpret_cast(buf, $1_ltype); + $2 = %numeric_cast(len, $2_ltype); +} + +%typemap(freearg,noblock=1,match="in") (const void *BYTES, size_t LENGTH) { + if (alloc$argnum == SWIG_NEWOBJ) { + %delete_array((char*)(buf$argnum)); + } +} + +%typemap(directorin,noblock=1,fragment="SWIG_FromCharPtrAndSize") (const void *BYTES, size_t LENGTH) { + if ($1 && $2 > 0) { + $input = SWIG_FromCharPtrAndSize((const char*)$1, (size_t)$2); + } else { + $input = SWIG_FromCharPtrAndSize("", 0); + } +} + +%typemap(in) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(freearg) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(directorin) (void *BYTES, size_t LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(in) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(freearg) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(directorin) (const void *BYTES, int LENGTH) = (const void *BYTES, size_t LENGTH); +%typemap(in) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH); +%typemap(freearg) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH); +%typemap(directorin) (void *BYTES, int LENGTH) = (const void *BYTES, int LENGTH); +%typemap(in) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH); +%typemap(freearg) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH); +%typemap(directorin) (const void *indata, size_t inlen) = (const void *BYTES, size_t LENGTH); +#define SWIG_CDATA_APPLIED + +%include + +%typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") SWIGCDATA { + %set_output(SWIG_FromCharPtrAndSize($1.data,$1.len)); +} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/constraints.i b/macx64/bin/swig/share/swig/4.3.0/constraints.i similarity index 66% rename from macx64/bin/swig/share/swig/4.0.0/constraints.i rename to macx64/bin/swig/share/swig/4.3.0/constraints.i index 8bc7f915..20c4c15c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/constraints.i +++ b/macx64/bin/swig/share/swig/4.3.0/constraints.i @@ -8,67 +8,60 @@ * errors in a language-independent manner. * ----------------------------------------------------------------------------- */ -#ifdef AUTODOC -%text %{ -%include - -This library provides support for applying constraints to function -arguments. Using a constraint, you can restrict arguments to be -positive numbers, non-NULL pointers, and so on. The following -constraints are available : - - Number POSITIVE - Positive number (not zero) - Number NEGATIVE - Negative number (not zero) - Number NONZERO - Nonzero number - Number NONNEGATIVE - Positive number (including zero) - Number NONPOSITIVE - Negative number (including zero) - Pointer NONNULL - Non-NULL pointer - Pointer ALIGN8 - 8-byte aligned pointer - Pointer ALIGN4 - 4-byte aligned pointer - Pointer ALIGN2 - 2-byte aligned pointer - -To use the constraints, you need to "apply" them to specific -function arguments in your code. This is done using the %apply -directive. For example : - - %apply Number NONNEGATIVE { double nonneg }; - double sqrt(double nonneg); // Name of argument must match - - %apply Pointer NONNULL { void *ptr }; - void *malloc(int POSITIVE); // May return a NULL pointer - void free(void *ptr); // May not accept a NULL pointer - -Any function argument of the type you specify with the %apply directive -will be checked with the appropriate constraint. Multiple types may -be specified as follows : - - %apply Pointer NONNULL { void *, Vector *, List *, double *}; - -In this case, all of the types listed would be checked for non-NULL -pointers. - -The common datatypes of int, short, long, unsigned int, unsigned long, -unsigned short, unsigned char, signed char, float, and double can be -checked without using the %apply directive by simply using the -constraint name as the parameter name. For example : - - double sqrt(double NONNEGATIVE); - double log(double POSITIVE); - -If you have used typedef to change type-names, you can also do this : - - %apply double { Real }; // Make everything defined for doubles - // work for Reals. - Real sqrt(Real NONNEGATIVE); - Real log(Real POSITIVE); - -%} -#endif +// This library provides support for applying constraints to function +// arguments. Using a constraint, you can restrict arguments to be +// positive numbers, non-NULL pointers, and so on. The following +// constraints are available : +// +// Number POSITIVE - Positive number (not zero) +// Number NEGATIVE - Negative number (not zero) +// Number NONZERO - Nonzero number +// Number NONNEGATIVE - Positive number (including zero) +// Number NONPOSITIVE - Negative number (including zero) +// Pointer NONNULL - Non-NULL pointer +// Pointer ALIGN8 - 8-byte aligned pointer +// Pointer ALIGN4 - 4-byte aligned pointer +// Pointer ALIGN2 - 2-byte aligned pointer +// +// To use the constraints, you need to "apply" them to specific +// function arguments in your code. This is done using the %apply +// directive. For example : +// +// %apply Number NONNEGATIVE { double nonneg }; +// double sqrt(double nonneg); // Name of argument must match +// +// %apply Pointer NONNULL { FILE *stream }; +// FILE *fdopen(int NONNEGATIVE); // May return a NULL pointer +// int fclose(void *stream); // Does not accept a NULL pointer +// +// Any function argument of the type you specify with the %apply directive +// will be checked with the appropriate constraint. Multiple types may +// be specified as follows : +// +// %apply Pointer NONNULL { void *, Vector *, List *, double *}; +// +// In this case, all of the types listed would be checked for non-NULL +// pointers. +// +// The common datatypes of int, short, long, unsigned int, unsigned long, +// unsigned short, unsigned char, signed char, float, and double can be +// checked without using the %apply directive by simply using the +// constraint name as the parameter name. For example : +// +// double sqrt(double NONNEGATIVE); +// double log(double POSITIVE); +// +// If you have used typedef to change type-names, you can also do this : +// +// %apply double { Real }; // Make everything defined for doubles +// // work for Reals. +// Real sqrt(Real NONNEGATIVE); +// Real log(Real POSITIVE); %include -#ifdef SWIGCSHARP -// Required attribute for C# exception handling +#if defined(SWIGCSHARP) || defined(SWIGD) +// Required attribute for C# and D exception handling #define SWIGCSHARPCANTHROW , canthrow=1 #else #define SWIGCSHARPCANTHROW @@ -182,7 +175,7 @@ If you have used typedef to change type-names, you can also do this : Pointer NONNULL { if (!$1) { - SWIG_exception(SWIG_ValueError,"Received a NULL pointer."); + SWIG_exception(SWIG_NullReferenceError,"Received a NULL pointer."); } } diff --git a/macx64/bin/swig/share/swig/4.0.0/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/cpointer.i similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/cpointer.i index 881c511f..df40c042 100644 --- a/macx64/bin/swig/share/swig/4.0.0/cpointer.i +++ b/macx64/bin/swig/share/swig/4.3.0/cpointer.i @@ -5,6 +5,12 @@ * pointer objects. * ----------------------------------------------------------------------------- */ +#ifndef __cplusplus +// C uses free/calloc/malloc +%include "swigfragments.swg" +%fragment(""); +#endif + /* ----------------------------------------------------------------------------- * %pointer_class(type,name) * @@ -55,14 +61,14 @@ NAME() { return new TYPE(); } ~NAME() { - if ($self) delete $self; + delete $self; } #else NAME() { return (TYPE *) calloc(1,sizeof(TYPE)); } ~NAME() { - if ($self) free($self); + free($self); } #endif } @@ -114,7 +120,7 @@ static NAME * frompointer(TYPE *t) { %define %pointer_functions(TYPE,NAME) %{ -static TYPE *new_##NAME() { %} +static TYPE *new_##NAME(void) { %} #ifdef __cplusplus %{ return new TYPE(); %} #else @@ -134,9 +140,9 @@ static TYPE *copy_##NAME(TYPE value) { %} static void delete_##NAME(TYPE *obj) { %} #ifdef __cplusplus -%{ if (obj) delete obj; %} +%{ delete obj; %} #else -%{ if (obj) free(obj); %} +%{ free(obj); %} #endif %{} @@ -149,7 +155,7 @@ static TYPE NAME ##_value(TYPE *obj) { } %} -TYPE *new_##NAME(); +TYPE *new_##NAME(void); TYPE *copy_##NAME(TYPE value); void delete_##NAME(TYPE *obj); void NAME##_assign(TYPE *obj, TYPE value); diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/csharp/argcargv.i new file mode 100644 index 00000000..2dae1f6d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/argcargv.i @@ -0,0 +1,76 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(cstype) (int ARGC, char **ARGV) "string[]" +%typemap(imtype) (int ARGC, char **ARGV) "global::System.IntPtr" +%typemap(ctype) (int ARGC, char **ARGV) "void*" +%typemap(csin) (int ARGC, char **ARGV) "$modulePINVOKE.SWIG_csharp_string_array_to_c($csinput.Length, $csinput)" +%pragma(csharp) imclasscode=%{ + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_array_to_c")] + public static extern global::System.IntPtr SWIG_csharp_string_array_to_c(int len, [global::System.Runtime.InteropServices.In,global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray, ArraySubType=global::System.Runtime.InteropServices.UnmanagedType.LPStr, SizeParamIndex=0)] string[] array); +%} +%fragment("SWIG_csharp_string_array", "header") %{ +#ifdef __cplusplus +extern "C" { +#endif +typedef struct { int len; char* array[1]; } SWIG_csharp_string_array; + +static void* SWIG_csharp_string_array_free(SWIG_csharp_string_array *arr) { + if (arr != SWIG_NULLPTR) { + int i; + for(i = 0; i < arr->len; i++) { + free(arr->array[i]); + } + free(arr); + } + return SWIG_NULLPTR; +} + +SWIGEXPORT void* SWIGSTDCALL SWIG_csharp_string_array_to_c(int len, void *array) { + int i; + size_t alen, slen; + char *p, **ptr; + SWIG_csharp_string_array *ret; + /* We don't need to add one to len for the terminating NULL here because + * SWIG_csharp_string_array includes one element already. + */ + alen = sizeof(SWIG_csharp_string_array) + sizeof(char *) * len; + ret = (SWIG_csharp_string_array *)malloc(alen); + if (ret == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate array."); + return SWIG_NULLPTR; + } + memset(ret, 0, alen); + ret->len = len; + ptr = (char **)array; + for(i = 0; i < len; i++) { + slen = strlen(ptr[i]) + 1; + p = (char*)malloc(slen); + if (p == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to alloc a string."); + return SWIG_csharp_string_array_free(ret); + } + memcpy(p, ptr[i], slen); + ret->array[i] = p; + } + ret->array[i] = SWIG_NULLPTR; + return ret; +} + +#ifdef __cplusplus +} +#endif +%} + +%typemap(in, canthrow=1, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{ + SWIG_csharp_string_array *arr = (SWIG_csharp_string_array*)$input; + if (arr != SWIG_NULLPTR) { + $1 = ($1_ltype)arr->len; + $2 = ($2_ltype)arr->array; + } +%} + +%typemap(freearg, fragment="SWIG_csharp_string_array") (int ARGC, char **ARGV) %{ + SWIG_csharp_string_array_free((SWIG_csharp_string_array*)$input); +%} diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/arrays_csharp.i b/macx64/bin/swig/share/swig/4.3.0/csharp/arrays_csharp.i similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/csharp/arrays_csharp.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/arrays_csharp.i index 237067a8..00ded718 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/arrays_csharp.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/arrays_csharp.i @@ -49,8 +49,17 @@ * %csmethodmodifiers myArrayCopy "public unsafe"; * void myArrayCopy( int *sourceArray, int* targetArray, int nitems ); * + * long type + * --------- + * Unlike other primitive types, the sizeof(long) varies considerably from one + * platform to another. The sizeof(long) in the unmanaged layer must match the + * number of bytes used in the managed layer. A check is implemented via the + * "long_check_wordsize" fragment which results in a compile time error upon an + * inconsistent match. Use the SWIGWORDSIZE64 macro to target 64-bit long. + * For easiest portability, avoid using long! * ----------------------------------------------------------------------------- */ + %define CSHARP_ARRAYS( CTYPE, CSTYPE ) // input only arrays @@ -94,16 +103,63 @@ CSHARP_ARRAYS(short, short) CSHARP_ARRAYS(unsigned short, ushort) CSHARP_ARRAYS(int, int) CSHARP_ARRAYS(unsigned int, uint) -// FIXME - on Unix 64 bit, long is 8 bytes but is 4 bytes on Windows 64 bit. -// How can this be handled sensibly? -// See e.g. http://www.xml.com/ldd/chapter/book/ch10.html -CSHARP_ARRAYS(long, int) -CSHARP_ARRAYS(unsigned long, uint) CSHARP_ARRAYS(long long, long) CSHARP_ARRAYS(unsigned long long, ulong) CSHARP_ARRAYS(float, float) CSHARP_ARRAYS(double, double) -CSHARP_ARRAYS(bool, bool) + +// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side +#if !defined(SWIGWORDSIZE64) +CSHARP_ARRAYS(long, int) +CSHARP_ARRAYS(unsigned long, uint) +#else +CSHARP_ARRAYS(long, long) +CSHARP_ARRAYS(unsigned long, ulong) +#endif +%typemap(in, fragment="long_check_wordsize") long INPUT[], unsigned long INPUT[] "$1 = $input;" +%typemap(in, fragment="long_check_wordsize") long OUTPUT[], unsigned long OUTPUT[] "$1 = $input;" +%typemap(in, fragment="long_check_wordsize") long INOUT[], unsigned long INOUT[] "$1 = $input;" + +// By default C# will marshal bools as 4 bytes +// UnmanagedType.I1 will change this to 1 byte +// FIXME - When running on mono ArraySubType appears to be ignored and bools will be marshalled as 4-byte +// https://github.com/mono/mono/issues/15592 + +// input only arrays +%typemap(ctype) bool INPUT[] "bool*" +%typemap(cstype) bool INPUT[] "bool[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INPUT[] "bool[]" +%typemap(csin) bool INPUT[] "$csinput" + +%typemap(in) bool INPUT[] %{ +$1 = $input; +%} +%typemap(freearg) bool INPUT[] "" +%typemap(argout) bool INPUT[] "" + +// output only arrays +%typemap(ctype) bool OUTPUT[] "bool*" +%typemap(cstype) bool OUTPUT[] "bool[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool OUTPUT[] "bool[]" +%typemap(csin) bool OUTPUT[] "$csinput" + +%typemap(in) bool OUTPUT[] %{ +$1 = $input; +%} +%typemap(freearg) bool OUTPUT[] "" +%typemap(argout) bool OUTPUT[] "" + +// inout arrays +%typemap(ctype) bool INOUT[] "bool*" +%typemap(cstype) bool INOUT[] "bool[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INOUT[] "bool[]" +%typemap(csin) bool INOUT[] "$csinput" + +%typemap(in) bool INOUT[] %{ +$1 = $input; +%} +%typemap(freearg) bool INOUT[] "" +%typemap(argout) bool INOUT[] "" %define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE ) @@ -129,11 +185,18 @@ CSHARP_ARRAYS_FIXED(short, short) CSHARP_ARRAYS_FIXED(unsigned short, ushort) CSHARP_ARRAYS_FIXED(int, int) CSHARP_ARRAYS_FIXED(unsigned int, uint) -CSHARP_ARRAYS_FIXED(long, int) -CSHARP_ARRAYS_FIXED(unsigned long, uint) CSHARP_ARRAYS_FIXED(long long, long) CSHARP_ARRAYS_FIXED(unsigned long long, ulong) CSHARP_ARRAYS_FIXED(float, float) CSHARP_ARRAYS_FIXED(double, double) CSHARP_ARRAYS_FIXED(bool, bool) +// 32-bit/64-bit architecture specific typemaps - special handling to ensure sizeof(long) on C side matches size used on C# side +#ifdef !SWIGWORDSIZE64 +CSHARP_ARRAYS_FIXED(long, int) +CSHARP_ARRAYS_FIXED(unsigned long, uint) +#else +CSHARP_ARRAYS_FIXED(long, long) +CSHARP_ARRAYS_FIXED(unsigned long, ulong) +#endif +%typemap(in, fragment="long_check_wordsize") long FIXED[], unsigned long FIXED[] "$1 = $input;" diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/boost_intrusive_ptr.i b/macx64/bin/swig/share/swig/4.3.0/csharp/boost_intrusive_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/csharp/boost_intrusive_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/boost_intrusive_ptr.i index fa3f53a2..355a910c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/boost_intrusive_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/csharp/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/csharp/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/csharp/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/boost_shared_ptr.i index 508c0ec1..d47fab55 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.3.0/csharp/cdata.i b/macx64/bin/swig/share/swig/4.3.0/csharp/cdata.i new file mode 100644 index 00000000..51d5f256 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/cdata.i @@ -0,0 +1,124 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +%pragma(csharp) imclasscode=%{ + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_bytes_to_c")] + public static extern global::System.IntPtr SWIG_csharp_bytes_to_c0(int len, byte[] ptr); + public static global::System.IntPtr SWIG_csharp_bytes_to_c(byte[] ptr) { + return SWIG_csharp_bytes_to_c0(ptr.Length, ptr); + } +%} + +%fragment("SWIG_csharp_bytes", "header") %{ +#ifdef __cplusplus +extern "C" { +#endif +typedef struct { int len; void *ptr; } SWIG_csharp_bytes; + +SWIGEXPORT void *SWIGSTDCALL SWIG_csharp_bytes_to_c(int len, void *ptr) { + SWIG_csharp_bytes *ret = (SWIG_csharp_bytes *)malloc(sizeof(SWIG_csharp_bytes)); + if (ret == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate bytes container."); + return SWIG_NULLPTR; + } + if (len > 0) { + ret->ptr = malloc(len); + if (ret->ptr == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate bytes."); + free(ret); + return SWIG_NULLPTR; + } + memcpy(ret->ptr, ptr, len); + ret->len = len; + } else { + ret->ptr = SWIG_NULLPTR; + ret->len = 0; + } + return ret; +} + +#ifdef __cplusplus +} +#endif +%} + +%typemap(cstype) (const void *BYTES, size_t LENGTH) "byte[]" +%typemap(ctype) (const void *BYTES, size_t LENGTH) "void *" +%typemap(imtype) (const void *BYTES, size_t LENGTH) "global::System.IntPtr" +%typemap(csin) (const void *BYTES, size_t LENGTH) "$modulePINVOKE.SWIG_csharp_bytes_to_c($csinput)" +%typemap(in, canthrow=1, fragment="SWIG_csharp_bytes") (const void *BYTES, size_t LENGTH) { + SWIG_csharp_bytes *p = (SWIG_csharp_bytes *)$input; + if (p != SWIG_NULLPTR) { + $1 = ($1_ltype)p->ptr; + $2 = ($2_ltype)p->len; + } else { + $1 = 0; + $2 = 0; + } +} +%typemap(freearg, fragment="SWIG_csharp_bytes") (const void *BYTES, size_t LENGTH) { + SWIG_csharp_bytes *p = (SWIG_csharp_bytes *)$input; + if (p != SWIG_NULLPTR) { + free(p->ptr); + free(p); + } +} + +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%pragma(csharp) imclasscode=%{ + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_data")] + public static extern int SWIG_csharp_data(global::System.IntPtr data, ref global::System.IntPtr m); +%} + +%fragment("SWIG_csharp_data", "header") %{ +#ifdef __cplusplus +extern "C" { +#endif + +SWIGEXPORT int SWIGSTDCALL SWIG_csharp_data(SWIGCDATA *d, void **ptr) { + int ret = 0; + if (d != SWIG_NULLPTR) { + if (d->len > 0 && d->data != SWIG_NULLPTR) { + *ptr = (void *)d->data; + ret = (int)d->len; + } + free(d); /* allocated in 'out' typemap */ + } + return ret; +} + +#ifdef __cplusplus +} +#endif +%} + +%typemap(ctype) SWIGCDATA "SWIGCDATA *" +%typemap(imtype) SWIGCDATA "global::System.IntPtr" +%typemap(cstype) SWIGCDATA "byte[]" +%typemap(out) SWIGCDATA %{ + $result = (SWIGCDATA*)malloc(sizeof($1)); + if ($result != SWIG_NULLPTR) { + memcpy($result, &$1, sizeof($1)); + } +%} +%typemap(csout, fragment="SWIG_csharp_data") SWIGCDATA { + global::System.IntPtr mm = global::System.IntPtr.Zero; + int size = $modulePINVOKE.SWIG_csharp_data($imcall, ref mm); + byte[] ret = new byte[size]; + if (size > 0) { + System.Runtime.InteropServices.Marshal.Copy(mm, ret, 0, size); + } + return ret; +} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/complex.i b/macx64/bin/swig/share/swig/4.3.0/csharp/complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/complex.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/csharp.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/csharp.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/csharp/csharp.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/csharp.swg index 83220638..3e1d050d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/csharp.swg +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/csharp.swg @@ -82,8 +82,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(ctype) unsigned short, const unsigned short & "unsigned short" %typemap(ctype) int, const int & "int" %typemap(ctype) unsigned int, const unsigned int & "unsigned int" -%typemap(ctype) long, const long & "long" -%typemap(ctype) unsigned long, const unsigned long & "unsigned long" +%typemap(ctype) long, const long & "int" +%typemap(ctype) unsigned long, const unsigned long & "unsigned int" %typemap(ctype) long long, const long long & "long long" %typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long" %typemap(ctype) float, const float & "float" @@ -201,9 +201,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(directorin) short "$input = $1;" %typemap(directorin) unsigned short "$input = $1;" %typemap(directorin) int "$input = $1;" -%typemap(directorin) unsigned int "$input = $1;" +%typemap(directorin) unsigned int "$input = (unsigned int)$1;" %typemap(directorin) long "$input = $1;" -%typemap(directorin) unsigned long "$input = (unsigned long)$1;" +%typemap(directorin) unsigned long "$input = $1;" %typemap(directorin) long long "$input = $1;" %typemap(directorin) unsigned long long "$input = $1;" %typemap(directorin) float "$input = $1;" @@ -246,9 +246,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) short %{ $result = $1; %} %typemap(out) unsigned short %{ $result = $1; %} %typemap(out) int %{ $result = $1; %} -%typemap(out) unsigned int %{ $result = $1; %} +%typemap(out) unsigned int %{ $result = (unsigned int)$1; %} %typemap(out) long %{ $result = $1; %} -%typemap(out) unsigned long %{ $result = (unsigned long)$1; %} +%typemap(out) unsigned long %{ $result = $1; %} %typemap(out) long long %{ $result = $1; %} %typemap(out) unsigned long long %{ $result = $1; %} %typemap(out) float %{ $result = $1; %} @@ -327,7 +327,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(directorin) const short & "$input = $1;" %typemap(directorin) const unsigned short & "$input = $1;" %typemap(directorin) const int & "$input = $1;" -%typemap(directorin) const unsigned int & "$input = $1;" +%typemap(directorin) const unsigned int & "$input = (unsigned int)$1;" %typemap(directorin) const long & "$input = $1;" %typemap(directorin) const unsigned long & "$input = $1;" %typemap(directorin) const long long & "$input = $1;" @@ -373,9 +373,9 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) const short & %{ $result = *$1; %} %typemap(out) const unsigned short & %{ $result = *$1; %} %typemap(out) const int & %{ $result = *$1; %} -%typemap(out) const unsigned int & %{ $result = *$1; %} +%typemap(out) const unsigned int & %{ $result = (unsigned int)*$1; %} %typemap(out) const long & %{ $result = *$1; %} -%typemap(out) const unsigned long & %{ $result = (unsigned long)*$1; %} +%typemap(out) const unsigned long & %{ $result = *$1; %} %typemap(out) const long long & %{ $result = *$1; %} %typemap(out) const unsigned long long & %{ $result = *$1; %} %typemap(out) const float & %{ $result = *$1; %} @@ -399,7 +399,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(out) SWIGTYPE #ifdef __cplusplus -%{ $result = new $1_ltype((const $1_ltype &)$1); %} +%{ $result = new $1_ltype($1); %} #else { $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype)); @@ -409,7 +409,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%{ $input = (void *)new $1_ltype(SWIG_STD_MOVE($1)); %} %typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" @@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %} %typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; } %} -%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0); return $null; - } %} + } + rvrdeleter.reset($1); %} %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %} %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{ char buf[128]; @@ -578,7 +579,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { unsigned long, unsigned short %{ char error_msg[256]; - sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1); + SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1); SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg); return $null; %} @@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { "$csinput" %typemap(csin) char *, char *&, char[ANY], char[] "$csinput" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)" -%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)" %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)" /* The csout typemap is used for converting function return types from the return type @@ -875,6 +877,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { global::System.IntPtr ret = $imcall;$excode return ret; } +%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{ + set { + $imcall;$excode + } %} +%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{ + get { + global::System.IntPtr ret = $imcall;$excode + return ret; + } %} %typemap(csdirectorin) void *VOID_INT_PTR "$iminput" %typemap(csdirectorout) void *VOID_INT_PTR "$cscall" @@ -885,6 +896,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(csinterfaces) SWIGTYPE "global::System.IDisposable" %typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(csinterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface" // csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users. @@ -903,6 +915,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} // Derived proxy classes @@ -916,6 +941,19 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + if (obj != null) { + if (!obj.swigCMemOwn) + throw new global::System.ApplicationException("Cannot release ownership as memory is not owned"); + global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + obj.Dispose(); + return ptr; + } else { + return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + } %} %enddef @@ -935,6 +973,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef swigRelease($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } %} %typemap(csbody) TYPE (CLASS::*) %{ @@ -1020,10 +1062,17 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE) %pragma(csharp) imclassclassmodifiers="class" %pragma(csharp) moduleclassmodifiers="public class" -/* Some ANSI C typemaps */ +/* 64-bit architecture specific typemaps */ +#if defined(SWIGWORDSIZE64) +%apply long long { long }; +%apply unsigned long long { unsigned long }; +%apply const long long & { const long & }; +%apply const unsigned long long & { const unsigned long & }; +#endif -%apply unsigned long { size_t }; -%apply const unsigned long & { const size_t & }; +/* size_t maps to C# 32-bit uint type */ +%apply unsigned int { size_t }; +%apply const unsigned int & { const size_t & }; /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } @@ -1034,6 +1083,100 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE) %apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } %apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } +/* String & length */ +%fragment("SWIG_csharp_string", "header") %{ +#ifdef __cplusplus +extern "C" { +#endif +typedef struct { int len; int size; char* str; } SWIG_csharp_string; + +SWIGEXPORT void* SWIGSTDCALL SWIG_csharp_string_to_c(int size, int len, char *str) { + SWIG_csharp_string *ret; + ret = (SWIG_csharp_string *)malloc(sizeof(SWIG_csharp_string)); + if (ret == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate string container."); + return SWIG_NULLPTR; + } + if (size > 0) { + /* The string is in UTF8 encoding */ + ret->str = (char *)malloc(size + 1); + if (ret->str == SWIG_NULLPTR) { + SWIG_CSharpSetPendingException(SWIG_CSharpOutOfMemoryException, "fail to duplicate string."); + free(ret); + return SWIG_NULLPTR; + } + memcpy(ret->str, str, size + 1); + ret->size = size; /* number of bytes in the UTF8 encoding */ + ret->len = len; /* number of characters in string */ + } else { + ret->str = SWIG_NULLPTR; + ret->size = 0; + ret->len = 0; + } + return ret; +} +SWIGEXPORT int SWIGSTDCALL SWIG_csharp_string_size(SWIG_csharp_string *p) { + if (p) { + return p->size; + } + return 0; +} +SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) { + if (p) { + char *ret = p->str; + free(p); + return ret; + } + return NULL; +} + +#ifdef __cplusplus +} +#endif +%} + +/* string & length typemap */ + +%typemap(cstype) (const char *STRING, size_t LENGTH) "string" +%typemap(ctype) (const char *STRING, size_t LENGTH) "void *" +%typemap(imtype) (const char *STRING, size_t LENGTH) "global::System.IntPtr" +%typemap(csin) (const char *STRING, size_t LENGTH) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_csharp_string_to_c($csinput)" +%typemap(in, canthrow=1, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) { + SWIG_csharp_string *p; + p = (SWIG_csharp_string *)$input; + if (p != SWIG_NULLPTR) { + $1 = ($1_ltype)p->str; + $2 = ($2_ltype)p->size; /* We use number of bytes */ + } else { + $1 = 0; + $2 = 0; + } +} +%typemap(freearg, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) { + SWIG_csharp_string *p; + p = (SWIG_csharp_string *)$input; + if (p != SWIG_NULLPTR) { + free(p->str); + free(p); + } +} + +%typemap(directorin) (const char *STRING, size_t LENGTH) %{ + if ($1 && $2 > 0) { + $input = malloc(sizeof(SWIG_csharp_string)); + if ($input) { + SWIG_csharp_string *p = (SWIG_csharp_string *)$input; + p->str = (char *)$1; + p->size = (int)$2; + } + } +%} +%typemap(csdirectorin) (const char *STRING, size_t LENGTH) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_c_to_csharp_string($iminput)" + +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) } +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } + /* csharp keywords */ %include diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/csharphead.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/csharphead.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/csharp/csharphead.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/csharphead.swg index 7db4c0e3..d7ceda23 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/csharphead.swg +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/csharphead.swg @@ -324,6 +324,41 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString %} #endif // SWIG_CSHARP_NO_STRING_HELPER +#if !defined(SWIG_CSHARP_NO_STRING_WITH_LENGTH_HELPER) +%pragma(csharp) imclasscode=%{ + public class SWIGStringWithLengthHelper { + + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_to_c")] + private static extern global::System.IntPtr SWIG_csharp_string_to_c0(int size, int len, [global::System.Runtime.InteropServices.In,global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPStr, SizeParamIndex=0)] string str); + + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_size")] + private static extern int SWIG_csharp_string_size(global::System.IntPtr str); + + [global::System.Runtime.InteropServices.DllImport("$module", EntryPoint="SWIG_csharp_string_str")] + private static extern global::System.IntPtr SWIG_csharp_string_str(global::System.IntPtr str); + + public static global::System.IntPtr SWIG_csharp_string_to_c(string str) { + if (str == null) + return global::System.IntPtr.Zero; + global::System.Text.Encoding utf8 = global::System.Text.Encoding.UTF8; + return SWIG_csharp_string_to_c0(utf8.GetByteCount(str), str.Length, str); + } + + public static string SWIG_c_to_csharp_string(global::System.IntPtr str) { + int size = SWIG_csharp_string_size(str); + if (size > 0) { + global::System.IntPtr s = SWIG_csharp_string_str(str); + byte[] b = new byte[size]; + global::System.Runtime.InteropServices.Marshal.Copy(s, b, 0, size); + global::System.Text.Encoding utf8 = global::System.Text.Encoding.UTF8; + return utf8.GetString(b); + } + return null; + } + } +%} +#endif // SWIG_CSHARP_NO_STRING_WITH_LENGTH_HELPER + #if !defined(SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR) // Ensure the class is not marked beforefieldinit %pragma(csharp) imclasscode=%{ @@ -335,5 +370,5 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString %insert(runtime) %{ /* Contract support */ -#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else +#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } } while (0) %} diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/csharpkw.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/csharpkw.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/csharp/csharpkw.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/csharpkw.swg index 824f6187..1904fce9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/csharpkw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/csharpkw.swg @@ -2,9 +2,9 @@ #define CSHARP_CSHARPKW_SWG_ /* Warnings for C# keywords */ -#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x` +#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword",rename="%s_") `x` -#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x` +#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes",%$isclass,rename="%s_") `x` /* from diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/director.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/director.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/director.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/director.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/enums.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/enums.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/enums.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/enums.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/enumsimple.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/enumsimple.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/enumsimple.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/enumsimple.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/enumtypesafe.swg b/macx64/bin/swig/share/swig/4.3.0/csharp/enumtypesafe.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/enumtypesafe.swg rename to macx64/bin/swig/share/swig/4.3.0/csharp/enumtypesafe.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_array.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_array.i similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_array.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_array.i index a4f0f964..87b1b895 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_array.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_array.i @@ -6,37 +6,37 @@ * The C# wrapper is made to look and feel like a C# System.Collections.Generic.IReadOnlyList<> collection. * ----------------------------------------------------------------------------- */ -%{ -#include -#include -#include -%} - %include -%define SWIG_STD_ARRAY_INTERNAL(T, N) -%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n"; +%define SWIG_STD_ARRAY_INTERNAL(CTYPE, N) +%typemap(csinterfaces) std::array< CTYPE, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>\n" %proxycode %{ public $csclassname(global::System.Collections.ICollection c) : this() { if (c == null) throw new global::System.ArgumentNullException("c"); - int end = global::System.Math.Min(this.Count, c.Count); + int count = this.Count; int i = 0; - foreach ($typemap(cstype, T) elem in c) { - if (i >= end) + foreach ($typemap(cstype, CTYPE) element in c) { + if (i >= count) break; - this[i++] = elem; + this[i++] = element; } } - public int Count { + public bool IsFixedSize { get { - return (int)size(); + return true; } } - public $typemap(cstype, T) this[int index] { + public bool IsReadOnly { + get { + return false; + } + } + + public $typemap(cstype, CTYPE) this[int index] { get { return getitem(index); } @@ -51,17 +51,29 @@ } } - public void CopyTo($typemap(cstype, T)[] array) + public int Count { + get { + return (int)size(); + } + } + + public bool IsSynchronized { + get { + return false; + } + } + + public void CopyTo($typemap(cstype, CTYPE)[] array) { CopyTo(0, array, 0, this.Count); } - public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) + public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex) { CopyTo(0, array, arrayIndex, this.Count); } - public void CopyTo(int index, $typemap(cstype, T)[] array, int arrayIndex, int count) + public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count) { if (array == null) throw new global::System.ArgumentNullException("array"); @@ -79,7 +91,13 @@ array.SetValue(getitemcopy(index+i), arrayIndex+i); } - global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() { + public $typemap(cstype, CTYPE)[] ToArray() { + $typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[this.Count]; + this.CopyTo(array); + return array; + } + + global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() { return new $csclassnameEnumerator(this); } @@ -97,7 +115,7 @@ /// collection but not when one of the elements of the collection is modified as it is a bit /// tricky to detect unmanaged code that modifies the collection under our feet. public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator - , global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> + , global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> { private $csclassname collectionRef; private int currentIndex; @@ -112,7 +130,7 @@ } // Type-safe iterator Current - public $typemap(cstype, T) Current { + public $typemap(cstype, CTYPE) Current { get { if (currentIndex == -1) throw new global::System.InvalidOperationException("Enumeration not started."); @@ -120,7 +138,7 @@ throw new global::System.InvalidOperationException("Enumeration finished."); if (currentObject == null) throw new global::System.InvalidOperationException("Collection modified."); - return ($typemap(cstype, T))currentObject; + return ($typemap(cstype, CTYPE))currentObject; } } @@ -161,7 +179,7 @@ public: typedef size_t size_type; typedef ptrdiff_t difference_type; - typedef T value_type; + typedef CTYPE value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; @@ -180,7 +198,7 @@ void swap(array& other); %extend { - T getitemcopy(int index) throw (std::out_of_range) { + CTYPE getitemcopy(int index) throw (std::out_of_range) { if (index>=0 && index<(int)$self->size()) return (*$self)[index]; else @@ -213,6 +231,11 @@ } %enddef +%{ +#include +#include +#include +%} %csmethodmodifiers std::array::empty "private" %csmethodmodifiers std::array::getitemcopy "private" diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_auto_ptr.i new file mode 100644 index 00000000..da15df3e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_auto_ptr.i @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * SWIG library file for handling std::auto_ptr. + * Memory ownership is passed from the std::auto_ptr C++ layer to the proxy + * class when returning a std::auto_ptr from a function. + * Memory ownership is passed from the proxy class to the std::auto_ptr in the + * C++ layer when passed as a parameter to a wrapped function. + * ----------------------------------------------------------------------------- */ + +%define %auto_ptr(TYPE) +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)" + +%typemap(in) std::auto_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} + +%typemap(csin) std::auto_ptr< TYPE > "$typemap(cstype, TYPE).swigRelease($csinput)" + +%typemap (out) std::auto_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} + +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + +%template() std::auto_ptr< TYPE >; +%enddef + +namespace std { + template class auto_ptr {}; +} diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_common.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_except.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_list.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_list.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_list.i index 674aba0a..cf6f2023 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_list.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/csharp/std_map.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_map.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_map.i index e538a03a..4f447422 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.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] { @@ -48,6 +48,12 @@ return false; } + public bool IsEmpty { + get { + return empty(); + } + } + public int Count { get { return (int)size(); @@ -236,7 +242,11 @@ } void setitem(const key_type& key, const mapped_type& x) { +%#ifdef __cpp_lib_map_try_emplace + (*$self).insert_or_assign(key, x); +%#else (*$self)[key] = x; +%#endif } bool ContainsKey(const key_type& key) { @@ -269,12 +279,14 @@ } const key_type& get_next_key(std::map< K, T, C >::iterator *swigiterator) { + (void)$self; std::map< K, T, C >::iterator iter = *swigiterator; (*swigiterator)++; return (*iter).first; } void destroy_iterator(std::map< K, T, C >::iterator *swigiterator) { + (void)$self; delete swigiterator; } } @@ -282,6 +294,7 @@ %enddef +%csmethodmodifiers std::map::empty "private" %csmethodmodifiers std::map::size "private" %csmethodmodifiers std::map::getitem "private" %csmethodmodifiers std::map::setitem "private" @@ -295,18 +308,3 @@ namespace std { SWIG_STD_MAP_INTERNAL(K, T, C) }; } - - -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_set.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_set.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_set.i index 3b2492e0..480a24cc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_set.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_set.i @@ -16,6 +16,7 @@ #include %} +%csmethodmodifiers std::set::empty "private" %csmethodmodifiers std::set::size "private" %csmethodmodifiers std::set::getitem "private" %csmethodmodifiers std::set::create_iterator_begin "private" @@ -28,9 +29,9 @@ namespace std { template class 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(string item) { + void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) { ((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item); } @@ -44,6 +45,12 @@ class set { } } + public bool IsEmpty { + get { + return empty(); + } + } + public int Count { get { return (int)size(); @@ -192,7 +199,7 @@ class set { private $csclassname collectionRef; private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection; private int currentIndex; - private $typemap(cstype, T) currentObject; + private object currentObject; private int currentSize; public $csclassnameEnumerator($csclassname collection) { @@ -212,7 +219,7 @@ class set { throw new global::System.InvalidOperationException("Enumeration finished."); if (currentObject == null) throw new global::System.InvalidOperationException("Collection modified."); - return currentObject; + return ($typemap(cstype, T))currentObject; } } @@ -297,12 +304,14 @@ class set { } const key_type& get_next(std::set::iterator *swigiterator) { + (void)$self; std::set::iterator iter = *swigiterator; (*swigiterator)++; return *iter; } void destroy_iterator(std::set::iterator *swigiterator) { + (void)$self; delete swigiterator; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_string.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_string.i similarity index 92% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_string.i index 5f8fa44c..c8920c09 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_string.i @@ -20,7 +20,7 @@ namespace std { class string; // string -%typemap(ctype) string "char *" +%typemap(ctype) string "const char *" %typemap(imtype) string "string" %typemap(cstype) string "string" @@ -42,7 +42,7 @@ class string; } $result.assign($input); %} -%typemap(directorin) string %{ $input = SWIG_csharp_string_callback($1.c_str()); %} +%typemap(directorin) string %{ $input = $1.c_str(); %} %typemap(csin) string "$csinput" %typemap(csout, excode=SWIGEXCODE) string { @@ -57,7 +57,7 @@ class string; return $null; %} // const string & -%typemap(ctype) const string & "char *" +%typemap(ctype) const string & "const char *" %typemap(imtype) const string & "string" %typemap(cstype) const string & "string" @@ -89,7 +89,7 @@ class string; $1_str = $input; $result = &$1_str; %} -%typemap(directorin) const string & %{ $input = SWIG_csharp_string_callback($1.c_str()); %} +%typemap(directorin) const string & %{ $input = $1.c_str(); %} %typemap(csvarin, excode=SWIGEXCODE2) const string & %{ set { diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_string_view.i new file mode 100644 index 00000000..3b6cd40e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_string_view.i @@ -0,0 +1,116 @@ +/* ----------------------------------------------------------------------------- + * std_string_view.i + * + * Typemaps for std::string_view and const std::string_view& + * These are mapped to a C# String and are passed around by value. + * + * To use non-const std::string_view references use the following %apply. Note + * that they are passed by value. + * %apply const std::string_view & {std::string_view &}; + * ----------------------------------------------------------------------------- */ + +%{ +#include +#include +%} + +namespace std { + +%naturalvar string_view; + +class string_view; + +// string_view +%typemap(ctype) string_view "const char *" +%typemap(imtype) string_view "string" +%typemap(cstype) string_view "string" + +%typemap(csdirectorin) string_view "$iminput" +%typemap(csdirectorout) string_view "$cscall" + +%typemap(in, canthrow=1) string_view +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0); + return $null; + } + $1 = std::string_view($input); %} +%typemap(out) string_view %{ $result = SWIG_csharp_string_callback(std::string($1).c_str()); %} + +%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) string_view +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0); + return $null; + } + /* possible thread/reentrant code problem */ + static std::string $1_str; + $1_str = $input; + $result = std::string_view($1_str); %} + +%typemap(directorin) string_view %{ $input = std::string($1).c_str(); %} + +%typemap(csin) string_view "$csinput" +%typemap(csout, excode=SWIGEXCODE) string_view { + string ret = $imcall;$excode + return ret; + } + +%typemap(typecheck) string_view = char *; + +%typemap(throws, canthrow=1) string_view +%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str()); + return $null; %} + +// const string_view & +%typemap(ctype) const string_view & "const char *" +%typemap(imtype) const string_view & "string" +%typemap(cstype) const string_view & "string" + +%typemap(csdirectorin) const string_view & "$iminput" +%typemap(csdirectorout) const string_view & "$cscall" + +%typemap(in, canthrow=1) const string_view & +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0); + return $null; + } + $*1_ltype $1_str($input); + $1 = &$1_str; %} +%typemap(out) const string_view & %{ $result = SWIG_csharp_string_callback(std::string(*$1).c_str()); %} + +%typemap(csin) const string_view & "$csinput" +%typemap(csout, excode=SWIGEXCODE) const string_view & { + string ret = $imcall;$excode + return ret; + } + +%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string_view & +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0); + return $null; + } + /* possible thread/reentrant code problem */ + static std::string $1_str; + $1_str = $input; + static $*1_ltype $1_strview; + $1_strview = $1_str; + $result = &$1_strview; %} + +%typemap(directorin) const string_view & %{ $input = std::string($1).c_str(); %} + +%typemap(csvarin, excode=SWIGEXCODE2) const string_view & %{ + set { + $imcall;$excode + } %} +%typemap(csvarout, excode=SWIGEXCODE2) const string_view & %{ + get { + string ret = $imcall;$excode + return ret; + } %} + +%typemap(typecheck) const string_view & = char *; + +%typemap(throws, canthrow=1) const string_view & +%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, std::string($1).c_str()); + return $null; %} + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unique_ptr.i new file mode 100644 index 00000000..d264c1e7 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unique_ptr.i @@ -0,0 +1,60 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "void *" +%typemap (imtype, out="System.IntPtr") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(cstype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} +%typemap(in) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && +%{ $*1_ltype $1_uptr((TYPE *)$input); + $1 = &$1_uptr; %} +%typemap(in, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & +%{ swig::NoDeleteUniquePtr< TYPE > $1_ndup((TYPE *)$input); +$1 = &$1_ndup.uptr; %} + +%typemap(csin) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(cstype, TYPE).swigRelease($csinput)" +%typemap(csin) const std::unique_ptr< TYPE > & "$typemap(cstype, TYPE).getCPtr($csinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + $result = (void *)$1->get(); +%} + + +%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, false);$excode + return ret; + } + + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "" + +%template() std::unique_ptr< TYPE >; +%enddef diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_map.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_map.i new file mode 100644 index 00000000..f8145e37 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_map.i @@ -0,0 +1,306 @@ +/* ----------------------------------------------------------------------------- + * std_unordered_map.i + * + * SWIG typemaps for std::unordered_map< K, T, H > + * + * The C# wrapper is made to look and feel like a C# System.Collections.Generic.IDictionary<>. + * + * Using this wrapper is fairly simple. For example, to create an unordered_map from integers to doubles use: + * + * %include + * %template(MapIntDouble) std::unordered_map + * + * Notes: + * 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with + * C++ std::unordered_map wrappers. + * + * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents! + * ----------------------------------------------------------------------------- */ + +%{ +#include +#include +#include +%} + +/* K is the C++ key type, T is the C++ value type */ +%define SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H) + +%typemap(csinterfaces) std::unordered_map< K, T, H > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n" +%proxycode %{ + + public $typemap(cstype, T) this[$typemap(cstype, K) key] { + get { + return getitem(key); + } + + set { + setitem(key, value); + } + } + + public bool TryGetValue($typemap(cstype, K) key, out $typemap(cstype, T) value) { + if (this.ContainsKey(key)) { + value = this[key]; + return true; + } + value = default($typemap(cstype, T)); + return false; + } + + public bool IsEmpty { + get { + return empty(); + } + } + + public int Count { + get { + return (int)size(); + } + } + + public bool IsReadOnly { + get { + return false; + } + } + + public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys { + get { + global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>(); + int size = this.Count; + if (size > 0) { + global::System.IntPtr iter = create_iterator_begin(); + for (int i = 0; i < size; i++) { + keys.Add(get_next_key(iter)); + } + destroy_iterator(iter); + } + return keys; + } + } + + public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values { + get { + global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>(); + foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) { + vals.Add(pair.Value); + } + return vals; + } + } + + public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + Add(item.Key, item.Value); + } + + public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + if (Contains(item)) { + return Remove(item.Key); + } else { + return false; + } + } + + public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + if (this[item.Key] == item.Value) { + return true; + } else { + return false; + } + } + + public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) { + CopyTo(array, 0); + } + + public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (arrayIndex+this.Count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + + global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys); + for (int i = 0; i < keyList.Count; i++) { + $typemap(cstype, K) currentKey = keyList[i]; + array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i); + } + } + + global::System.Collections.Generic.IEnumerator> global::System.Collections.Generic.IEnumerable>.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + public $csclassnameEnumerator GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator, + global::System.Collections.Generic.IEnumerator> + { + private $csclassname collectionRef; + private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection; + private int currentIndex; + private object currentObject; + private int currentSize; + + public $csclassnameEnumerator($csclassname collection) { + collectionRef = collection; + keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys); + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current { + get { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current { + get { + return Current; + } + } + + public bool MoveNext() { + int size = collectionRef.Count; + bool moveOkay = (currentIndex+1 < size) && (size == currentSize); + if (moveOkay) { + currentIndex++; + $typemap(cstype, K) currentKey = keyCollection[currentIndex]; + currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]); + } else { + currentObject = null; + } + return moveOkay; + } + + public void Reset() { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() { + currentIndex = -1; + currentObject = null; + } + } + +%} + + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + unordered_map(); + unordered_map(const unordered_map& other); + size_type size() const; + bool empty() const; + %rename(Clear) clear; + void clear(); + %extend { + const mapped_type& getitem(const key_type& key) throw (std::out_of_range) { + std::unordered_map< K, T, H >::iterator iter = $self->find(key); + if (iter != $self->end()) + return iter->second; + else + throw std::out_of_range("key not found"); + } + + void setitem(const key_type& key, const mapped_type& x) { + (*$self)[key] = x; + } + + bool ContainsKey(const key_type& key) { + std::unordered_map< K, T, H >::iterator iter = $self->find(key); + return iter != $self->end(); + } + + void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) { + std::unordered_map< K, T, H >::iterator iter = $self->find(key); + if (iter != $self->end()) + throw std::out_of_range("key already exists"); + $self->insert(std::pair< K, T >(key, value)); + } + + bool Remove(const key_type& key) { + std::unordered_map< K, T, H >::iterator iter = $self->find(key); + if (iter != $self->end()) { + $self->erase(iter); + return true; + } + return false; + } + + // create_iterator_begin(), get_next_key() and destroy_iterator work together to provide a collection of keys to C# + %apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *create_iterator_begin } + %apply void *VOID_INT_PTR { std::unordered_map< K, T, H >::iterator *swigiterator } + + std::unordered_map< K, T, H >::iterator *create_iterator_begin() { + return new std::unordered_map< K, T, H >::iterator($self->begin()); + } + + const key_type& get_next_key(std::unordered_map< K, T, H >::iterator *swigiterator) { + (void)self; + std::unordered_map< K, T, H >::iterator iter = *swigiterator; + (*swigiterator)++; + return (*iter).first; + } + + void destroy_iterator(std::unordered_map< K, T, H >::iterator *swigiterator) { + (void)self; + delete swigiterator; + } + } + + +%enddef + +%csmethodmodifiers std::unordered_map::empty "private" +%csmethodmodifiers std::unordered_map::size "private" +%csmethodmodifiers std::unordered_map::getitem "private" +%csmethodmodifiers std::unordered_map::setitem "private" +%csmethodmodifiers std::unordered_map::create_iterator_begin "private" +%csmethodmodifiers std::unordered_map::get_next_key "private" +%csmethodmodifiers std::unordered_map::destroy_iterator "private" + +// Default implementation +namespace std { + template > class unordered_map { + SWIG_STD_UNORDERED_MAP_INTERNAL(K, T, H) + }; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_set.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_set.i new file mode 100644 index 00000000..d6f6a18f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_unordered_set.i @@ -0,0 +1,320 @@ +/* ----------------------------------------------------------------------------- + * std_unordered_set.i + * + * SWIG typemaps for std::unordered_set. + * + * Note that ISet<> used here requires .NET 4 or later. + * + * The C# wrapper implements ISet<> interface and is similar in + * characteristics to the C# System.Collections.Generic.HashSet<> class, but + * doesn't provide quite all of its methods. + * ----------------------------------------------------------------------------- */ + +%{ +#include +#include +#include +%} + +%csmethodmodifiers std::unordered_set::empty "private" +%csmethodmodifiers std::unordered_set::size "private" +%csmethodmodifiers std::unordered_set::getitem "private" +%csmethodmodifiers std::unordered_set::create_iterator_begin "private" +%csmethodmodifiers std::unordered_set::get_next "private" +%csmethodmodifiers std::unordered_set::destroy_iterator "private" + +namespace std { + +// TODO: Add support for comparator and allocator template parameters. +template +class unordered_set { + +%typemap(csinterfaces) std::unordered_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); + } + + public bool TryGetValue($typemap(cstype, T) equalValue, out $typemap(cstype, T) actualValue) { + try { + actualValue = getitem(equalValue); + return true; + } catch { + actualValue = default($typemap(cstype, T)); + return false; + } + } + + public bool IsEmpty { + get { + return empty(); + } + } + + public int Count { + get { + return (int)size(); + } + } + + public bool IsReadOnly { + get { + return false; + } + } + + public void CopyTo($typemap(cstype, T)[] array) { + CopyTo(array, 0); + } + + public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (arrayIndex+this.Count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + + foreach ($typemap(cstype, T) item in this) { + array.SetValue(item, arrayIndex++); + } + } + + public void ExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + foreach ($typemap(cstype, T) item in other) { + Remove(item); + } + } + + public void IntersectWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + $csclassname old = new $csclassname(this); + + Clear(); + foreach ($typemap(cstype, T) item in other) { + if (old.Contains(item)) + Add(item); + } + } + + private static int count_enum(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + int count = 0; + foreach ($typemap(cstype, T) item in other) { + count++; + } + + return count; + } + + public bool IsProperSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + return IsSubsetOf(other) && Count < count_enum(other); + } + + public bool IsProperSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + return IsSupersetOf(other) && Count > count_enum(other); + } + + public bool IsSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + int countContained = 0; + + foreach ($typemap(cstype, T) item in other) { + if (Contains(item)) + countContained++; + } + + return countContained == Count; + } + + public bool IsSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + foreach ($typemap(cstype, T) item in other) { + if (!Contains(item)) + return false; + } + + return true; + } + + public bool Overlaps(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + foreach ($typemap(cstype, T) item in other) { + if (Contains(item)) + return true; + } + + return false; + } + + public bool SetEquals(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + return IsSupersetOf(other) && Count == count_enum(other); + } + + public void SymmetricExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + foreach ($typemap(cstype, T) item in other) { + if (!Remove(item)) + Add(item); + } + } + + public void UnionWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) { + foreach ($typemap(cstype, T) item in other) { + Add(item); + } + } + + private global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Items { + get { + global::System.Collections.Generic.ICollection<$typemap(cstype, T)> items = new global::System.Collections.Generic.List<$typemap(cstype, T)>(); + int size = this.Count; + if (size > 0) { + global::System.IntPtr iter = create_iterator_begin(); + for (int i = 0; i < size; i++) { + items.Add(get_next(iter)); + } + destroy_iterator(iter); + } + return items; + } + } + + global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + public $csclassnameEnumerator GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator, + global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> + { + private $csclassname collectionRef; + private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection; + private int currentIndex; + private object currentObject; + private int currentSize; + + public $csclassnameEnumerator($csclassname collection) { + collectionRef = collection; + ItemsCollection = new global::System.Collections.Generic.List<$typemap(cstype, T)>(collection.Items); + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public $typemap(cstype, T) Current { + get { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return ($typemap(cstype, T))currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current { + get { + return Current; + } + } + + public bool MoveNext() { + int size = collectionRef.Count; + bool moveOkay = (currentIndex+1 < size) && (size == currentSize); + if (moveOkay) { + currentIndex++; + currentObject = ItemsCollection[currentIndex]; + } else { + currentObject = null; + } + return moveOkay; + } + + public void Reset() { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() { + currentIndex = -1; + currentObject = null; + } + } + +%} + + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T key_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + unordered_set(); + unordered_set(const unordered_set& other); + size_type size() const; + bool empty() const; + %rename(Clear) clear; + void clear(); + %extend { + bool Add(const value_type& item) { + return $self->insert(item).second; + } + + bool Contains(const value_type& item) { + return $self->count(item) != 0; + } + + bool Remove(const value_type& item) { + return $self->erase(item) != 0; + } + + const value_type& getitem(const value_type& item) throw (std::out_of_range) { + std::unordered_set::iterator iter = $self->find(item); + if (iter == $self->end()) + throw std::out_of_range("item not found"); + + return *iter; + } + + // create_iterator_begin(), get_next() and destroy_iterator work together to provide a collection of items to C# + %apply void *VOID_INT_PTR { std::unordered_set::iterator *create_iterator_begin } + %apply void *VOID_INT_PTR { std::unordered_set::iterator *swigiterator } + + std::unordered_set::iterator *create_iterator_begin() { + return new std::unordered_set::iterator($self->begin()); + } + + const key_type& get_next(std::unordered_set::iterator *swigiterator) { + (void)$self; + std::unordered_set::iterator iter = *swigiterator; + (*swigiterator)++; + return *iter; + } + + void destroy_iterator(std::unordered_set::iterator *swigiterator) { + (void)$self; + delete swigiterator; + } + } +}; + +} diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_vector.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/csharp/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/std_vector.i index e2811290..982306e0 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.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) @@ -63,12 +63,18 @@ return (int)capacity(); } set { - if (value < size()) + if (value < 0 || ($typemap(cstype, size_t))value < size()) throw new global::System.ArgumentOutOfRangeException("Capacity"); reserve(($typemap(cstype, size_t))value); } } + public bool IsEmpty { + get { + return empty(); + } + } + public int Count { get { return (int)size(); @@ -203,19 +209,20 @@ typedef value_type& reference; typedef CONST_REFERENCE const_reference; + vector(); + vector(const vector &other); + %rename(Clear) clear; void clear(); %rename(Add) push_back; void push_back(CTYPE const& x); size_type size() const; + bool empty() const; size_type capacity() const; void reserve(size_type n); %newobject GetRange(int index, int count); %newobject Repeat(CTYPE const& value, int count); - vector(); - vector(const vector &other); - %extend { vector(int capacity) throw (std::out_of_range) { std::vector< CTYPE >* pv = 0; @@ -357,22 +364,13 @@ namespace std { } %enddef -// Legacy macros -%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...) -#warning SWIG_STD_VECTOR_SPECIALIZE macro deprecated, please see csharp/std_vector.i and switch to SWIG_STD_VECTOR_ENHANCED -SWIG_STD_VECTOR_ENHANCED(CTYPE) -%enddef - -%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...) -#warning SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro deprecated, it is no longer required -%enddef - %{ #include #include #include %} +%csmethodmodifiers std::vector::empty "private" %csmethodmodifiers std::vector::getitemcopy "private" %csmethodmodifiers std::vector::getitem "private" %csmethodmodifiers std::vector::setitem "private" @@ -415,4 +413,3 @@ SWIG_STD_VECTOR_ENHANCED(float) SWIG_STD_VECTOR_ENHANCED(double) SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include SWIG_STD_VECTOR_ENHANCED(std::wstring) // also requires a %include - diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/csharp/std_wstring.i new file mode 100644 index 00000000..c7fef41a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/std_wstring.i @@ -0,0 +1,146 @@ +/* ----------------------------------------------------------------------------- + * std_wstring.i + * + * Typemaps for std::wstring and const std::wstring& + * 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. + * %apply const std::wstring & {std::wstring &}; + * ----------------------------------------------------------------------------- */ + +%include + +%{ +#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; + +class wstring; + +// wstring +%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)]", + 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, fragment="Swig_csharp_UTF16ToWString") wstring +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); + return $null; + } + $1 = Swig_csharp_UTF16ToWString($input); %} +%typemap(out) wstring %{ $result = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %} + +%typemap(directorout, canthrow=1) wstring +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); + return $null; + } + $result = Swig_csharp_UTF16ToWString($input); %} + +%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %} + +%typemap(csin) wstring "$csinput" +%typemap(csout, excode=SWIGEXCODE) wstring { + string ret = $imcall;$excode + return ret; + } + +%typemap(typecheck) wstring = wchar_t *; + +%typemap(throws, canthrow=1) wstring +%{ SWIG_csharp_ApplicationException_callback($1.data(), (int)$1.size()); + return $null; %} + +// const wstring & +%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)]", + 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, fragment="Swig_csharp_UTF16ToWString") const wstring & +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); + return $null; + } + std::wstring $1_str(Swig_csharp_UTF16ToWString($input)); + $1 = &$1_str; %} +%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_with_length_callback($1->data(), (int)$1->size()); %} + +%typemap(csin) const wstring & "$csinput" +%typemap(csout, excode=SWIGEXCODE) const wstring & { + string ret = $imcall;$excode + return ret; + } + +%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring & +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0); + return $null; + } + /* possible thread/reentrant code problem */ + static std::wstring $1_str; + $1_str = Swig_csharp_UTF16ToWString($input); + $result = &$1_str; %} + +%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_with_length_callback($1.data(), (int)$1.size()); %} + +%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{ + set { + $imcall;$excode + } %} +%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{ + get { + string ret = $imcall;$excode + return ret; + } %} + +%typemap(typecheck) const wstring & = wchar_t *; + +%typemap(throws, canthrow=1) const wstring & +%{ SWIG_csharp_ApplicationException_callback($1.data(), (int)$1.size()); + return $null; %} + +} + diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/stl.i b/macx64/bin/swig/share/swig/4.3.0/csharp/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/stl.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/stl.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/swiginterface.i b/macx64/bin/swig/share/swig/4.3.0/csharp/swiginterface.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/csharp/swiginterface.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/swiginterface.i index e5bfd23a..a70694ac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/swiginterface.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/swiginterface.i @@ -61,3 +61,8 @@ INTERFACE_TYPEMAPS(CTYPE) INTERFACE_TYPEMAPS(CTYPE) %enddef +%define %interface_additional(PROXY, INTERFACE, ADDITIONAL, CTYPE...) +%rename(PROXY) CTYPE; +%feature("interface", name=INTERFACE, additional=ADDITIONAL) CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/csharp/swigmove.i new file mode 100644 index 00000000..2f21bd6f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/csharp/swigtype_inout.i b/macx64/bin/swig/share/swig/4.3.0/csharp/swigtype_inout.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/csharp/swigtype_inout.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/swigtype_inout.i diff --git a/macx64/bin/swig/share/swig/4.0.0/csharp/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/csharp/typemaps.i similarity index 87% rename from macx64/bin/swig/share/swig/4.0.0/csharp/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/csharp/typemaps.i index b6f9bddb..80a5cb54 100644 --- a/macx64/bin/swig/share/swig/4.0.0/csharp/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/typemaps.i @@ -74,15 +74,11 @@ INPUT_TYPEMAP(short, short, short) INPUT_TYPEMAP(unsigned short, unsigned short, ushort) INPUT_TYPEMAP(int, int, int) INPUT_TYPEMAP(unsigned int, unsigned int, uint) -INPUT_TYPEMAP(long, long, int) -INPUT_TYPEMAP(unsigned long, unsigned long, uint) INPUT_TYPEMAP(long long, long long, long) INPUT_TYPEMAP(unsigned long long, unsigned long long, ulong) INPUT_TYPEMAP(float, float, float) INPUT_TYPEMAP(double, double, double) -#undef INPUT_TYPEMAP - /* OUTPUT typemaps --------------- @@ -153,15 +149,11 @@ OUTPUT_TYPEMAP(short, short, short, INT16_PTR) OUTPUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR) OUTPUT_TYPEMAP(int, int, int, INT32_PTR) OUTPUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR) -OUTPUT_TYPEMAP(long, long, int, INT32_PTR) -OUTPUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR) OUTPUT_TYPEMAP(long long, long long, long, INT64_PTR) OUTPUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR) OUTPUT_TYPEMAP(float, float, float, FLOAT_PTR) OUTPUT_TYPEMAP(double, double, double, DOUBLE_PTR) -#undef OUTPUT_TYPEMAP - %typemap(in) bool *OUTPUT, bool &OUTPUT %{ *$input = 0; $1 = ($1_ltype)$input; %} @@ -242,12 +234,47 @@ INOUT_TYPEMAP(short, short, short, INT16_PTR) INOUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR) INOUT_TYPEMAP(int, int, int, INT32_PTR) INOUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR) -INOUT_TYPEMAP(long, long, int, INT32_PTR) -INOUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR) INOUT_TYPEMAP(long long, long long, long, INT64_PTR) INOUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR) INOUT_TYPEMAP(float, float, float, FLOAT_PTR) INOUT_TYPEMAP(double, double, double, DOUBLE_PTR) -#undef INOUT_TYPEMAP +// 32-bit/64-bit architecture specific typemaps - marshal as 32-bit by default +#if !defined(SWIGWORDSIZE64) +INPUT_TYPEMAP(long, int, int) +INPUT_TYPEMAP(unsigned long, unsigned int, uint) + +OUTPUT_TYPEMAP(long, int, int, INT32_PTR) +OUTPUT_TYPEMAP(unsigned long, unsigned int, uint, UINT32_PTR) + +INOUT_TYPEMAP(long, int, int, INT32_PTR) +INOUT_TYPEMAP(unsigned long, unsigned int, uint, UINT32_PTR) +#else +INPUT_TYPEMAP(long, long long, int) +INPUT_TYPEMAP(unsigned long, unsigned long long, uint) + +OUTPUT_TYPEMAP(long, long long, int, INT64_PTR) +OUTPUT_TYPEMAP(unsigned long, unsigned long long, uint, UINT64_PTR) + +INOUT_TYPEMAP(long, long long, int, INT64_PTR) +INOUT_TYPEMAP(unsigned long, unsigned long long, uint, UINT64_PTR) +#endif +%typemap(in) long INPUT[] ($*1_ltype tempinput), unsigned long INPUT[] ($*1_ltype tempinput) +%{tempinput = ($*1_ltype)*$input; + $1 = &tempinput;%} + +%typemap(in) long OUTPUT[] ($*1_ltype tempoutput), unsigned long OUTPUT[] ($*1_ltype tempoutput) +%{$1 = &tempoutput;%} + +%typemap(in) long INOUT[] ($*1_ltype tempinout), unsigned long INOUT[] ($*1_ltype tempinout) +%{tempinout = ($*1_ltype)*$input; + $1 = &tempinout;%} + +%typemap(argout) long OUTPUT[], unsigned long OUTPUT[] "*$input = *$1;" +%typemap(argout) long INOUT[], unsigned long INOUT[] "*$input = *$1;" + + +#undef INPUT_TYPEMAP +#undef OUTPUT_TYPEMAP +#undef INOUT_TYPEMAP diff --git a/macx64/bin/swig/share/swig/4.3.0/csharp/wchar.i b/macx64/bin/swig/share/swig/4.3.0/csharp/wchar.i new file mode 100644 index 00000000..69199d51 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/csharp/wchar.i @@ -0,0 +1,323 @@ +/* ----------------------------------------------------------------------------- + * wchar.i + * + * Typemaps for the wchar_t type + * 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/macx64/bin/swig/share/swig/4.0.0/cstring.i b/macx64/bin/swig/share/swig/4.3.0/cstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/cstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/cwstring.i b/macx64/bin/swig/share/swig/4.3.0/cwstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/cwstring.i rename to macx64/bin/swig/share/swig/4.3.0/cwstring.i diff --git a/macx64/bin/swig/share/swig/4.3.0/d/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/d/argcargv.i new file mode 100644 index 00000000..92544f9b --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/d/argcargv.i @@ -0,0 +1,26 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(ctype) (int ARGC, char **ARGV) "SWIG_c_dstring_array" +%typemap(imtype) (int ARGC, char **ARGV) "string[]" +%typemap(dtype) (int ARGC, char **ARGV) "string[]" + +%typemap(in, canthrow=1) (int ARGC, char **ARGV) { + $1_ltype i, len; + len = $input.len; + $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype)); + if ($2 == SWIG_NULLPTR) { + SWIG_DSetPendingException(SWIG_DException, "memory allocation failed"); + return $null; + } + $1 = len; + for (i = 0; i < len; i++) { + $2[i] = $input.array[i].str; + } + $2[i] = SWIG_NULLPTR; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/d/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/d/boost_shared_ptr.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/d/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/d/boost_shared_ptr.i index 4a220a58..34c950ec 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/boost_shared_ptr.i @@ -18,19 +18,19 @@ %typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{ argp = ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0; if (!argp) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Attempt to dereference null $1_type"); return $null; } $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) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Attempt to dereference null $1_type"); return $null; } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input; @@ -56,7 +56,7 @@ %typemap(in, canthrow=1) CONST TYPE & %{ $1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0); if (!$1) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type reference is null"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "$1_type reference is null"); return $null; } %} %typemap(out, fragment="SWIG_null_deleter") CONST TYPE & @@ -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/macx64/bin/swig/share/swig/4.0.0/d/carrays.i b/macx64/bin/swig/share/swig/4.3.0/d/carrays.i similarity index 60% rename from macx64/bin/swig/share/swig/4.0.0/d/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/d/carrays.i index f2803ea4..0bd99a7c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/carrays.i @@ -10,16 +10,16 @@ * Generates functions for creating and accessing elements of a C array * (as pointers). Creates the following functions: * - * TYPE *new_NAME(int nelements) + * TYPE *new_NAME(size_t nelements) * void delete_NAME(TYPE *); - * TYPE NAME_getitem(TYPE *, int index); - * void NAME_setitem(TYPE *, int index, TYPE value); + * TYPE NAME_getitem(TYPE *, size_t index); + * void NAME_setitem(TYPE *, size_t index, TYPE value); * * ----------------------------------------------------------------------------- */ %define %array_functions(TYPE,NAME) %{ -static TYPE *new_##NAME(int nelements) { %} +static TYPE *new_##NAME(size_t nelements) { %} #ifdef __cplusplus %{ return new TYPE[nelements](); %} #else @@ -35,18 +35,18 @@ static void delete_##NAME(TYPE *ary) { %} #endif %{} -static TYPE NAME##_getitem(TYPE *ary, int index) { +static TYPE NAME##_getitem(TYPE *ary, size_t index) { return ary[index]; } -static void NAME##_setitem(TYPE *ary, int index, TYPE value) { +static void NAME##_setitem(TYPE *ary, size_t index, TYPE value) { ary[index] = value; } %} -TYPE *new_##NAME(int nelements); +TYPE *new_##NAME(size_t nelements); void delete_##NAME(TYPE *ary); -TYPE NAME##_getitem(TYPE *ary, int index); -void NAME##_setitem(TYPE *ary, int index, TYPE value); +TYPE NAME##_getitem(TYPE *ary, size_t index); +void NAME##_setitem(TYPE *ary, size_t index, TYPE value); %enddef @@ -58,13 +58,13 @@ void NAME##_setitem(TYPE *ary, int index, TYPE value); * interface: * * struct NAME { - * NAME(int nelements); + * NAME(size_t nelements); * ~NAME(); - * TYPE getitem(int index); - * void setitem(int index, TYPE value); + * TYPE getitem(size_t index); + * void setitem(size_t index, TYPE value); * TYPE * ptr(); * static NAME *frompointer(TYPE *t); - * } + * } * * ----------------------------------------------------------------------------- */ @@ -76,34 +76,36 @@ typedef TYPE NAME; typedef struct {} NAME; %extend NAME { + #ifdef __cplusplus - NAME(int nelements) { - return new TYPE[nelements](); - } - ~NAME() { - delete [] self; - } +NAME(size_t nelements) { + return new TYPE[nelements](); +} +~NAME() { + delete [] self; +} #else - NAME(int nelements) { - return (TYPE *) calloc(nelements,sizeof(TYPE)); - } - ~NAME() { - free(self); - } +NAME(size_t nelements) { + return (TYPE *) calloc(nelements,sizeof(TYPE)); +} +~NAME() { + free(self); +} #endif - TYPE getitem(int index) { - return self[index]; - } - void setitem(int index, TYPE value) { - self[index] = value; - } - TYPE * ptr() { - return self; - } - static NAME *frompointer(TYPE *t) { - return (NAME *) t; - } +TYPE getitem(size_t index) { + return self[index]; +} +void setitem(size_t index, TYPE value) { + self[index] = value; +} +TYPE * ptr() { + return self; +} +static NAME *frompointer(TYPE *t) { + return (NAME *) t; +} + }; %types(NAME = TYPE); diff --git a/macx64/bin/swig/share/swig/4.3.0/d/cdata.i b/macx64/bin/swig/share/swig/4.3.0/d/cdata.i new file mode 100644 index 00000000..de282658 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/d/cdata.i @@ -0,0 +1,31 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ +%typemap(imtype) (const void *BYTES, size_t LENGTH) "ubyte[]" +%typemap(dtype) (const void *BYTES, size_t LENGTH) "ubyte[]" +%typemap(ctype) (const void *BYTES, size_t LENGTH) "SWIG_c_array" +%typemap(din) (const void *BYTES, size_t LENGTH) "$dinput" +%typemap(in, canthrow=1) (const void *BYTES, size_t LENGTH) %{ + $1 = ($1_ltype)$input.array; + $2 = ($2_ltype)$input.len; +%} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(dtype) SWIGCDATA "ubyte[]" +%typemap(imtype) SWIGCDATA "ubyte[]" +%typemap(ctype) SWIGCDATA "SWIG_c_array" +%typemap(out) SWIGCDATA %{ + $result.array = $1.data; + $result.len = $1.len; +%} +%typemap(dout) SWIGCDATA { return $imcall; } + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/d/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/d/cpointer.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/d/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/d/cpointer.i index 75e610f6..da3084b7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/cpointer.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/cpointer.i @@ -54,14 +54,14 @@ NAME() { return new TYPE(); } ~NAME() { - if (self) delete self; + delete self; } #else NAME() { return (TYPE *) calloc(1,sizeof(TYPE)); } ~NAME() { - if (self) free(self); + free(self); } #endif } @@ -133,9 +133,9 @@ static TYPE *copy_##NAME(TYPE value) { %} static void delete_##NAME(TYPE *self) { %} #ifdef __cplusplus -%{ if (self) delete self; %} +%{ delete self; %} #else -%{ if (self) free(self); %} +%{ free(self); %} #endif %{} diff --git a/macx64/bin/swig/share/swig/4.0.0/d/d.swg b/macx64/bin/swig/share/swig/4.3.0/d/d.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/d.swg rename to macx64/bin/swig/share/swig/4.3.0/d/d.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dclassgen.swg b/macx64/bin/swig/share/swig/4.3.0/d/dclassgen.swg similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/d/dclassgen.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dclassgen.swg index 84fa03a0..e4ff8d5f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dclassgen.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/d/ddirectives.swg b/macx64/bin/swig/share/swig/4.3.0/d/ddirectives.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/ddirectives.swg rename to macx64/bin/swig/share/swig/4.3.0/d/ddirectives.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/d/denums.swg b/macx64/bin/swig/share/swig/4.3.0/d/denums.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/denums.swg rename to macx64/bin/swig/share/swig/4.3.0/d/denums.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dexception.swg b/macx64/bin/swig/share/swig/4.3.0/d/dexception.swg similarity index 92% rename from macx64/bin/swig/share/swig/4.0.0/d/dexception.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dexception.swg index 1aadbaad..74e0422b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dexception.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dexception.swg @@ -15,7 +15,7 @@ unsigned long, unsigned short %{ char error_msg[256]; - sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1); + SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1); SWIG_DSetPendingException(SWIG_DException, error_msg); return $null; %} diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dhead.swg b/macx64/bin/swig/share/swig/4.3.0/d/dhead.swg similarity index 53% rename from macx64/bin/swig/share/swig/4.0.0/d/dhead.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dhead.swg index 50e9c2e8..20b9fe5d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dhead.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dhead.swg @@ -1,9 +1,6 @@ /* ----------------------------------------------------------------------------- * dhead.swg * - * Support code for exceptions if the SWIG_D_NO_EXCEPTION_HELPER is not defined - * Support code for strings if the SWIG_D_NO_STRING_HELPER is not defined - * * Support code for function pointers. ----------------------------------------------------------------------------- */ %insert(runtime) %{ @@ -12,7 +9,7 @@ #include /* Contract support. */ -#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_DSetPendingException(SWIG_DException, msg); return nullreturn; } else +#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_DSetPendingException(SWIG_DException, msg); return nullreturn; } } while (0) %} @@ -20,7 +17,6 @@ * Exception support code. */ -#if !defined(SWIG_D_NO_EXCEPTION_HELPER) %insert(runtime) %{ // Support for throwing D exceptions from C/C++. typedef enum { @@ -28,7 +24,8 @@ typedef enum { SWIG_DIllegalArgumentException, SWIG_DIllegalElementException, SWIG_DIOException, - SWIG_DNoSuchElementException + SWIG_DNoSuchElementException, + SWIG_DNullReferenceException } SWIG_DExceptionCodes; typedef void (* SWIG_DExceptionCallback_t)(const char *); @@ -43,7 +40,8 @@ static SWIG_DException_t SWIG_d_exceptions[] = { { SWIG_DIllegalArgumentException, NULL }, { SWIG_DIllegalElementException, NULL }, { SWIG_DIOException, NULL }, - { SWIG_DNoSuchElementException, NULL } + { SWIG_DNoSuchElementException, NULL }, + { SWIG_DNullReferenceException, NULL } }; static void SWIGUNUSED SWIG_DSetPendingException(SWIG_DExceptionCodes code, const char *msg) { @@ -62,96 +60,17 @@ SWIGEXPORT void SWIGRegisterExceptionCallbacks_$module( SWIG_DExceptionCallback_t illegalArgumentCallback, SWIG_DExceptionCallback_t illegalElementCallback, SWIG_DExceptionCallback_t ioCallback, - SWIG_DExceptionCallback_t noSuchElementCallback) { + SWIG_DExceptionCallback_t noSuchElementCallback, + SWIG_DExceptionCallback_t nullReferenceCallback) { SWIG_d_exceptions[SWIG_DException].callback = exceptionCallback; SWIG_d_exceptions[SWIG_DIllegalArgumentException].callback = illegalArgumentCallback; SWIG_d_exceptions[SWIG_DIllegalElementException].callback = illegalElementCallback; SWIG_d_exceptions[SWIG_DIOException].callback = ioCallback; SWIG_d_exceptions[SWIG_DNoSuchElementException].callback = noSuchElementCallback; + SWIG_d_exceptions[SWIG_DNullReferenceException].callback = nullReferenceCallback; } %} -#if (SWIG_D_VERSION == 1) -%pragma(d) imdmoduleimports=%{ -// Exception throwing support currently requires Tango, but there is no reason -// why it could not support Phobos. -static import tango.core.Exception; -static import tango.core.Thread; -static import tango.stdc.stringz; -%} - -%pragma(d) imdmodulecode=%{ -private class SwigExceptionHelper { - static this() { - swigRegisterExceptionCallbacks$module( - &setException, - &setIllegalArgumentException, - &setIllegalElementException, - &setIOException, - &setNoSuchElementException); - } - - static void setException(char* message) { - auto exception = new object.Exception(tango.stdc.stringz.fromStringz(message).dup); - SwigPendingException.set(exception); - } - - static void setIllegalArgumentException(char* message) { - auto exception = new tango.core.Exception.IllegalArgumentException(tango.stdc.stringz.fromStringz(message).dup); - SwigPendingException.set(exception); - } - - static void setIllegalElementException(char* message) { - auto exception = new tango.core.Exception.IllegalElementException(tango.stdc.stringz.fromStringz(message).dup); - SwigPendingException.set(exception); - } - - static void setIOException(char* message) { - auto exception = new tango.core.Exception.IOException(tango.stdc.stringz.fromStringz(message).dup); - SwigPendingException.set(exception); - } - - static void setNoSuchElementException(char* message) { - auto exception = new tango.core.Exception.NoSuchElementException(tango.stdc.stringz.fromStringz(message).dup); - SwigPendingException.set(exception); - } -} - -package class SwigPendingException { -public: - static this() { - m_sPendingException = new ThreadLocalData(null); - } - - static bool isPending() { - return m_sPendingException.val !is null; - } - - static void set(object.Exception e) { - auto pending = m_sPendingException.val; - if (pending !is null) { - e.next = pending; - throw new object.Exception("FATAL: An earlier pending exception from C/C++ " ~ - "code was missed and thus not thrown (" ~ pending.classinfo.name ~ ": " ~ - pending.msg ~ ")!", e); - } - m_sPendingException.val = e; - } - - static object.Exception retrieve() { - auto e = m_sPendingException.val; - m_sPendingException.val = null; - return e; - } - -private: - // The reference to the pending exception (if any) is stored thread-local. - alias tango.core.Thread.ThreadLocal!(object.Exception) ThreadLocalData; - static ThreadLocalData m_sPendingException; -} -alias void function(char* message) SwigExceptionCallback; -%} -#else %pragma(d) imdmoduleimports=%{ static import std.conv; %} @@ -165,6 +84,7 @@ private class SwigExceptionHelper { &setException, &setException, &setException, + &setException, &setException ); } @@ -175,7 +95,7 @@ private class SwigExceptionHelper { } } -package struct SwigPendingException { +public class SwigPendingException { public: static this() { m_sPendingException = null; @@ -208,16 +128,13 @@ private: } alias void function(const char* message) SwigExceptionCallback; %} -#endif // Callback registering function in wrapperloader.swg. -#endif // SWIG_D_NO_EXCEPTION_HELPER /* * String support code. */ -#if !defined(SWIG_D_NO_STRING_HELPER) %insert(runtime) %{ // Callback for returning strings to D without leaking memory. typedef char * (* SWIG_DStringHelperCallback)(const char *); @@ -231,23 +148,6 @@ SWIGEXPORT void SWIGRegisterStringCallback_$module(SWIG_DStringHelperCallback ca } %} -#if (SWIG_D_VERSION == 1) -%pragma(d) imdmoduleimports = "static import tango.stdc.stringz;"; - -%pragma(d) imdmodulecode = %{ -private class SwigStringHelper { - static this() { - swigRegisterStringCallback$module(&createString); - } - - static char* createString(char* cString) { - // We are effectively dup'ing the string here. - return tango.stdc.stringz.toStringz(tango.stdc.stringz.fromStringz(cString)); - } -} -alias char* function(char* cString) SwigStringCallback; -%} -#else %pragma(d) imdmoduleimports = %{ static import std.conv; static import std.string; @@ -261,31 +161,18 @@ private class SwigStringHelper { static const(char)* createString(const(char*) cString) { // We are effectively dup'ing the string here. - // TODO: Is this also correct for D2/Phobos? + // TODO: Is this correct for D2/Phobos? return std.string.toStringz(std.conv.to!string(cString)); } } alias const(char)* function(const(char*) cString) SwigStringCallback; %} -#endif // Callback registering function in wrapperloader.swg. -#endif // SWIG_D_NO_STRING_HELPER /* * Function pointer support code. */ -#if (SWIG_D_VERSION == 1) -%pragma(d) imdmodulecode = %{ -template SwigExternC(T) { - static if (is(typeof(*(T.init)) R == return)) { - static if (is(typeof(*(T.init)) P == function)) { - alias extern(C) R function(P) SwigExternC; - } - } -} -%} -#else %pragma(d) imdmodulecode = %{ template SwigExternC(T) if (is(typeof(*(T.init)) P == function)) { static if (is(typeof(*(T.init)) R == return)) { @@ -295,4 +182,3 @@ template SwigExternC(T) if (is(typeof(*(T.init)) P == function)) { } } %} -#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/d/director.swg b/macx64/bin/swig/share/swig/4.3.0/d/director.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/director.swg rename to macx64/bin/swig/share/swig/4.3.0/d/director.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dkw.swg b/macx64/bin/swig/share/swig/4.3.0/d/dkw.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/d/dkw.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dkw.swg index 581093f9..b96d1fa6 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dkw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dkw.swg @@ -2,7 +2,7 @@ #define D_DKW_SWG_ /* Warnings for D keywords */ -#define DKEYWORD(x) %keywordwarn("'" `x` "' is a D keyword, renaming to '_" `x` "'",rename="_%s") `x` +#define DKEYWORD(x) %keywordwarn("'" `x` "' is a D keyword",rename="_%s") `x` // Source: http://www.digitalmars.com/d/{1.0,2.0}/lex.html and DKEYWORD(Error); @@ -120,7 +120,7 @@ DKEYWORD(with); DKEYWORD(wstring); // Not really a keyword, but dispose() methods are generated in proxy classes -// and it's a special method name for D1/Tango. +// and it was a special method name for D1/Tango. DKEYWORD(dispose); #undef DKEYWORD diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dmemberfunctionpointers.swg b/macx64/bin/swig/share/swig/4.3.0/d/dmemberfunctionpointers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/dmemberfunctionpointers.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dmemberfunctionpointers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/d/doperators.swg b/macx64/bin/swig/share/swig/4.3.0/d/doperators.swg similarity index 56% rename from macx64/bin/swig/share/swig/4.0.0/d/doperators.swg rename to macx64/bin/swig/share/swig/4.3.0/d/doperators.swg index 0cb63533..f651c392 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/doperators.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/doperators.swg @@ -4,129 +4,6 @@ * Mapping of C++ operator overloading methods to D. * ----------------------------------------------------------------------------- */ -#if (SWIG_D_VERSION == 1) - -%pragma(d) imdmodulecode=%{ -template SwigOperatorDefinitions() { - public override int opEquals(Object o) { - if (auto rhs = cast(typeof(this))o) { - if (swigCPtr == rhs.swigCPtr) return 1; - static if (is(typeof(swigOpEquals(rhs)))) { - return swigOpEquals(rhs) ? 1 : 0; - } else { - return 0; - } - } - return super.opEquals(o); - } -%} -// opEquals is emitted in pure C mode as well to define two proxy classes -// pointing to the same struct as equal. - -#ifdef __cplusplus -%rename(opPos) *::operator+(); -%rename(opPos) *::operator+() const; -%rename(opNeg) *::operator-(); -%rename(opNeg) *::operator-() const; -%rename(opCom) *::operator~(); -%rename(opCom) *::operator~() const; - -%rename(opAdd) *::operator+; -%rename(opAddAssign) *::operator+=; -%rename(opSub) *::operator-; -%rename(opSubAssign) *::operator-=; -%rename(opMul) *::operator*; -%rename(opMulAssign) *::operator*=; -%rename(opDiv) *::operator/; -%rename(opDivAssign) *::operator/=; -%rename(opMod) *::operator%; -%rename(opModAssign) *::operator%=; -%rename(opAnd) *::operator&; -%rename(opAndAssign) *::operator&=; -%rename(opOr) *::operator|; -%rename(opOrAssign) *::operator|=; -%rename(opXor) *::operator^; -%rename(opXorAssign) *::operator^=; -%rename(opShl) *::operator<<; -%rename(opShlAssign) *::operator<<=; -%rename(opShr) *::operator>>; -%rename(opShrAssign) *::operator>>=; - -%rename(opIndex) *::operator[](unsigned) const; -// opIndexAssign is not currently generated, it needs more extensive support -// mechanisms. - -%rename(opCall) *::operator(); - -// !a is not overrideable in D1. -%ignoreoperator(LNOT) operator!; - -// opCmp is used in D. -%rename(swigOpEquals) *::operator==; -%rename(swigOpLt) *::operator<; -%rename(swigOpLtEquals) *::operator<=; -%rename(swigOpGt) *::operator>; -%rename(swigOpGtEquals) *::operator>=; - -// a != b is rewritten as !a.opEquals(b) in D. -%ignoreoperator(NOTEQUAL) operator!=; - -// The logic operators are not overrideable in D. -%ignoreoperator(LAND) operator&&; -%ignoreoperator(LOR) operator||; - -// ++/--a is rewritten as a +/-= 1 in D1,so ignore the prefix operators. -%ignoreoperator(PLUSPLUS) *::operator++(); -%ignoreoperator(MINUSMINUS) *::operator--(); -%rename(swigOpInc) *::operator++(int); -%rename(swigOpDec) *::operator--(int); - -// The C++ assignment operator does not translate well to D where the proxy -// classes have reference semantics. -%ignoreoperator(EQ) operator=; - -%pragma(d) imdmodulecode=%{ - public override int opCmp(Object o) { - static if (is(typeof(swigOpLt(typeof(this).init) && - swigOpEquals(typeof(this).init)))) { - if (auto rhs = cast(typeof(this))o) { - if (swigOpLt(rhs)) { - return -1; - } else if (swigOpEquals(rhs)) { - return 0; - } else { - return 1; - } - } - } - return super.opCmp(o); - } - - public typeof(this) opPostInc(T = int)(T unused = 0) { - static assert( - is(typeof(swigOpInc(int.init))), - "opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~ - "increment operator exists in the corresponding C++ class." - ); - return swigOpInc(int.init); - } - - public typeof(this) opPostDec(T = int)(T unused = 0) { - static assert( - is(typeof(swigOpDec(int.init))), - "opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~ - "decrement operator exists in the corresponding C++ class." - ); - return swigOpDec(int.init); - } -%} -#endif - -%pragma(d) imdmodulecode=%{ -} -%} - -#else %pragma(d) imdmodulecode=%{ mixin template SwigOperatorDefinitions() { public override bool opEquals(Object o) { @@ -198,7 +75,7 @@ mixin template SwigOperatorDefinitions() { // a != b is rewritten as !a.opEquals(b) in D. %ignoreoperator(NOTEQUAL) operator!=; -// The logic operators are not overrideable in D. +// The logic operators are not overridable in D. %ignoreoperator(LAND) operator&&; %ignoreoperator(LOR) operator||; @@ -255,5 +132,3 @@ mixin template SwigOperatorDefinitions() { %pragma(d) imdmodulecode=%{ } %} - -#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dprimitives.swg b/macx64/bin/swig/share/swig/4.3.0/d/dprimitives.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/d/dprimitives.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dprimitives.swg index eaee816d..843350fe 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dprimitives.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dprimitives.swg @@ -5,17 +5,10 @@ * ----------------------------------------------------------------------------- */ // C long/ulong width depends on the target arch, use stdlib aliases for them. -#if (SWIG_D_VERSION == 1) -%pragma(d) imdmoduleimports = "static import tango.stdc.config;" -%pragma(d) globalproxyimports = "static import tango.stdc.config;" -#define SWIG_LONG_DTYPE tango.stdc.config.c_long -#define SWIG_ULONG_DTYPE tango.stdc.config.c_ulong -#else %pragma(d) imdmoduleimports = "static import core.stdc.config;" %pragma(d) globalproxyimports = "static import core.stdc.config;" #define SWIG_LONG_DTYPE core.stdc.config.c_long #define SWIG_ULONG_DTYPE core.stdc.config.c_ulong -#endif /* * The SWIG_D_PRIMITIVE macro is used to define the typemaps for the primitive @@ -150,6 +143,12 @@ SWIG_D_PRIMITIVE(double, double) const unsigned long & "" +// Default assumes size_t is 32-bit for overloading +%typecheck(SWIG_TYPECHECK_UINT32) + size_t, + const size_t & + "" + %typecheck(SWIG_TYPECHECK_INT64) long long, const long long & diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dstrings.swg b/macx64/bin/swig/share/swig/4.3.0/d/dstrings.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/d/dstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dstrings.swg index 02895c15..0b875b58 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dstrings.swg @@ -64,17 +64,10 @@ // We need to have the \0-terminated string conversion functions available in // the D proxy modules. -#if (SWIG_D_VERSION == 1) -// Could be easily extended to support Phobos as well. -SWIGD_STRING_TYPEMAPS(char*, char[], tango.stdc.stringz.fromStringz, tango.stdc.stringz.toStringz) - -%pragma(d) globalproxyimports = "static import tango.stdc.stringz;"; -#else SWIGD_STRING_TYPEMAPS(const(char)*, string, std.conv.to!string, std.string.toStringz) %pragma(d) globalproxyimports = %{ static import std.conv; static import std.string; %} -#endif #undef SWIGD_STRING_TYPEMAPS diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dswigtype.swg b/macx64/bin/swig/share/swig/4.3.0/d/dswigtype.swg similarity index 60% rename from macx64/bin/swig/share/swig/4.0.0/d/dswigtype.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dswigtype.swg index f0d604b6..67f02f4e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/dswigtype.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/dswigtype.swg @@ -20,6 +20,10 @@ %typemap(imtype) SWIGTYPE & "void*" %typemap(dtype, nativepointer="$dtype") SWIGTYPE & "$dclassname" +%typemap(ctype) SWIGTYPE && "void *" +%typemap(imtype) SWIGTYPE && "void*" +%typemap(dtype, nativepointer="$dtype") SWIGTYPE && "$dclassname" + %typemap(ctype) SWIGTYPE *const& "void *" %typemap(imtype) SWIGTYPE *const& "void*" %typemap(dtype) SWIGTYPE *const& "$*dclassname" @@ -28,6 +32,7 @@ SWIGTYPE, SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [], SWIGTYPE *const& "" @@ -40,14 +45,14 @@ %typemap(in, canthrow=1) SWIGTYPE ($&1_type argp) %{ argp = ($&1_ltype)$input; if (!argp) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Attempt to dereference null $1_type"); return $null; } $1 = *argp; %} %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)); @@ -57,10 +62,10 @@ #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"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Unexpected null return for type $1_type"); return $null; } $result = *($&1_ltype)$input; %} @@ -117,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_DNullReferenceException, "$1_type is null"); return $null; } %} %typemap(out) SWIGTYPE & "$result = (void *)$1;" @@ -126,7 +131,7 @@ "$input = ($1_ltype) &$1;" %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE & %{ if (!$input) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Unexpected null return for type $1_type"); return $null; } $result = ($1_ltype)$input; %} @@ -148,6 +153,44 @@ } +/* + * Rvalue reference conversion typemaps. + */ + +%typemap(in, canthrow=1, fragment="") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input; + if (!$1) { + SWIG_DSetPendingException(SWIG_DNullReferenceException, "$1_type is null"); + return $null; + } + rvrdeleter.reset($1); %} +%typemap(out) SWIGTYPE && "$result = (void *)$1;" + +%typemap(directorin) SWIGTYPE && + "$input = ($1_ltype) &$1;" +%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE && +%{ if (!$input) { + SWIG_DSetPendingException(SWIG_DNullReferenceException, "Unexpected null return for type $1_type"); + return $null; + } + $result = ($1_ltype)$input; %} + +%typemap(ddirectorin, + nativepointer="cast($dtype)$winput" +) SWIGTYPE && "new $dclassname($winput, false)" +%typemap(ddirectorout, + nativepointer="cast(void*)$dcall" +) SWIGTYPE && "$dclassname.swigGetCPtr($dcall)" + +%typemap(din, + nativepointer="cast(void*)$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 + return ret; +} + + /* * Array conversion typemaps. */ @@ -164,6 +207,7 @@ // Treat references to arrays like references to a single element. %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* @@ -195,3 +239,47 @@ nativepointer="cast(void*)$dcall" ) SWIGTYPE *const& "$*dclassname.swigGetCPtr($dcall)" +/* + * D String & D array represent in C + */ + +%insert(runtime) %{ +#include +typedef struct { size_t len; char *str;} SWIG_c_dstring; +typedef struct { size_t len; SWIG_c_dstring *array; } SWIG_c_dstring_array; +typedef struct { size_t len; void *array; } SWIG_c_array; +%} + +/* + * String & length + */ +%typemap(imtype) (const char *STRING, size_t LENGTH) "string" +%typemap(dtype) (const char *STRING, size_t LENGTH) "string" +%typemap(ctype,default="={0,0}") (const char *STRING, size_t LENGTH) "SWIG_c_dstring" +%typemap(din, nativepointer="std.conv.to!string($dinput)") (const char *STRING, size_t LENGTH) "$dinput" +%typemap(freearg) (const char *STRING, size_t LENGTH) "" +%typemap(in, canthrow=1) (const char *STRING, size_t LENGTH) %{ + $1 = ($1_ltype)$input.str; + $2 = ($2_ltype)$input.len; +%} +%typemap(argout) (const char *STRING, size_t LENGTH) { + $input.str = (char *)$1; + $input.len = (size_t)$2; +} +%typemap(directorin) (const char *STRING, size_t LENGTH) { + $input.str = (char *)$1; + $input.len = (size_t)$2; +} +%typemap(ddirectorin) (const char *STRING, size_t LENGTH) "std.conv.to!string($winput)" +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +/* Enable write-back for non-const version */ +%typemap(argout) (char *STRING, size_t LENGTH) { + $input.str = (char *)$1; + $input.len = (size_t)$2; +} +%typemap(directorargout) (char *STRING, size_t LENGTH) +{ + $1 = ($1_ltype)$input.str; + $2 = ($2_ltype)$input.len; +} +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } diff --git a/macx64/bin/swig/share/swig/4.0.0/d/dvoid.swg b/macx64/bin/swig/share/swig/4.3.0/d/dvoid.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/dvoid.swg rename to macx64/bin/swig/share/swig/4.3.0/d/dvoid.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/d/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/d/std_auto_ptr.i new file mode 100644 index 00000000..500b6115 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/d/std_common.i b/macx64/bin/swig/share/swig/4.3.0/d/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/d/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_except.i b/macx64/bin/swig/share/swig/4.3.0/d/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_map.i b/macx64/bin/swig/share/swig/4.3.0/d/std_map.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/d/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_map.i index c5e03d06..a374f55a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/std_map.i @@ -44,7 +44,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/d/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/d/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_string.i b/macx64/bin/swig/share/swig/4.3.0/d/std_string.i similarity index 81% rename from macx64/bin/swig/share/swig/4.0.0/d/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_string.i index 8d75d23e..629f77c5 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/std_string.i @@ -27,13 +27,13 @@ class string; %typemap(in, canthrow=1) string, const string & %{ if (!$input) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "null string"); return $null; } $1.assign($input); %} %typemap(in, canthrow=1) const string & %{ if (!$input) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "null string"); return $null; } $*1_ltype $1_str($input); @@ -52,14 +52,14 @@ class string; %typemap(directorout, canthrow=1) string %{ if (!$input) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "null string"); return $null; } $result.assign($input); %} %typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string & %{ if (!$input) { - SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "null string"); + SWIG_DSetPendingException(SWIG_DNullReferenceException, "null string"); return $null; } /* possible thread/reentrant code problem */ @@ -79,19 +79,12 @@ class string; // We need to have the \0-terminated string conversion functions available in // the D proxy modules. -#if (SWIG_D_VERSION == 1) -// Could be easily extended to support Phobos as well. -SWIGD_STD_STRING_TYPEMAPS(char*, char[], tango.stdc.stringz.fromStringz, tango.stdc.stringz.toStringz) - -%pragma(d) globalproxyimports = "static import tango.stdc.stringz;"; -#else SWIGD_STD_STRING_TYPEMAPS(const(char)*, string, std.conv.to!string, std.string.toStringz) %pragma(d) globalproxyimports = %{ static import std.conv; static import std.string; %} -#endif #undef SWIGD_STD_STRING_TYPEMAPS diff --git a/macx64/bin/swig/share/swig/4.3.0/d/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/d/std_unique_ptr.i new file mode 100644 index 00000000..47a26464 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/d/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%define %unique_ptr(TYPE) +%typemap (ctype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "void *" +%typemap (imtype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "void*" +%typemap (dtype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(dtype, TYPE)" + +%typemap(in) std::unique_ptr< TYPE > +%{ $1.reset((TYPE *)$input); %} +%typemap(in) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && +%{ $*1_ltype $1_uptr((TYPE *)$input); + $1 = &$1_uptr; %} +%typemap(in, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & +%{ swig::NoDeleteUniquePtr< TYPE > $1_ndup((TYPE *)$input); +$1 = &$1_ndup.uptr; %} + + +%typemap(din, + nativepointer="cast(void*)$dinput" +) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(dtype, TYPE).swigRelease($dinput)" +%typemap(din, + nativepointer="cast(void*)$dinput" +) const std::unique_ptr< TYPE > & "$typemap(dtype, TYPE).swigGetCPtr($dinput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + $result = (void *)$1.release(); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + $result = (void *)$1->get(); +%} + + +%typemap(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(dout, excode=SWIGEXCODE, + nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}" +) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && { + void* cPtr = $imcall; + $typemap(dtype, TYPE) ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, false);$excode + return ret; +} + + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "" + +%template() std::unique_ptr< TYPE >; +%enddef diff --git a/macx64/bin/swig/share/swig/4.0.0/d/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/d/std_vector.i similarity index 72% rename from macx64/bin/swig/share/swig/4.0.0/d/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/d/std_vector.i index fb8f7d2e..8c67402e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/d/std_vector.i @@ -22,169 +22,6 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...) -#if (SWIG_D_VERSION == 1) -%typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;" -%proxycode %{ -public this($typemap(dtype, CTYPE)[] values) { - this(); - append(values); -} - -alias push_back add; -alias push_back push; -alias push_back opCatAssign; -alias size length; -alias opSlice slice; - -public $typemap(dtype, CTYPE) opIndexAssign($typemap(dtype, CTYPE) value, size_t index) { - if (index >= size()) { - throw new tango.core.Exception.NoSuchElementException("Tried to assign to element out of vector bounds."); - } - setElement(index, value); - return value; -} - -public $typemap(dtype, CTYPE) opIndex(size_t index) { - if (index >= size()) { - throw new tango.core.Exception.NoSuchElementException("Tried to read from element out of vector bounds."); - } - return getElement(index); -} - -public void append($typemap(dtype, CTYPE)[] value...) { - foreach (v; value) { - add(v); - } -} - -public $typemap(dtype, CTYPE)[] opSlice() { - $typemap(dtype, CTYPE)[] array = new $typemap(dtype, CTYPE)[size()]; - foreach (i, ref value; array) { - value = getElement(i); - } - return array; -} - -public int opApply(int delegate(ref $typemap(dtype, CTYPE) value) dg) { - int result; - - size_t currentSize = size(); - for (size_t i = 0; i < currentSize; ++i) { - auto value = getElement(i); - result = dg(value); - setElement(i, value); - } - return result; -} - -public int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg) { - int result; - - size_t currentSize = size(); - for (size_t i = 0; i < currentSize; ++i) { - auto value = getElement(i); - - // Workaround for http://d.puremagic.com/issues/show_bug.cgi?id=2443. - auto index = i; - - result = dg(index, value); - setElement(i, value); - } - return result; -} - -public void capacity(size_t value) { - if (value < size()) { - throw new tango.core.Exception.IllegalArgumentException("Tried to make the capacity of a vector smaller than its size."); - } - - reserve(value); -} -%} - - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef CTYPE value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef CONST_REFERENCE const_reference; - - void clear(); - void push_back(CTYPE const& x); - size_type size() const; - size_type capacity() const; - void reserve(size_type n) throw (std::length_error); - - vector(); - vector(const vector &other); - - %extend { - vector(size_type capacity) throw (std::length_error) { - std::vector< CTYPE >* pv = 0; - pv = new std::vector< CTYPE >(); - - // Might throw std::length_error. - pv->reserve(capacity); - - return pv; - } - - size_type unused() const { - return $self->capacity() - $self->size(); - } - - const_reference remove() throw (std::out_of_range) { - if ($self->empty()) { - throw std::out_of_range("Tried to remove last element from empty vector."); - } - - std::vector< CTYPE >::const_reference value = $self->back(); - $self->pop_back(); - return value; - } - - const_reference remove(size_type index) throw (std::out_of_range) { - if (index >= $self->size()) { - throw std::out_of_range("Tried to remove element with invalid index."); - } - - std::vector< CTYPE >::iterator it = $self->begin() + index; - std::vector< CTYPE >::const_reference value = *it; - $self->erase(it); - return value; - } - } - - // Wrappers for setting/getting items with the possibly thrown exception - // specified (important for SWIG wrapper generation). - %extend { - const_reference getElement(size_type index) throw (std::out_of_range) { - if ((index < 0) || ($self->size() <= index)) { - throw std::out_of_range("Tried to get value of element with invalid index."); - } - return (*$self)[index]; - } - } - - // Use CTYPE const& instead of const_reference to work around SWIG code - // generation issue when using const pointers as vector elements (like - // std::vector< const int* >). - %extend { - void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) { - if ((index < 0) || ($self->size() <= index)) { - throw std::out_of_range("Tried to set value of element with invalid index."); - } - (*$self)[index] = val; - } - } - -%dmethodmodifiers std::vector::getElement "private" -%dmethodmodifiers std::vector::setElement "private" -%dmethodmodifiers std::vector::reserve "private" - -#else %typemap(dimports) std::vector< CTYPE > %{ static import std.algorithm; @@ -541,7 +378,6 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg) %dmethodmodifiers std::vector::getElement "private" %dmethodmodifiers std::vector::setElement "private" -#endif %enddef // Extra methods added to the collection class if operator== is defined for the class being wrapped diff --git a/macx64/bin/swig/share/swig/4.0.0/d/stl.i b/macx64/bin/swig/share/swig/4.3.0/d/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/stl.i rename to macx64/bin/swig/share/swig/4.3.0/d/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/d/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/d/swigmove.i new file mode 100644 index 00000000..2bb89017 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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_DNullReferenceException, "Attempt to dereference null $1_type"); + return $null; + } + SwigValueWrapper< $1_ltype >::reset($1, argp); %} + +%typemap(din) SWIGTYPE MOVE "$dclassname.swigRelease($dinput)" diff --git a/macx64/bin/swig/share/swig/4.0.0/d/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/d/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/d/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/d/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.0.0/d/wrapperloader.swg b/macx64/bin/swig/share/swig/4.3.0/d/wrapperloader.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/d/wrapperloader.swg rename to macx64/bin/swig/share/swig/4.3.0/d/wrapperloader.swg index b3c1d0dc..d12e5cb8 100644 --- a/macx64/bin/swig/share/swig/4.0.0/d/wrapperloader.swg +++ b/macx64/bin/swig/share/swig/4.3.0/d/wrapperloader.swg @@ -40,9 +40,10 @@ private { } else { version(D_Version2) { static import std.conv; + } else { + static import std.c.string; } static import std.string; - static import std.c.string; } version(D_Version2) { @@ -112,7 +113,7 @@ private { version(Tango) { import tango.sys.Common; } else version(linux) { - import std.c.linux.linux; + import core.sys.posix.dlfcn; } else { extern(C) { const RTLD_NOW = 2; @@ -281,27 +282,20 @@ static this() { "))library.loadSymbol(`" ~ symbol ~ "`);"; } - //#if !defined(SWIG_D_NO_EXCEPTION_HELPER) mixin(bindCode("swigRegisterExceptionCallbacks$module", "SWIGRegisterExceptionCallbacks_$module")); - //#endif // SWIG_D_NO_EXCEPTION_HELPER - //#if !defined(SWIG_D_NO_STRING_HELPER) mixin(bindCode("swigRegisterStringCallback$module", "SWIGRegisterStringCallback_$module")); - //#endif // SWIG_D_NO_STRING_HELPER $wrapperloaderbindcode } -//#if !defined(SWIG_D_NO_EXCEPTION_HELPER) extern(C) void function( SwigExceptionCallback exceptionCallback, SwigExceptionCallback illegalArgumentCallback, SwigExceptionCallback illegalElementCallback, SwigExceptionCallback ioCallback, - SwigExceptionCallback noSuchElementCallback) swigRegisterExceptionCallbacks$module; -//#endif // SWIG_D_NO_EXCEPTION_HELPER + SwigExceptionCallback noSuchElementCallback, + SwigExceptionCallback nullReferenceCallback) swigRegisterExceptionCallbacks$module; -//#if !defined(SWIG_D_NO_STRING_HELPER) extern(C) void function(SwigStringCallback callback) swigRegisterStringCallback$module; -//#endif // SWIG_D_NO_STRING_HELPER %} %pragma(d) wrapperloaderbindcommand = %{ diff --git a/macx64/bin/swig/share/swig/4.0.0/director_common.swg b/macx64/bin/swig/share/swig/4.3.0/director_common.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/director_common.swg rename to macx64/bin/swig/share/swig/4.3.0/director_common.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/director_guard.swg b/macx64/bin/swig/share/swig/4.3.0/director_guard.swg new file mode 100644 index 00000000..b261fa56 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/director_guard.swg @@ -0,0 +1,105 @@ +/* ----------------------------------------------------------------------------- + * director_guard.swg + * + * Generic Mutex implementation for directors + * + * Before including this file, there are two macros to define for choosing + * an implementation as follows: + * - SWIG_THREADS: + * If defined than mutexes are used. + * If not defined then mutexes are not used. + * - SWIG_HAVE_MUTEX: + * If there is a target language defined 'Mutex' class available, the target + * language will define this macro to use the class over the options below. + * The language 'Mutex' class needs to be Basic Lockable. + * It must have public 'void lock()' and 'void unlock()' methods. + * See: https://en.cppreference.com/w/cpp/named_req/BasicLockable + * If the macro is not defined, one of the following will be used in this order: + * - std::mutex if using C++11 or later. + * - CRITICAL_SECTION on Windows. + * - POSIX pthread mutex. + * ----------------------------------------------------------------------------- */ + +#ifdef SWIG_THREADS + +#if __cplusplus >= 201103L +/* + * C++ 11 or above + * std::mutex https://en.cppreference.com/w/cpp/thread/mutex + * std::unique_lock https://en.cppreference.com/w/cpp/thread/unique_lock + */ +#include +#ifdef SWIG_HAVE_MUTEX +/* Use Language defined Mutex class */ +#define SWIG_GUARD(_mutex) std::unique_lock _guard(_mutex) +#define SWIG_GUARD_DEFINITION(_cls, _mutex) Mutex _cls::_mutex +#define SWIG_GUARD_DECLARATION(_mutex) static Mutex _mutex +#else +#define SWIG_GUARD(_mutex) std::unique_lock _guard(_mutex) +#define SWIG_GUARD_DEFINITION(_cls, _mutex) std::mutex _cls::_mutex +#define SWIG_GUARD_DECLARATION(_mutex) static std::mutex _mutex +#endif + +#else /* __cplusplus */ + +#ifdef SWIG_HAVE_MUTEX +/* Use Language defined Mutex class */ + +#elif defined(_WIN32) +/* + * Windows Critical Section Objects + * https://learn.microsoft.com/en-us/windows/win32/Sync/critical-section-objects + */ +#include +#include +namespace Swig { + class Mutex { + CRITICAL_SECTION mutex_; + public: + Mutex() { InitializeCriticalSection(&mutex_); } + ~Mutex() { DeleteCriticalSection(&mutex_); } + void lock() { EnterCriticalSection(&mutex_); } + void unlock() { LeaveCriticalSection(&mutex_); } + }; +} + +#else /* _WIN32 */ +/* + * POSIX Thread mutex + * https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread.h.html + */ +#include +namespace Swig { + class Mutex { + pthread_mutex_t mutex_; + public: + Mutex() { pthread_mutex_init(&mutex_, NULL); } + ~Mutex() { pthread_mutex_destroy(&mutex_); } + void lock() { pthread_mutex_lock(&mutex_); } + void unlock() { pthread_mutex_unlock(&mutex_); } + }; +} + +#endif /* _WIN32 */ + +namespace Swig { + class Unique_lock { + Mutex &mutex_; + public: + Unique_lock(Mutex &_mutex) : mutex_(_mutex) { mutex_.lock(); } + ~Unique_lock() { mutex_.unlock(); } + }; +} +#define SWIG_GUARD(_mutex) Unique_lock _guard(_mutex) +#define SWIG_GUARD_DEFINITION(_cls, _mutex) Mutex _cls::_mutex +#define SWIG_GUARD_DECLARATION(_mutex) static Mutex _mutex + +#endif /* __cplusplus */ + +#else /* SWIG_THREADS */ + +#define SWIG_GUARD(_mutex) +#define SWIG_GUARD_DEFINITION(_cls, _mutex) +#define SWIG_GUARD_DECLARATION(_mutex) + +#endif /* SWIG_THREADS */ diff --git a/macx64/bin/swig/share/swig/4.0.0/exception.i b/macx64/bin/swig/share/swig/4.3.0/exception.i similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/exception.i rename to macx64/bin/swig/share/swig/4.3.0/exception.i index ee9ce9bc..c3629bbf 100644 --- a/macx64/bin/swig/share/swig/4.0.0/exception.i +++ b/macx64/bin/swig/share/swig/4.3.0/exception.i @@ -12,10 +12,16 @@ %insert("runtime") "swigerrors.swg" -#ifdef SWIGPHP7 +#ifdef SWIGPHP %{ -#include "zend_exceptions.h" -#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code); goto thrown; } while (0) +#define SWIG_exception(code, msg) do { zend_throw_exception( \ + code == SWIG_TypeError ? zend_ce_type_error : \ + code == SWIG_ValueError ? zend_ce_value_error : \ + code == SWIG_DivisionByZero ? zend_ce_division_by_zero_error : \ + code == SWIG_SyntaxError ? zend_ce_parse_error : \ + code == SWIG_OverflowError ? zend_ce_arithmetic_error : \ + code == SWIG_NullReferenceError ? zend_ce_type_error : \ + NULL, msg, code); SWIG_fail; } while (0) %} #endif @@ -24,24 +30,24 @@ SWIGINTERN void SWIG_exception_ (int code, const char *msg, const char *subr) { #define ERROR(scmerr) \ - scm_error(scm_from_locale_string((char *) (scmerr)), \ - (char *) subr, (char *) msg, \ - SCM_EOL, SCM_BOOL_F) + scm_error(scm_from_locale_string(scmerr), \ + subr, msg, SCM_EOL, SCM_BOOL_F) #define MAP(swigerr, scmerr) \ case swigerr: \ ERROR(scmerr); \ break switch (code) { - MAP(SWIG_MemoryError, "swig-memory-error"); - MAP(SWIG_IOError, "swig-io-error"); - MAP(SWIG_RuntimeError, "swig-runtime-error"); - MAP(SWIG_IndexError, "swig-index-error"); - MAP(SWIG_TypeError, "swig-type-error"); - MAP(SWIG_DivisionByZero, "swig-division-by-zero"); - MAP(SWIG_OverflowError, "swig-overflow-error"); - MAP(SWIG_SyntaxError, "swig-syntax-error"); - MAP(SWIG_ValueError, "swig-value-error"); - MAP(SWIG_SystemError, "swig-system-error"); + MAP(SWIG_MemoryError, "swig-memory-error"); + MAP(SWIG_IOError, "swig-io-error"); + MAP(SWIG_RuntimeError, "swig-runtime-error"); + MAP(SWIG_IndexError, "swig-index-error"); + MAP(SWIG_TypeError, "swig-type-error"); + MAP(SWIG_DivisionByZero, "swig-division-by-zero"); + MAP(SWIG_OverflowError, "swig-overflow-error"); + MAP(SWIG_SyntaxError, "swig-syntax-error"); + MAP(SWIG_ValueError, "swig-value-error"); + MAP(SWIG_SystemError, "swig-system-error"); + MAP(SWIG_NullReferenceError, "swig-null-reference-error"); default: ERROR("swig-error"); } @@ -64,16 +70,17 @@ SWIGINTERN void SWIG_exception_ (int code, const char *msg) { ERROR(errname); \ break switch (code) { - MAP(SWIG_MemoryError, "swig-memory-error"); - MAP(SWIG_IOError, "swig-io-error"); - MAP(SWIG_RuntimeError, "swig-runtime-error"); - MAP(SWIG_IndexError, "swig-index-error"); - MAP(SWIG_TypeError, "swig-type-error"); - MAP(SWIG_DivisionByZero, "swig-division-by-zero"); - MAP(SWIG_OverflowError, "swig-overflow-error"); - MAP(SWIG_SyntaxError, "swig-syntax-error"); - MAP(SWIG_ValueError, "swig-value-error"); - MAP(SWIG_SystemError, "swig-system-error"); + MAP(SWIG_MemoryError, "swig-memory-error"); + MAP(SWIG_IOError, "swig-io-error"); + MAP(SWIG_RuntimeError, "swig-runtime-error"); + MAP(SWIG_IndexError, "swig-index-error"); + MAP(SWIG_TypeError, "swig-type-error"); + MAP(SWIG_DivisionByZero, "swig-division-by-zero"); + MAP(SWIG_OverflowError, "swig-overflow-error"); + MAP(SWIG_SyntaxError, "swig-syntax-error"); + MAP(SWIG_ValueError, "swig-value-error"); + MAP(SWIG_SystemError, "swig-system-error"); + MAP(SWIG_NullReferenceError, "swig-null-reference-error"); default: ERROR("swig-error"); } @@ -112,6 +119,9 @@ SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) { case SWIG_TypeError: exception_code = SWIG_JavaIllegalArgumentException; break; + case SWIG_NullReferenceError: + exception_code = SWIG_JavaNullPointerException; + break; case SWIG_UnknownError: default: exception_code = SWIG_JavaUnknownError; @@ -156,6 +166,9 @@ SWIGINTERN void SWIG_OCamlException(int code, const char *msg) { case SWIG_ValueError: exception_code = SWIG_OCamlIllegalArgumentException; break; + case SWIG_NullReferenceError: + exception_code = SWIG_OCamlNullReferenceException; + break; case SWIG_UnknownError: default: exception_code = SWIG_OCamlUnknownError; @@ -193,6 +206,9 @@ SWIGINTERN void SWIG_CSharpException(int code, const char *msg) { case SWIG_OverflowError: exception_code = SWIG_CSharpOverflowException; break; + case SWIG_NullReferenceError: + exception_code = SWIG_CSharpNullReferenceException; + break; case SWIG_RuntimeError: case SWIG_TypeError: case SWIG_SyntaxError: @@ -234,6 +250,9 @@ SWIGINTERN void SWIG_DThrowException(int code, const char *msg) { case SWIG_ValueError: exception_code = SWIG_DIllegalArgumentException; break; + case SWIG_NullReferenceError: + exception_code = SWIG_DNullReferenceException; + break; case SWIG_DivisionByZero: case SWIG_MemoryError: case SWIG_OverflowError: diff --git a/macx64/bin/swig/share/swig/4.3.0/go/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/go/argcargv.i new file mode 100644 index 00000000..f2dee2be --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/go/argcargv.i @@ -0,0 +1,62 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(gotype) (int ARGC, char **ARGV) "[]string" + +%insert(go_wrapper) %{ +//export cgo_swig_get_string_slice_idx +func cgo_swig_get_string_slice_idx(s []string, i C.swig_intgo) string { + return s[i] +} +%} + +%{ +extern +#ifdef __cplusplus + "C" +#endif +_gostring_ cgo_swig_get_string_slice_idx(_goslice_ s, intgo i); +%} + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype len = ($1_ltype)$input.len; + size_t aralloc = (size_t)((len + 1) * sizeof(char *)); + if (len < 0) { + _swig_gopanic("negative array length"); + } + $2 = ($2_ltype) Swig_malloc((int)aralloc); + if ($2 == NULL) { + _swig_gopanic("fail allocating memory for array"); + } + memset($2, 0, aralloc); + $1 = len; + { + $1_ltype i; + for (i = 0; i < len; i++) { + char *p; + _gostring_ st = cgo_swig_get_string_slice_idx($input, (intgo)i); + if (st.n < 0) { + _swig_gopanic("string length negative"); + } + p = (char *) Swig_malloc((int)(st.n + 1)); + if (p == NULL) { + _swig_gopanic("fail allocating memory for a string"); + } + memcpy(p, st.p, st.n); + p[st.n] = 0; + $2[i] = p; + } + $2[i] = NULL; + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != NULL) { + $1_ltype i; + for (i = 0; i < $1; i++) { + Swig_free((void *)$2[i]); + } + Swig_free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.3.0/go/cdata.i b/macx64/bin/swig/share/swig/4.3.0/go/cdata.i new file mode 100644 index 00000000..77b08ec7 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/go/cdata.i @@ -0,0 +1,57 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +%typemap(gotype) (const void *BYTES, size_t LENGTH) "[]byte" +%typemap(in) (const void *BYTES, size_t LENGTH) %{ + $1 = ($1_ltype)$input.array; + $2 = ($2_ltype)$input.len; +%} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%fragment("cdata", "header") %{ +struct swigcdata { + uintgo size; + void *data; +}; +%} + +%typemap(gotype) SWIGCDATA "[]byte" +%typemap(imtype) SWIGCDATA "uint64" + +%typemap(out, fragment="cdata") SWIGCDATA(struct swigcdata *swig_out) %{ + swig_out = (struct swigcdata *)malloc(sizeof(*swig_out)); + if (swig_out) { + swig_out->size = $1.len; + swig_out->data = malloc(swig_out->size); + if (swig_out->data) { + memcpy(swig_out->data, $1.data, swig_out->size); + } + } + $result = *(long long *)(void **)&swig_out; +%} + +%typemap(goout) SWIGCDATA { + type swigcdata struct { size int; data uintptr } + p := (*swigcdata)(unsafe.Pointer(uintptr($1))) + if p == nil || p.data == 0 { + $result = nil + } else { + b := make([]byte, p.size) + a := (*[0x7fffffff]byte)(unsafe.Pointer(p.data))[:p.size] + copy(b, a) + Swig_free(p.data) + Swig_free(uintptr(unsafe.Pointer(p))) + $result = b + } +} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/go/director.swg b/macx64/bin/swig/share/swig/4.3.0/go/director.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/director.swg rename to macx64/bin/swig/share/swig/4.3.0/go/director.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/go/exception.i b/macx64/bin/swig/share/swig/4.3.0/go/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/exception.i rename to macx64/bin/swig/share/swig/4.3.0/go/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/go.swg b/macx64/bin/swig/share/swig/4.3.0/go/go.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/go/go.swg rename to macx64/bin/swig/share/swig/4.3.0/go/go.swg index c225ed9a..8f5bb4fc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/go/go.swg +++ b/macx64/bin/swig/share/swig/4.3.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; %} @@ -453,9 +454,12 @@ %} %typemap(freearg) - char *, char *&, char[ANY], char[] + char *, char[ANY], char[] %{ free($1); %} +%typemap(freearg) char *& +%{ free(temp$argnum); %} + %typemap(out,fragment="AllocateString") char *, char *&, char[ANY], char[] %{ $result = Swig_AllocateString((char*)$1, $1 ? strlen((char*)$1) : 0); %} @@ -494,31 +498,72 @@ /* String & length */ -%typemap(gotype) (char *STRING, size_t LENGTH) "string" +%typemap(gotype) (const char *STRING, size_t LENGTH) "string" -%typemap(in) (char *STRING, size_t LENGTH) +%typemap(in) (const char *STRING, size_t LENGTH) %{ $1 = ($1_ltype)$input.p; $2 = ($2_ltype)$input.n; %} -%typemap(out,fragment="AllocateString") (char *STRING, size_t LENGTH) +%typemap(out,fragment="AllocateString") (const char *STRING, size_t LENGTH) %{ $result = Swig_AllocateString((char*)$1, (size_t)$2); %} -%typemap(goout,fragment="CopyString") (char *STRING, size_t LENGTH) +%typemap(goout,fragment="CopyString") (const char *STRING, size_t LENGTH) %{ $result = swigCopyString($1) %} -%typemap(directorin,fragment="AllocateString") (char *STRING, size_t LENGTH) +%typemap(directorin,fragment="AllocateString") (const char *STRING, size_t LENGTH) %{ $input = Swig_AllocateString((char*)$1, $2); %} -%typemap(godirectorin,fragment="CopyString") (char *STRING, size_t LENGTH) +%typemap(godirectorin,fragment="CopyString") (const char *STRING, size_t LENGTH) %{ $result = swigCopyString($input) %} -%typemap(directorout) (char *STRING, size_t LENGTH) +%typemap(directorout) (const char *STRING, size_t LENGTH) %{ $1 = ($1_ltype)$input.p; $2 = ($2_ltype)$input.n; %} +%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) } +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } + +/* The int & type needs to convert to intgo. */ + +%typemap(gotype) int & "*int" + +%typemap(in) int & (int e) +%{ + e = (int)*$input; + $1 = &e; +%} + +%typemap(out) int & +%{ $result = new intgo(*$1); %} + +%typemap(argout) int & +%{ *$input = (intgo)e$argnum; %} + +%typemap(goout) int & "" + +%typemap(directorin) int & (intgo e) +%{ + e = (intgo)$1; + $input = &e; +%} + +%typemap(godirectorin) int & "" + +%typemap(directorout) int & +%{ + $*1_ltype f = ($*1_ltype)*$input; + $result = ($1_ltype)&f; +%} + +%typemap(directorargout) int & +%{ $1 = (int)*$input; %} + +%typemap(argout) const int & "" +%typemap(directorargout) const int & "" /* Enums. We can't do the right thing for enums in typemap(gotype) so we deliberately don't define them. The right thing would be to @@ -552,10 +597,7 @@ %typemap(godirectorin) enum SWIGTYPE & "" %typemap(directorout) enum SWIGTYPE & -%{ - $*1_ltype f = ($*1_ltype)*$input; - $result = ($1_ltype)&f; -%} +%{ $result = $input; %} /* Arbitrary type. This is a type passed by value in the C/C++ code. We convert it to a pointer for the Go code. Note that all basic @@ -587,7 +629,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/macx64/bin/swig/share/swig/4.0.0/go/gokw.swg b/macx64/bin/swig/share/swig/4.3.0/go/gokw.swg similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/go/gokw.swg rename to macx64/bin/swig/share/swig/4.3.0/go/gokw.swg index dd9f35aa..35428300 100644 --- a/macx64/bin/swig/share/swig/4.0.0/go/gokw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/go/gokw.swg @@ -1,6 +1,6 @@ /* Rename keywords. */ -#define GOKW(x) %keywordwarn("'" `x` "' is a Go keyword, renaming to 'X"`x`"'",rename="X%s") `x` +#define GOKW(x) %keywordwarn("'" `x` "' is a Go keyword",rename="X%s") `x` #define GOBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in Go") "::"`x` GOKW(break); diff --git a/macx64/bin/swig/share/swig/4.0.0/go/goruntime.swg b/macx64/bin/swig/share/swig/4.3.0/go/goruntime.swg similarity index 50% rename from macx64/bin/swig/share/swig/4.0.0/go/goruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/go/goruntime.swg index 269a4eef..7bf083bd 100644 --- a/macx64/bin/swig/share/swig/4.0.0/go/goruntime.swg +++ b/macx64/bin/swig/share/swig/4.3.0/go/goruntime.swg @@ -23,46 +23,39 @@ static void* Swig_malloc(int c) { %} -#if SWIGGO_CGO %insert(cgo_comment_typedefs) %{ +#include #include %} -#endif #if SWIGGO_INTGO_SIZE == 32 %insert(runtime) %{ typedef int intgo; typedef unsigned int uintgo; %} -#if SWIGGO_CGO %insert(cgo_comment_typedefs) %{ typedef int intgo; typedef unsigned int uintgo; %} -#endif #elif SWIGGO_INTGO_SIZE == 64 %insert(runtime) %{ typedef long long intgo; typedef unsigned long long uintgo; %} -#if SWIGGO_CGO %insert(cgo_comment_typedefs) %{ typedef long long intgo; typedef unsigned long long uintgo; %} -#endif #else %insert(runtime) %{ typedef ptrdiff_t intgo; typedef size_t uintgo; %} -#if SWIGGO_CGO %insert(cgo_comment_typedefs) %{ typedef ptrdiff_t intgo; typedef size_t uintgo; %} #endif -#endif #ifndef SWIGGO_GCCGO // Set the host compiler struct attribute that will be @@ -89,8 +82,6 @@ typedef struct { void* array; intgo len; intgo cap; } _goslice_; %} -#ifdef SWIGGO_CGO - %insert(cgo_comment_typedefs) %{ typedef struct { char *p; intgo n; } _gostring_; @@ -98,91 +89,7 @@ typedef struct { void* array; intgo len; intgo cap; } _goslice_; %} -#endif - -#ifndef SWIGGO_GCCGO -/* Boilerplate for C/C++ code when using 6g/8g. This code is compiled - with gcc. */ -%insert(runtime) %{ - -#define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1]; -#define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n) - -swiggo_size_assert(char, 1) -swiggo_size_assert(short, 2) -swiggo_size_assert(int, 4) -typedef long long swiggo_long_long; -swiggo_size_assert(swiggo_long_long, 8) -swiggo_size_assert(float, 4) -swiggo_size_assert(double, 8) - -#ifdef __cplusplus -extern "C" { -#endif -extern void crosscall2(void (*fn)(void *, int), void *, int); -extern char* _cgo_topofstack(void) __attribute__ ((weak)); -extern void _cgo_allocate(void *, int); -extern void _cgo_panic(void *, int); -#ifdef __cplusplus -} -#endif - -static char *_swig_topofstack() { - if (_cgo_topofstack) { - return _cgo_topofstack(); - } else { - return 0; - } -} - -static void _swig_gopanic(const char *p) { - struct { - const char *p; - } SWIGSTRUCTPACKED a; - a.p = p; - crosscall2(_cgo_panic, &a, (int) sizeof a); -} - -%} - -#if !SWIGGO_CGO - -/* This is here for backward compatibility, but it will not work - with Go 1.5 or later. Do not use it in new code. */ -%insert(runtime) %{ - -static void *_swig_goallocate(size_t len) { - struct { - size_t len; - void *ret; - } SWIGSTRUCTPACKED a; - a.len = len; - crosscall2(_cgo_allocate, &a, (int) sizeof a); - return a.ret; -} - -%} - -#endif - -#if !SWIGGO_CGO - -/* Boilerplate for C code when using 6g/8g. This code is compiled - with 6c/8c. */ -%insert(gc_header) %{ -#include "runtime.h" -#include "cgocall.h" - -#pragma dataflag 16 -static void *cgocall = runtime·cgocall; -#pragma dataflag 16 -void *·_cgo_runtime_cgocall = &cgocall; - -%} - -#endif - -#else +#ifdef SWIGGO_GCCGO /* Boilerplate for C/C++ code when using gccgo. */ %insert(runtime) %{ @@ -201,115 +108,12 @@ extern void _cgo_panic(const char *); #define _swig_gopanic _cgo_panic %} -#if !SWIGGO_CGO - -%insert(runtime) %{ - -/* Implementations of SwigCgocall and friends for different versions - of gccgo. The Go code will call these functions using C names with - a prefix of the module name. The implementations here call the - routine in libgo. The routines to call vary depending on the gccgo - version. We assume that the version of gcc used to compile this - file is the same as the version of gccgo. */ - -#ifdef __cplusplus -extern "C" { #endif -#define SWIG_GCC_VERSION \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - -#if SWIG_GCC_VERSION < 40700 -#define SwigDoCgocall() -#define SwigDoCgocallDone() -#define SwigDoCgocallBack() -#define SwigDoCgocallBackDone() -#elif SWIG_GCC_VERSION == 40700 -void SwigDoCgocall(void) __asm__("libgo_syscall.syscall.Entersyscall"); -void SwigDoCgocallDone(void) __asm__("libgo_syscall.syscall.Exitsyscall"); -void SwigDoCgocallBack(void) __asm__("libgo_syscall.syscall.Exitsyscall"); -void SwigDoCgocallBackDone(void) __asm__("libgo_syscall.syscall.Entersyscall"); -#else -void SwigDoCgocall(void) __asm__("syscall.Cgocall"); -void SwigDoCgocallDone(void) __asm__("syscall.CgocallDone"); -void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack"); -void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone"); -#endif - -#define SWIGSTRINGIFY2(s) #s -#define SWIGSTRINGIFY(s) SWIGSTRINGIFY2(s) - -void SwigCgocall() - __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocall"); -void SwigCgocall() { - SwigDoCgocall(); -} - -void SwigCgocallDone() - __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallDone"); -void SwigCgocallDone() { - SwigDoCgocallDone(); -} - -void SwigCgocallBack() - __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBack"); -void SwigCgocallBack() { - SwigDoCgocallBack(); -} - -void SwigCgocallBackDone() - __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBackDone"); -void SwigCgocallBackDone() { - SwigDoCgocallBackDone(); -} - -#undef SWIGSTRINGIFY -#undef SWIGSTRINGIFY2 - -#ifdef __cplusplus -} -#endif - -%} - -#endif - -#endif - -#if !SWIGGO_CGO - -%insert(runtime) %{ - -/* This is here for backward compatibility, but it will not work - with Go 1.5 or later. Do not use it in new code. */ -static _gostring_ _swig_makegostring(const char *p, size_t l) { - _gostring_ ret; - ret.p = (char*)_swig_goallocate(l + 1); - memcpy(ret.p, p, l); - ret.n = l; - return ret; -} - -%} - -#endif - -%insert(runtime) %{ - -#define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { _swig_gopanic(msg); } else -%} - #ifndef SWIGGO_GCCGO %go_import("unsafe", _ "runtime/cgo") -#if !SWIGGO_CGO -%insert(go_header) %{ -var _cgo_runtime_cgocall func(unsafe.Pointer, uintptr) -%} -#endif - #else %go_import("syscall", "unsafe") @@ -346,6 +150,17 @@ type _swig_fnptr *byte type _swig_memberptr *byte %} +/* Convert a Go interface value into a C++ pointer. */ + +%insert(go_header) %{ +func getSwigcptr(v interface { Swigcptr() uintptr }) uintptr { + if v == nil { + return 0 + } + return v.Swigcptr() +} +%} + /* For directors we need C++ to track a Go pointer. Since we can't pass a Go pointer into C++, we use a map to track the pointers on the Go side. */ diff --git a/macx64/bin/swig/share/swig/4.0.0/go/gostring.swg b/macx64/bin/swig/share/swig/4.3.0/go/gostring.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/gostring.swg rename to macx64/bin/swig/share/swig/4.3.0/go/gostring.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_array.i b/macx64/bin/swig/share/swig/4.3.0/go/std_array.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/java/std_array.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_array.i index d3436cc6..36c790e3 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_array.i +++ b/macx64/bin/swig/share/swig/4.3.0/go/std_array.i @@ -41,4 +41,3 @@ namespace std { } }; } - diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_common.i b/macx64/bin/swig/share/swig/4.3.0/go/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/go/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_except.i b/macx64/bin/swig/share/swig/4.3.0/go/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_list.i b/macx64/bin/swig/share/swig/4.3.0/go/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_map.i b/macx64/bin/swig/share/swig/4.3.0/go/std_map.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/go/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_map.i index 773b6d0c..19281ad7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/go/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/go/std_map.i @@ -48,7 +48,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/go/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_string.i b/macx64/bin/swig/share/swig/4.3.0/go/std_string.i similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/go/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_string.i index 099ae84d..35b4a5e4 100644 --- a/macx64/bin/swig/share/swig/4.0.0/go/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.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,4 +91,72 @@ 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) +%{ + 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 + } +%} + +%typemap(directorout) string * (string temp) +%{ + temp.assign($input->p, $input->n); + $result = &temp; + free($input.p); +%} + +%typemap(out,fragment="AllocateString") string * (_gostring_ temp) +%{ + temp = Swig_AllocateString($1->data(), $1->length()); + $result = &temp; +%} + +%typemap(goout,fragment="CopyString") string * +%{ *$result = swigCopyString(*$1) %} + +%typemap(directorin,fragment="AllocateString") string * (_gostring_ 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 * +%{ + if ($1) + *$input = Swig_AllocateString($1->data(), $1->length()); +%} + +%typemap(goargout,fragment="CopyString") string * +%{ + if $input != nil { + *$1 = swigCopyString(*$input) + } +%} + } diff --git a/macx64/bin/swig/share/swig/4.0.0/go/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/go/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/go/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/go/stl.i b/macx64/bin/swig/share/swig/4.3.0/go/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/stl.i rename to macx64/bin/swig/share/swig/4.3.0/go/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/go/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/go/swigmove.i new file mode 100644 index 00000000..e1984b6e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/go/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/go/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/go/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/go/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/guile/argcargv.i new file mode 100644 index 00000000..003be96a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/argcargv.i @@ -0,0 +1,44 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i, len; + SWIG_contract_assert($input != (SCM)0 && + !scm_is_null($input) && + scm_is_array($input), + "you must pass array of strings"); + len = scm_c_array_length($input); + $1 = len; + $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype)); + if ($2 == NULL) { + scm_misc_error(FUNC_NAME, "fail allocating memory for array", SCM_EOL); + } + for (i = 0; i < len; i++) { + SCM args = scm_list_1(scm_from_long(i)); + SCM str = scm_array_ref($input, args); + SWIG_contract_assert(scm_is_string(str), "elements in array must be strings"); + $2[i] = ($*2_ltype)SWIG_scm2str(str); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + if ($input != (SCM)0 && !scm_is_null($input) && scm_is_array($input)) { + size_t len = scm_c_array_length($input); + size_t i; + for(i = 0; i < len; i++) { + SCM args = scm_list_1(scm_from_long(i)); + SCM str = scm_array_ref($input, args); + if (!scm_is_string(str)) { + break; + } + } + /* All elements are strings! */ + $1 = (i == len); + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/cdata.i b/macx64/bin/swig/share/swig/4.3.0/guile/cdata.i new file mode 100644 index 00000000..a03e8585 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/cdata.i @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +%typemap(in) (const void *BYTES, size_t LENGTH) { + size_t temp; + $1 = ($1_ltype) SWIG_Guile_scm2newstr($input, &temp); + $2 = ($2_ltype) temp; +} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(out) SWIGCDATA { + $result = scm_from_locale_stringn($1.data,$1.len); +} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/common.scm b/macx64/bin/swig/share/swig/4.3.0/guile/common.scm similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/common.scm rename to macx64/bin/swig/share/swig/4.3.0/guile/common.scm diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/cplusplus.i b/macx64/bin/swig/share/swig/4.3.0/guile/cplusplus.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/cplusplus.i rename to macx64/bin/swig/share/swig/4.3.0/guile/cplusplus.i diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/guile.i b/macx64/bin/swig/share/swig/4.3.0/guile/guile.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/guile.i rename to macx64/bin/swig/share/swig/4.3.0/guile/guile.i diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/guile_scm.swg b/macx64/bin/swig/share/swig/4.3.0/guile/guile_scm.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/guile_scm.swg rename to macx64/bin/swig/share/swig/4.3.0/guile/guile_scm.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/guile_scm_run.swg b/macx64/bin/swig/share/swig/4.3.0/guile/guile_scm_run.swg similarity index 87% rename from macx64/bin/swig/share/swig/4.0.0/guile/guile_scm_run.swg rename to macx64/bin/swig/share/swig/4.3.0/guile/guile_scm_run.swg index 86e5c3be..bd224271 100644 --- a/macx64/bin/swig/share/swig/4.0.0/guile/guile_scm_run.swg +++ b/macx64/bin/swig/share/swig/4.3.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 @@ -65,10 +71,11 @@ typedef struct swig_guile_clientdata { #define SWIG_IsPointer(object) \ SWIG_Guile_IsPointer(object) #define SWIG_contract_assert(expr, msg) \ - if (!(expr)) \ - scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \ - (char *) FUNC_NAME, (char *) msg, \ - SCM_EOL, SCM_BOOL_F); else + do { \ + if (!(expr)) \ + scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"), \ + FUNC_NAME, msg, SCM_EOL, SCM_BOOL_F); \ + } while (0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) \ @@ -84,15 +91,9 @@ static swig_module_info *SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata)); SWIGINTERN char * SWIG_Guile_scm2newstr(SCM str, size_t *len) { #define FUNC_NAME "SWIG_Guile_scm2newstr" - char *ret; - SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME); - ret = scm_to_utf8_string(str); - if (!ret) return NULL; - - if (len) *len = strlen(ret) - 1; - return ret; + return scm_to_utf8_stringn(str, len); #undef FUNC_NAME } @@ -110,6 +111,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) { @@ -123,7 +126,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, @@ -143,7 +146,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)) { @@ -156,7 +159,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)) { @@ -183,8 +186,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 @@ -195,22 +199,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 * @@ -221,7 +239,7 @@ SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type, int res = SWIG_Guile_ConvertPtr(s, &result, type, flags); if (!SWIG_IsOK(res)) { /* type mismatch */ - scm_wrong_type_arg((char *) func_name, argnum, s); + scm_wrong_type_arg(func_name, argnum, s); } return result; } @@ -250,7 +268,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); } @@ -263,7 +281,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); } @@ -315,13 +333,13 @@ print_swig_aux (SCM swig_smob, SCM port, scm_print_state *pstate, type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob); if (type) { - scm_puts((char *) "#<", port); - scm_puts((char *) attribute, port); - scm_puts((char *) "swig-pointer ", port); - scm_puts((char *) SWIG_TypePrettyName(type), port); - scm_puts((char *) " ", port); + scm_puts("#<", port); + scm_puts(attribute, port); + scm_puts("swig-pointer ", port); + scm_puts(SWIG_TypePrettyName(type), port); + scm_puts(" ", port); scm_intprint((long) SCM_CELL_WORD_1(swig_smob), 16, port); - scm_puts((char *) ">", port); + scm_puts(">", port); /* non-zero means success */ return 1; } else { @@ -354,10 +372,10 @@ print_member_function_swig (SCM swig_smob, SCM port, scm_print_state *pstate) swig_type_info *type; type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob); if (type) { - scm_puts((char *) "#<", port); - scm_puts((char *) "swig-member-function-pointer ", port); - scm_puts((char *) SWIG_TypePrettyName(type), port); - scm_puts((char *) " >", port); + scm_puts("#<", port); + scm_puts("swig-member-function-pointer ", port); + scm_puts(SWIG_TypePrettyName(type), port); + scm_puts(" >", port); /* non-zero means success */ return 1; } else { @@ -401,7 +419,7 @@ ensure_smob_tag(SCM swig_module, SCM variable = scm_module_variable(swig_module, scm_from_locale_symbol(scheme_variable_name)); if (scm_is_false(variable)) { - *tag_variable = scm_make_smob_type((char*)scheme_variable_name, 0); + *tag_variable = scm_make_smob_type(scheme_variable_name, 0); scm_c_module_define(swig_module, scheme_variable_name, scm_from_ulong(*tag_variable)); return 1; @@ -446,7 +464,7 @@ SWIG_Guile_Init () } swig_make_func = scm_permanent_object( scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make"))); - swig_keyword = scm_permanent_object(scm_from_locale_keyword((char*) "init-smob")); + swig_keyword = scm_permanent_object(scm_from_locale_keyword("init-smob")); swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob")); #ifdef SWIG_INIT_RUNTIME_MODULE SWIG_INIT_RUNTIME_MODULE @@ -484,21 +502,21 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest, int i; int num_args_passed = 0; for (i = 0; i") PTRTYPE *OUTPUT_NONCOLLECTABLE "SWIG_APPEND_VALUE(SWIG_NewPointerObj(*$1, $*descriptor, 0));"; -%typemap(in) PTRTYPE *BOTH = PTRTYPE *INPUT; -%typemap(argout) PTRTYPE *BOTH = PTRTYPE *OUTPUT; %typemap(in) PTRTYPE *INOUT = PTRTYPE *INPUT; %typemap(argout) PTRTYPE *INOUT = PTRTYPE *OUTPUT; diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/ports.i b/macx64/bin/swig/share/swig/4.3.0/guile/ports.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/ports.i rename to macx64/bin/swig/share/swig/4.3.0/guile/ports.i diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_auto_ptr.i new file mode 100644 index 00000000..59d5c0ed --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/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) { + 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/macx64/bin/swig/share/swig/4.0.0/guile/std_common.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_common.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_common.i index 5899c554..97974497 100644 --- a/macx64/bin/swig/share/swig/4.0.0/guile/std_common.i +++ b/macx64/bin/swig/share/swig/4.3.0/guile/std_common.i @@ -19,7 +19,7 @@ std::string SWIG_scm2string(SCM x) { char* temp; temp = SWIG_scm2str(x); std::string s(temp); - if (temp) SWIG_free(temp); + SWIG_free(temp); return s; } %} diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_except.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_except.i diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/std_map.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_map.i new file mode 100644 index 00000000..6fb9bcab --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/std_map.i @@ -0,0 +1,280 @@ +/* ----------------------------------------------------------------------------- + * std_map.i + * + * SWIG typemaps for std::map + * ----------------------------------------------------------------------------- */ + +%include +%include + +// ------------------------------------------------------------------------ +// std::map +// +// The aim of all that follows would be to integrate std::map with +// Guile as much as possible, namely, to allow the user to pass and +// be returned Scheme association lists. +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::map), f(const std::map&), f(const std::map*): +// the parameter being read-only, either a Scheme alist or a +// previously wrapped std::map can be passed. +// -- f(std::map&), f(std::map*): +// the parameter must be modified; therefore, only a wrapped std::map +// can be passed. +// -- std::map f(): +// the map is returned by copy; therefore, a Scheme alist +// is returned which is most easily used in other Scheme functions +// -- std::map& f(), std::map* f(), const std::map& f(), +// const std::map* f(): +// the map is returned by reference; therefore, a wrapped std::map +// is returned +// ------------------------------------------------------------------------ + +%{ +#include +#include +#include +%} + +// exported class + +namespace std { + + template > class map { + %typemap(in) map< K, T, C > { + if (scm_is_null($input)) { + $1 = std::map< K, T, C >(); + } else if (scm_is_pair($input)) { + $1 = std::map< K, T, C >(); + SCM alist = $input; + while (!scm_is_null(alist)) { + K* k; + T* x; + SCM entry, key, val; + entry = SCM_CAR(alist); + if (!scm_is_pair(entry)) + SWIG_exception(SWIG_TypeError,"alist expected"); + key = SCM_CAR(entry); + val = SCM_CDR(entry); + k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != 0) { + if (!scm_is_pair(val)) + SWIG_exception(SWIG_TypeError,"alist expected"); + val = SCM_CAR(val); + x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); + } +%#ifdef __cpp_lib_map_try_emplace + (($1_type &)$1).insert_or_assign(*k, *x); +%#else + (($1_type &)$1)[*k] = *x; +%#endif + alist = SCM_CDR(alist); + } + } else { + $1 = *(($&1_type) + SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); + } + } + %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp), + const map< K, T, C >* (std::map< K, T, C > temp) { + if (scm_is_null($input)) { + temp = std::map< K, T, C >(); + $1 = &temp; + } else if (scm_is_pair($input)) { + temp = std::map< K, T, C >(); + $1 = &temp; + SCM alist = $input; + while (!scm_is_null(alist)) { + K* k; + T* x; + SCM entry, key, val; + entry = SCM_CAR(alist); + if (!scm_is_pair(entry)) + SWIG_exception(SWIG_TypeError,"alist expected"); + key = SCM_CAR(entry); + val = SCM_CDR(entry); + k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != 0) { + if (!scm_is_pair(val)) + SWIG_exception(SWIG_TypeError,"alist expected"); + val = SCM_CAR(val); + x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); + } +%#ifdef __cpp_lib_map_try_emplace + temp.insert_or_assign(*k, *x); +%#else + temp[*k] = *x; +%#endif + alist = SCM_CDR(alist); + } + } else { + $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); + } + } + %typemap(out) map< K, T, C > { + SCM alist = SCM_EOL; + for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { + K* key = new K(i->first); + T* val = new T(i->second); + SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); + SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1); + SCM entry = scm_cons(k,x); + alist = scm_cons(entry,alist); + } + $result = alist; + } + %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { + /* native sequence? */ + if (scm_is_null($input)) { + /* an empty sequence can be of any type */ + $1 = 1; + } else if (scm_is_pair($input)) { + /* check the first element only */ + K* k; + T* x; + SCM head = SCM_CAR($input); + if (scm_is_pair(head)) { + SCM key = SCM_CAR(head); + SCM val = SCM_CDR(head); + if (SWIG_ConvertPtr(key,(void**) &k, + $descriptor(K *), 0) != 0) { + $1 = 0; + } else { + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == 0) { + $1 = 1; + } else if (scm_is_pair(val)) { + val = SCM_CAR(val); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == 0) + $1 = 1; + else + $1 = 0; + } else { + $1 = 0; + } + } + } else { + $1 = 0; + } + } else { + /* wrapped map? */ + std::map< K, T, C >* m; + if (SWIG_ConvertPtr($input,(void **) &m, + $&1_descriptor, 0) == 0) + $1 = 1; + else + $1 = 0; + } + } + %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, + const map< K, T, C >* { + /* native sequence? */ + if (scm_is_null($input)) { + /* an empty sequence can be of any type */ + $1 = 1; + } else if (scm_is_pair($input)) { + /* check the first element only */ + K* k; + T* x; + SCM head = SCM_CAR($input); + if (scm_is_pair(head)) { + SCM key = SCM_CAR(head); + SCM val = SCM_CDR(head); + if (SWIG_ConvertPtr(key,(void**) &k, + $descriptor(K *), 0) != 0) { + $1 = 0; + } else { + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == 0) { + $1 = 1; + } else if (scm_is_pair(val)) { + val = SCM_CAR(val); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == 0) + $1 = 1; + else + $1 = 0; + } else { + $1 = 0; + } + } + } else { + $1 = 0; + } + } else { + /* wrapped map? */ + std::map< K, T, C >* m; + if (SWIG_ConvertPtr($input,(void **) &m, + $1_descriptor, 0) == 0) + $1 = 1; + else + $1 = 0; + } + } + %rename("length") size; + %rename("null?") empty; + %rename("clear!") clear; + %rename("ref") __getitem__; + %rename("set!") __setitem__; + %rename("delete!") __delitem__; + %rename("has-key?") has_key; + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + map(); + map(const map& other); + + unsigned int size() const; + bool empty() const; + void clear(); + %extend { + const T& __getitem__(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + void __setitem__(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else + (*self)[key] = x; +%#endif + } + void __delitem__(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + bool has_key(const K& key) { + std::map< K, T, C >::iterator i = self->find(key); + return i != self->end(); + } + SCM keys() { + SCM result = SCM_EOL; + for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { + K* key = new K(i->first); + SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); + result = scm_cons(k,result); + } + return result; + } + } + }; + +} diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_string.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_string.i similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_string.i index 6513173e..178c484c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/guile/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/guile/std_string.i @@ -30,7 +30,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); $1.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -40,7 +40,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); temp.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); $1 = &temp; } else { SWIG_exception(SWIG_TypeError, "string expected"); @@ -51,7 +51,7 @@ namespace std { if (scm_is_string($input)) { tempptr = SWIG_scm2str($input); $1 = new $*1_ltype(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -73,7 +73,7 @@ namespace std { if (scm_is_string($input)) { char *tempptr = SWIG_scm2str($input); $1.assign(tempptr); - if (tempptr) SWIG_free(tempptr); + SWIG_free(tempptr); } else { SWIG_exception(SWIG_TypeError, "string expected"); } @@ -83,4 +83,13 @@ namespace std { $result = SWIG_str02scm($1.c_str()); } + %typemap(throws) string { + scm_throw(scm_from_locale_symbol("swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } + + %typemap(throws) const string & { + scm_throw(scm_from_locale_symbol("swig-exception"), + scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED)); + } } diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_unique_ptr.i new file mode 100644 index 00000000..485f423e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/std_unique_ptr.i @@ -0,0 +1,68 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/guile/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/guile/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/stl.i b/macx64/bin/swig/share/swig/4.3.0/guile/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/guile/stl.i rename to macx64/bin/swig/share/swig/4.3.0/guile/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/guile/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/guile/swigmove.i new file mode 100644 index 00000000..7920a1bf --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/guile/swigmove.i @@ -0,0 +1,21 @@ +/* ----------------------------------------------------------------------------- + * 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); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/guile/swigrun.i b/macx64/bin/swig/share/swig/4.3.0/guile/swigrun.i similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/guile/swigrun.i rename to macx64/bin/swig/share/swig/4.3.0/guile/swigrun.i index 4b9ea2c7..e4573eb3 100644 --- a/macx64/bin/swig/share/swig/4.0.0/guile/swigrun.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/guile/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/guile/typemaps.i similarity index 81% rename from macx64/bin/swig/share/swig/4.0.0/guile/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/guile/typemaps.i index cfccced8..a75c5592 100644 --- a/macx64/bin/swig/share/swig/4.0.0/guile/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.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(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); @@ -29,7 +55,7 @@ } %typemap(varin) SWIGTYPE [] { - scm_wrong_type_arg((char *) FUNC_NAME, 1, $input); + scm_wrong_type_arg(FUNC_NAME, 1, $input); } %typemap(varin) SWIGTYPE [ANY] { @@ -68,31 +94,31 @@ %typemap(throws) SWIGTYPE { $<ype temp = new $ltype($1); - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(SWIG_NewPointerObj(temp, $&descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE & { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE && { - scm_throw(gh_symbol2scm((char *) "swig-exception"), - gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1), + scm_throw(scm_from_locale_symbol("swig-exception"), + scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE * { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE [] { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1), SCM_UNDEFINED)); } @@ -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 @@ -166,8 +192,8 @@ %typemap(varin) enum SWIGTYPE { if (sizeof(int) != sizeof($1)) { scm_error(scm_from_locale_symbol("swig-error"), - (char *) FUNC_NAME, - (char *) "enum variable '$name' cannot be set", + FUNC_NAME, + "enum variable '$name' cannot be set", SCM_EOL, SCM_BOOL_F); } * (int *) &($1) = scm_to_int($input); @@ -175,7 +201,7 @@ %typemap(out) enum SWIGTYPE { $result = scm_from_long((int)$1); } %typemap(varout) enum SWIGTYPE { $result = scm_from_long((int)$1); } %typemap(throws) enum SWIGTYPE { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(scm_from_long((int)$1), SCM_UNDEFINED)); } @@ -209,8 +235,6 @@ %typemap (argout,doc="$name (of type <" #SCM_NAME ">)") C_NAME *OUTPUT { C_NAME swig_c_value = *$1; SWIG_APPEND_VALUE(C_TO_SCM_EXPR); } - %typemap (in) C_NAME *BOTH = C_NAME *INPUT; - %typemap (argout) C_NAME *BOTH = C_NAME *OUTPUT; %typemap (in) C_NAME *INOUT = C_NAME *INPUT; %typemap (argout) C_NAME *INOUT = C_NAME *OUTPUT; /* Const primitive references. Passed by value */ @@ -224,7 +248,7 @@ /* Throw typemap */ %typemap(throws) C_NAME { C_NAME swig_c_value = $1; - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(C_TO_SCM_EXPR, SCM_UNDEFINED)); } %enddef @@ -252,8 +276,6 @@ {$1 = &temp;} %typemap (argout,doc="$name (of type <" #SCM_NAME ">)") C_NAME *OUTPUT, C_NAME &OUTPUT {SWIG_APPEND_VALUE(C_TO_SCM(*$1));} - %typemap (in) C_NAME *BOTH = C_NAME *INPUT; - %typemap (argout) C_NAME *BOTH = C_NAME *OUTPUT; %typemap (in) C_NAME *INOUT = C_NAME *INPUT; %typemap (argout) C_NAME *INOUT = C_NAME *OUTPUT; %typemap (in) C_NAME &INOUT = C_NAME &INPUT; @@ -268,7 +290,7 @@ } /* Throw typemap */ %typemap(throws) C_NAME { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(C_TO_SCM($1), SCM_UNDEFINED)); } %enddef @@ -314,27 +336,25 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); {$1 = &temp;} %typemap (argout,doc="$NAME (a string)") char **OUTPUT {SWIG_APPEND_VALUE(SWIG_str02scm(*$1));} - %typemap (in) char **BOTH = char **INPUT; - %typemap (argout) char **BOTH = char **OUTPUT; %typemap (in) char **INOUT = char **INPUT; %typemap (argout) char **INOUT = char **OUTPUT; /* 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 && $1) SWIG_free($1);"; -%typemap (freearg) char **INPUT, char **BOTH "if (must_free$argnum && (*$1)) SWIG_free(*$1);" +%typemap (freearg) char * "if (must_free$argnum) SWIG_free($1);" +%typemap (freearg) char **INPUT, char **INOUT "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 *INOUT "" /* If we set a string variable, delete the old result first, unless const. */ %typemap (varin) char * { - if ($1) free($1); + free($1); $1 = ($1_ltype) SWIG_scm2str($input); } @@ -343,19 +363,19 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); } %typemap(throws) char * { - scm_throw(scm_from_locale_symbol((char *) "swig-exception"), + scm_throw(scm_from_locale_symbol("swig-exception"), scm_list_n(SWIG_str02scm($1), SCM_UNDEFINED)); } /* 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;"; /* ------------------------------------------------------------ @@ -367,37 +387,35 @@ typedef unsigned long SCM; $1 = ($1_ltype) SWIG_Guile_scm2newstr($input, &temp); $2 = ($2_ltype) temp; } +%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) } +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } /* ------------------------------------------------------------ * CLASS::* (member function pointer) typemaps * 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($type),$descriptor); +%typemap(in) SWIGTYPE (CLASS::*) { + int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { - %argument_fail(res,"$type",$symname, $argnum); + %argument_fail(res,"$type",$symname, $argnum); } } %typemap(out,noblock=1) SWIGTYPE (CLASS::*) { - %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); + %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor)); } %typemap(varin) SWIGTYPE (CLASS::*) { - int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor); + int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { - scm_wrong_type_arg((char *) FUNC_NAME, 1, $input); + scm_wrong_type_arg(FUNC_NAME, 1, $input); } } %typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { - %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); + %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor)); } /* ------------------------------------------------------------ @@ -426,7 +444,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/macx64/bin/swig/share/swig/4.0.0/intrusive_ptr.i b/macx64/bin/swig/share/swig/4.3.0/intrusive_ptr.i similarity index 66% rename from macx64/bin/swig/share/swig/4.0.0/intrusive_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/intrusive_ptr.i index 621a701f..a4e8df0a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/intrusive_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.0/intrusive_ptr.i @@ -56,25 +56,3 @@ SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(, TYPE) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE) %enddef - -// Legacy macros -%define SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE...) -#warning "SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead." -%intrusive_ptr(TYPE) -%enddef - -%define SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...) -#warning "SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead." -%intrusive_ptr(TYPE) -%enddef - -%define SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE...) -#warning "SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead." -%intrusive_ptr_no_wrap(TYPE) -%enddef - -%define SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE...) -#warning "SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead." -%intrusive_ptr_no_wrap(TYPE) -%enddef - diff --git a/macx64/bin/swig/share/swig/4.0.0/inttypes.i b/macx64/bin/swig/share/swig/4.3.0/inttypes.i similarity index 66% rename from macx64/bin/swig/share/swig/4.0.0/inttypes.i rename to macx64/bin/swig/share/swig/4.3.0/inttypes.i index 85bd5ada..f5a09f0b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/inttypes.i +++ b/macx64/bin/swig/share/swig/4.3.0/inttypes.i @@ -49,37 +49,12 @@ extern "C" { extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t ** endptr, int base); #endif -#ifdef SWIGWORDSIZE64 - /* Like `strtol' but convert to `intmax_t'. */ extern intmax_t strtoimax (const char *nptr, char **endptr, int base); /* Like `strtoul' but convert to `uintmax_t'. */ extern uintmax_t strtoumax (const char *nptr, char **endptr,int base); -#ifdef SWIG_WCHAR - /* Like `wcstol' but convert to `intmax_t'. */ - extern intmax_t wcstoimax (const wchar_t *nptr, wchar_t **endptr, int base); - - /* Like `wcstoul' but convert to `uintmax_t'. */ - extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base); -#endif - -#else /* SWIGWORDSIZE32 */ - - /* Like `strtol' but convert to `intmax_t'. */ - extern intmax_t strtoimax (const char *nptr, char **endptr, int base); - - /* Like `strtoul' but convert to `uintmax_t'. */ - extern uintmax_t strtoumax (const char *nptr, char **endptr, int base); - -#ifdef SWIG_WCHAR - /* Like `wcstol' but convert to `intmax_t'. */ - extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base); -#endif - -#endif /* SWIGWORDSIZE64 */ - #ifdef __cplusplus } #endif diff --git a/macx64/bin/swig/share/swig/4.3.0/java/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/java/argcargv.i new file mode 100644 index 00000000..cf0f85ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/java/argcargv.i @@ -0,0 +1,36 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(jni) (int ARGC, char **ARGV) "jobjectArray" +%typemap(jtype) (int ARGC, char **ARGV) "String[]" +%typemap(jstype) (int ARGC, char **ARGV) "String[]" + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i, len; + if ($input == (jobjectArray)0) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array"); + return $null; + } + len = ($1_ltype)JCALL1(GetArrayLength, jenv, $input); + if (len < 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "array length negative"); + return $null; + } + $2 = ($2_ltype) malloc((len+1)*sizeof($*2_ltype)); + if ($2 == NULL) { + SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "memory allocation failed"); + return $null; + } + $1 = len; + for (i = 0; i < len; i++) { + jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, (jsize)i); + const char *c_string = JCALL2(GetStringUTFChars, jenv, j_string, 0); + $2[i] = ($*2_ltype)c_string; + } + $2[i] = NULL; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/java/arrays_java.i b/macx64/bin/swig/share/swig/4.3.0/java/arrays_java.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/java/arrays_java.i rename to macx64/bin/swig/share/swig/4.3.0/java/arrays_java.i index dd38438a..a8f5180c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/arrays_java.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/arrays_java.i @@ -104,7 +104,7 @@ JAVA_ARRAYS_DECL(int, jint, Int, Int) /* int[] */ JAVA_ARRAYS_DECL(unsigned int, jlong, Long, Uint) /* unsigned int[] */ JAVA_ARRAYS_DECL(long, jint, Int, Long) /* long[] */ JAVA_ARRAYS_DECL(unsigned long, jlong, Long, Ulong) /* unsigned long[] */ -JAVA_ARRAYS_DECL(jlong, jlong, Long, Longlong) /* long long[] */ +JAVA_ARRAYS_DECL(long long, jlong, Long, Longlong) /* long long[] */ JAVA_ARRAYS_DECL(float, jfloat, Float, Float) /* float[] */ JAVA_ARRAYS_DECL(double, jdouble, Double, Double) /* double[] */ @@ -128,7 +128,7 @@ JAVA_ARRAYS_IMPL(int, jint, Int, Int) /* int[] */ JAVA_ARRAYS_IMPL(unsigned int, jlong, Long, Uint) /* unsigned int[] */ JAVA_ARRAYS_IMPL(long, jint, Int, Long) /* long[] */ JAVA_ARRAYS_IMPL(unsigned long, jlong, Long, Ulong) /* unsigned long[] */ -JAVA_ARRAYS_IMPL(jlong, jlong, Long, Longlong) /* long long[] */ +JAVA_ARRAYS_IMPL(long long, jlong, Long, Longlong) /* long long[] */ JAVA_ARRAYS_IMPL(float, jfloat, Float, Float) /* float[] */ JAVA_ARRAYS_IMPL(double, jdouble, Double, Double) /* double[] */ @@ -147,19 +147,19 @@ JAVA_ARRAYS_IMPL(double, jdouble, Double, Double) /* double[] */ %typemap(jstype) CTYPE[ANY], CTYPE[] %{JTYPE[]%} %typemap(in) CTYPE[] (JNITYPE *jarr) -%{ if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, (CTYPE **)&$1, $input)) return $null; %} +%{ if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, ($&1_ltype)&$1, $input)) return $null; %} %typemap(in) CTYPE[ANY] (JNITYPE *jarr) %{ if ($input && JCALL1(GetArrayLength, jenv, $input) != $1_size) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "incorrect array size"); return $null; } - if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, (CTYPE **)&$1, $input)) return $null; %} + if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, ($&1_ltype)&$1, $input)) return $null; %} %typemap(argout) CTYPE[ANY], CTYPE[] -%{ SWIG_JavaArrayArgout##JFUNCNAME(jenv, jarr$argnum, (CTYPE *)$1, $input); %} +%{ SWIG_JavaArrayArgout##JFUNCNAME(jenv, jarr$argnum, ($1_ltype)$1, $input); %} %typemap(out) CTYPE[ANY] -%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, (CTYPE *)$1, $1_dim0); %} +%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, ($1_ltype)$1, $1_dim0); %} %typemap(out) CTYPE[] -%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, (CTYPE *)$1, FillMeInAsSizeCannotBeDeterminedAutomatically); %} +%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, ($1_ltype)$1, FillMeInAsSizeCannotBeDeterminedAutomatically); %} %typemap(freearg) CTYPE[ANY], CTYPE[] #ifdef __cplusplus %{ delete [] $1; %} @@ -227,6 +227,12 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] * double[ANY], double[] "" +#if defined(SWIGWORDSIZE64) +%apply long long[ANY] { long[ANY] }; +%apply unsigned long long[ANY] { unsigned long[ANY] }; +%apply long long[] { long[] }; +%apply unsigned long long[] { unsigned long[] }; +#endif /* Arrays of proxy classes. The typemaps in this macro make it possible to treat an array of * class/struct/unions as an array of Java classes. diff --git a/macx64/bin/swig/share/swig/4.0.0/java/boost_intrusive_ptr.i b/macx64/bin/swig/share/swig/4.3.0/java/boost_intrusive_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/java/boost_intrusive_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/java/boost_intrusive_ptr.i index 3bc80b46..072a31e8 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/boost_intrusive_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/java/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/java/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/java/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/java/boost_shared_ptr.i index 325a6832..ce00162d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.3.0/java/cdata.i b/macx64/bin/swig/share/swig/4.3.0/java/cdata.i new file mode 100644 index 00000000..f1befcaf --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/java/cdata.i @@ -0,0 +1,78 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +/* String & length */ +%typemap(jni) (const void *BYTES, size_t LENGTH) "jbyteArray" +%typemap(jtype) (const void *BYTES, size_t LENGTH) "byte[]" +%typemap(jstype) (const void *BYTES, size_t LENGTH) "byte[]" +%typemap(javain) (const void *BYTES, size_t LENGTH) "$javainput" +%typemap(freearg) (const void *BYTES, size_t LENGTH) "" +%typemap(in) (const void *BYTES, size_t LENGTH) { + if ($input) { + $1 = ($1_ltype) JCALL2(GetByteArrayElements, jenv, $input, 0); + $2 = ($2_type) JCALL1(GetArrayLength, jenv, $input); + } else { + $1 = 0; + $2 = 0; + } +} +%typemap(argout) (const void *BYTES, size_t LENGTH) { + if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, JNI_ABORT); +} +%typemap(directorin, descriptor="[B", noblock=1) (const void *BYTES, size_t LENGTH) { + $input = 0; + if ($1) { + $input = JCALL1(NewByteArray, jenv, (jsize)$2); + if (!$input) return $null; + JCALL4(SetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); + } + Swig::LocalRefGuard $1_refguard(jenv, $input); +} +%typemap(javadirectorin, descriptor="[B") (const void *BYTES, size_t LENGTH) "$jniinput" +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } +/* Enable write-back for non-const version */ +%typemap(argout) (void *BYTES, size_t LENGTH) { + if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0); +} +%typemap(directorargout, noblock=1) (void *BYTES, size_t LENGTH) +{ if ($input && $1) JCALL4(GetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); } + +%include + +%typemap(jni) SWIGCDATA "jbyteArray" +%typemap(jtype) SWIGCDATA "byte[]" +%typemap(jstype) SWIGCDATA "byte[]" +%fragment("SWIG_JavaArrayOutCDATA", "header") { +static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) { + jbyteArray jresult; + jbyte *arr; + int i; + jresult = JCALL1(NewByteArray, jenv, sz); + if (!jresult) { + return SWIG_NULLPTR; + } + arr = JCALL2(GetByteArrayElements, jenv, jresult, 0); + if (!arr) { + return SWIG_NULLPTR; + } + for (i=0; i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/director.swg b/macx64/bin/swig/share/swig/4.3.0/java/director.swg similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/java/director.swg rename to macx64/bin/swig/share/swig/4.3.0/java/director.swg index d3bd162e..630a98f3 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/java/director.swg @@ -51,16 +51,20 @@ 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 */ class JObjectWrapper { public: - JObjectWrapper() : jthis_(NULL), weak_global_(true) { + JObjectWrapper() : jthis_(SWIG_NULLPTR), weak_global_(true) { } ~JObjectWrapper() { - jthis_ = NULL; + jthis_ = SWIG_NULLPTR; weak_global_ = true; } @@ -99,13 +103,13 @@ namespace Swig { #endif if (jthis_) { if (weak_global_) { - if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) + if (jenv->IsSameObject(jthis_, SWIG_NULLPTR) == JNI_FALSE) jenv->DeleteWeakGlobalRef((jweak)jthis_); } else jenv->DeleteGlobalRef(jthis_); } - jthis_ = NULL; + jthis_ = SWIG_NULLPTR; weak_global_ = true; } @@ -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_; @@ -172,7 +193,7 @@ namespace Swig { JNIEnv *jenv_; int env_status; public: - JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { + JNIEnvWrapper(const Director *director) : director_(director), jenv_(SWIG_NULLPTR), env_status(0) { #if defined(__ANDROID__) JNIEnv **jenv = &jenv_; #else @@ -181,8 +202,8 @@ namespace Swig { env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); JavaVMAttachArgs args; args.version = JNI_VERSION_1_2; - args.group = NULL; - args.name = NULL; + args.group = SWIG_NULLPTR; + args.name = SWIG_NULLPTR; #if defined(SWIG_JAVA_USE_THREAD_NAME) char thread_name[64]; // MAX_TASK_COMM_LEN=16 is hard-coded in the Linux kernel and MacOS has MAXTHREADNAMESIZE=64. if (Swig::GetThreadName(thread_name, sizeof(thread_name)) == 0) { @@ -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) @@ -215,6 +246,15 @@ namespace Swig { } }; + struct SwigDirectorMethod { + const char *name; + const char *desc; + jmethodID methid; + SwigDirectorMethod(JNIEnv *jenv, jclass baseclass, const char *name, const char *desc) : name(name), desc(desc) { + methid = jenv->GetMethodID(baseclass, name, desc); + } + }; + /* Java object wrapper */ JObjectWrapper swig_self_; @@ -227,7 +267,7 @@ namespace Swig { #if defined(DEBUG_DIRECTOR_OWNED) std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; #endif - if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { + if (jobj && jenv->IsSameObject(jobj, SWIG_NULLPTR) == JNI_FALSE) { jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); if (disconn_meth) { #if defined(DEBUG_DIRECTOR_OWNED) @@ -238,8 +278,13 @@ namespace Swig { } } + jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) { + jclass clz = jenv->FindClass(classname); + return clz ? (jclass)jenv->NewGlobalRef(clz) : SWIG_NULLPTR; + } + public: - Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { + Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) SWIG_NULLPTR), swig_self_() { /* Acquire the Java VM pointer */ jenv->GetJavaVM(&swig_jvm_); } @@ -284,9 +329,9 @@ namespace Swig { // Simple holder for a Java string during exception handling, providing access to a c-style string class JavaString { public: - JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { + JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(SWIG_NULLPTR) { if (jenv_ && jstr_) - cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); + cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, SWIG_NULLPTR); } ~JavaString() { @@ -327,7 +372,7 @@ namespace Swig { // Get exception message by calling Java method Throwable.getMessage() static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { - jstring jmsg = NULL; + jstring jmsg = SWIG_NULLPTR; if (jenv && throwable) { jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions jclass throwclz = jenv->GetObjectClass(throwable); @@ -337,7 +382,7 @@ namespace Swig { if (getMessageMethodID) jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); } - if (jmsg == NULL && jenv->ExceptionCheck()) + if (jmsg == SWIG_NULLPTR && jenv->ExceptionCheck()) jenv->ExceptionClear(); } return jmsg; @@ -351,7 +396,7 @@ namespace Swig { public: // Construct exception from a Java throwable - DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(0), msg_(0) { + DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(SWIG_NULLPTR), msg_(SWIG_NULLPTR) { // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') if (jenv && throwable) { @@ -366,7 +411,7 @@ namespace Swig { // Copy strings, since there is no guarantee that jenv will be active when handled if (jstr_classname) { JavaString jsclassname(jenv, jstr_classname); - const char *classname = jsclassname.c_str(0); + const char *classname = jsclassname.c_str(SWIG_NULLPTR); if (classname) classname_ = copypath(classname); } @@ -376,11 +421,11 @@ namespace Swig { } JavaExceptionMessage exceptionmsg(jenv, throwable); - msg_ = copystr(exceptionmsg.message(0)); + msg_ = copystr(exceptionmsg.message(SWIG_NULLPTR)); } // More general constructor for handling as a java.lang.RuntimeException - DirectorException(const char *msg) : jenv_(0), throwable_(0), classname_(0), msg_(msg ? copystr(msg) : 0) { + DirectorException(const char *msg) : jenv_(SWIG_NULLPTR), throwable_(SWIG_NULLPTR), classname_(SWIG_NULLPTR), msg_(msg ? copystr(msg) : SWIG_NULLPTR) { } ~DirectorException() throw() { @@ -401,7 +446,7 @@ namespace Swig { jthrowable throwable = jenv->ExceptionOccurred(); if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) { jenv->ExceptionClear(); - throwable = 0; + throwable = SWIG_NULLPTR; } if (!throwable) jenv->Throw(throwable_); @@ -409,8 +454,8 @@ namespace Swig { // Try and reconstruct original exception, but original stacktrace is not reconstructed jenv->ExceptionClear(); - jmethodID ctorMethodID = 0; - jclass throwableclass = 0; + jmethodID ctorMethodID = SWIG_NULLPTR; + jclass throwableclass = SWIG_NULLPTR; if (classname_) { throwableclass = jenv->FindClass(classname_); if (throwableclass) @@ -447,7 +492,7 @@ namespace Swig { } static char *copystr(const char *srcmsg) { - char *target = 0; + char *target = SWIG_NULLPTR; if (srcmsg) { size_t msglen = strlen(srcmsg) + 1; target = new char[msglen]; diff --git a/macx64/bin/swig/share/swig/4.0.0/java/enums.swg b/macx64/bin/swig/share/swig/4.3.0/java/enums.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/enums.swg rename to macx64/bin/swig/share/swig/4.3.0/java/enums.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/java/enumsimple.swg b/macx64/bin/swig/share/swig/4.3.0/java/enumsimple.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/enumsimple.swg rename to macx64/bin/swig/share/swig/4.3.0/java/enumsimple.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/java/enumtypesafe.swg b/macx64/bin/swig/share/swig/4.3.0/java/enumtypesafe.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/enumtypesafe.swg rename to macx64/bin/swig/share/swig/4.3.0/java/enumtypesafe.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/java/enumtypeunsafe.swg b/macx64/bin/swig/share/swig/4.3.0/java/enumtypeunsafe.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/enumtypeunsafe.swg rename to macx64/bin/swig/share/swig/4.3.0/java/enumtypeunsafe.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/java/java.swg b/macx64/bin/swig/share/swig/4.3.0/java/java.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/java/java.swg rename to macx64/bin/swig/share/swig/4.3.0/java/java.swg index e9309331..dd5b0358 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/java.swg +++ b/macx64/bin/swig/share/swig/4.3.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::*) { @@ -1038,7 +1039,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } unsigned long, unsigned short %{ char error_msg[256]; - sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1); + SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1); SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg); return $null; %} @@ -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 @@ -1196,6 +1198,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(javainterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface" /* javabody typemaps */ @@ -1215,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 @@ -1229,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 @@ -1248,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::*) %{ @@ -1273,7 +1304,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE) SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE) %typemap(javafinalize) SWIGTYPE %{ - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) protected void finalize() { delete(); } @@ -1367,11 +1398,19 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE) %pragma(java) jniclassclassmodifiers="public class" %pragma(java) moduleclassmodifiers="public class" +%pragma(java) constantsmodifiers="public interface" -/* Some ANSI C typemaps */ +/* 64-bit architecture specific typemaps */ +#if defined(SWIGWORDSIZE64) +%apply long long { long }; +%apply unsigned long long { unsigned long }; +%apply const long long & { const long & }; +%apply const unsigned long long & { const unsigned long & }; +#endif -%apply unsigned long { size_t }; -%apply const unsigned long & { const size_t & }; +/* size_t maps to Java 64-bit (signed) long type */ +%apply unsigned int { size_t }; +%apply const unsigned int & { const size_t & }; /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } @@ -1385,8 +1424,8 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE) /* String & length */ %typemap(jni) (const char *STRING, size_t LENGTH) "jbyteArray" %typemap(jtype) (const char *STRING, size_t LENGTH) "byte[]" -%typemap(jstype) (const char *STRING, size_t LENGTH) "byte[]" -%typemap(javain) (const char *STRING, size_t LENGTH) "$javainput" +%typemap(jstype) (const char *STRING, size_t LENGTH) "String" +%typemap(javain) (const char *STRING, size_t LENGTH) %{($javainput == null) ? null : $javainput.getBytes()%} %typemap(freearg) (const char *STRING, size_t LENGTH) "" %typemap(in) (const char *STRING, size_t LENGTH) { if ($input) { @@ -1400,7 +1439,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE) %typemap(argout) (const char *STRING, size_t LENGTH) { if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, JNI_ABORT); } -%typemap(directorin, descriptor="[B", noblock=1) (const char *STRING, size_t LENGTH) { +%typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) (const char *STRING, size_t LENGTH) { $input = 0; if ($1) { $input = JCALL1(NewByteArray, jenv, (jsize)$2); @@ -1409,7 +1448,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE) } Swig::LocalRefGuard $1_refguard(jenv, $input); } -%typemap(javadirectorin, descriptor="[B") (const char *STRING, size_t LENGTH) "$jniinput" +%typemap(javadirectorin, descriptor="[B") (const char *STRING, size_t LENGTH) "($jniinput == null) ? null : new String($jniinput)" %apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } /* Enable write-back for non-const version */ %typemap(argout) (char *STRING, size_t LENGTH) { diff --git a/macx64/bin/swig/share/swig/4.0.0/java/javahead.swg b/macx64/bin/swig/share/swig/4.3.0/java/javahead.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/java/javahead.swg rename to macx64/bin/swig/share/swig/4.3.0/java/javahead.swg index 685bba19..758a037d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/javahead.swg +++ b/macx64/bin/swig/share/swig/4.3.0/java/javahead.swg @@ -5,7 +5,7 @@ * ----------------------------------------------------------------------------- */ -/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so +/* JNI function calls require different calling conventions for C and C++. These JCALL macros are used so * that the same typemaps can be used for generating code for both C and C++. The SWIG preprocessor can expand * the macros thereby generating the correct calling convention. It is thus essential that all typemaps that * use the macros are not within %{ %} brackets as they won't be run through the SWIG preprocessor. */ @@ -30,18 +30,6 @@ #endif %insert(runtime) %{ -/* Fix for jlong on some versions of gcc on Windows */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) - typedef long long __int64; -#endif - -/* Fix for jlong on 64-bit x86 Solaris */ -#if defined(__x86_64) -# ifdef _LP64 -# undef _LP64 -# endif -#endif - #include #include #include @@ -50,15 +38,16 @@ %insert(runtime) %{ /* Support for throwing Java exceptions */ typedef enum { - SWIG_JavaOutOfMemoryError = 1, - SWIG_JavaIOException, - SWIG_JavaRuntimeException, + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, SWIG_JavaIndexOutOfBoundsException, SWIG_JavaArithmeticException, SWIG_JavaIllegalArgumentException, SWIG_JavaNullPointerException, SWIG_JavaDirectorPureVirtual, - SWIG_JavaUnknownError + SWIG_JavaUnknownError, + SWIG_JavaIllegalStateException, } SWIG_JavaExceptionCodes; typedef struct { @@ -80,6 +69,7 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" }, { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } }; const SWIG_JavaExceptions_t *except_ptr = java_exceptions; @@ -97,5 +87,5 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC %insert(runtime) %{ /* Contract support */ -#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else +#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } } while (0) %} diff --git a/macx64/bin/swig/share/swig/4.0.0/java/javakw.swg b/macx64/bin/swig/share/swig/4.3.0/java/javakw.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/java/javakw.swg rename to macx64/bin/swig/share/swig/4.3.0/java/javakw.swg index 99cd5477..8a5b76ee 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/javakw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/java/javakw.swg @@ -2,7 +2,7 @@ #define JAVA_JAVAKW_SWG_ /* Warnings for Java keywords */ -#define JAVAKW(x) %keywordwarn("'" `x` "' is a java keyword, renaming to '_"`x`"'",rename="_%s") `x` +#define JAVAKW(x) %keywordwarn("'" `x` "' is a java keyword",rename="_%s") `x` /* from diff --git a/macx64/bin/swig/share/swig/4.3.0/java/std_array.i b/macx64/bin/swig/share/swig/4.3.0/java/std_array.i new file mode 100644 index 00000000..b5012dee --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_array.i @@ -0,0 +1,62 @@ +/* ----------------------------------------------------------------------------- + * std_array.i + * ----------------------------------------------------------------------------- */ + +%include + +%fragment("SWIG_ArraySize", "header", fragment="SWIG_JavaIntFromSize_t") { + SWIGINTERN jint SWIG_ArraySize(size_t size) { + jint sz = SWIG_JavaIntFromSize_t(size); + if (sz == -1) { + throw std::out_of_range("array size is too large to fit into a Java int"); + } + + return sz; + } +} + +%javamethodmodifiers std::array::sizeImpl "private"; + +namespace std { + + template class array { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + array(); + array(const array& other); + + %rename(isEmpty) empty; + bool empty() const; + void fill(const T& u); + %extend { + %fragment("SWIG_ArraySize"); + + jint size() const throw (std::out_of_range) { + return SWIG_ArraySize(self->size()); + } + + const_reference get(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i "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< 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 {}; +} diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_common.i b/macx64/bin/swig/share/swig/4.3.0/java/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/java/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_except.i b/macx64/bin/swig/share/swig/4.3.0/java/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_list.i b/macx64/bin/swig/share/swig/4.3.0/java/std_list.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/java/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_list.i index 1077bd0a..896df30c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_list.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_list.i @@ -168,7 +168,7 @@ namespace std { return **$self; } - iterator advance_unchecked(size_type index) const { + iterator advance_unchecked(int index) const { std::list::iterator ret = *$self; std::advance(ret, index); return ret; diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_map.i b/macx64/bin/swig/share/swig/4.3.0/java/std_map.i similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/java/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_map.i index 6d5ca1aa..5461c204 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_map.i @@ -79,7 +79,7 @@ template > class map { } public $typemap(jboxtype, T) put($typemap(jboxtype, K) key, $typemap(jboxtype, T) value) { - Iterator itr = find(($typemap(jboxtype, K)) key); + Iterator itr = find(key); if (itr.isNot(end())) { $typemap(jboxtype, T) oldValue = itr.getValue(); itr.setValue(value); @@ -156,7 +156,7 @@ template > class map { map(const map& other); struct iterator { - %typemap(javaclassmodifiers) iterator "protected class" + %typemap(javaclassmodifiers) iterator "public class" %extend { std::map< K, T, C >::iterator getNextUnchecked() { std::map< K, T, C >::iterator copy = (*$self); @@ -199,7 +199,11 @@ template > class map { } void putUnchecked(const K& key, const T& value) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, value); +%#else (*self)[key] = value; +%#endif } void removeUnchecked(const std::map< K, T, C >::iterator itr) { @@ -208,17 +212,4 @@ template > class map { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/java/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_set.i b/macx64/bin/swig/share/swig/4.3.0/java/std_set.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/java/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_set.i index 04658f76..6752d475 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_set.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_set.i @@ -57,6 +57,10 @@ class set { return sizeImpl(); } + public boolean add($typemap(jboxtype, T) key) { + return addImpl(key); + } + public boolean addAll(java.util.Collection collection) { boolean didAddElement = false; for (java.lang.Object object : collection) { @@ -92,6 +96,10 @@ class set { public boolean hasNext() { return curr.isNot(end); } + + public void remove() { + throw new java.lang.UnsupportedOperationException(); + } }.init(); } @@ -134,7 +142,7 @@ class set { public: struct iterator { - %typemap(javaclassmodifiers) iterator "protected class" + %typemap(javaclassmodifiers) iterator "public class" %extend { void incrementUnchecked() { ++(*$self); @@ -172,7 +180,7 @@ class set { %fragment("SWIG_SetSize"); // Returns whether item was inserted. - bool add(const T& key) { + bool addImpl(const T& key) { return self->insert(key).second; } diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/java/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_string.i b/macx64/bin/swig/share/swig/4.3.0/java/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/java/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/java/std_string_view.i new file mode 100644 index 00000000..c89f7997 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_string_view.i @@ -0,0 +1,138 @@ +/* ----------------------------------------------------------------------------- + * std_string_view.i + * + * Typemaps for std::string_view and const std::string_view& + * These are mapped to a Java String and are passed around by value. + * + * To use non-const std::string_view references use the following %apply. Note + * that they are passed by value. + * %apply const std::string_view & {std::string_view &}; + * ----------------------------------------------------------------------------- */ + +%{ +#include +#include +%} + +namespace std { + +%naturalvar string_view; + +class string_view; + +// string_view +%typemap(jni) string_view "jstring" +%typemap(jtype) string_view "String" +%typemap(jstype) string_view "String" +%typemap(javadirectorin) string_view "$jniinput" +%typemap(javadirectorout) string_view "$javacall" + +%typemap(in) string_view +%{ if(!$input) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return $null; + } + const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0); + if (!$1_pstr) return $null; + $1 = std::string_view($1_pstr); %} + +/* std::string_view requires the string data to remain valid while the + * string_view is in use. */ +%typemap(freearg) string_view +%{ jenv->ReleaseStringUTFChars($input, $1_pstr); %} + +%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) string_view +%{ if(!$input) { + if (!jenv->ExceptionCheck()) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + } + return $null; + } + const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0); + if (!$1_pstr) return $null; + /* possible thread/reentrant code problem */ + static std::string $1_str; + $1_str = $1_pstr; + $result = std::string_view($1_str); + jenv->ReleaseStringUTFChars($input, $1_pstr); %} + +/* std::string_view::data() isn't zero-byte terminated, but NewStringUTF() + * requires a zero byte so it seems we have to make a copy (ick). The + * cleanest way to do that seems to be via a temporary std::string. + */ +%typemap(directorin,descriptor="Ljava/lang/String;") string_view +%{ $input = jenv->NewStringUTF(std::string($1).c_str()); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} + +%typemap(out) string_view +%{ $result = jenv->NewStringUTF(std::string($1).c_str()); %} + +%typemap(javain) string_view "$javainput" + +%typemap(javaout) string_view { + return $jnicall; + } + +%typemap(typecheck) string_view = char *; + +%typemap(throws) string_view +%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, std::string($1).c_str()); + return $null; %} + +// const string_view & +%typemap(jni) const string_view & "jstring" +%typemap(jtype) const string_view & "String" +%typemap(jstype) const string_view & "String" +%typemap(javadirectorin) const string_view & "$jniinput" +%typemap(javadirectorout) const string_view & "$javacall" + +%typemap(in) const string_view & +%{ if(!$input) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return $null; + } + const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0); + if (!$1_pstr) return $null; + $*1_ltype $1_str($1_pstr); + $1 = &$1_str; %} + +/* std::string_view requires the string data to remain valid while the + * string_view is in use. */ +%typemap(freearg) const string_view & +%{ jenv->ReleaseStringUTFChars($input, $1_pstr); %} + +%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string_view & +%{ if(!$input) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return $null; + } + const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0); + if (!$1_pstr) return $null; + /* possible thread/reentrant code problem */ + static std::string $1_str; + $1_str = $1_pstr; + static $*1_ltype $1_strview; + $1_strview = $1_str; + $result = &$1_strview; + jenv->ReleaseStringUTFChars($input, $1_pstr); %} + +%typemap(directorin,descriptor="Ljava/lang/String;") const string_view & +%{ $input = jenv->NewStringUTF(std::string($1).c_str()); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} + +%typemap(out) const string_view & +%{ $result = jenv->NewStringUTF(std::string(*$1).c_str()); %} + +%typemap(javain) const string_view & "$javainput" + +%typemap(javaout) const string_view & { + return $jnicall; + } + +%typemap(typecheck) const string_view & = char *; + +%typemap(throws) const string_view & +%{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, std::string($1).c_str()); + return $null; %} + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/java/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/java/std_unique_ptr.i new file mode 100644 index 00000000..ded7b80b --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_unique_ptr.i @@ -0,0 +1,63 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%define %unique_ptr(TYPE) + +%typemap (jni) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "jlong" +%typemap (jtype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "long" +%typemap (jstype) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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(in) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && +%{ $*1_ltype $1_uptr((TYPE *)$input); + $1 = &$1_uptr; %} +%typemap(in, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & +%{ swig::NoDeleteUniquePtr< TYPE > $1_ndup((TYPE *)$input); +$1 = &$1_ndup.uptr; %} + +%typemap(javain) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "$typemap(jstype, TYPE).swigRelease($javainput)" +%typemap(javain) const std::unique_ptr< TYPE > & "$typemap(jstype, TYPE).getCPtr($javainput)" + +%typemap (out) std::unique_ptr< TYPE > %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1.release(); + $result = lpp; +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + jlong lpp = 0; + *(TYPE **) &lpp = $1->get(); + $result = lpp; +%} + + +%typemap(javaout) std::unique_ptr< TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } +%typemap(javaout) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, false); + } + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && "" + +%template() std::unique_ptr< TYPE >; +%enddef diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_unordered_map.i b/macx64/bin/swig/share/swig/4.3.0/java/std_unordered_map.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/java/std_unordered_map.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_unordered_map.i index 283a9b46..f3fdb34a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_unordered_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_unordered_map.i @@ -156,7 +156,7 @@ template class unordered_map { unordered_map(const unordered_map& other); struct iterator { - %typemap(javaclassmodifiers) iterator "protected class" + %typemap(javaclassmodifiers) iterator "public class" %extend { std::unordered_map< K, T >::iterator getNextUnchecked() { std::unordered_map< K, T >::iterator copy = (*$self); @@ -199,7 +199,11 @@ template class unordered_map { } void putUnchecked(const K& key, const T& value) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, value); +%#else (*self)[key] = value; +%#endif } void removeUnchecked(const std::unordered_map< K, T >::iterator itr) { diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_unordered_set.i b/macx64/bin/swig/share/swig/4.3.0/java/std_unordered_set.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/java/std_unordered_set.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_unordered_set.i index 59726e94..a66fe9a9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_unordered_set.i +++ b/macx64/bin/swig/share/swig/4.3.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(); } @@ -134,7 +138,7 @@ class unordered_set { public: struct iterator { - %typemap(javaclassmodifiers) iterator "protected class" + %typemap(javaclassmodifiers) iterator "public class" %extend { void incrementUnchecked() { ++(*$self); diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/java/std_vector.i similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/java/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_vector.i index 955e20ca..dee48fac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_vector.i @@ -29,6 +29,8 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) { %proxycode %{ public $javaclassname($typemap(jstype, CTYPE)[] initialElements) { this(); + reserve(initialElements.length); + for ($typemap(jstype, CTYPE) element : initialElements) { add(element); } @@ -73,6 +75,14 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) { public int size() { return doSize(); } + + public int capacity() { + return doCapacity(); + } + + public void reserve(int n) { + doReserve(n); + } %} public: @@ -87,8 +97,6 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) { vector(); vector(const vector &other); - size_type capacity() const; - void reserve(size_type n) throw (std::length_error); %rename(isEmpty) empty; bool empty() const; void clear(); @@ -101,6 +109,16 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) { return new std::vector< CTYPE >(static_cast::size_type>(count), value); } + jint doCapacity() throw (std::out_of_range) { + return SWIG_VectorSize(self->capacity()); + } + + void doReserve(jint n) throw (std::length_error, std::out_of_range) { + if (n < 0) + throw std::out_of_range("vector reserve size must be positive"); + self->reserve(n); + } + jint doSize() const throw (std::out_of_range) { return SWIG_VectorSize(self->size()); } @@ -159,6 +177,8 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) { } %enddef +%javamethodmodifiers std::vector::doCapacity "private"; +%javamethodmodifiers std::vector::doReserve "private"; %javamethodmodifiers std::vector::doSize "private"; %javamethodmodifiers std::vector::doAdd "private"; %javamethodmodifiers std::vector::doGet "private"; @@ -181,4 +201,3 @@ namespace std { %define specialize_std_vector(T) #warning "specialize_std_vector - specialization for type T no longer needed" %enddef - diff --git a/macx64/bin/swig/share/swig/4.0.0/java/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/java/std_wstring.i similarity index 88% rename from macx64/bin/swig/share/swig/4.0.0/java/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/java/std_wstring.i index dd0b2f5f..efa9e63b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/std_wstring.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/std_wstring.i @@ -60,7 +60,7 @@ class wstring; %} %typemap(directorin,descriptor="Ljava/lang/String;") wstring %{ - jsize $1_len = $1.length(); + jsize $1_len = (jsize)$1.length(); jchar *$1_conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { $1_conv_buf[i] = (jchar)$1[i]; @@ -71,7 +71,7 @@ class wstring; %} %typemap(out) wstring -%{jsize $1_len = $1.length(); +%{jsize $1_len = (jsize)$1.length(); jchar *conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { conv_buf[i] = (jchar)$1[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" @@ -138,7 +141,7 @@ class wstring; jenv->ReleaseStringChars($input, $1_pstr); %} %typemap(directorin,descriptor="Ljava/lang/String;") const wstring & %{ - jsize $1_len = $1.length(); + jsize $1_len = (jsize)$1.length(); jchar *$1_conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { $1_conv_buf[i] = (jchar)($1)[i]; @@ -149,7 +152,7 @@ class wstring; %} %typemap(out) const wstring & -%{jsize $1_len = $1->length(); +%{jsize $1_len = (jsize)$1->length(); jchar *conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { conv_buf[i] = (jchar)(*$1)[i]; @@ -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/macx64/bin/swig/share/swig/4.0.0/java/stl.i b/macx64/bin/swig/share/swig/4.3.0/java/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/stl.i rename to macx64/bin/swig/share/swig/4.3.0/java/stl.i diff --git a/macx64/bin/swig/share/swig/4.0.0/java/swiginterface.i b/macx64/bin/swig/share/swig/4.3.0/java/swiginterface.i similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/java/swiginterface.i rename to macx64/bin/swig/share/swig/4.3.0/java/swiginterface.i index 33446415..ce21d90c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/swiginterface.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/swiginterface.i @@ -28,7 +28,7 @@ } %typemap(javaout) CTYPE *const& { long cPtr = $jnicall; - return (cPtr == 0) ? null : ($javainterfacename)new $javaclassname(cPtr, $owner); + return (cPtr == 0) ? null : ($*javainterfacename)new $*javaclassname(cPtr, $owner); } %typemap(javadirectorin) CTYPE "($&javainterfacename)new $&javaclassname($jniinput, true)" @@ -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 & @@ -72,3 +72,8 @@ INTERFACE_TYPEMAPS(CTYPE) INTERFACE_TYPEMAPS(CTYPE) %enddef +%define %interface_additional(PROXY, INTERFACE, ADDITIONAL, CTYPE...) +%rename(PROXY) CTYPE; +%feature("interface", name=INTERFACE, additional=ADDITIONAL) CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef diff --git a/macx64/bin/swig/share/swig/4.3.0/java/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/java/swigmove.i new file mode 100644 index 00000000..671b988a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/java/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/java/typemaps.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/java/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/java/typemaps.i index e130c193..658a6b11 100644 --- a/macx64/bin/swig/share/swig/4.0.0/java/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/java/typemaps.i @@ -527,3 +527,23 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray); %typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT; %typemap(argout) unsigned long long &INOUT = unsigned long long &OUTPUT; + +#if defined(SWIGWORDSIZE64) +%apply long long *INPUT { long *INPUT }; +%apply unsigned long long *INPUT { unsigned long *INPUT }; + +%apply long long &INPUT { long &INPUT }; +%apply unsigned long long &INPUT { unsigned long &INPUT }; + +%apply long long *INOUT { long *INOUT }; +%apply unsigned long long *INOUT { unsigned long *INOUT }; + +%apply long long &INOUT { long &INOUT }; +%apply unsigned long long &INOUT { unsigned long &INOUT }; + +%apply long long *OUTPUT { long *OUTPUT }; +%apply unsigned long long *OUTPUT { unsigned long *OUTPUT }; + +%apply long long &OUTPUT { long &OUTPUT }; +%apply unsigned long long &OUTPUT { unsigned long &OUTPUT }; +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/java/various.i b/macx64/bin/swig/share/swig/4.3.0/java/various.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/java/various.i rename to macx64/bin/swig/share/swig/4.3.0/java/various.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/javascriptkw.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/javascriptkw.swg new file mode 100644 index 00000000..e3244a66 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/javascriptkw.swg @@ -0,0 +1,63 @@ +#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_ +#define JAVASCRIPT_JAVASCRIPTKW_SWG_ + +/* Warnings for Javascript keywords: note that we allow the use of keywords for members, as they're used as property names in JS and properties don't conflict with keywords. */ +#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",%$not %$ismember,rename="_%s") `x` + +/* Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords */ +/* This the union of all currently reserved keywords in ECMAScript 4 to 6 in both sloppy and strict mode */ + +JAVASCRIPTKW(arguments); +JAVASCRIPTKW(await); +JAVASCRIPTKW(break); +JAVASCRIPTKW(case); +JAVASCRIPTKW(catch); +JAVASCRIPTKW(class); +JAVASCRIPTKW(const); +JAVASCRIPTKW(continue); +JAVASCRIPTKW(debugger); +JAVASCRIPTKW(default); +JAVASCRIPTKW(delete); +JAVASCRIPTKW(do); +JAVASCRIPTKW(else); +JAVASCRIPTKW(enum); +JAVASCRIPTKW(eval); +JAVASCRIPTKW(export); +JAVASCRIPTKW(extends); +JAVASCRIPTKW(false); +JAVASCRIPTKW(finally); +JAVASCRIPTKW(for); +JAVASCRIPTKW(function); +JAVASCRIPTKW(if); +JAVASCRIPTKW(implements); +JAVASCRIPTKW(import); +JAVASCRIPTKW(in); +JAVASCRIPTKW(instanceof); +JAVASCRIPTKW(interface); +JAVASCRIPTKW(let); +JAVASCRIPTKW(new); +JAVASCRIPTKW(null); +JAVASCRIPTKW(package); +JAVASCRIPTKW(private); +JAVASCRIPTKW(protected); +JAVASCRIPTKW(public); +JAVASCRIPTKW(return); +JAVASCRIPTKW(static); +JAVASCRIPTKW(super); +JAVASCRIPTKW(switch); +JAVASCRIPTKW(this); +JAVASCRIPTKW(throw); +JAVASCRIPTKW(try); +JAVASCRIPTKW(typeof); +JAVASCRIPTKW(var); +JAVASCRIPTKW(void); +JAVASCRIPTKW(while); +JAVASCRIPTKW(with); +JAVASCRIPTKW(yield); + +/* others bad names if any*/ +// for example %namewarn("321:clone() is a javascript bad method name") *::clone(); + +#undef JAVASCRIPTKW + +#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_ diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/argcargv.i new file mode 100644 index 00000000..dacecb08 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/argcargv.i @@ -0,0 +1,67 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%{ +SWIGINTERN int SWIG_AsVal_string SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, JSStringRef* str) +{ + if (!JSValueIsString SWIG_JSC_FROM_CALL_ARGS(obj)) { + return SWIG_TypeError; + } + if(str != SWIG_NULLPTR) { + *str = JSValueToStringCopy SWIG_JSC_AS_CALL_ARGS(obj, SWIG_NULLPTR); + } + return SWIG_OK; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + int i, len; + size_t arraysize; + JSObjectRef array; + if (!JSValueIsArray SWIG_JSC_FROM_CALL_ARGS($input)) { + SWIG_exception_fail(SWIG_ERROR, "not array"); + } + array = JSValueToObject SWIG_JSC_AS_CALL_ARGS($input, SWIG_NULLPTR); + len = SWIGJSC_ArrayLength SWIG_JSC_FROM_CALL_ARGS(array); + arraysize = (len+1)*sizeof($*2_ltype); + $1 = len; + $2 = ($2_ltype) malloc(arraysize); + if ($2 == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed"); + } + memset($2, 0, arraysize); + for (i = 0; i < len; i++) { + int res, slen; + $*2_ltype pstr; + JSStringRef str; + JSValueRef jsvalue = JSObjectGetPropertyAtIndex(context, array, i, SWIG_NULLPTR); + res = SWIG_AsVal_string SWIG_JSC_AS_CALL_ARGS(jsvalue, &str); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ERROR, "failed to convert to string"); + } + slen = JSStringGetMaximumUTF8CStringSize(str); + pstr = ($*2_ltype) malloc(slen); + if (pstr == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed"); + } + if (slen) { + res = JSStringGetUTF8CString(str, pstr, slen); + if (res > slen) { + SWIG_exception_fail(SWIG_ERROR, "wrong string length"); + } + } + $2[i] = pstr; + } + $2[i] = SWIG_NULLPTR; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != SWIG_NULLPTR) { + $1_ltype i; + for (i = 0; i < $1; i++) { + free((void *)$2[i]); + } + free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/arrays_javascript.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/arrays_javascript.i new file mode 100644 index 00000000..713b7ef2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/arrays_javascript.i @@ -0,0 +1,94 @@ +/* ----------------------------------------------------------------------------- + * arrays_javascript.i + * + * These typemaps give more natural support for arrays. The typemaps are not efficient + * as there is a lot of copying of the array values whenever the array is passed to C/C++ + * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. + * An exception is thrown if they are not. + * + * Example usage: + * Wrapping: + * + * %include + * %inline %{ + * extern int FiddleSticks[3]; + * %} + * + * Use from JavaScript like this: + * + * var fs = [10, 11, 12]; + * example.FiddleSticks = fs; + * fs = example.FiddleSticks; + * ----------------------------------------------------------------------------- */ + + +%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} +%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} +%fragment("SWIG_JSCOutInt", "header", fragment=SWIG_From_frag(int)) {} +%fragment("SWIG_JSCOutNumber", "header", fragment=SWIG_From_frag(double)) {} + +%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH) + +%typemap(in, fragment=NAME) CTYPE[ANY] { + if (JSValueIsObject(context, $input)) + { + int i; + // Convert into Array + JSObjectRef array = JSValueToObject(context, $input, NULL); + + int length = ANYLENGTH; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (i = 0; i < length; i++) + { + JSValueRef jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL); + $*1_ltype temp; + + // Get primitive value from JSObject + int res = SWIG_AsVal(CTYPE)(jsvalue, &temp); + if (!SWIG_IsOK(res)) + { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + } + else + { + SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); + } +} + +%typemap(freearg) CTYPE[ANY] { + free($1); +} + +%enddef + +%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE) + +%typemap(out, fragment=NAME) CTYPE[ANY] { + int length = $1_dim0; + JSValueRef values[length]; + int i; + + for (i = 0; i < length; i++) + { + values[i] = SWIG_From(CTYPE)($1[i]); + } + + $result = JSObjectMakeArray(context, length, values, NULL); +} + +%enddef + +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, , SWIGJSC_ArrayLength(context, array)) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, ANY, $1_dim0) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, , SWIGJSC_ArrayLength(context, array)) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, ANY, $1_dim0) + +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int) +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double) + diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/ccomplex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/ccomplex.i similarity index 51% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/ccomplex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/ccomplex.i index 50f0f95f..e58dbf71 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/ccomplex.i +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/ccomplex.i @@ -12,15 +12,16 @@ #include %} +#define complex _Complex /* C complex constructor */ #define CCplxConst(r, i) ((r) + I*(i)) -%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); +%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag); /* declaring the typemaps */ -%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/complex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/exception.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/exception.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/factory.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/factory.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/factory.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascript.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascript.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascript.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascript.swg index 3a83b649..3d8f7bac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascript.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascript.swg @@ -12,7 +12,7 @@ %include -%include +%include %include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcode.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcode.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcode.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcode.swg index 4050a6ee..e560200a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcode.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcode.swg @@ -4,6 +4,7 @@ * - $jslocals: locals part of wrapper * - $jscode: code part of wrapper * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments * - $jsmangledtype: mangled type of class * ----------------------------------------------------------------------------- */ %fragment ("js_ctor", "templates") @@ -11,7 +12,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) { $jslocals - if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); @@ -67,6 +68,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject, * - $jslocals: locals part of wrapper * - $jscode: code part of wrapper * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments * - $jsmangledtype: mangled type of class * ----------------------------------------------------------------------------- */ %fragment ("js_overloaded_ctor", "templates") @@ -86,13 +88,14 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size /* ----------------------------------------------------------------------------- * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor. * - $jsargcount: number of arguments of called ctor + * - $jsargrequired: required number of arguments * - $jswrapper: wrapper of called ctor * * Note: a try-catch-like mechanism is used to switch cases * ----------------------------------------------------------------------------- */ %fragment ("js_ctor_dispatch_case", "templates") %{ - if(argc == $jsargcount) { + if(argc >= $jsargrequired && argc <= $jsargcount) { thisObject = $jswrapper(context, NULL, argc, argv, exception); if(thisObject != NULL) { *exception=0; return thisObject; } /* reset exception and return */ } @@ -187,9 +190,11 @@ static bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef /* ----------------------------------------------------------------------------- * js_function: template for function wrappers - * - $jswrapper: wrapper function name - * - $jslocals: locals part of wrapper - * - $jscode: code part of wrapper + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments + * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function", "templates") %{ @@ -198,7 +203,7 @@ static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjec $jslocals JSValueRef jsresult; - if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode return jsresult; @@ -236,9 +241,11 @@ static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjec /* ----------------------------------------------------------------------------- * js_overloaded_function: template for a overloaded function - * - $jswrapper: wrapper function name - * - $jslocals: locals part of wrapper - * - $jscode: code part of wrapper + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jsargcount: required number of arguments + * - $jsargrequired: required number of arguments + * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_overloaded_function", "templates") %{ @@ -247,7 +254,7 @@ static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th $jslocals JSValueRef jsresult; - if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if (argc < $jsargrequired || argc > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode *p_result = jsresult; @@ -261,18 +268,26 @@ static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th /* ----------------------------------------------------------------------------- * js_function_dispatch_case: template for a case used in the function dispatcher - * - $jswrapper: wrapper function name - * - $jsargcount: number of arguments of overloaded function - * - $jscode: code part of wrapper + * - $jswrapper: wrapper function name + * - $jsargcount: number of arguments of overloaded function + * - $jsargrequired: required number of arguments + * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function_dispatch_case", "templates") %{ - if(argc == $jsargcount) { + if(argc >= $jsargrequired && argc <= $jsargcount) { res = $jswrapper(context, function, thisObject, argc, argv, exception, &jsresult); if(res == SWIG_OK) { *exception = 0; return jsresult; } } %} +/* ----------------------------------------------------------------------------- + * js_check_arg: template for checking if an argument exists + * - $jsarg: number of argument + * ----------------------------------------------------------------------------- */ +%fragment ("js_check_arg", "templates") +%{if(argc > $jsarg)%} + /* ----------------------------------------------------------------------------- * jsc_variable_declaration: template for a variable table entry * - $jsname: name of the variable diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcomplex.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcomplex.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcomplex.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcomplex.swg index 7be120b3..93019e7d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptcomplex.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptcomplex.swg @@ -13,7 +13,11 @@ fragment=SWIG_From_frag(double)) { SWIGINTERNINLINE JSObjectRef -SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) +#if defined(__cplusplus) +SWIG_From_dec(Type)(const Type& c) +#else +SWIG_From_dec(Type)(Type c) +#endif { JSValueRef vals[2]; vals[0] = SWIG_From(double)(Real(c)); @@ -127,7 +131,7 @@ SWIG_AsVal_dec(Type)(JSValueRef o, Type *val) float re; int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); if (SWIG_IsOK(res)) { - if (val) *val = Constructor(re, 0.0); + if (val) *val = Constructor(re, 0.0f); return res; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptfragments.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptfragments.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripthelpers.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascripthelpers.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripthelpers.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascripthelpers.swg index 45765433..bdd5142a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripthelpers.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascripthelpers.swg @@ -46,7 +46,7 @@ SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObjec int res; JSStringGetUTF8CString(propertyName, buffer, 256); - res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); + res = SWIG_snprintf(msg, sizeof(msg), "Tried to write read-only variable: %s.", buffer); if(res<0) { SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptinit.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptinit.swg similarity index 54% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptinit.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptinit.swg index a32ba336..b0138b39 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptinit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptinit.swg @@ -1,14 +1,59 @@ %insert(init) %{ SWIGRUNTIME void -SWIG_JSC_SetModule(swig_module_info *swig_module) {} +SWIG_JSC_SetModule(JSGlobalContextRef context, swig_module_info *swig_module) { + JSObjectRef globalObject; + JSStringRef moduleName; + JSClassDefinition classDef; + JSClassRef classRef; + JSObjectRef object; + if(context == 0){ + return; + } + + globalObject = JSContextGetGlobalObject(context); + moduleName = JSStringCreateWithUTF8CString("swig_module_info_data"); + + classDef = kJSClassDefinitionEmpty; + classRef = JSClassCreate(&classDef); + + object = JSObjectMake(context, classRef, NULL); + JSObjectSetPrivate(object, (void*)swig_module); + + JSObjectSetProperty(context, globalObject, moduleName, object, kJSPropertyAttributeNone, NULL); + + JSClassRelease(classRef); + JSStringRelease(moduleName); +} SWIGRUNTIME swig_module_info * -SWIG_JSC_GetModule(void) { - return 0; +SWIG_JSC_GetModule(JSGlobalContextRef context) { + JSObjectRef globalObject; + JSStringRef moduleName; + JSValueRef value; + JSObjectRef object; + + if(context == 0){ + return 0; + } + + globalObject = JSContextGetGlobalObject(context); + moduleName = JSStringCreateWithUTF8CString("swig_module_info_data"); + + if(JSObjectHasProperty(context, globalObject, moduleName) == false) { + JSStringRelease(moduleName); + return 0; + } + + value = JSObjectGetProperty(context, globalObject, moduleName, NULL); + object = JSValueToObject(context, value, NULL); + JSStringRelease(moduleName); + + return (swig_module_info*)JSObjectGetPrivate(object); } -#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule() -#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(pointer) +#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(clientdata, pointer) +#define SWIG_INIT_CLIENT_DATA_TYPE JSGlobalContextRef %} %insert(init) "swiginit.swg" @@ -26,7 +71,7 @@ extern "C" { #endif bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) { - SWIG_InitializeModule(0); + SWIG_InitializeModule(context); %} /* ----------------------------------------------------------------------------- diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptprimtypes.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptprimtypes.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptrun.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptrun.swg similarity index 81% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptrun.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptrun.swg index 4a8fc5be..ee68c577 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptrun.swg +++ b/macx64/bin/swig/share/swig/4.3.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); } @@ -117,28 +121,33 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob SwigPrivData *cdata; cdata = (SwigPrivData *) JSObjectGetPrivate(objRef); - if(cdata == NULL) { + if (cdata == NULL) { return SWIG_ERROR; } - if(cdata->info != info) { - bool type_valid = false; - swig_cast_info *t = info->cast; - while(t != NULL) { - if(t->type == cdata->info) { - type_valid = true; - break; - } - t = t->next; - } - if(!type_valid) { - return SWIG_TypeError; + assert(ptr); + *ptr = NULL; + if (!info || cdata->info == info) { + *ptr = cdata->swigCObject; + } else { + swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, cdata->swigCObject, &newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; } } - *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; @@ -264,11 +273,12 @@ int SWIG_JSC_ConvertPacked(JSContextRef context, JSValueRef valRef, void *ptr, s SWIGRUNTIME JSValueRef SWIG_JSC_NewPackedObj(JSContextRef context, void *data, size_t size, swig_type_info *type) { - JSClassRef classRef = _SwigObject_classRef; + JSClassRef classRef = _SwigPackedData_classRef; JSObjectRef result = JSObjectMake(context, classRef, NULL); SwigPackedData* cdata = (SwigPackedData*) malloc(sizeof(SwigPackedData)); - cdata->data = data; + cdata->data = malloc(size); + memcpy(cdata->data, data, size); cdata->size = size; cdata->type = type; @@ -317,6 +327,30 @@ unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) { } } +SWIGRUNTIME +bool SWIGJSC_ValueIsArray(JSContextRef context, JSValueRef value) { + if (JSValueIsObject(context, value)) { + static JSStringRef ArrayString = NULL; + static JSStringRef isArrayString = NULL; + JSObjectRef array = NULL; + JSObjectRef isArray = NULL; + JSValueRef retval = NULL; + + if (!ArrayString) + ArrayString = JSStringCreateWithUTF8CString("Array"); + if (!isArrayString) + isArrayString = JSStringCreateWithUTF8CString("isArray"); + + array = (JSObjectRef)JSObjectGetProperty(context, JSContextGetGlobalObject(context), ArrayString, NULL); + isArray = (JSObjectRef)JSObjectGetProperty(context, array, isArrayString, NULL); + retval = JSObjectCallAsFunction(context, isArray, NULL, 1, &value, NULL); + + if (JSValueIsBoolean(context, retval)) + return JSValueToBoolean(context, retval); + } + return false; +} + SWIGRUNTIME JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueRef obj) { JSObjectRef arr; @@ -324,6 +358,8 @@ JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueR if (JSValueIsUndefined(context, value)) { arr = JSObjectMakeArray(context, 0, 0, 0); + } else if (!SWIGJSC_ValueIsArray(context, value)) { + arr = JSObjectMakeArray(context, 1, &value, 0); } else { arr = JSValueToObject(context, value, 0); } diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptruntime.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptruntime.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptruntime.swg index 8f839089..a626390c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptruntime.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptruntime.swg @@ -11,6 +11,7 @@ #include #include #include +#include %} %insert(runtime) "swigrun.swg"; /* SWIG API */ diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptstrings.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptstrings.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptstrings.swg index 55c8e4b9..e17b0662 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascriptstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascriptstrings.swg @@ -16,6 +16,9 @@ SWIG_JSC_AsCharPtrAndSize(JSContextRef context, JSValueRef valRef, char** cptr, if(psize) *psize = len; if(cptr) *cptr = cstr; + return SWIG_OK; + } else if (JSValueIsNull(context, valRef)) { + if (cptr) *cptr = 0; return SWIG_OK; } else { if(JSValueIsObject(context, valRef)) { @@ -75,6 +78,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 +170,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripttypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascripttypemaps.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripttypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/javascripttypemaps.swg index e8fbbeca..fd8e7aa2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascripttypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_common.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_except.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_map.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_map.i similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_map.i index 3f197baa..a679f449 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_map.i @@ -19,6 +19,7 @@ // exported class namespace std { + template > class map { // add typemaps here public: @@ -32,6 +33,7 @@ namespace std { typedef value_type& reference; typedef const value_type& const_reference; + map(); map(const map& other); @@ -47,7 +49,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); @@ -63,17 +69,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_string.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/stl.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/stl.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/typemaps.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/jsc/typemaps.i index d3d8afb1..08b58386 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/jsc/typemaps.i @@ -18,7 +18,7 @@ you would use a real value instead. int *INPUT short *INPUT long *INPUT - long long *INPUT + long long *INPUT unsigned int *INPUT unsigned short *INPUT unsigned long *INPUT @@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple. For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and -returns the integer part in one of its parameters).K: +returns the integer part in one of its parameters) : double modf(double x, double *ip); @@ -139,10 +139,6 @@ to a Python variable you might do this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ %include diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/argcargv.i new file mode 100644 index 00000000..4a146047 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/argcargv.i @@ -0,0 +1,66 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%{ +SWIGINTERN int SWIG_AsVal_string (Napi::Value valRef, Napi::String *str) +{ + if (!valRef.IsString()) { + return SWIG_TypeError; + } + if(str != SWIG_NULLPTR) { + *str = valRef.ToString(); + } + return SWIG_OK; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i, len; + size_t arraysize; + Napi::Array array; + if (!$input.IsArray()) { + SWIG_exception_fail(SWIG_ERROR, "not array"); + } + array = $input.As(); + len = array.Length(); + arraysize = (len+1)*sizeof($*2_ltype); + $1 = len; + $2 = ($2_ltype) malloc(arraysize); + if ($2 == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed"); + } + memset($2, 0, arraysize); + for (i = 0; i < len; i++) { + int res, slen; + $*2_ltype pstr; + Napi::String napi_str; + Napi::Value jsvalue = array.Get(i); + res = SWIG_AsVal_string(jsvalue, &napi_str); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ERROR, "failed to convert to string"); + } + std::string str = napi_str.Utf8Value(); + slen = str.size(); + pstr = ($*2_ltype) malloc(slen + 1); + if (pstr == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed"); + } + if (slen) { + memcpy(pstr, str.c_str(), slen); + } + pstr[slen] = 0; + $2[i] = pstr; + } + $2[i] = SWIG_NULLPTR; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != SWIG_NULLPTR) { + $1_ltype i; + for (i = 0; i < $1; i++) { + free((void *)$2[i]); + } + free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/arrays_javascript.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/arrays_javascript.i new file mode 100644 index 00000000..c0209781 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/arrays_javascript.i @@ -0,0 +1,88 @@ +/* ----------------------------------------------------------------------------- + * arrays_javascript.i + * + * These typemaps give more natural support for arrays. The typemaps are not efficient + * as there is a lot of copying of the array values whenever the array is passed to C/C++ + * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. + * An exception is thrown if they are not. + * + * Example usage: + * Wrapping: + * + * %include + * %inline %{ + * extern int FiddleSticks[3]; + * %} + * + * Use from JavaScript like this: + * + * var fs = [10, 11, 12]; + * example.FiddleSticks = fs; + * fs = example.FiddleSticks; + * ----------------------------------------------------------------------------- */ + + +%fragment("SWIG_NAPI_GetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} +%fragment("SWIG_NAPI_GetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} +%fragment("SWIG_NAPI_OutInt", "header", fragment=SWIG_From_frag(int)) {} +%fragment("SWIG_NAPI_OutNumber", "header", fragment=SWIG_From_frag(double)) {} + +%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH) + +%typemap(in, fragment=NAME) CTYPE[ANY] { + if ($input.IsArray()) { + Napi::Env env = $input.Env(); + // Convert into Array + Napi::Array array = $input.As(); + + int length = ANYLENGTH; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (int i = 0; i < length; i++) { + Napi::Value jsvalue = array.Get(i); + $*1_ltype temp; + + // Get primitive value from JSObject + int res = SWIG_AsVal(CTYPE)(jsvalue, &temp); + if (!SWIG_IsOK(res)) { + SWIG_Error(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + } else { + Napi::Env env = $input.Env(); + SWIG_Error(SWIG_ERROR, "$input is not an array"); + } +} + +%typemap(freearg) CTYPE[ANY] { + free($1); +} + +%enddef + +%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE) + +%typemap(out, fragment=NAME) CTYPE[ANY] { + int length = $1_dim0; + Napi::Array array = Napi::Array::New(env, length); + + for (int i = 0; i < length; i++) { + array.Set(i, SWIG_From(CTYPE)($1[i])); + } + + $result = array; +} + +%enddef + +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetIntProperty", int, , array.Length()) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetIntProperty", int, ANY, $1_dim0) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetNumberProperty", double, , array.Length()) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_NAPI_GetNumberProperty", double, ANY, $1_dim0) + +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_NAPI_OutInt", int) +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_NAPI_OutNumber", double) + diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/ccomplex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/ccomplex.i new file mode 100644 index 00000000..e58dbf71 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/ccomplex.i @@ -0,0 +1,27 @@ +/* ----------------------------------------------------------------------------- + * ccomplex.i + * + * C complex typemaps + * ISO C99: 7.3 Complex arithmetic + * ----------------------------------------------------------------------------- */ + + +%include + +%{ +#include +%} + +#define complex _Complex + +/* C complex constructor */ +#define CCplxConst(r, i) ((r) + I*(i)) + +%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag); + +/* declaring the typemaps */ +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/complex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/exception.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/exception.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/factory.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/factory.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/factory.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascript.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascript.swg new file mode 100644 index 00000000..8924d9e1 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascript.swg @@ -0,0 +1,17 @@ +/* ----------------------------------------------------------------------------- + * javascript.swg + * + * Javascript typemaps + * ----------------------------------------------------------------------------- */ + +%include + +%include + +%include + +%include + +%include + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcode.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcode.swg new file mode 100644 index 00000000..26e8aded --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcode.swg @@ -0,0 +1,880 @@ +/* ----------------------------------------------------------------------------- + * js_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none) + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsargrequired: minimum number of arguments + * - $jsmangledname: mangled name of class + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ + +%fragment("js_ctor", "templates") %{ +template +// js_ctor +// This is the main constructor +$jsmangledname_templ::$jsmangledname_templ(const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) { + Napi::Env env = info.Env(); + + this->info = SWIGTYPE_$jsmangledtype; + if (info.Length() == 1 && info[0].IsExternal()) { + // This constructor has been called internally from C++/SWIG + // to wrap an already existing C++ object in JS + this->self = info[0].As>().Data(); + this->owned = false; + return; + } + this->owned = true; + + $jslocals + if(static_cast(info.Length()) < $jsargrequired || static_cast(info.Length()) > $jsargcount) { + SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + } + $jscode + this->self = result; + return; + goto fail; +fail: + return; +} + +// This is the bypass constructor to be used from child classes +template +$jsmangledname_templ::$jsmangledname_templ(bool, const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) {} +%} + + +/* ----------------------------------------------------------------------------- + * js_veto_ctor: a vetoing ctor for abstract classes + * - $jsmangledname: mangled name of class + * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none) + * ----------------------------------------------------------------------------- */ +%fragment ("js_veto_ctor", "templates") +%{ +// js_veto_ctor +template +$jsmangledname_templ::$jsmangledname_templ(const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) { + Napi::Env env = info.Env(); + if (info.Length() == 1 && info[0].IsExternal()) { + // This constructor has been called internally from C++/SWIG + // to wrap an already existing C++ object in JS as its + // base abstract class + this->self = info[0].As>().Data(); + this->owned = false; + return; + } + SWIG_Error(SWIG_ERROR, "Class $jsname can not be instantiated"); + return; + goto fail; +fail: + return; +} + +// This is the extendable constructor to be used from child classes +template +$jsmangledname_templ::$jsmangledname_templ(bool, const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) { +} +%} + + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatcher: dispatcher for overloaded constructors + * - $jsmangledname: mangled name of class + * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none) + * - $jsdispatchcases: part containing code for dispatching + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatcher", "templates") +%{ +// js_ctor_dispatcher +template +$jsmangledname_templ::$jsmangledname_templ(const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) { + Napi::Env env = info.Env(); + Napi::Object self; + NAPI_CHECK_RESULT(info.This().ToObject(), self); + this->info = SWIGTYPE_$jsmangledtype; + if (info.Length() == 1 && info[0].IsExternal()) { + // This constructor has been called internally from C++/SWIG + // to wrap an already existing C++ object in JS + this->self = info[0].As>().Data(); + this->owned = false; + return; + } + + // switch all cases by means of series of if-returns. + $jsdispatchcases + + // default: + SWIG_Error(SWIG_ERROR, "Illegal arguments for construction of $jsmangledname"); + + goto fail; +fail: + return; +} + +// This is the extendable constructor to be used from child classes +template +$jsmangledname_templ::$jsmangledname_templ(bool, const Napi::CallbackInfo &info) + : $jsparent_templ(true, info) { +} +%} + + +/* ----------------------------------------------------------------------------- + * js_overloaded_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsargrequired: minimum number of arguments + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ +%fragment("js_overloaded_ctor", "templates") %{ +// js_overloaded_ctor +template +Napi::Value $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Object self; + $jslocals + NAPI_CHECK_RESULT(info.This().ToObject(), self); + this->owned = true; + if(static_cast(info.Length()) < $jsargrequired || static_cast(info.Length()) > $jsargcount) { + SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + } + $jscode + this->self = result; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor. + * - $jsargcount: number of arguments of called ctor + * - $jsargrequired: minimum number of arguments + * - $jswrapper: wrapper of called ctor + * + * Note: a try-catch-like mechanism is used to switch cases + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatch_case", "templates") +%{ + // js_ctor_dispatch_case + if(static_cast(info.Length()) >= $jsargrequired && static_cast(info.Length()) <= $jsargcount) { +#ifdef NAPI_CPP_EXCEPTIONS + bool tryNext = false; + try { + $jswrapper(info); + } catch (const Napi::TypeError &) { + tryNext = true; + } catch (const Napi::Error &e) { + throw e; + } + if (!tryNext) + return; +#else + $jswrapper(info); + if (env.IsExceptionPending()) { + Napi::Error e = env.GetAndClearPendingException(); + Napi::Value typeErrorValue; + bool isTypeError; + Napi::Function typeErrorCons; + // Yes, this is ugly + // TODO: Fix this in Node.js when the core team grows up + NAPI_CHECK_RESULT(env.Global().Get("TypeError"), typeErrorValue); + typeErrorCons = typeErrorValue.As(); + NAPI_CHECK_RESULT(e.Value().InstanceOf(typeErrorCons), isTypeError); + if (!isTypeError) { + // This is not the error you are looking for + e.ThrowAsJavaScriptException(); + SWIG_fail; + } + } else { + return; + } +#endif + } +%} + + +/* ----------------------------------------------------------------------------- + * js_check_arg: template for checking if an argument exists + * - $jsarg: number of argument + * ----------------------------------------------------------------------------- */ +%fragment ("js_check_arg", "templates") +%{if(info.Length() > $jsarg)%} + + +/* ----------------------------------------------------------------------------- + * js_dtor: template for a destructor wrapper + * - $jsmangledname: mangled class name + * - $jstype: class type + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtor", "templates") +%{ +// js_dtor +template +$jsmangledname_templ::~$jsmangledname_templ() { +} +%} + + +/* ----------------------------------------------------------------------------- + * js_dtoroverride: template for a destructor wrapper + * - ${classname_mangled}: mangled class name + * - $jstype: class type + * - ${destructor_action}: The custom destructor action to invoke. + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtoroverride", "templates") +%{ +// js_dtoroverride +template +${classname_mangled}_templ::~${classname_mangled}_templ() { + auto arg1 = reinterpret_cast<$jstype>(this->self); + if (this->owned && arg1) { + ${destructor_action} + this->self = nullptr; + } +} +%} + +/* ----------------------------------------------------------------------------- + * js_global_getter: template for global getter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_global_getter", "templates") +%{ +// js_global_getter +Napi::Value $jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_global_setter: template for global setter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_global_setter", "templates") +%{ +// js_global_setter +void $jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value value = info.Length() > 0 ? info[0] : Napi::Value(); + Napi::Value jsresult; + $jslocals + $jscode + return; + + goto fail; +fail: + return; +} +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_register_global_variable: template for a statement that registers a global variable + * - $jsname: variable name + * - $jsparent: parent namespace + * - $jsgetter: wrapper of the getter function + * - $jssetter: wrapper of the setter function + * + * Note: this template is also used for global variables. + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_global_variable", "templates") +%{ + // jsnapi_register_global_variable + do { + Napi::PropertyDescriptor pd = Napi::PropertyDescriptor::Accessor<$jsgetter, $jssetter>("$jsname"); + NAPI_CHECK_MAYBE($jsparent.DefineProperties({pd})); + } while (0); +%} + + +/* ----------------------------------------------------------------------------- + * js_global_function: template for function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jsargcount: number of arguments + * - $jsargrequired: minimum number of arguments + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_global_function", "templates") +%{ +// js_global_function +Napi::Value $jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + if(static_cast(info.Length()) < $jsargrequired || static_cast(info.Length()) > $jsargcount) { + SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + } + + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_global_function_dispatcher: template for a global function dispatcher for + * global overloaded functions + * - $jswrapper: wrapper function name + * - $jsname: name of the wrapped function + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_global_function_dispatcher", "templates") +%{ +// js_global_function_dispatcher +Napi::Value $jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jscode + + SWIG_Error(SWIG_ERROR, "Illegal arguments for function $jsname."); + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_register_global_function: template for a statement that registers a global function + * - $jsname: function name + * - $jsparent: parent namespace + * - $jswrapper: name of the JS wrapper + * + * Note: this template is also used for global variables. + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_global_function", "templates") +%{ + // jsnapi_register_global_function + do { + Napi::PropertyDescriptor pd = Napi::PropertyDescriptor::Function("$jsname", $jswrapper); + NAPI_CHECK_MAYBE($jsparent.DefineProperties({pd})); + } while (0); +%} + + +/* ----------------------------------------------------------------------------- + * js_getter: template for getter function wrappers + * - $jsmangledname: mangled class name + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_getter", "templates") +%{ +// js_getter +template +Napi::Value $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_setter: template for setter function wrappers + * - $jsmangledname: mangled class name + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_setter", "templates") +%{ +// js_setter +template +void $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info, const Napi::Value &value) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + $jscode + return; + + goto fail; +fail: + return; +} +%} + + +/* ----------------------------------------------------------------------------- + * js_function: template for function wrappers + * - $jsmangledname: mangled class name + * - $jswrapper: wrapper function name + * - $jsargcount: minimum number of arguments + * - $jsargrequired: minimum number of arguments + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_function", "templates") +%{ +// js_function +template +Napi::Value $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + if(static_cast(info.Length()) < $jsargrequired || static_cast(info.Length()) > $jsargcount) { + SWIG_Error(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + } + + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_function_dispatcher: template for a function dispatcher for overloaded functions + * - $jsmangledname: mangled class name + * - $jswrapper: wrapper function name + * - $jsname: name of the wrapped function + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_function_dispatcher", "templates") +%{ +// js_function_dispatcher +template +Napi::Value $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jscode + + SWIG_Error(SWIG_ERROR, "Illegal arguments for function $jsname."); + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_overloaded_function: template for a overloaded function + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_overloaded_function", "templates") +%{ +// js_overloaded_function +template +Napi::Value $jsmangledname_templ::$jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_global_overloaded_function: template for a global overloaded function + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_global_overloaded_function", "templates") +%{ +// js_global_overloaded_function +Napi::Value $jswrapper(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + $jslocals + $jscode + return jsresult; + + goto fail; +fail: + return Napi::Value(); +} +%} + + +/* ----------------------------------------------------------------------------- + * js_function_dispatch_case: template for a case used in the function dispatcher + * - $jswrapper: wrapper function name + * - $jsargcount: number of arguments of overloaded function + * - $jsargrequired: minimum number of arguments + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_function_dispatch_case", "templates") +%{ + // js_function_dispatch_case + if(static_cast(info.Length()) >= $jsargrequired && static_cast(info.Length()) <= $jsargcount) { +#ifdef NAPI_CPP_EXCEPTIONS + bool tryNext = false; + try { + jsresult = $jswrapper(info); + } catch (const Napi::TypeError &) { + tryNext = true; + } catch (const Napi::Error &e) { + throw e; + } + if (!tryNext) + return jsresult; +#else + $jswrapper(info); + if (env.IsExceptionPending()) { + Napi::Error e = env.GetAndClearPendingException(); + Napi::Value typeErrorValue; + bool isTypeError; + Napi::Function typeErrorCons; + // Yes, this is ugly + // TODO: Fix this in Node.js when the core team grows up + NAPI_CHECK_RESULT(env.Global().Get("TypeError"), typeErrorValue); + typeErrorCons = typeErrorValue.As(); + NAPI_CHECK_RESULT(e.Value().InstanceOf(typeErrorCons), isTypeError); + if (!isTypeError) { + // This is not the error you are looking for + e.ThrowAsJavaScriptException(); + SWIG_fail; + } + } else { + return jsresult; + } +#endif + } +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_class_prologue_template: template for a class prologue + * - $jsmangledname: mangled class name + * - $jsparent: mangled name of parent (or SWIG_NAPI_ObjectWrap if none) + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_class_prologue_template", "templates") +%{ + // jsnapi_class_prologue_template + template + class $jsmangledname_templ : public $jsparent_templ { + public: + $jsmangledname_templ(const Napi::CallbackInfo &); + $jsmangledname_templ(bool, const Napi::CallbackInfo &); +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_class_dtor_declaration: template for a class destructor declaration + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_class_dtor_declaration", "templates") +%{ + virtual ~$jsmangledname_templ(); +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_class_method_declaration: template for a class method declaration + * - $jsmangledname: mangled class name + * - $jswrapper: method name + * - $jsstatic: static modifier + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_class_method_declaration", "templates") +%{ + // jsnapi_class_method_declaration + $jsstatic Napi::Value $jswrapper(const Napi::CallbackInfo &); +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_class_setter_declaration: template for a class method declaration + * - $jsmangledname: mangled class name + * - $jswrapper: method name + * - $jsstatic: static modifier + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_class_setter_declaration", "templates") +%{ + // jsnapi_class_setter_declaration + $jsstatic void $jswrapper(const Napi::CallbackInfo &, const Napi::Value &); +%} + + + +/* ----------------------------------------------------------------------------- + * jsnapi_class_epilogue_template: template for a class epilogue + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_class_epilogue_template", "templates") +%{ + // jsnapi_class_epilogue_template + static void JS_veto_set_static_variable(const Napi::CallbackInfo &, const Napi::Value &); + void JS_veto_set_variable(const Napi::CallbackInfo &, const Napi::Value &); +}; + +template +void $jsmangledname_templ::JS_veto_set_static_variable(const Napi::CallbackInfo &info, const Napi::Value &value) { + SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable."); +} + +template +void $jsmangledname_templ::JS_veto_set_variable(const Napi::CallbackInfo &info, const Napi::Value &value) { + SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable."); +} +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_class_instance: template for a class declaration instance + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_declare_class_instance", "templates") +%{ + // jsnapi_class_instance + class $jsmangledname_inst : public $jsmangledname_templ<$jsmangledname_inst> { + public: + using $jsmangledname_templ::$jsmangledname_templ; + virtual ~$jsmangledname_inst() {}; + static void GetMembers( + Napi::Env, + std::map &, + std::map & + ); + static Napi::Function GetClass(Napi::Env); + }; +%} + + +/* + * Inheritance is still not officially supported in NAPI + * Refer to this for my workaround: + * https://mmomtchev.medium.com/c-class-inheritance-with-node-api-and-node-addon-api-c180334d9902 + */ + +/* ----------------------------------------------------------------------------- + * jsnapi_inherited_class_prologue_template: template for a class prologue + * - $jsmangledname: mangled class name + * - $jsparent: mangled name of parent class + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_inherited_class_prologue_template", "templates") +%{ + // jsnapi_inherited_class_prologue_template + SWIG_NAPI_ClientData $jsmangledname_clientData; + template + class $jsmangledname_templ : public $jsparent_templ { + public: + $jsmangledname_templ(const Napi::CallbackInfo& info); +%} + + +/* ----------------------------------------------------------------------------- + * jsnapi_getclass: template for creating a class object + * - $jsname: class name + * - $jsmangledname: mangled class name + * - $jsfunctions: member functions + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_getclass", "templates") +%{ + /* Class: $jsname ($jsmangledname) */ + // jsnapi_getclass +Napi::Function $jsmangledname_inst::GetClass(Napi::Env env) { + std::map members, staticMembers; + GetMembers(env, members, staticMembers); + + std::vector<$jsmangledname_inst::PropertyDescriptor> symbolTable; + for (auto it = members.begin(); it != members.end(); it++) + symbolTable.push_back(it->second); + for (auto it = staticMembers.begin(); it != staticMembers.end(); it++) + symbolTable.push_back(it->second); + + return Napi::ObjectWrap<$jsmangledname_inst>::DefineClass(env, "$jsname", symbolTable); +} + +void $jsmangledname_inst::GetMembers( + Napi::Env env, + std::map &members, + std::map &staticMembers +) { + std::map::PropertyDescriptor> baseMembers, baseStaticMembers; + $jsparent_inst::GetMembers(env, baseMembers, baseStaticMembers); + members.insert(baseMembers.begin(), baseMembers.end()); + staticMembers.insert(staticMembers.begin(), staticMembers.end()); + + /* register wrapper functions */ + $jsnapiwrappers + /* add static class functions and variables */ + $jsnapistaticwrappers +} +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_registerclass: template for regsitering a class object + * - $jsname: class name + * - $jsmangledname: mangled class name + * - $jsparent: parent namespace + * - $jsmangledtype: mangled class type + * - $jsclassidx: class index in the class table + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_registerclass", "templates") +%{ + + /* Class: $jsname ($jsmangledname) */ + // jsnapi_registerclass + Napi::Function $jsmangledname_ctor = $jsmangledname_inst::GetClass(env); + $jsparent.Set("$jsname", $jsmangledname_ctor); + if (SWIGTYPE_$jsmangledtype->clientdata == nullptr) { + SWIGTYPE_$jsmangledtype->clientdata = new size_t($jsclassidx); + } + Napi::FunctionReference *$jsmangledname_ctor_ref = new Napi::FunctionReference(); + *$jsmangledname_ctor_ref = Napi::Persistent($jsmangledname_ctor); + env.GetInstanceData()->ctor[$jsclassidx] = $jsmangledname_ctor_ref; +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_setup_inheritance: setup inheritance between two classes + * - $jsname: class name + * - $jsmangledname: mangled class name + * - $jsparent: mangled name of parent class + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_setup_inheritance", "templates") +%{ + // Inheritance for $jsmangledname ($jsname) <- $jsparent + // jsnapi_setup_inheritance + do { + Napi::Value protoBase, protoSub; + NAPI_CHECK_RESULT($jsmangledname_ctor.Get("prototype"), protoSub); + NAPI_CHECK_RESULT($jsparent_ctor.Get("prototype"), protoBase); + NAPI_CHECK_MAYBE(setProto.Call({$jsmangledname_ctor, $jsparent_ctor})); + NAPI_CHECK_MAYBE(setProto.Call({protoSub, protoBase})); + } while (0); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_create_namespace: template for a statement that creates a namespace object. + * - $jsmangledname: mangled namespace name + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_create_namespace", "templates") +%{ + // jsnapi_create_namespace + Napi::Object $jsmangledname = Napi::Object::New(env); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_register_namespace: template for a statement that registers a namespace in a parent namespace. + * - $jsname: name of namespace + * - $jsmangledname: mangled name of namespace + * - $jsparent: mangled name of parent namespace + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_namespace", "templates") +%{ + // jsnapi_register_namespace + NAPI_CHECK_MAYBE($jsparent.Set("$jsname", $jsmangledname)); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_member_function_descriptor: template for a statement that registers a member function. + * - $jsmangledname: mangled class name + * - $jsname: name of the function + * - $jswrapper: wrapper of the member function + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_member_function", "templates") +%{ + // jsnapi_member_function_descriptor + members.erase("$jsname"); + members.insert({"$jsname", + $jsmangledname_templ::InstanceMethod("$jsname", + &$jsmangledname_templ::$jswrapper, + static_cast(napi_writable | napi_configurable)) + }); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_register_member_variable: template for a statement that registers a member variable. + * - $jsname: name of the function + * - $jsmangledname: mangled class name + * - $jsgetter: wrapper of the getter function + * - $jssetter: wrapper of the setter function + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_member_variable", "templates") +%{ + // jsnapi_register_member_variable + members.erase("$jsname"); + members.insert({"$jsname", + $jsmangledname_templ::InstanceAccessor("$jsname", + &$jsmangledname_templ::$jsgetter, + &$jsmangledname_templ::$jssetter, + static_cast(napi_writable | napi_enumerable | napi_configurable)) + }); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_register_static_function: template for a statement that registers a static class function. + * - $jsname: function name + * - $jsmangledname: mangled class name + * - $jswrapper: wrapper of the function + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_static_function", "templates") +%{ + // jsnapi_register_static_function + staticMembers.erase("$jsname"); + staticMembers.insert({"$jsname", + StaticMethod("$jsname", + &$jsmangledname_templ::$jswrapper, + static_cast(napi_writable | napi_configurable)) + }); +%} + +/* ----------------------------------------------------------------------------- + * jsnapi_register_static_variable: template for a statement that registers a static variable. + * - $jsname: variable name + * - $jsmangledname: mangled class name + * - $jsgetter: wrapper of the getter function + * - $jssetter: wrapper of the setter function + * ----------------------------------------------------------------------------- */ +%fragment("jsnapi_register_static_variable", "templates") +%{ + // jsnapi_register_static_variable + staticMembers.erase("$jsname"); + staticMembers.insert({"$jsname", + StaticAccessor("$jsname", + &$jsmangledname_templ::$jsgetter, + &$jsmangledname_templ::$jssetter, + static_cast(napi_writable | napi_enumerable | napi_configurable)) + }); +%} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcomplex.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcomplex.swg new file mode 100644 index 00000000..69cdf7a2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptcomplex.swg @@ -0,0 +1,120 @@ +/* + Defines the As/From converters for double/float complex, you need to + provide complex Type, the Name you want to use in the converters, + the complex Constructor method, and the Real and Imag complex + accessor methods. + + See the std_complex.i and ccomplex.i for concrete examples. +*/ + +/* the common from converter */ +%define %swig_fromcplx_conv(Type, Real, Imag) +%fragment(SWIG_From_frag(Type),"header", + fragment=SWIG_From_frag(double)) +{ +SWIGINTERNINLINE Napi::Value +#if defined(__cplusplus) +SWIG_From_dec(Type)(const Type& c) +#else +SWIG_From_dec(Type)(Type c) +#endif +{ + Napi::Array vals = Napi::Array::New(0); + + vals.Set(0, SWIG_From(double)(Real(c))); + vals.Set(1, SWIG_From(double)(Imag(c))); + return vals; +} +} +%enddef + +/* the double case */ +%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(double)) +{ +SWIGINTERN int +SWIG_AsVal_dec(Type) (Napi::Value o, Type* val) +{ + if (o.IsArray()) { + Napi::Array array = Napi::Array::Cast(o); + + if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + double re, im; + Napi::Value r; + + r = array.Get(0); + if (!r.IsNumber()) { + return SWIG_TypeError; + } + re = r.ToNumber().DoubleValue(); + + r = array.Get(1); + if (!r.IsNumber()) { + return SWIG_TypeError; + } + im = r.ToNumber().DoubleValue(); + + if (val) *val = Constructor(re, im); + return SWIG_OK; + } else if (o.IsNumber()) { + double d = o.ToNumber().DoubleValue(); + if (val) *val = Constructor(d, 0.0); + return SWIG_OK; + } + return SWIG_TypeError; +} +} +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +/* the float case */ +%define %swig_cplxflt_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(float)) { +SWIGINTERN int +SWIG_AsVal_dec(Type) (Napi::Value o, Type* val) +{ + if (o.IsArray()) { + Napi::Array array = o.As(); + + if (array.Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + double re, im; + Napi::Value r; + + r = array.Get(0); + if (!r.IsNumber()) { + return SWIG_TypeError; + } + re = r.ToNumber().DoubleValue(); + + r = array.Get(1); + if (!r.IsNumber()) { + return SWIG_TypeError; + } + im = r.ToNumber().DoubleValue(); + + if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { + if (val) *val = Constructor(%numeric_cast(re, float), + %numeric_cast(im, float)); + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else if (o.IsNumber()) { + float f = static_cast(o.ToNumber().DoubleValue()); + if (val) *val = Constructor(f, 0.0); + return SWIG_OK; + } + return SWIG_TypeError; +} +} +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \ +%swig_cplxflt_conv(Type, Constructor, Real, Imag) + + +#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \ +%swig_cplxdbl_conv(Type, Constructor, Real, Imag) diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptfragments.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptfragments.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptinit.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptinit.swg new file mode 100644 index 00000000..e8b3d38c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptinit.swg @@ -0,0 +1,111 @@ +%insert(header) %{ +#include +%} + +%insert(init) %{ + +EnvInstanceData::EnvInstanceData(Napi::Env env, swig_module_info *swig_module) : +env(env), SWIG_NAPI_ObjectWrapCtor(nullptr), ctor(nullptr), swig_module(swig_module) { + ctor = new Napi::FunctionReference*[swig_module->size + 1]; + for (size_t i = 0; i <= swig_module->size; i++) { + ctor[i] = nullptr; + } +} + +EnvInstanceData::~EnvInstanceData() { + for (size_t i = 0; i <= swig_module->size; i++) { + if (ctor[i] != nullptr) + delete ctor[i]; + ctor[i] = nullptr; + } + delete [] ctor; + delete SWIG_NAPI_ObjectWrapCtor; +} + +SWIGRUNTIME void +SWIG_NAPI_SetModule(Napi::Env env, swig_module_info *swig_module) { + auto data = new EnvInstanceData(env, swig_module); + env.SetInstanceData(data); +} + +SWIGRUNTIME swig_module_info * +SWIG_NAPI_GetModule(Napi::Env env) { + auto data = env.GetInstanceData(); + if (data == nullptr) return nullptr; + return data->swig_module; +} + +#define SWIG_GetModule(clientdata) SWIG_NAPI_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_NAPI_SetModule(clientdata, pointer) +#define SWIG_INIT_CLIENT_DATA_TYPE Napi::Env + +%} + +%insert(init) "swiginit.swg" + +// Open the initializer function definition here + +%fragment ("js_initializer_define", "templates") %{ +#define SWIG_NAPI_INIT $jsname_initialize +%} + +%insert(init) %{ +Napi::Object Init(Napi::Env env, Napi::Object exports) { + SWIG_InitializeModule(env); +%} + +/* ----------------------------------------------------------------------------- + * js_init_inheritance: template for enabling the inheritance + * ----------------------------------------------------------------------------- */ +%fragment("js_init_inheritance", "templates") +%{ + Napi::Value jsObjectValue, jsSetProtoValue; + Napi::Object jsObject; + Napi::Function setProto; + NAPI_CHECK_RESULT(env.Global().Get("Object"), jsObjectValue); + NAPI_CHECK_RESULT(jsObjectValue.ToObject(), jsObject); + NAPI_CHECK_RESULT(jsObject.Get("setPrototypeOf"), jsSetProtoValue); + setProto = jsSetProtoValue.As(); +%} + +/* ----------------------------------------------------------------------------- + * js_initializer: template for the module initializer function + * - $jsname: module name + * - $jsnapipreinheritance: the previous template + * - $jsnapinspaces: part with code creating namespace objects + * - $jsnapiwrappers: part with code that registers wrapper functions + * - $jsnapiinitinheritance: part with inherit statements + * - $jsnapistaticwrappers: part with code adding static functions to class objects + * - $jsnapiregisterclasses: part with code that registers class objects in namespaces + * - $jsnapiregisternspaces: part with code that registers namespaces in parent namespaces + * ----------------------------------------------------------------------------- */ +%fragment("js_initializer", "templates") +%{ + Napi::Function SWIG_NAPI_ObjectWrap_ctor = SWIG_NAPI_ObjectWrap_inst::GetClass(env); + Napi::FunctionReference *SWIG_NAPI_ObjectWrap_ctor_ref = new Napi::FunctionReference(); + *SWIG_NAPI_ObjectWrap_ctor_ref = Napi::Persistent(SWIG_NAPI_ObjectWrap_ctor); + env.GetInstanceData()->SWIG_NAPI_ObjectWrapCtor = SWIG_NAPI_ObjectWrap_ctor_ref; + + /* create objects for namespaces */ + $jsnapinspaces + + /* register classes */ + $jsnapiregisterclasses + + /* enable inheritance */ + $jsnapipreinheritance + + /* setup inheritances */ + $jsnapiinitinheritance + + /* create and register namespace objects */ + $jsnapiregisternspaces + + return exports; + goto fail; +fail: + return Napi::Object(); +} + +NODE_API_MODULE($jsname, Init) +%} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptprimtypes.swg new file mode 100644 index 00000000..e6224f91 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptprimtypes.swg @@ -0,0 +1,387 @@ +/* ------------------------------------------------------------ + * Primitive Types + * ------------------------------------------------------------ */ + +/* boolean */ + +%fragment(SWIG_From_frag(bool),"header", "header") { +SWIGINTERN +Napi::Value SWIG_From_bool(Napi::Env env, bool val) +{ + return Napi::Boolean::New(env, val); +} +} + + +%fragment(SWIG_AsVal_frag(bool),"header", + fragment=SWIG_AsVal_frag(long)) { +SWIGINTERN +int SWIG_AsVal_dec(bool)(Napi::Value obj, bool *val) +{ + if(!obj.IsBoolean()) { + return SWIG_TypeError; + } + + Napi::Boolean b; + NAPI_CHECK_RESULT(obj.ToBoolean(), b); + if (val) *val = b.Value(); + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + +/* char */ + +%fragment(SWIG_From_frag(unsigned char), "header") { +SWIGINTERNINLINE Napi::Value +SWIG_From_unsigned_SS_char(Napi::Env env, unsigned char c) +{ + return Napi::Number::New(env, static_cast(c)); +} +} + + +%fragment(SWIG_From_frag(signed char), "header") { +SWIGINTERNINLINE Napi::Value +SWIG_From_signed_SS_char(Napi::Env env, signed char c) +{ + return Napi::Number::New(env, static_cast(c)); +} +} + +/* int */ + +%fragment(SWIG_From_frag(int), "header") { +SWIGINTERN +Napi::Value SWIG_From_int(Napi::Env env, int val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(int),"header") { +SWIGINTERN +int SWIG_AsVal_dec(int)(Napi::Value valRef, int* val) +{ + if (!valRef.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(valRef.ToNumber(), num); + *val = static_cast(num.Int32Value()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + + +/* unsigned int */ + +%fragment(SWIG_From_frag(unsigned int), "header") { +SWIGINTERN +Napi::Value SWIG_From_unsigned_SS_int(Napi::Env env, unsigned int val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(unsigned int),"header") { +SWIGINTERN +int SWIG_AsVal_dec(unsigned int)(Napi::Value valRef, unsigned int* val) +{ + if (!valRef.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(valRef.ToNumber(), num); + if (num.Int64Value() < 0) { + return SWIG_TypeError; + } + *val = static_cast(num.Uint32Value()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + + +/* short */ + +%fragment("SWIG_Env_FromShort", "header") { +SWIGINTERN +Napi::Value SWIG_From_short(Napi::Env env, short val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(short),"header") { +SWIGINTERN +int SWIG_AsVal_dec(short)(Napi::Value valRef, short* val) +{ + if (!valRef.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(valRef.ToNumber(), num); + *val = static_cast(num.Int32Value()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + + +/* unsigned short */ + +%fragment(SWIG_From_frag(unsigned short), "header") { +SWIGINTERN +Napi::Value SWIG_From_unsigned_SS_short(Napi::Env env, unsigned short val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(unsigned short),"header") { +SWIGINTERN +int SWIG_AsVal_dec(unsigned short)(Napi::Value valRef, unsigned short* val) +{ + if (!valRef.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(valRef.ToNumber(), num); + if (num.Int64Value() < 0) { + return SWIG_TypeError; + } + *val = static_cast(num.Uint32Value()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + + +/* long */ + +%fragment(SWIG_From_frag(long), "header") { +SWIGINTERN +Napi::Value SWIG_From_long(Napi::Env env, long val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN +int SWIG_AsVal_dec(long)(Napi::Value obj, long* val) +{ + if (!obj.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + *val = static_cast(num.Int64Value()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + +/* unsigned long */ + +%fragment(SWIG_From_frag(unsigned long), "header") { +SWIGINTERN +Napi::Value SWIG_From_unsigned_SS_long(Napi::Env env, unsigned long val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(unsigned long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN +int SWIG_AsVal_dec(unsigned long)(Napi::Value obj, unsigned long *val) +{ + if(!obj.IsNumber()) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + if (num.Int64Value() < 0) { + return SWIG_TypeError; + } + *val = static_cast(num.Int64Value()); + } + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + +/* long long */ + +%fragment(SWIG_From_frag(long long), "header", fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +Napi::Value SWIG_From_long_SS_long(Napi::Env env, long long val) +{ + return Napi::Number::New(env, val); +} +%#endif +} + +%fragment(SWIG_AsVal_frag(long long),"header", + fragment=SWIG_AsVal_frag(long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +int SWIG_AsVal_dec(long long)(Napi::Value obj, long long* val) +{ + if(!obj.IsNumber()) { + return SWIG_TypeError; + } + + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + *val = static_cast(num.Int64Value()); + } + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +%#endif +} + +/* unsigned long long */ + +%fragment(SWIG_From_frag(unsigned long long), "header", fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +Napi::Value SWIG_From_unsigned_SS_long_SS_long(Napi::Env env, unsigned long long val) +{ + return Napi::Number::New(env, val); +} +%#endif +} + + +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment=SWIG_AsVal_frag(unsigned long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +int SWIG_AsVal_dec(unsigned long long)(Napi::Value obj, unsigned long long *val) +{ + if(!obj.IsNumber()) { + return SWIG_TypeError; + } + if (obj.ToNumber().Int64Value() < 0) { + return SWIG_TypeError; + } + if (val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + *val = static_cast(num.Int64Value()); + } + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +%#endif +} + + +/* float */ + +%fragment(SWIG_From_frag(float), "header") { +SWIGINTERN +Napi::Value SWIG_From_float(Napi::Env env, float val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(float),"header") { +SWIGINTERN +int SWIG_AsVal_dec(float)(Napi::Value obj, float *val) +{ + if(!obj.IsNumber()) { + return SWIG_TypeError; + } + + if(val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + *val = static_cast(num.DoubleValue()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} + + +/* double */ + +%fragment(SWIG_From_frag(double), "header") { +SWIGINTERN +Napi::Value SWIG_From_double(Napi::Env env, double val) +{ + return Napi::Number::New(env, val); +} +} + +%fragment(SWIG_AsVal_frag(double),"header") { +SWIGINTERN +int SWIG_AsVal_dec(double)(Napi::Value obj, double *val) +{ + if(!obj.IsNumber()) { + return SWIG_TypeError; + } + + if(val) { + Napi::Number num; + NAPI_CHECK_RESULT(obj.ToNumber(), num); + *val = static_cast(num.DoubleValue()); + } + + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptrun.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptrun.swg new file mode 100644 index 00000000..7e956f96 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptrun.swg @@ -0,0 +1,448 @@ +/* --------------------------------------------------------------------------- + * Error handling + * + * ---------------------------------------------------------------------------*/ + +/* + * We support several forms: + * + * SWIG_Raise("Error message") + * which creates an Error object with the error message + * + * SWIG_Raise(SWIG_TypeError, "Type error") + * which creates the specified error type with the message + * + * SWIG_Raise(obj) + * which throws the object itself + * + * SWIG_Raise(obj, "Exception const &", SWIGType_p_Exception) + * which also throws the object itself and discards the unneeded extra type info + * + * These must be functions instead of macros to use the C++ overloading to + * resolve the arguments + */ +#define SWIG_exception(code, msg) SWIG_Error(code, msg) +#define SWIG_fail goto fail + +#ifdef NAPI_CPP_EXCEPTIONS + +#define SWIG_Error(code, msg) SWIG_NAPI_Raise(env, code, msg) +#define NAPI_CHECK_MAYBE(maybe) (maybe) +#define NAPI_CHECK_RESULT(maybe, result) (result = maybe) + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, const char *msg) { + throw Napi::Error::New(env, msg); +} + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, int type, const char *msg) { + switch(type) { + default: + case SWIG_IOError: + case SWIG_MemoryError: + case SWIG_SystemError: + case SWIG_RuntimeError: + case SWIG_DivisionByZero: + case SWIG_SyntaxError: + throw Napi::Error::New(env, msg); + case SWIG_OverflowError: + case SWIG_IndexError: + throw Napi::RangeError::New(env, msg); + case SWIG_ValueError: + case SWIG_TypeError: + case SWIG_NullReferenceError: + throw Napi::TypeError::New(env, msg); + } +} + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, Napi::Value obj, + const char *msg = nullptr, swig_type_info *info = nullptr) { + throw Napi::Error(env, obj); +} + +#else + +#define SWIG_Error(code, msg) do { SWIG_NAPI_Raise(env, code, msg); SWIG_fail; } while (0) +#define NAPI_CHECK_MAYBE(maybe) do { if (maybe.IsNothing()) SWIG_fail; } while (0) +#define NAPI_CHECK_RESULT(maybe, result) \ + do { \ + auto r = maybe; \ + if (r.IsNothing()) SWIG_fail; \ + result = r.Unwrap(); \ + } while (0) + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, const char *msg) { + Napi::Error::New(env, msg).ThrowAsJavaScriptException(); +} + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, int type, const char *msg) { + switch(type) { + default: + case SWIG_IOError: + case SWIG_MemoryError: + case SWIG_SystemError: + case SWIG_RuntimeError: + case SWIG_DivisionByZero: + case SWIG_SyntaxError: + Napi::Error::New(env, msg).ThrowAsJavaScriptException(); + return; + case SWIG_OverflowError: + case SWIG_IndexError: + Napi::RangeError::New(env, msg).ThrowAsJavaScriptException(); + return; + case SWIG_ValueError: + case SWIG_TypeError: + case SWIG_NullReferenceError: + Napi::TypeError::New(env, msg).ThrowAsJavaScriptException(); + return; + } +} + +SWIGINTERN void SWIG_NAPI_Raise(Napi::Env env, Napi::Value obj, + const char *msg = nullptr, swig_type_info *info = nullptr) { + Napi::Error(env, obj).ThrowAsJavaScriptException(); +} + +#endif + +void JS_veto_set_variable(const Napi::CallbackInfo &info) { + SWIG_NAPI_Raise(info.Env(), "Tried to write read-only variable."); +} + +struct EnvInstanceData { + Napi::Env env; + // Base class per-environment constructor, used to check + // if a JS object is a SWIG wrapper + Napi::FunctionReference *SWIG_NAPI_ObjectWrapCtor; + // Per-environment wrapper constructors, indexed by the number in + // swig_type->clientdata + Napi::FunctionReference **ctor; + swig_module_info *swig_module; + EnvInstanceData(Napi::Env, swig_module_info *); + ~EnvInstanceData(); +}; + +typedef size_t SWIG_NAPI_ClientData; + +// Base class for all wrapped objects, +// used mostly when unwrapping unknown objects +template +class SWIG_NAPI_ObjectWrap_templ : public Napi::ObjectWrap { + public: + void *self; + bool owned; + size_t size; + swig_type_info *info; + SWIG_NAPI_ObjectWrap_templ(const Napi::CallbackInfo &info); + SWIG_NAPI_ObjectWrap_templ(bool, const Napi::CallbackInfo &info) : + Napi::ObjectWrap(info), + self(nullptr), + owned(true), + size(0), + info(nullptr) + {} + virtual ~SWIG_NAPI_ObjectWrap_templ() {}; + + Napi::Value ToString(const Napi::CallbackInfo &info); +}; + +template +SWIG_NAPI_ObjectWrap_templ::SWIG_NAPI_ObjectWrap_templ(const Napi::CallbackInfo &info) : + Napi::ObjectWrap(info), size(0), info(nullptr) { + Napi::Env env = info.Env(); + if (info.Length() == 1 && info[0].IsExternal()) { + // This constructor has been called internally from C++/SWIG + // to wrap an already existing C++ object of unknown type in JS + this->self = info[0].As>().Data(); + this->owned = false; + } else { + SWIG_Error(SWIG_ERROR, "This constructor is not accessible from JS"); + } + return; + goto fail; +fail: + return; +} + +template +Napi::Value SWIG_NAPI_ObjectWrap_templ::ToString(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + static char repr[128]; + const char *name = SWIG_TypePrettyName(this->info); + snprintf(repr, sizeof(repr), "{SwigObject %s (%s) at %p %s}", + this->info ? this->info->name : "unknown", + name ? name : "unknown", + this->self, + this->owned ? "[owned]" : "[copy]"); + return Napi::String::New(env, repr); +} + +class SWIG_NAPI_ObjectWrap_inst : public SWIG_NAPI_ObjectWrap_templ { +public: + using SWIG_NAPI_ObjectWrap_templ::SWIG_NAPI_ObjectWrap_templ; + static Napi::Function GetClass(Napi::Env); + static void GetMembers( + Napi::Env, + std::map &, + std::map & + ); +}; + +void SWIG_NAPI_ObjectWrap_inst::GetMembers( + Napi::Env env, + std::map &members, + std::map & +) { + members.erase("toString"); + members.insert({"toString", SWIG_NAPI_ObjectWrap_templ::InstanceMethod("toString", &SWIG_NAPI_ObjectWrap_templ::ToString)}); +} + +Napi::Function SWIG_NAPI_ObjectWrap_inst::GetClass(Napi::Env env) { + return Napi::ObjectWrap::DefineClass(env, "SwigObject", {}); +} + +SWIGRUNTIME int SWIG_NAPI_ConvertInstancePtr(Napi::Object objRef, void **ptr, swig_type_info *info, int flags) { + SWIG_NAPI_ObjectWrap_inst *ow; + Napi::Env env = objRef.Env(); + if(!objRef.IsObject()) return SWIG_ERROR; + + // Check if this is a SWIG wrapper + Napi::FunctionReference *ctor = env.GetInstanceData()->SWIG_NAPI_ObjectWrapCtor; + bool instanceOf; + NAPI_CHECK_RESULT(objRef.InstanceOf(ctor->Value()), instanceOf); + if (!instanceOf) { + return SWIG_TypeError; + } + + ow = Napi::ObjectWrap::Unwrap(objRef); + + // Now check if the SWIG type is compatible unless the types match exactly or the type is unknown + if(info && ow->info != info && ow->info != nullptr) { + swig_cast_info *tc = SWIG_TypeCheckStruct(ow->info, info); + if (!tc && ow->info->name) { + tc = SWIG_TypeCheck(ow->info->name, info); + } + bool type_valid = tc != 0; + if(!type_valid) { + return SWIG_TypeError; + } + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, ow->self, &newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + *ptr = ow->self; + } + + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !ow->owned) { + return SWIG_ERROR_RELEASE_NOT_OWNED; + } else { + if (flags & SWIG_POINTER_DISOWN) { + ow->owned = false; + } + if (flags & SWIG_POINTER_CLEAR) { + ow->self = nullptr; + } + } + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} + + +SWIGRUNTIME int SWIG_NAPI_GetInstancePtr(Napi::Value valRef, void **ptr) { + SWIG_NAPI_ObjectWrap_inst *ow; + if(!valRef.IsObject()) { + return SWIG_TypeError; + } + Napi::Object objRef; + NAPI_CHECK_RESULT(valRef.ToObject(), objRef); + ow = Napi::ObjectWrap::Unwrap(objRef); + + if(ow->self == nullptr) { + return SWIG_ERROR; + } + + *ptr = ow->self; + return SWIG_OK; + goto fail; +fail: + return SWIG_ERROR; +} + + +SWIGRUNTIME int SWIG_NAPI_ConvertPtr(Napi::Value valRef, void **ptr, swig_type_info *info, int flags) { + // special case: JavaScript null => C NULL pointer + if (valRef.IsNull()) { + *ptr=0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } + + if (!valRef.IsObject()) { + return SWIG_TypeError; + } + + Napi::Object objRef; + NAPI_CHECK_RESULT(valRef.ToObject(), objRef); + return SWIG_NAPI_ConvertInstancePtr(objRef, ptr, info, flags); + goto fail; +fail: + return SWIG_ERROR; +} + +SWIGRUNTIME Napi::Value SWIG_NAPI_NewPointerObj(Napi::Env env, void *ptr, swig_type_info *info, int flags) { + Napi::External native; + Napi::FunctionReference *ctor; + + if (ptr == nullptr) { + return env.Null(); + } + native = Napi::External::New(env, ptr); + + size_t *idx = info != nullptr ? + reinterpret_cast(info->clientdata) : + nullptr; + if (idx == nullptr) { + // This type does not have a dedicated wrapper + ctor = env.GetInstanceData()->SWIG_NAPI_ObjectWrapCtor; + } else { + ctor = env.GetInstanceData()->ctor[*idx]; + } + + Napi::Value wrapped; + NAPI_CHECK_RESULT(ctor->New({native}), wrapped); + + // Preserve the type even if using the generic wrapper + if (idx == nullptr && info != nullptr) { + Napi::Object obj; + NAPI_CHECK_RESULT(wrapped.ToObject(), obj); + Napi::ObjectWrap::Unwrap(obj)->info = info; + } + + if ((flags & SWIG_POINTER_OWN) == SWIG_POINTER_OWN) { + Napi::Object obj; + NAPI_CHECK_RESULT(wrapped.ToObject(), obj); + Napi::ObjectWrap::Unwrap(obj)->owned = true; + } + + return wrapped; + goto fail; +fail: + return Napi::Value(); +} + +#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_NAPI_ConvertPtr(obj, ptr, info, flags) +#define SWIG_NewPointerObj(ptr, info, flags) SWIG_NAPI_NewPointerObj(env, ptr, info, flags) + +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_NAPI_ConvertInstancePtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_NAPI_NewPointerObj(env, thisvalue, type, flags) + +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_NAPI_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NAPI_NewPointerObj(env, ptr, type, 0) + +#define SWIG_GetInstancePtr(obj, ptr) SWIG_NAPI_GetInstancePtr(obj, ptr) + +SWIGRUNTIME Napi::Value _SWIG_NAPI_wrap_equals(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + void *arg1 = (void *) 0 ; + void *arg2 = (void *) 0 ; + bool result; + int res1; + int res2; + + if(info.Length() != 1) SWIG_Error(SWIG_ERROR, "Illegal number of arguments for equals."); + + res1 = SWIG_GetInstancePtr(info.This(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_Error(SWIG_ERROR, "Could not get pointer from 'this' object for equals."); + } + res2 = SWIG_GetInstancePtr(info[0], &arg2); + if (!SWIG_IsOK(res2)) { + SWIG_Error(SWIG_ArgError(res2), " in method '" "equals" "', argument " "1"" of type '" "void *""'"); + } + + result = (bool)(arg1 == arg2); + jsresult = Napi::Boolean::New(env, result); + + return jsresult; + goto fail; +fail: + return Napi::Value(); +} + +SWIGRUNTIME Napi::Value _wrap_getCPtr(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::Value jsresult; + void *arg1 = (void *) 0 ; + intptr_t result; + int res1; + + res1 = SWIG_GetInstancePtr(info.This(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_Error(SWIG_ArgError(res1), " in method '" "getCPtr" "', argument " "1"" of type '" "void *""'"); + } + + result = (intptr_t)arg1; + jsresult = Napi::Number::New(env, result); + + return jsresult; + goto fail; +fail: + return Napi::Value(); +} + + +/* --------------------------------------------------------------------------- + * PackedData object + * (objects visible to JS that do not have a dedicated wrapper but must preserve type) + * ---------------------------------------------------------------------------*/ + +SWIGRUNTIME +Napi::Value SWIG_NAPI_NewPackedObj(Napi::Env env, void *data, size_t size, swig_type_info *type) { + void *data_copy = new uint8_t[size]; + memcpy(data_copy, data, size); + Napi::Value val = SWIG_NAPI_NewPointerObj(env, data_copy, type, SWIG_POINTER_OWN); + Napi::Object obj; + if (val.IsEmpty()) goto fail; + + NAPI_CHECK_RESULT(val.ToObject(), obj); + Napi::ObjectWrap::Unwrap(obj)->size = size; + +fail: + return val; +} + +SWIGRUNTIME +int SWIG_NAPI_ConvertPacked(Napi::Value valRef, void *ptr, size_t size, swig_type_info *type) { + void *tmp; + if (!SWIG_IsOK(SWIG_NAPI_ConvertPtr(valRef, &tmp, type, 0))) { + return SWIG_ERROR; + } + memcpy(ptr, tmp, size); + return SWIG_OK; +} + +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_NAPI_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_NAPI_NewPackedObj(env, ptr, sz, type) + + +/* --------------------------------------------------------------------------- + * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg) + * + * ---------------------------------------------------------------------------*/ + +SWIGRUNTIME + +Napi::Value SWIG_NAPI_AppendOutput(Napi::Env env, Napi::Value result, Napi::Value obj) { + if (result.IsUndefined()) { + result = Napi::Array::New(env); + } else if (!result.IsArray()) { + Napi::Array tmparr = Napi::Array::New(env); + tmparr.Set(static_cast(0), result); + result = tmparr; + } + + Napi::Array arr = result.As(); + arr.Set(arr.Length(), obj); + return arr; +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptruntime.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptruntime.swg new file mode 100644 index 00000000..42f11ed8 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptruntime.swg @@ -0,0 +1,40 @@ +/* ----------------------------------------------------------------------------- + * javascriptruntime.swg + * + * ----------------------------------------------------------------------------- */ + +// NAPI +// ---------- + +%insert(runtime) %{ +#if defined(_CPPUNWIND) || defined(__EXCEPTIONS) +#define NAPI_CPP_EXCEPTIONS +#else +#define NAPI_DISABLE_CPP_EXCEPTIONS +#define NODE_ADDON_API_ENABLE_MAYBE +#endif + +// This gives us +// Branch Node.js v10.x - from v10.20.0 +// Branch Node.js v12.x - from v12.17.0 +// Everything from Node.js v14.0.0 on +// Our limiting feature is napi_set_instance_data +#ifndef NAPI_VERSION +#define NAPI_VERSION 6 +#elif NAPI_VERSION < 6 +#error NAPI_VERSION 6 is the minimum supported target (Node.js >=14, >=12.17, >=10.20) +#endif +#include + +#include +#include +#include +#include +#include +%} + +%insert(runtime) "swigrun.swg"; /* SWIG API */ +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ + +%insert(runtime) "javascriptrun.swg" + diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptstrings.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptstrings.swg new file mode 100644 index 00000000..09227bf1 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascriptstrings.swg @@ -0,0 +1,80 @@ + +/* ------------------------------------------------------------ + * utility methods for char strings + * ------------------------------------------------------------ */ +%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") { +SWIGINTERN int +SWIG_AsCharPtrAndSize(Napi::Value valRef, char** cptr, size_t* psize, int *alloc) +{ + if(valRef.IsString()) { + Napi::String js_str; + NAPI_CHECK_RESULT(valRef.ToString(), js_str); + + std::string str = js_str.Utf8Value(); + size_t len = str.size() + 1; + char* cstr = (char*) %new_array(len, char); + memcpy(cstr, str.data(), len); + + if(alloc) *alloc = SWIG_NEWOBJ; + if(psize) *psize = len; + if(cptr) *cptr = cstr; + + return SWIG_OK; + } else if (valRef.IsNull()) { + if (cptr) *cptr = 0; + return SWIG_OK; + } else { + if(valRef.IsObject()) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + Napi::Object obj; + NAPI_CHECK_RESULT(valRef.ToObject(), obj); + // try if the object is a wrapped char[] + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + } + goto fail; +fail: + return SWIG_TypeError; +} +} + + +%fragment(SWIG_From_frag(char), "header") { +SWIGINTERNINLINE Napi::Value +SWIG_From_char(Napi::Env env, char c) +{ + Napi::String js_str = Napi::String::New(env, &c, 1); + return js_str; +} +} + + +%fragment("SWIG_FromCharPtr", "header", fragment = "SWIG_FromCharPtrAndSize") { +// Override the default one with an empty one +} + +%fragment("SWIG_FromCharPtrAndSize", "header") { +SWIGINTERNINLINE Napi::Value +SWIG_Env_FromCharPtrAndSize(Napi::Env env, const char* carray, size_t size) +{ + if (carray) { + Napi::String js_str = Napi::String::New(env, carray, size); + return js_str; + } else { + return env.Undefined(); + } +} +} + +%insert(runtime) %{ +#define SWIG_FromCharPtrAndSize(cptr, size) SWIG_Env_FromCharPtrAndSize(env, cptr, size) +#define SWIG_FromCharPtr(cptr) SWIG_Env_FromCharPtrAndSize(env, cptr, strlen(cptr)) +%} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascripttypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascripttypemaps.swg new file mode 100644 index 00000000..d7d21be2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/javascripttypemaps.swg @@ -0,0 +1,56 @@ +/* ------------------------------------------------------------ + * Typemap specializations for Javascript + * ------------------------------------------------------------ */ + +/* ------------------------------------------------------------ + * Fragment section + * ------------------------------------------------------------ */ + +/* These macros are necessary to provide an extra parameter + to SWIG_AsVal_dec functions (Napi::Env environment). + They must be defined before including `typemaps/fragments.swg` +*/ +#define SWIG_FROM_DECL_ARGS SWIG_NAPI_FROM_DECL_ARGS +#define SWIG_FROM_CALL_ARGS SWIG_NAPI_FROM_CALL_ARGS + +/* Include fundamental fragemt definitions */ +%include + +/* Look for user fragments file. */ +%include + +/* Javascript fragments for fundamental types */ +%include + +/* Javascript fragments for char* strings */ +%include + + +/* ------------------------------------------------------------ + * Unified typemap section + * ------------------------------------------------------------ */ + +/* Javascript types */ + +#define SWIG_Object Napi::Value +#define VOID_Object env.Undefined() + +/* Overload of the output/constant/exception/dirout handling */ + +/* append output */ +#define SWIG_AppendOutput(result, obj) SWIG_NAPI_AppendOutput(env, result, obj) + +/* set constant */ +#define SWIG_SetConstant(name, obj) + +/* raise */ +#define SWIG_Raise(...) SWIG_NAPI_Raise(env, __VA_ARGS__) + +%insert("runtime") %{ +#define SWIG_NAPI_FROM_DECL_ARGS(arg1) (Napi::Env env, arg1) +#define SWIG_NAPI_FROM_CALL_ARGS(arg1) (env, arg1) +%} + + +/* Include the unified typemap library */ +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/nodejs_buffer.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/nodejs_buffer.i new file mode 100644 index 00000000..d95ba2d6 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/nodejs_buffer.i @@ -0,0 +1,47 @@ +/* + * To include generic versions of the in typemaps, add: + * + * %typemap(in) (void *, size_t) = (const void* buffer_data, const size_t buffer_len); + * %typemap(typecheck) (void *, size_t) = (const void* buffer_data, const size_t buffer_len); + * + * or to discriminate by argument names: + * %typemap(in) (void *data, size_t length) = (const void* buffer_data, const size_t buffer_len); + * %typemap(typecheck) (void *data, size_t length) = (const void* buffer_data, const size_t buffer_len); + */ + +%typemap(in) (const void* buffer_data, const size_t buffer_len) { + if ($input.IsBuffer()) { + Napi::Buffer buf = $input.As>(); + $1 = reinterpret_cast(buf.Data()); + $2 = buf.ByteLength(); + } else { + SWIG_exception_fail(SWIG_TypeError, "in method '$symname', argument is not a Buffer"); + } +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_VOIDPTR) (const void* buffer_data, const size_t buffer_len) { + $1 = $input.IsBuffer(); +} + + +/* + * In order to use the argout typemap, the function must have the following signature: + * + * void buffer(void **buffer_data, size_t *buffer_len) + * + * In this case, this function will be wrapped by a JS function that takes + * no arguments (because of numinputs=0) and returns a Buffer + */ + +%typemap(in, numinputs=0) (void **buffer_data, size_t *buffer_len) (void *temp_data, size_t temp_len) { + $1 = &temp_data; + $2 = &temp_len; +} +%typemap(argout) (void **buffer_data, size_t *buffer_len) { + if (*$1 != nullptr) { + Napi::Buffer buf = Napi::Buffer::Copy(env, reinterpret_cast(*$1), *$2); + NAPI_CHECK_RESULT(buf.As(), $result); + } else { + $result = env.Null(); + } +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/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/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_common.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_except.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_map.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_map.i similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_map.i index 3b8b0936..a33e8868 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_map.i @@ -48,7 +48,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); @@ -64,17 +68,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_string.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/stl.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/stl.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/napi/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/typemaps.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/napi/typemaps.i index d3d8afb1..08b58386 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/napi/typemaps.i @@ -18,7 +18,7 @@ you would use a real value instead. int *INPUT short *INPUT long *INPUT - long long *INPUT + long long *INPUT unsigned int *INPUT unsigned short *INPUT unsigned long *INPUT @@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple. For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and -returns the integer part in one of its parameters).K: +returns the integer part in one of its parameters) : double modf(double x, double *ip); @@ -139,10 +139,6 @@ to a Python variable you might do this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ %include diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/argcargv.i new file mode 100644 index 00000000..b1396a4e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/argcargv.i @@ -0,0 +1,75 @@ +/* ------------------------------------------------------------ + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------ */ + +%{ +#ifndef SWIGV8_VALUE_TO_ARRAY +# define SWIGV8_VALUE_TO_ARRAY(val) SWIGV8_ARRAY::Cast(val) +#endif +#ifndef SWIGV8_STRING +# define SWIGV8_STRING v8::Local +#endif + +SWIGINTERN int SWIG_AsVal_string (SWIGV8_VALUE valRef, SWIGV8_STRING *str) +{ + if (!valRef->IsString()) { + return SWIG_TypeError; + } + if(str != SWIG_NULLPTR) { + *str = SWIGV8_TO_STRING(valRef); + } + return SWIG_OK; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i, len; + size_t arraysize; + SWIGV8_ARRAY array; + if (!$input->IsArray()) { + SWIG_exception_fail(SWIG_ERROR, "not array"); + } + array = SWIGV8_VALUE_TO_ARRAY($input); + len = array->Length(); + arraysize = (len+1)*sizeof($*2_ltype); + $1 = len; + $2 = ($2_ltype) malloc(arraysize); + if ($2 == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of array failed"); + } + memset($2, 0, arraysize); + for (i = 0; i < len; i++) { + int res, slen; + $*2_ltype pstr; + SWIGV8_STRING str; + SWIGV8_VALUE jsvalue = SWIGV8_ARRAY_GET(array, i); + res = SWIG_AsVal_string(jsvalue, &str); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ERROR, "failed to convert to string"); + } + slen = SWIGV8_UTF8_LENGTH(str); + pstr = ($*2_ltype) malloc(slen + 1); + if (pstr == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_ERROR, "memory allocation of a string failed"); + } + if (slen) { + res = SWIGV8_WRITE_UTF8(str, pstr, slen); + if (res != slen) { + SWIG_exception_fail(SWIG_ERROR, "wrong string length"); + } + } + pstr[slen] = 0; + $2[i] = pstr; + } + $2[i] = SWIG_NULLPTR; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != SWIG_NULLPTR) { + $1_ltype i; + for (i = 0; i < $1; i++) { + free((void *)$2[i]); + } + free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/arrays_javascript.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/arrays_javascript.i new file mode 100644 index 00000000..6dc7e4b9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/arrays_javascript.i @@ -0,0 +1,86 @@ +/* ----------------------------------------------------------------------------- + * arrays_javascript.i + * + * These typemaps give more natural support for arrays. The typemaps are not efficient + * as there is a lot of copying of the array values whenever the array is passed to C/C++ + * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. + * An exception is thrown if they are not. + * + * Example usage: + * Wrapping: + * + * %include + * %inline %{ + * extern int FiddleSticks[3]; + * %} + * + * Use from JavaScript like this: + * + * var fs = [10, 11, 12]; + * example.FiddleSticks = fs; + * fs = example.FiddleSticks; + * ----------------------------------------------------------------------------- */ + + +%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} +%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} +%fragment("SWIG_JSCOutInt", "header", fragment=SWIG_From_frag(int)) {} +%fragment("SWIG_JSCOutNumber", "header", fragment=SWIG_From_frag(double)) {} + +%define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH) + +%typemap(in, fragment=NAME) CTYPE[ANY] { + if ($input->IsArray()) { + // Convert into Array + v8::Local array = v8::Local::Cast($input); + + int length = ANYLENGTH; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (int i = 0; i < length; i++) { + v8::Local jsvalue = SWIGV8_ARRAY_GET(array, i); + $*1_ltype temp; + + // Get primitive value from JSObject + int res = SWIG_AsVal(CTYPE)(jsvalue, &temp); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + } else { + SWIG_exception_fail(SWIG_ERROR, "$input is not an array"); + } +} + +%typemap(freearg) CTYPE[ANY] { + free($1); +} + +%enddef + +%define JAVASCRIPT_ARRAYS_OUT_DECL(NAME, CTYPE) + +%typemap(out, fragment=NAME) CTYPE[ANY] { + int length = $1_dim0; + v8::Local array = SWIGV8_ARRAY_NEW(length); + + for (int i = 0; i < length; i++) { + SWIGV8_ARRAY_SET(array, i, SWIG_From(CTYPE)($1[i])); + } + + $result = array; +} + +%enddef + +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, , array->Length()) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetIntProperty", int, ANY, $1_dim0) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, , array->Length()) +JAVASCRIPT_ARRAYS_IN_DECL("SWIG_JSCGetNumberProperty", double, ANY, $1_dim0) + +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutInt", int) +JAVASCRIPT_ARRAYS_OUT_DECL("SWIG_JSCOutNumber", double) + diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/ccomplex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/ccomplex.i new file mode 100644 index 00000000..e58dbf71 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/ccomplex.i @@ -0,0 +1,27 @@ +/* ----------------------------------------------------------------------------- + * ccomplex.i + * + * C complex typemaps + * ISO C99: 7.3 Complex arithmetic + * ----------------------------------------------------------------------------- */ + + +%include + +%{ +#include +%} + +#define complex _Complex + +/* C complex constructor */ +#define CCplxConst(r, i) ((r) + I*(i)) + +%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag); + +/* declaring the typemaps */ +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/python/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/complex.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/complex.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/exception.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/exception.i new file mode 100644 index 00000000..0246cfde --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/exception.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/python/factory.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/factory.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/factory.i diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascript.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascript.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascript.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascript.swg index 3a83b649..3d8f7bac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/jsc/javascript.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascript.swg @@ -12,7 +12,7 @@ %include -%include +%include %include diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcode.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcode.swg similarity index 74% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcode.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcode.swg index c4aaf3db..81ae4e1a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcode.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcode.swg @@ -4,16 +4,18 @@ * - $jslocals: locals part of wrapper * - $jscode: code part of wrapper * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments * - $jsmangledtype: mangled type of class * ----------------------------------------------------------------------------- */ %fragment("js_ctor", "templates") %{ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { SWIGV8_HANDLESCOPE(); - - v8::Handle self = args.Holder(); + + SWIGV8_OBJECT self = args.Holder(); $jslocals - if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper."); + if(args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); @@ -53,7 +55,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { SWIGV8_HANDLESCOPE(); OverloadErrorHandler errorHandler; - v8::Handle self; + SWIGV8_VALUE self; // switch all cases by means of series of if-returns. $jsdispatchcases @@ -72,15 +74,17 @@ fail: * - $jslocals: locals part of wrapper * - $jscode: code part of wrapper * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments * - $jsmangledtype: mangled type of class * ----------------------------------------------------------------------------- */ %fragment("js_overloaded_ctor", "templates") %{ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) { SWIGV8_HANDLESCOPE(); - - v8::Handle self = args.Holder(); + + SWIGV8_OBJECT self = args.Holder(); $jslocals - if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if(self->InternalFieldCount() < 1) SWIG_exception_fail(SWIG_ERROR, "Illegal call of constructor $jswrapper."); + if(args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); @@ -95,25 +99,19 @@ fail: /* ----------------------------------------------------------------------------- * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor. * - $jsargcount: number of arguments of called ctor + * - $jsargrequired: required number of arguments * - $jswrapper: wrapper of called ctor * * Note: a try-catch-like mechanism is used to switch cases * ----------------------------------------------------------------------------- */ %fragment ("js_ctor_dispatch_case", "templates") %{ - if(args.Length() == $jsargcount) { + if(args.Length() >= $jsargrequired && args.Length() <= $jsargcount) { errorHandler.err.Clear(); -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - self = $jswrapper(args, errorHandler); - if(errorHandler.err.IsEmpty()) { - SWIGV8_ESCAPE(self); - } -#else $jswrapper(args, errorHandler); if(errorHandler.err.IsEmpty()) { return; } -#endif } %} @@ -125,22 +123,8 @@ fail: %fragment ("js_dtor", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) -static void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) -static void $jswrapper(v8::Isolate *isolate, v8::Persistent object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) -static void $jswrapper(v8::Isolate *isolate, v8::Persistent *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 -static void $jswrapper(const v8::WeakCallbackData &data) { - v8::Local object = data.GetValue(); +static void $jswrapper(const v8::WeakCallbackInfo &data) { SWIGV8_Proxy *proxy = data.GetParameter(); -#else - static void $jswrapper(const v8::WeakCallbackInfo &data) { - SWIGV8_Proxy *proxy = data.GetParameter(); -#endif if(proxy->swigCMemOwn && proxy->swigCObject) { #ifdef SWIGRUNTIME_DEBUG @@ -149,20 +133,6 @@ static void $jswrapper(const v8::WeakCallbackData &dat $jsfree proxy->swigCObject; } delete proxy; - -#if (V8_MAJOR_VERSION-0) < 5 - object.Clear(); -#endif - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - object.Dispose(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - object.Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - object->Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 5 - object->Dispose(); -#endif } %} @@ -174,40 +144,14 @@ static void $jswrapper(const v8::WeakCallbackData &dat * ----------------------------------------------------------------------------- */ %fragment ("js_dtoroverride", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) -static void $jswrapper(v8::Persistent object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) -static void $jswrapper(v8::Isolate *isolate, v8::Persistent object, void *parameter) { - SWIGV8_Proxy *proxy = static_cast(parameter); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) -static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 -static void $jswrapper(const v8::WeakCallbackData &data) { - v8::Local object = data.GetValue(); - SWIGV8_Proxy *proxy = data.GetParameter(); -#else static void $jswrapper(const v8::WeakCallbackInfo &data) { SWIGV8_Proxy *proxy = data.GetParameter(); -#endif if(proxy->swigCMemOwn && proxy->swigCObject) { $jstype arg1 = ($jstype)proxy->swigCObject; ${destructor_action} } delete proxy; - -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) - object.Dispose(); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) - object.Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) - object->Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) - object->Dispose(); -#elif (V8_MAJOR_VERSION-0) < 5 - object.Clear(); -#endif } %} @@ -219,14 +163,10 @@ static void $jswrapper(const v8::WeakCallbackInfo &data) { * ----------------------------------------------------------------------------- */ %fragment("js_getter", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 5 -static SwigV8ReturnValue $jswrapper(v8::Local property, const SwigV8PropertyCallbackInfo &info) { -#else static SwigV8ReturnValue $jswrapper(v8::Local property, const SwigV8PropertyCallbackInfo &info) { -#endif SWIGV8_HANDLESCOPE(); - v8::Handle jsresult; + SWIGV8_VALUE jsresult; $jslocals $jscode SWIGV8_RETURN_INFO(jsresult, info); @@ -245,11 +185,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("js_setter", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 5 -static void $jswrapper(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid &info) { -#else static void $jswrapper(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid &info) { -#endif SWIGV8_HANDLESCOPE(); $jslocals @@ -262,18 +198,20 @@ fail: /* ----------------------------------------------------------------------------- * js_function: template for function wrappers - * - $jswrapper: wrapper function name - * - $jslocals: locals part of wrapper - * - $jscode: code part of wrapper + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsargrequired: required number of arguments * ----------------------------------------------------------------------------- */ %fragment("js_function", "templates") %{ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { SWIGV8_HANDLESCOPE(); - v8::Handle jsresult; + SWIGV8_VALUE jsresult; $jslocals - if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + if (args.Length() < $jsargrequired || args.Length() > $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); $jscode SWIGV8_RETURN(jsresult); @@ -296,7 +234,7 @@ fail: static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { SWIGV8_HANDLESCOPE(); - v8::Handle jsresult; + SWIGV8_VALUE jsresult; OverloadErrorHandler errorHandler; $jscode @@ -320,7 +258,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler { SWIGV8_HANDLESCOPE(); - v8::Handle jsresult; + SWIGV8_VALUE jsresult; $jslocals $jscode SWIGV8_RETURN(jsresult); @@ -333,29 +271,30 @@ fail: /* ----------------------------------------------------------------------------- * js_function_dispatch_case: template for a case used in the function dispatcher - * - $jswrapper: wrapper function name - * - $jsargcount: number of arguments of overloaded function - * - $jscode: code part of wrapper + * - $jswrapper: wrapper function name + * - $jsargcount: number of arguments of overloaded function + * - $jsargrequired: required number of arguments + * - $jscode: code part of wrapper * ----------------------------------------------------------------------------- */ %fragment ("js_function_dispatch_case", "templates") %{ - if(args.Length() == $jsargcount) { + if(args.Length() >= $jsargrequired && args.Length() <= $jsargcount) { errorHandler.err.Clear(); -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - jsresult = $jswrapper(args, errorHandler); - if(errorHandler.err.IsEmpty()) { - SWIGV8_ESCAPE(jsresult); - } -#else $jswrapper(args, errorHandler); if(errorHandler.err.IsEmpty()) { return; } -#endif } %} +/* ----------------------------------------------------------------------------- + * js_check_arg: template for checking if an argument exists + * - $jsarg: number of argument + * ----------------------------------------------------------------------------- */ +%fragment ("js_check_arg", "templates") +%{if(args.Length() > $jsarg)%} + /* ----------------------------------------------------------------------------- * jsv8_declare_class_template: template for a class template declaration. * - $jsmangledname: mangled class name @@ -374,7 +313,7 @@ fail: %fragment("jsv8_define_class_template", "templates") %{ /* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */ - v8::Handle $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname"); + SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname"); SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class); $jsmangledname_clientData.dtor = $jsdtor; if (SWIGTYPE_$jsmangledtype->clientdata == 0) { @@ -392,15 +331,11 @@ fail: %{ if (SWIGTYPE_p$jsbaseclass->clientdata && !(static_cast(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ.IsEmpty())) { -#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) - $jsmangledname_class->Inherit(static_cast(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ); -#else $jsmangledname_class->Inherit( v8::Local::New( v8::Isolate::GetCurrent(), static_cast(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ) ); -#endif #ifdef SWIGRUNTIME_DEBUG printf("Inheritance successful $jsmangledname $jsbaseclass\n"); @@ -420,11 +355,10 @@ fail: %fragment("jsv8_create_class_instance", "templates") %{ /* Class: $jsname ($jsmangledname) */ - v8::Handle $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname"); + SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname"); $jsmangledname_class_0->SetCallHandler($jsctor); $jsmangledname_class_0->Inherit($jsmangledname_class); - $jsmangledname_class_0->SetHiddenPrototype(true); - v8::Handle $jsmangledname_obj = $jsmangledname_class_0->GetFunction(); + v8::Local $jsmangledname_obj = $jsmangledname_class_0->GetFunction(context).ToLocalChecked(); %} /* ----------------------------------------------------------------------------- @@ -435,7 +369,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_register_class", "templates") %{ - $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); + SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj)); %} /* ----------------------------------------------------------------------------- @@ -444,7 +378,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_create_namespace", "templates") %{ - v8::Handle $jsmangledname_obj = SWIGV8_OBJECT_NEW(); + SWIGV8_OBJECT $jsmangledname_obj = SWIGV8_OBJECT_NEW(); %} /* ----------------------------------------------------------------------------- @@ -455,7 +389,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_register_namespace", "templates") %{ - $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); + SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj)); %} /* ----------------------------------------------------------------------------- @@ -491,7 +425,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_register_static_function", "templates") %{ - SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper); + SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper, context); %} /* ----------------------------------------------------------------------------- @@ -505,5 +439,5 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("jsv8_register_static_variable", "templates") %{ - SWIGV8_AddStaticVariable($jsparent_obj, "$jsname", $jsgetter, $jssetter); + SWIGV8_AddStaticVariable($jsparent_obj, "$jsname", $jsgetter, $jssetter, context); %} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcomplex.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcomplex.swg similarity index 66% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcomplex.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcomplex.swg index d3b4aaff..cf57555e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptcomplex.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptcomplex.swg @@ -12,15 +12,19 @@ %fragment(SWIG_From_frag(Type),"header", fragment=SWIG_From_frag(double)) { -SWIGINTERNINLINE v8::Handle -SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) +SWIGINTERNINLINE SWIGV8_VALUE +#if defined(__cplusplus) +SWIG_From_dec(Type)(const Type& c) +#else +SWIG_From_dec(Type)(Type c) +#endif { SWIGV8_HANDLESCOPE_ESC(); - v8::Local vals = SWIGV8_ARRAY_NEW(); + v8::Local vals = SWIGV8_ARRAY_NEW(0); - vals->Set(0, SWIG_From(double)(Real(c))); - vals->Set(1, SWIG_From(double)(Imag(c))); + SWIGV8_ARRAY_SET(vals, 0, SWIG_From(double)(Real(c))); + SWIGV8_ARRAY_SET(vals, 1, SWIG_From(double)(Imag(c))); SWIGV8_ESCAPE(vals); } } @@ -32,30 +36,30 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) fragment=SWIG_AsVal_frag(double)) { SWIGINTERN int -SWIG_AsVal_dec(Type) (v8::Handle o, Type* val) +SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val) { SWIGV8_HANDLESCOPE(); if (o->IsArray()) { - v8::Handle array = v8::Handle::Cast(o); + SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o); - if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); double re, im; int res; - res = SWIG_AsVal(double)(array->Get(0), &re); - if(!SWIG_IsOK(res)) { + res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re); + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } - res = SWIG_AsVal(double)(array->Get(1), &im); - if(!SWIG_IsOK(res)) { + res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im); + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } if (val) *val = Constructor(re, im); return SWIG_OK; - } else if(o->IsNumber()){ + } else if (o->IsNumber()) { double d; int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d)); if (SWIG_IsOK(res)) { @@ -74,24 +78,24 @@ SWIG_AsVal_dec(Type) (v8::Handle o, Type* val) %fragment(SWIG_AsVal_frag(Type),"header", fragment=SWIG_AsVal_frag(float)) { SWIGINTERN int -SWIG_AsVal_dec(Type) (v8::Handle o, Type* val) +SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val) { SWIGV8_HANDLESCOPE(); if (o->IsArray()) { - v8::Handle array = v8::Handle::Cast(o); + SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o); - if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); double re, im; int res; - res = SWIG_AsVal(double)(array->Get(0), &re); - if(!SWIG_IsOK(res)) { + res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re); + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } - res = SWIG_AsVal(double)(array->Get(1), &im); - if(!SWIG_IsOK(res)) { + res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im); + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } @@ -102,7 +106,7 @@ SWIG_AsVal_dec(Type) (v8::Handle o, Type* val) } else { return SWIG_OverflowError; } - } else if(o->IsNumber()){ + } else if (o->IsNumber()) { float re; int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); if (SWIG_IsOK(res)) { diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptfragments.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptfragments.swg new file mode 100644 index 00000000..4778bf03 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptfragments.swg @@ -0,0 +1,23 @@ +/* + + Create a file with this name, 'javascriptfragments.swg', in your working + directory and add all the %fragments you want to take precedence + over the default ones defined by swig. + + For example, if you add: + + %fragment(SWIG_AsVal_frag(int),"header") { + SWIGINTERNINLINE int + SWIG_AsVal(int)(PyObject *obj, int *val) + { + ; + } + } + + this will replace the code used to retrieve an integer value for all + the typemaps that need it, including: + + int, std::vector, std::list >, etc. + + +*/ diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripthelpers.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripthelpers.swg new file mode 100644 index 00000000..7f704061 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripthelpers.swg @@ -0,0 +1,87 @@ +%insert(runtime) %{ + +typedef v8::FunctionCallback SwigV8FunctionCallback; +typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback; +typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback; +typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfoVoid; + +/** + * Creates a class template for a class with specified initialization function. + */ +SWIGRUNTIME SWIGV8_FUNCTION_TEMPLATE SWIGV8_CreateClassTemplate(const char* symbol) { + SWIGV8_HANDLESCOPE_ESC(); + + v8::Local class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID(); + class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol)); + + SWIGV8_OBJECT_TEMPLATE inst_templ = class_templ->InstanceTemplate(); + inst_templ->SetInternalFieldCount(1); + + SWIGV8_OBJECT_TEMPLATE equals_templ = class_templ->PrototypeTemplate(); + equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals)); + + SWIGV8_OBJECT_TEMPLATE cptr_templ = class_templ->PrototypeTemplate(); + cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr)); + + SWIGV8_ESCAPE(class_templ); +} + +/** + * Registers a class method with given name for a given class template. + */ +SWIGRUNTIME void SWIGV8_AddMemberFunction(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol, + SwigV8FunctionCallback _func) { + SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->PrototypeTemplate(); + proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)); +} + +/** + * Registers a class property with given name for a given class template. + */ +SWIGRUNTIME void SWIGV8_AddMemberVariable(SWIGV8_FUNCTION_TEMPLATE class_templ, const char* symbol, + SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { + SWIGV8_OBJECT_TEMPLATE proto_templ = class_templ->InstanceTemplate(); + proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); +} + +/** + * Registers a class method with given name for a given object. + */ +SWIGRUNTIME void SWIGV8_AddStaticFunction(SWIGV8_OBJECT obj, const char* symbol, + const SwigV8FunctionCallback& _func, v8::Local context) { + SWIGV8_MAYBE_CHECK(obj->Set(context, SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(context).ToLocalChecked())); +} + +/** + * Registers a class method with given name for a given object. + */ +SWIGRUNTIME void SWIGV8_AddStaticVariable(SWIGV8_OBJECT obj, const char* symbol, + SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter, + v8::Local context) { + SWIGV8_MAYBE_CHECK(obj->SetAccessor(context, SWIGV8_SYMBOL_NEW(symbol), getter, setter)); +} + +SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid& info) +{ + char buffer[256]; + char msg[512]; + int res; + + v8::Local sproperty; + if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) { + SWIGV8_WRITE_UTF8(sproperty, buffer, 256); + res = SWIG_snprintf(msg, sizeof(msg), "Tried to write read-only variable: %s.", buffer); + } + else { + res = -1; + } + + if(res<0) { + SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); + } else { + SWIG_exception(SWIG_ERROR, msg); + } +fail: ; +} + +%} // v8_helper_functions diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptinit.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptinit.swg similarity index 75% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptinit.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptinit.swg index 8faf2dd8..3bf8c416 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptinit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptinit.swg @@ -5,29 +5,21 @@ %insert(init) %{ SWIGRUNTIME void -SWIG_V8_SetModule(void *, swig_module_info *swig_module) { - v8::Local global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); +SWIG_V8_SetModule(v8::Local context, swig_module_info *swig_module) { + v8::Local global_obj = context->Global(); v8::Local mod = SWIGV8_EXTERNAL_NEW(swig_module); assert(!mod.IsEmpty()); -#if (V8_MAJOR_VERSION-0) < 5 - global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod); -#else v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); - global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod); -#endif + global_obj->SetPrivate(context, privateKey, mod); } SWIGRUNTIME swig_module_info * -SWIG_V8_GetModule(void *) { - v8::Local global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); -#if (V8_MAJOR_VERSION-0) < 5 - v8::Local moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data")); -#else +SWIG_V8_GetModule(v8::Local context) { + v8::Local global_obj = context->Global(); v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); v8::Local moduleinfo; - if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo)) + if (!global_obj->GetPrivate(context, privateKey).ToLocal(&moduleinfo)) return 0; -#endif if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined()) { @@ -52,6 +44,7 @@ SWIG_V8_GetModule(void *) { #define SWIG_GetModule(clientdata) SWIG_V8_GetModule(clientdata) #define SWIG_SetModule(clientdata, pointer) SWIG_V8_SetModule(clientdata, pointer) +#define SWIG_INIT_CLIENT_DATA_TYPE v8::Local %} @@ -64,20 +57,20 @@ SWIG_V8_GetModule(void *) { %} %insert(init) %{ +#if !defined(NODE_MODULE_VERSION) || (NODE_MODULE_VERSION < 12) // Note: 'extern "C"'' disables name mangling which makes it easier to load the symbol manually -// TODO: is it ok to do that? -extern "C" -#if (NODE_MODULE_VERSION < 0x000C) -void SWIGV8_INIT (v8::Handle exports) +extern "C" void SWIGV8_INIT (SWIGV8_OBJECT exports_obj) +#elif (NODE_MODULE_VERSION < 64) +void SWIGV8_INIT (SWIGV8_OBJECT exports_obj, SWIGV8_VALUE /*module*/, void*) #else -void SWIGV8_INIT (v8::Handle exports, v8::Handle /*module*/) +void SWIGV8_INIT (SWIGV8_OBJECT exports_obj, SWIGV8_VALUE /*module*/, v8::Local context, void*) #endif { - SWIG_InitializeModule(static_cast(&exports)); +#if !defined(NODE_MODULE_VERSION) || NODE_MODULE_VERSION < 64 + v8::Local context = SWIGV8_CURRENT_CONTEXT(); +#endif - SWIGV8_HANDLESCOPE(); - - v8::Handle exports_obj = exports; + SWIG_InitializeModule(context); %} @@ -124,6 +117,10 @@ void SWIGV8_INIT (v8::Handle exports, v8::Handle /*modul } #if defined(BUILDING_NODE_EXTENSION) +#if (NODE_MODULE_VERSION < 64) NODE_MODULE($jsname, $jsname_initialize) +#else +NODE_MODULE_CONTEXT_AWARE($jsname, $jsname_initialize) +#endif #endif %} diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptprimtypes.swg similarity index 74% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptprimtypes.swg index f76be983..8ed571df 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptprimtypes.swg @@ -6,7 +6,7 @@ %fragment(SWIG_From_frag(bool),"header") { SWIGINTERNINLINE -v8::Handle +SWIGV8_VALUE SWIG_From_dec(bool)(bool value) { return SWIGV8_BOOLEAN_NEW(value); @@ -16,7 +16,7 @@ SWIG_From_dec(bool)(bool value) %fragment(SWIG_AsVal_frag(bool),"header", fragment=SWIG_AsVal_frag(long)) { SWIGINTERN -int SWIG_AsVal_dec(bool)(v8::Handle obj, bool *val) +int SWIG_AsVal_dec(bool)(SWIGV8_VALUE obj, bool *val) { if(!obj->IsBoolean()) { return SWIG_ERROR; @@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle obj, bool *val) %fragment(SWIG_From_frag(int),"header") { SWIGINTERNINLINE -v8::Handle SWIG_From_dec(int)(int value) +SWIGV8_VALUE SWIG_From_dec(int)(int value) { return SWIGV8_INT32_NEW(value); } @@ -39,7 +39,7 @@ v8::Handle SWIG_From_dec(int)(int value) %fragment(SWIG_AsVal_frag(int),"header") { SWIGINTERN -int SWIG_AsVal_dec(int)(v8::Handle valRef, int* val) +int SWIG_AsVal_dec(int)(SWIGV8_VALUE valRef, int* val) { if (!valRef->IsNumber()) { return SWIG_TypeError; @@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle valRef, int* val) %fragment(SWIG_From_frag(long),"header") { SWIGINTERNINLINE -v8::Handle SWIG_From_dec(long)(long value) +SWIGV8_VALUE SWIG_From_dec(long)(long value) { return SWIGV8_NUMBER_NEW(value); } @@ -63,7 +63,7 @@ v8::Handle SWIG_From_dec(long)(long value) %fragment(SWIG_AsVal_frag(long),"header", fragment="SWIG_CanCastAsInteger") { SWIGINTERN -int SWIG_AsVal_dec(long)(v8::Handle obj, long* val) +int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val) { if (!obj->IsNumber()) { return SWIG_TypeError; @@ -79,17 +79,16 @@ int SWIG_AsVal_dec(long)(v8::Handle obj, long* val) %fragment(SWIG_From_frag(unsigned long),"header", fragment=SWIG_From_frag(long)) { SWIGINTERNINLINE -v8::Handle SWIG_From_dec(unsigned long)(unsigned long value) +SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value) { - return (value > LONG_MAX) ? - SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long)); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } } %fragment(SWIG_AsVal_frag(unsigned long),"header", fragment="SWIG_CanCastAsInteger") { SWIGINTERN -int SWIG_AsVal_dec(unsigned long)(v8::Handle obj, unsigned long *val) +int SWIG_AsVal_dec(unsigned long)(SWIGV8_VALUE obj, unsigned long *val) { if(!obj->IsNumber()) { return SWIG_TypeError; @@ -115,7 +114,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle obj, unsigned long *val) fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE -v8::Handle SWIG_From_dec(long long)(long long value) +SWIGV8_VALUE SWIG_From_dec(long long)(long long value) { return SWIGV8_NUMBER_NEW(value); } @@ -128,7 +127,7 @@ v8::Handle SWIG_From_dec(long long)(long long value) fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN -int SWIG_AsVal_dec(long long)(v8::Handle obj, long long* val) +int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val) { if (!obj->IsNumber()) { return SWIG_TypeError; @@ -148,10 +147,9 @@ int SWIG_AsVal_dec(long long)(v8::Handle obj, long long* val) fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE -v8::Handle SWIG_From_dec(unsigned long long)(unsigned long long value) +SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value) { - return (value > LONG_MAX) ? - SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long)); + return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast(value)); } %#endif } @@ -162,7 +160,7 @@ v8::Handle SWIG_From_dec(unsigned long long)(unsigned long long value fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN -int SWIG_AsVal_dec(unsigned long long)(v8::Handle obj, unsigned long long *val) +int SWIG_AsVal_dec(unsigned long long)(SWIGV8_VALUE obj, unsigned long long *val) { if(!obj->IsNumber()) { return SWIG_TypeError; @@ -185,7 +183,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle obj, unsigned long %fragment(SWIG_From_frag(double),"header") { SWIGINTERN -v8::Handle SWIG_From_dec(double) (double val) +SWIGV8_VALUE SWIG_From_dec(double) (double val) { return SWIGV8_NUMBER_NEW(val); } @@ -193,7 +191,7 @@ v8::Handle SWIG_From_dec(double) (double val) %fragment(SWIG_AsVal_frag(double),"header") { SWIGINTERN -int SWIG_AsVal_dec(double)(v8::Handle obj, double *val) +int SWIG_AsVal_dec(double)(SWIGV8_VALUE obj, double *val) { if(!obj->IsNumber()) { return SWIG_TypeError; @@ -203,4 +201,3 @@ int SWIG_AsVal_dec(double)(v8::Handle obj, double *val) return SWIG_OK; } } - diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptrun.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptrun.swg new file mode 100644 index 00000000..c4e3c82b --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptrun.swg @@ -0,0 +1,456 @@ +/* --------------------------------------------------------------------------- + * These typedefs and defines are used to deal with v8 API changes + * + * Useful table of versions: https://nodejs.org/en/download/releases/ + * ---------------------------------------------------------------------------*/ + +#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked() + +typedef void SwigV8ReturnValue; +typedef v8::FunctionCallbackInfo SwigV8Arguments; +typedef v8::PropertyCallbackInfo SwigV8PropertyCallbackInfo; +#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return +#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return + +#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_ESCAPE(val) return scope.Escape(val) + +#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size) +#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext() +#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err) + +#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::NewStringType::kNormal)).ToLocalChecked() +#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::NewStringType::kNormal)).ToLocalChecked() + +#define SWIGV8_MAYBE_CHECK(maybe) maybe.Check() + +#define SWIGV8_ARRAY_NEW(size) v8::Array::New(v8::Isolate::GetCurrent(), size) +#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool) +#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val) +#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func) +#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New(v8::Isolate::GetCurrent()) +#define SWIGV8_INT32_NEW(num) v8::Int32::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), num) +#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent()) +#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent()) +#define SWIGV8_ARRAY v8::Local +#define SWIGV8_FUNCTION_TEMPLATE v8::Local +#define SWIGV8_OBJECT v8::Local +#define SWIGV8_OBJECT_TEMPLATE v8::Local +#define SWIGV8_OBJECT_TEMPLATE_NEW() v8::ObjectTemplate::New(v8::Isolate::GetCurrent()) +#define SWIGV8_VALUE v8::Local +#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent()) +#define SWIGV8_ARRAY_GET(array, index) (array)->Get(SWIGV8_CURRENT_CONTEXT(), index).ToLocalChecked() +#define SWIGV8_ARRAY_SET(array, index, value) SWIGV8_MAYBE_CHECK((array)->Set(SWIGV8_CURRENT_CONTEXT(), index, value)) + +#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class); + +#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked() +#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked() +#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked() +#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked() +#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len) +#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent()) +#define SWIGV8_OBJECT_TEMPLATE_INSTACE(tmpl) tmpl->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked(); +#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent()) + +/* --------------------------------------------------------------------------- + * Error handling + * + * ---------------------------------------------------------------------------*/ + +#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg) +#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0) +#define SWIG_fail goto fail +#define SWIGV8_OVERLOAD false + +SWIGINTERN void SWIG_V8_Raise(const char *msg) { + SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); +} + +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. + For overloaded methods the throwing type checking mechanism is used + during dispatching. As V8 exceptions can not be reset properly + the trick is to use a dynamic ErrorHandler with same local name as the global + one. + + - See definition of SWIG_Error above. + - See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload', + and 'JS_function_dispatch_case' in javascriptcode.swg + +*/ +class V8ErrorHandler { +public: + virtual ~V8ErrorHandler() {} + virtual void error(int code, const char *msg) { + SWIG_V8_Raise(msg); + } +}; +// this is used in usually +SWIGRUNTIME V8ErrorHandler SWIGV8_ErrorHandler; + +// instances of this are used in overloaded functions +class OverloadErrorHandler: public V8ErrorHandler { +public: + virtual void error(int code, const char *msg) { + err = v8::Exception::Error(SWIGV8_STRING_NEW(msg)); + if(code != SWIG_TypeError) { + SWIGV8_THROW_EXCEPTION(err); + } + } + SWIGV8_VALUE err; +}; + +/* --------------------------------------------------------------------------- + * Basic Proxy object + * + * ---------------------------------------------------------------------------*/ + +// Note: to trigger the v8 gc more often one can tell v8 about the memory consumption +// TODO: we could add a v8 specific parameter to control this value +#define SWIGV8_AVG_OBJ_SIZE 1000 + +class SWIGV8_Proxy { +public: + SWIGV8_Proxy(): swigCMemOwn(false), swigCObject(0), info(0) { + SWIGV8_ADJUST_MEMORY(SWIGV8_AVG_OBJ_SIZE); + }; + + ~SWIGV8_Proxy() { + handle.ClearWeak(); + handle.Reset(); + + SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE); + } + + bool swigCMemOwn; + void *swigCObject; + swig_type_info *info; + v8::Persistent handle; +}; + +class SWIGV8_ClientData { +public: + v8::Persistent class_templ; + + void (*dtor) (const v8::WeakCallbackInfo &data); +}; + +SWIGRUNTIME v8::Persistent SWIGV8_SWIGTYPE_Proxy_class_templ; + +SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(SWIGV8_OBJECT objRef, void **ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE(); + + if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; + + SWIGV8_Proxy *cdata = static_cast(objRef->GetAlignedPointerFromInternalField(0)); + + if(cdata == NULL) { + return SWIG_ERROR; + } + if(info && cdata->info != info) { + swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info); + if (!tc && cdata->info->name) { + tc = SWIG_TypeCheck(cdata->info->name, info); + } + bool type_valid = tc != 0; + if(!type_valid) { + return SWIG_TypeError; + } + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, cdata->swigCObject, &newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + *ptr = cdata->swigCObject; + } + + 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; +} + + +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo &data) { + SWIGV8_Proxy *proxy = data.GetParameter(); + delete proxy; +} + +SWIGRUNTIME int SWIG_V8_GetInstancePtr(SWIGV8_VALUE valRef, void **ptr) { + if(!valRef->IsObject()) { + return SWIG_TypeError; + } + SWIGV8_OBJECT objRef = SWIGV8_OBJECT::Cast(valRef); + + if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; + + SWIGV8_Proxy *cdata = static_cast(objRef->GetAlignedPointerFromInternalField(0)); + + if(cdata == NULL) { + return SWIG_ERROR; + } + + *ptr = cdata->swigCObject; + + return SWIG_OK; +} + +SWIGRUNTIME void SWIGV8_SetPrivateData(SWIGV8_OBJECT obj, void *ptr, swig_type_info *info, int flags) { + SWIGV8_Proxy *cdata = new SWIGV8_Proxy(); + cdata->swigCObject = ptr; + cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0; + cdata->info = info; + + obj->SetAlignedPointerInInternalField(0, cdata); + + cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); + + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter); + } else { + cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter); + } +} + +SWIGRUNTIME int SWIG_V8_ConvertPtr(SWIGV8_VALUE valRef, void **ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE(); + + /* special case: JavaScript null => C NULL pointer */ + if(valRef->IsNull()) { + *ptr=0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } + if(!valRef->IsObject()) { + return SWIG_TypeError; + } + SWIGV8_OBJECT objRef = SWIGV8_OBJECT::Cast(valRef); + return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags); +} + +SWIGRUNTIME SWIGV8_VALUE SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE_ESC(); + + SWIGV8_FUNCTION_TEMPLATE class_templ; + + if (ptr == NULL) { + v8::Local result = SWIGV8_NULL(); + SWIGV8_ESCAPE(result); + } + + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + + if(info->clientdata != 0) { + class_templ = v8::Local::New(isolate, ((SWIGV8_ClientData*) info->clientdata)->class_templ); + } else { + class_templ = v8::Local::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ); + } + + v8::Local result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked(); + + SWIGV8_SetPrivateData(result, ptr, info, flags); + + SWIGV8_ESCAPE(result); +} + +#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags) +#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags) + +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags) + +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_V8_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_V8_NewPointerObj(ptr, type, 0) + +#define SWIG_GetInstancePtr(obj, ptr) SWIG_V8_GetInstancePtr(obj, ptr) + +SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + SWIGV8_VALUE jsresult; + void *arg1 = (void *) 0 ; + void *arg2 = (void *) 0 ; + bool result; + int res1; + int res2; + + if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for equals."); + + res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ERROR, "Could not get pointer from 'this' object for equals."); + } + res2 = SWIG_GetInstancePtr(args[0], &arg2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "1"" of type '" "void *""'"); + } + + result = (bool)(arg1 == arg2); + jsresult = SWIGV8_BOOLEAN_NEW(result); + + SWIGV8_RETURN(jsresult); + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + +SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + SWIGV8_VALUE jsresult; + void *arg1 = (void *) 0 ; + intptr_t result; + int res1; + + res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCPtr" "', argument " "1"" of type '" "void *""'"); + } + + result = (intptr_t)arg1; + jsresult = SWIGV8_NUMBER_NEW(result); + + SWIGV8_RETURN(jsresult); + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + +/* --------------------------------------------------------------------------- + * PackedData object + * + * ---------------------------------------------------------------------------*/ + +class SwigV8PackedData { +public: + SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(nullptr), size(size), type(type) { + this->data = malloc(size); + if (this->data != nullptr) + memcpy(this->data, data, size); + }; + + ~SwigV8PackedData() { + free(this->data); + }; + + void *data; + size_t size; + swig_type_info *type; + + v8::Persistent handle; +}; + +SWIGRUNTIMEINLINE +int SwigV8Packed_Check(SWIGV8_VALUE valRef) { + SWIGV8_HANDLESCOPE(); + + SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef); + if(objRef->InternalFieldCount() < 1) return false; + v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); + v8::Local flag; + if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag)) + return false; + return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag)); +} + +SWIGRUNTIME +swig_type_info *SwigV8Packed_UnpackData(SWIGV8_VALUE valRef, void *ptr, size_t size) { + if (SwigV8Packed_Check(valRef)) { + SWIGV8_HANDLESCOPE(); + + SwigV8PackedData *sobj; + + SWIGV8_OBJECT objRef = SWIGV8_TO_OBJECT(valRef); + + sobj = static_cast(objRef->GetAlignedPointerFromInternalField(0)); + if (sobj == NULL || sobj->size != size) return 0; + memcpy(ptr, sobj->data, size); + return sobj->type; + } else { + return 0; + } +} + +SWIGRUNTIME +int SWIGV8_ConvertPacked(SWIGV8_VALUE valRef, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo &data) { + SwigV8PackedData *cdata = data.GetParameter(); + cdata->handle.Reset(); + delete cdata; +} + +SWIGRUNTIME +SWIGV8_VALUE SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) { + SWIGV8_HANDLESCOPE_ESC(); + + SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type); + SWIGV8_OBJECT_TEMPLATE tmpl = SWIGV8_OBJECT_TEMPLATE_NEW(); + tmpl->SetInternalFieldCount(1); + v8::Local obj = SWIGV8_OBJECT_TEMPLATE_INSTACE(tmpl); + + v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); + obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true)); + + obj->SetAlignedPointerInInternalField(0, cdata); + + cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); + + cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter); + + SWIGV8_ESCAPE(obj); +} + +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIGV8_NewPackedObj(ptr, sz, type) + + +/* --------------------------------------------------------------------------- + * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg) + * + * ---------------------------------------------------------------------------*/ + +SWIGRUNTIME + +SWIGV8_VALUE SWIGV8_AppendOutput(SWIGV8_VALUE result, SWIGV8_VALUE obj) { + SWIGV8_HANDLESCOPE_ESC(); + + if (result->IsUndefined()) { + result = SWIGV8_ARRAY_NEW(0); + } else if (!result->IsArray()) { + SWIGV8_ARRAY tmparr = SWIGV8_ARRAY_NEW(0); + SWIGV8_ARRAY_SET(tmparr, 0, result); + result = tmparr; + } + + SWIGV8_ARRAY arr = SWIGV8_ARRAY::Cast(result); + SWIGV8_ARRAY_SET(arr, arr->Length(), obj); + SWIGV8_ESCAPE(arr); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptruntime.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptruntime.swg new file mode 100644 index 00000000..4e93fc4c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptruntime.swg @@ -0,0 +1,47 @@ +/* ----------------------------------------------------------------------------- + * javascriptruntime.swg + * + * ----------------------------------------------------------------------------- */ + +// V8 Version Macro +// ---------------- +// +// v8 added version macros V8_MAJOR_VERSION, V8_MINOR_VERSION, V8_BUILD_NUMBER +// and V8_PATCH_LEVEL in version 4.3.0. SWIG doesn't support anything that +// old so SWIG generated code can rely on these. + +// Node support +// ------------ + +#ifdef BUILDING_NODE_EXTENSION +%insert("runtime") %{ +#include +//Older version of node.h does not include this +#include +%} +#endif + + +// V8 runtime +// ---------- + +%insert(runtime) %{ +#include + +#undef SWIG_V8_VERSION +#define SWIG_V8_VERSION ((V8_MAJOR_VERSION / 10) * 4096 + \ + (V8_MAJOR_VERSION % 10) * 256 + \ + (V8_MINOR_VERSION / 10) * 16 + \ + (V8_MINOR_VERSION % 10)) + +#include +#include +#include +#include +%} + +%insert(runtime) "swigrun.swg"; /* SWIG API */ +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ + +%insert(runtime) "javascriptrun.swg" + diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptstrings.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptstrings.swg similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptstrings.swg index e767a6d6..b0622098 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascriptstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascriptstrings.swg @@ -4,23 +4,26 @@ * ------------------------------------------------------------ */ %fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") { SWIGINTERN int -SWIG_AsCharPtrAndSize(v8::Handle valRef, char** cptr, size_t* psize, int *alloc) +SWIG_AsCharPtrAndSize(SWIGV8_VALUE valRef, char** cptr, size_t* psize, int *alloc) { if(valRef->IsString()) { - v8::Handle js_str = SWIGV8_TO_STRING(valRef); + v8::Local js_str = v8::Local::Cast(valRef); size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1; - char* cstr = new char[len]; + char* cstr = (char*) %new_array(len, char); SWIGV8_WRITE_UTF8(js_str, cstr, len); if(alloc) *alloc = SWIG_NEWOBJ; if(psize) *psize = len; if(cptr) *cptr = cstr; + return SWIG_OK; + } else if (valRef->IsNull()) { + if (cptr) *cptr = 0; return SWIG_OK; } else { if(valRef->IsObject()) { - v8::Handle obj = SWIGV8_TO_OBJECT(valRef); + SWIGV8_OBJECT obj = SWIGV8_OBJECT::Cast(valRef); // try if the object is a wrapped char[] swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { @@ -41,7 +44,7 @@ SWIG_AsCharPtrAndSize(v8::Handle valRef, char** cptr, size_t* psize, } %fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") { -SWIGINTERNINLINE v8::Handle +SWIGINTERNINLINE SWIGV8_VALUE SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { @@ -49,7 +52,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) // TODO: handle extra long strings return SWIGV8_UNDEFINED(); } else { - v8::Handle js_str = SWIGV8_STRING_NEW2(carray, size); + v8::Local js_str = SWIGV8_STRING_NEW2(carray, size); return js_str; } } else { diff --git a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripttypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripttypemaps.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripttypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripttypemaps.swg index 4601698e..c4d341be 100644 --- a/macx64/bin/swig/share/swig/4.0.0/javascript/v8/javascripttypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/javascripttypemaps.swg @@ -25,7 +25,7 @@ /* Javascript types */ -#define SWIG_Object v8::Handle +#define SWIG_Object SWIGV8_VALUE #define VOID_Object SWIGV8_UNDEFINED() /* Overload of the output/constant/exception/dirout handling */ @@ -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/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/lua/std_common.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_common.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_complex.i new file mode 100644 index 00000000..a252e0aa --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_complex.i @@ -0,0 +1,26 @@ +/* + * STD C++ complex typemaps + */ + +%include + +%{ +#include +%} + +namespace std { + %naturalvar complex; + template class complex; + %template() complex; + %template() complex; +} + +/* defining the complex as/from converters */ + +%swig_cplxdbl_convn(std::complex, std::complex, std::real, std::imag) +%swig_cplxflt_convn(std::complex, std::complex, std::real, std::imag) + +/* defining the typemaps */ + +%typemaps_primitive(%checkcode(CPLXDBL), std::complex); +%typemaps_primitive(%checkcode(CPLXFLT), std::complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_except.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_except.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_map.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_map.i new file mode 100644 index 00000000..a33e8868 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_map.i @@ -0,0 +1,71 @@ +/* ----------------------------------------------------------------------------- + * std_map.i + * + * SWIG typemaps for std::map + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::map +// ------------------------------------------------------------------------ + +%{ +#include +#include +#include +%} + +// exported class + +namespace std { + + template > class map { + // add typemaps here + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + map(); + map(const map& other); + + unsigned int size() const; + bool empty() const; + void clear(); + %extend { + const T& get(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else + (*self)[key] = x; +%#endif + } + void del(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + bool has_key(const K& key) { + std::map< K, T, C >::iterator i = self->find(key); + return i != self->end(); + } + } + }; + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_pair.i new file mode 100644 index 00000000..b72c50b9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_pair.i @@ -0,0 +1,35 @@ +/* ----------------------------------------------------------------------------- + * std_pair.i + * + * SWIG typemaps for std::pair + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::pair +// ------------------------------------------------------------------------ + +%{ +#include +%} + +namespace std { + + template struct pair { + typedef T first_type; + typedef U second_type; + + pair(); + pair(T first, U second); + pair(const pair& other); + + template pair(const pair &other); + + T first; + U second; + }; + + // add specializations here + +} diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_string.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_vector.i new file mode 100644 index 00000000..59357c5a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/std_vector.i @@ -0,0 +1,68 @@ +/* ----------------------------------------------------------------------------- + * std_vector.i + * ----------------------------------------------------------------------------- */ + +%include + +%{ +#include +#include +%} + + +%define SWIG_STD_VECTOR_INTERNAL(CTYPE, CONST_REFERENCE) + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef CTYPE value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef CTYPE& reference; + typedef CONST_REFERENCE const_reference; + + vector(); + vector(size_type n); + vector(const vector& other); + + size_type size() const; + size_type capacity() const; + void reserve(size_type n); + %rename(isEmpty) empty; + bool empty() const; + void clear(); + %rename(add) push_back; + void push_back(const value_type& x); + %extend { + CONST_REFERENCE get(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && isize()); + if (i>=0 && i class vector { + SWIG_STD_VECTOR_INTERNAL(T, const value_type&) + }; + + // bool specialization + template<> class vector { + SWIG_STD_VECTOR_INTERNAL(bool, bool) + }; +} + +%define specialize_std_vector(T) +#warning "specialize_std_vector - specialization for type T no longer needed" +%enddef + diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/stl.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/stl.i rename to macx64/bin/swig/share/swig/4.3.0/javascript/v8/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/javascript/v8/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/typemaps.i new file mode 100644 index 00000000..08b58386 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/javascript/v8/typemaps.i @@ -0,0 +1,144 @@ +/* ----------------------------------------------------------------------------- + * typemaps.i + * + * Pointer handling + * These mappings provide support for input/output arguments and common + * uses for C/C++ pointers. + * ----------------------------------------------------------------------------- */ + +// INPUT typemaps. +// These remap a C pointer to be an "INPUT" value which is passed by value +// instead of reference. + +/* +The following methods can be applied to turn a pointer into a simple +"input" value. That is, instead of passing a pointer to an object, +you would use a real value instead. + + int *INPUT + short *INPUT + long *INPUT + long long *INPUT + unsigned int *INPUT + unsigned short *INPUT + unsigned long *INPUT + unsigned long long *INPUT + unsigned char *INPUT + bool *INPUT + float *INPUT + double *INPUT + +To use these, suppose you had a C function like this : + + double fadd(double *a, double *b) { + return *a+*b; + } + +You could wrap it with SWIG as follows : + + %include + double fadd(double *INPUT, double *INPUT); + +or you can use the %apply directive : + + %include + %apply double *INPUT { double *a, double *b }; + double fadd(double *a, double *b); + +*/ + +// OUTPUT typemaps. These typemaps are used for parameters that +// are output only. The output value is appended to the result as +// a list element. + +/* +The following methods can be applied to turn a pointer into an "output" +value. When calling a function, no input value would be given for +a parameter, but an output value would be returned. In the case of +multiple output values, they are returned in the form of a Python tuple. + + int *OUTPUT + short *OUTPUT + long *OUTPUT + long long *OUTPUT + unsigned int *OUTPUT + unsigned short *OUTPUT + unsigned long *OUTPUT + unsigned long long *OUTPUT + unsigned char *OUTPUT + bool *OUTPUT + float *OUTPUT + double *OUTPUT + +For example, suppose you were trying to wrap the modf() function in the +C math library which splits x into integral and fractional parts (and +returns the integer part in one of its parameters) : + + double modf(double x, double *ip); + +You could wrap it with SWIG as follows : + + %include + double modf(double x, double *OUTPUT); + +or you can use the %apply directive : + + %include + %apply double *OUTPUT { double *ip }; + double modf(double x, double *ip); + +The Python output of the function would be a tuple containing both +output values. + +*/ + +// INOUT +// Mappings for an argument that is both an input and output +// parameter + +/* +The following methods can be applied to make a function parameter both +an input and output value. This combines the behavior of both the +"INPUT" and "OUTPUT" methods described earlier. Output values are +returned in the form of a Python tuple. + + int *INOUT + short *INOUT + long *INOUT + long long *INOUT + unsigned int *INOUT + unsigned short *INOUT + unsigned long *INOUT + unsigned long long *INOUT + unsigned char *INOUT + bool *INOUT + float *INOUT + double *INOUT + +For example, suppose you were trying to wrap the following function : + + void neg(double *x) { + *x = -(*x); + } + +You could wrap it with SWIG as follows : + + %include + void neg(double *INOUT); + +or you can use the %apply directive : + + %include + %apply double *INOUT { double *x }; + void neg(double *x); + +Unlike C, this mapping does not directly modify the input value (since +this makes no sense in Python). Rather, the modified input value shows +up as the return value of the function. Thus, to apply this function +to a Python variable you might do this : + + x = neg(x) + +*/ + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/_std_common.i b/macx64/bin/swig/share/swig/4.3.0/lua/_std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/_std_common.i rename to macx64/bin/swig/share/swig/4.3.0/lua/_std_common.i diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/lua/argcargv.i new file mode 100644 index 00000000..605a24fd --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/lua/carrays.i b/macx64/bin/swig/share/swig/4.3.0/lua/carrays.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/lua/carrays.i diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/cdata.i b/macx64/bin/swig/share/swig/4.3.0/lua/cdata.i new file mode 100644 index 00000000..e4c96d6f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/lua/cdata.i @@ -0,0 +1,23 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +%typemap(in,checkfn="lua_isstring") (const void *BYTES, size_t LENGTH) { + size_t len; + $1 = ($1_ltype)lua_tolstring(L, $input, &len); + SWIG_contract_assert($1, "non null string"); + $2 = ($2_ltype)len; +} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(out) SWIGCDATA %{lua_pushlstring(L, $1.data,$1.len); SWIG_arg++;%} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/factory.i b/macx64/bin/swig/share/swig/4.3.0/lua/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/factory.i rename to macx64/bin/swig/share/swig/4.3.0/lua/factory.i diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/lua.swg b/macx64/bin/swig/share/swig/4.3.0/lua/lua.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/lua/lua.swg rename to macx64/bin/swig/share/swig/4.3.0/lua/lua.swg index 6db3add6..204de087 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/lua.swg +++ b/macx64/bin/swig/share/swig/4.3.0/lua/lua.swg @@ -18,8 +18,9 @@ * constants typemaps * ----------------------------------------------------------------------------- */ // this basically adds to a table of constants +/* Extra `(`...`)` here are to handle $value being e.g. `SizeOf< int,int >::size`. */ %typemap(consttab) int, unsigned int, short, unsigned short, long, unsigned long, unsigned char, signed char, bool, enum SWIGTYPE - {SWIG_LUA_CONSTTAB_INT("$symname", $value)} + {SWIG_LUA_CONSTTAB_INT("$symname", ($value))} %typemap(consttab) float, double {SWIG_LUA_CONSTTAB_FLOAT("$symname", $value)} @@ -51,6 +52,17 @@ %typemap(consttab) SWIGTYPE (CLASS::*) { SWIG_LUA_CONSTTAB_BINARY("$symname", sizeof($type),&$value, $1_descriptor) } +/* String & length typemap */ + +%typemap(in,checkfn="lua_isstring") (const char *STRING, size_t LENGTH) { + size_t len; + $1 = ($1_ltype)lua_tolstring(L, $input, &len); + SWIG_contract_assert($1, "non null string"); + $2 = ($2_ltype)len; +} +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) } +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } /* ----------------------------------------------------------------------------- * Overloaded operator support @@ -151,7 +163,7 @@ The python/lua ones are great, but C++ ones I don't like (mainly because I cannot get the stack trace out of it) Therefore I have not bothered to try doing much in this -Therefore currently its just enough to get a few test cases running ok +Therefore currently it's just enough to get a few test cases running ok note: if you wish to throw anything related to std::exception use %include instead @@ -191,7 +203,7 @@ use %include instead Throwing object is a serious problem: Assuming some code throws a 'FooBar' There are a few options: -- return a pointer to it: but its unclear how long this will last for. +- return a pointer to it: but it's unclear how long this will last for. - return a copy of it: but not all objects are copyable (see exception_partial_info in the test suite for a case where you cannot do this) - convert to a string & throw that @@ -213,7 +225,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 @@ -224,7 +236,7 @@ SWIG_fail;%} // note: no support for object pointers -// its not clear how long the pointer is valid for, therefore not supporting it +// it's not clear how long the pointer is valid for, therefore not supporting it /* ----------------------------------------------------------------------------- * extras diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/lua_fnptr.i b/macx64/bin/swig/share/swig/4.3.0/lua/lua_fnptr.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/lua/lua_fnptr.i rename to macx64/bin/swig/share/swig/4.3.0/lua/lua_fnptr.i index 481cfafa..b4c663c5 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/lua_fnptr.i +++ b/macx64/bin/swig/share/swig/4.3.0/lua/lua_fnptr.i @@ -17,7 +17,7 @@ note: it should be passed by value, not byref or as a pointer. The SWIGLUA_FN holds a pointer to the lua_State, and the stack index where the function is held. The macro SWIGLUA_FN_GET() will put a copy of the lua function at the top of the stack. -After that its fairly simple to write the rest of the code (assuming know how to use lua), +After that it's fairly simple to write the rest of the code (assuming know how to use lua), just push the parameters, call the function and return the result. int my_func(int a, int b, SWIGLUA_FN fn) @@ -119,6 +119,6 @@ void swiglua_ref_get(SWIGLUA_REF* pref){ %{ swiglua_ref_set(&$1,L,$input); %} %typemap(out) SWIGLUA_REF -%{ if ($1.L!=0) {swiglua_ref_get(&$1);} else {lua_pushnil(L);} +%{ if ($1.L!=0) {swiglua_ref_get(&$1);} else {lua_pushnil(L);} SWIG_arg++; %} diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/luakw.swg b/macx64/bin/swig/share/swig/4.3.0/lua/luakw.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/lua/luakw.swg rename to macx64/bin/swig/share/swig/4.3.0/lua/luakw.swg index fc2f92bf..394e4005 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/luakw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/lua/luakw.swg @@ -2,7 +2,7 @@ Warnings for Lua keywords, built-in names and bad names. */ -#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword, renaming to 'c_" `x` "'", rename="c_%s") `x` +#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword", rename="c_%s") `x` #define LUABN(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "'" `x` "' conflicts with a basic function in Lua"), %$not %$ismember) `x` /* diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/luarun.swg b/macx64/bin/swig/share/swig/4.3.0/lua/luarun.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/lua/luarun.swg rename to macx64/bin/swig/share/swig/4.3.0/lua/luarun.swg index 9636cdc9..af6cd66f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/luarun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/lua/luarun.swg @@ -149,6 +149,20 @@ typedef struct swig_elua_entry { # define lua_rawlen lua_objlen #endif +/* lua_tolstring() was added in Lua 5.1. It should be a little more + efficient than making two separate calls and it avoids problems with order + of evaluation so SWIG calls lua_tolstring() when it wants the length and + we provide a compatibility implementation for Lua 5.0. */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 +static const char *(lua_tolstring)(lua_State *L, int idx, size_t *len) { + /* Call lua_tostring() first as it may convert the value from number to + string. */ + const char *result = lua_tostring(L, idx); + if (len) *len = lua_strlen(L, idx); + return result; +} +#endif + /* lua_pushglobaltable is the recommended "future-proof" way to get the global table for Lua 5.2 and later. Here we define @@ -289,7 +303,7 @@ to tell the two structures apart within SWIG, other than by looking at the type typedef struct { swig_type_info *type; int own; /* 1 if owned & must be destroyed */ - char data[1]; /* arbitrary amount of data */ + char data[1]; /* arbitrary amount of data */ } swig_lua_rawdata; /* Common SWIG API */ @@ -307,7 +321,7 @@ typedef struct { /* Contract support */ #define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else + do { if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } } while (0) /* helper #defines */ @@ -341,7 +355,7 @@ typedef struct { #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) #ifdef __cplusplus -/* Special helper for member function pointers +/* Special helper for member function pointers it gets the address, casts it, then dereferences it */ /*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */ #endif @@ -444,7 +458,7 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent lua_pop(L,1); /*remove nil */ lua_newtable(L); SWIG_Lua_elua_emulate_register(L,entry->value.value.table); - } + } if(is_metatable) { assert(lua_istable(L,-1)); lua_pushvalue(L,-1); @@ -453,11 +467,11 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent break; case LUA_TUSERDATA: - if(entry->value.value.userdata.member) + if(entry->value.value.userdata.member) SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue, entry->value.value.userdata.lvalue, *(entry->value.value.userdata.ptype)); - else + else SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue, *(entry->value.value.userdata.ptype),0); break; @@ -502,7 +516,7 @@ SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L) } assert(lua_gettop(L) == 2); return 1; - + fail: lua_error(L); return 0; @@ -520,7 +534,7 @@ SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L) lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable); lua_rawset(L,-3); lua_pop(L,2); - + } /* END OF REMOVE */ @@ -819,6 +833,7 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i int bases_search_result; int substack_start = lua_gettop(L)-2; assert(first_arg == substack_start+1); + (void)first_arg; lua_checkstack(L,5); assert(lua_isuserdata(L,-2)); /* just in case */ lua_getmetatable(L,-2); /* get the meta table */ @@ -826,7 +841,7 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i /* NEW: looks for the __getitem() fn this is a user provided get fn */ SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ - if (lua_iscfunction(L,-1)) /* if its there */ + if (lua_iscfunction(L,-1)) /* if it's there */ { /* found it so call the fn & return its value */ lua_pushvalue(L,substack_start+1); /* the userdata */ lua_pushvalue(L,substack_start+2); /* the parameter */ @@ -857,6 +872,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW int bases_search_result; int substack_start = lua_gettop(L)-2; assert(first_arg == substack_start+1); + (void)first_arg; lua_checkstack(L,5); assert(lua_isuserdata(L,-2)); /* just in case */ lua_getmetatable(L,-2); /* get the meta table */ @@ -883,7 +899,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW lua_pushvalue(L,substack_start+2); /* key */ lua_rawget(L,-2); /* look for the fn */ lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ + if (lua_isfunction(L,-1)) /* note: if it's a C function or lua function */ { /* found it so return the fn & let lua call it */ lua_remove(L,-2); /* stack tidy, remove metatable */ if(ret) @@ -966,7 +982,7 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi /* NEW: looks for the __setitem() fn this is a user provided set fn */ SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ - if (lua_iscfunction(L,-1)) /* if its there */ + if (lua_iscfunction(L,-1)) /* if it's there */ { /* found it so call the fn & return its value */ lua_pushvalue(L,substack_start+1); /* the userdata */ lua_pushvalue(L,substack_start+2); /* the parameter */ @@ -1039,17 +1055,11 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L) { /* there should be 1 param passed in (1) userdata (not the metatable) */ - const char *className; - void* userData; + swig_lua_userdata* userData; assert(lua_isuserdata(L,1)); /* just in case */ - userData = lua_touserdata(L,1); /* get the userdata address for later */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ + userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */ - lua_getfield(L, -1, ".type"); - className = lua_tostring(L, -1); - - lua_pushfstring(L, "<%s userdata: %p>", className, userData); + lua_pushfstring(L, "", userData->type->str, userData->ptr); return 1; } @@ -1061,7 +1071,7 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L) swig_lua_userdata *usr; assert(lua_isuserdata(L,-1)); /* just in case */ usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - + usr->own = 0; /* clear our ownership */ return 0; } @@ -1170,7 +1180,7 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname) Each class structure has a list of pointers to the base class structures. This function fills them. It cannot be done at compile time, as this will not work with hireachies -spread over more than one swig file. +spread over more than one swig file. Therefore it must be done at runtime, querying the SWIG type system. */ SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss) @@ -1349,15 +1359,15 @@ SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_clas SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/ /* The real function that resolves a metamethod. - * Function searches given class and all it's bases(recursively) for first instance of something that is - * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation + * Function searches given class and all its bases (recursively) for first instance of something that is + * not equal to SWIG_Lua_resolve_metamethod. (Almost always this 'something' is actual metamethod implementation * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the * answer. * Returns 1 if found, 0 otherwise. * clss is class which metatable we will search for method * metamethod_name_idx is index in L where metamethod name (as string) lies - * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check - * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from + * skip_check allows skipping searching metamethod in the given class and immediately going to searching in bases. skip_check + * is not carried to subsequent recursive calls - false is always passed. It is set to true only at first call from * SWIG_Lua_resolve_metamethod * */ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx, @@ -1404,11 +1414,11 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L) lua_checkstack(L,5); numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */ - + /* Get upvalues from closure */ lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/ metamethod_name_idx = lua_gettop(L); - + lua_pushvalue(L, lua_upvalueindex(2)); clss = (const swig_lua_class*)(lua_touserdata(L,-1)); lua_pop(L,1); /* remove lightuserdata with clss from stack */ @@ -1440,7 +1450,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class * /* metamethod name - on the top of the stack */ assert(lua_isstring(L,-1)); - + key_index = lua_gettop(L); /* Check whether method is already defined in metatable */ @@ -1450,7 +1460,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class * lua_pop(L,1); return -1; } - lua_pop(L,1); + lua_pop(L,1); /* Iterating over immediate bases */ for(i=0;clss->bases[i];i++) @@ -1460,13 +1470,13 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class * lua_pushvalue(L, key_index); lua_rawget(L, -2); if( !lua_isnil(L,-1) ) { - lua_pushvalue(L, key_index); + lua_pushvalue(L, key_index); /* Add proxy function */ lua_pushvalue(L, key_index); /* first closure value is function name */ lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */ lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2); - + lua_rawset(L, metatable_index); success = 1; } @@ -1477,7 +1487,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class * break; } - return success; + return success; } SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss) @@ -1503,7 +1513,7 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class } } - lua_pop(L,1); /* remove inheritable metatmethods table */ + lua_pop(L,1); /* remove inheritable metamethods table */ /* Special handling for __tostring method */ lua_pushstring(L, "__tostring"); @@ -1763,6 +1773,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 */ @@ -1771,33 +1782,49 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type *ptr=0; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } + if (lua_islightuserdata(L,index)) + { + *ptr=lua_touserdata(L,index); + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ if (usr) { + 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, int argnum,const char *func_name){ - void *result; + void *result = 0; if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ luaL_error (L,"Error in %s, expected a %s at argument number %d\n", func_name,(type && type->str)?type->str:"void*",argnum); @@ -1816,7 +1843,7 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_t memcpy(raw->data,ptr,size); /* copy the data */ SWIG_Lua_AddMetatable(L,type); /* add metatable */ } - + /* converts a packed userdata. user for member fn pointers only */ SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type) { @@ -1915,7 +1942,7 @@ Unfortunately lua keeps changing its APIs, so we need a conditional compile In lua 5.0.X it's lua_dostring() In lua 5.1.X it's luaL_dostring() */ -SWIGINTERN int +SWIGINTERN int SWIG_Lua_dostring(lua_State *L, const char *str) { int ok,top; if (str==0 || str[0]==0) return 0; /* nothing to do */ @@ -1930,7 +1957,7 @@ SWIG_Lua_dostring(lua_State *L, const char *str) { } lua_settop(L,top); /* restore the stack */ return ok; -} +} #ifdef __cplusplus } diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/luaruntime.swg b/macx64/bin/swig/share/swig/4.3.0/lua/luaruntime.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/luaruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/lua/luaruntime.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/luatypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/lua/luatypemaps.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/lua/luatypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/lua/luatypemaps.swg index 8959f201..7d23917e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/luatypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/lua/luatypemaps.swg @@ -24,7 +24,7 @@ // additional check for unsigned numbers, to not permit negative input %typemap(in,checkfn="lua_isnumber") unsigned int, unsigned short, unsigned long, unsigned char -%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative") +%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative"); $1 = ($type)lua_tonumber(L, $input);%} %typemap(out) int,short,long, @@ -39,12 +39,12 @@ $1 = ($type)lua_tonumber(L, $input);%} // 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&($basetype temp) -%{ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%} +%typemap(in,checkfn="lua_isnumber") const int&($*1_ltype temp) +%{ temp=($*1_ltype)lua_tonumber(L,$input); $1=&temp;%} -%typemap(in,checkfn="lua_isnumber") const unsigned int&($basetype temp) -%{SWIG_contract_assert((lua_tonumber(L,$input)>=0),"number must not be negative") -temp=($basetype)lua_tonumber(L,$input); $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;%} %typemap(out) const int&, const unsigned int& %{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%} @@ -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 @@ -237,22 +243,22 @@ $1=($1_ltype)&temp;%} // therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written %typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*) %{ - if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($type),$descriptor))) + if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor))) SWIG_fail_ptr("$symname",$argnum,$descriptor); %} %typemap(out) SWIGTYPE (CLASS::*) -%{ - SWIG_NewMemberObj(L,(void*)(&$1),sizeof($type),$descriptor); SWIG_arg++; +%{ + SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++; %} // 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) -but if its an output, then it should be wrapped like any other SWIG object (using default typemap) +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* %{$1=($1_ltype)SWIG_MustGetPtr(L,$input,0,0,$argnum,"$symname");%} @@ -285,7 +291,7 @@ 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 its integral +// 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, @@ -396,7 +402,7 @@ parameters match which function * Specials * ----------------------------------------------------------------------------- */ // swig::LANGUAGE_OBJ was added to allow containers of native objects -// however its rather difficult to do this in lua, as you cannot hold pointers +// however it's rather difficult to do this in lua, as you cannot hold pointers // to native objects (they are held in the interpreter) // therefore for now: just ignoring this feature #ifdef __cplusplus diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_auto_ptr.i new file mode 100644 index 00000000..b3b71d0f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.3.0/lua/std_common.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_common.i new file mode 100644 index 00000000..cee11e8c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/lua/std_common.i @@ -0,0 +1,5 @@ +%include + +%apply size_t { std::size_t }; +%apply const size_t& { const std::size_t& }; + diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_except.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_map.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_map.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_map.i index 773b6d0c..19281ad7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/lua/std_map.i @@ -48,7 +48,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_string.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_string.i similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_string.i index b95a8a4a..795db71f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/lua/std_string.i @@ -43,19 +43,28 @@ but Similarly for getting the string $1 = (char*)lua_tostring(L, $input); becomes - $1.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); - -Not using: lua_tolstring() as this is only found in Lua 5.1 & not 5.0.2 + size_t len; + const char *ptr = lua_tolstring(L, $input, &len); + $1.assign(ptr, len); */ %typemap(in,checkfn="lua_isstring") string -%{$1.assign(lua_tostring(L,$input),lua_rawlen(L,$input));%} +{ + size_t len; + const char *ptr = lua_tolstring(L, $input, &len); + $1.assign(ptr, len); +} %typemap(out) string %{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} %typemap(in,checkfn="lua_isstring") const string& ($*1_ltype temp) -%{temp.assign(lua_tostring(L,$input),lua_rawlen(L,$input)); $1=&temp;%} +{ + size_t len; + const char *ptr = lua_tolstring(L, $input, &len); + temp.assign(ptr, len); + $1=&temp; +} %typemap(out) const string& %{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_string_view.i new file mode 100644 index 00000000..5c8b6367 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/lua/std_string_view.i @@ -0,0 +1,50 @@ +/* ----------------------------------------------------------------------------- + * std_string_view.i + * + * std::string_view typemaps for LUA + * ----------------------------------------------------------------------------- */ + +%{ +#include +%} + +namespace std { + +%naturalvar string_view; + +%typemap(in,checkfn="lua_isstring") string_view +{ + size_t len; + const char *ptr = lua_tolstring(L, $input, &len); + $1 = std::string_view(ptr, len); +} + +%typemap(out) string_view +%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_arg++;%} + +%typemap(in,checkfn="lua_isstring") const string_view& ($*1_ltype temp) +{ + size_t len; + const char *ptr = lua_tolstring(L, $input, &len); + temp = std::string_view(ptr, len); + $1=&temp; +} + +%typemap(out) const string_view& +%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_arg++;%} + +// for throwing of any kind of string_view, string_view ref's and string_view pointers +// we convert all to lua strings +%typemap(throws) string_view, string_view&, const string_view& +%{ lua_pushlstring(L,$1.data(),$1.size()); SWIG_fail;%} + +%typemap(throws) string_view*, const string_view* +%{ lua_pushlstring(L,$1->data(),$1->size()); SWIG_fail;%} + +%typecheck(SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view& { + $1 = lua_isstring(L,$input); +} + +class string_view; + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_unique_ptr.i new file mode 100644 index 00000000..6d2ed152 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/lua/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, checkfn="SWIG_isptrtype", noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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 *)); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, checkfn="SWIG_isptrtype", noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr(L, $input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + SWIG_fail_ptr("$symname", $argnum, $descriptor(TYPE *)); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + SWIG_NewPointerObj(L, $1->get(), $descriptor(TYPE *), $owner); SWIG_arg++; +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/lua/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/lua/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/stl.i b/macx64/bin/swig/share/swig/4.3.0/lua/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/stl.i rename to macx64/bin/swig/share/swig/4.3.0/lua/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/lua/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/lua/swigmove.i new file mode 100644 index 00000000..ae3c56a0 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/lua/swigmove.i @@ -0,0 +1,20 @@ +/* ----------------------------------------------------------------------------- + * 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); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/lua/typemaps.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/lua/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/lua/typemaps.i index 8392e5bf..68f6f6cc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/lua/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/lua/typemaps.i @@ -28,7 +28,7 @@ The basic code looks like this: However the code below is a mixture of #defines & such, so nowhere as easy to read -To make you code work correctly its not just a matter of %including this file +To make you code work correctly it's not just a matter of %including this file You also have to give SWIG the hints on which to use where eg @@ -77,7 +77,7 @@ SWIG_NUMBER_TYPEMAP(enum SWIGTYPE); // also for long longs's SWIG_NUMBER_TYPEMAP(long long); SWIG_NUMBER_TYPEMAP(unsigned long long); SWIG_NUMBER_TYPEMAP(signed long long); -// note we dont do char, as a char* is probably a string not a ptr to a single char +// note we don't do char, as a char* is probably a string not a ptr to a single char // similar for booleans %typemap(in,checkfn="lua_isboolean") bool *INPUT(bool temp), bool &INPUT(bool temp) @@ -188,16 +188,6 @@ int SWIG_read_NAME_num_array(lua_State* L,int index,TYPE *array,int size); */ -/* Reported that you don't need to check for NULL for delete & free -There probably is some compiler that its not true for, so the code is left here just in case. -#ifdef __cplusplus -#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN] -#define SWIG_FREE_ARRAY(PTR) if(PTR){delete[] PTR;} -#else -#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE)) -#define SWIG_FREE_ARRAY(PTR) if(PTR){free(PTR);} -#endif -*/ %{ #ifdef __cplusplus /* generic alloc/dealloc fns*/ #define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN] diff --git a/macx64/bin/swig/share/swig/4.0.0/lua/wchar.i b/macx64/bin/swig/share/swig/4.3.0/lua/wchar.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/lua/wchar.i rename to macx64/bin/swig/share/swig/4.3.0/lua/wchar.i diff --git a/macx64/bin/swig/share/swig/4.0.0/math.i b/macx64/bin/swig/share/swig/4.3.0/math.i similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/math.i rename to macx64/bin/swig/share/swig/4.3.0/math.i index a37c92d1..ac8d9a6e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/math.i +++ b/macx64/bin/swig/share/swig/4.3.0/math.i @@ -9,6 +9,8 @@ #include %} +#ifndef SWIGPHP /* PHP already provides all these functions except fabs() */ + extern double cos(double x); /* Cosine of x */ @@ -54,9 +56,6 @@ extern double pow(double x, double y); extern double sqrt(double x); /* Square root. x >= 0 */ -extern double fabs(double x); -/* Absolute value of x */ - extern double ceil(double x); /* Smallest integer not less than x, as a double */ @@ -66,6 +65,13 @@ extern double floor(double x); extern double fmod(double x, double y); /* Floating-point remainder of x/y, with the same sign as x. */ +#endif + +extern double fabs(double x); +/* Absolute value of x */ + +#ifndef SWIGPHP /* PHP already provides these constants and it's an error to redefine them */ + #define M_E 2.7182818284590452354 #define M_LOG2E 1.4426950408889634074 #define M_LOG10E 0.43429448190325182765 @@ -80,3 +86,4 @@ extern double fmod(double x, double y); #define M_SQRT2 1.41421356237309504880 #define M_SQRT1_2 0.70710678118654752440 +#endif diff --git a/macx64/bin/swig/share/swig/4.3.0/mzscheme/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/argcargv.i new file mode 100644 index 00000000..eec1e0d0 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/argcargv.i @@ -0,0 +1,41 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i, len; + Scheme_Object **elems; + SWIG_contract_assert($input != (Scheme_Object *)NULL && + $input != scheme_null && + SCHEME_TYPE($input) == scheme_vector_type, "null array"); + len = SCHEME_VEC_SIZE($input); + $1 = len; + $2 = ($2_ltype) SWIG_MzScheme_Malloc((size_t)(len+1)*sizeof($*2_ltype), FUNC_NAME); + elems = SCHEME_VEC_ELS($input); + for (i = 0; i < len; i++) { + SWIG_contract_assert(SCHEME_TYPE(elems[i]) == scheme_char_string_type, + "elements in array must be strings"); + $2[i] = ($*2_ltype)SCHEME_STR_VAL(elems[i]); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + if ($input != (Scheme_Object *)NULL && $input != scheme_null && + SCHEME_TYPE($input) == scheme_vector_type) { + size_t len = SCHEME_VEC_SIZE($input); + size_t i; + Scheme_Object **elems = SCHEME_VEC_ELS($input); + for (i = 0; i < len; i++) { + if (SCHEME_TYPE(elems[i]) != scheme_char_string_type) { + break; + } + } + /* All elements are strings! */ + $1 = (i == len); + } +} + +%typemap(freearg) (int ARGC, char **ARGV) { + SWIG_free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/mzscheme/cdata.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/cdata.i new file mode 100644 index 00000000..2c9bc421 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/cdata.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * + * TODO: + * Use generic cdata by deleting this file and implementing + * SWIG_AsCharPtrAndSize() and SWIG_FromCharPtrAndSize() + * Or implement (void *BYTES, size_t LENGTH) and SWIGCDATA typemaps + * ----------------------------------------------------------------------------- */ + +%typemap(in) (const void *BYTES, size_t LENGTH) {} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(out) SWIGCDATA "" + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/mzrun.swg b/macx64/bin/swig/share/swig/4.3.0/mzscheme/mzrun.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/mzrun.swg rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/mzrun.swg index c438c9ce..8adae46b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/mzrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/mzrun.swg @@ -23,12 +23,15 @@ extern "C" { SWIG_MzScheme_MustGetPtr(s, type, argnum, flags, FUNC_NAME, argc, argv) #define SWIG_contract_assert(expr,msg) \ - if (!(expr)) { \ - char *m=(char *) scheme_malloc(strlen(msg)+1000); \ - sprintf(m,"SWIG contract, assertion failed: function=%s, message=%s", \ - (char *) FUNC_NAME,(char *) msg); \ - scheme_signal_error(m); \ - } + do { \ + if (!(expr)) { \ + size_t len=strlen(msg)+1000; \ + char *m=(char *) scheme_malloc(len); \ + SWIG_snprintf2(m, len, "SWIG contract, assertion failed: function=%s, message=%s", \ + (char *) FUNC_NAME,(char *) msg); \ + scheme_signal_error(m); \ + } \ + } while (0) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_MzScheme_GetModule((Scheme_Env *)(clientdata)) @@ -123,6 +126,7 @@ struct swig_mz_proxy { Scheme_Type mztype; swig_type_info *type; void *object; + int own; }; static Scheme_Type swig_type; @@ -133,7 +137,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); } } @@ -141,42 +145,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 * @@ -195,7 +218,8 @@ SWIG_MzScheme_Malloc(size_t size, const char *func_name) { void *p = malloc(size); if (p == NULL) { scheme_signal_error("swig-memory-error"); - } else return p; + } + return p; } static Scheme_Object * @@ -398,10 +422,10 @@ SWIG_MzScheme_new_scheme_struct (Scheme_Env* env, const char* basename, int L=strlen(mz_dynload_libpaths[k])+strlen("\\")+strlen(mz_dlopen_libraries[i])+1; libp=(char *) malloc(L*sizeof(char)); #ifdef __OS_WIN32 - sprintf(libp,"%s\\%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]); + SWIG_snprintf2(libp,L,"%s\\%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]); mz_libraries[i]=(void *) LoadLibrary(libp); #else - sprintf(libp,"%s/%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]); + SWIG_snprintf2(libp,L,"%s/%s",mz_dynload_libpaths[k],mz_dlopen_libraries[i]); mz_libraries[i]=(void *) dlopen(libp,RTLD_LAZY); #endif if (mz_dynload_debug) { diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/mzscheme.swg b/macx64/bin/swig/share/swig/4.3.0/mzscheme/mzscheme.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/mzscheme.swg rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/mzscheme.swg index f45c8725..d5904d0e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/mzscheme.swg +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/mzscheme.swg @@ -10,9 +10,7 @@ %runtime "swigerrors.swg" // SWIG errors %runtime "mzrun.swg" -%define SWIG_APPEND_VALUE(value) - values[lenv++] = value -%enddef +#define SWIG_APPEND_VALUE(value) values[lenv++] = value /* Definitions */ #define SWIG_malloc(size) swig_malloc(size, FUNC_NAME) diff --git a/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_auto_ptr.i new file mode 100644 index 00000000..c61bc8b2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_common.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_map.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_map.i new file mode 100644 index 00000000..4d312f56 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_map.i @@ -0,0 +1,284 @@ +/* ----------------------------------------------------------------------------- + * std_map.i + * + * SWIG typemaps for std::map + * ----------------------------------------------------------------------------- */ + +%include +%include + +// ------------------------------------------------------------------------ +// std::map +// +// The aim of all that follows would be to integrate std::map with +// MzScheme as much as possible, namely, to allow the user to pass and +// be returned Scheme association lists. +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::map), f(const std::map&), f(const std::map*): +// the parameter being read-only, either a Scheme alist or a +// previously wrapped std::map can be passed. +// -- f(std::map&), f(std::map*): +// the parameter must be modified; therefore, only a wrapped std::map +// can be passed. +// -- std::map f(): +// the map is returned by copy; therefore, a Scheme alist +// is returned which is most easily used in other Scheme functions +// -- std::map& f(), std::map* f(), const std::map& f(), +// const std::map* f(): +// the map is returned by reference; therefore, a wrapped std::map +// is returned +// ------------------------------------------------------------------------ + +%{ +#include +#include +#include +%} + +// exported class + +namespace std { + + template > class map { + %typemap(in) map< K, T, C > (std::map< K, T, C >* m) { + if (SCHEME_NULLP($input)) { + $1 = std::map< K, T, C >(); + } else if (SCHEME_PAIRP($input)) { + $1 = std::map< K, T, C >(); + Scheme_Object* alist = $input; + while (!SCHEME_NULLP(alist)) { + K* k; + T* x; + Scheme_Object *entry, *key, *val; + entry = scheme_car(alist); + if (!SCHEME_PAIRP(entry)) + SWIG_exception(SWIG_TypeError,"alist expected"); + key = scheme_car(entry); + val = scheme_cdr(entry); + k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == -1) { + if (!SCHEME_PAIRP(val)) + SWIG_exception(SWIG_TypeError,"alist expected"); + val = scheme_car(val); + x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); + } +%#ifdef __cpp_lib_map_try_emplace + (($1_type &)$1).insert_or_assign(*k, *x); +%#else + (($1_type &)$1)[*k] = *x; +%#endif + alist = scheme_cdr(alist); + } + } else { + $1 = *(($&1_type) + SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); + } + } + %typemap(in) const map< K, T, C >& (std::map< K, T, C > temp, + std::map< K, T, C >* m), + const map< K, T, C >* (std::map< K, T, C > temp, + std::map< K, T, C >* m) { + if (SCHEME_NULLP($input)) { + temp = std::map< K, T, C >(); + $1 = &temp; + } else if (SCHEME_PAIRP($input)) { + temp = std::map< K, T, C >(); + $1 = &temp; + Scheme_Object* alist = $input; + while (!SCHEME_NULLP(alist)) { + K* k; + T* x; + Scheme_Object *entry, *key, *val; + entry = scheme_car(alist); + if (!SCHEME_PAIRP(entry)) + SWIG_exception(SWIG_TypeError,"alist expected"); + key = scheme_car(entry); + val = scheme_cdr(entry); + k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) == -1) { + if (!SCHEME_PAIRP(val)) + SWIG_exception(SWIG_TypeError,"alist expected"); + val = scheme_car(val); + x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0); + } +%#ifdef __cpp_lib_map_try_emplace + temp.insert_or_assign(*k, *x); +%#else + temp[*k] = *x; +%#endif + alist = scheme_cdr(alist); + } + } else { + $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0); + } + } + %typemap(out) map< K, T, C > { + Scheme_Object* alist = scheme_null; + for (std::map< K, T, C >::reverse_iterator i=$1.rbegin(); + i!=$1.rend(); ++i) { + K* key = new K(i->first); + T* val = new T(i->second); + Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); + Scheme_Object* x = SWIG_NewPointerObj(val,$descriptor(T *), 1); + Scheme_Object* entry = scheme_make_pair(k,x); + alist = scheme_make_pair(entry,alist); + } + $result = alist; + } + %typecheck(SWIG_TYPECHECK_MAP) map< K, T, C > { + /* native sequence? */ + if (SCHEME_NULLP($input)) { + /* an empty sequence can be of any type */ + $1 = 1; + } else if (SCHEME_PAIRP($input)) { + /* check the first element only */ + K* k; + T* x; + Scheme_Object* head = scheme_car($input); + if (SCHEME_PAIRP(head)) { + Scheme_Object* key = scheme_car(head); + Scheme_Object* val = scheme_cdr(head); + if (SWIG_ConvertPtr(key,(void**) &k, + $descriptor(K *), 0) == -1) { + $1 = 0; + } else { + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != -1) { + $1 = 1; + } else if (SCHEME_PAIRP(val)) { + val = scheme_car(val); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } else { + $1 = 0; + } + } + } else { + $1 = 0; + } + } else { + /* wrapped map? */ + std::map< K, T, C >* m; + if (SWIG_ConvertPtr($input,(void **) &m, + $&1_descriptor, 0) != -1) + $1 = 1; + else + $1 = 0; + } + } + %typecheck(SWIG_TYPECHECK_MAP) const map< K, T, C >&, + const map< K, T, C >* { + /* native sequence? */ + if (SCHEME_NULLP($input)) { + /* an empty sequence can be of any type */ + $1 = 1; + } else if (SCHEME_PAIRP($input)) { + /* check the first element only */ + K* k; + T* x; + Scheme_Object* head = scheme_car($input); + if (SCHEME_PAIRP(head)) { + Scheme_Object* key = scheme_car(head); + Scheme_Object* val = scheme_cdr(head); + if (SWIG_ConvertPtr(key,(void**) &k, + $descriptor(K *), 0) == -1) { + $1 = 0; + } else { + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != -1) { + $1 = 1; + } else if (SCHEME_PAIRP(val)) { + val = scheme_car(val); + if (SWIG_ConvertPtr(val,(void**) &x, + $descriptor(T *), 0) != -1) + $1 = 1; + else + $1 = 0; + } else { + $1 = 0; + } + } + } else { + $1 = 0; + } + } else { + /* wrapped map? */ + std::map< K, T, C >* m; + if (SWIG_ConvertPtr($input,(void **) &m, + $1_descriptor, 0) != -1) + $1 = 1; + else + $1 = 0; + } + } + %rename("length") size; + %rename("null?") empty; + %rename("clear!") clear; + %rename("ref") __getitem__; + %rename("set!") __setitem__; + %rename("delete!") __delitem__; + %rename("has-key?") has_key; + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + map(); + map(const map& other); + + unsigned int size() const; + bool empty() const; + void clear(); + %extend { + T& __getitem__(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + void __setitem__(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else + (*self)[key] = x; +%#endif + } + void __delitem__(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + bool has_key(const K& key) { + std::map< K, T, C >::iterator i = self->find(key); + return i != self->end(); + } + Scheme_Object* keys() { + Scheme_Object* result = scheme_null; + for (std::map< K, T, C >::reverse_iterator i=self->rbegin(); + i!=self->rend(); ++i) { + K* key = new K(i->first); + Scheme_Object* k = SWIG_NewPointerObj(key,$descriptor(K *), 1); + result = scheme_make_pair(k,result); + } + return result; + } + } + }; + +} diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_string.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_string.i similarity index 87% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/std_string.i index b19e8567..70673ead 100644 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_unique_ptr.i new file mode 100644 index 00000000..8263e607 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_vector.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/std_vector.i index 0ef5edb1..ae886b7b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/std_vector.i @@ -421,6 +421,9 @@ namespace std { } }; %enddef + %typemap(throws) std::out_of_range { + scheme_signal_error("%s: %s", FUNC_NAME, $1.what()); + } specialize_std_vector(bool,SCHEME_BOOLP,SCHEME_TRUEP,\ swig_make_boolean); diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/stl.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/stl.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/mzscheme/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/swigmove.i new file mode 100644 index 00000000..076f7170 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/mzscheme/swigmove.i @@ -0,0 +1,21 @@ +/* ----------------------------------------------------------------------------- + * 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); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/mzscheme/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/mzscheme/typemaps.i similarity index 83% rename from macx64/bin/swig/share/swig/4.0.0/mzscheme/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/mzscheme/typemaps.i index 09bda2cc..04db8fa7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/mzscheme/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.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 @@ -187,8 +207,6 @@ s = C_TO_MZ(*$1); SWIG_APPEND_VALUE(s); } -%typemap(in) C_NAME *BOTH = C_NAME *INPUT; -%typemap(argout) C_NAME *BOTH = C_NAME *OUTPUT; %typemap(in) C_NAME *INOUT = C_NAME *INPUT; %typemap(argout) C_NAME *INOUT = C_NAME *OUTPUT; %enddef @@ -220,19 +238,6 @@ SIMPLE_MAP(float, SCHEME_REALP, scheme_real_to_double, SIMPLE_MAP(double, SCHEME_REALP, scheme_real_to_double, scheme_make_double, real); -SIMPLE_MAP(char *, SCHEME_STRINGP, SCHEME_STR_VAL, - SCHEME_MAKE_STRING, string); -SIMPLE_MAP(const char *, SCHEME_STRINGP, SCHEME_STR_VAL, - SCHEME_MAKE_STRING, string); - -/* For MzScheme 30x: Use these typemaps if you are not going to use - UTF8 encodings in your C code. - SIMPLE_MAP(char *,SCHEME_BYTE_STRINGP, SCHEME_BYTE_STR_VAL, - scheme_make_byte_string_without_copying,bytestring); - SIMPLE_MAP(const char *,SCHEME_BYTE_STRINGP, SCHEME_BYTE_STR_VAL, - scheme_make_byte_string_without_copying,bytestring); -*/ - /* Const primitive references. Passed by value */ %define REF_MAP(C_NAME, MZ_PREDICATE, MZ_TO_C, C_TO_MZ, MZ_NAME) @@ -270,14 +275,47 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double, REF_MAP(double, SCHEME_REALP, scheme_real_to_double, scheme_make_double, real); + +%typemap(in) char * { + if (SCHEME_STRINGP($input)) { + $1 = SCHEME_STR_VAL($input); + } else if (SCHEME_NULLP($input)) { + $1 = NULL; + } else { + scheme_wrong_type(FUNC_NAME, "string", $argnum - 1, argc, argv); + } +} + +%typemap(varin) char * { + if (SCHEME_STRINGP($input)) { + $1 = SCHEME_STR_VAL($input); + } else if (SCHEME_NULLP($input)) { + $1 = NULL; + } else { + scheme_wrong_type(FUNC_NAME, "string", 0, argc, argv); + } +} + +%typemap(out) char * { + $result = SCHEME_MAKE_STRING($1); +} + +%typemap(varout) char * { + $result = SCHEME_MAKE_STRING($1); +} + +%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 +329,6 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double, // $2 = ($2_ltype) temp; //} - /* ------------------------------------------------------------ * Typechecking rules * ------------------------------------------------------------ */ diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/carray.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/carray.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/carray.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/carray.i index 5e74c3da..71631aab 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/carray.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/carray.i @@ -77,7 +77,7 @@ type _value = c_obj %typemap(out) SWIGTYPE [] { int i; - CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); + const value *fromval = caml_named_value("create_$ntype_from_ptr"); $result = caml_array_new($1_dim0); for( i = 0; i < $1_dim0; i++ ) { diff --git a/macx64/bin/swig/share/swig/4.3.0/ocaml/cdata.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/cdata.i new file mode 100644 index 00000000..a2456e62 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/cdata.i @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * + * TODO: Need to test with li_cdata_cpp and li_cdata + * ----------------------------------------------------------------------------- */ + +%typemap(in) (const void *BYTES, size_t LENGTH) { + $1 = ($1_ltype) caml_string_val($input); + $2 = ($2_ltype) caml_string_len($input); +} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(out) SWIGCDATA %{ caml_val_string_len($1.data,$1.len); %} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/class.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/class.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/class.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/class.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/cstring.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/cstring.i similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/cstring.i index f1190ad5..cf588edd 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/cstring.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/cstring.i @@ -25,13 +25,13 @@ * * %cstring_bounded_output(char *outx, 512); * void foo(char *outx) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } * */ %define %cstring_bounded_output(TYPEMAP,MAX) -%typemap(ignore) TYPEMAP(char temp[MAX+1]) { +%typemap(in,numinputs=0) TYPEMAP(char temp[MAX+1]) { $1 = ($1_ltype) temp; } %typemap(argout) TYPEMAP { @@ -54,7 +54,7 @@ */ %define %cstring_chunk_output(TYPEMAP,SIZE) -%typemap(ignore) TYPEMAP(char temp[SIZE]) { +%typemap(in,numinputs=0) TYPEMAP(char temp[SIZE]) { $1 = ($1_ltype) temp; } %typemap(argout) TYPEMAP { @@ -144,7 +144,7 @@ * * %cstring_output_maxsize(char *outx, int max) { * void foo(char *outx, int max) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } */ @@ -175,7 +175,7 @@ * * %cstring_output_maxsize(char *outx, int *max) { * void foo(char *outx, int *max) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * *max = strlen(outx); * } */ @@ -210,15 +210,15 @@ * This macro is used to return character data that was * allocated with new or malloc. * - * %cstring_output_allocated(char **outx, free($1)); + * %cstring_output_allocate(char **outx, free(*$1)); * void foo(char **outx) { * *outx = (char *) malloc(512); - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } */ %define %cstring_output_allocate(TYPEMAP, RELEASE) -%typemap(ignore) TYPEMAP($*1_ltype temp = 0) { +%typemap(in,numinputs=0) TYPEMAP($*1_ltype temp = 0) { $1 = &temp; } @@ -238,16 +238,16 @@ * This macro is used to return character data that was * allocated with new or malloc. * - * %cstring_output_allocated(char **outx, int *sz, free($1)); + * %cstring_output_allocate_size(char **outx, int *sz, free(*$1)); * void foo(char **outx, int *sz) { * *outx = (char *) malloc(512); - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * *sz = strlen(outx); * } */ %define %cstring_output_allocate_size(TYPEMAP, SIZE, RELEASE) -%typemap(ignore) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) { +%typemap(in,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn) { $1 = &temp; $2 = &tempn; } diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/director.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/director.swg similarity index 80% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/director.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/director.swg index eb91aaf4..0ba2a22e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/director.swg @@ -49,31 +49,17 @@ namespace Swig { } }; - /* simple thread abstraction for pthreads on win32 */ -#ifdef __THREAD__ -#define __PTHREAD__ -#if defined(_WIN32) || defined(__WIN32__) -#define pthread_mutex_lock EnterCriticalSection -#define pthread_mutex_unlock LeaveCriticalSection -#define pthread_mutex_t CRITICAL_SECTION -#define MUTEX_INIT(var) CRITICAL_SECTION var -#else -#include -#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER -#endif -#endif - /* director base class */ class Director { private: /* pointer to the wrapped ocaml object */ - CAML_VALUE swig_self; + value swig_self; /* flag indicating whether the object is owned by ocaml or c++ */ mutable bool swig_disown_flag; public: /* wrap a ocaml object. */ - Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) { + Director(value self) : swig_self(self), swig_disown_flag(false) { caml_register_global_root(&swig_self); } @@ -85,7 +71,7 @@ namespace Swig { } /* return a pointer to the wrapped ocaml object */ - CAML_VALUE swig_get_self() const { + value swig_get_self() const { return swig_self; } diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.i similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.i index 96a36c8b..cc26d185 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.i @@ -8,7 +8,7 @@ %insert(runtime) "swigrun.swg" /* Include headers */ -%insert(runtime) "ocamldec.swg" +%insert(runtime) "ocamlrundec.swg" /* Type registration */ %insert(init) "swiginit.swg" @@ -28,18 +28,14 @@ %} /*#ifndef SWIG_NOINCLUDE*/ -%insert(runtime) "ocaml.swg" +%insert(runtime) "ocamlrun.swg" /*#endif*/ %insert(classtemplate) "class.swg" -/* Definitions */ -#define SWIG_malloc(size) swig_malloc(size, FUNC_NAME) -#define SWIG_free(mem) free(mem) - /* Read in standard typemaps. */ %include -%include +%include %include %include %include diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.swg index 23e2955f..ce66c1da 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocaml.swg @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * typemaps.i + * ocaml.swg * * The Ocaml module handles all types uniformly via typemaps. Here * are the definitions. @@ -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)); @@ -62,7 +63,7 @@ #if 0 %typemap(argout) SWIGTYPE & { - CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); + const value *fromval = caml_named_value("create_$ntype_from_ptr"); if( fromval ) { swig_result = caml_list_append(swig_result, @@ -75,7 +76,7 @@ } } %typemap(argout) SWIGTYPE && { - CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); + const value *fromval = caml_named_value("create_$ntype_from_ptr"); if( fromval ) { swig_result = caml_list_append(swig_result, @@ -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); } @@ -142,13 +151,6 @@ %typemap(directorout) C_NAME { $1 = OCAML_TO_C($input); } -%typemap(in) C_NAME *INPUT ($*1_ltype temp) { - temp = ($*1_ltype) OCAML_TO_C($input); - $1 = &temp; -} -%typemap(in,numinputs=0) C_NAME *OUTPUT ($*1_ltype temp) { - $1 = &temp; -} /* Out */ %typemap(out) C_NAME { $result = C_TO_OCAML($1); @@ -159,9 +161,6 @@ %typemap(varout) const C_NAME & { $result = C_TO_OCAML($1); } -%typemap(argout) C_NAME *OUTPUT { - swig_result = caml_list_append(swig_result, C_TO_OCAML((long)*$1)); -} %typemap(out) const C_NAME & { $result = C_TO_OCAML(*$1); } @@ -190,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) value "$1=$input;" +%typemap (out) value "$result=$1;" #if 0 %include @@ -300,6 +299,8 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val); %swig_enum_out(varout) %swig_enum_out(directorin) +/* String & length typemap */ + %typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) { $1 = ($1_ltype) caml_string_val($input); $2 = ($2_ltype) caml_string_len($input); @@ -312,7 +313,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/macx64/bin/swig/share/swig/4.0.0/ocaml/ocamlkw.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlkw.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/ocamlkw.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlkw.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrun.swg similarity index 57% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrun.swg index 3d552cc5..95350eac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/ocaml.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrun.swg @@ -91,20 +91,20 @@ extern "C" { } } - SWIGINTERN void caml_print_list( CAML_VALUE v ); + SWIGINTERN void caml_print_list( value v ); - SWIGINTERN void caml_print_val( CAML_VALUE v ) { - switch( SWIG_Tag_val(v) ) { + SWIGINTERN void caml_print_val( value v ) { + switch( Tag_val(v) ) { case C_bool: - if( Bool_val(SWIG_Field(v,0)) ) fprintf( stderr, "true " ); + if( Bool_val(Field(v,0)) ) fprintf( stderr, "true " ); else fprintf( stderr, "false " ); break; case C_char: case C_uchar: fprintf( stderr, "'%c' (\\%03d) ", - (Int_val(SWIG_Field(v,0)) >= ' ' && - Int_val(SWIG_Field(v,0)) < 127) ? Int_val(SWIG_Field(v,0)) : '.', - Int_val(SWIG_Field(v,0)) ); + (Int_val(Field(v,0)) >= ' ' && + Int_val(Field(v,0)) < 127) ? Int_val(Field(v,0)) : '.', + Int_val(Field(v,0)) ); break; case C_short: case C_ushort: @@ -127,7 +127,7 @@ extern "C" { case C_ptr: { void *vout = 0; - swig_type_info *ty = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1)); + swig_type_info *ty = (swig_type_info *)(long)Int64_val(Field(v,1)); caml_ptr_val_internal(v,&vout,0); fprintf( stderr, "PTR(%p,%s) ", vout, @@ -137,15 +137,15 @@ extern "C" { case C_array: { unsigned int i; - for( i = 0; i < Wosize_val( SWIG_Field(v,0) ); i++ ) - caml_print_val( SWIG_Field(SWIG_Field(v,0),i) ); + for( i = 0; i < Wosize_val( Field(v,0) ); i++ ) + caml_print_val( Field(Field(v,0),i) ); } break; case C_list: - caml_print_list( SWIG_Field(v,0) ); + caml_print_list( Field(v,0) ); break; case C_obj: - fprintf( stderr, "OBJ(%p) ", (void *)SWIG_Field(v,0) ); + fprintf( stderr, "OBJ(%p) ", (void *)Field(v,0) ); break; case C_string: { @@ -157,30 +157,30 @@ extern "C" { } } - SWIGINTERN void caml_print_list( CAML_VALUE v ) { + SWIGINTERN void caml_print_list( value v ) { CAMLparam1(v); while( v && Is_block(v) ) { fprintf( stderr, "[ " ); - caml_print_val( SWIG_Field(v,0) ); + caml_print_val( Field(v,0) ); fprintf( stderr, "]\n" ); - v = SWIG_Field(v,1); + v = Field(v,1); } CAMLreturn0; } - SWIGINTERN CAML_VALUE caml_list_nth( CAML_VALUE lst, int n ) { + SWIGINTERN value caml_list_nth( value lst, int n ) { CAMLparam1(lst); int i = 0; while( i < n && lst && Is_block(lst) ) { - i++; lst = SWIG_Field(lst,1); + i++; lst = Field(lst,1); } if( lst == Val_unit ) CAMLreturn(Val_unit); - else CAMLreturn(SWIG_Field(lst,0)); + else CAMLreturn(Field(lst,0)); } - SWIGINTERN CAML_VALUE caml_list_append( CAML_VALUE lst, CAML_VALUE elt ) { + SWIGINTERN value caml_list_append( value lst, value elt ) { CAMLparam2(lst,elt); - SWIG_CAMLlocal3(v,vt,lh); + CAMLlocal3(v,vt,lh); lh = Val_unit; v = Val_unit; @@ -190,224 +190,224 @@ extern "C" { while( lst && Is_block(lst) ) { if( v && v != Val_unit ) { vt = caml_alloc_tuple(2); - SWIG_Store_field(v,1,vt); + Store_field(v,1,vt); v = vt; } else { v = lh = caml_alloc_tuple(2); } - SWIG_Store_field(v,0,SWIG_Field(lst,0)); - lst = SWIG_Field(lst,1); + Store_field(v,0,Field(lst,0)); + lst = Field(lst,1); } if( v && Is_block(v) ) { vt = caml_alloc_tuple(2); - SWIG_Store_field(v,1,vt); + Store_field(v,1,vt); v = vt; } else { v = lh = caml_alloc_tuple(2); } - SWIG_Store_field(v,0,elt); - SWIG_Store_field(v,1,Val_unit); + Store_field(v,0,elt); + Store_field(v,1,Val_unit); CAMLreturn(lh); } - SWIGINTERN int caml_list_length( CAML_VALUE lst ) { + SWIGINTERN int caml_list_length( value lst ) { CAMLparam1(lst); int i = 0; - while( lst && Is_block(lst) ) { i++; lst = SWIG_Field(lst,1); } + while( lst && Is_block(lst) ) { i++; lst = Field(lst,1); } CAMLreturn(i); } - SWIGINTERN void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ) { + SWIGINTERN void caml_array_set( value arr, int n, value item ) { CAMLparam2(arr,item); - SWIG_Store_field(SWIG_Field(arr,0),n,item); + Store_field(Field(arr,0),n,item); CAMLreturn0; } - SWIGINTERN value caml_array_nth( CAML_VALUE arr, int n ) { + SWIGINTERN value caml_array_nth( value arr, int n ) { CAMLparam1(arr); - if( SWIG_Tag_val(arr) == C_array ) - CAMLreturn(SWIG_Field(SWIG_Field(arr,0),n)); - else if( SWIG_Tag_val(arr) == C_list ) + if( Tag_val(arr) == C_array ) + CAMLreturn(Field(Field(arr,0),n)); + else if( Tag_val(arr) == C_list ) CAMLreturn(caml_list_nth(arr,0)); else caml_failwith("Need array or list"); } - SWIGINTERN int caml_array_len( CAML_VALUE arr ) { + SWIGINTERN int caml_array_len( value arr ) { CAMLparam1(arr); - if( SWIG_Tag_val(arr) == C_array ) - CAMLreturn(Wosize_val(SWIG_Field(arr,0))); - else if( SWIG_Tag_val(arr) == C_list ) + if( Tag_val(arr) == C_array ) + CAMLreturn(Wosize_val(Field(arr,0))); + else if( Tag_val(arr) == C_list ) CAMLreturn(caml_list_length(arr)); else caml_failwith("Need array or list"); } - SWIGINTERN CAML_VALUE caml_swig_alloc(int x,int y) { + SWIGINTERN value caml_swig_alloc(int x,int y) { return caml_alloc(x,y); } SWIGINTERN value caml_array_new( int n ) { CAMLparam0(); - SWIG_CAMLlocal1(vv); + CAMLlocal1(vv); vv = caml_swig_alloc(1,C_array); - SWIG_Store_field(vv,0,caml_alloc_tuple(n)); + Store_field(vv,0,caml_alloc_tuple(n)); CAMLreturn(vv); } - SWIGINTERN CAML_VALUE caml_val_bool( int b ) { + SWIGINTERN value caml_val_bool( int b ) { CAMLparam0(); - SWIG_CAMLlocal1(bv); + CAMLlocal1(bv); bv = caml_swig_alloc(1,C_bool); - SWIG_Store_field(bv,0,Val_bool(b)); + Store_field(bv,0,Val_bool(b)); CAMLreturn(bv); } - SWIGINTERN CAML_VALUE caml_val_char( char c ) { + SWIGINTERN value caml_val_char( char c ) { CAMLparam0(); - SWIG_CAMLlocal1(cv); + CAMLlocal1(cv); cv = caml_swig_alloc(1,C_char); - SWIG_Store_field(cv,0,Val_int(c)); + Store_field(cv,0,Val_int(c)); CAMLreturn(cv); } - SWIGINTERN CAML_VALUE caml_val_uchar( unsigned char uc ) { + SWIGINTERN value caml_val_uchar( unsigned char uc ) { CAMLparam0(); - SWIG_CAMLlocal1(ucv); + CAMLlocal1(ucv); ucv = caml_swig_alloc(1,C_uchar); - SWIG_Store_field(ucv,0,Val_int(uc)); + Store_field(ucv,0,Val_int(uc)); CAMLreturn(ucv); } - SWIGINTERN CAML_VALUE caml_val_short( short s ) { + SWIGINTERN value caml_val_short( short s ) { CAMLparam0(); - SWIG_CAMLlocal1(sv); + CAMLlocal1(sv); sv = caml_swig_alloc(1,C_short); - SWIG_Store_field(sv,0,Val_int(s)); + Store_field(sv,0,Val_int(s)); CAMLreturn(sv); } - SWIGINTERN CAML_VALUE caml_val_ushort( unsigned short us ) { + SWIGINTERN value caml_val_ushort( unsigned short us ) { CAMLparam0(); - SWIG_CAMLlocal1(usv); + CAMLlocal1(usv); usv = caml_swig_alloc(1,C_ushort); - SWIG_Store_field(usv,0,Val_int(us)); + Store_field(usv,0,Val_int(us)); CAMLreturn(usv); } - SWIGINTERN CAML_VALUE caml_val_int( int i ) { + SWIGINTERN value caml_val_int( int i ) { CAMLparam0(); - SWIG_CAMLlocal1(iv); + CAMLlocal1(iv); iv = caml_swig_alloc(1,C_int); - SWIG_Store_field(iv,0,Val_int(i)); + Store_field(iv,0,Val_int(i)); CAMLreturn(iv); } - SWIGINTERN CAML_VALUE caml_val_uint( unsigned int ui ) { + SWIGINTERN value caml_val_uint( unsigned int ui ) { CAMLparam0(); - SWIG_CAMLlocal1(uiv); + CAMLlocal1(uiv); uiv = caml_swig_alloc(1,C_int); - SWIG_Store_field(uiv,0,Val_int(ui)); + Store_field(uiv,0,Val_int(ui)); CAMLreturn(uiv); } - SWIGINTERN CAML_VALUE caml_val_long( long l ) { + SWIGINTERN value caml_val_long( long l ) { CAMLparam0(); - SWIG_CAMLlocal1(lv); + CAMLlocal1(lv); lv = caml_swig_alloc(1,C_int64); - SWIG_Store_field(lv,0,caml_copy_int64(l)); + Store_field(lv,0,caml_copy_int64(l)); CAMLreturn(lv); } - SWIGINTERN CAML_VALUE caml_val_ulong( unsigned long ul ) { + SWIGINTERN value caml_val_ulong( unsigned long ul ) { CAMLparam0(); - SWIG_CAMLlocal1(ulv); + CAMLlocal1(ulv); ulv = caml_swig_alloc(1,C_int64); - SWIG_Store_field(ulv,0,caml_copy_int64(ul)); + Store_field(ulv,0,caml_copy_int64(ul)); CAMLreturn(ulv); } - SWIGINTERN CAML_VALUE caml_val_float( float f ) { + SWIGINTERN value caml_val_float( float f ) { CAMLparam0(); - SWIG_CAMLlocal1(fv); + CAMLlocal1(fv); fv = caml_swig_alloc(1,C_float); - SWIG_Store_field(fv,0,caml_copy_double((double)f)); + Store_field(fv,0,caml_copy_double((double)f)); CAMLreturn(fv); } - SWIGINTERN CAML_VALUE caml_val_double( double d ) { + SWIGINTERN value caml_val_double( double d ) { CAMLparam0(); - SWIG_CAMLlocal1(fv); + CAMLlocal1(fv); fv = caml_swig_alloc(1,C_double); - SWIG_Store_field(fv,0,caml_copy_double(d)); + Store_field(fv,0,caml_copy_double(d)); CAMLreturn(fv); } - SWIGINTERN CAML_VALUE caml_val_ptr( void *p, swig_type_info *info ) { + SWIGINTERN value caml_val_ptr( void *p, swig_type_info *info ) { CAMLparam0(); - SWIG_CAMLlocal1(vv); + CAMLlocal1(vv); vv = caml_swig_alloc(2,C_ptr); - SWIG_Store_field(vv,0,caml_copy_int64((long)p)); - SWIG_Store_field(vv,1,caml_copy_int64((long)info)); + Store_field(vv,0,caml_copy_int64((long)p)); + Store_field(vv,1,caml_copy_int64((long)info)); CAMLreturn(vv); } - SWIGINTERN CAML_VALUE caml_val_string( const char *p ) { + SWIGINTERN value caml_val_string( const char *p ) { CAMLparam0(); - SWIG_CAMLlocal1(vv); + CAMLlocal1(vv); if( !p ) CAMLreturn(caml_val_ptr( (void *)p, 0 )); vv = caml_swig_alloc(1,C_string); - SWIG_Store_field(vv,0,caml_copy_string(p)); + Store_field(vv,0,caml_copy_string(p)); CAMLreturn(vv); } - SWIGINTERN CAML_VALUE caml_val_string_len( const char *p, int len ) { + SWIGINTERN value caml_val_string_len( const char *p, int len ) { CAMLparam0(); - SWIG_CAMLlocal1(vv); + CAMLlocal1(vv); if( !p || len < 0 ) CAMLreturn(caml_val_ptr( (void *)p, 0 )); vv = caml_swig_alloc(1,C_string); - SWIG_Store_field(vv,0,caml_alloc_string(len)); - memcpy(String_val(SWIG_Field(vv,0)),p,len); + Store_field(vv,0,caml_alloc_string(len)); + memcpy(Bp_val(Field(vv,0)),p,len); CAMLreturn(vv); } #define caml_val_obj(v, name) caml_val_obj_helper(v, SWIG_TypeQuery((name)), name) - SWIGINTERN CAML_VALUE caml_val_obj_helper( void *v, swig_type_info *type, char *name) { + SWIGINTERN value caml_val_obj_helper( void *v, swig_type_info *type, char *name) { CAMLparam0(); CAMLreturn(caml_callback2(*caml_named_value("caml_create_object_fn"), caml_val_ptr(v,type), caml_copy_string(name))); } - SWIGINTERN long caml_long_val_full( CAML_VALUE v, const char *name ) { + SWIGINTERN long caml_long_val_full( value v, const char *name ) { CAMLparam1(v); if( !Is_block(v) ) return 0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_bool: case C_char: case C_uchar: case C_short: case C_ushort: case C_int: - CAMLreturn(Int_val(SWIG_Field(v,0))); + CAMLreturn(Int_val(Field(v,0))); case C_uint: case C_int32: - CAMLreturn(Int32_val(SWIG_Field(v,0))); + CAMLreturn(Int32_val(Field(v,0))); case C_int64: - CAMLreturn((long)SWIG_Int64_val(SWIG_Field(v,0))); + CAMLreturn((long)Int64_val(Field(v,0))); case C_float: case C_double: - CAMLreturn((long)Double_val(SWIG_Field(v,0))); + CAMLreturn((long)Double_val(Field(v,0))); case C_string: - CAMLreturn((long)String_val(SWIG_Field(v,0))); + CAMLreturn((long)String_val(Field(v,0))); case C_ptr: - CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0))); + CAMLreturn((long)Int64_val(Field(Field(v,0),0))); case C_enum: { - SWIG_CAMLlocal1(ret); - CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int"); + CAMLlocal1(ret); + const value *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int"); if( !name ) caml_failwith( "Not an enum conversion" ); ret = caml_callback2(*enum_to_int,*caml_named_value(name),v); CAMLreturn(caml_long_val(ret)); @@ -417,100 +417,100 @@ extern "C" { } } - SWIGINTERN long caml_long_val( CAML_VALUE v ) { + SWIGINTERN long caml_long_val( value v ) { return caml_long_val_full(v,0); } - SWIGINTERN double caml_double_val( CAML_VALUE v ) { + SWIGINTERN double caml_double_val( value v ) { CAMLparam1(v); if( !Is_block(v) ) return 0.0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_bool: case C_char: case C_uchar: case C_short: case C_ushort: case C_int: - CAMLreturn_type(Int_val(SWIG_Field(v,0))); + CAMLreturnT(double, Int_val(Field(v,0))); case C_uint: case C_int32: - CAMLreturn_type(Int32_val(SWIG_Field(v,0))); + CAMLreturnT(double, Int32_val(Field(v,0))); case C_int64: - CAMLreturn_type(SWIG_Int64_val(SWIG_Field(v,0))); + CAMLreturnT(double, Int64_val(Field(v,0))); case C_float: case C_double: - CAMLreturn_type(Double_val(SWIG_Field(v,0))); + CAMLreturnT(double, Double_val(Field(v,0))); default: - fprintf( stderr, "Unknown block tag %d\n", SWIG_Tag_val(v) ); + fprintf( stderr, "Unknown block tag %d\n", Tag_val(v) ); caml_failwith("No conversion to double"); } } - SWIGINTERN int caml_ptr_val_internal( CAML_VALUE v, void **out, + SWIGINTERN int caml_ptr_val_internal( value v, void **out, swig_type_info *descriptor ) { CAMLparam1(v); void *outptr = NULL; swig_type_info *outdescr = NULL; - static CAML_VALUE *func_val = NULL; + static const value *func_val = NULL; if( v == Val_unit ) { *out = 0; - CAMLreturn_type(0); + CAMLreturnT(int, 0); } if( !Is_block(v) ) return -1; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_obj: if (!func_val) { func_val = caml_named_value("caml_obj_ptr"); } - CAMLreturn_type(caml_ptr_val_internal(caml_callback(*func_val, v), out, descriptor)); + CAMLreturnT(int, caml_ptr_val_internal(caml_callback(*func_val, v), out, descriptor)); case C_string: - outptr = (void *)String_val(SWIG_Field(v,0)); + outptr = (void *)String_val(Field(v,0)); break; case C_ptr: - outptr = (void *)(long)SWIG_Int64_val(SWIG_Field(v,0)); - outdescr = (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field(v,1)); + outptr = (void *)(long)Int64_val(Field(v,0)); + outdescr = (swig_type_info *)(long)Int64_val(Field(v,1)); break; default: *out = 0; - CAMLreturn_type(1); + CAMLreturnT(int, 1); break; } - CAMLreturn_type(SWIG_GetPtr(outptr, out, outdescr, descriptor)); + CAMLreturnT(int, SWIG_GetPtr(outptr, out, outdescr, descriptor)); } - SWIGINTERN void *caml_ptr_val( CAML_VALUE v, swig_type_info *descriptor ) { + SWIGINTERN void *caml_ptr_val( value v, swig_type_info *descriptor ) { CAMLparam0(); #ifdef TYPE_CAST_VERBOSE caml_print_val( v ); #endif void *out = NULL; if( !caml_ptr_val_internal( v, &out, descriptor ) ) - CAMLreturn_type(out); + CAMLreturnT(void*, out); else caml_failwith( "No appropriate conversion found." ); } - SWIGINTERN char *caml_string_val( CAML_VALUE v ) { + SWIGINTERN char *caml_string_val( value v ) { return (char *)caml_ptr_val( v, 0 ); } - SWIGINTERN int caml_string_len( CAML_VALUE v ) { - switch( SWIG_Tag_val(v) ) { + SWIGINTERN int caml_string_len( value v ) { + switch( Tag_val(v) ) { case C_string: - return caml_string_length(SWIG_Field(v,0)); + return caml_string_length(Field(v,0)); default: return strlen((char *)caml_ptr_val(v,0)); } } - SWIGINTERN int caml_bool_check( CAML_VALUE v ) { + SWIGINTERN int caml_bool_check( value v ) { CAMLparam1(v); if( !Is_block(v) ) return 0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_bool: case C_ptr: case C_string: @@ -520,12 +520,12 @@ extern "C" { } } - SWIGINTERN int caml_int_check( CAML_VALUE v ) { + SWIGINTERN int caml_int_check( value v ) { CAMLparam1(v); if( !Is_block(v) ) return 0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_char: case C_uchar: case C_short: @@ -541,11 +541,11 @@ extern "C" { } } - SWIGINTERN int caml_float_check( CAML_VALUE v ) { + SWIGINTERN int caml_float_check( value v ) { CAMLparam1(v); if( !Is_block(v) ) return 0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_float: case C_double: CAMLreturn(1); @@ -555,11 +555,11 @@ extern "C" { } } - SWIGINTERN int caml_ptr_check( CAML_VALUE v ) { + SWIGINTERN int caml_ptr_check( value v ) { CAMLparam1(v); if( !Is_block(v) ) return 0; - switch( SWIG_Tag_val(v) ) { + switch( Tag_val(v) ) { case C_string: case C_ptr: case C_int64: @@ -570,11 +570,11 @@ extern "C" { } } - SWIGINTERN CAML_VALUE SWIG_Ocaml_ptr_to_val(const char *name, void *ptr, swig_type_info *descriptor) { + SWIGINTERN value SWIG_Ocaml_ptr_to_val(const char *name, void *ptr, swig_type_info *descriptor) { CAMLparam0(); - SWIG_CAMLlocal1(result); + CAMLlocal1(result); - CAML_VALUE *fromval = caml_named_value(name); + const value *fromval = caml_named_value(name); if (fromval) { result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor)); } else { @@ -584,17 +584,17 @@ extern "C" { } static swig_module_info *SWIG_Ocaml_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - CAML_VALUE pointer; + value pointer; pointer = caml_callback(*caml_named_value("swig_find_type_info"), caml_val_int(0)); - if (Is_block(pointer) && SWIG_Tag_val(pointer) == C_ptr) { - return (swig_module_info *)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0)); + if (Is_block(pointer) && Tag_val(pointer) == C_ptr) { + return (swig_module_info *)(void *)(long)Int64_val(Field(pointer,0)); } return 0; } static void SWIG_Ocaml_SetModule(swig_module_info *pointer) { - CAML_VALUE mod_pointer; + value mod_pointer; mod_pointer = caml_val_ptr(pointer, NULL); caml_callback(*caml_named_value("swig_set_type_info"), mod_pointer); @@ -603,5 +603,3 @@ extern "C" { #ifdef __cplusplus } #endif -#undef value - diff --git a/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrundec.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrundec.swg new file mode 100644 index 00000000..76a1d610 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/ocamlrundec.swg @@ -0,0 +1,123 @@ +/* ----------------------------------------------------------------------------- + * ocamlrundec.swg + * + * Ocaml runtime code -- declarations + * ----------------------------------------------------------------------------- */ + +#include +#include +#include + +#ifdef __cplusplus +#define SWIGEXT extern "C" +SWIGEXT { +#else +#define SWIGEXT +#endif +#define CAML_NAME_SPACE +#include +#include +#include +#include +#include +#include +#include + +#if defined(CAMLassert) +/* Both this macro and version.h were introduced in version 4.02.0 */ +#include +#else +#define OCAML_VERSION 0 /* Unknown, but < 40200 */ +#endif + +#define caml_array_set swig_caml_array_set + +#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type) +#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer) + +typedef enum { + SWIG_OCamlArithmeticException, + SWIG_OCamlDirectorPureVirtual, + SWIG_OCamlOutOfMemoryError, + SWIG_OCamlOverflowException, + SWIG_OCamlIllegalArgumentException, + SWIG_OCamlIndexOutOfBoundsException, + SWIG_OCamlRuntimeException, + SWIG_OCamlSystemException, + SWIG_OCamlNullReferenceException, + SWIG_OCamlUnknownError +} SWIG_OCamlExceptionCodes; + +SWIGINTERN void SWIG_OCamlThrowException(SWIG_OCamlExceptionCodes code, const char *msg) { + CAMLparam0(); + CAMLlocal1(str); + + switch (code) { + case SWIG_OCamlIllegalArgumentException: + case SWIG_OCamlNullReferenceException: + caml_invalid_argument(msg); + break; + case SWIG_OCamlSystemException: + str = caml_copy_string(msg); + caml_raise_sys_error(str); + break; + case SWIG_OCamlArithmeticException: + case SWIG_OCamlIndexOutOfBoundsException: + case SWIG_OCamlOutOfMemoryError: + case SWIG_OCamlOverflowException: + case SWIG_OCamlRuntimeException: + case SWIG_OCamlUnknownError: + default: + caml_failwith(msg); + break; + } + CAMLreturn0; +} + +#define SWIG_contract_assert(expr, msg) do { if(!(expr)) {SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, msg);} } while (0) + + SWIGINTERN int + SWIG_GetPtr(void *source, void **result, swig_type_info *type, swig_type_info *result_type); + + SWIGINTERN value caml_list_nth( value lst, int n ); + SWIGINTERN value caml_list_append( value lst, value elt ); + SWIGINTERN int caml_list_length( value lst ); + SWIGINTERN value caml_array_new( int n ); + SWIGINTERN void caml_array_set( value arr, int n, value item ); + SWIGINTERN value caml_array_nth( value arr, int n ); + SWIGINTERN int caml_array_len( value arr ); + + SWIGINTERN value caml_val_char( char c ); + SWIGINTERN value caml_val_uchar( unsigned char c ); + + SWIGINTERN value caml_val_short( short s ); + SWIGINTERN value caml_val_ushort( unsigned short s ); + + SWIGINTERN value caml_val_int( int x ); + SWIGINTERN value caml_val_uint( unsigned int x ); + + SWIGINTERN value caml_val_long( long x ); + SWIGINTERN value caml_val_ulong( unsigned long x ); + + SWIGINTERN value caml_val_float( float f ); + SWIGINTERN value caml_val_double( double d ); + + SWIGINTERN value caml_val_ptr( void *p, swig_type_info *descriptor ); + + SWIGINTERN value caml_val_string( const char *str ); + SWIGINTERN value caml_val_string_len( const char *str, int len ); + + SWIGINTERN long caml_long_val( value v ); + SWIGINTERN double caml_double_val( value v ); + + SWIGINTERN int caml_ptr_val_internal( value v, void **out, + swig_type_info *descriptor ); + SWIGINTERN void *caml_ptr_val( value v, swig_type_info *descriptor ); + + SWIGINTERN char *caml_string_val( value v ); + SWIGINTERN int caml_string_len( value v ); + +#ifdef __cplusplus +} +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/preamble.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/preamble.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/preamble.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/preamble.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_common.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_common.i similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_common.i index 7e64607d..62a8d3cd 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_common.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_common.i @@ -12,12 +12,12 @@ %{ #include SWIGINTERNINLINE -CAML_VALUE SwigString_FromString(const std::string &s) { +value SwigString_FromString(const std::string &s) { return caml_val_string((char *)s.c_str()); } SWIGINTERNINLINE -std::string SwigString_AsString(CAML_VALUE o) { +std::string SwigString_AsString(value o) { return std::string((char *)caml_ptr_val(o,0)); } %} diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_except.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_list.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_list.i diff --git a/macx64/bin/swig/share/swig/4.3.0/ocaml/std_map.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_map.i new file mode 100644 index 00000000..b6a98c6e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_map.i @@ -0,0 +1,70 @@ +/* ----------------------------------------------------------------------------- + * std_map.i + * + * SWIG typemaps for std::map + * ----------------------------------------------------------------------------- */ + +%include + +// ------------------------------------------------------------------------ +// std::map +// ------------------------------------------------------------------------ + +%{ +#include +#include +#include +%} + +// exported class + +namespace std { + template > class map { + // add typemaps here + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef K key_type; + typedef T mapped_type; + typedef std::pair< const K, T > value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + map(); + map(const map& other); + + unsigned int size() const; + bool empty() const; + void clear(); + %extend { + const T& get(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else + (*self)[key] = x; +%#endif + } + void del(const K& key) throw (std::out_of_range) { + std::map< K, T, C >::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + bool has_key(const K& key) { + std::map< K, T, C >::iterator i = self->find(key); + return i != self->end(); + } + } + }; + +} diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_string.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_string.i similarity index 67% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_string.i index 712c3bb7..6cf918c6 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_string.i @@ -4,18 +4,11 @@ * SWIG typemaps for std::string * ----------------------------------------------------------------------------- */ -// ------------------------------------------------------------------------ -// std::string is typemapped by value -// This can prevent exporting methods which return a string -// in order for the user to modify it. -// However, I think I'll wait until someone asks for it... -// ------------------------------------------------------------------------ - %{ #include #include %} - + %include %include @@ -23,10 +16,10 @@ namespace std { %naturalvar string; %naturalvar wstring; - + class string; class wstring; - + /* Overloading check */ %typemap(in) string { if (caml_ptr_check($input)) @@ -44,15 +37,6 @@ class wstring; } } -%typemap(in) string & ($*1_ltype temp) { - if (caml_ptr_check($input)) { - temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input)); - $1 = &temp; - } else { - SWIG_exception(SWIG_TypeError, "string expected"); - } -} - %typemap(in) string * ($*1_ltype *temp) { if (caml_ptr_check($input)) { temp = new $*1_ltype((char *)caml_ptr_val($input,0), caml_string_len($input)); @@ -66,12 +50,12 @@ class wstring; delete temp; } -%typemap(argout) string & { - swig_result = caml_list_append(swig_result,caml_val_string_len((*$1).c_str(), (*$1).size())); +%typemap(out) const string & { + $result = caml_val_string_len((*$1).data(), (*$1).size()); } %typemap(directorin) string { - swig_result = caml_val_string_len($1.c_str(), $1.size()); + swig_result = caml_val_string_len($1.data(), $1.size()); args = caml_list_append(args, swig_result); } @@ -80,13 +64,39 @@ class wstring; } %typemap(out) string { - $result = caml_val_string_len($1.c_str(),$1.size()); + $result = caml_val_string_len($1.data(),$1.size()); +} + +%typemap(varout) string { + $result = caml_val_string_len($1.data(),$1.size()); } %typemap(out) string * { - $result = caml_val_string_len((*$1).c_str(),(*$1).size()); + $result = caml_val_string_len((*$1).data(),(*$1).size()); } + +%typemap(varout) string * { + $result = caml_val_string_len((*$1).data(),(*$1).size()); +} + %typemap(typecheck) string, const string & = char *; + +%typemap(throws) string, const string & "SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, $1.c_str());" + +%typemap(in) string &INPUT = const string &; +%typemap(in, numinputs=0) string &OUTPUT ($*1_ltype temp) +%{ $1 = &temp; %} +%typemap(argout) string &OUTPUT { + swig_result = caml_list_append(swig_result, caml_val_string_len((*$1).data(), (*$1).size())); +} +%typemap(in) string &INOUT = const string &; +%typemap(argout) string &INOUT = string &OUTPUT; + +%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/macx64/bin/swig/share/swig/4.0.0/ocaml/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/stl.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/stl.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/stl.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/swig.ml b/macx64/bin/swig/share/swig/4.3.0/ocaml/swig.ml similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/swig.ml rename to macx64/bin/swig/share/swig/4.3.0/ocaml/swig.ml diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/swig.mli b/macx64/bin/swig/share/swig/4.3.0/ocaml/swig.mli similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/swig.mli rename to macx64/bin/swig/share/swig/4.3.0/ocaml/swig.mli diff --git a/macx64/bin/swig/share/swig/4.3.0/ocaml/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/swigmove.i new file mode 100644 index 00000000..2c99b207 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/swigmove.i @@ -0,0 +1,13 @@ +/* ----------------------------------------------------------------------------- + * swigmove.i + * + * Input typemaps library for implementing full move semantics when passing + * parameters by value. + * ----------------------------------------------------------------------------- */ + +%typemap(in, noblock=1) SWIGTYPE MOVE (void *argp = 0) { + argp = ($&1_ltype) caml_ptr_val($input,$&1_descriptor); + SwigValueWrapper< $1_ltype >::reset($1, ($&1_type)argp); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/swigp4.ml b/macx64/bin/swig/share/swig/4.3.0/ocaml/swigp4.ml similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/swigp4.ml rename to macx64/bin/swig/share/swig/4.3.0/ocaml/swigp4.ml diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/typecheck.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/typecheck.i similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/typecheck.i rename to macx64/bin/swig/share/swig/4.3.0/ocaml/typecheck.i index 0c0a600a..1466d1c5 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ocaml/typecheck.i +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/typecheck.i @@ -7,7 +7,7 @@ %typecheck(SWIG_TYPECHECK_INT8) char, signed char, const char &, const signed char & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_char: $1 = 1; break; default: $1 = 0; break; } @@ -17,7 +17,7 @@ %typecheck(SWIG_TYPECHECK_UINT8) unsigned char, const unsigned char & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_uchar: $1 = 1; break; default: $1 = 0; break; } @@ -27,7 +27,7 @@ %typecheck(SWIG_TYPECHECK_INT16) short, signed short, const short &, const signed short &, wchar_t { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_short: $1 = 1; break; default: $1 = 0; break; } @@ -37,7 +37,7 @@ %typecheck(SWIG_TYPECHECK_UINT16) unsigned short, const unsigned short & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_ushort: $1 = 1; break; default: $1 = 0; break; } @@ -50,7 +50,7 @@ %typecheck(SWIG_TYPECHECK_INT32) int, signed int, const int &, const signed int &, enum SWIGTYPE { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_int: $1 = 1; break; default: $1 = 0; break; } @@ -60,7 +60,7 @@ %typecheck(SWIG_TYPECHECK_UINT32) unsigned int, const unsigned int & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_uint: $1 = 1; break; case C_int32: $1 = 1; break; default: $1 = 0; break; @@ -77,7 +77,7 @@ { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_int64: $1 = 1; break; default: $1 = 0; break; } @@ -87,7 +87,7 @@ %typecheck(SWIG_TYPECHECK_BOOL) bool, const bool & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_bool: $1 = 1; break; default: $1 = 0; break; } @@ -97,7 +97,7 @@ %typecheck(SWIG_TYPECHECK_FLOAT) float, const float & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_float: $1 = 1; break; default: $1 = 0; break; } @@ -107,7 +107,7 @@ %typecheck(SWIG_TYPECHECK_DOUBLE) double, const double & { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_double: $1 = 1; break; default: $1 = 0; break; } @@ -117,11 +117,11 @@ %typecheck(SWIG_TYPECHECK_STRING) char * { if( !Is_block($input) ) $1 = 0; else { - switch( SWIG_Tag_val($input) ) { + switch( Tag_val($input) ) { case C_string: $1 = 1; break; case C_ptr: { swig_type_info *typeinfo = - (swig_type_info *)(long)SWIG_Int64_val(SWIG_Field($input,1)); + (swig_type_info *)(long)Int64_val(Field($input,1)); $1 = SWIG_TypeCheck("char *",typeinfo) || SWIG_TypeCheck("signed char *",typeinfo) || SWIG_TypeCheck("unsigned char *",typeinfo) || @@ -136,7 +136,7 @@ } %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { - if (!Is_block($input) || !(SWIG_Tag_val($input) == C_obj || SWIG_Tag_val($input) == C_ptr)) { + if (!Is_block($input) || !(Tag_val($input) == C_obj || Tag_val($input) == C_ptr)) { $1 = 0; } else { void *ptr; @@ -149,14 +149,14 @@ if (!Is_block($input)) { $1 = 0; } else { - switch (SWIG_Tag_val($input)) { + switch (Tag_val($input)) { case C_obj: { void *ptr; $1 = !caml_ptr_val_internal($input, &ptr, $&1_descriptor); break; } case C_ptr: { - typeinfo = (swig_type_info *)SWIG_Int64_val(SWIG_Field($input, 1)); + typeinfo = (swig_type_info *)Int64_val(Field($input, 1)); $1 = SWIG_TypeCheck("$1_type", typeinfo) != NULL; break; } @@ -170,7 +170,7 @@ $1 = !caml_ptr_val_internal($input, &ptr, 0); } -%typecheck(SWIG_TYPECHECK_SWIGOBJECT) CAML_VALUE "$1 = 1;" +%typecheck(SWIG_TYPECHECK_SWIGOBJECT) value "$1 = 1;" /* ------------------------------------------------------------ * Exception handling @@ -183,7 +183,7 @@ unsigned long, unsigned short { char error_msg[256]; - sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1); + SWIG_snprintf(error_msg, sizeof(error_msg), "C++ $1_type exception thrown, value: %d", $1); SWIG_OCamlThrowException(SWIG_OCamlRuntimeException, error_msg); } diff --git a/macx64/bin/swig/share/swig/4.3.0/ocaml/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/ocaml/typemaps.i new file mode 100644 index 00000000..39231e22 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ocaml/typemaps.i @@ -0,0 +1,44 @@ +/* ---------------------------------------------------------------------------- + * typemaps.i + * + * These typemaps provide support for input/output arguments for C/C++ pointers + * and C++ references. +* ---------------------------------------------------------------------------- */ + +%define INPUT_OUTPUT_INOUT_TYPEMAPS(type, c_to_ocaml, ocaml_to_c) +%typemap(in) type *INPUT(type temp), type &INPUT(type temp) { + temp = (type)ocaml_to_c($input); + $1 = &temp; +} +%typemap(typecheck) type *INPUT = type; +%typemap(typecheck) type &INPUT = type; + +%typemap(in, numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;" +%typemap(argout) type *OUTPUT, type &OUTPUT { + swig_result = caml_list_append(swig_result, c_to_ocaml(*$1)); +} +%typemap(in) type *INOUT = type *INPUT; +%typemap(in) type &INOUT = type &INPUT; + +%typemap(argout) type *INOUT = type *OUTPUT; +%typemap(argout) type &INOUT = type &OUTPUT; + +%typemap(typecheck) type *INOUT = type; +%typemap(typecheck) type &INOUT = type; +%enddef + +INPUT_OUTPUT_INOUT_TYPEMAPS(bool, caml_val_bool, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(int, caml_val_int, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(long, caml_val_long, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(short, caml_val_int, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(char, caml_val_char, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(signed char, caml_val_char, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(float, caml_val_float, caml_double_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(double, caml_val_double, caml_double_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned int, caml_val_uint, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned long, caml_val_ulong, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned short, caml_val_ushort, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned char, caml_val_uchar, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(long long, caml_val_long, caml_long_val); +INPUT_OUTPUT_INOUT_TYPEMAPS(unsigned long long, caml_val_ulong, caml_long_val); +#undef INPUT_OUTPUT_INOUT_TYPEMAPS diff --git a/macx64/bin/swig/share/swig/4.0.0/ocaml/typeregister.swg b/macx64/bin/swig/share/swig/4.3.0/ocaml/typeregister.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ocaml/typeregister.swg rename to macx64/bin/swig/share/swig/4.3.0/ocaml/typeregister.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/octave/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/octave/argcargv.i new file mode 100644 index 00000000..8ddca59a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/octave/argcargv.i @@ -0,0 +1,52 @@ +/* ------------------------------------------------------------- + * 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); + } + const std::string & s = list(i).string_value(); + size_t slen = s.size() + 1; + char * p = (char*)malloc(slen); + $2[i] = p; + memcpy(p, s.c_str(), slen); + } + $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) { + $1_ltype i; + for (i = 0; i < $1; i++) { + free((void *)$2[i]); + } + free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/attribute.i b/macx64/bin/swig/share/swig/4.3.0/octave/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/octave/attribute.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/octave/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/scilab/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/octave/boost_shared_ptr.i index 668bf435..87c89b5f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/octave/carrays.i b/macx64/bin/swig/share/swig/4.3.0/octave/carrays.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/octave/carrays.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/octave/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/octave/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/director.swg b/macx64/bin/swig/share/swig/4.3.0/octave/director.swg similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/octave/director.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/director.swg index bf71d18e..5b9cd86e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/director.swg @@ -7,8 +7,6 @@ # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast(ARG) -#include - namespace Swig { class Director { diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/exception.i b/macx64/bin/swig/share/swig/4.3.0/octave/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/exception.i rename to macx64/bin/swig/share/swig/4.3.0/octave/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/factory.i b/macx64/bin/swig/share/swig/4.3.0/octave/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/factory.i rename to macx64/bin/swig/share/swig/4.3.0/octave/factory.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/implicit.i b/macx64/bin/swig/share/swig/4.3.0/octave/implicit.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/implicit.i rename to macx64/bin/swig/share/swig/4.3.0/octave/implicit.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octave.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octave.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/octave.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octave.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octcomplex.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octcomplex.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/octave/octcomplex.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octcomplex.swg index a3e9ebf7..553c25a3 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octcomplex.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octcomplex.swg @@ -2,7 +2,7 @@ Defines the As/From conversors for double/float complex, you need to provide complex Type, the Name you want to use in the conversors, the complex Constructor method, and the Real and Imag complex - accesor methods. + accessor methods. See the std_complex.i and ccomplex.i for concrete examples. */ @@ -73,7 +73,7 @@ int res = SWIG_AddCast(SWIG_AsVal(float)(ov, &d)); if (SWIG_IsOK(res)) { if (val) - *val = Constructor(d, 0.0); + *val = Constructor(d, 0.0f); return res; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octcontainer.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octcontainer.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/octave/octcontainer.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octcontainer.swg index 269ff754..83b73946 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octcontainer.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octcontainer.swg @@ -11,12 +11,6 @@ * be the case. * ----------------------------------------------------------------------------- */ -%{ -#include -#include -%} - - #if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS) # if !defined(SWIG_EXPORT_ITERATOR_METHODS) # define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS @@ -64,7 +58,6 @@ namespace swig { %fragment("OctSequence_Base","header",fragment="") { -%#include namespace std { template <> @@ -73,7 +66,11 @@ namespace std { bool operator()(const octave_value& v, const octave_value& w) const { +%#if SWIG_OCTAVE_PREREQ(7,0,0) + octave_value res = octave::binary_op(octave_value::op_le,v,w); +%#else octave_value res = do_binary_op(octave_value::op_le,v,w); +%#endif return res.is_true(); } }; @@ -109,7 +106,7 @@ namespace swig { template inline typename Sequence::iterator - getpos(Sequence* self, Difference i) { + getpos(Sequence* self, Difference i) { typename Sequence::iterator pos = self->begin(); std::advance(pos, check_index(i,self->size())); return pos; @@ -117,7 +114,7 @@ namespace swig { template inline typename Sequence::const_iterator - cgetpos(const Sequence* self, Difference i) { + cgetpos(const Sequence* self, Difference i) { typename Sequence::const_iterator pos = self->begin(); std::advance(pos, check_index(i,self->size())); return pos; @@ -143,25 +140,29 @@ namespace swig { template inline void - setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) { + setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) { typename Sequence::size_type size = self->size(); typename Sequence::size_type ii = swig::check_index(i, size, true); typename Sequence::size_type jj = swig::slice_index(j, size); if (jj < ii) jj = ii; size_t ssize = jj - ii; - if (ssize <= v.size()) { + if (ssize <= is.size()) { + // expanding/staying the same size typename Sequence::iterator sb = self->begin(); - typename InputSeq::const_iterator vmid = v.begin(); + typename InputSeq::const_iterator vmid = is.begin(); std::advance(sb,ii); std::advance(vmid, jj - ii); - self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end()); + self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end()); } else { + // shrinking typename Sequence::iterator sb = self->begin(); typename Sequence::iterator se = self->begin(); std::advance(sb,ii); std::advance(se,jj); self->erase(sb,se); - self->insert(sb, v.begin(), v.end()); + sb = self->begin(); + std::advance(sb,ii); + self->insert(sb, is.begin(), is.end()); } } @@ -205,7 +206,7 @@ namespace swig return swig::as(item); } catch (const std::exception& e) { char msg[1024]; - sprintf(msg, "in sequence element %d ", _index); + SWIG_snprintf(msg, sizeof(msg), "in sequence element %d ", _index); if (!Octave_Error_Occurred()) { %type_error(swig::type_name()); } @@ -352,7 +353,7 @@ namespace swig throw std::invalid_argument("a sequence is expected"); } _seq = seq; - Py_INCREF(_seq); + SWIG_Py_INCREF(_seq); */ } @@ -401,20 +402,14 @@ namespace swig return const_reference(_seq, n); } - bool check(bool set_err = true) const + bool check() const { int s = size(); for (int i = 0; i < s; ++i) { // swig::SwigVar_PyObject item = OctSequence_GetItem(_seq, i); octave_value item; // * todo - if (!swig::check(item)) { - if (set_err) { - char msg[1024]; - sprintf(msg, "in sequence element %d", i); - SWIG_Error(SWIG_RuntimeError, msg); - } + if (!swig::check(item)) return false; - } } return true; } @@ -582,8 +577,17 @@ namespace swig { } else { return octseq.check() ? SWIG_OK : SWIG_ERROR; } - } catch (std::exception& e) { + } +%#if SWIG_OCTAVE_PREREQ(6,0,0) + catch (octave::execution_exception& exec) { + } +%#endif + catch (std::exception& e) { +%#if SWIG_OCTAVE_PREREQ(6,0,0) + if (seq) // Know that octave is not in an error state +%#else if (seq&&!error_state) +%#endif error("swig type error: %s",e.what()); return SWIG_ERROR; } diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octfragments.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/octfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octfragments.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/octave/octheaders.hpp b/macx64/bin/swig/share/swig/4.3.0/octave/octheaders.hpp new file mode 100644 index 00000000..26e5564d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octheaders.hpp @@ -0,0 +1,130 @@ +// +// This header includes all C++ headers required for generated Octave wrapper code. +// Using a single header file allows pre-compilation of Octave headers, as follows: +// * Check out this header file: +// swig -octave -co octheaders.hpp +// * Pre-compile header file into octheaders.hpp.gch: +// g++ -c ... octheaders.hpp +// * Use pre-compiled header file: +// g++ -c -include octheaders.hpp ... +// + +#if !defined(SWIG_OCTAVE_OCTHEADERS_HPP) +#define SWIG_OCTAVE_OCTHEADERS_HPP + +// Required C++ headers +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Minimal headers to define Octave version +#include +#include + +// Macro for enabling features which require Octave version >= major.minor.patch +// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '' (released) and '+' (in development) patch numbers +#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ + ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) ) + +// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 +#if !defined(OCTAVE_MAJOR_VERSION) + +# if !defined(OCTAVE_API_VERSION_NUMBER) + +// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet +// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER +# include +# if defined(octave_ov_h) +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 8 +# define OCTAVE_PATCH_VERSION 0 +# else + +// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed +# define ComplexLU __ignore +# include +# undef ComplexLU +# if defined(octave_Complex_LU_h) + +// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 1 +# define OCTAVE_PATCH_VERSION 99 + +# else + +// OCTAVE_API_VERSION_NUMBER == 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 2 +# define OCTAVE_PATCH_VERSION 0 + +# endif // defined(octave_Complex_LU_h) + +# endif // defined(octave_ov_h) + +// Correlation between Octave API and version numbers extracted from Octave's +// ChangeLogs; version is the *earliest* released Octave with that API number +# elif OCTAVE_API_VERSION_NUMBER >= 48 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 6 +# define OCTAVE_PATCH_VERSION 0 + +# elif OCTAVE_API_VERSION_NUMBER >= 45 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 4 +# define OCTAVE_PATCH_VERSION 1 + +# elif OCTAVE_API_VERSION_NUMBER >= 42 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 54 + +# elif OCTAVE_API_VERSION_NUMBER >= 41 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 53 + +# elif OCTAVE_API_VERSION_NUMBER >= 40 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 52 + +# elif OCTAVE_API_VERSION_NUMBER >= 39 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 51 + +# else // OCTAVE_API_VERSION_NUMBER == 38 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 50 + +# endif // !defined(OCTAVE_API_VERSION_NUMBER) + +#endif // !defined(OCTAVE_MAJOR_VERSION) + +// Required Octave headers +#include +#include +#include +#include +#include +#include +#include +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include +#else +#include +#endif +#include +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include +#endif + +#endif // !defined(SWIG_OCTAVE_OCTHEADERS_HPP) diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octiterators.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octiterators.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/octave/octiterators.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octiterators.swg index e186c94a..2f435650 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octiterators.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octiterators.swg @@ -101,12 +101,7 @@ namespace swig { } static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::OctSwigIterator *"); - init = 1; - } + static swig_type_info *desc = SWIG_TypeQuery("swig::OctSwigIterator *"); return desc; } }; diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octopers.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octopers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/octopers.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octopers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octprimtypes.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/octave/octprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octprimtypes.swg index 1c9aa908..e47fb00f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octprimtypes.swg @@ -226,20 +226,25 @@ SWIG_AsCharPtrAndSize(octave_value ov, char** cptr, size_t* psize, int *alloc) %#endif && ov.rows() == 1 && ov.columns() == 1) ov = ov.cell_value()(0); - if (!ov.is_string()) - return SWIG_TypeError; - - std::string str=ov.string_value(); - size_t len=str.size(); - char* cstr=(char*)str.c_str(); - if (alloc) { - *cptr = %new_copy_array(cstr, len + 1, char); - *alloc = SWIG_NEWOBJ; - } else if (cptr) - *cptr = cstr; - if (psize) - *psize = len + 1; - return SWIG_OK; + + if (ov.is_string()) { + std::string str=ov.string_value(); + size_t len=str.size(); + char* cstr=(char*)str.c_str(); + if (alloc) { + *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } else if (cptr) + *cptr = cstr; + if (psize) + *psize = len + 1; + } else if (!ov.is_defined() || (ov.is_matrix_type() && ov.rows() == 0 && ov.columns() == 0) ) { + if (cptr) + *cptr = 0; + } else { + return SWIG_TypeError; + } + return SWIG_OK; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octrun.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octrun.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/octave/octrun.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octrun.swg index ff614e68..fc34fdaa 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octrun.swg @@ -43,6 +43,8 @@ SWIGRUNTIME octave_value SWIG_ErrorType(int code) { return "SWIG_SystemError"; case SWIG_AttributeError: return "SWIG_AttributeError"; + case SWIG_NullReferenceError: + return "SWIG_NullReferenceError"; } return "SWIG unknown error"; } @@ -89,10 +91,6 @@ SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *point // Runtime API implementation -#include -#include -#include - typedef octave_value_list(*octave_func) (const octave_value_list &, int); class octave_swig_type; @@ -175,7 +173,16 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_function* function_value(bool = false) { return this; } +#if SWIG_OCTAVE_PREREQ(6,0,0) octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) { + return execute(tw,nargout,args); + } +#endif +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave_value_list execute(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) { +#else + octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) { +#endif octave_value_list all_args; all_args.append(first_args); all_args.append(args); @@ -203,11 +210,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); std::set dispatch_classes; - private: - - DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; - DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_bound_func, "octave_swig_bound_func", "octave_swig_bound_func"); #else #define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(func) #endif @@ -217,7 +220,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); // // These should really be decoupled, with the class support added to Octave // and the shadow class given by an m-file script. That would dramatically - // reduce the runtime complexity, and be more in line w/ other modules. + // reduce the runtime complexity, and be more in line with other modules. class octave_swig_type:public octave_base_value { struct cpp_ptr { @@ -231,7 +234,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; @@ -401,7 +404,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } static octave_value make_value_hack(const octave_base_value &x) { +#if SWIG_OCTAVE_PREREQ(9,0,0) + ((octave_swig_type &) x).m_count++; +#else ((octave_swig_type &) x).count++; +#endif return octave_value((octave_base_value *) &x); } @@ -411,7 +418,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)); @@ -425,8 +432,12 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } ~octave_swig_type() { - if (own) { + if (thisown) { +#if SWIG_OCTAVE_PREREQ(9,0,0) + ++m_count; +#else ++count; +#endif for (unsigned int j = 0; j < types.size(); ++j) { if (!types[j].first || !types[j].first->clientdata) continue; @@ -464,10 +475,20 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); // Fill in dim_vector for (int k=0;k a; + try { + a = out.int_vector_value(); + } + catch (octave::execution_exception& oee) { + return dim_vector(1,1); + } +#else Array a = out.int_vector_value(); if (error_state) return dim_vector(1,1); +#endif dim_vector d; d.resize(a.numel() < 2 ? 2 : a.numel()); d(0) = d(1) = 1; @@ -494,23 +525,35 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } octave_value as_value() { +#if SWIG_OCTAVE_PREREQ(9,0,0) + ++m_count; +#else ++count; +#endif return Swig::swig_value_ref(this); } void incref() { +#if SWIG_OCTAVE_PREREQ(9,0,0) + ++m_count; +#else ++count; +#endif } void decref() { +#if SWIG_OCTAVE_PREREQ(9,0,0) + if (!--m_count) +#else if (!--count) +#endif delete this; } - long swig_this() const { + size_t swig_this() const { if (!types.size()) - return (long) this; - return (long) types[0].second.ptr; + return (size_t) this; + return (size_t) types[0].second.ptr; } const char* help_text() const { if (!types.size()) @@ -538,7 +581,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 @@ -561,35 +604,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; @@ -598,7 +662,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } bool is_owned() const { - return own; + return thisown; } #ifdef SWIG_DIRECTORS @@ -639,7 +703,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); return true; } +#if SWIG_OCTAVE_PREREQ(6,0,0) + virtual bool isstruct() const { +#else virtual bool is_map() const { +#endif return true; } @@ -787,7 +855,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); return as_value(); } +#if SWIG_OCTAVE_PREREQ(4,4,0) + virtual bool isobject() const { +#else virtual bool is_object() const { +#endif return true; } @@ -882,7 +954,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } virtual bool load_binary (std::istream& is, bool swap, - oct_mach_info::float_format fmt) { +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::mach_info::float_format fmt) { +#else + oct_mach_info::float_format fmt) { +#endif return true; } @@ -1066,7 +1142,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_swig_type *ptr; public: octave_swig_ref(octave_swig_type *_ptr = 0) - :ptr(_ptr) { } + :ptr(_ptr) + { + // Ensure type_id() is set correctly +#if SWIG_OCTAVE_PREREQ(9,0,0) + if (s_t_id == -1) { + s_t_id = octave_swig_ref::static_type_id(); +#else + if (t_id == -1) { + t_id = octave_swig_ref::static_type_id(); +#endif + } + } ~octave_swig_ref() { if (ptr) ptr->decref(); } @@ -1086,8 +1173,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); bool is_defined() const { return ptr->is_defined(); } +#if SWIG_OCTAVE_PREREQ(6,0,0) + virtual bool isstruct() const + { return ptr->isstruct(); } +#else virtual bool is_map() const { return ptr->is_map(); } +#endif virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx) { return ptr->subsref(ops, idx); } @@ -1098,8 +1190,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs) { return ptr->subsasgn(ops, idx, rhs); } +#if SWIG_OCTAVE_PREREQ(4,4,0) + virtual bool isobject() const + { return ptr->isobject(); } +#else virtual bool is_object() const { return ptr->is_object(); } +#endif virtual bool is_string() const { return ptr->is_string(); } @@ -1144,7 +1241,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); { return ptr->save_binary(os, save_as_floats); } virtual bool load_binary (std::istream& is, bool swap, - oct_mach_info::float_format fmt) +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::mach_info::float_format fmt) +#else + oct_mach_info::float_format fmt) +#endif { return ptr->load_binary(is, swap, fmt); } #if defined (HAVE_HDF5) @@ -1180,6 +1281,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); #endif { return ptr->print(os, pr_as_read_syntax); } +#if SWIG_OCTAVE_PREREQ(9,0,0) + static void set_type_id(int type_id) { s_t_id=type_id; } +#else +# if SWIG_OCTAVE_PREREQ(4,4,0) + static void set_type_id(int type_id) { t_id=type_id; } +# endif +#endif + virtual type_conv_info numeric_conversion_function(void) const { return octave_base_value::type_conv_info (default_numeric_conversion_function, octave_scalar::static_type_id ()); @@ -1207,8 +1316,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); public: octave_swig_packed(swig_type_info *_type = 0, const void *_buf = 0, size_t _buf_len = 0) - : type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len) { - } + : type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len) + { + // Ensure type_id() is set correctly +#if SWIG_OCTAVE_PREREQ(9,0,0) + if (s_t_id == -1) { + s_t_id = octave_swig_packed::static_type_id(); +#else + if (t_id == -1) { + t_id = octave_swig_packed::static_type_id(); +#endif + } + } bool copy(swig_type_info *outtype, void *ptr, size_t sz) const { if (outtype && outtype != type) @@ -1254,7 +1373,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); } virtual bool load_binary (std::istream& is, bool swap, - oct_mach_info::float_format fmt) { +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::mach_info::float_format fmt) { +#else + oct_mach_info::float_format fmt) { +#endif return true; } @@ -1280,6 +1403,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); return true; } # endif +#endif + +#if SWIG_OCTAVE_PREREQ(9,0,0) + static void set_type_id(int type_id) { s_t_id=type_id; } +#else +# if SWIG_OCTAVE_PREREQ(4,4,0) + static void set_type_id(int type_id) { t_id=type_id; } +# endif #endif private: @@ -1456,12 +1587,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) { @@ -1504,16 +1638,24 @@ SWIGRUNTIMEINLINE void SWIG_Octave_SetConstant(octave_swig_type *module_ns, cons } SWIGRUNTIMEINLINE octave_value SWIG_Octave_GetGlobalValue(std::string name) { +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::interpreter *interp = octave::interpreter::the_interpreter (); + return interp->global_varval(name); +#else #if SWIG_OCTAVE_PREREQ(4,4,0) octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table(); return symtab.global_varval(name); #else return get_global_value(name, true); #endif +#endif } SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value& value) { -#if SWIG_OCTAVE_PREREQ(4,4,0) +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::interpreter *interp = octave::interpreter::the_interpreter (); + interp->global_assign(name, value); +#elif SWIG_OCTAVE_PREREQ(4,4,0) octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table(); symtab.global_assign(name, value); #else @@ -1523,10 +1665,24 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) { #if SWIG_OCTAVE_PREREQ(4,4,0) - octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table(); octave::symbol_scope symscope = octave::interpreter::the_interpreter()->get_current_scope(); +#if SWIG_OCTAVE_PREREQ(6,0,0) + octave::interpreter *interp = octave::interpreter::the_interpreter (); + interp->assign(name, interp->global_varval(name)); + octave::tree_evaluator& tree_eval = interp->get_evaluator(); +#if SWIG_OCTAVE_PREREQ(8,0,0) + std::shared_ptr stackFrame = tree_eval.get_current_stack_frame(); +#else + octave::call_stack& callStack = tree_eval.get_call_stack(); + std::shared_ptr stackFrame = tree_eval.get_current_stack_frame(); +#endif + octave::symbol_record sym=symscope.lookup_symbol(name); + stackFrame->mark_global(sym); +#else + octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table(); symscope.assign(name, symtab.global_varval(name)); symscope.mark_global(name); +#endif #else #if !SWIG_OCTAVE_PREREQ(3,2,0) link_to_global_variable(curr_sym_tab->lookup(name, true)); diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octruntime.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octruntime.swg similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/octave/octruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octruntime.swg index f98bf4fe..94e2ca4f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octruntime.swg +++ b/macx64/bin/swig/share/swig/4.3.0/octave/octruntime.swg @@ -1,111 +1,10 @@ +#ifdef SWIG_OCTAVE_EXTERNAL_OCTHEADERS %insert(runtime) %{ - -#include -#include - -#include -#include - -// Macro for enabling features which require Octave version >= major.minor.patch -// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '' (released) and '+' (in development) patch numbers -#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ - ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) ) - -// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 -#if !defined(OCTAVE_MAJOR_VERSION) - -# if !defined(OCTAVE_API_VERSION_NUMBER) - -// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet -// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER -# include -# if defined(octave_ov_h) -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 8 -# define OCTAVE_PATCH_VERSION 0 -# else - -// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed -# define ComplexLU __ignore -# include -# undef ComplexLU -# if defined(octave_Complex_LU_h) - -// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 1 -# define OCTAVE_PATCH_VERSION 99 - -# else - -// OCTAVE_API_VERSION_NUMBER == 37 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 2 -# define OCTAVE_PATCH_VERSION 0 - -# endif // defined(octave_Complex_LU_h) - -# endif // defined(octave_ov_h) - -// Correlation between Octave API and version numbers extracted from Octave's -// ChangeLogs; version is the *earliest* released Octave with that API number -# elif OCTAVE_API_VERSION_NUMBER >= 48 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 6 -# define OCTAVE_PATCH_VERSION 0 - -# elif OCTAVE_API_VERSION_NUMBER >= 45 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 4 -# define OCTAVE_PATCH_VERSION 1 - -# elif OCTAVE_API_VERSION_NUMBER >= 42 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 54 - -# elif OCTAVE_API_VERSION_NUMBER >= 41 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 53 - -# elif OCTAVE_API_VERSION_NUMBER >= 40 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 52 - -# elif OCTAVE_API_VERSION_NUMBER >= 39 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 51 - -# else // OCTAVE_API_VERSION_NUMBER == 38 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 50 - -# endif // !defined(OCTAVE_API_VERSION_NUMBER) - -#endif // !defined(OCTAVE_MAJOR_VERSION) - -#include -#include -#include -#include -#include -#include -#include -#if SWIG_OCTAVE_PREREQ(4,2,0) -#include -#else -#include -#endif -#include -#if SWIG_OCTAVE_PREREQ(4,2,0) -#include -#endif - +#include "octheaders.hpp" %} +#else +%insert(runtime) "octheaders.hpp"; +#endif %insert(runtime) "swigrun.swg"; %insert(runtime) "swigerrors.swg"; @@ -120,7 +19,8 @@ static bool SWIG_init_user(octave_swig_type* module_ns); SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { bool retn = false; { -#if SWIG_OCTAVE_PREREQ(4,2,0) +#if SWIG_OCTAVE_PREREQ(6,0,0) +#elif SWIG_OCTAVE_PREREQ(4,2,0) octave::unwind_protect frame; frame.protect_var(discard_error_messages); discard_error_messages = true; frame.protect_var(discard_warning_messages); discard_warning_messages = true; @@ -163,7 +63,8 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) { bool retn = false; { -#if SWIG_OCTAVE_PREREQ(4,2,0) +#if SWIG_OCTAVE_PREREQ(6,0,0) +#elif SWIG_OCTAVE_PREREQ(4,2,0) octave::unwind_protect frame; frame.protect_var(discard_error_messages); discard_error_messages = true; frame.protect_var(discard_warning_messages); discard_warning_messages = true; @@ -315,13 +216,29 @@ DEFUN_DLD( swig_octave_prereq, args, nargout, swig_octave_prereq_usage ) { return octave_value(prereq); } +static const char *const swig_exit_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} swig_exit([@var{exit_status}])\n\ +Exit Octave without performing any memory cleanup.\n\ +@end deftypefn"; + +DEFUN_DLD( swig_exit, args, nargout, swig_exit_usage ) { + if (args.length() > 1) { + error("swig_exit: must be called with at most one arguments"); + return octave_value_list(); + } + int exit_status = 0; + if (args.length() == 1) { + exit_status = args(0).int_value(); + } + ::_Exit(exit_status); + return octave_value(); +} + static const char *const SWIG_name_usage = "-*- texinfo -*- \n\ @deftypefn {Loadable Module} {} " SWIG_name_d "\n\ Loads the SWIG-generated module `" SWIG_name_d "'.\n\ @end deftypefn"; -void __swig_atexit__(void) { ::_Exit(0); } - DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { static octave_swig_type* module_ns = 0; @@ -329,14 +246,15 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { // workaround to prevent octave seg-faulting on exit: set Octave exit function // octave_exit to _Exit, which exits immediately without trying to cleanup memory. // definitely affected version 3.2.*, not sure about 3.3.*, seems to be fixed in - // version 3.4.*, but reappeared in 4.2.*, so turn on for all versions after 3.2.*. + // version 3.4.*, reappeared in 4.2.*, hack not possible in 4.4.* or later due to + // removal of octave_exit, so turn on for all versions between 3.2.*. and 4.4.*. // can be turned off with macro definition. #ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK -#if SWIG_OCTAVE_PREREQ(4,4,0) - atexit(__swig_atexit__); -#elif SWIG_OCTAVE_PREREQ(3,2,0) +#if !SWIG_OCTAVE_PREREQ(4,4,0) +#if SWIG_OCTAVE_PREREQ(3,2,0) octave_exit = ::_Exit; #endif +#endif #endif // check for no input and output args @@ -376,16 +294,14 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { string_vector types = typeinfo.installed_type_names(); bool register_octave_swig_ref = true; bool register_octave_swig_packed = true; - bool register_octave_swig_bound_func = true; for (int i = 0; i < types.numel(); ++i) { if (types(i) == octave_swig_ref::static_type_name()) { register_octave_swig_ref = false; + octave_swig_ref::set_type_id(i); } if (types(i) == octave_swig_packed::static_type_name()) { register_octave_swig_packed = false; - } - if (types(i) == octave_swig_bound_func::static_type_name()) { - register_octave_swig_bound_func = false; + octave_swig_packed::set_type_id(i); } } if (register_octave_swig_ref) { @@ -394,9 +310,6 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { if (register_octave_swig_packed) { octave_swig_packed::register_type(); } - if (register_octave_swig_bound_func) { - octave_swig_bound_func::register_type(); - } } #else octave_swig_ref::register_type(); @@ -405,7 +318,14 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { SWIG_InitializeModule(0); SWIG_PropagateClientData(); -#if SWIG_OCTAVE_PREREQ(4,4,0) +#if SWIG_OCTAVE_PREREQ(8,0,0) + octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); + octave_function *me = tree_eval.current_function(); +#elif SWIG_OCTAVE_PREREQ(6,0,0) + octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); + octave::call_stack& stack = tree_eval.get_call_stack(); + octave_function *me = stack.current_function(); +#elif SWIG_OCTAVE_PREREQ(4,4,0) octave::call_stack& stack = octave::interpreter::the_interpreter()->get_call_stack(); octave_function *me = stack.current(); #else @@ -427,6 +347,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { if (!SWIG_Octave_InstallFunction(me, "swig_octave_prereq")) { return octave_value_list(); } + if (!SWIG_Octave_InstallFunction(me, "swig_exit")) { + return octave_value_list(); + } octave_swig_type* cvar_ns=0; if (std::string(SWIG_global_name) != ".") { diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octstdcommon.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octstdcommon.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/octstdcommon.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octstdcommon.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/octtypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octtypemaps.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/octave/octtypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octtypemaps.swg index 4acf8e07..4984fddf 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/octtypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/octave/octuserdir.swg b/macx64/bin/swig/share/swig/4.3.0/octave/octuserdir.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/octuserdir.swg rename to macx64/bin/swig/share/swig/4.3.0/octave/octuserdir.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.3.0/octave/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/octave/std_basic_string.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_basic_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_basic_string.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_basic_string.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_char_traits.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_char_traits.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_char_traits.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_char_traits.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_common.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_complex.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_complex.i index 30c18824..461e2fdf 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/std_complex.i +++ b/macx64/bin/swig/share/swig/4.3.0/octave/std_complex.i @@ -4,10 +4,6 @@ %include -%{ -#include -%} - namespace std { %naturalvar complex; template class complex; diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_container.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_container.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_except.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_list.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_map.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_map.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_map.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_string.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/octave/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/octave/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/octave/std_wstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/octave/std_wstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/stl.i b/macx64/bin/swig/share/swig/4.3.0/octave/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/stl.i rename to macx64/bin/swig/share/swig/4.3.0/octave/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/octave/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/octave/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/octave/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/octave/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/octave/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/octave/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/Makefile.pl b/macx64/bin/swig/share/swig/4.3.0/perl5/Makefile.pl similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/Makefile.pl rename to macx64/bin/swig/share/swig/4.3.0/perl5/Makefile.pl diff --git a/macx64/bin/swig/share/swig/4.3.0/perl5/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/perl5/argcargv.i new file mode 100644 index 00000000..ee238130 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/argcargv.i @@ -0,0 +1,30 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(in) (int ARGC, char **ARGV) { + int i; + SSize_t 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) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/attribute.i b/macx64/bin/swig/share/swig/4.3.0/perl5/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/attribute.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/carrays.i b/macx64/bin/swig/share/swig/4.3.0/perl5/carrays.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/perl5/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/carrays.i index 8be67abc..c1e6db3f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/carrays.i @@ -1,2 +1 @@ %include - diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/perl5/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/perl5/cpointer.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/cpointer.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/cstring.i b/macx64/bin/swig/share/swig/4.3.0/perl5/cstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/cstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/director.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/director.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/director.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/director.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/exception.i b/macx64/bin/swig/share/swig/4.3.0/perl5/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/exception.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/factory.i b/macx64/bin/swig/share/swig/4.3.0/perl5/factory.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/factory.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/factory.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/noembed.h b/macx64/bin/swig/share/swig/4.3.0/perl5/noembed.h similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/noembed.h rename to macx64/bin/swig/share/swig/4.3.0/perl5/noembed.h diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perl5.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perl5.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perl5.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perl5.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlerrors.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlerrors.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlerrors.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlerrors.swg index 57296c67..0e563b62 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlerrors.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlerrors.swg @@ -27,6 +27,8 @@ SWIG_Perl_ErrorType(int code) { return "SystemError"; case SWIG_AttributeError: return "AttributeError"; + case SWIG_NullReferenceError: + return "NullReferenceError"; default: return "RuntimeError"; } diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlfragments.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlfragments.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlhead.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlhead.swg similarity index 62% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlhead.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlhead.swg index 5437af5a..11ea50a9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlhead.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlhead.swg @@ -4,26 +4,27 @@ #include extern "C" { #endif + +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvolatile" +#endif +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" -/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */ +#if __GNUC__ >= 10 +#if defined(__cplusplus) +#pragma GCC diagnostic pop +#endif +#endif -/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */ -#ifndef PERL_REVISION -# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) -# define PERL_PATCHLEVEL_H_IMPLICIT -# include -# endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) -# include -# endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION -# 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 #endif #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) @@ -38,15 +39,6 @@ extern "C" { # define SvUOK(sv) SvIOK_UV(sv) #endif -#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) -# define PL_sv_undef sv_undef -# define PL_na na -# define PL_errgv errgv -# define PL_sv_no sv_no -# define PL_sv_yes sv_yes -# define PL_markstack_ptr markstack_ptr -#endif - #ifndef IVSIZE # ifdef LONGSIZE # define IVSIZE LONGSIZE diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlinit.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlinit.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlinit.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlinit.swg index b49040d2..c26b93fa 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlinit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlinit.swg @@ -4,15 +4,11 @@ #ifdef __cplusplus extern "C" #endif -#ifndef PERL_OBJECT #ifndef MULTIPLICITY SWIGEXPORT void SWIG_init (CV* cv); #else SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); #endif -#else -SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); -#endif %} /* Module initialization function */ diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlkw.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlkw.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlkw.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlkw.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlmacros.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlmacros.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlmacros.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlmacros.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlmain.i b/macx64/bin/swig/share/swig/4.3.0/perl5/perlmain.i similarity index 64% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlmain.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlmain.i index 18ecb7eb..14f1cf21 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlmain.i +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlmain.i @@ -4,25 +4,20 @@ * Code to statically rebuild perl5. * ----------------------------------------------------------------------------- */ -#ifdef AUTODOC -%subsection "perlmain.i" -%text %{ -This module provides support for building a new version of the -Perl executable. This will be necessary on systems that do -not support shared libraries and may be necessary with C++ -extensions. - -This module may only build a stripped down version of the -Perl executable. Thus, it may be necessary (or desirable) -to hand-edit this file for your particular application. To -do this, simply copy this file from swig_lib/perl5/perlmain.i -to your working directory and make the appropriate modifications. - -This library file works with Perl 5.003. It may work with earlier -versions, but it hasn't been tested. As far as I know, this -library is C++ safe. -%} -#endif +// This module provides support for building a new version of the +// Perl executable. This will be necessary on systems that do +// not support shared libraries and may be necessary with C++ +// extensions. +// +// This module may only build a stripped down version of the +// Perl executable. Thus, it may be necessary (or desirable) +// to hand-edit this file for your particular application. To +// do this, simply copy this file from swig_lib/perl5/perlmain.i +// to your working directory and make the appropriate modifications. +// +// This library file works with Perl 5.003. It may work with earlier +// versions, but it hasn't been tested. As far as I know, this +// library is C++ safe. %{ diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlopers.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlopers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlopers.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlopers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlprimtypes.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlprimtypes.swg index 4cb67567..57f390a2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlprimtypes.swg @@ -179,7 +179,7 @@ SWIG_From_dec(long long)(long long value) else { //sv = newSVpvf("%lld", value); doesn't work in non 64bit Perl char temp[256]; - sprintf(temp, "%lld", value); + SWIG_snprintf(temp, sizeof(temp), "%lld", value); sv = newSVpv(temp, 0); } return sv_2mortal(sv); @@ -259,7 +259,7 @@ SWIG_From_dec(unsigned long long)(unsigned long long value) else { //sv = newSVpvf("%llu", value); doesn't work in non 64bit Perl char temp[256]; - sprintf(temp, "%llu", value); + SWIG_snprintf(temp, sizeof(temp), "%llu", value); sv = newSVpv(temp, 0); } return sv_2mortal(sv); @@ -280,7 +280,7 @@ SWIG_AsVal_dec(unsigned long long)(SV *obj, unsigned long long *val) * (UVSIZE <= sizeof(*val) || v <= ULLONG_MAX) */ if (val) *val = SvUV(obj); return SWIG_OK; - } else if (SvIOK(obj)) { + } else if (SvIOK(obj)) { IV v = SvIV(obj); if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULLONG_MAX)) { if (val) *val = v; diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlrun.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlrun.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlrun.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlrun.swg index b04002f5..dfb2c8ee 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlrun.swg @@ -6,13 +6,8 @@ * type checking. * ----------------------------------------------------------------------------- */ -#ifdef PERL_OBJECT -#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl), -#define SWIG_PERL_OBJECT_CALL pPerl, -#else #define SWIG_PERL_OBJECT_DECL #define SWIG_PERL_OBJECT_CALL -#endif /* Common SWIG API */ @@ -88,31 +83,11 @@ extern "C" { #endif /* Macro to call an XS function */ -#ifdef PERL_OBJECT -# define SWIG_CALLXS(_name) _name(cv,pPerl) -#else -# ifndef MULTIPLICITY -# define SWIG_CALLXS(_name) _name(cv) -# else -# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) -# endif -#endif - -#ifdef PERL_OBJECT -#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; - -#ifdef __cplusplus -extern "C" { +#ifndef MULTIPLICITY +# define SWIG_CALLXS(_name) _name(cv) +#else +# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) #endif -typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); -#ifdef __cplusplus -} -#endif - -#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) -#define SWIGCLASS_STATIC - -#else /* PERL_OBJECT */ #define MAGIC_PPERL #define SWIGCLASS_STATIC static SWIGUNUSED @@ -141,24 +116,14 @@ typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #endif #endif /* MULTIPLICITY */ -#endif /* PERL_OBJECT */ -# ifdef PERL_OBJECT -# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) -static void SWIGUNUSED SWIG_Perl_croak_null(CPerlObj *pPerl) -# else static void SWIGUNUSED SWIG_croak_null() -# endif { SV *err = get_sv("@", GV_ADD); -# if (PERL_VERSION < 6) - croak("%_", err); -# else if (sv_isobject(err)) croak(0); else croak("%s", SvPV_nolen(err)); -# endif } @@ -233,7 +198,7 @@ SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { /* Acquire a pointer value */ SWIGRUNTIME int -SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) { +SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *SWIGUNUSEDPARM(sv), int SWIGUNUSEDPARM(own)) { /* TODO */ return 0; } @@ -245,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; @@ -321,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); /* @@ -335,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; } @@ -462,24 +440,19 @@ typedef struct { } swig_variable_info; /* Magic variable code */ -#ifndef PERL_OBJECT -# ifdef __cplusplus +#ifdef __cplusplus # define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast(a),b,c) -# else -# define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c) -# endif -# ifndef MULTIPLICITY -SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) -# else -SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) -# endif #else -# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) -SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) +# define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c) +#endif +#ifndef MULTIPLICITY +SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) +#else +SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) #endif { MAGIC *mg; - sv_magic(sv,sv,'U',name,strlen(name)); + sv_magic(sv,sv,'U',name,(I32)strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); mg->mg_virtual->svt_get = (SwigMagicFunc) get; diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlruntime.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlruntime.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlruntime.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perlstrings.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perlstrings.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perlstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perlstrings.swg index 242a9c96..d21b75af 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perlstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perlstrings.swg @@ -15,7 +15,7 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) STRLEN len = 0; char *cstr = SvPV(obj, len); size_t size = len + 1; - if (cptr) { + if (cptr) { if (alloc) { if (*alloc == SWIG_NEWOBJ) { *cptr = %new_copy_array(cstr, size, char); diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perltypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perltypemaps.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perltypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perltypemaps.swg index bf1596e9..42f8887b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/perltypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/perltypemaps.swg @@ -56,7 +56,9 @@ %define %set_output(obj) $result = obj; argvi++ %enddef /* append output */ -%define %append_output(obj) if (argvi >= items) EXTEND(sp, argvi+1); %set_output(obj) %enddef +%define %append_output(obj) +if (argvi >= items) EXTEND(sp, argvi+1); +%set_output(obj) %enddef /* variable output */ %define %set_varoutput(obj) sv_setsv($result,obj) %enddef @@ -95,7 +97,7 @@ "sv_setiv(SvRV($result), PTR2IV(&$1));"; %typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) { - SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor); + SWIG_MakePackedObj($result, (void *) &$1, sizeof($1), $1_descriptor); } %typemap(varout) SWIGTYPE *const = SWIGTYPE *; diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/perluserdir.swg b/macx64/bin/swig/share/swig/4.3.0/perl5/perluserdir.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/perluserdir.swg rename to macx64/bin/swig/share/swig/4.3.0/perl5/perluserdir.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/reference.i b/macx64/bin/swig/share/swig/4.3.0/perl5/reference.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/reference.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/reference.i diff --git a/macx64/bin/swig/share/swig/4.3.0/perl5/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/perl5/std_common.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/php/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/php/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_except.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_list.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_list.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_list.i index 36678add..76f789b9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/std_list.i +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/std_list.i @@ -55,7 +55,7 @@ namespace std { SWIG_croak("Type error in argument $argnum of $symname. " "Expected an array of " #T); SV **tv; - I32 len = av_len(av) + 1; + SSize_t len = av_len(av) + 1; T* obj; for (int i=0; i::iterator i = self->find(key); @@ -64,17 +68,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_string.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/perl5/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_string_view.i new file mode 100644 index 00000000..b1afffcc --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/std_string_view.i @@ -0,0 +1,2 @@ +%include +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/perl5/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/perl5/std_vector.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/perl5/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/std_vector.i index 5bfd2c5a..06bc6f38 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/std_vector.i @@ -51,7 +51,7 @@ namespace std { SWIG_croak("Type error in argument $argnum of $symname. " "Expected an array of " #T); SV **tv; - I32 len = av_len(av) + 1; + SSize_t len = av_len(av) + 1; T* obj; for (int i=0; i diff --git a/macx64/bin/swig/share/swig/4.0.0/perl5/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/perl5/typemaps.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/perl5/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/perl5/typemaps.i index 3e1f60d9..078f24ce 100644 --- a/macx64/bin/swig/share/swig/4.0.0/perl5/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/perl5/typemaps.i @@ -206,7 +206,7 @@ output values. if (argvi >= items) { EXTEND(sp, argvi+1); } - sprintf(temp,"%lld", (long long)*($1)); + SWIG_snprintf(temp, sizeof(temp),"%lld", (long long)*($1)); $result = sv_newmortal(); sv_setpv($result,temp); argvi++; @@ -217,7 +217,7 @@ output values. if (argvi >= items) { EXTEND(sp, argvi+1); } - sprintf(temp,"%llu", (unsigned long long)*($1)); + SWIG_snprintf(temp, sizeof(temp),"%llu", (unsigned long long)*($1)); $result = sv_newmortal(); sv_setpv($result,temp); argvi++; diff --git a/macx64/bin/swig/share/swig/4.3.0/php/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/php/argcargv.i new file mode 100644 index 00000000..2a0d745d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/argcargv.i @@ -0,0 +1,38 @@ +/* ------------------------------------------------------------- + * 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) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/php/cdata.i b/macx64/bin/swig/share/swig/4.3.0/php/cdata.i new file mode 100644 index 00000000..4a755546 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/cdata.i @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data. + * ----------------------------------------------------------------------------- */ + +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ + +%typemap(in, phptype="string") (const void *BYTES, size_t LENGTH) %{ + convert_to_string(&$input); + $1 = ($1_ltype) Z_STRVAL($input); + $2 = ($2_ltype) Z_STRLEN($input); +%} +%apply (const void *BYTES, size_t LENGTH) { (void *BYTES, size_t LENGTH) } + +%include + +%typemap(out) SWIGCDATA { + ZVAL_STRINGL($result, $1.data, $1.len); +} + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/php/const.i b/macx64/bin/swig/share/swig/4.3.0/php/const.i new file mode 100644 index 00000000..1e1fe9ca --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/const.i @@ -0,0 +1,103 @@ +/* ----------------------------------------------------------------------------- + * const.i + * + * Typemaps for constants + * ----------------------------------------------------------------------------- */ +%typemap(classconsttab) int, + unsigned int, + short, + unsigned short, + long, + unsigned long, + unsigned char, + signed char, + enum SWIGTYPE %{ + 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)); +%} + +%typemap(classconsttab) float, + double %{ + zend_declare_class_constant_double(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, $value); +%} + +%typemap(classconsttab) char %{ +{ + char swig_char = $value; + zend_declare_class_constant_stringl(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, &swig_char, 1); +} +%} + +%typemap(classconsttab) char *, + const char *, + char [], + const char [] %{ + zend_declare_class_constant_string(SWIG_Php_ce_$class, "$const_name", sizeof("$const_name") - 1, $value); +%} + +// This creates a zend_object to wrap the pointer, and we can't do that +// before the Zend runtime has been initialised so we delay it until +// RINIT. The downside is it then happens for every request. +%typemap(classconsttab,rinit=1) SWIGTYPE *, + SWIGTYPE &, + SWIGTYPE &&, + SWIGTYPE [] %{ +{ + zval z; + ZVAL_UNDEF(&z); + 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(consttab) int, + unsigned int, + short, + unsigned short, + long, + unsigned long, + unsigned char, + signed char, + enum SWIGTYPE + "SWIG_LONG_CONSTANT($symname, ($1_type)($value));"; + +%typemap(consttab) bool + "SWIG_BOOL_CONSTANT($symname, ($1_type)($value));"; + +%typemap(consttab) float, + double + "SWIG_DOUBLE_CONSTANT($symname, $value);"; + +%typemap(consttab) char + "SWIG_CHAR_CONSTANT($symname, $value);"; + +%typemap(consttab) char *, + const char *, + char [], + const char [] + "SWIG_STRING_CONSTANT($symname, $value);"; + +// This creates a zend_object to wrap the pointer, and we can't do that +// before the Zend runtime has been initialised so we delay it until +// RINIT. The downside is it then happens for every request. +%typemap(consttab,rinit=1) SWIGTYPE *, + SWIGTYPE &, + SWIGTYPE &&, + SWIGTYPE [] { + zend_constant c; + ZVAL_UNDEF(&c.value); + SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0); + zval_copy_ctor(&c.value); + c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); + ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); + zend_register_constant(&c); +} + +/* Handled as a global variable. */ +%typemap(consttab) SWIGTYPE (CLASS::*) "" diff --git a/macx64/bin/swig/share/swig/4.0.0/php/director.swg b/macx64/bin/swig/share/swig/4.3.0/php/director.swg similarity index 78% rename from macx64/bin/swig/share/swig/4.0.0/php/director.swg rename to macx64/bin/swig/share/swig/4.3.0/php/director.swg index ea0eba8a..55ffff51 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/php/director.swg @@ -8,6 +8,8 @@ #ifndef SWIG_DIRECTOR_PHP_HEADER_ #define SWIG_DIRECTOR_PHP_HEADER_ +#define SWIG_DIRECTOR_CAST(ARG) dynamic_cast(ARG) + #include #include #include @@ -76,31 +78,34 @@ namespace Swig { }; class Director { + private: + /* flag indicating whether the object is owned by PHP or C++ */ + mutable bool swig_disown_flag; + protected: // "mutable" so we can get a non-const pointer to it in const methods. mutable zval swig_self; typedef std::map swig_ownership_map; mutable swig_ownership_map swig_owner; + public: - Director(zval *self) { + Director(zval *self) : swig_disown_flag(false) { ZVAL_COPY_VALUE(&swig_self, self); } - static bool swig_is_overridden_method(const char *cname, const char *lc_fname) { - bool result = false; - zend_string * cname_str = zend_string_init(cname, strlen(cname), 0); - zend_class_entry *ce = zend_lookup_class(cname_str); - if (ce) { - zval * mptr = zend_hash_str_find(&ce->function_table, lc_fname, strlen(lc_fname)); - if (mptr) { - // common.scope points to zend_class_entry for the declaring class, - // and there's only one of those per class, so we can just use a - // pointer compare here. - result = Z_FUNC_P(mptr)->common.scope != ce; - } + ~Director() { + if (swig_disown_flag) { + Z_DELREF(swig_self); + } + } + + zend_object *swig_get_self() const { return Z_OBJ(swig_self); } + + void swig_disown() const { + if (!swig_disown_flag) { + swig_disown_flag = true; + Z_ADDREF(swig_self); } - zend_string_release(cname_str); - return result; } template @@ -109,6 +114,12 @@ namespace Swig { swig_owner[vptr] = new GCItem_T(vptr); } } + + void swig_acquire_ownership_obj(void *vptr, int own) const { + if (vptr && own) { + swig_owner[vptr] = new GCItem_Object(own); + } + } }; /* base class for director exceptions */ @@ -121,8 +132,8 @@ namespace Swig { swig_msg += " "; swig_msg += msg; } - SWIG_ErrorCode() = code; - SWIG_ErrorMsg() = swig_msg.c_str(); + // Don't replace an already active PHP exception. + if (!EG(exception)) zend_throw_exception(NULL, swig_msg.c_str(), code); } virtual ~DirectorException() throw() { @@ -150,8 +161,7 @@ namespace Swig { }; /* any php exception that occurs during a director method call */ - class DirectorMethodException : public DirectorException - { + class DirectorMethodException : public DirectorException { public: DirectorMethodException() : DirectorException(E_ERROR, "SWIG director method error", NULL) { diff --git a/macx64/bin/swig/share/swig/4.0.0/php/factory.i b/macx64/bin/swig/share/swig/4.3.0/php/factory.i similarity index 64% rename from macx64/bin/swig/share/swig/4.0.0/php/factory.i rename to macx64/bin/swig/share/swig/4.3.0/php/factory.i index c4e082dd..5f2b397e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/factory.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/factory.i @@ -3,41 +3,41 @@ you have: ---- geometry.h -------- - struct Geometry { - enum GeomType{ - POINT, - CIRCLE - }; - - virtual ~Geometry() {} + struct Geometry { + enum GeomType{ + POINT, + CIRCLE + }; + + virtual ~Geometry() {} virtual int draw() = 0; - + // // Factory method for all the Geometry objects // - static Geometry *create(GeomType i); - }; - - struct Point : Geometry { - int draw() { return 1; } - double width() { return 1.0; } - }; - - struct Circle : Geometry { - int draw() { return 2; } - double radius() { return 1.5; } - }; - + static Geometry *create(GeomType i); + }; + + struct Point : Geometry { + int draw() { return 1; } + double width() { return 1.0; } + }; + + struct Circle : Geometry { + int draw() { return 2; } + double radius() { return 1.5; } + }; + // // Factory method for all the Geometry objects // Geometry *Geometry::create(GeomType type) { - switch (type) { - case POINT: return new Point(); - case CIRCLE: return new Circle(); - default: return 0; - } - } + switch (type) { + case POINT: return new Point(); + case CIRCLE: return new Circle(); + default: return 0; + } + } ---- geometry.h -------- @@ -57,16 +57,16 @@ NOTES: remember to fully qualify all the type names and don't use %factory inside a namespace declaration, ie, instead of - + namespace Foo { %factory(Geometry *Geometry::create, Point, Circle); } use - %factory(Foo::Geometry *Foo::Geometry::create, Foo::Point, Foo::Circle); + %factory(Foo::Geometry *Foo::Geometry::create, Foo::Point, Foo::Circle); + - */ /* for loop for macro with one argument */ @@ -90,20 +90,20 @@ /* for loop for macro with two arguments */ %define %formacro_2(macro,...)%_formacro_2(macro, __VA_ARGS__, __fordone__)%enddef -%define %_factory_dispatch(Type) +%define %_factory_dispatch(Type) if (!dcast) { Type *dobj = dynamic_cast($1); if (dobj) { dcast = 1; - SWIG_SetPointerZval(return_value, SWIG_as_voidptr(dobj),$descriptor(Type *), $owner); - } + SWIG_SetPointerZval(return_value, SWIG_as_voidptr(dobj), $descriptor(Type *), $owner); + } }%enddef %define %factory(Method,Types...) -%typemap(out) Method { +%typemap(out, phptype="?SWIGTYPE") Method { int dcast = 0; %formacro(%_factory_dispatch, Types) if (!dcast) { - SWIG_SetPointerZval(return_value, SWIG_as_voidptr($1),$descriptor, $owner); + SWIG_SetPointerZval(return_value, SWIG_as_voidptr($1), $descriptor, $owner); } }%enddef diff --git a/macx64/bin/swig/share/swig/4.3.0/php/php.swg b/macx64/bin/swig/share/swig/4.3.0/php/php.swg new file mode 100644 index 00000000..64bf0b27 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/php.swg @@ -0,0 +1,619 @@ +/* ----------------------------------------------------------------------------- + * php.swg + * + * PHP configuration file + * ----------------------------------------------------------------------------- */ + +%include + +// Default to generating PHP type declarations (for PHP >= 8) except for +// cases which are liable to cause compatibility issues with existing +// bindings. +%feature("php:type", "compat"); + +%runtime "swigrun.swg" // Common C API type-checking code +%runtime "swigerrors.swg" // SWIG errors +%runtime "phprun.swg" // PHP runtime functions + +%include // PHP initialization routine. + +%include + +// use %init %{ "/*code goes here*/ " %} +// or %minit %{ "/* code goes here*/ " %} to +// insert code in the PHP_MINIT_FUNCTION +#define %minit %insert("init") + +// use %rinit %{ "/* code goes here*/ " %} to +// insert code in the PHP_RINIT_FUNCTION +#define %rinit %insert("rinit") + +// use %shutdown %{ " /*code goes here*/ " %} to +// insert code in the PHP_MSHUTDOWN_FUNCTION +#define %shutdown %insert("shutdown") +#define %mshutdown %insert("shutdown") + +// use %rshutdown %{ " /*code goes here*/" %} to +// insert code in the PHP_RSHUTDOWN_FUNCTION +#define %rshutdown %insert("rshutdown") + +/* Typemaps for input parameters by value */ + +%include + +%pass_by_val(bool, "bool", CONVERT_BOOL_IN); + +%pass_by_val(size_t, "int", CONVERT_INT_IN); + +%pass_by_val(enum SWIGTYPE, "int", CONVERT_INT_IN); + +%pass_by_val(signed int, "int", CONVERT_INT_IN); +%pass_by_val(int,"int", CONVERT_INT_IN); +%pass_by_val(unsigned int,"int", CONVERT_INT_IN); + +%pass_by_val(signed short, "int", CONVERT_INT_IN); +%pass_by_val(short,"int", CONVERT_INT_IN); +%pass_by_val(unsigned short, "int", CONVERT_INT_IN); + +%pass_by_val(signed long, "int", CONVERT_INT_IN); +%pass_by_val(long, "int", CONVERT_INT_IN); +%pass_by_val(unsigned long, "int", CONVERT_INT_IN); + +%pass_by_val(signed long long, "int|string", CONVERT_LONG_LONG_IN); +%pass_by_val(long long, "int|string", CONVERT_LONG_LONG_IN); +%pass_by_val(unsigned long long, "int|string", CONVERT_UNSIGNED_LONG_LONG_IN); + +%pass_by_val(signed char, "int", CONVERT_INT_IN); +%pass_by_val(char, "string", CONVERT_CHAR_IN); +%pass_by_val(unsigned char, "int", CONVERT_INT_IN); + +%pass_by_val(float, "float", CONVERT_FLOAT_IN); + +%pass_by_val(double, "float", CONVERT_FLOAT_IN); + +%pass_by_val(char *, "string", CONVERT_STRING_IN); +%typemap(in) char *& = const char *&; +%typemap(directorout) char *& = const char *&; + +// char array can be in/out, though the passed string may not be big enough... +// so we have to size it +%typemap(in, phptype="string") char[ANY] +%{ + convert_to_string(&$input); + $1 = ($1_ltype) Z_STRVAL($input); +%} + +/* String & length typemap */ + +%typemap(in, phptype="string", noblock=1) (const char *STRING, size_t LENGTH) %{ + convert_to_string(&$input); + $1 = ($1_ltype) Z_STRVAL($input); + $2 = ($2_ltype) Z_STRLEN($input); +%} +%typemap(directorin, noblock=1) (const char *STRING, size_t LENGTH) { + if (!$1) { + ZVAL_EMPTY_STRING($input); + } else { + ZVAL_STRINGL($input, (const char*)$1, (size_t)$2); + } +} +%apply (const char *STRING, size_t LENGTH) { (const char *STRING, int LENGTH) } +%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) } +%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } + +/* Object passed by value. Convert to a pointer */ +%typemap(in, phptype="SWIGTYPE") SWIGTYPE ($&1_ltype tmp) +%{ + if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { + zend_type_error("Expected $&1_descriptor for argument $argnum of $symname"); + return; + } + $1 = *tmp; +%} + +%typemap(directorout) SWIGTYPE ($&1_ltype tmp) +%{ + if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { + zend_type_error("Expected $&1_descriptor for argument $argnum of $symname"); + SWIG_fail; + } + $result = *tmp; +%} + +%typemap(in, phptype="?SWIGTYPE") SWIGTYPE *, + SWIGTYPE [] +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } +%} + +%typemap(directorout) SWIGTYPE * (swig_owntype own), + SWIGTYPE [] (swig_owntype own) +%{ + if (SWIG_ConvertPtrAndOwn($input, (void **)&$result, $1_descriptor, SWIG_POINTER_DISOWN, &own) < 0) { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + SWIG_fail; + } + swig_acquire_ownership_obj((void*)$result, own); +%} + +%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) +%{ + if (SWIG_ConvertPtr($input, (void **) &tmp, $1_descriptor, 0) < 0 || tmp == NULL) { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + SWIG_fail; + } + $result = tmp; +%} + +%typemap(in, phptype="?SWIGTYPE") SWIGTYPE *const& ($*ltype temp) +%{ + if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) { + zend_type_error("Expected $*1_descriptor for argument $argnum of $symname"); + return; + } + $1 = ($1_ltype)&temp; +%} + +%typemap(in, phptype="?SWIGTYPE") SWIGTYPE *DISOWN +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN) < 0) { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } +%} + +%typemap(argout) SWIGTYPE *, + SWIGTYPE [], + SWIGTYPE &, + SWIGTYPE &&; + +%typemap(in, phptype="?SWIGTYPE") void * +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) { + /* Allow NULL from php for void* */ + if (Z_ISNULL($input)) { + $1=0; + } else { + zend_type_error("Expected $1_descriptor for argument $argnum of $symname"); + return; + } + } +%} + +/* Special case when void* is passed by reference so it can be made to point + to opaque api structs */ +%typemap(in, phptype="?SWIG\\_p_void", byref=1) void ** ($*1_ltype ptr, int force), + void *& ($*1_ltype ptr, int force) +{ + /* If they pass NULL by reference, make it into a void* + This bit should go in arginit if arginit support init-ing scripting args */ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { + /* So... we didn't get a ref or ptr, but we'll accept NULL by reference */ + if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) { + /* wasn't a pre/ref/thing, OR anything like an int thing */ + zend_throw_exception(zend_ce_type_error, "Type error in argument $arg of $symname", 0); + goto fail; + } + } + force=0; + if (arg1==NULL) { +#ifdef __cplusplus + ptr=new $*1_ltype(); +#else + ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); +#endif + $1=&ptr; + /* have to passback arg$arg too */ + force=1; + } +} +%typemap(argout) void **, + void *& +%{ + if (force$argnum && Z_ISREF($input)) { + SWIG_SetPointerZval(Z_REFVAL($input), (void*) ptr$argnum, $*1_descriptor, 1); + } +%} + +/* Typemap for output values */ + +%typemap(out, phptype="int") + int, + unsigned int, + short, + unsigned short, + long, + unsigned long, + signed char, + unsigned char, + size_t +%{ + RETVAL_LONG($1); +%} + +%typemap(out, phptype="int") enum SWIGTYPE +%{ + RETVAL_LONG((long)$1); +%} + +%typemap(out, phptype="int|string") long long +%{ + if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { + RETVAL_LONG((long)($1)); + } else { + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)$1)); + } +%} +%typemap(out, phptype="int|string") unsigned long long +%{ + if ($1 <= (unsigned long long)LONG_MAX) { + RETVAL_LONG((long)($1)); + } else { + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)$1)); + } +%} + +%typemap(out, phptype="int") + const int &, + const unsigned int &, + const short &, + const unsigned short &, + const long &, + const unsigned long &, + const signed char &, + const unsigned char &, + const bool &, + const size_t & +%{ + RETVAL_LONG(*$1); +%} + +%typemap(out, phptype="int") const enum SWIGTYPE & +%{ + RETVAL_LONG((long)*$1); +%} + +%typemap(out, phptype="int") const enum SWIGTYPE && +%{ + RETVAL_LONG((long)*$1); +%} + +%typemap(out, phptype="int|string") const long long & +%{ + if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { + RETVAL_LONG((long)(*$1)); + } else { + RETVAL_NEW_STR(zend_strpprintf(0, "%lld", (long long)(*$1))); + } +%} +%typemap(out, phptype="int|string") const unsigned long long & +%{ + if (*$1 <= (unsigned long long)LONG_MAX) { + RETVAL_LONG((long)(*$1)); + } else { + RETVAL_NEW_STR(zend_strpprintf(0, "%llu", (unsigned long long)(*$1))); + } +%} + +%typemap(directorin) int, + unsigned int, + short, + unsigned short, + long, + unsigned long, + signed char, + unsigned char, + size_t, + enum SWIGTYPE +%{ + ZVAL_LONG($input,$1); +%} + +%typemap(directorin) enum SWIGTYPE +%{ + ZVAL_LONG($input, (long)$1_name); +%} + +%typemap(directorin) char *, char [] +%{ + if(!$1) { + ZVAL_NULL($input); + } else { + ZVAL_STRING($input, (const char*)$1); + } +%} + +%typemap(out, phptype="bool") bool +%{ + RETVAL_BOOL(($1) ? 1 : 0); +%} + +%typemap(out, phptype="bool") const bool & +%{ + RETVAL_BOOL((*$1) ? 1 : 0); +%} + +%typemap(directorin) bool +%{ + ZVAL_BOOL($input, ($1) ? 1 : 0); +%} + +%typemap(out, phptype="float") float, + double +%{ + RETVAL_DOUBLE($1); +%} + +%typemap(out, phptype="float") const float &, + const double & +%{ + RETVAL_DOUBLE(*$1); +%} + +%typemap(directorin) float, + double +%{ + ZVAL_DOUBLE($input, $1); +%} + +%typemap(out, phptype="string") char +%{ + RETVAL_STRINGL(&$1, 1); +%} + +%typemap(out, phptype="string") const char & +%{ + RETVAL_STRINGL(&*$1, 1); +%} + +%typemap(out, phptype="string") char [] +%{ + RETVAL_STRING((const char *)$1); +%} + +%typemap(out, phptype="?string") char * +%{ + if (!$1) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)$1); + } +%} + +%typemap(out, phptype="?string") char *& +%{ + if (!*$1) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)*$1); + } +%} + +%typemap(out, phptype="?SWIGTYPE") SWIGTYPE * +%{ + SWIG_SetPointerZval($result, (void *)$1, $1_descriptor, $owner); +%} + +%typemap(out, phptype="SWIGTYPE") + SWIGTYPE [], + SWIGTYPE &, + SWIGTYPE && +%{ + SWIG_SetPointerZval($result, (void *)$1, $1_descriptor, $owner); +%} + +%typemap(out, phptype="?SWIGTYPE") SWIGTYPE *const& +%{ + SWIG_SetPointerZval($result, (void *)*$1, $*1_descriptor, $owner); +%} + +%typemap(directorin) SWIGTYPE *, + SWIGTYPE [], + SWIGTYPE &, + SWIGTYPE && +%{ + ZVAL_UNDEF($input); + SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, $owner); +%} + +%typemap(out, phptype="SWIGTYPE") SWIGTYPE (CLASS::*) +{ + void * p = emalloc(sizeof($1)); + memcpy(p, &$1, sizeof($1)); + SWIG_SetPointerZval($result, (void *)p, $&1_descriptor, 1); +} + +%typemap(in, phptype="SWIGTYPE") SWIGTYPE (CLASS::*) +{ + void * p = SWIG_Z_FETCH_OBJ_P(&$input)->ptr; + memcpy(&$1, p, sizeof($1)); +} + +%typemap(out, phptype="?SWIGTYPE") SWIGTYPE *DYNAMIC +{ + swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); + SWIG_SetPointerZval($result, (void *)$1, ty, $owner); +} + +%typemap(out, phptype="SWIGTYPE") SWIGTYPE &DYNAMIC +{ + swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); + SWIG_SetPointerZval($result, (void *)$1, ty, $owner); +} + +%typemap(out, phptype="SWIGTYPE") SWIGTYPE +{ +#ifdef __cplusplus + $&1_ltype resultobj = new $1_ltype($1); +#else + $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type)); + memcpy(resultobj, &$1, sizeof($1_type)); +#endif + SWIG_SetPointerZval($result, (void *)resultobj, $&1_descriptor, 1); +} + +%typemap(directorin) SWIGTYPE +%{ + ZVAL_UNDEF($input); + SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1); +%} + +%typemap(out, phptype="void") void "" + +%typemap(out, phptype="string") char [ANY] +{ + size_t len = 0; + while (len < $1_dim0 && $1[len]) ++len; + RETVAL_STRINGL($1, len); +} + +// This typecheck does hard checking for proper argument type. If you want +// an argument to be converted from a different PHP type, you must convert +// it yourself before passing it (e.g. (string)4.7 or (int)"6"). +%define %php_typecheck(_type,_prec,is) +%typemap(typecheck,precedence=_prec) _type, const _type & + " $1 = (Z_TYPE($input) == is);" +%enddef + +// Like %php_typecheck but allows either of two values. +%define %php_typecheck2(_type,_prec,is1,is2) +%typemap(typecheck,precedence=_prec) _type, const _type & + " $1 = (Z_TYPE($input) == is1 || Z_TYPE($input) == is2);" +%enddef + +%define %php_typecheck_long(_type,_prec,_min,_max) +%typemap(typecheck,precedence=_prec) _type, const _type & %{ + $1 = (Z_TYPE($input) == IS_LONG && + (_min <= ZEND_LONG_MIN || (zend_long)_min <= Z_LVAL($input)) && + (_max >= ZEND_LONG_MAX || (zend_long)_max >= Z_LVAL($input))); +%} +%enddef + +%php_typecheck_long(int,SWIG_TYPECHECK_INTEGER,INT_MIN,INT_MAX) +%php_typecheck_long(unsigned int,SWIG_TYPECHECK_UINT32,0,UINT_MAX) +%php_typecheck_long(short,SWIG_TYPECHECK_INT16,SHRT_MIN,SHRT_MAX) +%php_typecheck_long(unsigned short,SWIG_TYPECHECK_UINT16,0,USHRT_MAX) +%php_typecheck_long(long,SWIG_TYPECHECK_INT32,LONG_MIN,LONG_MAX) +%php_typecheck_long(unsigned long,SWIG_TYPECHECK_UINT32,0,ULONG_MAX) +%php_typecheck_long(long long,SWIG_TYPECHECK_INT64,LLONG_MIN,LLONG_MAX) +%php_typecheck_long(unsigned long long,SWIG_TYPECHECK_UINT64,0,ULLONG_MAX) +%php_typecheck_long(signed char,SWIG_TYPECHECK_INT8,SCHAR_MIN,SCHAR_MAX) +%php_typecheck_long(unsigned char,SWIG_TYPECHECK_UINT8,0,UCHAR_MAX) +%php_typecheck_long(size_t,SWIG_TYPECHECK_SIZE,0,(size_t)-1) +%php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG) +%php_typecheck2(bool,SWIG_TYPECHECK_BOOL,IS_TRUE,IS_FALSE) +%typemap(typecheck,precedence=SWIG_TYPECHECK_FLOAT,fragment="SWIG_Float_Overflow_Check") float, const float & %{ + $1 = (Z_TYPE($input) == IS_DOUBLE && !SWIG_Float_Overflow_Check(Z_DVAL($input))); +%} +/* Don't range check here since PHP stores this as C/C++ double. */ +%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE) +%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING) + +%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *& + " $1 = (Z_TYPE($input) == IS_STRING || Z_TYPE($input) == IS_NULL); " + +%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char [] + " $1 = (Z_TYPE($input) == IS_STRING); " + +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE +{ + void *tmp; + $1 = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, SWIG_POINTER_NO_NULL) >= 0); +} + +%typecheck(SWIG_TYPECHECK_POINTER) + SWIGTYPE *, + SWIGTYPE [], + SWIGTYPE *const& +{ + void *tmp; + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0); +} + +%typecheck(SWIG_TYPECHECK_POINTER) + SWIGTYPE &, + SWIGTYPE && +{ + void *tmp; + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, SWIG_POINTER_NO_NULL) >= 0); +} + +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& +{ + void *tmp; + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0); +} + +%typecheck(SWIG_TYPECHECK_VOIDPTR) void * +{ + void *tmp; + $1 = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0); +} + +/* Exception handling */ + +%typemap(throws) int, + long, + short, + unsigned int, + unsigned long, + unsigned short %{ + zend_throw_exception(NULL, "C++ $1_type exception thrown", $1); + goto fail; +%} + +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ + (void)$1; + zend_throw_exception(NULL, "C++ $1_type exception thrown", 0); + goto fail; +%} + +%typemap(throws) char * %{ + zend_throw_exception(NULL, $1, 0); + goto fail; +%} + +/* Array reference typemaps */ +%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } + +/* const pointers */ +%apply SWIGTYPE * { SWIGTYPE *const } +%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) } +%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) } + +/* php keywords */ +%include + +/* PHP known interfaces */ +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/php/phpinit.swg b/macx64/bin/swig/share/swig/4.3.0/php/phpinit.swg new file mode 100644 index 00000000..ae72a10a --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/phpinit.swg @@ -0,0 +1,16 @@ + +/* ------------------------------------------------------------ + * The start of the PHP initialization function + * ------------------------------------------------------------ */ + +%insert(init) "swiginit.swg" + +%init %{ +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/macx64/bin/swig/share/swig/4.3.0/php/phpinterfaces.i b/macx64/bin/swig/share/swig/4.3.0/php/phpinterfaces.i new file mode 100644 index 00000000..e1029b64 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/phpinterfaces.i @@ -0,0 +1,60 @@ +/* ----------------------------------------------------------------------------- + * phpinterfaces.i + * + * Define "known" PHP interfaces. + * + * These can be added at MINIT time (which is when PHP loads the extension + * module). + * + * Any interface can be added via phpinterfaces, but looking up the + * zend_class_entry by name has to wait until RINIT time, which means it + * happens for every request. + * ----------------------------------------------------------------------------- */ + +// Note: Abstract interfaces such as "Traversable" can't be used in +// "implements" so are not relevant here. + +%insert(header) %{ + +#define SWIG_PHP_INTERFACE_Iterator_CE zend_ce_iterator +#define SWIG_PHP_INTERFACE_Iterator_HEADER "zend_interfaces.h" + +#define SWIG_PHP_INTERFACE_IteratorAggregate_CE zend_ce_aggregate +#define SWIG_PHP_INTERFACE_IteratorAggregate_HEADER "zend_interfaces.h" + +#define SWIG_PHP_INTERFACE_ArrayAccess_CE zend_ce_arrayaccess +#define SWIG_PHP_INTERFACE_ArrayAccess_HEADER "zend_interfaces.h" + +#define SWIG_PHP_INTERFACE_Serializable_CE zend_ce_serializable +#define SWIG_PHP_INTERFACE_Serializable_HEADER "zend_interfaces.h" + +#define SWIG_PHP_INTERFACE_Countable_CE zend_ce_countable +#define SWIG_PHP_INTERFACE_Countable_HEADER "zend_interfaces.h" + +#define SWIG_PHP_INTERFACE_OuterIterator_CE spl_ce_OuterIterator +#define SWIG_PHP_INTERFACE_OuterIterator_HEADER "ext/spl/spl_iterators.h" + +#define SWIG_PHP_INTERFACE_RecursiveIterator_CE spl_ce_RecursiveIterator +#define SWIG_PHP_INTERFACE_RecursiveIterator_HEADER "ext/spl/spl_iterators.h" + +#define SWIG_PHP_INTERFACE_SeekableIterator_CE spl_ce_SeekableIterator +#define SWIG_PHP_INTERFACE_SeekableIterator_HEADER "ext/spl/spl_iterators.h" + +#define SWIG_PHP_INTERFACE_SplObserver_CE spl_ce_SplObserver +#define SWIG_PHP_INTERFACE_SplObserver_HEADER "ext/spl/spl_observer.h" + +#define SWIG_PHP_INTERFACE_SplSubject_CE spl_ce_SplSubject +#define SWIG_PHP_INTERFACE_SplSubject_HEADER "ext/spl/spl_observer.h" + +#define SWIG_PHP_INTERFACE_DateTimeInterface_CE php_date_get_interface_ce() +#define SWIG_PHP_INTERFACE_DateTimeInterface_HEADER "ext/date/php_date.h" + +// The "json" extension needs to be loaded earlier that us for this to work. +#define SWIG_PHP_INTERFACE_JsonSerializable_CE php_json_serializable_ce +#define SWIG_PHP_INTERFACE_JsonSerializable_HEADER "ext/json/php_json.h" + +// New in PHP 8.0. +#define SWIG_PHP_INTERFACE_Stringable_CE zend_ce_stringable +#define SWIG_PHP_INTERFACE_Stringable_HEADER "zend_interfaces.h" + +%} diff --git a/macx64/bin/swig/share/swig/4.0.0/php/phpkw.swg b/macx64/bin/swig/share/swig/4.3.0/php/phpkw.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/php/phpkw.swg rename to macx64/bin/swig/share/swig/4.3.0/php/phpkw.swg index 5c5296a1..443ac8bf 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/phpkw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/php/phpkw.swg @@ -3,10 +3,13 @@ * ----------------------------------------------------------------------------- */ /* Keyword (case insensitive) */ -#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x` +#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword",sourcefmt="%(lower)s",rename="c_%s") `x` + +/* Keyword, except ok as a function */ +#define PHPKW_ok_as_function(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",%$not %$isfunction,sourcefmt="%(lower)s",rename="c_%s") `x` /* Class (case insensitive) */ -#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x` +#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x` /* Constant (case insensitive) */ #define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x` @@ -22,7 +25,7 @@ PHPBN2a(X); PHPBN2b(X) %enddef -#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x` +#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x` /* From: http://php.net/manual/en/reserved.keywords.php * "You cannot use any of the following words as constants, class names, @@ -55,6 +58,7 @@ PHPKW(endwhile); PHPKW(extends); PHPKW(final); PHPKW(finally); +PHPKW(fn); // as of PHP 7.4 PHPKW(for); PHPKW(foreach); PHPKW(function); @@ -65,6 +69,7 @@ PHPKW(implements); PHPKW(instanceof); PHPKW(insteadof); PHPKW(interface); +PHPKW(match); // as of PHP 8.0 PHPKW(namespace); PHPKW(new); PHPKW(or); @@ -82,6 +87,11 @@ PHPKW(while); PHPKW(xor); PHPKW(yield); +/* PHP 8.1 made `readonly` a keyword, but (unlike any other keyword it seems) + * it may still be used as a function name. + */ +PHPKW_ok_as_function(readonly); + // Compile-time "magic" constants // From: http://php.net/manual/en/reserved.keywords.php // also at: http://php.net/manual/en/language.constants.predefined.php @@ -119,6 +129,10 @@ PHPBN2(PHP_SAPI); PHPBN2(PHP_EOL); PHPBN2(PHP_INT_MAX); PHPBN2(PHP_INT_SIZE); +PHPBN2(PHP_FLOAT_DIG); // Since 7.2.0 +PHPBN2(PHP_FLOAT_EPSILON); // Since 7.2.0 +PHPBN2(PHP_FLOAT_MIN); // Since 7.2.0 +PHPBN2(PHP_FLOAT_MAX); // Since 7.2.0 PHPBN2(DEFAULT_INCLUDE_PATH); PHPBN2(PEAR_INSTALL_DIR); PHPBN2(PEAR_EXTENSION_DIR); @@ -134,6 +148,7 @@ PHPBN2(PHP_LOCALSTATEDIR); PHPBN2(PHP_CONFIG_FILE_PATH); PHPBN2(PHP_CONFIG_FILE_SCAN_DIR); PHPBN2(PHP_SHLIB_SUFFIX); +PHPBN2(PHP_FD_SETSIZE); // Since 7.1.0 PHPBN2(E_ERROR); PHPBN2(E_WARNING); PHPBN2(E_PARSE); @@ -145,6 +160,7 @@ PHPBN2(E_COMPILE_WARNING); PHPBN2(E_USER_ERROR); PHPBN2(E_USER_WARNING); PHPBN2(E_USER_NOTICE); +PHPBN2(E_RECOVERABLE_ERROR); PHPBN2(E_DEPRECATED); PHPBN2(E_USER_DEPRECATED); PHPBN2(E_ALL); @@ -156,6 +172,9 @@ PHPBN2(__COMPILER_HALT_OFFSET__); PHPBN2(PHP_OUTPUT_HANDLER_START); PHPBN2(PHP_OUTPUT_HANDLER_CONT); PHPBN2(PHP_OUTPUT_HANDLER_END); +/* Since 7.4.0 (Microsoft Windows only) */ +PHPBN2(PHP_WINDOWS_EVENT_CTRL_C); +PHPBN2(PHP_WINDOWS_EVENT_CTRL_BREAK); /* These don't actually seem to be set (tested on Linux, I guess they're * Windows only?) */ PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); @@ -402,21 +421,6 @@ PHPBN2(CURLOPT_TCP_NODELAY); PHPBN2(CURLOPT_TIMEOUT_MS); PHPBN2(CURLOPT_CONNECTTIMEOUT_MS); PHPBN2(GMP_VERSION); -PHPBN2(SWFTEXTFIELD_USEFONT); -PHPBN2(SWFTEXTFIELD_AUTOSIZE); -PHPBN2(SWF_SOUND_NOT_COMPRESSED); -PHPBN2(SWF_SOUND_ADPCM_COMPRESSED); -PHPBN2(SWF_SOUND_MP3_COMPRESSED); -PHPBN2(SWF_SOUND_NOT_COMPRESSED_LE); -PHPBN2(SWF_SOUND_NELLY_COMPRESSED); -PHPBN2(SWF_SOUND_5KHZ); -PHPBN2(SWF_SOUND_11KHZ); -PHPBN2(SWF_SOUND_22KHZ); -PHPBN2(SWF_SOUND_44KHZ); -PHPBN2(SWF_SOUND_8BITS); -PHPBN2(SWF_SOUND_16BITS); -PHPBN2(SWF_SOUND_MONO); -PHPBN2(SWF_SOUND_STEREO); PHPBN2(OPENSSL_VERSION_NUMBER); PHPBN2(SNMP_OID_OUTPUT_FULL); PHPBN2(SNMP_OID_OUTPUT_NUMERIC); @@ -627,27 +631,26 @@ PHPBN2(PGSQL_POLLING_OK); PHPBN2(PGSQL_POLLING_READING); PHPBN2(PGSQL_POLLING_WRITING); -/* Class names reserved by PHP (case insensitive) */ +/* Class names reserved by PHP. */ +/* Check is case insensitive - these *MUST* be listed in lower case here. */ PHPCN(directory); PHPCN(stdclass); PHPCN(__php_incomplete_class); -/* Added in PHP5. */ PHPCN(exception); PHPCN(errorexception); PHPCN(php_user_filter); PHPCN(closure); PHPCN(generator); PHPCN(self); -PHPCN(static); PHPCN(parent); /* http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.classes */ PHPCN(bool); // As of PHP 7.0 PHPCN(int); // As of PHP 7.0 PHPCN(float); // As of PHP 7.0 PHPCN(string); // As of PHP 7.0 -PHPCN(NULL); // As of PHP 7.0 -PHPCN(TRUE); // As of PHP 7.0 -PHPCN(FALSE); // As of PHP 7.0 +PHPCN(null); // As of PHP 7.0 +PHPCN(true); // As of PHP 7.0 +PHPCN(false); // As of PHP 7.0 PHPCN(resource); // As of PHP 7.0 (currently works but reserved) PHPCN(object); // As of PHP 7.0 (currently works but reserved) PHPCN(mixed); // As of PHP 7.0 (currently works but reserved) @@ -655,6 +658,14 @@ PHPCN(numeric); // As of PHP 7.0 (currently works but reserved) /* http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.invalid-class-names */ PHPCN(iterable); // As of PHP 7.1 PHPCN(void); // As of PHP 7.1 +/* Predefined interfaces and classes, introduced in PHP 7.0.0 */ +PHPCN(arithmeticerror); +PHPCN(assertionerror); +PHPCN(divisionbyzeroerror); +PHPCN(error); +PHPCN(throwable); +PHPCN(parseerror); +PHPCN(typeerror); /* From extensions (which of these are actually predefined depends which * extensions are loaded by default). */ PHPCN(xmlwriter); @@ -866,6 +877,7 @@ PHPFN(unset); // "Language construct" PHPFN(usort); #undef PHPKW +#undef PHPKW_ok_as_function #undef PHPBN1a #undef PHPBN1b #undef PHPBN1 diff --git a/macx64/bin/swig/share/swig/4.3.0/php/phppointers.i b/macx64/bin/swig/share/swig/4.3.0/php/phppointers.i new file mode 100644 index 00000000..a4ff3c0b --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/phppointers.i @@ -0,0 +1,42 @@ +%define %pass_by_ref( TYPE, PHP_TYPE, CONVERT_IN, CONVERT_OUT ) +%typemap(in,byref=1,phptype=PHP_TYPE) TYPE *REF ($*1_ltype tmp), + TYPE &REF ($*1_ltype tmp) +%{ + if (Z_ISREF($input)) { + CONVERT_IN(tmp, $*1_ltype, $input); + $1 = &tmp; + } else { + zend_type_error(SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference)); + } +%} +%typemap(argout) TYPE *REF, + TYPE &REF +%{ + if (Z_ISREF($input)) { + CONVERT_OUT(Z_REFVAL($input), tmp$argnum); + } +%} +%enddef + +%pass_by_ref( size_t, "int", CONVERT_INT_IN, ZVAL_LONG ); + +%pass_by_ref( signed int, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( int, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( unsigned int, "int", CONVERT_INT_IN, ZVAL_LONG ); + +%pass_by_ref( signed short, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( short, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( unsigned short, "int", CONVERT_INT_IN, ZVAL_LONG ); + +%pass_by_ref( signed long, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( long, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( unsigned long, "int", CONVERT_INT_IN, ZVAL_LONG ); + +%pass_by_ref( signed char, "int", CONVERT_INT_IN, ZVAL_LONG ); +%pass_by_ref( char, "string", CONVERT_CHAR_IN, ZVAL_STRING ); +%pass_by_ref( unsigned char, "int", CONVERT_INT_IN, ZVAL_LONG ); + +%pass_by_ref( float, "float", CONVERT_FLOAT_IN, ZVAL_DOUBLE ); +%pass_by_ref( double, "float", CONVERT_FLOAT_IN, ZVAL_DOUBLE ); + +%pass_by_ref( char *, "string", CONVERT_CHAR_IN, ZVAL_STRING ); diff --git a/macx64/bin/swig/share/swig/4.3.0/php/phprun.swg b/macx64/bin/swig/share/swig/4.3.0/php/phprun.swg new file mode 100644 index 00000000..9022ca2e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/phprun.swg @@ -0,0 +1,233 @@ +/* ----------------------------------------------------------------------------- + * phprun.swg + * + * PHP runtime library + * ----------------------------------------------------------------------------- */ + +#define swig_owntype int + +#ifdef __cplusplus +extern "C" { +#endif + +#if PHP_MAJOR_VERSION < 8 +# error These bindings need PHP 8 or later - to generate PHP7 bindings use SWIG < 4.1.0; to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 +#endif + +/* For PHP 8.0 */ +#ifndef ZSTR_INIT_LITERAL +# define ZSTR_INIT_LITERAL(S, P) zend_string_init((S), strlen(S), (P)) +#endif + +#include "zend_inheritance.h" +#include "zend_exceptions.h" +#include "zend_inheritance.h" + +#include /* for abort(), used in generated code. */ + +#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT) +#define SWIG_CHAR_CONSTANT(N, V) do {\ + char swig_char = (V);\ + REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\ +} while (0) + +#ifdef __cplusplus +} +#endif + +#define SWIG_fail goto fail + +static const char *default_error_msg = "Unknown error occurred"; +static int default_error_code = E_ERROR; + +#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg + +#define SWIG_PHP_Error(code,msg) do { zend_throw_exception(NULL, msg, code); SWIG_fail; } while (0) + +#define SWIG_contract_assert(expr,msg) \ + do { if (!(expr)) zend_printf("Contract Assert Failed %s\n", msg); } while (0) + +/* Standard SWIG API */ +#define SWIG_GetModule(clientdata) SWIG_Php_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer, *(int*)clientdata) + +static zend_class_entry SWIG_Php_swig_wrapped_interface_ce; + +/* used to wrap returned objects in so we know whether they are newobject + and need freeing, or not */ +typedef struct { + void * ptr; + int newobject; + const swig_type_info * type; + zend_object std; +} swig_object_wrapper; + +#define SWIG_Z_FETCH_OBJ_P(zv) swig_php_fetch_object(Z_OBJ_P(zv)) + +static inline +swig_object_wrapper * swig_php_fetch_object(zend_object *obj) { + return (swig_object_wrapper *)((char *)obj - XtOffsetOf(swig_object_wrapper, std)); +} + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) + +static void +SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) { + // Return PHP NULL for a C/C++ NULL pointer. + if (!ptr) { + ZVAL_NULL(z); + return; + } + + if (!type->clientdata) { + zend_type_error("Type: %s not registered with zend", type->name); + return; + } + + { + zend_object *obj; + swig_object_wrapper *value; + if (Z_TYPE_P(z) == IS_OBJECT) { + /* The PHP object is already initialised - this is the case when wrapping + * the return value from a PHP constructor. */ + obj = Z_OBJ_P(z); + } else { + zend_class_entry *ce = (zend_class_entry*)(type->clientdata); + obj = ce->create_object(ce); + ZVAL_OBJ(z, obj); + } + value = swig_php_fetch_object(obj); + value->ptr = ptr; + value->newobject = (newobject & 1); + value->type = type; + } +} + +/* We wrap C/C++ pointers as PHP objects. */ +static int +SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_owntype *own) { + if (own) + *own = 0; + + if (z == NULL) { + *ptr = 0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } + + switch (Z_TYPE_P(z)) { + case IS_OBJECT: { + zend_object *obj = Z_OBJ_P(z); + swig_object_wrapper *value; + if (ty && ty->clientdata == (void*)obj->ce) { + // Object is exactly the class asked for - this handles common cases cheaply, + // and in particular the PHP classes we use to wrap a pointer to a non-class. + } else if (!zend_class_implements_interface(obj->ce, &SWIG_Php_swig_wrapped_interface_ce)) { + // Not an object we've wrapped. + return -1; + } + + /* convert and cast value->ptr from value->type to ptr as ty. */ + value = swig_php_fetch_object(obj); + if (!ty) { + /* They don't care about the target type, so just pass on the pointer! */ + *ptr = value->ptr; + } else { + swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, value->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 |= SWIG_CAST_NEW_MEMORY; + } + } else { + *ptr = NULL; + } + } + + 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: + *ptr = 0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; + } + + return -1; +} + +static int +SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) { + return SWIG_ConvertPtrAndOwn(z, ptr, ty, flags, 0); +} + +static const char const_name[] = "swig_runtime_data_type_pointer"; +static swig_module_info *SWIG_Php_GetModule(void) { + zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1); + if (pointer) { + if (Z_TYPE_P(pointer) == IS_LONG) { + return (swig_module_info *) pointer->value.lval; + } + } + return NULL; +} + +static void SWIG_Php_SetModule(swig_module_info *pointer, int module_number) { + REGISTER_LONG_CONSTANT(const_name, (long) pointer, CONST_CS | CONST_PERSISTENT); +} + +/* Common parts of the "create_object" object handler. */ +static zend_object *SWIG_Php_do_create_object(zend_class_entry *ce, zend_object_handlers *handlers) { + swig_object_wrapper *obj = (swig_object_wrapper*)zend_object_alloc(sizeof(swig_object_wrapper), ce); + zend_object_std_init(&obj->std, ce); + object_properties_init(&obj->std, ce); + obj->std.handlers = handlers; + obj->newobject = 1; + return &obj->std; +} + +/* Common parts of the "free_obj" object handler. + Returns void* pointer if the C/C++ object should be destroyed. */ +static void* SWIG_Php_free_obj(zend_object *object) { + if (object) { + swig_object_wrapper *obj = swig_php_fetch_object(object); + zend_object_std_dtor(&obj->std); + if (obj->newobject) return obj->ptr; + } + return NULL; +} + +SWIGINTERN void +SWIG_Php_AppendOutput(zval *target, zval *o, int is_void) { + zval tmp; + if (Z_TYPE_P(target) == IS_ARRAY) { + /* it's already an array, just append */ + add_next_index_zval(target, o); + return; + } + if (Z_TYPE_P(target) == IS_NULL && is_void) { + /* NULL isn't refcounted */ + ZVAL_COPY_VALUE(target, o); + return; + } + ZVAL_DUP(&tmp, target); + array_init(target); + add_next_index_zval(target, &tmp); + add_next_index_zval(target, o); +} diff --git a/macx64/bin/swig/share/swig/4.3.0/php/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/php/std_auto_ptr.i new file mode 100644 index 00000000..28409165 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/php/std_common.i b/macx64/bin/swig/share/swig/4.3.0/php/std_common.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/php/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/php/std_common.i index 092bf012..1b69fc77 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/std_common.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_common.i @@ -7,4 +7,3 @@ %include %apply size_t { std::size_t }; - diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/php/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/php/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/php/std_map.i b/macx64/bin/swig/share/swig/4.3.0/php/std_map.i similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/php/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/php/std_map.i index 7c015735..6904efc6 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_map.i @@ -35,7 +35,7 @@ namespace std { map(); map(const map& other); - + unsigned int size() const; void clear(); %extend { @@ -47,7 +47,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); @@ -66,17 +70,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/php/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/php/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/php/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/php/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.3.0/php/std_string.i b/macx64/bin/swig/share/swig/4.3.0/php/std_string.i new file mode 100644 index 00000000..aad77fb9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_string.i @@ -0,0 +1,121 @@ +/* ----------------------------------------------------------------------------- + * std_string.i + * + * SWIG typemaps for std::string types + * ----------------------------------------------------------------------------- */ + +%{ +#include +%} + +/* std::string and const std::string& are converted to/from PHP string + * automatically. + * + * A C++ std::string& parameter is wrapped as a pass-by-reference PHP + * string parameter by default, but the INPUT/INOUT/OUTPUT typemaps + * below provide other options (see below). + * + * std::string* is not wrapped by default, but INPUT/INOUT/OUTPUT typemaps + * are provided (see below). + */ + +namespace std { + + %naturalvar string; + + class string; + + %typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) string, const string& %{ + $1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0; + %} + + %typemap(in, phptype="string") string %{ + convert_to_string(&$input); + $1.assign(Z_STRVAL($input), Z_STRLEN($input)); + %} + + %typemap(directorout) string %{ + convert_to_string($input); + $result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input)); + %} + + %typemap(out, phptype="string") string %{ + ZVAL_STRINGL($result, $1.data(), $1.size()); + %} + + %typemap(directorin) string, const string& %{ + ZVAL_STRINGL($input, $1.data(), $1.size()); + %} + + %typemap(out, phptype="string") const string& %{ + ZVAL_STRINGL($result, $1->data(), $1->size()); + %} + + %typemap(throws) string, const string& %{ + zend_throw_exception(NULL, $1.c_str(), 0); + goto fail; + %} + + %typemap(throws) string*, const string* %{ + zend_throw_exception(NULL, $1->c_str(), 0); + goto fail; + %} + + %typemap(in, phptype="string") const string& ($*1_ltype temp) %{ + convert_to_string(&$input); + temp.assign(Z_STRVAL($input), Z_STRLEN($input)); + $1 = &temp; + %} + + /*************************************************************************/ + + /* These next four typemaps handle a function which takes a non-const + * reference to a std::string and modifies the string. */ + %typemap(in,byref=1, phptype="string") string& ($*1_ltype temp) %{ + { + zval * p = Z_ISREF($input) ? Z_REFVAL($input) : &$input; + convert_to_string(p); + temp.assign(Z_STRVAL_P(p), Z_STRLEN_P(p)); + $1 = &temp; + } + %} + + %typemap(directorout) string& ($*1_ltype *temp) %{ + convert_to_string($input); + temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input)); + swig_acquire_ownership(temp); + $result = temp; + %} + + %typemap(argout) string& %{ + if (Z_ISREF($input)) { + ZVAL_STRINGL(Z_REFVAL($input), $1->data(), $1->size()); + } + %} + + /* SWIG will apply the non-const typemap above to const string& without + * this more specific typemap. */ + %typemap(argout) const string& "" + + /*************************************************************************/ + + /* Alternative ways to handle string& - you can specify how to wrap based + * on the parameter name, e.g. this handles parameters named `str` as + * INOUT: + * + * %apply (std::string& INOUT) (std::string& str); + */ + + %typemap(in) string& INPUT = const string&; + %typemap(in, numinputs=0) string& OUTPUT ($*1_ltype temp) + %{ $1 = &temp; %} + %typemap(argout) string& OUTPUT + { + zval o; + ZVAL_STRINGL(&o, $1->data(), $1->size()); + SWIG_AppendOutput($result, &o); + } + %typemap(in) string& INOUT = const string&; + %typemap(argout) string& INOUT = string& OUTPUT; + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/php/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/php/std_string_view.i new file mode 100644 index 00000000..8fff6e10 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_string_view.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_string_view.i + * + * SWIG typemaps for std::string_view types + * ----------------------------------------------------------------------------- */ + +%include + +%{ +#include +%} + +namespace std { + + %naturalvar string_view; + + class string_view; + + %typemap(typecheck,precedence=SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view& %{ + $1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0; + %} + + %typemap(in, phptype="string") string_view %{ + convert_to_string(&$input); + $1 = std::string_view(Z_STRVAL($input), Z_STRLEN($input)); + %} + + %typemap(in, phptype="string") const string_view& ($*1_ltype temp) %{ + convert_to_string(&$input); + temp = std::string_view(Z_STRVAL($input), Z_STRLEN($input)); + $1 = &temp; + %} + + %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) string_view %{ + convert_to_string($input); + $result = std::string_view(Z_STRVAL_P($input), Z_STRLEN_P($input)); + %} + + %typemap(out, phptype="string") string_view %{ + ZVAL_STRINGL($result, $1.data(), $1.size()); + %} + + %typemap(directorin) string_view, const string_view& %{ + ZVAL_STRINGL($input, $1.data(), $1.size()); + %} + + %typemap(out, phptype="string") const string_view& %{ + ZVAL_STRINGL($result, $1->data(), $1->size()); + %} + + %typemap(throws) string_view, const string_view& %{ + { + zval swig_exception; + ZVAL_STRINGL(&swig_exception, $1.data(), $1.size()); + zend_throw_exception_object(&swig_exception); + goto fail; + } + %} + + %typemap(throws) string_view*, const string_view* %{ + { + zval swig_exception; + ZVAL_STRINGL(&swig_exception, $1->data(), $1->size()); + zend_throw_exception_object(&swig_exception); + goto fail; + } + %} + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/php/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/php/std_unique_ptr.i new file mode 100644 index 00000000..dc8db336 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_unique_ptr.i @@ -0,0 +1,73 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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; + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr(&$input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + zend_type_error("Expected $descriptor(TYPE *) for argument $argnum of $symname"); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + SWIG_SetPointerZval($result, (void *)$1->get(), $descriptor(TYPE *), $owner); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/php/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/php/std_vector.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/php/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/php/std_vector.i index e633bc3a..382b37ca 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/std_vector.i @@ -112,5 +112,3 @@ namespace std { %define specialize_std_vector(T) #warning "specialize_std_vector - specialization for type T no longer needed" %enddef - - diff --git a/macx64/bin/swig/share/swig/4.0.0/pointer.i b/macx64/bin/swig/share/swig/4.3.0/php/stl.i similarity index 56% rename from macx64/bin/swig/share/swig/4.0.0/pointer.i rename to macx64/bin/swig/share/swig/4.3.0/php/stl.i index ea8e535a..38aba67b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/pointer.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/stl.i @@ -1,11 +1,9 @@ /* ----------------------------------------------------------------------------- - * pointer.i + * stl.i * ----------------------------------------------------------------------------- */ - -%echo "pointer.i is deprecated. Use cpointer.i instead." -%echo "See http://www.swig.org/Doc3.0/Library.html" - - - - +%include +%include +%include +%include +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/php/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/php/swigmove.i new file mode 100644 index 00000000..75c18ce3 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/php/swigmove.i @@ -0,0 +1,26 @@ +/* ----------------------------------------------------------------------------- + * 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); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/php/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/php/typemaps.i similarity index 78% rename from macx64/bin/swig/share/swig/4.0.0/php/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/php/typemaps.i index c248a588..71e5cfde 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/typemaps.i @@ -25,21 +25,21 @@ * ----------------------------------------------------------------------------- */ %define BOOL_TYPEMAP(TYPE) -%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) +%typemap(in, phptype="bool") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ convert_to_boolean(&$input); 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,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" +%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT { zval o; ZVAL_BOOL(&o, temp$argnum); - t_output_helper($result, &o); + SWIG_AppendOutput($result, &o); } -%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) +%typemap(in, phptype="float") TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ convert_to_boolean($input); lvalue = (Z_TYPE_P($input) == IS_TRUE); @@ -52,20 +52,20 @@ %enddef %define DOUBLE_TYPEMAP(TYPE) -%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) +%typemap(in, phptype="float") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ 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,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" +%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT { zval o; ZVAL_DOUBLE(&o, temp$argnum); - t_output_helper($result, &o); + SWIG_AppendOutput($result, &o); } -%typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue) +%typemap(in, phptype="float") TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue) %{ dvalue = (TYPE) zval_get_double(&$input); $1 = &dvalue; @@ -77,20 +77,20 @@ %enddef %define INT_TYPEMAP(TYPE) -%typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) +%typemap(in, phptype="int") TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ 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,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT +%typemap(argout) TYPE *INPUT, TYPE &INPUT "" +%typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;" +%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT { zval o; ZVAL_LONG(&o, temp$argnum); - t_output_helper($result, &o); + SWIG_AppendOutput($result, &o); } -%typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) +%typemap(in, phptype="int") TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ lvalue = (TYPE) zval_get_long(&$input); $1 = &lvalue; @@ -116,19 +116,17 @@ INT_TYPEMAP(unsigned char); INT_TYPEMAP(signed char); INT_TYPEMAP(long long); -%typemap(argout,fragment="t_output_helper") long long *OUTPUT +%typemap(argout) long long *OUTPUT { zval o; 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); + SWIG_AppendOutput($result, &o); } -%typemap(in) TYPE *REFERENCE (long long lvalue) +%typemap(in, phptype="int|string") TYPE *REFERENCE (long long lvalue) %{ CONVERT_LONG_LONG_IN(lvalue, long long, $input) $1 = &lvalue; @@ -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,25 +144,22 @@ 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))); } %} + INT_TYPEMAP(unsigned long long); -%typemap(argout,fragment="t_output_helper") unsigned long long *OUTPUT +%typemap(argout) unsigned long long *OUTPUT { zval o; 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); + SWIG_AppendOutput($result, &o); } -%typemap(in) TYPE *REFERENCE (unsigned long long lvalue) +%typemap(in, phptype="int|string") TYPE *REFERENCE (unsigned long long lvalue) %{ CONVERT_UNSIGNED_LONG_LONG_IN(lvalue, unsigned long long, $input) $1 = &lvalue; @@ -176,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 @@ -186,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))); } %} @@ -252,7 +241,7 @@ INT_TYPEMAP(unsigned long long); %typemap(argout) unsigned long long &INOUT = unsigned long long *OUTPUT; %typemap(argout) signed char &INOUT = signed char *OUTPUT; -%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] ) +%typemap(in, phptype="string") char INPUT[ANY] ( char temp[$1_dim0] ) %{ convert_to_string(&$input); strncpy(temp, Z_STRVAL($input), $1_dim0); @@ -260,14 +249,14 @@ INT_TYPEMAP(unsigned long long); %} %typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] ) "$1 = temp;"; -%typemap(argout,fragment="t_output_helper") char OUTPUT[ANY] +%typemap(argout) char OUTPUT[ANY] { zval o; ZVAL_STRINGL(&o, temp$argnum, $1_dim0); - t_output_helper($result, &o); + SWIG_AppendOutput($result, &o); } -%typemap(in,numinputs=0) void **OUTPUT (int force), +%typemap(in,numinputs=0,phptype="?SWIGTYPE") void **OUTPUT (int force), void *&OUTPUT (int force) %{ /* If they pass NULL by reference, make it into a void* @@ -276,7 +265,8 @@ INT_TYPEMAP(unsigned long long); /* So... we didn't get a ref or ptr, but we'll accept NULL by reference */ if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) { /* wasn't a pre/ref/thing, OR anything like an int thing */ - SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname."); + zend_type_error("Expected reference or NULL for argument $arg of $symname"); + return; } } force=0; diff --git a/macx64/bin/swig/share/swig/4.0.0/php/utils.i b/macx64/bin/swig/share/swig/4.3.0/php/utils.i similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/php/utils.i rename to macx64/bin/swig/share/swig/4.3.0/php/utils.i index ed6e08ff..ceb88d38 100644 --- a/macx64/bin/swig/share/swig/4.0.0/php/utils.i +++ b/macx64/bin/swig/share/swig/4.3.0/php/utils.i @@ -16,9 +16,9 @@ char * endptr; errno = 0; lvar = (t) strtoll(Z_STRVAL(invar), &endptr, 10); - if (*endptr && !errno) break; - /* FALL THRU */ + if (*endptr == '\0' && !errno) break; } + /* FALL THRU */ default: lvar = (t) zval_get_long(&invar); } @@ -33,9 +33,9 @@ char * endptr; errno = 0; lvar = (t) strtoull(Z_STRVAL(invar), &endptr, 10); - if (*endptr && !errno) break; - /* FALL THRU */ + if (*endptr == '\0' && !errno) break; } + /* FALL THRU */ default: lvar = (t) zval_get_long(&invar); } @@ -63,48 +63,40 @@ } %enddef -%define %pass_by_val( TYPE, CONVERT_IN ) -%typemap(in) TYPE +%define %pass_by_val( TYPE, PHP_TYPE, CONVERT_IN ) +%typemap(in, phptype=PHP_TYPE) TYPE %{ CONVERT_IN($1,$1_ltype,$input); %} -%typemap(in) const TYPE & ($*1_ltype temp) +%typemap(in, phptype=PHP_TYPE) const TYPE & ($*1_ltype temp) %{ CONVERT_IN(temp,$*1_ltype,$input); $1 = &temp; %} %typemap(directorout) TYPE %{ - if (!EG(exception)) { - CONVERT_IN($result, $1_ltype, *$input); - } + CONVERT_IN($result, $1_ltype, *$input); %} -%typemap(directorout) const TYPE & ($*1_ltype temp) +%typemap(directorout) const TYPE & %{ - if (!EG(exception)) { - CONVERT_IN(temp, $*1_ltype, *$input); + $*1_ltype swig_val; + CONVERT_IN(swig_val, $*1_ltype, *$input); + $1_ltype temp = new $*1_ltype(swig_val); + swig_acquire_ownership(temp); + $result = temp; +%} +%typemap(directorfree) const TYPE & +%{ + if (director) { + director->swig_release_ownership(%as_voidptr($input)); } - $result = &temp; %} %enddef -%fragment("t_output_helper","header") %{ -static void -t_output_helper(zval *target, zval *o) { - zval tmp; - if (Z_TYPE_P(target) == IS_ARRAY) { - /* it's already an array, just append */ - add_next_index_zval(target, o); - return; - } - if (Z_TYPE_P(target) == IS_NULL) { - /* NULL isn't refcounted */ - ZVAL_COPY_VALUE(target, o); - return; - } - ZVAL_DUP(&tmp, target); - array_init(target); - add_next_index_zval(target, &tmp); - add_next_index_zval(target, o); -} -%} +#define SWIG_AppendOutput(result, obj) SWIG_Php_AppendOutput(result, obj, $isvoid) + +/* Deprecated (since 4.3.0) backwards compatibility macro */ +#define t_output_helper SWIG_AppendOutput + +/* Deprecated fragment */ +%fragment("t_output_helper","header") {} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/python/argcargv.i similarity index 85% rename from macx64/bin/swig/share/swig/4.0.0/python/argcargv.i rename to macx64/bin/swig/share/swig/4.3.0/python/argcargv.i index 717fe733..af71840f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/argcargv.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/python/attribute.i b/macx64/bin/swig/share/swig/4.3.0/python/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/python/attribute.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/python/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/python/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/python/boost_shared_ptr.i index 709e7811..bfd8787c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/python/builtin.swg b/macx64/bin/swig/share/swig/4.3.0/python/builtin.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/python/builtin.swg rename to macx64/bin/swig/share/swig/4.3.0/python/builtin.swg index 5062a8b4..e2e7f120 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/builtin.swg +++ b/macx64/bin/swig/share/swig/4.3.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 @@ -57,7 +61,7 @@ SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) { tuple = PyTuple_New(0); assert(tuple); result = (*getset->get)(obj, tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } @@ -89,11 +93,11 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { } tuple = PyTuple_New(1); assert(tuple); - Py_INCREF(val); + SWIG_Py_INCREF(val); PyTuple_SET_ITEM(tuple, 0, val); result = (*getset->set)(obj, tuple); - Py_DECREF(tuple); - Py_XDECREF(result); + SWIG_Py_DECREF(tuple); + SWIG_Py_XDECREF(result); return result ? 0 : -1; } @@ -111,15 +115,15 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) return -1; } result = (*getset->set)(obj, val); - Py_XDECREF(result); + SWIG_Py_XDECREF(result); return result ? 0 : -1; } SWIGINTERN void SwigPyStaticVar_dealloc(PyDescrObject *descr) { - _PyObject_GC_UNTRACK(descr); - Py_XDECREF(PyDescr_TYPE(descr)); - Py_XDECREF(PyDescr_NAME(descr)); + PyObject_GC_UnTrack(descr); + SWIG_Py_XDECREF((PyObject *)PyDescr_TYPE(descr)); + SWIG_Py_XDECREF((PyObject *)PyDescr_NAME(descr)); PyObject_GC_Del(descr); } @@ -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 */ @@ -256,6 +264,18 @@ SwigPyStaticVar_Type(void) { #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#if PY_VERSION_HEX >= 0x030c0000 + 0, /* tp_watched */ +#endif +#if PY_VERSION_HEX >= 0x030d00a4 + 0, /* tp_versions_used */ +#endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ @@ -289,7 +309,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 */ @@ -334,6 +358,18 @@ SwigPyObjectType(void) { #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#if PY_VERSION_HEX >= 0x030c0000 + 0, /* tp_watched */ +#endif +#if PY_VERSION_HEX >= 0x030d00a4 + 0, /* tp_versions_used */ +#endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ @@ -357,19 +393,19 @@ SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) { PyGetSetDescrObject *descr; descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0); assert(descr); - Py_XINCREF(type); + SWIG_Py_XINCREF((PyObject *)type); PyDescr_TYPE(descr) = type; PyDescr_NAME(descr) = PyString_InternFromString(getset->name); descr->d_getset = getset; if (PyDescr_NAME(descr) == NULL) { - Py_DECREF(descr); + SWIG_Py_DECREF((PyObject *)descr); descr = NULL; } return descr; } -SWIGINTERN void -SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { +SWIGINTERN PyObject * +SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t base_count = 0; PyTypeObject **b; PyObject *tuple; @@ -379,33 +415,31 @@ SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { bases[0] = SwigPyObject_type(); bases[1] = NULL; } - type->tp_base = bases[0]; - Py_INCREF((PyObject *)bases[0]); for (b = bases; *b != NULL; ++b) ++base_count; tuple = PyTuple_New(base_count); for (i = 0; i < base_count; ++i) { - Py_INCREF((PyObject *)bases[i]); + SWIG_Py_INCREF((PyObject *)bases[i]); PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]); } - type->tp_bases = tuple; + return tuple; } SWIGINTERN PyObject * SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { PyObject *result; result = (PyObject *)SWIG_Python_GetSwigThis(self); - Py_XINCREF(result); + SWIG_Py_XINCREF(result); return result; } SWIGINTERN void SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) { -#if PY_VERSION_HEX >= 0x03000000 - type->ob_base.ob_base.ob_type = metatype; +#if PY_VERSION_HEX >= 0x030900a4 + Py_SET_TYPE(type, metatype); #else - type->ob_type = metatype; + Py_TYPE(type) = metatype; #endif } @@ -433,7 +467,7 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - Py_XDECREF(sobj->dict); + SWIG_Py_XDECREF(sobj->dict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -442,15 +476,15 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap if (!o) { PyObject *deallocname = PyString_FromString(wrappername); PyErr_WriteUnraisable(deallocname); - Py_DECREF(deallocname); + SWIG_Py_DECREF(deallocname); } PyErr_Restore(type, value, traceback); - Py_XDECREF(o); + SWIG_Py_XDECREF(o); } if (PyType_IS_GC(a->ob_type)) { PyObject_GC_Del(a); } else { - PyObject_Del(a); + PyObject_Free(a); } } @@ -465,7 +499,7 @@ SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) { int result; pyresult = wrapper(a, NULL); result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; - Py_XDECREF(pyresult); + SWIG_Py_XDECREF(pyresult); return result; } @@ -489,10 +523,10 @@ SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyO PyObject *tuple, *result; tuple = PyTuple_New(1); assert(tuple); - Py_INCREF(b); + SWIG_Py_INCREF(b); PyTuple_SET_ITEM(tuple, 0, b); result = wrapper(a, tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } @@ -508,12 +542,14 @@ SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py PyObject *tuple, *result; tuple = PyTuple_New(2); assert(tuple); - Py_INCREF(b); + SWIG_Py_INCREF(b); PyTuple_SET_ITEM(tuple, 0, b); - Py_INCREF(c); - PyTuple_SET_ITEM(tuple, 1, c); + if (c) { + SWIG_Py_INCREF(c); + PyTuple_SET_ITEM(tuple, 1, c); + } result = wrapper(a, tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } @@ -539,7 +575,7 @@ SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { Py_ssize_t result; resultobj = wrapper(a, NULL); result = PyNumber_AsSsize_t(resultobj, NULL); - Py_DECREF(resultobj); + SWIG_Py_DECREF(resultobj); return result; } @@ -556,7 +592,7 @@ SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); result = wrapper(a, tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } @@ -574,13 +610,13 @@ SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObje PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); if (d) { - Py_INCREF(d); + SWIG_Py_INCREF(d); PyTuple_SET_ITEM(tuple, 2, d); } resultobj = wrapper(a, tuple); result = resultobj ? 0 : -1; - Py_DECREF(tuple); - Py_XDECREF(resultobj); + SWIG_Py_DECREF(tuple); + SWIG_Py_XDECREF(resultobj); return result; } @@ -596,7 +632,7 @@ SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObje assert(tuple); PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); result = wrapper(a, tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } @@ -610,7 +646,7 @@ SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, P PyObject *arg, *result; arg = _PyLong_FromSsize_t(b); result = wrapper(a, arg); - Py_DECREF(arg); + SWIG_Py_DECREF(arg); return result; } @@ -626,12 +662,14 @@ SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a tuple = PyTuple_New(2); assert(tuple); PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); - Py_INCREF(c); - PyTuple_SET_ITEM(tuple, 1, c); + if (c) { + SWIG_Py_INCREF(c); + PyTuple_SET_ITEM(tuple, 1, c); + } resultobj = wrapper(a, tuple); result = resultobj ? 0 : -1; - Py_XDECREF(resultobj); - Py_DECREF(tuple); + SWIG_Py_XDECREF(resultobj); + SWIG_Py_DECREF(tuple); return result; } @@ -647,12 +685,12 @@ SwigPyBuiltin_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyO PyObject *tuple; tuple = PyTuple_New(1); assert(tuple); - Py_INCREF(b); + SWIG_Py_INCREF(b); PyTuple_SET_ITEM(tuple, 0, b); pyresult = wrapper(a, tuple); result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1; - Py_XDECREF(pyresult); - Py_DECREF(tuple); + SWIG_Py_XDECREF(pyresult); + SWIG_Py_DECREF(tuple); return result; } @@ -667,7 +705,7 @@ SwigPyBuiltin_funpack_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject PyObject *pyresult; pyresult = wrapper(a, b); result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1; - Py_XDECREF(pyresult); + SWIG_Py_XDECREF(pyresult); return result; } @@ -682,16 +720,16 @@ SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, int result; tuple = PyTuple_New(c ? 2 : 1); assert(tuple); - Py_INCREF(b); + SWIG_Py_INCREF(b); PyTuple_SET_ITEM(tuple, 0, b); if (c) { - Py_INCREF(c); + SWIG_Py_INCREF(c); PyTuple_SET_ITEM(tuple, 1, c); } resultobj = wrapper(a, tuple); result = resultobj ? 0 : -1; - Py_XDECREF(resultobj); - Py_DECREF(tuple); + SWIG_Py_XDECREF(resultobj); + SWIG_Py_DECREF(tuple); return result; } @@ -718,7 +756,7 @@ SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { if (!pyresult) return -1; result = SWIG_PyNumber_AsPyHash(pyresult); - Py_DECREF(pyresult); + SWIG_Py_DECREF(pyresult); return result; } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/carrays.i b/macx64/bin/swig/share/swig/4.3.0/python/carrays.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/python/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/python/carrays.i index 74b2be9c..a7b6120d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/carrays.i @@ -7,7 +7,3 @@ %enddef %include - - - - diff --git a/macx64/bin/swig/share/swig/4.0.0/python/ccomplex.i b/macx64/bin/swig/share/swig/4.3.0/python/ccomplex.i similarity index 51% rename from macx64/bin/swig/share/swig/4.0.0/python/ccomplex.i rename to macx64/bin/swig/share/swig/4.3.0/python/ccomplex.i index 28872b98..b99f96a4 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/ccomplex.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/ccomplex.i @@ -12,15 +12,16 @@ #include %} +#define complex _Complex /* C complex constructor */ #define CCplxConst(r, i) ((r) + I*(i)) -%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); -%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); +%swig_cplxflt_convn(float _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double _Complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(_Complex, CCplxConst, creal, cimag); /* declaring the typemaps */ -%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); -%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double _Complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, _Complex); diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/python/cmalloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/cmalloc.i rename to macx64/bin/swig/share/swig/4.3.0/python/cmalloc.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/complex.i b/macx64/bin/swig/share/swig/4.3.0/python/complex.i new file mode 100644 index 00000000..4c3b3c5e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/complex.i @@ -0,0 +1,6 @@ +#ifdef __cplusplus +%include +#else +%include +#endif + diff --git a/macx64/bin/swig/share/swig/4.0.0/python/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/python/cpointer.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/python/cpointer.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/cstring.i b/macx64/bin/swig/share/swig/4.3.0/python/cstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/python/cstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/cwstring.i b/macx64/bin/swig/share/swig/4.3.0/python/cwstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/cwstring.i rename to macx64/bin/swig/share/swig/4.3.0/python/cwstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/director.swg b/macx64/bin/swig/share/swig/4.3.0/python/director.swg similarity index 80% rename from macx64/bin/swig/share/swig/4.0.0/python/director.swg rename to macx64/bin/swig/share/swig/4.3.0/python/director.swg index 4bdc94dc..c5935695 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/director.swg @@ -14,7 +14,6 @@ #include #include - /* Use -DSWIG_PYTHON_DIRECTOR_NO_VTABLE if you don't want to generate a 'virtual table', and avoid multiple GetAttr calls to retrieve the python @@ -173,7 +172,7 @@ namespace Swig { swig_msg += msg; } if (!PyErr_Occurred()) { - PyErr_SetString(error, what()); + PyErr_SetString(error, swig_msg.c_str()); } SWIG_PYTHON_THREAD_END_BLOCK; } @@ -199,46 +198,6 @@ namespace Swig { } }; - /* unknown exception handler */ - class UnknownExceptionHandler { -#ifdef SWIG_DIRECTOR_UEH - static void handler() { - try { - throw; - } catch (DirectorException& e) { - std::cerr << "SWIG Director exception caught:" << std::endl - << e.what() << std::endl; - } catch (std::exception& e) { - std::cerr << "std::exception caught: "<< e.what() << std::endl; - } catch (...) { - std::cerr << "Unknown exception caught." << std::endl; - } - - std::cerr << std::endl - << "Python interpreter traceback:" << std::endl; - PyErr_Print(); - std::cerr << std::endl; - - std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl - << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl - << std::endl - << "Exception is being re-thrown, program will likely abort/terminate." << std::endl; - throw; - } - - public: - - std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) { - old = std::set_unexpected(nh); - } - - ~UnknownExceptionHandler() { - std::set_unexpected(old); - } -#endif - }; - /* type mismatch in the return value from a python method call */ class DirectorTypeMismatchException : public DirectorException { public: @@ -284,31 +243,6 @@ namespace Swig { }; -#if defined(SWIG_PYTHON_THREADS) -/* __THREAD__ is the old macro to activate some thread support */ -# if !defined(__THREAD__) -# define __THREAD__ 1 -# endif -#endif - -#ifdef __THREAD__ -# include "pythread.h" - class Guard { - PyThread_type_lock &mutex_; - - public: - Guard(PyThread_type_lock & mutex) : mutex_(mutex) { - PyThread_acquire_lock(mutex_, WAIT_LOCK); - } - - ~Guard() { - PyThread_release_lock(mutex_); - } - }; -# define SWIG_GUARD(mutex) Guard _guard(mutex) -#else -# define SWIG_GUARD(mutex) -#endif /* director base class */ class Director { @@ -322,7 +256,7 @@ namespace Swig { void swig_decref() const { if (swig_disown_flag) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_DECREF(swig_self); + SWIG_Py_DECREF(swig_self); SWIG_PYTHON_THREAD_END_BLOCK; } } @@ -353,7 +287,7 @@ namespace Swig { /* increase the reference count of the wrapped python object */ void swig_incref() const { if (swig_disown_flag) { - Py_INCREF(swig_self); + SWIG_Py_INCREF(swig_self); } } @@ -369,9 +303,7 @@ namespace Swig { private: typedef std::map swig_ownership_map; mutable swig_ownership_map swig_owner; -#ifdef __THREAD__ - static PyThread_type_lock swig_mutex_own; -#endif + SWIG_GUARD_DECLARATION(swig_mutex_own); public: template @@ -421,9 +353,7 @@ namespace Swig { } }; -#ifdef __THREAD__ - PyThread_type_lock Director::swig_mutex_own = PyThread_allocate_lock(); -#endif + SWIG_GUARD_DEFINITION(Director, swig_mutex_own); } #endif diff --git a/macx64/bin/swig/share/swig/4.3.0/python/director_py_mutex.swg b/macx64/bin/swig/share/swig/4.3.0/python/director_py_mutex.swg new file mode 100644 index 00000000..9e271455 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/director_py_mutex.swg @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * director_py_mutex.swg + * + * contains python mutex for threads + * ----------------------------------------------------------------------------- */ + +#if defined(SWIG_PYTHON_THREADS) && !defined(SWIG_THREADS) +#define SWIG_THREADS 1 +#endif +#if defined(SWIG_THREADS) && !defined(Py_LIMITED_API) +#include "pythread.h" +#define SWIG_HAVE_MUTEX +namespace Swig { + class Mutex + { + PyThread_type_lock mutex_; + public: + Mutex() : mutex_(PyThread_allocate_lock()) {} + ~Mutex() { PyThread_release_lock(mutex_); } + void lock() { PyThread_acquire_lock(mutex_, WAIT_LOCK); } + void unlock() { PyThread_free_lock(mutex_); } + }; +} +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/embed.i b/macx64/bin/swig/share/swig/4.3.0/python/embed.i similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/python/embed.i rename to macx64/bin/swig/share/swig/4.3.0/python/embed.i index efd04878..e5ee601d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/embed.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/embed.i @@ -2,36 +2,43 @@ // embed.i // SWIG file embedding the Python interpreter in something else. // This file is deprecated and no longer actively maintained, but it still -// seems to work with Python 2.7. Status with Python 3 is unknown. +// seems to work with Python 2.7. It doesn't work with Python 3. // // This file makes it possible to extend Python and all of its // built-in functions without having to hack its setup script. // - - -#ifdef AUTODOC -%subsection "embed.i" -%text %{ -This module provides support for building a new version of the -Python executable. This will be necessary on systems that do -not support shared libraries and may be necessary with C++ -extensions. This file contains everything you need to build -a new version of Python from include files and libraries normally -installed with the Python language. - -This module will automatically grab all of the Python modules -present in your current Python executable (including any special -purpose modules you have enabled such as Tkinter). Thus, you -may need to provide additional link libraries when compiling. - -As far as I know, this module is C++ safe. -%} -#endif +// This module provides support for building a new version of the +// Python executable. This will be necessary on systems that do +// not support shared libraries and may be necessary with C++ +// extensions. This file contains everything you need to build +// a new version of Python from include files and libraries normally +// installed with the Python language. +// +// This module will automatically grab all of the Python modules +// present in your current Python executable (including any special +// purpose modules you have enabled such as Tkinter). Thus, you +// may need to provide additional link libraries when compiling. +// +// As far as I know, this module is C++ safe. %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/macx64/bin/swig/share/swig/4.0.0/python/exception.i b/macx64/bin/swig/share/swig/4.3.0/python/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/exception.i rename to macx64/bin/swig/share/swig/4.3.0/python/exception.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/factory.i b/macx64/bin/swig/share/swig/4.3.0/python/factory.i new file mode 100644 index 00000000..46a0a873 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/factory.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/python/file.i b/macx64/bin/swig/share/swig/4.3.0/python/file.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/file.i rename to macx64/bin/swig/share/swig/4.3.0/python/file.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/implicit.i b/macx64/bin/swig/share/swig/4.3.0/python/implicit.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/implicit.i rename to macx64/bin/swig/share/swig/4.3.0/python/implicit.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/pyabc.i b/macx64/bin/swig/share/swig/4.3.0/python/pyabc.i new file mode 100644 index 00000000..cae1e703 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyabc.i @@ -0,0 +1,14 @@ +%define %pythonabc(Type, Abc) + %feature("python:abc", Abc) Type; +%enddef +%pythoncode %{if _swig_python_version_info[0:2] >= (3, 3): + import collections.abc +else: + import collections +%} +%pythonabc(std::vector, "collections.abc.MutableSequence if _swig_python_version_info >= (3, 3) else collections.MutableSequence"); +%pythonabc(std::list, "collections.abc.MutableSequence if _swig_python_version_info >= (3, 3) else collections.MutableSequence"); +%pythonabc(std::map, "collections.abc.MutableMapping if _swig_python_version_info >= (3, 3) else collections.MutableMapping"); +%pythonabc(std::multimap, "collections.abc.MutableMapping if _swig_python_version_info >= (3, 3) else collections.MutableMapping"); +%pythonabc(std::set, "collections.abc.MutableSet if _swig_python_version_info >= (3, 3) else collections.MutableSet"); +%pythonabc(std::multiset, "collections.abc.MutableSet if _swig_python_version_info >= (3, 3) else collections.MutableSet"); diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyapi.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyapi.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pyapi.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyapi.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pybackward.swg b/macx64/bin/swig/share/swig/4.3.0/python/pybackward.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pybackward.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pybackward.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pybuffer.i b/macx64/bin/swig/share/swig/4.3.0/python/pybuffer.i similarity index 51% rename from macx64/bin/swig/share/swig/4.0.0/python/pybuffer.i rename to macx64/bin/swig/share/swig/4.3.0/python/pybuffer.i index 577eb69c..9ebc36a8 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pybuffer.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/pybuffer.i @@ -12,18 +12,43 @@ * } */ +/* Note that in Py_LIMITED_API case we have no choice, but to use deprecated + * functions, as they provides the only way to access buffer data with limited + * API, which doesn't include Py_buffer definition. We also disable the + * warnings about doing this because they're not useful in our case. + */ + %define %pybuffer_mutable_binary(TYPEMAP, SIZE) %typemap(in) (TYPEMAP, SIZE) { int res; Py_ssize_t size = 0; void *buf = 0; +%#ifndef Py_LIMITED_API Py_buffer view; res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE); - size = view.len; - buf = view.buf; - PyBuffer_Release(&view); +%#else + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic push + %#pragma GCC diagnostic ignored "-Wdeprecated" + %#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + %#elif defined(_MSC_VER) + %#pragma warning(push) + %#pragma warning(disable: 4996) + %#endif + res = PyObject_AsWriteBuffer($input, &buf, &size); + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic pop + %#elif defined(_MSC_VER) + %#pragma warning(pop) + %#endif +%#endif if (res < 0) { PyErr_Clear(); %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum); } +%#ifndef Py_LIMITED_API + size = view.len; + buf = view.buf; + PyBuffer_Release(&view); +%#endif $1 = ($1_ltype) buf; $2 = ($2_ltype) (size/sizeof($*1_type)); } @@ -45,14 +70,34 @@ %define %pybuffer_mutable_string(TYPEMAP) %typemap(in) (TYPEMAP) { int res; void *buf = 0; +%#ifndef Py_LIMITED_API Py_buffer view; res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE); - buf = view.buf; - PyBuffer_Release(&view); +%#else + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic push + %#pragma GCC diagnostic ignored "-Wdeprecated" + %#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + %#elif defined(_MSC_VER) + %#pragma warning(push) + %#pragma warning(disable: 4996) + %#endif + Py_ssize_t size; + res = PyObject_AsWriteBuffer($input, &buf, &size); + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic pop + %#elif defined(_MSC_VER) + %#pragma warning(pop) + %#endif +%#endif if (res < 0) { PyErr_Clear(); %argument_fail(res, "(TYPEMAP)", $symname, $argnum); } +%#ifndef Py_LIMITED_API + buf = view.buf; + PyBuffer_Release(&view); +%#endif $1 = ($1_ltype) buf; } %enddef @@ -74,15 +119,34 @@ %define %pybuffer_binary(TYPEMAP, SIZE) %typemap(in) (TYPEMAP, SIZE) { int res; Py_ssize_t size = 0; const void *buf = 0; +%#ifndef Py_LIMITED_API Py_buffer view; res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO); - size = view.len; - buf = view.buf; - PyBuffer_Release(&view); +%#else + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic push + %#pragma GCC diagnostic ignored "-Wdeprecated" + %#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + %#elif defined(_MSC_VER) + %#pragma warning(push) + %#pragma warning(disable: 4996) + %#endif + res = PyObject_AsReadBuffer($input, &buf, &size); + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic pop + %#elif defined(_MSC_VER) + %#pragma warning(pop) + %#endif +%#endif if (res < 0) { PyErr_Clear(); %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum); } +%#ifndef Py_LIMITED_API + size = view.len; + buf = view.buf; + PyBuffer_Release(&view); +%#endif $1 = ($1_ltype) buf; $2 = ($2_ltype) (size / sizeof($*1_type)); } @@ -106,16 +170,34 @@ %define %pybuffer_string(TYPEMAP) %typemap(in) (TYPEMAP) { int res; const void *buf = 0; +%#ifndef Py_LIMITED_API Py_buffer view; res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO); - buf = view.buf; - PyBuffer_Release(&view); +%#else + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic push + %#pragma GCC diagnostic ignored "-Wdeprecated" + %#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + %#elif defined(_MSC_VER) + %#pragma warning(push) + %#pragma warning(disable: 4996) + %#endif + Py_ssize_t size; + res = PyObject_AsReadBuffer($input, &buf, &size); + %#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) + %#pragma GCC diagnostic pop + %#elif defined(_MSC_VER) + %#pragma warning(pop) + %#endif +%#endif if (res < 0) { + PyErr_Clear(); %argument_fail(res, "(TYPEMAP)", $symname, $argnum); } +%#ifndef Py_LIMITED_API + buf = view.buf; + PyBuffer_Release(&view); +%#endif $1 = ($1_ltype) buf; } %enddef - - - diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyclasses.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyclasses.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/python/pyclasses.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyclasses.swg index 9d6299ff..7a9d0936 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyclasses.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyclasses.swg @@ -11,7 +11,7 @@ or as a member variable: struct A { - SwigPtr_PyObject obj; + SwigPtr_PyObject _obj; A(PyObject *o) : _obj(o) { } }; @@ -20,7 +20,7 @@ SwigPtr_PyObject func(SwigPtr_PyObject obj) { SwigPtr_PyObject out = PyString_FromFormat("hello %s", PyObject_AsString(obj)); - Py_DECREF(out); + SWIG_Py_DECREF(out); return out; } @@ -43,18 +43,18 @@ 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 */ %typemap(out,noblock=1) SwigPtr_PyObject { $result = (PyObject *)$1; - Py_INCREF($result); + SWIG_Py_INCREF($result); } %typemap(out,noblock=1) SwigPtr_PyObject const & { $result = (PyObject *)*$1; - Py_INCREF($result); + SWIG_Py_INCREF($result); } } @@ -73,7 +73,7 @@ namespace swig { SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(_obj); + SWIG_Py_XINCREF(_obj); SWIG_PYTHON_THREAD_END_BLOCK; } @@ -81,7 +81,7 @@ namespace swig { { if (initial_ref) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(_obj); + SWIG_Py_XINCREF(_obj); SWIG_PYTHON_THREAD_END_BLOCK; } } @@ -89,8 +89,8 @@ namespace swig { SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(item._obj); - Py_XDECREF(_obj); + SWIG_Py_XINCREF(item._obj); + SWIG_Py_XDECREF(_obj); _obj = item._obj; SWIG_PYTHON_THREAD_END_BLOCK; return *this; @@ -99,7 +99,7 @@ namespace swig { ~SwigPtr_PyObject() { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XDECREF(_obj); + SWIG_Py_XDECREF(_obj); SWIG_PYTHON_THREAD_END_BLOCK; } @@ -145,7 +145,7 @@ namespace swig { SwigVar_PyObject & operator = (PyObject* obj) { - Py_XDECREF(_obj); + SWIG_Py_XDECREF(_obj); _obj = obj; return *this; } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pycomplex.swg b/macx64/bin/swig/share/swig/4.3.0/python/pycomplex.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/python/pycomplex.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pycomplex.swg index 087c50f9..eeb9af7b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pycomplex.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pycomplex.swg @@ -12,7 +12,11 @@ %fragment(SWIG_From_frag(Type),"header") { SWIGINTERNINLINE PyObject* -SWIG_From(Type)(%ifcplusplus(const Type&, Type) c) +#if defined(__cplusplus) +SWIG_From_dec(Type)(const Type& c) +#else +SWIG_From_dec(Type)(Type c) +#endif { return PyComplex_FromDoubles(Real(c), Imag(c)); } @@ -65,7 +69,7 @@ SWIG_AsVal(Type)(PyObject *o, Type *val) float re; int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); if (SWIG_IsOK(res)) { - if (val) *val = Constructor(re, 0.0); + if (val) *val = Constructor(re, 0.0f); return res; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pycontainer.swg b/macx64/bin/swig/share/swig/4.3.0/python/pycontainer.swg similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/python/pycontainer.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pycontainer.swg index ef2f725a..12a45bfc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pycontainer.swg +++ b/macx64/bin/swig/share/swig/4.3.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 %} @@ -52,7 +52,7 @@ namespace swig { struct container_owner { // By default, do not add the back-reference (for value types) // Specialization below will check the reference for pointer types. - static bool back_reference(PyObject* child, PyObject* owner) { + static bool back_reference(PyObject* /*child*/, PyObject* /*owner*/) { return false; } }; @@ -69,8 +69,7 @@ namespace swig { static bool back_reference(PyObject* child, PyObject* owner) { SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child); if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) { - PyObject_SetAttr(child, container_owner_attribute(), owner); - return true; + return PyObject_SetAttr(child, container_owner_attribute(), owner) != -1; } return false; } @@ -89,7 +88,7 @@ namespace swig { typedef SwigPtr_PyObject value_type; static PyObject *from(const value_type& val) { PyObject *obj = static_cast(val); - Py_XINCREF(obj); + SWIG_Py_XINCREF(obj); return obj; } }; @@ -122,7 +121,7 @@ namespace swig { typedef SwigVar_PyObject value_type; static PyObject *from(const value_type& val) { PyObject *obj = static_cast(val); - Py_XINCREF(obj); + SWIG_Py_XINCREF(obj); return obj; } }; @@ -220,7 +219,7 @@ namespace swig { template <> struct traits_from { typedef PyObject * value_type; static PyObject *from(const value_type& val) { - Py_XINCREF(val); + SWIG_Py_XINCREF(val); return val; } }; @@ -387,7 +386,7 @@ namespace swig { size_t replacecount = (jj - ii + step - 1) / step; if (is.size() != replacecount) { char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); throw std::invalid_argument(msg); } typename Sequence::const_iterator isit = is.begin(); @@ -403,7 +402,7 @@ namespace swig { size_t replacecount = (ii - jj - step - 1) / -step; if (is.size() != replacecount) { char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); + PyOS_snprintf(msg, sizeof(msg), "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); throw std::invalid_argument(msg); } typename Sequence::const_iterator isit = is.begin(); @@ -457,245 +456,6 @@ namespace swig { } } -%fragment("SwigPySequence_Cont","header", - fragment="StdTraits", - fragment="SwigPySequence_Base", - fragment="SwigPyIterator_T") -{ -namespace swig -{ - template - struct SwigPySequence_Ref - { - SwigPySequence_Ref(PyObject* seq, Py_ssize_t index) - : _seq(seq), _index(index) - { - } - - operator T () const - { - swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index); - try { - return swig::as(item); - } catch (const std::invalid_argument& e) { - char msg[1024]; - sprintf(msg, "in sequence element %d ", (int)_index); - if (!PyErr_Occurred()) { - ::%type_error(swig::type_name()); - } - SWIG_Python_AddErrorMsg(msg); - SWIG_Python_AddErrorMsg(e.what()); - throw; - } - } - - SwigPySequence_Ref& operator=(const T& v) - { - PySequence_SetItem(_seq, _index, swig::from(v)); - return *this; - } - - private: - PyObject* _seq; - Py_ssize_t _index; - }; - - template - struct SwigPySequence_ArrowProxy - { - SwigPySequence_ArrowProxy(const T& x): m_value(x) {} - const T* operator->() const { return &m_value; } - operator const T*() const { return &m_value; } - T m_value; - }; - - template - struct SwigPySequence_InputIterator - { - typedef SwigPySequence_InputIterator self; - - typedef std::random_access_iterator_tag iterator_category; - typedef Reference reference; - typedef T value_type; - typedef T* pointer; - typedef Py_ssize_t difference_type; - - SwigPySequence_InputIterator() - { - } - - SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index) - : _seq(seq), _index(index) - { - } - - reference operator*() const - { - return reference(_seq, _index); - } - - SwigPySequence_ArrowProxy - operator->() const { - return SwigPySequence_ArrowProxy(operator*()); - } - - bool operator==(const self& ri) const - { - return (_index == ri._index) && (_seq == ri._seq); - } - - bool operator!=(const self& ri) const - { - return !(operator==(ri)); - } - - self& operator ++ () - { - ++_index; - return *this; - } - - self& operator -- () - { - --_index; - return *this; - } - - self& operator += (difference_type n) - { - _index += n; - return *this; - } - - self operator +(difference_type n) const - { - return self(_seq, _index + n); - } - - self& operator -= (difference_type n) - { - _index -= n; - return *this; - } - - self operator -(difference_type n) const - { - return self(_seq, _index - n); - } - - difference_type operator - (const self& ri) const - { - return _index - ri._index; - } - - bool operator < (const self& ri) const - { - return _index < ri._index; - } - - reference - operator[](difference_type n) const - { - return reference(_seq, _index + n); - } - - private: - PyObject* _seq; - difference_type _index; - }; - - // STL container wrapper around a Python sequence - template - struct SwigPySequence_Cont - { - typedef SwigPySequence_Ref reference; - typedef const SwigPySequence_Ref const_reference; - typedef T value_type; - typedef T* pointer; - typedef Py_ssize_t difference_type; - typedef size_t size_type; - typedef const pointer const_pointer; - typedef SwigPySequence_InputIterator iterator; - typedef SwigPySequence_InputIterator const_iterator; - - SwigPySequence_Cont(PyObject* seq) : _seq(0) - { - if (!PySequence_Check(seq)) { - throw std::invalid_argument("a sequence is expected"); - } - _seq = seq; - Py_INCREF(_seq); - } - - ~SwigPySequence_Cont() - { - Py_XDECREF(_seq); - } - - size_type size() const - { - return static_cast(PySequence_Size(_seq)); - } - - bool empty() const - { - return size() == 0; - } - - iterator begin() - { - return iterator(_seq, 0); - } - - const_iterator begin() const - { - return const_iterator(_seq, 0); - } - - iterator end() - { - return iterator(_seq, size()); - } - - const_iterator end() const - { - return const_iterator(_seq, size()); - } - - reference operator[](difference_type n) - { - return reference(_seq, n); - } - - const_reference operator[](difference_type n) const - { - return const_reference(_seq, n); - } - - bool check(bool set_err = true) const - { - Py_ssize_t s = size(); - for (Py_ssize_t i = 0; i < s; ++i) { - swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i); - if (!swig::check(item)) { - if (set_err) { - char msg[1024]; - sprintf(msg, "in sequence element %d", (int)i); - SWIG_Error(SWIG_RuntimeError, msg); - } - return false; - } - } - return true; - } - - private: - PyObject* _seq; - }; - -} -} - %define %swig_sequence_iterator(Sequence...) %swig_sequence_iterator_with_making_function(swig::make_output_iterator,Sequence...) %enddef @@ -711,12 +471,12 @@ namespace swig class const_iterator; class const_reverse_iterator; - %typemap(out,noblock=1,fragment="SwigPySequence_Cont") + %typemap(out,noblock=1,fragment="SwigPyIterator_T") iterator, reverse_iterator, const_iterator, const_reverse_iterator { $result = SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &)), swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); } - %typemap(out,noblock=1,fragment="SwigPySequence_Cont") + %typemap(out,noblock=1,fragment="SwigPyIterator_T") std::pair, std::pair { $result = PyTuple_New(2); PyTuple_SetItem($result,0,SWIG_NewPointerObj(Make_output_iterator(%static_cast($1,const $type &).first), @@ -725,7 +485,7 @@ namespace swig swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN)); } - %fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="SwigPySequence_Cont") {} + %fragment("SwigPyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="SwigPyIterator_T") {} %typemap(out,noblock=1,fragment="SwigPyPairBoolOutputIterator") std::pair, std::pair { @@ -735,7 +495,7 @@ namespace swig PyTuple_SetItem($result,1,SWIG_From(bool)(%static_cast($1,const $type &).second)); } - %typemap(in,noblock=1,fragment="SwigPySequence_Cont") + %typemap(in,noblock=1,fragment="SwigPyIterator_T") iterator(swig::SwigPyIterator *iter = 0, int res), reverse_iterator(swig::SwigPyIterator *iter = 0, int res), const_iterator(swig::SwigPyIterator *iter = 0, int res), @@ -753,14 +513,14 @@ namespace swig } } - %typecheck(%checkcode(ITERATOR),noblock=1,fragment="SwigPySequence_Cont") + %typecheck(%checkcode(ITERATOR),noblock=1,fragment="SwigPyIterator_T") iterator, reverse_iterator, const_iterator, const_reverse_iterator { swig::SwigPyIterator *iter = 0; int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); $1 = (SWIG_IsOK(res) && iter && (dynamic_cast *>(iter) != 0)); } - %fragment("SwigPySequence_Cont"); + %fragment("SwigPyIterator_T"); %newobject iterator(PyObject **PYTHON_SELF); %extend { @@ -788,7 +548,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__; @@ -836,13 +596,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); } @@ -872,49 +632,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); @@ -1006,26 +766,50 @@ namespace swig %fragment("StdSequenceTraits","header", fragment="StdTraits", - fragment="SwigPySequence_Cont") + fragment="SwigPySequence_Base") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, Seq* seq) { - // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); + template + struct IteratorProtocol { + static void assign(PyObject *obj, Seq *seq) { + SwigVar_PyObject iter = PyObject_GetIter(obj); + if (iter) { + SwigVar_PyObject item = PyIter_Next(iter); + while (item) { + seq->insert(seq->end(), swig::as(item)); + item = PyIter_Next(iter); + } + } } - } + + static bool check(PyObject *obj) { + bool ret = false; + SwigVar_PyObject iter = PyObject_GetIter(obj); + if (iter) { + SwigVar_PyObject item = PyIter_Next(iter); + ret = true; + while (item) { + ret = swig::check(item); + item = ret ? PyIter_Next(iter) : 0; + } + } + return ret; + } + }; template struct traits_asptr_stdseq { typedef Seq sequence; typedef T value_type; + static bool is_iterable(PyObject *obj) { + SwigVar_PyObject iter = PyObject_GetIter(obj); + PyErr_Clear(); + return iter != 0; + } + static int asptr(PyObject *obj, sequence **seq) { + int ret = SWIG_ERROR; if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) { sequence *p; swig_type_info *descriptor = swig::type_info(); @@ -1033,27 +817,25 @@ namespace swig { if (seq) *seq = p; return SWIG_OLDOBJ; } - } else if (PySequence_Check(obj)) { + } else if (is_iterable(obj)) { try { - SwigPySequence_Cont swigpyseq(obj); if (seq) { - sequence *pseq = new sequence(); - assign(swigpyseq, pseq); - *seq = pseq; - return SWIG_NEWOBJ; + *seq = new sequence(); + IteratorProtocol::assign(obj, *seq); + if (!PyErr_Occurred()) + return SWIG_NEWOBJ; } else { - return swigpyseq.check() ? SWIG_OK : SWIG_ERROR; + return IteratorProtocol::check(obj) ? SWIG_OK : SWIG_ERROR; } } catch (std::exception& e) { - if (seq) { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, e.what()); - } - } - return SWIG_ERROR; + if (seq && !PyErr_Occurred()) + PyErr_SetString(PyExc_TypeError, e.what()); } + if (seq) + delete *seq; + return SWIG_ERROR; } - return SWIG_ERROR; + return ret; } }; diff --git a/macx64/bin/swig/share/swig/4.3.0/python/pydocs.swg b/macx64/bin/swig/share/swig/4.3.0/python/pydocs.swg new file mode 100644 index 00000000..5a25423d --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/pydocs.swg @@ -0,0 +1,45 @@ + +// Documentation for use with the autodoc feature. + +#ifdef SWIG_DOC_DOXYGEN_STYLE +%typemap(doc) SWIGTYPE "@param $1_name $1_type" +%typemap(doc) SWIGTYPE * "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE & "@param $1_name $1_type" +%typemap(doc) const SWIGTYPE && "@param $1_name $1_type" +%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type" + +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "@param $1_name $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "@param $1_name $1_type (output)" +#else +%typemap(doc) SWIGTYPE "$1_name: $1_type" +%typemap(doc) SWIGTYPE * "$1_name: $1_type" +%typemap(doc) const SWIGTYPE & "$1_name: $1_type" +%typemap(doc) const SWIGTYPE && "$1_name: $1_type" +%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type" + +%typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)" +%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)" +%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)" +#endif + + +// Types to use in Python documentation for the parameters of the given C++ type. +%typemap(doctype) bool "boolean" + +%define int_doctype_for_cppint_type(cppint_type) + %typemap(doctype) cppint_type, unsigned cppint_type "int" +%enddef +%formacro(int_doctype_for_cppint_type, short, int, long, long long) + +%typemap(doctype) size_t "int" + +%typemap(doctype) enum SWIGTYPE "int" + +%typemap(doctype) float, double, long double "float" + +%typemap(doctype) char*, std::string "string" + +%typemap(doctype) SWIGTYPE "$1_basetype" +%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)" +%typemap(doctype) SWIGTYPE & "$typemap(doctype, $*1_ltype)" diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyerrors.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyerrors.swg similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/python/pyerrors.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyerrors.swg index dcd99c93..e7fe688d 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyerrors.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyerrors.swg @@ -39,6 +39,9 @@ SWIG_Python_ErrorType(int code) { case SWIG_AttributeError: type = PyExc_AttributeError; break; + case SWIG_NullReferenceError: + type = PyExc_TypeError; + break; default: type = PyExc_RuntimeError; } @@ -57,16 +60,17 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyErr_Fetch(&type, &value, &traceback); if (value) { PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); + PyObject *bytes = NULL; + const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes); PyErr_Clear(); - Py_XINCREF(type); + SWIG_Py_XINCREF(type); if (tmp) PyErr_Format(type, "%s %s", tmp, mesg); else PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - Py_DECREF(value); + SWIG_Py_XDECREF(bytes); + SWIG_Py_DECREF(old_str); + SWIG_Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } @@ -95,8 +99,12 @@ SWIG_Python_RaiseOrModifyTypeError(const char *message) #else newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message); #endif - Py_XDECREF(value); - PyErr_Restore(type, newvalue, traceback); + if (newvalue) { + SWIG_Py_XDECREF(value); + PyErr_Restore(type, newvalue, traceback); + } else { + PyErr_Restore(type, value, traceback); + } } else { /* Raise TypeError using given message */ PyErr_SetString(PyExc_TypeError, message); diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyfragments.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pyfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyfragments.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/python/pyhead.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyhead.swg new file mode 100644 index 00000000..c0faf01e --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyhead.swg @@ -0,0 +1,103 @@ +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ +SWIGINTERN const char * +SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes) +{ +#if PY_VERSION_HEX >= 0x03030000 +# if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000 + *pbytes = NULL; + return PyUnicode_AsUTF8AndSize(str, psize); +# else + const char *chars; + *pbytes = PyUnicode_AsUTF8String(str); + chars = *pbytes ? PyBytes_AsString(*pbytes) : NULL; + if (chars && psize) + *psize = PyBytes_Size(*pbytes); + return chars; +# endif +#else + char *chars = NULL; + *pbytes = NULL; + PyString_AsStringAndSize(str, &chars, psize); + return chars; +#endif +} + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ +# define SWIGPY_USE_CAPSULE +#ifdef SWIGPYTHON_BUILTIN +# define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule_builtin" SWIG_TYPE_TABLE_NAME +#else +# define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME +#endif +# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long +#endif + +#ifdef Py_LIMITED_API +# define PyTuple_GET_ITEM PyTuple_GetItem +/* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used + interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ +# define PyTuple_SET_ITEM PyTuple_SetItem +# define PyTuple_GET_SIZE PyTuple_Size +# define PyCFunction_GET_FLAGS PyCFunction_GetFlags +# define PyCFunction_GET_FUNCTION PyCFunction_GetFunction +# define PyCFunction_GET_SELF PyCFunction_GetSelf +# define PyList_GET_ITEM PyList_GetItem +# define PyList_SET_ITEM PyList_SetItem +# define PySliceObject PyObject +#endif + +/* Increment and Decrement wrappers - for portability when using the stable abi and for performance otherwise */ +#ifdef Py_LIMITED_API +# define SWIG_Py_INCREF Py_IncRef +# define SWIG_Py_XINCREF Py_IncRef +# define SWIG_Py_DECREF Py_DecRef +# define SWIG_Py_XDECREF Py_DecRef +#else +# define SWIG_Py_INCREF Py_INCREF +# define SWIG_Py_XINCREF Py_XINCREF +# define SWIG_Py_DECREF Py_DECREF +# define SWIG_Py_XDECREF Py_XDECREF +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyinit.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyinit.swg similarity index 55% rename from macx64/bin/swig/share/swig/4.0.0/python/pyinit.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyinit.swg index dfbf40b3..f37d3fe9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyinit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyinit.swg @@ -8,6 +8,8 @@ %fragment(""); // For offsetof #endif +#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN + %insert(runtime) %{ #ifdef __cplusplus extern "C" { @@ -24,220 +26,14 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO #endif %} +#endif + %init %{ #ifdef __cplusplus extern "C" { #endif -/* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - -/* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - -typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; -} swig_globalvar; - -typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; -} swig_varlinkobject; - -SWIGINTERN PyObject * -swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString(""); -#else - return PyString_FromString(""); -#endif -} - -SWIGINTERN PyObject * -swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif - return str; -} - -SWIGINTERN void -swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } -} - -SWIGINTERN PyObject * -swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; -} - -SWIGINTERN int -swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; -} - -SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - varlink_type = tmp; - type_init = 1; - if (PyType_Ready(&varlink_type) < 0) - return NULL; - } - return &varlink_type; -} - -/* Create a variable linking object for use later */ -SWIGINTERN PyObject * -SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); -} - -SWIGINTERN void -SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - memcpy(gv->name, name, size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; -} - -SWIGINTERN PyObject * -SWIG_globals(void) { - static PyObject *globals = 0; - if (!globals) { - globals = SWIG_newvarlink(); - } - return globals; -} - /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ @@ -261,20 +57,17 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { } if (obj) { PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); + SWIG_Py_DECREF(obj); } } } -/* -----------------------------------------------------------------------------*/ -/* Fix SwigMethods to carry the callback ptrs when needed */ -/* -----------------------------------------------------------------------------*/ +/* ----------------------------------------------------------------------------- + * Patch %callback methods' docstrings to hold the callback ptrs + * -----------------------------------------------------------------------------*/ SWIGINTERN void -SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { +SWIG_Python_FixMethods(PyMethodDef *methods, const swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) { size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; @@ -282,7 +75,7 @@ SWIG_Python_FixMethods(PyMethodDef *methods, c = strstr(c, "swig_ptr: "); if (c) { int j; - swig_const_info *ci = 0; + const swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { if (strncmp(const_table[j].name, name, @@ -314,6 +107,20 @@ SWIG_Python_FixMethods(PyMethodDef *methods, } } +#ifdef __cplusplus +} +#endif + +%} + +#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN + +%init %{ + +#ifdef __cplusplus +extern "C" { +#endif + /* ----------------------------------------------------------------------------- * Method creation and docstring support functions * ----------------------------------------------------------------------------- */ @@ -376,6 +183,12 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO } #endif +%} + +#endif + +%init %{ + /* -----------------------------------------------------------------------------* * Partial Init method * -----------------------------------------------------------------------------*/ @@ -500,7 +313,7 @@ SWIG_init(void) { (void)public_symbol; PyDict_SetItemString(md, "__all__", public_interface); - Py_DECREF(public_interface); + SWIG_Py_DECREF(public_interface); for (i = 0; SwigMethods[i].ml_name != NULL; ++i) SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); for (i = 0; swig_const_table[i].name != 0; ++i) diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyiterators.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyiterators.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/python/pyiterators.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyiterators.swg index cb15e35c..53f22b9f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyiterators.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyiterators.swg @@ -119,12 +119,7 @@ namespace swig { } static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::SwigPyIterator *"); - init = 1; - } + static swig_type_info* desc = SWIG_TypeQuery("swig::SwigPyIterator *"); return desc; } }; @@ -132,7 +127,7 @@ namespace swig { %#if defined(SWIGPYTHON_BUILTIN) inline PyObject* make_output_iterator_builtin (PyObject *pyself) { - Py_INCREF(pyself); + SWIG_Py_INCREF(pyself); return pyself; } %#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pymacros.swg b/macx64/bin/swig/share/swig/4.3.0/python/pymacros.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pymacros.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pymacros.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyname_compat.i b/macx64/bin/swig/share/swig/4.3.0/python/pyname_compat.i similarity index 92% rename from macx64/bin/swig/share/swig/4.0.0/python/pyname_compat.i rename to macx64/bin/swig/share/swig/4.3.0/python/pyname_compat.i index a9630dbe..789b2844 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyname_compat.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyname_compat.i @@ -25,7 +25,6 @@ */ %fragment("PySequence_Base", "header", fragment="SwigPySequence_Base") {} -%fragment("PySequence_Cont", "header", fragment="SwigPySequence_Cont") {} %fragment("PySwigIterator_T", "header", fragment="SwigPyIterator_T") {} %fragment("PyPairBoolOutputIterator", "header", fragment="SwigPyPairBoolOutputIterator") {} %fragment("PySwigIterator", "header", fragment="SwigPyIterator") {} @@ -38,11 +37,6 @@ #define PyObject_ptr SwigPtr_PyObject #define PyObject_var SwigVar_PyObject #define PyOper SwigPyOper -#define PySeq SwigPySeq -#define PySequence_ArrowProxy SwigPySequence_ArrowProxy -#define PySequence_Cont SwigPySequence_Cont -#define PySequence_InputIterator SwigPySequence_InputIterator -#define PySequence_Ref SwigPySequence_Ref #define PySwigClientData SwigPyClientData #define PySwigClientData_Del SwigPyClientData_Del #define PySwigClientData_New SwigPyClientData_New @@ -79,7 +73,6 @@ #define PySwigPacked_repr SwigPyPacked_repr #define PySwigPacked_str SwigPyPacked_str #define PySwigPacked_type SwigPyPacked_type -#define pyseq swigpyseq #define pyswigobject_type swigpyobject_type #define pyswigpacked_type swigpypacked_type %} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyopers.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyopers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pyopers.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyopers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyprimtypes.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/python/pyprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyprimtypes.swg index 6a01af17..7f372753 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyprimtypes.swg @@ -104,7 +104,12 @@ SWIG_AsVal_dec(long)(PyObject *obj, long* val) if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + // Largest double not larger than LONG_MAX (not portably calculated easily) + // Note that double(LONG_MAX) is stored in a double rounded up by one (for 64-bit long) + // 0x7ffffffffffffc00LL == (int64_t)std::nextafter(double(__uint128_t(LONG_MAX)+1), double(0)) + const double long_max = sizeof(long) == 8 ? 0x7ffffffffffffc00LL : LONG_MAX; + // No equivalent needed for 64-bit double(LONG_MIN) is exactly LONG_MIN + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, long_max)) { if (val) *val = (long)(d); return res; } @@ -166,7 +171,11 @@ SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val) if (!dispatch) { double d; int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + // Largest double not larger than ULONG_MAX (not portably calculated easily) + // Note that double(ULONG_MAX) is stored in a double rounded up by one (for 64-bit unsigned long) + // 0xfffffffffffff800ULL == (uint64_t)std::nextafter(double(__uint128_t(ULONG_MAX)+1), double(0)) + const double ulong_max = sizeof(unsigned long) == 8 ? 0xfffffffffffff800ULL : ULONG_MAX; + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ulong_max)) { if (val) *val = (unsigned long)(d); return res; } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyrun.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyrun.swg similarity index 68% rename from macx64/bin/swig/share/swig/4.0.0/python/pyrun.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyrun.swg index ad1b8196..4a327547 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pyrun.swg +++ b/macx64/bin/swig/share/swig/4.3.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 */ @@ -72,7 +72,7 @@ SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); - Py_DECREF(obj); + SWIG_Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } @@ -93,13 +93,13 @@ SWIGINTERN void SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { PyObject *s = PyString_InternFromString(key); PyList_Append(seq, s); - Py_DECREF(s); + SWIG_Py_DECREF(s); } SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); + SWIG_Py_DECREF(obj); if (public_interface) SwigPyBuiltin_AddPublicSymbol(public_interface, name); } @@ -109,7 +109,7 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); + SWIG_Py_DECREF(obj); } #endif @@ -117,20 +117,25 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { /* Append a value to the result obj */ SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { result = obj; - } else if (result == Py_None) { - Py_DECREF(result); + } else if (result == Py_None && is_void) { + SWIG_Py_DECREF(result); result = obj; } else { if (!PyList_Check(result)) { PyObject *o2 = result; result = PyList_New(1); - PyList_SetItem(result, 0, o2); + if (result) { + PyList_SET_ITEM(result, 0, o2); + } else { + SWIG_Py_DECREF(obj); + return o2; + } } PyList_Append(result,obj); - Py_DECREF(obj); + SWIG_Py_DECREF(obj); } return result; } @@ -183,8 +188,21 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi } } +SWIGINTERN int +SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) { + int no_kwargs = 1; + if (kwargs) { + assert(PyDict_Check(kwargs)); + if (PyDict_Size(kwargs) > 0) { + PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name); + no_kwargs = 0; + } + } + return no_kwargs; +} + /* A functor is a function object with one single object argument */ -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, (char *)"O", obj); +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); /* Helper for static pointer initialization for both C and C++ code, for example @@ -196,6 +214,264 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var #endif +#ifdef __cplusplus +extern "C" { +#endif + +/* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + +/* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + +typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; +} swig_globalvar; + +typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; +} swig_varlinkobject; + +SWIGINTERN PyObject * +swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString(""); +#else + return PyString_FromString(""); +#endif +} + +SWIGINTERN PyObject * +swig_varlink_str(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + SWIG_Py_DECREF(str); + SWIG_Py_DECREF(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + SWIG_Py_DECREF(str); + SWIG_Py_DECREF(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + SWIG_Py_DECREF(str); + SWIG_Py_DECREF(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; +} + +SWIGINTERN void +swig_varlink_dealloc(PyObject *o) { + swig_varlinkobject *v = (swig_varlinkobject *) o; + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } +} + +SWIGINTERN PyObject * +swig_varlink_getattr(PyObject *o, char *n) { + swig_varlinkobject *v = (swig_varlinkobject *) o; + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; +} + +SWIGINTERN int +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) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; +} + +SWIGINTERN PyTypeObject* +swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; +#ifndef SWIG_HEAPTYPES + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + "swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ +#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 */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ + 0, /* tp_del */ + 0, /* tp_version_tag */ +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#if PY_VERSION_HEX >= 0x030c0000 + 0, /* tp_watched */ +#endif +#if PY_VERSION_HEX >= 0x030d00a4 + 0, /* tp_versions_used */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0 /* tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; + if (PyType_Ready(&varlink_type) < 0) + return NULL; + } + return &varlink_type; +#else + PyType_Slot slots[] = { + { Py_tp_dealloc, (void *)swig_varlink_dealloc }, + { Py_tp_repr, (void *)swig_varlink_repr }, + { Py_tp_getattr, (void *)swig_varlink_getattr }, + { Py_tp_setattr, (void *)swig_varlink_setattr }, + { Py_tp_str, (void *)swig_varlink_str }, + { Py_tp_doc, (void *)varlink__doc__ }, + { 0, NULL } + }; + PyType_Spec spec = { + "swigvarlink", + sizeof(swig_varlinkobject), + 0, + Py_TPFLAGS_DEFAULT, + slots + }; + return (PyTypeObject *)PyType_FromSpec(&spec); +#endif +} + +/* Create a variable linking object for use later */ +SWIGINTERN PyObject * +SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); +} + +SWIGINTERN void +SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + memcpy(gv->name, name, size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; +} + + +static PyObject *Swig_Globals_global = NULL; + +SWIGINTERN PyObject * +SWIG_globals(void) { + if (Swig_Globals_global == NULL) { + Swig_Globals_global = SWIG_newvarlink(); + } + return Swig_Globals_global; +} + +#ifdef __cplusplus +} +#endif + /* ----------------------------------------------------------------------------- * Pointer declarations * ----------------------------------------------------------------------------- */ @@ -219,7 +495,7 @@ SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; - Py_INCREF(none); + SWIG_Py_INCREF(none); return none; } @@ -262,22 +538,29 @@ SwigPyClientData_New(PyObject* obj) SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); /* the klass element */ data->klass = obj; - Py_INCREF(data->klass); + SWIG_Py_INCREF(data->klass); /* the newraw method and newargs arguments used to create a new raw instance */ if (PyClass_Check(obj)) { data->newraw = 0; + SWIG_Py_INCREF(obj); data->newargs = obj; - Py_INCREF(obj); } else { data->newraw = PyObject_GetAttrString(data->klass, "__new__"); if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); + data->newargs = PyTuple_New(1); + if (data->newargs) { + SWIG_Py_INCREF(obj); + PyTuple_SET_ITEM(data->newargs, 0, obj); + } else { + SWIG_Py_DECREF(data->newraw); + SWIG_Py_DECREF(data->klass); + free(data); + return 0; + } } else { - data->newargs = obj; + SWIG_Py_INCREF(obj); + data->newargs = obj; } - Py_INCREF(data->newargs); } /* the destroy method, aka as the C++ delete method */ data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__"); @@ -286,10 +569,7 @@ SwigPyClientData_New(PyObject* obj) data->destroy = 0; } if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); - data->delargs = !(flags & (METH_O)); + data->delargs = !(PyCFunction_GET_FLAGS(data->destroy) & METH_O); } else { data->delargs = 0; } @@ -300,10 +580,13 @@ SwigPyClientData_New(PyObject* obj) } SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData *data) { - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); +SwigPyClientData_Del(SwigPyClientData *data) +{ + SWIG_Py_XDECREF(data->klass); + SWIG_Py_XDECREF(data->newraw); + SWIG_Py_XDECREF(data->newargs); + SWIG_Py_XDECREF(data->destroy); + free(data); } /* =============== SwigPyObject =====================*/ @@ -330,7 +613,7 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) if (!sobj->dict) sobj->dict = PyDict_New(); - Py_INCREF(sobj->dict); + SWIG_Py_XINCREF(sobj->dict); return sobj->dict; } @@ -348,18 +631,21 @@ SwigPyObject_format(const char* fmt, SwigPyObject *v) PyObject *res = NULL; PyObject *args = PyTuple_New(1); if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + PyObject *val = SwigPyObject_long(v); + if (val) { + PyObject *ofmt; + PyTuple_SET_ITEM(args, 0, val); + ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { #if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); + res = PyUnicode_Format(ofmt,args); #else - res = PyString_Format(ofmt,args); + res = PyString_Format(ofmt,args); #endif - Py_DECREF(ofmt); + SWIG_Py_DECREF(ofmt); } - Py_DECREF(args); } + SWIG_Py_DECREF(args); } return res; } @@ -381,18 +667,23 @@ SwigPyObject_repr(SwigPyObject *v) { const char *name = SWIG_TypePrettyName(v->ty); PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v); - if (v->next) { + if (repr && v->next) { PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); + if (nrep) { # if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; + PyObject *joined = PyUnicode_Concat(repr, nrep); + SWIG_Py_DECREF(repr); + SWIG_Py_DECREF(nrep); + repr = joined; # else - PyString_ConcatAndDel(&repr,nrep); + PyString_ConcatAndDel(&repr,nrep); # endif + } else { + SWIG_Py_DECREF(repr); + repr = NULL; + } } - return repr; + return repr; } /* We need a version taking two PyObject* parameters so it's a valid @@ -415,12 +706,14 @@ SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) SWIGRUNTIME PyObject* SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) { - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + PyObject* res = NULL; + if (!PyErr_Occurred()) { + if (op != Py_EQ && op != Py_NE) { + SWIG_Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); return res; } @@ -448,20 +741,37 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { -#ifdef SWIGPYTHON_BUILTIN PyTypeObject *target_tp = SwigPyObject_type(); - if (PyType_IsSubtype(op->ob_type, target_tp)) + PyTypeObject *op_type = Py_TYPE(op); +#ifdef SWIGPYTHON_BUILTIN + if (PyType_IsSubtype(op_type, target_tp)) return 1; - return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); + return (strcmp(op_type->tp_name, "SwigPyObject") == 0); #else - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +# ifdef Py_LIMITED_API + int cmp; + PyObject *tp_name; +#endif + if (op_type == target_tp) + return 1; +# ifdef Py_LIMITED_API + tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); + if (!tp_name) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); + SWIG_Py_DECREF(tp_name); + return cmp == 0; +# else + return (strcmp(op_type->tp_name, "SwigPyObject") == 0); +# endif #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own); +static PyObject* Swig_Capsule_global = NULL; + SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v) { @@ -488,8 +798,12 @@ SwigPyObject_dealloc(PyObject *v) if (data->delargs) { /* we need to create a temporary object to carry the destroy operation */ PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); + if (tmp) { + res = SWIG_Python_CallFunctor(destroy, tmp); + } else { + res = 0; + } + SWIG_Py_XDECREF(tmp); } else { PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); PyObject *mself = PyCFunction_GET_SELF(destroy); @@ -500,7 +814,7 @@ SwigPyObject_dealloc(PyObject *v) PyErr_Restore(type, value, traceback); - Py_XDECREF(res); + SWIG_Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { @@ -508,9 +822,13 @@ SwigPyObject_dealloc(PyObject *v) printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif - } - Py_XDECREF(next); - PyObject_DEL(v); + SWIG_Py_XDECREF(Swig_Capsule_global); + } + SWIG_Py_XDECREF(next); +#ifdef SWIGPYTHON_BUILTIN + SWIG_Py_XDECREF(sobj->dict); +#endif + PyObject_Free(v); } SWIGRUNTIME PyObject* @@ -521,8 +839,9 @@ 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); + SWIG_Py_INCREF(next); return SWIG_Py_Void(); } @@ -531,7 +850,7 @@ SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *) v; if (sobj->next) { - Py_INCREF(sobj->next); + SWIG_Py_INCREF(sobj->next); return sobj->next; } else { return SWIG_Py_Void(); @@ -565,9 +884,9 @@ SwigPyObject_own(PyObject *v, PyObject *args) PyObject *obj = PyBool_FromLong(sobj->own); if (val) { if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); + SWIG_Py_DECREF(SwigPyObject_acquire(v,args)); } else { - SwigPyObject_disown(v,args); + SWIG_Py_DECREF(SwigPyObject_disown(v,args)); } } return obj; @@ -588,7 +907,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - +#ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ @@ -647,7 +966,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 @@ -696,6 +1019,18 @@ SwigPyObject_TypeOnce(void) { #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#if PY_VERSION_HEX >= 0x030c0000 + 0, /* tp_watched */ +#endif +#if PY_VERSION_HEX >= 0x030d00a4 + 0, /* tp_versions_used */ +#endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ @@ -706,21 +1041,50 @@ SwigPyObject_TypeOnce(void) { }; swigpyobject_type = tmp; type_init = 1; - if (PyType_Ready(&swigpyobject_type) < 0) + if (PyType_Ready(&swigpyobject_type) != 0) return NULL; } return &swigpyobject_type; +#else + PyType_Slot slots[] = { + { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, + { Py_tp_repr, (void *)SwigPyObject_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, + { Py_tp_methods, (void *)swigobject_methods }, + { Py_nb_int, (void *)SwigPyObject_long }, + { 0, NULL } + }; + PyType_Spec spec = { + "SwigPyObject", + sizeof(SwigPyObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, + slots + }; + return (PyTypeObject *)PyType_FromSpec(&spec); +#endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; +#ifdef SWIGPYTHON_BUILTIN + sobj->dict = 0; +#endif + if (own == SWIG_POINTER_OWN) { + /* Obtain a reference to the Python capsule wrapping the module information, so that the + * module information is correctly destroyed after all SWIG python objects have been freed + * by the GC (and corresponding destructors invoked) */ + SWIG_Py_XINCREF(Swig_Capsule_global); + } } return (PyObject *)sobj; } @@ -777,8 +1141,23 @@ SwigPyPacked_type(void) { SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +#ifdef Py_LIMITED_API + int cmp; + PyObject *tp_name; +#endif + PyTypeObject* op_type = Py_TYPE(op); + if (op_type == SwigPyPacked_TypeOnce()) + return 1; +#ifdef Py_LIMITED_API + tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); + if (!tp_name) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); + SWIG_Py_DECREF(tp_name); + return cmp == 0; +#else + return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); +#endif } SWIGRUNTIME void @@ -788,12 +1167,13 @@ SwigPyPacked_dealloc(PyObject *v) SwigPyPacked *sobj = (SwigPyPacked *) v; free(sobj->pack); } - PyObject_DEL(v); + PyObject_Free(v); } SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { @@ -808,7 +1188,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 @@ -857,6 +1241,18 @@ SwigPyPacked_TypeOnce(void) { #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x03080000 + 0, /* tp_vectorcall */ +#endif +#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000) + 0, /* tp_print */ +#endif +#if PY_VERSION_HEX >= 0x030c0000 + 0, /* tp_watched */ +#endif +#if PY_VERSION_HEX >= 0x030d00a4 + 0, /* tp_versions_used */ +#endif #ifdef COUNT_ALLOCS 0, /* tp_allocs */ 0, /* tp_frees */ @@ -867,16 +1263,34 @@ SwigPyPacked_TypeOnce(void) { }; swigpypacked_type = tmp; type_init = 1; - if (PyType_Ready(&swigpypacked_type) < 0) + if (PyType_Ready(&swigpypacked_type) != 0) return NULL; } return &swigpypacked_type; +#else + PyType_Slot slots[] = { + { Py_tp_dealloc, (void *)SwigPyPacked_dealloc }, + { Py_tp_repr, (void *)SwigPyPacked_repr }, + { Py_tp_str, (void *)SwigPyPacked_str }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_doc, (void *)swigpacked_doc }, + { 0, NULL } + }; + PyType_Spec spec = { + "SwigPyPacked", + sizeof(SwigPyPacked), + 0, + Py_TPFLAGS_DEFAULT, + slots + }; + return (PyTypeObject *)PyType_FromSpec(&spec); +#endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -885,7 +1299,7 @@ SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) sobj->ty = ty; sobj->size = size; } else { - PyObject_DEL((PyObject *) sobj); + PyObject_Free((PyObject *)sobj); sobj = 0; } } @@ -938,7 +1352,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) (void)obj; # ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { +#if PY_VERSION_HEX >= 0x030d0000 + PyWeakref_GetRef(pyobj, &pyobj); + Py_DECREF(pyobj); +#else pyobj = PyWeakref_GET_OBJECT(pyobj); +#endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } @@ -965,7 +1384,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #endif obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { - Py_DECREF(obj); + SWIG_Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; @@ -975,7 +1394,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #else obj = PyObject_GetAttr(pyobj,SWIG_This()); if (obj) { - Py_DECREF(obj); + SWIG_Py_DECREF(obj); } else { if (PyErr_Occurred()) PyErr_Clear(); return 0; @@ -1057,12 +1476,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; @@ -1094,7 +1520,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } } - Py_DECREF(impconv); + SWIG_Py_DECREF(impconv); } } } @@ -1121,10 +1547,20 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { swig_cast_info *tc; /* here we get the method pointer for callbacks */ +#ifndef Py_LIMITED_API const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); +#else + PyObject* pystr_doc = PyObject_GetAttrString(obj, "__doc__"); + PyObject *bytes = NULL; + const char *doc = pystr_doc ? SWIG_PyUnicode_AsUTF8AndSize(pystr_doc, NULL, &bytes) : 0; +#endif const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; if (desc) desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; +#ifdef Py_LIMITED_API + SWIG_Py_XDECREF(bytes); + SWIG_Py_XDECREF(pystr_doc); +#endif if (!desc) return SWIG_ERROR; tc = SWIG_TypeCheck(desc,ty); @@ -1175,16 +1611,23 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + } else{ + SWIG_Py_DECREF(inst); + inst = 0; + } } #else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); + if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) { + SWIG_Py_DECREF(inst); + inst = 0; + } #endif } } else { @@ -1193,46 +1636,55 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) if (empty_args) { PyObject *empty_kwargs = PyDict_New(); if (empty_kwargs) { - inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs); - Py_DECREF(empty_kwargs); +#ifndef Py_LIMITED_API + newfunc newfn = ((PyTypeObject *)data->newargs)->tp_new; +#else + newfunc newfn = (newfunc)PyType_GetSlot((PyTypeObject *)data->newargs, Py_tp_new); +#endif + inst = newfn((PyTypeObject *)data->newargs, empty_args, empty_kwargs); + SWIG_Py_DECREF(empty_kwargs); if (inst) { - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) { + SWIG_Py_DECREF(inst); + inst = 0; + } else { + PyType_Modified(Py_TYPE(inst)); + } } } - Py_DECREF(empty_args); + SWIG_Py_DECREF(empty_args); } #else PyObject *dict = PyDict_New(); if (dict) { PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); + SWIG_Py_DECREF(dict); } #endif } return inst; } -SWIGRUNTIME void +SWIGRUNTIME int SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) { - PyObject *dict; #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + if (dict) { + return PyDict_SetItem(dict, SWIG_This(), swig_this); + } else{ + return -1; + } + } #endif - dict = PyObject_GetAttrString(inst, "__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); + return PyObject_SetAttr(inst, SWIG_This(), swig_this); } @@ -1244,9 +1696,10 @@ SWIG_Python_InitShadowInstance(PyObject *args) { } else { SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); + SWIG_Py_DECREF(SwigPyObject_append((PyObject*) sthis, obj[1])); } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); + if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0) + return NULL; } return SWIG_Py_Void(); } @@ -1270,7 +1723,12 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f if (flags & SWIG_BUILTIN_TP_INIT) { newobj = (SwigPyObject*) self; if (newobj->ptr) { - PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); +#ifndef Py_LIMITED_API + allocfunc alloc = clientdata->pytype->tp_alloc; +#else + allocfunc alloc = (allocfunc)PyType_GetSlot(clientdata->pytype, Py_tp_alloc); +#endif + PyObject *next_self = alloc(clientdata->pytype, 0); while (newobj->next) newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; @@ -1282,7 +1740,9 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); #ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; + if (newobj) { + newobj->dict = 0; + } #endif } if (newobj) { @@ -1300,7 +1760,7 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f robj = SwigPyObject_New(ptr, type, own); if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - Py_DECREF(robj); + SWIG_Py_DECREF(robj); robj = inst; } return robj; @@ -1321,39 +1781,61 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { void *SWIG_ReturnGlobalTypeList(void *); #endif +static PyObject *Swig_TypeCache_global = NULL; + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + if (Swig_TypeCache_global == NULL) { + Swig_TypeCache_global = PyDict_New(); + } + return Swig_TypeCache_global; +} + 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) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + ty->clientdata = 0; if (data) SwigPyClientData_Del(data); } } - Py_DECREF(SWIG_This()); + SWIG_Py_DECREF(SWIG_This()); Swig_This_global = NULL; + SWIG_Py_DECREF(SWIG_globals()); + Swig_Globals_global = NULL; + SWIG_Py_DECREF(SWIG_Python_TypeCache()); + Swig_TypeCache_global = NULL; + Swig_Capsule_global = NULL; } SWIGRUNTIME void @@ -1367,19 +1849,17 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { #endif PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { - PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + ++interpreter_counter; + Swig_Capsule_global = pointer; + } else { + SWIG_Py_DECREF(pointer); + } } else { - Py_XDECREF(pointer); + SWIG_Py_XDECREF(pointer); } } -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { @@ -1394,11 +1874,13 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); + if (obj) { + PyDict_SetItem(cache, key, obj); + SWIG_Py_DECREF(obj); + } } } - Py_DECREF(key); + SWIG_Py_DECREF(key); return descriptor; } @@ -1419,17 +1901,18 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) PyErr_Fetch(&type, &value, &traceback); if (value) { PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); + PyObject *bytes = NULL; + const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes); const char *errmesg = tmp ? tmp : "Invalid error message"; - Py_XINCREF(type); + SWIG_Py_XINCREF(type); PyErr_Clear(); if (infront) { PyErr_Format(type, "%s %s", mesg, errmesg); } else { PyErr_Format(type, "%s %s", errmesg, mesg); } - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); + SWIG_Py_XDECREF(bytes); + SWIG_Py_DECREF(old_str); } return 1; } else { @@ -1461,6 +1944,7 @@ SwigPyObject_GetDesc(PyObject *self) SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj) { + (void) obj; if (type) { #if defined(SWIG_COBJECT_TYPES) if (obj && SwigPyObject_Check(obj)) { @@ -1473,21 +1957,25 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) } else #endif { +#ifndef Py_LIMITED_API + /* tp_name is not accessible */ const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + PyObject *bytes = NULL; + const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; 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); } - Py_XDECREF(str); + SWIG_Py_XDECREF(bytes); + SWIG_Py_XDECREF(str); return; } +#endif } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { @@ -1502,12 +1990,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; } @@ -1534,11 +2016,11 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); return -1; } else { - Py_INCREF(name); + SWIG_Py_INCREF(name); } if (!tp->tp_dict) { - if (PyType_Ready(tp) < 0) + if (PyType_Ready(tp) != 0) goto done; } @@ -1549,20 +2031,20 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!f) { if (PyString_Check(name)) { encoded_name = name; - Py_INCREF(name); + SWIG_Py_INCREF(name); } else { encoded_name = PyUnicode_AsUTF8String(name); if (!encoded_name) - return -1; + goto done; } PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); - Py_DECREF(encoded_name); + SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); } done: - Py_DECREF(name); + SWIG_Py_DECREF(name); return res; } #endif diff --git a/macx64/bin/swig/share/swig/4.3.0/python/pyruntime.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyruntime.swg new file mode 100644 index 00000000..6d18afa1 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/pyruntime.swg @@ -0,0 +1,64 @@ +%insert(runtime) %{ +#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) +/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ +# include +#endif + +#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 !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 +# define SWIG_HEAPTYPES + +/* Note: Currently this won't activate - it is in place ready for when the + * SWIGPYTHON_BUILTIN condition above gets removed. */ +# if PY_VERSION_HEX < 0x030c0000 && defined(SWIGPYTHON_BUILTIN) +# include +# define Py_READONLY READONLY +# define Py_T_PYSSIZET T_PYSSIZET +# endif +#endif + +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif + +#include +#include +%} + +%insert(runtime) "swigrun.swg"; /* SWIG API */ +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ +%insert(runtime) "pyhead.swg"; /* Python includes and fixes */ +%insert(runtime) "pyerrors.swg"; /* Python errors */ +%insert(runtime) "pythreads.swg"; /* Python thread code */ +%insert(runtime) "pyapi.swg"; /* Python API */ +%insert(runtime) "pyrun.swg"; /* Python run-time code */ + +#if defined(SWIGPYTHON_BUILTIN) +%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */ +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pystdcommon.swg b/macx64/bin/swig/share/swig/4.3.0/python/pystdcommon.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/python/pystdcommon.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pystdcommon.swg index 0242e4d3..afa71350 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pystdcommon.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pystdcommon.swg @@ -45,11 +45,20 @@ namespace swig { template struct traits_asptr { static int asptr(PyObject *obj, Type **val) { - Type *p = 0; + int res = SWIG_ERROR; swig_type_info *descriptor = type_info(); - int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; - if (SWIG_IsOK(res)) { - if (val) *val = p; + if (val) { + Type *p = 0; + int newmem = 0; + res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR; + if (SWIG_IsOK(res)) { + if (newmem & SWIG_CAST_NEW_MEMORY) { + res |= SWIG_NEWOBJMASK; + } + *val = p; + } + } else { + res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR; } return res; } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pystrings.swg b/macx64/bin/swig/share/swig/4.3.0/python/pystrings.swg similarity index 68% rename from macx64/bin/swig/share/swig/4.0.0/python/pystrings.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pystrings.swg index 93f48acf..9797d1f7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pystrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pystrings.swg @@ -2,8 +2,10 @@ * utility methods for char strings * ------------------------------------------------------------ */ %fragment("SWIG_AsCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") { +/* Return string from Python obj. NOTE: obj must remain in scope in order + to use the returned cptr (but only when alloc is set to SWIG_OLDOBJ) */ SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { %#if PY_VERSION_HEX>=0x03000000 %#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) @@ -16,53 +18,31 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) %#endif { char *cstr; Py_ssize_t len; + PyObject *bytes = NULL; int ret = SWIG_OK; -%#if PY_VERSION_HEX>=0x03000000 -%#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - if (!obj) - return SWIG_TypeError; if (alloc) - *alloc = SWIG_NEWOBJ; -%#endif - PyBytes_AsStringAndSize(obj, &cstr, &len); + *alloc = SWIG_OLDOBJ; +%#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) + return SWIG_TypeError; %#else - PyString_AsStringAndSize(obj, &cstr, &len); -%#endif - if (cptr) { + cstr = (char *)SWIG_PyUnicode_AsUTF8AndSize(obj, &len, &bytes); + if (!cstr) + return SWIG_TypeError; + /* The returned string is only duplicated if the char * returned is not owned and memory managed by obj */ + if (bytes && cptr) { if (alloc) { - if (*alloc == SWIG_NEWOBJ) { - *cptr = %new_copy_array(cstr, len + 1, char); - *alloc = SWIG_NEWOBJ; - } else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } + cstr = %new_copy_array(cstr, len + 1, char); + *alloc = SWIG_NEWOBJ; } else { -%#if PY_VERSION_HEX>=0x03000000 -%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - *cptr = PyBytes_AsString(obj); -%#else - assert(0); /* Should never reach here with Unicode strings in Python 3 */ -%#endif -%#else - *cptr = SWIG_Python_str_AsChar(obj); - if (!*cptr) - ret = SWIG_TypeError; -%#endif + /* alloc must be set in order to clean up allocated memory */ + return SWIG_RuntimeError; } } - if (psize) *psize = len + 1; -%#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - Py_XDECREF(obj); %#endif + if (cptr) *cptr = cstr; + if (psize) *psize = len + 1; + SWIG_Py_XDECREF(bytes); return ret; } else { %#if defined(SWIG_PYTHON_2_UNICODE) @@ -85,10 +65,10 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) } if (psize) *psize = len + 1; - Py_XDECREF(obj); + SWIG_Py_XDECREF(obj); return SWIG_OK; } else { - Py_XDECREF(obj); + SWIG_Py_XDECREF(obj); } } %#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/python/python.swg b/macx64/bin/swig/share/swig/4.3.0/python/python.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/python.swg rename to macx64/bin/swig/share/swig/4.3.0/python/python.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pythonkw.swg b/macx64/bin/swig/share/swig/4.3.0/python/pythonkw.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/python/pythonkw.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pythonkw.swg index 0138e40e..a2103452 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pythonkw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pythonkw.swg @@ -2,7 +2,7 @@ Warnings for Python keywords, built-in names and bad names. */ -#define PYTHONKW(x) %keywordwarn("'" `x` "' is a python keyword, renaming to '_" `x` "'", rename="_%s") `x` +#define PYTHONKW(x) %keywordwarn("'" `x` "' is a python keyword", rename="_%s") `x` #define PYTHONBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in python") `x` diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pythreads.swg b/macx64/bin/swig/share/swig/4.3.0/python/pythreads.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/python/pythreads.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pythreads.swg index d8797e65..96a64710 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pythreads.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pythreads.swg @@ -8,8 +8,12 @@ # define SWIG_PYTHON_USE_GIL # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# if PY_VERSION_HEX < 0x03070000 +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# else +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { @@ -24,7 +28,7 @@ bool status; PyThreadState *save; public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + void end() { if (status) { status = false; PyEval_RestoreThread(save); }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pytypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/python/pytypemaps.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/python/pytypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pytypemaps.swg index 0eda17cd..f4a6e457 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pytypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pytypemaps.swg @@ -23,11 +23,6 @@ /* Python fragments for char* strings */ %include -/* Backward compatibility output helper */ -%fragment("t_output_helper","header") %{ -#define t_output_helper SWIG_Python_AppendOutput -%} - /* ------------------------------------------------------------ * Unified typemap section @@ -50,7 +45,7 @@ /* Overload of the output/constant/exception/dirout handling */ /* append output */ -#define SWIG_AppendOutput(result, obj) SWIG_Python_AppendOutput(result, obj) +#define SWIG_AppendOutput(result, obj) SWIG_Python_AppendOutput(result, obj, $isvoid) /* set constant */ #if defined(SWIGPYTHON_BUILTIN) @@ -62,6 +57,9 @@ /* raise */ #define SWIG_Raise(obj, type, desc) SWIG_Python_Raise(obj, type, desc) +/* clear errors */ +#define %error_clear PyErr_Clear() + /* Include the unified typemap library */ %include @@ -83,7 +81,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)); @@ -98,7 +96,7 @@ if (robj && !PyErr_Occurred()) { SwigPyObject_append((PyObject *) SWIG_Python_GetSwigThis($result), (PyObject *) SWIG_Python_GetSwigThis(robj)); - Py_DECREF(robj); + SWIG_Py_DECREF(robj); } } } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pyuserdir.swg b/macx64/bin/swig/share/swig/4.3.0/python/pyuserdir.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/pyuserdir.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pyuserdir.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/python/pywstrings.swg b/macx64/bin/swig/share/swig/4.3.0/python/pywstrings.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/python/pywstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/python/pywstrings.swg index 0e5a78df..903885ab 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/pywstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/python/pywstrings.swg @@ -30,7 +30,11 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc) %#endif if (isunicode) { %#if PY_VERSION_HEX >= 0x03030000 +%# if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 Py_ssize_t len = PyUnicode_GetLength(obj); +%# else + Py_ssize_t len = PyUnicode_AsWideChar(SWIGPY_UNICODE_ARG(obj), NULL, 0) - 1; +%# endif %#else Py_ssize_t len = PyUnicode_GetSize(obj); %#endif @@ -40,14 +44,14 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc) length = PyUnicode_AsWideChar(SWIGPY_UNICODE_ARG(obj), *cptr, len); if (length == -1) { PyErr_Clear(); - Py_XDECREF(tmp); + SWIG_Py_XDECREF(tmp); return SWIG_TypeError; } (*cptr)[length] = 0; } if (psize) *psize = (size_t) len + 1; if (alloc) *alloc = cptr ? SWIG_NEWOBJ : 0; - Py_XDECREF(tmp); + SWIG_Py_XDECREF(tmp); return SWIG_OK; } else { swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor(); diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/python/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_array.i b/macx64/bin/swig/share/swig/4.3.0/python/std_array.i similarity index 73% rename from macx64/bin/swig/share/swig/4.0.0/python/std_array.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_array.i index a3de3125..707b3547 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_array.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_array.i @@ -19,15 +19,43 @@ } }; - template - inline void - assign(const SwigPySeq& swigpyseq, std::array* seq) { - if (swigpyseq.size() < seq->size()) - throw std::invalid_argument("std::array cannot be expanded in size"); - else if (swigpyseq.size() > seq->size()) - throw std::invalid_argument("std::array cannot be reduced in size"); - std::copy(swigpyseq.begin(), swigpyseq.end(), seq->begin()); - } + template + struct IteratorProtocol, T> { + + static void assign(PyObject *obj, std::array *seq) { + SwigVar_PyObject iter = PyObject_GetIter(obj); + if (iter) { + SwigVar_PyObject item = PyIter_Next(iter); + size_t count = 0; + typename std::array::iterator array_iter = seq->begin(); + while (item && (count < N)) { + ++count; + *array_iter++ = swig::as(item); + item = PyIter_Next(iter); + } + if (count != N || item) + throw std::invalid_argument("std::array size does not match source container size"); + } + } + + static bool check(PyObject *obj) { + bool ret = false; + SwigVar_PyObject iter = PyObject_GetIter(obj); + if (iter) { + SwigVar_PyObject item = PyIter_Next(iter); + size_t count = 0; + ret = true; + while (item && (count < N)) { + ++count; + ret = swig::check(item); + item = ret ? PyIter_Next(iter) : 0; + } + if (count != N || item) + ret = false; + } + return ret; + } + }; template inline void diff --git a/macx64/bin/swig/share/swig/4.3.0/python/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/python/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/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/macx64/bin/swig/share/swig/4.0.0/python/std_basic_string.i b/macx64/bin/swig/share/swig/4.3.0/python/std_basic_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_basic_string.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_basic_string.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_char_traits.i b/macx64/bin/swig/share/swig/4.3.0/python/std_char_traits.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_char_traits.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_char_traits.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_common.i b/macx64/bin/swig/share/swig/4.3.0/python/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/python/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_container.i b/macx64/bin/swig/share/swig/4.3.0/python/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_container.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/python/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_except.i b/macx64/bin/swig/share/swig/4.3.0/python/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_except.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/std_filesystem.i b/macx64/bin/swig/share/swig/4.3.0/python/std_filesystem.i new file mode 100644 index 00000000..4fd11614 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_filesystem.i @@ -0,0 +1,127 @@ +/* ----------------------------------------------------------------------------- + * std_filesystem.i + * + * SWIG typemaps for std::filesystem::path + * ----------------------------------------------------------------------------- */ + +%{ +#include +%} + +namespace std { + namespace filesystem { + class path; + } +} + +%fragment("SWIG_std_filesystem", "header") { +SWIGINTERN PyObject *SWIG_std_filesystem_importPathClass() { + PyObject *module = PyImport_ImportModule("pathlib"); + PyObject *cls = PyObject_GetAttrString(module, "Path"); + SWIG_Py_DECREF(module); + return cls; +} + +SWIGINTERN bool SWIG_std_filesystem_isPathInstance(PyObject *obj) { + PyObject *cls = SWIG_std_filesystem_importPathClass(); + bool is_instance = PyObject_IsInstance(obj, cls); + SWIG_Py_DECREF(cls); + return is_instance; +} +} + +%typemap(in, fragment="SWIG_std_filesystem", fragment="") std::filesystem::path { + if (PyUnicode_Check($input)) { + PyObject *bytes = NULL; + const char *s = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &bytes); + $1 = std::filesystem::path(s); + SWIG_Py_XDECREF(bytes); + } else if (SWIG_std_filesystem_isPathInstance($input)) { + PyObject *str_obj = PyObject_Str($input); + if constexpr (std::is_same_v) { + Py_ssize_t size = 0; + wchar_t *ws = PyUnicode_AsWideCharString(str_obj, &size); + if (!ws) SWIG_fail; + $1 = std::filesystem::path(std::wstring(ws, static_cast(size))); + PyMem_Free(ws); + } else { + PyObject *bytes = NULL; + const char *s = SWIG_PyUnicode_AsUTF8AndSize(str_obj, NULL, &bytes); + $1 = std::filesystem::path(s); + SWIG_Py_XDECREF(bytes); + } + SWIG_Py_DECREF(str_obj); + } else { + void *argp = 0; + int res = SWIG_ConvertPtr($input, &argp, $descriptor(std::filesystem::path *), $disown | 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "$type", $symname, $argnum); + } + std::filesystem::path *temp = %reinterpret_cast(argp, $1_ltype*); + $1 = *temp; + } +} + +%typemap(in, fragment="SWIG_std_filesystem", fragment="") const std::filesystem::path &(std::filesystem::path temp_path) { + if (PyUnicode_Check($input)) { + PyObject *bytes = NULL; + const char *s = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &bytes); + temp_path = std::filesystem::path(s); + $1 = &temp_path; + SWIG_Py_XDECREF(bytes); + } else if (SWIG_std_filesystem_isPathInstance($input)) { + PyObject *str_obj = PyObject_Str($input); + if constexpr (std::is_same_v) { + Py_ssize_t size = 0; + wchar_t *ws = PyUnicode_AsWideCharString(str_obj, &size); + if (!ws) SWIG_fail; + temp_path = std::filesystem::path(std::wstring(ws, static_cast(size))); + $1 = &temp_path; + PyMem_Free(ws); + } else { + PyObject *bytes = NULL; + const char *s = SWIG_PyUnicode_AsUTF8AndSize(str_obj, NULL, &bytes); + temp_path = std::filesystem::path(s); + $1 = &temp_path; + SWIG_Py_XDECREF(bytes); + } + SWIG_Py_DECREF(str_obj); + } else { + void *argp = 0; + int res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "$type", $symname, $argnum); + } + $1 = %reinterpret_cast(argp, $1_ltype); + } +} + +%typemap(out, fragment="SWIG_std_filesystem", fragment="") std::filesystem::path { + PyObject *args; + if constexpr (std::is_same_v) { + std::wstring s = $1.generic_wstring(); + args = Py_BuildValue("(u)", s.data()); + } else { + std::string s = $1.generic_string(); + args = Py_BuildValue("(s)", s.data()); + } + PyObject *cls = SWIG_std_filesystem_importPathClass(); + $result = PyObject_CallObject(cls, args); + SWIG_Py_DECREF(cls); + SWIG_Py_DECREF(args); +} + +%typemap(out, fragment="SWIG_std_filesystem", fragment="") const std::filesystem::path & { + PyObject *args; + if constexpr (std::is_same_v) { + std::wstring s = $1->generic_wstring(); + args = Py_BuildValue("(u)", s.data()); + } else { + std::string s = $1->generic_string(); + args = Py_BuildValue("(s)", s.data()); + } + PyObject *cls = SWIG_std_filesystem_importPathClass(); + $result = PyObject_CallObject(cls, args); + SWIG_Py_DECREF(cls); + SWIG_Py_DECREF(args); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_ios.i b/macx64/bin/swig/share/swig/4.3.0/python/std_ios.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_ios.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_ios.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_iostream.i b/macx64/bin/swig/share/swig/4.3.0/python/std_iostream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_iostream.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_iostream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_list.i b/macx64/bin/swig/share/swig/4.3.0/python/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_map.i b/macx64/bin/swig/share/swig/4.3.0/python/std_map.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/python/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_map.i index 8ae483ce..954e7eb2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_map.i @@ -2,7 +2,7 @@ Maps */ -%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits") +%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits",fragment="SwigPyIterator_T") { namespace swig { template @@ -77,16 +77,6 @@ %fragment("StdMapTraits","header",fragment="StdMapCommonTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::map *map) { - typedef typename std::map::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - map->insert(value_type(it->first, it->second)); - } - } - template struct traits_asptr > { typedef std::map map_type; @@ -101,7 +91,7 @@ %#endif res = traits_asptr_stdseq >::asptr(items, val); } else { - map_type *p; + map_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; @@ -295,7 +285,11 @@ } void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } PyObject* asdict() { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_multimap.i b/macx64/bin/swig/share/swig/4.3.0/python/std_multimap.i similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/python/std_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_multimap.i index f78a5277..75b4d7fc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_multimap.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_multimap.i @@ -6,16 +6,6 @@ %fragment("StdMultimapTraits","header",fragment="StdMapCommonTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::multimap *multimap) { - typedef typename std::multimap::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - multimap->insert(value_type(it->first, it->second)); - } - } - template struct traits_asptr > { typedef std::multimap multimap_type; @@ -29,7 +19,7 @@ %#endif res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { - multimap_type *p; + multimap_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_multiset.i b/macx64/bin/swig/share/swig/4.3.0/python/std_multiset.i similarity index 59% rename from macx64/bin/swig/share/swig/4.0.0/python/std_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_multiset.i index ac430334..b79f64e5 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_multiset.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_multiset.i @@ -7,17 +7,6 @@ %fragment("StdMultisetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::multiset* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_asptr > { static int asptr(PyObject *obj, std::multiset **m) { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/python/std_pair.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/python/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_pair.i index 172572bf..0dcd0bb7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_pair.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_pair.i @@ -47,7 +47,7 @@ res = get_pair(first, second, val); } } else { - value_type *p; + value_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = *p; @@ -104,7 +104,7 @@ res = get_pair(first, second, val); } } else { - value_type *p; + value_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; @@ -140,7 +140,7 @@ SwigPython_std_pair_repr (PyObject *o) PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttrString(o, (char*) "first")); PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttrString(o, (char*) "second")); PyObject *result = PyObject_Repr(tuple); - Py_DECREF(tuple); + SWIG_Py_DECREF(tuple); return result; } diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_set.i b/macx64/bin/swig/share/swig/4.3.0/python/std_set.i similarity index 74% rename from macx64/bin/swig/share/swig/4.0.0/python/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_set.i index 0ef01199..3f80daff 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_set.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_set.i @@ -5,17 +5,6 @@ %fragment("StdSetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::set* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_asptr > { static int asptr(PyObject *obj, std::set **s) { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/python/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_sstream.i b/macx64/bin/swig/share/swig/4.3.0/python/std_sstream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_sstream.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_sstream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_streambuf.i b/macx64/bin/swig/share/swig/4.3.0/python/std_streambuf.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_streambuf.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_streambuf.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_string.i b/macx64/bin/swig/share/swig/4.3.0/python/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/python/std_string_view.i new file mode 100644 index 00000000..702dd9b4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_string_view.i @@ -0,0 +1,135 @@ +/* ----------------------------------------------------------------------------- + * std_string_view.i + * + * SWIG typemaps for std::string_view types + * ----------------------------------------------------------------------------- */ + +%include + +%{ +#include + +#if PY_VERSION_HEX < 0x03000000 +# error std_string_view.i not supported for Python 2 +#endif +%} + +namespace std { + + %naturalvar string_view; + + class string_view; + + %typemap(typecheck,precedence=SWIG_TYPECHECK_STRINGVIEW) string_view, const string_view & %{ +#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + $1 = PyBytes_Check($input); +#else + $1 = PyUnicode_Check($input) || PyBytes_Check($input); +#endif + %} + + %typemap(in) string_view (PyObject *bytes = NULL) { + Py_ssize_t len; +%#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + const char *p = PyBytes_AsString($input); + if (!p) SWIG_fail; + len = PyBytes_Size($input); +%#else + const char *p; + if (PyUnicode_Check($input)) { + p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes); + if (!p) SWIG_fail; + } else { + p = PyBytes_AsString($input); + if (!p) SWIG_fail; + len = PyBytes_Size($input); + } +%#endif + $1 = std::string_view(p, len); + } + + %typemap(freearg) string_view %{ + SWIG_Py_XDECREF(bytes$argnum); + %} + + %typemap(in) const string_view & ($*1_ltype temp, PyObject *bytes = NULL) { + Py_ssize_t len; +%#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + const char *p = PyBytes_AsString($input); + if (!p) SWIG_fail; + len = PyBytes_Size($input); +%#else + const char *p; + if (PyUnicode_Check($input)) { + p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes); + if (!p) SWIG_fail; + } else { + p = PyBytes_AsString($input); + if (!p) SWIG_fail; + len = PyBytes_Size($input); + } +%#endif + temp = std::string_view(p, len); + $1 = &temp; + } + + %typemap(freearg) const string_view & %{ + SWIG_Py_XDECREF(bytes$argnum); + %} + + %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) string_view { + Py_ssize_t len; +%#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + const char *p = PyBytes_AsString($input); + if (p) len = PyBytes_Size($input); +%#else + const char *p; + PyObject *bytes = NULL; + if (PyUnicode_Check($input)) { + p = SWIG_PyUnicode_AsUTF8AndSize($input, &len, &bytes); + // Avoid undefined behaviour (p will be pointing to a temporary + // if bytes is not NULL which happens when Py_LIMITED_API is defined + // and < 0x030A0000) and just leak by not calling Py_XDECREF. + // Py_XDECREF(bytes); + } else { + p = PyBytes_AsString($input); + if (p) len = PyBytes_Size($input); + } +%#endif + if (p) $result = std::string_view(p, len); + } + + + %typemap(out) string_view %{ +#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + $result = PyBytes_FromStringAndSize($1.data(), $1.size()); +#else + $result = PyUnicode_FromStringAndSize($1.data(), $1.size()); +#endif + %} + + %typemap(varout) string_view %{ +#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + $result = PyBytes_FromStringAndSize($1.data(), $1.size()); +#else + $result = PyUnicode_FromStringAndSize($1.data(), $1.size()); +#endif + %} + + %typemap(directorin) string_view, const string_view & %{ +#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + $input = PyBytes_FromStringAndSize($1.data(), $1.size()); +#else + $input = PyUnicode_FromStringAndSize($1.data(), $1.size()); +#endif + %} + + %typemap(out) const string_view & %{ +#ifdef SWIG_PYTHON_STRICT_BYTE_CHAR + $result = PyBytes_FromStringAndSize($1->data(), $1->size()); +#else + $result = PyUnicode_FromStringAndSize($1->data(), $1->size()); +#endif + %} + +} diff --git a/macx64/bin/swig/share/swig/4.3.0/python/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/python/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_map.i b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_map.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/python/std_unordered_map.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_unordered_map.i index 042d5b67..43217355 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_map.i @@ -56,16 +56,6 @@ %fragment("StdUnorderedMapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_map *unordered_map) { - typedef typename std::unordered_map::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - unordered_map->insert(value_type(it->first, it->second)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_map &seq, typename std::unordered_map::size_type n) { @@ -87,7 +77,7 @@ %#endif res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { - unordered_map_type *p; + unordered_map_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; @@ -281,7 +271,11 @@ } void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) { +%#ifdef __cpp_lib_unordered_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } PyObject* asdict() { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multimap.i b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multimap.i similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multimap.i index 28114044..816ec093 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multimap.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multimap.i @@ -6,16 +6,6 @@ %fragment("StdUnorderedMultimapTraits","header",fragment="StdMapCommonTraits",fragment="StdUnorderedMapForwardIteratorTraits") { namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_multimap *unordered_multimap) { - typedef typename std::unordered_multimap::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - unordered_multimap->insert(value_type(it->first, it->second)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_multimap &seq, typename std::unordered_multimap::size_type n) { @@ -36,7 +26,7 @@ %#endif res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { - unordered_multimap_type *p; + unordered_multimap_type *p = 0; swig_type_info *descriptor = swig::type_info(); res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multiset.i b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multiset.i similarity index 71% rename from macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multiset.i index b0f3f096..0542247b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_multiset.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_multiset.i @@ -7,17 +7,6 @@ %fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_multiset* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_multiset &seq, typename std::unordered_multiset::size_type n) { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_set.i b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_set.i similarity index 77% rename from macx64/bin/swig/share/swig/4.0.0/python/std_unordered_set.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_unordered_set.i index 79fca6c2..fd866b14 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/std_unordered_set.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/std_unordered_set.i @@ -5,17 +5,6 @@ %fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template - inline void - assign(const SwigPySeq& swigpyseq, std::unordered_set* seq) { - // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - template struct traits_reserve > { static void reserve(std::unordered_set &seq, typename std::unordered_set::size_type n) { diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/python/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_vectora.i b/macx64/bin/swig/share/swig/4.3.0/python/std_vectora.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_vectora.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_vectora.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_wios.i b/macx64/bin/swig/share/swig/4.3.0/python/std_wios.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_wios.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_wios.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_wiostream.i b/macx64/bin/swig/share/swig/4.3.0/python/std_wiostream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_wiostream.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_wiostream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_wsstream.i b/macx64/bin/swig/share/swig/4.3.0/python/std_wsstream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_wsstream.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_wsstream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_wstreambuf.i b/macx64/bin/swig/share/swig/4.3.0/python/std_wstreambuf.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_wstreambuf.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_wstreambuf.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/python/std_wstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/python/std_wstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/python/stl.i b/macx64/bin/swig/share/swig/4.3.0/python/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/stl.i rename to macx64/bin/swig/share/swig/4.3.0/python/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/python/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/python/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/python/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/python/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/python/typemaps.i similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/python/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/python/typemaps.i index 5d438eca..75592036 100644 --- a/macx64/bin/swig/share/swig/4.0.0/python/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/python/typemaps.i @@ -72,7 +72,7 @@ multiple output values, they are returned in the form of a Python tuple. For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and -returns the integer part in one of its parameters).K: +returns the integer part in one of its parameters) : double modf(double x, double *ip); @@ -139,10 +139,6 @@ to a Python variable you might do this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ %include diff --git a/macx64/bin/swig/share/swig/4.0.0/python/wchar.i b/macx64/bin/swig/share/swig/4.3.0/python/wchar.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/python/wchar.i rename to macx64/bin/swig/share/swig/4.3.0/python/wchar.i diff --git a/macx64/bin/swig/share/swig/4.3.0/r/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/r/argcargv.i new file mode 100644 index 00000000..1753f6e3 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/r/argcargv.i @@ -0,0 +1,38 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +/* Preserve string vector as is */ +%typemap(scoercein) (int ARGC, char **ARGV) "" +/* Verify we pass the proper string vector */ +%typemap(scheck) (int ARGC, char **ARGV) %{ + assert(is.null($input) || (is.vector($input) && is.character($input))) +%} +/* Check argument is null or a string vector for dispatcher */ +%typemap(rtypecheck) (int ARGC, char **ARGV) %{ + is.null($arg) || (is.vector($arg) && is.character($arg)) +%} +%typemap(in) (int ARGC, char **ARGV) { + $1_ltype i; + SEXP *pstr; + if ($input == R_NilValue) { + /* Empty array */ + $1 = 0; + } else if (!Rf_isVectorAtomic($input) || TYPEOF($input) != STRSXP) { + SWIG_exception_fail(SWIG_RuntimeError, "Wrong array type."); + } else { + $1 = Rf_length($input); + pstr = CHARACTER_POINTER($input); + } + $2 = ($2_ltype) malloc(($1+1)*sizeof($*2_ltype)); + if ($2 == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_MemoryError, "Memory allocation failed."); + } + for (i = 0; i < $1; i++) { + $2[i] = ($*2_ltype)STRING_VALUE(pstr[i]); + } + $2[i] = SWIG_NULLPTR; +} +%typemap(freearg,noblock=1) (int ARGC, char **ARGV) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/r/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/r/boost_shared_ptr.i similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/r/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/r/boost_shared_ptr.i index 668bf435..fde6ae56 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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,31 @@ #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(rtypecheck) 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 > *& + "(extends($argtype, '$typemap(rtype, TYPE)') && length($arg) == 1) || is.null($arg)" + +%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/macx64/bin/swig/share/swig/4.0.0/r/exception.i b/macx64/bin/swig/share/swig/4.3.0/r/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/exception.i rename to macx64/bin/swig/share/swig/4.3.0/r/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/r.swg b/macx64/bin/swig/share/swig/4.3.0/r/r.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/r/r.swg rename to macx64/bin/swig/share/swig/4.3.0/r/r.swg index 8cf8cdf5..63b69d8c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/r.swg +++ b/macx64/bin/swig/share/swig/4.3.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("%s", 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/macx64/bin/swig/share/swig/4.0.0/r/rcontainer.swg b/macx64/bin/swig/share/swig/4.3.0/r/rcontainer.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/r/rcontainer.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rcontainer.swg index 54b31b39..84a6c690 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/rcontainer.swg +++ b/macx64/bin/swig/share/swig/4.3.0/r/rcontainer.swg @@ -75,25 +75,29 @@ namespace swig { template inline void - setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) { + setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) { typename Sequence::size_type size = self->size(); typename Sequence::size_type ii = swig::check_index(i, size, true); typename Sequence::size_type jj = swig::slice_index(j, size); if (jj < ii) jj = ii; size_t ssize = jj - ii; - if (ssize <= v.size()) { + if (ssize <= is.size()) { + // expanding/staying the same size typename Sequence::iterator sb = self->begin(); - typename InputSeq::const_iterator vmid = v.begin(); + typename InputSeq::const_iterator vmid = is.begin(); std::advance(sb,ii); std::advance(vmid, jj - ii); - self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end()); + self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end()); } else { + // shrinking typename Sequence::iterator sb = self->begin(); typename Sequence::iterator se = self->begin(); std::advance(sb,ii); std::advance(se,jj); self->erase(sb,se); - self->insert(sb, v.begin(), v.end()); + sb = self->begin(); + std::advance(sb,ii); + self->insert(sb, is.begin(), is.end()); } } @@ -148,9 +152,9 @@ namespace swig { return swig::getslice(self, i, j); } - void __setslice__(difference_type i, difference_type j, const Sequence& v) + void __setslice__(difference_type i, difference_type j, const Sequence& is) throw (std::out_of_range, std::invalid_argument) { - swig::setslice(self, i, j, v); + swig::setslice(self, i, j, is); } void __delslice__(difference_type i, difference_type j) throw (std::out_of_range) { diff --git a/macx64/bin/swig/share/swig/4.0.0/r/rfragments.swg b/macx64/bin/swig/share/swig/4.3.0/r/rfragments.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/r/rfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rfragments.swg index b89212b0..c3b40a90 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/rfragments.swg +++ b/macx64/bin/swig/share/swig/4.3.0/r/rfragments.swg @@ -1,7 +1,3 @@ -#define SWIG_Error(code, msg) Rf_warning(msg); return Rf_ScalarLogical(NA_LOGICAL) - -#define SWIG_fail return Rf_ScalarLogical(NA_LOGICAL) - /* for raw pointers */ #define SWIG_ConvertPtr(oc, ptr, ty, flags) SWIG_R_ConvertPtr(oc, ptr, ty, flags) #define SWIG_ConvertFunctionPtr(oc, ptr, ty) SWIG_R_ConvertPtr(oc, ptr, ty, 0) diff --git a/macx64/bin/swig/share/swig/4.0.0/r/rkw.swg b/macx64/bin/swig/share/swig/4.3.0/r/rkw.swg similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/r/rkw.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rkw.swg index 074d7dfd..c4af7084 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/rkw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/r/rkw.swg @@ -2,8 +2,8 @@ Warnings for R keywords, built-in names and bad names. */ -#define RKW(x) %keywordwarn("'" `x` "' is a R keyword, renaming to '_" `x`"'", rename="_%s") `x` -#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name, renaming to '_" `x`"'", rename="_%s") `x` +#define RKW(x) %keywordwarn("'" `x` "' is a R keyword", rename="_%s") `x` +#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name", rename="_%s") `x` /* Warnings for R reserved words taken from diff --git a/macx64/bin/swig/share/swig/4.0.0/r/ropers.swg b/macx64/bin/swig/share/swig/4.3.0/r/ropers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/ropers.swg rename to macx64/bin/swig/share/swig/4.3.0/r/ropers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/r/rrun.swg b/macx64/bin/swig/share/swig/4.3.0/r/rrun.swg similarity index 83% rename from macx64/bin/swig/share/swig/4.0.0/r/rrun.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rrun.swg index c341321a..4c03d588 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/rrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/r/rrun.swg @@ -1,4 +1,3 @@ - /* Remove global namespace pollution */ #if !defined(SWIG_NO_R_NO_REMAP) # define R_NO_REMAP @@ -16,13 +15,15 @@ extern "C" { #endif /* for raw pointer */ +#define SWIG_R_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags) #include #include #include +#include #if R_VERSION >= R_Version(2,6,0) #define VMAXTYPE void * @@ -30,6 +31,47 @@ extern "C" { #define VMAXTYPE char * #endif +/* Last error */ +static int SWIG_lasterror_code = 0; +static char SWIG_lasterror_msg[1024]; +SWIGRUNTIME void SWIG_Error(int code, const char *format, ...) { + va_list arg; + SWIG_lasterror_code = code; + va_start(arg, format); + vsnprintf(SWIG_lasterror_msg, sizeof(SWIG_lasterror_msg), format, arg); + va_end(arg); +} + +SWIGRUNTIME const char *SWIG_ErrorType(int code) { + switch (code) { + case SWIG_MemoryError: + return "SWIG:MemoryError"; + case SWIG_IOError: + return "SWIG:IOError"; + case SWIG_RuntimeError: + return "SWIG:RuntimeError"; + case SWIG_IndexError: + return "SWIG:IndexError"; + case SWIG_TypeError: + return "SWIG:TypeError"; + case SWIG_DivisionByZero: + return "SWIG:DivisionByZero"; + case SWIG_OverflowError: + return "SWIG:OverflowError"; + case SWIG_SyntaxError: + return "SWIG:SyntaxError"; + case SWIG_ValueError: + return "SWIG:ValueError"; + case SWIG_SystemError: + return "SWIG:SystemError"; + case SWIG_AttributeError: + return "SWIG:AttributeError"; + } + return "SWIG:UnknownError"; +} + +#define SWIG_fail goto fail + /* This is mainly a way to avoid having lots of local variables that may conflict with those in the routine. @@ -273,9 +315,11 @@ SWIG_R_NewPointerObj(void *ptr, swig_type_info *type, int flags) { /* Convert a pointer value */ SWIGRUNTIMEINLINE int -SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) { +SWIG_R_ConvertPtrAndOwn(SEXP obj, void **ptr, swig_type_info *ty, int flags, int *own) { void *vptr; if (!obj) return SWIG_ERROR; + if (own) + *own = 0; if (obj == R_NilValue) { if (ptr) *ptr = NULL; return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; @@ -289,9 +333,15 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) { if (ptr) *ptr = vptr; } else { swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - int newmemory = 0; - if (ptr) *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, vptr, &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; + } + } } } else { if (ptr) *ptr = vptr; diff --git a/macx64/bin/swig/share/swig/4.0.0/r/rstdcommon.swg b/macx64/bin/swig/share/swig/4.3.0/r/rstdcommon.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/rstdcommon.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rstdcommon.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/r/rtype.swg b/macx64/bin/swig/share/swig/4.3.0/r/rtype.swg similarity index 74% rename from macx64/bin/swig/share/swig/4.0.0/r/rtype.swg rename to macx64/bin/swig/share/swig/4.3.0/r/rtype.swg index bdc48c24..1d666329 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/rtype.swg +++ b/macx64/bin/swig/share/swig/4.3.0/r/rtype.swg @@ -3,34 +3,34 @@ 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") bool, bool * "logical" +%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") 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 %} %typemap("rtypecheck") int *, long * %{ is.integer($arg) || is.numeric($arg) %} - -%typemap("rtypecheck") float, double +%typemap("rtypecheck") float, float &, double, double & %{ is.numeric($arg) && length($arg) == 1 %} %typemap("rtypecheck") float *, double * %{ is.numeric($arg) %} @@ -40,6 +40,38 @@ %typemap("rtypecheck") bool * %{ is.logical($arg) %} +%typemap("rtypecheck") char + %{ is.character($arg) && length($arg) == 1 %} +%typemap("rtypecheck") char *, char ** + %{ is.character($arg) %} + +%typemap("rtypecheck") string, string & + %{ is.character($arg) && length($arg) == 1 %} +%typemap("rtypecheck") string * + %{ is.character($arg) %} + +%typemap("rtypecheck") std::string, std::string & + %{ is.character($arg) && length($arg) == 1 %} +%typemap("rtypecheck") std::string * + %{ is.character($arg) %} + +%typemap("rtypecheck") enum SWIGTYPE, enum SWIGTYPE *const&, enum SWIGTYPE &, const enum SWIGTYPE &, enum SWIGTYPE && + %{ is.character($arg) && length($arg) == 1 %} +%typemap("rtypecheck") enum SWIGTYPE * + %{ is.character($arg) %} + +%typemap("rtypecheck") SWIGTYPE * + %{ extends($argtype, '$R_class') || is.null($arg) %} + +%typemap("rtypecheck") SWIGTYPE &, SWIGTYPE && + %{ extends($argtype, '$R_class') && length($arg) == 1 %} + +%typemap("rtypecheck") SWIGTYPE *const& + %{ extends($argtype, '$*R_class') && length($arg) == 1 %} + +%typemap("rtypecheck") SWIGTYPE + %{ extends($argtype, '$&R_class') && length($arg) == 1 %} + /* Set up type checks to insure overloading precedence. We would like non pointer items to shadow pointer items, so that @@ -93,21 +125,21 @@ %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} -%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE && - %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref") %} +%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE && + %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %} /* %typemap(scoercein) SWIGTYPE *, SWIGTYPE *const - %{ $input = coerceIfNotSubclass($input, "$R_class") %} + %{ $input = coerceIfNotSubclass($input, "$R_class"); %} %typemap(scoercein) SWIGTYPE & - %{ $input = coerceIfNotSubclass($input, "$R_class") %} + %{ $input = coerceIfNotSubclass($input, "$R_class"); %} %typemap(scoercein) SWIGTYPE && - %{ $input = coerceIfNotSubclass($input, "$R_class") %} + %{ $input = coerceIfNotSubclass($input, "$R_class"); %} %typemap(scoercein) SWIGTYPE - %{ $input = coerceIfNotSubclass($input, "$&R_class") %} + %{ $input = coerceIfNotSubclass($input, "$&R_class"); %} */ %typemap(scoercein) SWIGTYPE[ANY] @@ -172,6 +204,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/macx64/bin/swig/share/swig/4.0.0/r/srun.swg b/macx64/bin/swig/share/swig/4.3.0/r/srun.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/srun.swg rename to macx64/bin/swig/share/swig/4.3.0/r/srun.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/r/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_common.i b/macx64/bin/swig/share/swig/4.3.0/r/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_container.i b/macx64/bin/swig/share/swig/4.3.0/r/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_container.i diff --git a/macx64/bin/swig/share/swig/4.3.0/r/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/r/std_deque.i new file mode 100644 index 00000000..f377a80c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/r/std_deque.i @@ -0,0 +1,3 @@ +%fragment("StdDequeTraits", "header", fragment="StdSequenceTraits") {} + +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_except.i b/macx64/bin/swig/share/swig/4.3.0/r/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_list.i b/macx64/bin/swig/share/swig/4.3.0/r/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_map.i b/macx64/bin/swig/share/swig/4.3.0/r/std_map.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_map.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/r/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/r/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.3.0/r/std_string.i b/macx64/bin/swig/share/swig/4.3.0/r/std_string.i new file mode 100644 index 00000000..dc1378ae --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/r/std_string.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/r/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/r/std_vector.i similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/r/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/r/std_vector.i index 4ec51dc9..6b32c9f6 100644 --- a/macx64/bin/swig/share/swig/4.0.0/r/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/r/std_vector.i @@ -122,11 +122,39 @@ } }; - // vectors of 64 bit unsigned int -#if defined(SWIGWORDSIZE64) + // vectors of unsigned long (32 or 64 bit int, depending on architecture) template <> - struct traits_from_ptr > { - static SEXP from (std::vector *val, int owner = 0) { + struct traits_from_ptr > { + static SEXP from (std::vector *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of int (32 or 64 bit int, depending on architecture) + template <> + struct traits_from_ptr > { + static SEXP from (std::vector *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of 64 bit unsigned long long + template <> + struct traits_from_ptr > { + static SEXP from (std::vector *val, int owner = 0) { SEXP result; PROTECT(result = Rf_allocVector(INTSXP, val->size())); for (unsigned pos = 0; pos < val->size(); pos++) @@ -139,8 +167,8 @@ }; // vectors of 64 bit int template <> - struct traits_from_ptr > { - static SEXP from (std::vector *val, int owner = 0) { + struct traits_from_ptr > { + static SEXP from (std::vector *val, int owner = 0) { SEXP result; PROTECT(result = Rf_allocVector(INTSXP, val->size())); for (unsigned pos = 0; pos < val->size(); pos++) @@ -151,35 +179,7 @@ return(result); } }; -#else - template <> - struct traits_from_ptr > { - static SEXP from (std::vector *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(INTSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - INTEGER_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; - // vectors of 64 bit int - template <> - struct traits_from_ptr > { - static SEXP from (std::vector *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(INTSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - INTEGER_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; -#endif + // vectors of bool template <> struct traits_from_ptr > { @@ -194,7 +194,7 @@ return(result); } }; - + // vectors of strings template <> struct traits_from_ptr > > { @@ -395,20 +395,19 @@ } }; -#if defined(SWIGWORDSIZE64) - // 64 bit integer types + // long (32 bit or 64 bit depending on architecture) template <> - struct traits_asptr < std::vector > { - static int asptr(SEXP obj, std::vector **val) { - std::vector *p; + struct traits_asptr < std::vector > { + static int asptr(SEXP obj, std::vector **val) { + std::vector *p; unsigned int sexpsz = Rf_length(obj); - p = new std::vector(sexpsz); + p = new std::vector(sexpsz); SEXP coerced; PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); int *S = INTEGER_POINTER(coerced); for (unsigned pos = 0; pos < p->size(); pos++) { - (*p)[pos] = static_cast(S[pos]); + (*p)[pos] = static_cast(S[pos]); } int res = SWIG_OK; if (SWIG_IsOK(res)) { @@ -420,18 +419,18 @@ }; template <> - struct traits_asptr < std::vector > { - static int asptr(SEXP obj, std::vector **val) { - std::vector *p; + struct traits_asptr < std::vector > { + static int asptr(SEXP obj, std::vector **val) { + std::vector *p; // not sure how to check the size of the SEXP obj is correct int sexpsz = Rf_length(obj); - p = new std::vector(sexpsz); + p = new std::vector(sexpsz); SEXP coerced; PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); int *S = INTEGER_POINTER(coerced); for (unsigned pos = 0; pos < p->size(); pos++) { - (*p)[pos] = static_cast(S[pos]); + (*p)[pos] = static_cast(S[pos]); } int res = SWIG_OK; if (SWIG_IsOK(res)) { @@ -442,20 +441,19 @@ } }; -#else // 64 bit integer types template <> - struct traits_asptr < std::vector > { - static int asptr(SEXP obj, std::vector **val) { - std::vector *p; + struct traits_asptr < std::vector > { + static int asptr(SEXP obj, std::vector **val) { + std::vector *p; unsigned int sexpsz = Rf_length(obj); - p = new std::vector(sexpsz); + p = new std::vector(sexpsz); SEXP coerced; PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); int *S = INTEGER_POINTER(coerced); for (unsigned pos = 0; pos < p->size(); pos++) { - (*p)[pos] = static_cast(S[pos]); + (*p)[pos] = static_cast(S[pos]); } int res = SWIG_OK; if (SWIG_IsOK(res)) { @@ -467,18 +465,18 @@ }; template <> - struct traits_asptr < std::vector > { - static int asptr(SEXP obj, std::vector **val) { - std::vector *p; + struct traits_asptr < std::vector > { + static int asptr(SEXP obj, std::vector **val) { + std::vector *p; // not sure how to check the size of the SEXP obj is correct int sexpsz = Rf_length(obj); - p = new std::vector(sexpsz); + p = new std::vector(sexpsz); SEXP coerced; PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); int *S = INTEGER_POINTER(coerced); for (unsigned pos = 0; pos < p->size(); pos++) { - (*p)[pos] = static_cast(S[pos]); + (*p)[pos] = static_cast(S[pos]); } int res = SWIG_OK; if (SWIG_IsOK(res)) { @@ -489,8 +487,6 @@ } }; -#endif - template <> struct traits_asptr < std::vector > { static int asptr(SEXP obj, std::vector **val) { @@ -544,7 +540,7 @@ struct traits_asptr < std::vector > { static int asptr(SEXP obj, std::vector **val) { std::vector *p; - int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector >(), 0); + int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector >(), 0); if (SWIG_IsOK(res)) { if (val) *val = p; } @@ -660,6 +656,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) { @@ -806,7 +823,7 @@ static int asptr(SEXP obj, std::vector< std::vector > **val) { std::vector< std::vector > *p; Rprintf("vector of vectors - unsupported content\n"); - int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector > > (), 0); + int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector > > (), 0); if (SWIG_IsOK(res)) { if (val) *val = p; } @@ -841,7 +858,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 +874,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 +883,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 +904,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); @@ -897,13 +912,11 @@ std::vector< std::basic_string > *, %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); %traits_type_name(std::vector); -#if defined(SWIGWORDSIZE64) -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); -%traits_type_name(std::vector); -#else -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); -%traits_type_name(std::vector); -#endif +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); +%traits_type_name(std::vector); + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); +%traits_type_name(std::vector); // unsigned %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); @@ -915,13 +928,11 @@ std::vector< std::basic_string > *, %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); %traits_type_name(std::vector); -#if defined(SWIGWORDSIZE64) -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); -%traits_type_name(std::vector); -#else -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); -%traits_type_name(std::vector); -#endif +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); +%traits_type_name(std::vector); + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector); +%traits_type_name(std::vector); // These R side typemaps are common for integer types // but we can't use %apply as it will copy the C side ones too @@ -932,13 +943,11 @@ std::vector< std::basic_string > *, %typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; %typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; -#if defined(SWIGWORDSIZE64) -%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; -%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; -#else -%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; -%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; -#endif +%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; +%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; + +%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; +%typemap("rtype") std::vector, std::vector *, std::vector & = std::vector; %typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; @@ -946,26 +955,22 @@ std::vector< std::basic_string > *, %typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; %typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; -#if defined(SWIGWORDSIZE64) -%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; -%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; -#else -%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; -%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; -#endif +%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; +%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; + +%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; +%typemap("scoercein") std::vector, std::vector *, std::vector & = std::vector; %typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; %typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; %typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; %typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; -#if defined(SWIGWORDSIZE64) -%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; -%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; -#else -%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; -%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; -#endif +%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; +%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; + +%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; +%typemap("rtypecheck") std::vector, std::vector *, std::vector & = std::vector; /////////////////////////////////////////////////////////////// @@ -974,21 +979,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 +1008,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,25 +1061,27 @@ 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) -%typemap(scoerceout) std::vector, - std::vector*, - std::vector&, - std::vector, - std::vector*, - std::vector& - %{ %} -#else - -%typemap(scoerceout) std::vector, - std::vector*, - std::vector&, - std::vector, - std::vector*, - std::vector& +%typemap(scoerceout) std::vector, + std::vector*, + std::vector&, + std::vector, + std::vector*, + std::vector& %{ %} -#endif +%typemap(scoerceout) std::vector, + std::vector*, + std::vector&, + std::vector, + std::vector*, + std::vector& + %{ %} + +%apply std::vector< std::basic_string > { std::vector }; +%apply std::vector< std::vector< std::basic_string > > { std::vector< std::vector > }; diff --git a/macx64/bin/swig/share/swig/4.0.0/r/stl.i b/macx64/bin/swig/share/swig/4.3.0/r/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/stl.i rename to macx64/bin/swig/share/swig/4.3.0/r/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/r/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/r/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/r/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/r/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/r/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/r/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/r/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/Makefile.swig b/macx64/bin/swig/share/swig/4.3.0/ruby/Makefile.swig similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/Makefile.swig rename to macx64/bin/swig/share/swig/4.3.0/ruby/Makefile.swig diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/ruby/argcargv.i similarity index 63% rename from macx64/bin/swig/share/swig/4.0.0/ruby/argcargv.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/argcargv.i index fc0bc406..b8efcffb 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/argcargv.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/argcargv.i @@ -1,26 +1,22 @@ -/* ------------------------------------------------------------ - * --- 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) - * ------------------------------------------------------------ */ + * ------------------------------------------------------------- */ %typemap(in) (int ARGC, char **ARGV) { if (rb_obj_is_kind_of($input,rb_cArray)) { @@ -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/macx64/bin/swig/share/swig/4.0.0/ruby/attribute.i b/macx64/bin/swig/share/swig/4.3.0/ruby/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/attribute.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/ruby/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/ruby/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/boost_shared_ptr.i index 9676bf9d..70deae4f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/ruby/carrays.i b/macx64/bin/swig/share/swig/4.3.0/ruby/carrays.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/ruby/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/carrays.i index 8f74cd9b..7e1e66a7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/carrays.i @@ -3,4 +3,3 @@ %enddef %include - diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/ruby/cmalloc.i new file mode 100644 index 00000000..248f06b9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/cmalloc.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/ruby/cpointer.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/cpointer.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/cstring.i b/macx64/bin/swig/share/swig/4.3.0/ruby/cstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/cstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/director.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/director.swg similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/ruby/director.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/director.swg index c6c53a34..360f3f19 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/director.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/director.swg @@ -153,43 +153,6 @@ namespace Swig { } }; - /* unknown exception handler */ - class UnknownExceptionHandler { -#ifdef SWIG_DIRECTOR_UEH - static void handler() { - try { - throw; - } catch (DirectorException& e) { - std::cerr << "SWIG Director exception caught:" << std::endl - << e.what() << std::endl; - } catch (std::exception& e) { - std::cerr << "std::exception caught: "<< e.what() << std::endl; - } catch (...) { - std::cerr << "Unknown exception caught." << std::endl; - } - std::cerr << std::endl - << "Ruby interpreter traceback:" << std::endl; - std::cerr << std::endl; - std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl - << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl - << std::endl - << "Exception is being re-thrown, program will like abort/terminate." << std::endl; - throw; - } - - public: - std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) { - old = std::set_unexpected(nh); - } - - ~UnknownExceptionHandler() { - std::set_unexpected(old); - } -#endif - }; - - /* Type mismatch in the return value from a Ruby method call */ class DirectorTypeMismatchException : public DirectorException { public: @@ -239,37 +202,6 @@ namespace Swig { } }; - /* Simple thread abstraction for pthreads on win32 */ -#ifdef __THREAD__ -# define __PTHREAD__ -# if defined(_WIN32) || defined(__WIN32__) -# define pthread_mutex_lock EnterCriticalSection -# define pthread_mutex_unlock LeaveCriticalSection -# define pthread_mutex_t CRITICAL_SECTION -# define SWIG_MUTEX_INIT(var) var -# else -# include -# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER -# endif -#endif - -#ifdef __PTHREAD__ - struct Guard { - pthread_mutex_t *_mutex; - - Guard(pthread_mutex_t &mutex) : _mutex(&mutex) { - pthread_mutex_lock(_mutex); - } - - ~Guard() { - pthread_mutex_unlock(_mutex); - } - }; -# define SWIG_GUARD(mutex) Guard _guard(mutex) -#else -# define SWIG_GUARD(mutex) -#endif - /* director base class */ class Director { private: @@ -303,9 +235,7 @@ namespace Swig { private: typedef std::map swig_ownership_map; mutable swig_ownership_map swig_owner; -#ifdef __PTHREAD__ - static pthread_mutex_t swig_mutex_own; -#endif + SWIG_GUARD_DECLARATION(swig_mutex_own); public: template @@ -344,5 +274,6 @@ namespace Swig { return own; } }; + SWIG_GUARD_DEFINITION(Director, swig_mutex_own); } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/embed.i b/macx64/bin/swig/share/swig/4.3.0/ruby/embed.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/embed.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/embed.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/exception.i b/macx64/bin/swig/share/swig/4.3.0/ruby/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/exception.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/extconf.rb b/macx64/bin/swig/share/swig/4.3.0/ruby/extconf.rb similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/extconf.rb rename to macx64/bin/swig/share/swig/4.3.0/ruby/extconf.rb diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/factory.i b/macx64/bin/swig/share/swig/4.3.0/ruby/factory.i new file mode 100644 index 00000000..46a0a873 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/factory.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/file.i b/macx64/bin/swig/share/swig/4.3.0/ruby/file.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/file.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/file.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/progargcargv.i b/macx64/bin/swig/share/swig/4.3.0/ruby/progargcargv.i similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/ruby/progargcargv.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/progargcargv.i index a2843c34..36f1c9ad 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/progargcargv.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/progargcargv.i @@ -3,7 +3,7 @@ int PROG_ARGC char **PROG_ARGV Some C function receive argc and argv from C main function. - This typemap provides ignore typemap which pass Ruby ARGV contents + This file provides typemaps which pass Ruby ARGV contents as argc and argv to C function. */ diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/ruby.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/ruby.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/ruby/ruby.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/ruby.swg index d1335974..cf7c1092 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/ruby.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/ruby.swg @@ -17,7 +17,7 @@ /* SWIG only considers static class members with inline initializers to be constants. For examples of what is and isn't considered a constant by SWIG see naming.i in the Ruby test suite. */ -%rename("%(uppercase)s", %$ismember, %$isvariable,%$isimmutable,%$isstatic,%$hasvalue,%$hasconsttype) ""; +%rename("%(uppercase)s", %$ismember, %$isvariable, %$isstatic, %$hasvalue, %$hasconsttype) ""; /* Enums are mapped to constants but all we do is make sure the first letter is uppercase */ diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyapi.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyapi.swg similarity index 88% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyapi.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyapi.swg index e0077572..fe71a22a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyapi.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyapi.swg @@ -7,8 +7,8 @@ extern "C" { #endif SWIGINTERN VALUE -SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { - if (NIL_P(target)) { +SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void) { + if (NIL_P(target) && is_void) { target = o; } else { if (TYPE(target) != T_ARRAY) { diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyautodoc.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyautodoc.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyautodoc.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyautodoc.swg index 1e6b0d9d..6b0472ce 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyautodoc.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyautodoc.swg @@ -77,7 +77,7 @@ AUTODOC(operator>, "Higher than comparison operator"); AUTODOC(operator<<, "Left shifting or appending operator"); AUTODOC(operator>>, "Right shifting operator or extracting operator"); AUTODOC(operator+, "Add operator"); -AUTODOC(operator-, "Substraction operator"); +AUTODOC(operator-, "Subtraction operator"); AUTODOC(operator+(), "Positive operator"); AUTODOC(operator-(), "Negation operator"); AUTODOC(operator&, "AND operator"); @@ -93,7 +93,7 @@ AUTODOC(__gt__, "Higher than comparison operator"); AUTODOC(__lshift__, "Left shifting or appending operator"); AUTODOC(__rshift__, "Right shifting operator or extracting operator"); AUTODOC(__add___, "Add operator"); -AUTODOC(__sub__, "Substraction operator"); +AUTODOC(__sub__, "Subtraction operator"); AUTODOC(__pos__, "Positive operator"); AUTODOC(__neg__, "Negation operator"); AUTODOC(__and__, "AND operator"); diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyclasses.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyclasses.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyclasses.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyclasses.swg index f7b51bdc..c43f38fc 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyclasses.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyclasses.swg @@ -174,7 +174,7 @@ namespace swig { return rb_inspect(_obj); } - static VALUE swig_rescue_swallow(VALUE) + static VALUE swig_rescue_swallow(VALUE, VALUE) { /* VALUE errstr = rb_obj_as_string(rb_errinfo()); @@ -203,12 +203,12 @@ namespace swig { args.id = op_id; args.nargs = 1; args.target = VALUE(other); - ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args), - (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil); + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); } if (ret == Qnil) { - VALUE a = rb_funcall( _obj, hash_id, 0 ); - VALUE b = rb_funcall( VALUE(other), hash_id, 0 ); + VALUE a = rb_funcall2( _obj, hash_id, 0, 0 ); + VALUE b = rb_funcall2( VALUE(other), hash_id, 0, 0 ); res = op_func(a, b); } else { res = RTEST(ret); @@ -243,8 +243,8 @@ namespace swig { args.id = op_id; args.nargs = 0; args.target = Qnil; - ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args), - (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil); + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); SWIG_RUBY_THREAD_END_BLOCK; return ret; } @@ -262,8 +262,8 @@ namespace swig { args.id = op_id; args.nargs = 1; args.target = VALUE(other); - ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args), - (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil); + ret = rb_rescue(VALUEFUNC(swig_rescue_funcall), VALUE(&args), + (VALUEFUNC(swig_rescue_swallow)), Qnil); SWIG_RUBY_THREAD_END_BLOCK; return GC_VALUE(ret); } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubycomplex.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubycomplex.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubycomplex.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubycomplex.swg index 4e249c71..5d5d9bc7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubycomplex.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubycomplex.swg @@ -36,12 +36,12 @@ SWIGINTERN int SWIG_Is_Complex( VALUE obj ) { SWIGINTERN VALUE SWIG_Complex_Real(VALUE obj) { static ID real_id = rb_intern("real"); - return rb_funcall(obj, real_id, 0); + return rb_funcall2(obj, real_id, 0, 0); } SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) { static ID imag_id = rb_intern("imag"); - return rb_funcall(obj, imag_id, 0); + return rb_funcall2(obj, imag_id, 0, 0); } } @@ -56,7 +56,11 @@ SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) { %fragment(SWIG_From_frag(Type),"header",fragment="rb_complex_new") { SWIGINTERNINLINE VALUE -SWIG_From(Type)(%ifcplusplus(const Type&, Type) c) +#if defined(__cplusplus) +SWIG_From_dec(Type)(const Type& c) +#else +SWIG_From_dec(Type)(Type c) +#endif { VALUE re = rb_float_new(Real(c)); VALUE im = rb_float_new(Imag(c)); @@ -127,7 +131,7 @@ SWIG_AsVal(Type)(VALUE o, Type *val) float re; int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); if (SWIG_IsOK(res)) { - if (val) *val = Constructor(re, 0.0); + if (val) *val = Constructor(re, 0.0f); return res; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubycontainer.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubycontainer.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubycontainer.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubycontainer.swg index e8830a71..468d4a4b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubycontainer.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubycontainer.swg @@ -101,7 +101,7 @@ namespace swig { inline Sequence* getslice(const Sequence* self, Difference i, Difference j) { typename Sequence::size_type size = self->size(); - typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size)); + typename Sequence::size_type ii = swig::check_index(i, size, (i == (Difference)size && j == (Difference)size)); typename Sequence::size_type jj = swig::slice_index(j, size); if (jj > ii) { @@ -117,25 +117,29 @@ namespace swig { template inline void - setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) { + setslice(Sequence* self, Difference i, Difference j, const InputSeq& is) { typename Sequence::size_type size = self->size(); typename Sequence::size_type ii = swig::check_index(i, size, true); typename Sequence::size_type jj = swig::slice_index(j, size); if (jj < ii) jj = ii; size_t ssize = jj - ii; - if (ssize <= v.size()) { + if (ssize <= is.size()) { + // expanding/staying the same size typename Sequence::iterator sb = self->begin(); - typename InputSeq::const_iterator vmid = v.begin(); + typename InputSeq::const_iterator vmid = is.begin(); std::advance(sb,ii); std::advance(vmid, jj - ii); - self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end()); + self->insert(std::copy(is.begin(), vmid, sb), vmid, is.end()); } else { + // shrinking typename Sequence::iterator sb = self->begin(); typename Sequence::iterator se = self->begin(); std::advance(sb,ii); std::advance(se,jj); self->erase(sb,se); - self->insert(sb, v.begin(), v.end()); + sb = self->begin(); + std::advance(sb,ii); + self->insert(sb, is.begin(), is.end()); } } @@ -186,7 +190,7 @@ namespace swig return swig::as(item); } catch (const std::invalid_argument& e) { char msg[1024]; - sprintf(msg, "in sequence element %d ", _index); + SWIG_snprintf(msg, sizeof(msg), "in sequence element %d ", _index); VALUE lastErr = rb_gv_get("$!"); if ( lastErr == Qnil ) { %type_error(swig::type_name()); @@ -338,7 +342,7 @@ namespace swig typedef T value_type; typedef T* pointer; typedef int difference_type; - typedef int size_type; + typedef std::size_t size_type; typedef const pointer const_pointer; typedef RubySequence_InputIterator iterator; typedef RubySequence_InputIterator const_iterator; @@ -395,19 +399,13 @@ namespace swig return const_reference(_seq, n); } - bool check(bool set_err = false) const + bool check() const { int s = (int) size(); for (int i = 0; i < s; ++i) { VALUE item = rb_ary_entry(_seq, i ); - if (!swig::check(item)) { - if (set_err) { - char msg[1024]; - sprintf(msg, "in sequence element %d", i); - SWIG_Error(SWIG_RuntimeError, msg); - } + if (!swig::check(item)) return false; - } } return true; } @@ -634,7 +632,7 @@ namespace swig try { r = swig::from< const Sequence* >( swig::getslice(self, i, j) ); } - catch( std::out_of_range ) { + catch( const std::out_of_range& ) { } return r; } @@ -680,7 +678,7 @@ namespace swig { VALUE v = swig::from< Sequence::value_type >(*i); if ( RTEST( rb_yield(v) ) ) - $self->insert( r->end(), *i); + r->insert( r->end(), *i); } return r; @@ -693,9 +691,8 @@ namespace swig r = swig::from< Sequence::value_type >( *(at) ); $self->erase(at); } - catch (std::out_of_range) - { - } + catch (const std::out_of_range&) { + } return r; } } @@ -763,7 +760,7 @@ namespace swig try { r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) ); } - catch( std::out_of_range ) { + catch( const std::out_of_range& ) { } return r; } @@ -786,7 +783,7 @@ namespace swig try { r = swig::from< const Sequence* >( swig::getslice(self, i, j) ); } - catch( std::out_of_range ) { + catch( const std::out_of_range& ) { } return r; } @@ -796,7 +793,7 @@ namespace swig try { r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) ); } - catch( std::out_of_range ) { + catch( const std::out_of_range& ) { } return r; } @@ -810,9 +807,9 @@ namespace swig static ID id_start = rb_intern("begin"); static ID id_noend = rb_intern("exclude_end?"); - VALUE start = rb_funcall( i, id_start, 0 ); - VALUE end = rb_funcall( i, id_end, 0 ); - bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue ); + VALUE start = rb_funcall2( i, id_start, 0, 0 ); + VALUE end = rb_funcall2( i, id_end, 0, 0 ); + bool noend = ( rb_funcall2( i, id_noend, 0, 0 ) == Qtrue ); int len = $self->size(); @@ -844,7 +841,7 @@ namespace swig return swig::from< Sequence::value_type >( x ); } - VALUE __setitem__(difference_type i, difference_type length, const Sequence& v) throw (std::invalid_argument) { + VALUE __setitem__(difference_type i, difference_type length, const Sequence& is) throw (std::invalid_argument) { if ( length < 0 ) return Qnil; @@ -856,13 +853,13 @@ namespace swig i = len + i; } Sequence::difference_type j = length + i; - if ( j > static_cast(len) ) { - swig::resize( $self, j, *(v.begin()) ); + if ( j > static_cast(len) && is.size() > 0 ) { + swig::resize( $self, j, *(is.begin()) ); } VALUE r = Qnil; - swig::setslice($self, i, j, v); - r = swig::from< const Sequence* >( &v ); + swig::setslice($self, i, j, is); + r = swig::from< const Sequence* >( &is ); return r; } } @@ -1023,7 +1020,7 @@ namespace swig { } else { return rubyseq.check() ? SWIG_OK : SWIG_ERROR; } - } catch (std::exception& e) { + } catch (const std::exception& e) { if (seq) { VALUE lastErr = rb_gv_get("$!"); if (lastErr == Qnil) { @@ -1063,7 +1060,7 @@ namespace swig { } else { return true; } - } catch (std::exception& e) { + } catch (const std::exception& e) { if (seq) { VALUE lastErr = rb_gv_get("$!"); if (lastErr == Qnil) { diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubycontainer_extended.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubycontainer_extended.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubycontainer_extended.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubycontainer_extended.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubydef.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubydef.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubydef.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubydef.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyerrors.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyerrors.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyerrors.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyerrors.swg index 434544bc..82cc141b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyerrors.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyerrors.swg @@ -8,15 +8,12 @@ /* Define custom exceptions for errors that do not map to existing Ruby - exceptions. Note this only works for C++ since a global cannot be - initialized by a function in C. For C, fallback to rb_eRuntimeError.*/ + exceptions. */ SWIGINTERN VALUE getNullReferenceError(void) { - static int init = 0; - static VALUE rb_eNullReferenceError ; - if (!init) { - init = 1; + static VALUE rb_eNullReferenceError = Qnil; + if (rb_eNullReferenceError == Qnil) { rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError); } return rb_eNullReferenceError; @@ -24,10 +21,8 @@ getNullReferenceError(void) { SWIGINTERN VALUE getObjectPreviouslyDeletedError(void) { - static int init = 0; - static VALUE rb_eObjectPreviouslyDeleted ; - if (!init) { - init = 1; + static VALUE rb_eObjectPreviouslyDeleted = Qnil; + if (rb_eObjectPreviouslyDeleted == Qnil) { rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError); } return rb_eObjectPreviouslyDeleted; @@ -110,7 +105,7 @@ const char* Ruby_Format_TypeError( const char* msg, } str = rb_str_cat2( str, "Expected argument " ); - sprintf( buf, "%d of type ", argn-1 ); + SWIG_snprintf( buf, sizeof( buf), "%d of type ", argn-1 ); str = rb_str_cat2( str, buf ); str = rb_str_cat2( str, type ); str = rb_str_cat2( str, ", but got " ); diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyfragments.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyfragments.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyhead.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyhead.swg similarity index 60% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyhead.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyhead.swg index 90f07cf6..39196d4e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyhead.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyhead.swg @@ -1,4 +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 +#include /* For RUBY_API_VERSION_CODE */ + +#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 @@ -98,38 +116,46 @@ /* - * Need to be very careful about how these macros are defined, especially - * when compiling C++ code or C code with an ANSI C compiler. + * The following macros are used for providing the correct type of a + * function pointer to the Ruby C API. * - * VALUEFUNC(f) is a macro used to typecast a C function that implements - * a Ruby method so that it can be passed as an argument to API functions - * like rb_define_method() and rb_define_singleton_method(). + * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving + * moving away from ANYARGS and instead employing strict function signatures. * - * VOIDFUNC(f) is a macro used to typecast a C function that implements - * either the "mark" or "free" stuff for a Ruby Data object, so that it - * can be passed as an argument to API functions like Data_Wrap_Struct() + * Note: In case of C (not C++) the macros are transparent even before + * Ruby 2.7 due to the fact that the Ruby C API used function declarators + * with empty parentheses, which allows for an unspecified number of + * arguments. + * + * PROTECTFUNC(f) is used for the function pointer argument of the Ruby + * C API function rb_protect(). + * + * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API + * functions like rb_define_method() and rb_define_singleton_method(). + * + * VOIDFUNC(f) is used to typecast a C function that implements either + * the "mark" or "free" stuff for a Ruby Data object, so that it can be + * passed as an argument to Ruby C API functions like Data_Wrap_Struct() * and Data_Make_Struct(). + * + * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like rb_define_virtual_variable(). + * + * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like st_foreach(). */ - -#ifdef __cplusplus -# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((void (*)()) f) -# else -# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# else /* These definitions should work for Ruby 1.7+ */ -# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) -# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# endif -# endif +#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700 +# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) +# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) +# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f)) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f)) #else +# define PROTECTFUNC(f) (f) # define VALUEFUNC(f) (f) # define VOIDFUNC(f) (f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f) #endif /* Don't use for expressions have side effect */ diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyinit.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyinit.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyinit.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyinit.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyiterators.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyiterators.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyiterators.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyiterators.swg index 89fea452..05d14698 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyiterators.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyiterators.swg @@ -173,12 +173,7 @@ namespace swig { } static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::ConstIterator *"); - init = 1; - } + static swig_type_info *desc = SWIG_TypeQuery("swig::ConstIterator *"); return desc; } }; @@ -204,12 +199,7 @@ namespace swig { public: static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::Iterator *"); - init = 1; - } + static swig_type_info *desc = SWIG_TypeQuery("swig::Iterator *"); return desc; } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubykw.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubykw.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubykw.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubykw.swg index 194687b9..6b4685eb 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubykw.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubykw.swg @@ -2,7 +2,7 @@ #define RUBY_RUBYKW_SWG_ /* Warnings for Ruby keywords */ -#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword, renaming to 'C_" `x` "'",rename="C_%s",fullname=1) `x` +#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword",rename="C_%s",fullname=1) `x` /* diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubymacros.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubymacros.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubymacros.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubymacros.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyopers.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyopers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyopers.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyopers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyprimtypes.swg similarity index 69% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyprimtypes.swg index 3a848191..c04a6fc7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyprimtypes.swg @@ -10,24 +10,12 @@ %fragment("SWIG_ruby_failed","header") { SWIGINTERN VALUE -SWIG_ruby_failed(void) +SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2)) { return Qnil; } } -%define %ruby_aux_method(Type, Method, Action) -SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE *args) -{ - VALUE obj = args[0]; - VALUE type = TYPE(obj); - Type *res = (Type *)(args[1]); - *res = Action; - return obj; -} -%enddef - - /* boolean */ %fragment(SWIG_From_frag(bool),"header") { @@ -68,7 +56,15 @@ SWIG_AsVal_dec(bool)(VALUE obj, bool *val) } %fragment(SWIG_AsVal_frag(long),"header",fragment="SWIG_ruby_failed") { -%ruby_aux_method(long, NUM2LONG, type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj)) +SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long *res = (long *)(args[1]); + *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj); + return obj; +} SWIGINTERN int SWIG_AsVal_dec(long)(VALUE obj, long* val) @@ -79,7 +75,7 @@ SWIG_AsVal_dec(long)(VALUE obj, long* val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } @@ -100,7 +96,15 @@ SWIG_From_dec(unsigned long)(unsigned long value) } %fragment(SWIG_AsVal_frag(unsigned long),"header",fragment="SWIG_ruby_failed") { -%ruby_aux_method(unsigned long, NUM2ULONG, type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj)) +SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + unsigned long *res = (unsigned long *)(args[1]); + *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj); + return obj; +} SWIGINTERN int SWIG_AsVal_dec(unsigned long)(VALUE obj, unsigned long *val) @@ -111,7 +115,9 @@ SWIG_AsVal_dec(unsigned long)(VALUE obj, unsigned long *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse) + return SWIG_OverflowError; if (val) *val = v; return SWIG_OK; } @@ -138,7 +144,15 @@ SWIG_From_dec(long long)(long long value) fragment="SWIG_ruby_failed", fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE -%ruby_aux_method(long long, NUM2LL, type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj)) +SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long long *res = (long long *)(args[1]); + *res = type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj); + return obj; +} SWIGINTERN int SWIG_AsVal_dec(long long)(VALUE obj, long long *val) @@ -149,7 +163,7 @@ SWIG_AsVal_dec(long long)(VALUE obj, long long *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } @@ -176,7 +190,15 @@ SWIG_From_dec(unsigned long long)(unsigned long long value) fragment="SWIG_ruby_failed", fragment="SWIG_LongLongAvailable") { %#ifdef SWIG_LONG_LONG_AVAILABLE -%ruby_aux_method(long long, NUM2ULL, type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj)) +SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long long *res = (long long *)(args[1]); + *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj); + return obj; +} SWIGINTERN int SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val) @@ -187,7 +209,9 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse) + return SWIG_OverflowError; if (val) *val = v; return SWIG_OK; } @@ -204,7 +228,15 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val) } %fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") { -%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj); (void)type) +SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + double *res = (double *)(args[1]); + *res = NUM2DBL(obj); (void)type; + return obj; +} SWIGINTERN int SWIG_AsVal_dec(double)(VALUE obj, double *val) @@ -215,7 +247,7 @@ SWIG_AsVal_dec(double)(VALUE obj, double *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyrun.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyrun.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyrun.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyrun.swg index 4b2ffe4b..d470f893 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyrun.swg @@ -80,6 +80,7 @@ static VALUE swig_runtime_data_type_pointer = Qnil; /* Global IDs used to keep some internal SWIG stuff */ static ID swig_arity_id = 0; static ID swig_call_id = 0; +static ID swig_lowerthan_id = 0; /* If your swig extension is to be run within an embedded ruby and has @@ -113,10 +114,8 @@ static ID swig_call_id = 0; SWIGRUNTIME VALUE getExceptionClass(void) { - static int init = 0; - static VALUE rubyExceptionClass ; - if (!init) { - init = 1; + static VALUE rubyExceptionClass = Qnil; + if (rubyExceptionClass == Qnil) { rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); } return rubyExceptionClass; @@ -131,7 +130,7 @@ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { VALUE exceptionClass = getExceptionClass(); if (rb_obj_is_kind_of(obj, exceptionClass)) { return obj; - } else { + } else { return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); } } @@ -144,6 +143,7 @@ SWIG_Ruby_InitRuntime(void) _mSWIG = rb_define_module("SWIG"); swig_call_id = rb_intern("call"); swig_arity_id = rb_intern("arity"); + swig_lowerthan_id = rb_intern("<"); } } @@ -151,13 +151,14 @@ SWIG_Ruby_InitRuntime(void) SWIGRUNTIME void SWIG_Ruby_define_class(swig_type_info *type) { - char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); + size_t klass_len = 4 + strlen(type->name) + 1; + char *klass_name = (char *) malloc(klass_len); + SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name); if (NIL_P(_cSWIG_Pointer)) { _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer)); free((void *) klass_name); } @@ -208,8 +209,9 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) SWIG_RubyAddTracking(ptr, obj); } } else { - klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); + size_t klass_len = 4 + strlen(type->name) + 1; + klass_name = (char *) malloc(klass_len); + SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name); klass = rb_const_get(_mSWIG, rb_intern(klass_name)); free((void *) klass_name); obj = Data_Wrap_Struct(klass, 0, 0, ptr); @@ -235,6 +237,8 @@ SWIGRUNTIMEINLINE char * SWIG_Ruby_MangleStr(VALUE obj) { VALUE stype = rb_iv_get(obj, "@__swigtype__"); + if (NIL_P(stype)) + return NULL; return StringValuePtr(stype); } @@ -279,6 +283,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 @@ -290,7 +299,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 @@ -304,6 +313,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) { @@ -411,6 +424,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); @@ -441,7 +455,7 @@ int SWIG_Ruby_arity( VALUE proc, int minimal ) { if ( rb_respond_to( proc, swig_arity_id ) ) { - VALUE num = rb_funcall( proc, swig_arity_id, 0 ); + VALUE num = rb_funcall2( proc, swig_arity_id, 0, 0 ); int arity = NUM2INT(num); if ( arity < 0 && (arity+1) < -minimal ) return 1; if ( arity == minimal ) return 1; diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyruntime.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyruntime.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyruntime.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubystdautodoc.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubystdautodoc.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubystdautodoc.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubystdautodoc.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubystdcommon.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubystdcommon.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubystdcommon.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubystdcommon.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubystdcommon_forward.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubystdcommon_forward.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubystdcommon_forward.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubystdcommon_forward.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubystdfunctors.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubystdfunctors.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubystdfunctors.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubystdfunctors.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubystrings.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubystrings.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubystrings.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubystrings.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubytracking.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubytracking.swg similarity index 88% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubytracking.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubytracking.swg index b9fb249d..1edcc568 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubytracking.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubytracking.swg @@ -32,7 +32,7 @@ extern "C" { */ static st_table* swig_ruby_trackings = NULL; -static VALUE swig_ruby_trackings_count(ANYARGS) { +static VALUE swig_ruby_trackings_count(ID id, VALUE *var) { return SWIG2NUM(swig_ruby_trackings->num_entries); } @@ -69,7 +69,9 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value); } - rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL); + rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", + VALUEFUNC(swig_ruby_trackings_count), + SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL)); } /* Add a Tracking from a C/C++ struct to a Ruby object */ @@ -118,13 +120,15 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { to the passed callback function. */ /* Proxy method to abstract the internal trackings datatype */ -static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) { - (*meth)(ptr, obj); +static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) { + ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj); return ST_CONTINUE; } SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) { - st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth); + st_foreach(swig_ruby_trackings, + SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback), + (st_data_t)meth); } #ifdef __cplusplus diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubytypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubytypemaps.swg similarity index 92% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubytypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubytypemaps.swg index 3837df07..4a6a71bb 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/rubytypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/rubytypemaps.swg @@ -20,11 +20,6 @@ /* Ruby fragments for char* strings */ %include -/* Backward compatibility output helper */ -%fragment("output_helper","header") %{ -#define output_helper SWIG_Ruby_AppendOutput -%} - /* ------------------------------------------------------------ * Unified typemap section * ------------------------------------------------------------ */ @@ -42,7 +37,7 @@ /* Overload of the output/constant/exception handling */ /* append output */ -#define SWIG_AppendOutput(result,obj) SWIG_Ruby_AppendOutput(result, obj) +#define SWIG_AppendOutput(result,obj) SWIG_Ruby_AppendOutput(result, obj, $isvoid) /* set constant */ #define SWIG_SetConstant(name, obj) rb_define_const($module, name, obj) diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubyuserdir.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubyuserdir.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubyuserdir.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubyuserdir.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/rubywstrings.swg b/macx64/bin/swig/share/swig/4.3.0/ruby/rubywstrings.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/rubywstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/ruby/rubywstrings.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_array.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_array.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_array.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_array.i index a4d3ef54..c00685f2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_array.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_array.i @@ -41,7 +41,7 @@ getslice(const std::array* self, Difference i, Difference j) { typedef std::array Sequence; typename Sequence::size_type size = self->size(); - typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size)); + typename Sequence::size_type ii = swig::check_index(i, size, (i == (Difference)size && j == (Difference)size)); typename Sequence::size_type jj = swig::slice_index(j, size); if (ii == 0 && jj == size) { diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_auto_ptr.i new file mode 100644 index 00000000..3d7ae8ba --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/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/macx64/bin/swig/share/swig/4.0.0/ruby/std_basic_string.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_basic_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_basic_string.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_basic_string.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_char_traits.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_char_traits.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_char_traits.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_char_traits.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_common.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_complex.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_complex.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_complex.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_complex.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_container.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_container.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_except.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_functors.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_functors.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_functors.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_functors.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_ios.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_ios.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_ios.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_ios.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_iostream.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_iostream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_iostream.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_iostream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_list.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_map.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_map.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_map.i index 7077fa10..2da1ada5 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_map.i @@ -96,7 +96,7 @@ int res = SWIG_ERROR; if ( TYPE(obj) == T_HASH ) { static ID id_to_a = rb_intern("to_a"); - VALUE items = rb_funcall(obj, id_to_a, 0); + VALUE items = rb_funcall2(obj, id_to_a, 0, 0); res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { map_type *p; @@ -214,7 +214,7 @@ VALUE k = swig::from(i->first); VALUE v = swig::from(i->second); if ( RTEST( rb_yield_values(2, k, v) ) ) - $self->insert(r->end(), *i); + r->insert(r->end(), *i); } return r; @@ -344,7 +344,11 @@ } void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } VALUE inspect() diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_multimap.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_multimap.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_multimap.i index 762a8765..5d8e33e9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_multimap.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_multimap.i @@ -23,7 +23,7 @@ int res = SWIG_ERROR; if ( TYPE(obj) == T_HASH ) { static ID id_to_a = rb_intern("to_a"); - VALUE items = rb_funcall(obj, id_to_a, 0); + VALUE items = rb_funcall2(obj, id_to_a, 0, 0); return traits_asptr_stdseq, std::pair >::asptr(items, val); } else { multimap_type *p; diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_multiset.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_multiset.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_multiset.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_queue.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_queue.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_queue.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_queue.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_set.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_set.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_set.i index e38702ef..1b425c6b 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_set.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/ruby/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_shared_ptr.i similarity index 82% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_shared_ptr.i index dee35ec0..086e3081 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_shared_ptr.i @@ -13,24 +13,27 @@ namespace swig { template struct traits_asptr > { static int asptr(VALUE obj, std::shared_ptr **val) { - std::shared_ptr *p = 0; + int res = SWIG_ERROR; swig_type_info *descriptor = type_info >(); - swig_ruby_owntype newmem = {0, 0}; - int res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR; - if (SWIG_IsOK(res)) { - if (val) { - if (*val) { - **val = p ? *p : std::shared_ptr(); - } else { - *val = p; - if (newmem.own & SWIG_CAST_NEW_MEMORY) { - // Upcast for pointers to shared_ptr in this generic framework has not been implemented - res = SWIG_ERROR; - } - } - } - if (newmem.own & SWIG_CAST_NEW_MEMORY) - delete p; + if (val) { + std::shared_ptr *p = 0; + swig_ruby_owntype newmem = {0, 0}; + res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR; + if (SWIG_IsOK(res)) { + if (*val) { + **val = p ? *p : std::shared_ptr(); + } else { + *val = p; + if (newmem.own & SWIG_CAST_NEW_MEMORY) { + // Upcast for pointers to shared_ptr in this generic framework has not been implemented + res = SWIG_ERROR; + } + } + if (newmem.own & SWIG_CAST_NEW_MEMORY) + delete p; + } + } else { + res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR; } return res; } diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_sstream.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_sstream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_sstream.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_sstream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_stack.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_stack.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_stack.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_stack.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_streambuf.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_streambuf.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_streambuf.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_streambuf.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_string.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_string_view.i new file mode 100644 index 00000000..cbfc4289 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_string_view.i @@ -0,0 +1,6 @@ + +%warnfilter(SWIGWARN_RUBY_WRONG_NAME) std::basic_string_view; + +AUTODOC(substr, "Return a portion of the String"); + +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unique_ptr.i new file mode 100644 index 00000000..e3669bb4 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + %set_output(SWIG_NewPointerObj($1->get(), $descriptor(TYPE *), $owner | %newpointer_flags)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_map.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_map.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_map.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_map.i index 48c87521..3c6b6502 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_map.i @@ -23,7 +23,7 @@ int res = SWIG_ERROR; if (TYPE(obj) == T_HASH) { static ID id_to_a = rb_intern("to_a"); - VALUE items = rb_funcall(obj, id_to_a, 0); + VALUE items = rb_funcall2(obj, id_to_a, 0, 0); res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { map_type *p; diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_multimap.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_multimap.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_multimap.i index ebc53b59..c3261f9e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_multimap.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_multimap.i @@ -23,7 +23,7 @@ int res = SWIG_ERROR; if ( TYPE(obj) == T_HASH ) { static ID id_to_a = rb_intern("to_a"); - VALUE items = rb_funcall(obj, id_to_a, 0); + VALUE items = rb_funcall2(obj, id_to_a, 0, 0); return traits_asptr_stdseq, std::pair >::asptr(items, val); } else { multimap_type *p; diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_multiset.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_multiset.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_multiset.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_set.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_set.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_unordered_set.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_unordered_set.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_vectora.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_vectora.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_vectora.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_vectora.i diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/ruby/std_wstring.i similarity index 78% rename from macx64/bin/swig/share/swig/4.0.0/ruby/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/std_wstring.i index 2b633438..c5d168a0 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/std_wstring.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/std_wstring.i @@ -1,4 +1,15 @@ %{ +#if defined(__linux__) +#include +#if BYTE_ORDER == LITTLE_ENDIAN +#define SWIG_RUBY_ENDIAN "LE" +#elif BYTE_ORDER == BIG_ENDIAN +#define SWIG_RUBY_ENDIAN "BE" +#endif +#else +#define SWIG_RUBY_ENDIAN "LE" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -15,9 +26,9 @@ extern "C" { #ifndef SWIG_RUBY_WSTRING_ENCODING #if WCHAR_MAX == 0x7fff || WCHAR_MAX == 0xffff -#define SWIG_RUBY_WSTRING_ENCODING "UTF-16LE" +#define SWIG_RUBY_WSTRING_ENCODING "UTF-16" SWIG_RUBY_ENDIAN #elif WCHAR_MAX == 0x7fffffff || WCHAR_MAX == 0xffffffff -#define SWIG_RUBY_WSTRING_ENCODING "UTF-32LE" +#define SWIG_RUBY_WSTRING_ENCODING "UTF-32" SWIG_RUBY_ENDIAN #else #error unsupported wchar_t size. SWIG_RUBY_WSTRING_ENCODING must be given. #endif diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/stl.i b/macx64/bin/swig/share/swig/4.3.0/ruby/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/ruby/stl.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/ruby/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/ruby/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/timeval.i b/macx64/bin/swig/share/swig/4.3.0/ruby/timeval.i similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/ruby/timeval.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/timeval.i index e7bc2d32..94a75c80 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/timeval.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/timeval.i @@ -55,7 +55,7 @@ struct timeval rb_time_timeval(VALUE); if (NIL_P($input)) $1 = (time_t)-1; else - $1 = NUM2LONG(rb_funcall($input, rb_intern("tv_sec"), 0)); + $1 = NUM2LONG(rb_funcall2($input, rb_intern("tv_sec"), 0, 0)); } %typemap(typecheck) time_t diff --git a/macx64/bin/swig/share/swig/4.0.0/ruby/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/ruby/typemaps.i similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/ruby/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/ruby/typemaps.i index c4db8216..a3eaa0c1 100644 --- a/macx64/bin/swig/share/swig/4.0.0/ruby/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/ruby/typemaps.i @@ -119,7 +119,7 @@ multiple output values, they are returned in the form of a Ruby Array. For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and -returns the integer part in one of its parameters).K: +returns the integer part in one of its parameters) : double modf(double x, double *ip); @@ -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); @@ -214,10 +214,6 @@ to a Ruby variable you might do this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ %typemap(in) int *INOUT = int *INPUT; diff --git a/macx64/bin/swig/share/swig/4.0.0/runtime.swg b/macx64/bin/swig/share/swig/4.3.0/runtime.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/runtime.swg rename to macx64/bin/swig/share/swig/4.3.0/runtime.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/scilab/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/scilab/argcargv.i new file mode 100644 index 00000000..9aeda1a7 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/argcargv.i @@ -0,0 +1,109 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%{ +SWIGINTERN int SWIG_AsVal_strings (SwigSciObject iVar, int **array, int report) { + int iType = 0; + SciErr sciErr = getVarAddressFromPosition(pvApiCtx, iVar, array); + if (sciErr.iErr) { + if (report) printError(&sciErr, 0); + return SWIG_ERROR; + } + sciErr = getVarType(pvApiCtx, *array, &iType); + if (sciErr.iErr) { + if (report) printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iType != sci_strings) { + /* An empty matrix has type sci_matrix. */ + if (!isEmptyMatrix(pvApiCtx, *array)) { + return SWIG_TypeError; + } + *array = SWIG_NULLPTR; + } + return SWIG_OK; +} +%} + +%typemap(in) (int ARGC, char **ARGV) { + SciErr sciErr; + size_t memsize; + int i, rows, cols, res, len, *aLen, *array; + res = SWIG_AsVal_strings ($input, &array, 1); + if (!SWIG_IsOK(res)) { + if (res == SWIG_TypeError) { + SWIG_exception_fail(SWIG_TypeError, "not a string matrix"); + } + SWIG_fail; + } + + if (array == SWIG_NULLPTR) { + /* Special case for empty matrix. */ + $1 = 0; + $2 = ($2_ltype) malloc(sizeof($*2_ltype)); + $2[0] = SWIG_NULLPTR; + } else { + /* first call to retrieve dimensions */ + rows = 0; + cols = 0; + sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, SWIG_NULLPTR, SWIG_NULLPTR); + if (sciErr.iErr) { + printError(&sciErr, 0); + SWIG_fail; + } + len = rows * cols; + memsize = sizeof(int) * len; + aLen = (int*)malloc(memsize); + if (aLen == SWIG_NULLPTR) { + SWIG_exception_fail(SWIG_MemoryError, "fail allocate sizes array"); + } + memset(aLen, 0, memsize); + /*second call to retrieve length of each string */ + sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, SWIG_NULLPTR); + if (sciErr.iErr) { + printError(&sciErr, 0); + free((void *)aLen); + SWIG_fail; + } + memsize = sizeof($*2_ltype) * (len + 1); + $1 = ($1_ltype) len; + $2 = ($2_ltype) malloc(memsize); + if ($2 == SWIG_NULLPTR) { + free((void *)aLen); + SWIG_exception_fail(SWIG_MemoryError, "fail allocate array"); + } + memset($2, 0, memsize); + for(i = 0 ; i < len ; i++) { + $2[i] = ($*2_ltype)malloc(aLen[i] + 1); + if ($2[i] == SWIG_NULLPTR) { + free((void *)aLen); + SWIG_exception_fail(SWIG_MemoryError, "fail allocate array string element"); + } + } + /* third call to retrieve data */ + sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, $2); + if(sciErr.iErr) { + printError(&sciErr, 0); + free((void *)aLen); + SWIG_fail; + } + $2[len] = SWIG_NULLPTR; + free((void *)aLen); + } +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + int *array; + $1 = SWIG_IsOK(SWIG_AsVal_strings ($input, &array, 0)); +} + +%typemap(freearg) (int ARGC, char **ARGV) { + if ($2 != SWIG_NULLPTR) { + $1_ltype i; + for (i = 0; i < $1; i++) { + free((void *)$2[i]); + } + free((void *)$2); + } +} diff --git a/macx64/bin/swig/share/swig/4.0.0/octave/boost_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/scilab/boost_shared_ptr.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/octave/boost_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/boost_shared_ptr.i index 668bf435..87c89b5f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/octave/boost_shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/scilab/carrays.i b/macx64/bin/swig/share/swig/4.3.0/scilab/carrays.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/carrays.i diff --git a/macx64/bin/swig/share/swig/4.3.0/scilab/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/scilab/cmalloc.i new file mode 100644 index 00000000..248f06b9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/cmalloc.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/scilab/cpointer.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/cpointer.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/exception.i b/macx64/bin/swig/share/swig/4.3.0/scilab/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/exception.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/exception.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/matrix.i b/macx64/bin/swig/share/swig/4.3.0/scilab/matrix.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/matrix.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/matrix.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciarray.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciarray.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciarray.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciarray.swg index c00e3837..97b30a29 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/sciarray.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/sciarray.swg @@ -40,8 +40,8 @@ } else { char errmsg[100]; - sprintf(errmsg, "Size of input data (%d) is too big (maximum is %d)", - iRows*iCols, $1_dim0); + SWIG_snprintf2(errmsg, sizeof(errmsg), "Size of input data (%d) is too big (maximum is %d)", + iRows*iCols, $1_dim0); SWIG_exception_fail(SWIG_OverflowError, errmsg); } } diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scibool.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scibool.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scibool.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scibool.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scichar.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scichar.swg similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scichar.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scichar.swg index 5edbf5b7..e56d5186 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scichar.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scichar.swg @@ -148,7 +148,8 @@ SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t } if (piLength != NULL) { - *piLength = strlen(pstString); + /* Add the null termination */ + *piLength = iLen + 1; } return SWIG_OK; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scicontainer.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scicontainer.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scicontainer.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scicontainer.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scidouble.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scidouble.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scidouble.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scidouble.swg index 1b826330..e14c8464 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scidouble.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scidouble.swg @@ -56,6 +56,7 @@ SWIG_SciDouble_FromDouble(void *pvApiCtx, int iVarOut, double dblValue, char *fn SWIGINTERN int SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, double **pdValue, char *fname) { SciErr sciErr; + int iType = 0; int *piAddrVar = NULL; sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); @@ -64,13 +65,24 @@ SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *i return SWIG_ERROR; } - if (isDoubleType(pvApiCtx, piAddrVar) && !isVarComplex(pvApiCtx, piAddrVar)) { + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix && !isVarComplex(pvApiCtx, piAddrVar)) { sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, pdValue); if (sciErr.iErr) { printError(&sciErr, 0); return SWIG_ERROR; } } + else if (iType == sci_implicit_poly) { + *iRows = -1; + *iCols = 0; + *pdValue = NULL; + } else { Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), fname, iVar); return SWIG_ERROR; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scienum.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scienum.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scienum.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scienum.swg index 54ec1f85..cc1f7c97 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scienum.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scienum.swg @@ -18,7 +18,7 @@ SWIG_Int_AsEnum(void *pvApiCtx, int iVar, int *enumValue, char *fname) { } %fragment(SWIG_From_frag(Enum), "header", fragment="SWIG_Int_FromEnum") { -%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), (int)scilabValue, SWIG_Scilab_GetFuncName()) } %fragment("SWIG_Int_FromEnum", "header", fragment="SWIG_SciDouble_FromInt") { SWIGINTERN int diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciexception.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciexception.swg similarity index 90% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciexception.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciexception.swg index 1d653b31..9b842cf2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/sciexception.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/sciexception.swg @@ -17,20 +17,20 @@ size_t, size_t&, ptrdiff_t, ptrdiff_t& { char obj[20]; - sprintf(obj, "%d", (int)$1); + SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1); SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); } %typemap(throws, noblock=1) enum SWIGTYPE { char obj[20]; - sprintf(obj, "%d", (int)$1); + SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1); SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); } %typemap(throws, noblock=1) float, double, float&, double& { char obj[20]; - sprintf(obj, "%5.3f", (double)$1); + SWIG_snprintf(obj, sizeof(obj), "%5.3f", (double)$1); SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); } @@ -44,7 +44,8 @@ %typemap(throws, noblock=1) char, char& { char obj[2]; - sprintf(obj, "%c", (char)$1); + obj[0] = (char)$1; + obj[1] = 0; SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); } diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scifloat.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scifloat.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scifloat.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scifloat.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciint.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciint.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciint.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciint.swg index 2d699356..b7b2563e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/sciint.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/sciint.swg @@ -157,6 +157,11 @@ SWIG_SciDoubleOrInt32_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, in return SWIG_ERROR; } } + else if (iType == sci_implicit_poly) { + *iRows = -1; + *iCols = 0; + *piValue = NULL; + } else { Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double matrix expected.\n"), fname, iVar); return SWIG_ERROR; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciiterators.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciiterators.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciiterators.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciiterators.swg index 69cb04be..e9e9e751 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/sciiterators.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/sciiterators.swg @@ -101,12 +101,7 @@ namespace swig { } static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::SciSwigIterator *"); - init = 1; - } + static swig_type_info *desc = SWIG_TypeQuery("swig::SciSwigIterator *"); return desc; } }; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scilab.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scilab.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scilab.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scilab.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scilist.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scilist.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scilist.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scilist.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scilong.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scilong.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scilong.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scilong.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scilonglong.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scilonglong.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scilonglong.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scilonglong.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimacros.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimacros.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimacros.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimacros.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixbool.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixbool.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixbool.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixbool.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixchar.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixchar.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixchar.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixchar.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixdouble.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixdouble.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixdouble.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixdouble.swg index 9444a807..bb9403ed 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixdouble.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixdouble.swg @@ -28,7 +28,11 @@ %typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE) (int rowCount, int colCount) { if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { - $2 = rowCount * colCount; + if (rowCount < 0) { + $2 = rowCount; + } else { + $2 = rowCount * colCount; + } } else { return SWIG_ERROR; @@ -40,7 +44,11 @@ %typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN) (int rowCount, int colCount) { if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { - $1 = rowCount * colCount; + if (rowCount < 0) { + $1 = rowCount; + } else { + $1 = rowCount * colCount; + } } else { return SWIG_ERROR; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixint.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixint.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixint.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixint.swg index e304d4f6..05771072 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scimatrixint.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scimatrixint.swg @@ -30,7 +30,11 @@ %typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE) (int rowCount, int colCount) { if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { - $2 = rowCount * colCount; + if (rowCount < 0) { + $2 = rowCount; + } else { + $2 = rowCount * colCount; + } } else { return SWIG_ERROR; @@ -43,7 +47,11 @@ %typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN) (int rowCount, int colCount) { if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { - $1 = rowCount * colCount; + if (rowCount < 0) { + $1 = rowCount; + } else { + $1 = rowCount * colCount; + } } else { return SWIG_ERROR; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scimisctypes.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scimisctypes.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scimisctypes.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scimisctypes.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scipointer.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scipointer.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scipointer.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scipointer.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciprimtypes.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciprimtypes.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scirun.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scirun.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scirun.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scirun.swg index 51df9a59..a7b737a6 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/scirun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/scirun.swg @@ -5,7 +5,6 @@ /* Scilab version macro */ #include "version.h" -#define SWIG_SCILAB_VERSION (SCI_VERSION_MAJOR * 100) + (SCI_VERSION_MINOR * 10) + SCI_VERSION_MAINTENANCE /* Scilab standard headers */ @@ -13,11 +12,11 @@ extern "C" { #endif #include "api_scilab.h" -#if SWIG_SCILAB_VERSION < 540 +#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4 #define __USE_DEPRECATED_STACK_FUNCTIONS__ #include "stack-c.h" #endif -#if SWIG_SCILAB_VERSION < 600 +#if SCI_VERSION_MAJOR < 6 #include "MALLOC.h" #endif #include "Scierror.h" @@ -31,12 +30,12 @@ extern "C" { /* Gateway signature */ -#if SWIG_SCILAB_VERSION >= 600 -#define SWIG_GatewayParameters char* fname, void *pvApiCtx -#define SWIG_GatewayArguments fname, pvApiCtx -#else +#if SCI_VERSION_MAJOR < 6 #define SWIG_GatewayParameters char* fname, unsigned long fname_len #define SWIG_GatewayArguments fname, fname_len +# else +#define SWIG_GatewayParameters char* fname, void *pvApiCtx +#define SWIG_GatewayArguments fname, pvApiCtx #endif /* Function name management functions */ @@ -47,10 +46,8 @@ static char *SWIG_Scilab_GetFuncName(void) { return SwigFuncName; } static void SWIG_Scilab_SetFuncName(char *funcName) { - if (SwigFuncName != NULL) { - free(SwigFuncName); - SwigFuncName = NULL; - } + free(SwigFuncName); + SwigFuncName = NULL; if (funcName) { SwigFuncName = (char *)malloc(strlen(funcName) + 1); if (SwigFuncName) @@ -60,29 +57,29 @@ static void SWIG_Scilab_SetFuncName(char *funcName) { /* Api context management functions */ -#if SWIG_SCILAB_VERSION >= 600 +#if SCI_VERSION_MAJOR < 6 +#define SWIG_Scilab_SetApiContext(apiCtx) +#else static void *pvApiCtx = NULL; static void SWIG_Scilab_SetApiContext(void *apiCtx) { pvApiCtx = apiCtx; } -#else -#define SWIG_Scilab_SetApiContext(apiCtx) #endif /* Argument management functions */ -#if SWIG_SCILAB_VERSION >= 540 -#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) -#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) -#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) -#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx) -#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos -#else +#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4 #define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument) #define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckRhs(minInputArgument, 256) #define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument) #define SWIG_NbInputArgument(pvApiCtx) Rhs #define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) LhsVar(outputArgumentPos) = argumentPos +#else +#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) +#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) +#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) +#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx) +#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos #endif typedef int SwigSciObject; @@ -134,6 +131,8 @@ SWIG_Scilab_ErrorType(int code) { return "SystemError"; case SWIG_AttributeError: return "AttributeError"; + case SWIG_NullReferenceError: + return "NullReferenceError"; default: return "RuntimeError"; } @@ -436,7 +435,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty #ifdef __cplusplus extern "C" #endif -int SWIG_this(SWIG_GatewayParameters) { +SWIGEXPORT int SWIG_this(SWIG_GatewayParameters) { void *ptrValue = NULL; if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) { SWIG_Scilab_SetOutputPosition(1); @@ -453,7 +452,7 @@ int SWIG_this(SWIG_GatewayParameters) { #ifdef __cplusplus extern "C" #endif -int SWIG_ptr(SWIG_GatewayParameters) { +SWIGEXPORT int SWIG_ptr(SWIG_GatewayParameters) { if (SWIG_NbInputArgument(pvApiCtx) > 0) { SciErr sciErr; int *piAddrVar1 = NULL; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciruntime.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciruntime.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciruntime.swg index 3de138e1..e772926f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/sciruntime.swg +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/sciruntime.swg @@ -40,7 +40,7 @@ SWIG_Scilab_TypeQuery(const char *name) { #ifdef __cplusplus extern "C" #endif -int _Init(SWIG_GatewayParameters) { +SWIGEXPORT int SWIG__Init(SWIG_GatewayParameters) { SWIG_InitializeModule(NULL); SWIG_CreateScilabVariables(pvApiCtx); swig_module_initialized = 1; diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequence.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequence.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequence.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequence.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequencebool.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequencebool.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequencebool.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequencebool.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequencedouble.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequencedouble.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequencedouble.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequencedouble.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequencefloat.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequencefloat.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequencefloat.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequencefloat.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequenceint.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequenceint.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequenceint.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequenceint.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequencepointer.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequencepointer.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequencepointer.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequencepointer.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisequencestring.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisequencestring.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisequencestring.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisequencestring.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scishort.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scishort.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scishort.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scishort.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scisignedchar.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scisignedchar.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scisignedchar.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scisignedchar.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scistdcommon.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scistdcommon.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scistdcommon.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scistdcommon.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/scitypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/scitypemaps.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/scitypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/scitypemaps.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedchar.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedchar.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedchar.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedchar.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedint.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedint.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedint.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedint.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedlong.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedlong.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedlong.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedlong.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedshort.swg b/macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedshort.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/sciunsignedshort.swg rename to macx64/bin/swig/share/swig/4.3.0/scilab/sciunsignedshort.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_basic_string.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_basic_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_basic_string.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_basic_string.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_char_traits.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_char_traits.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_char_traits.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_char_traits.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_common.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_container.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_container.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_except.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_list.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_map.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_map.i similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_map.i index 07eb63fd..aeede607 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/std_map.i @@ -47,7 +47,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); @@ -63,17 +67,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_multiset.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_multiset.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_multiset.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_set.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_set.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_set.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_shared_ptr.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_shared_ptr.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/std_string.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_string.i similarity index 78% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_string.i index 71ac6d2f..b7f68996 100644 --- a/macx64/bin/swig/share/swig/4.0.0/scilab/std_string.i +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/std_string.i @@ -11,7 +11,7 @@ SWIG_AsPtr_dec(std::string)(int iVar, std::string **pstValue) { if (SWIG_IsOK((SWIG_SciString_AsCharPtrAndSize(pvApiCtx, iVar, &buf, &size, &alloc, SWIG_Scilab_GetFuncName())))) { if (buf) { if (pstValue) { - *pstValue = new std::string(buf, size); + *pstValue = new std::string(buf, size - 1); } if (alloc == SWIG_NEWOBJ) { delete[] buf; @@ -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/macx64/bin/swig/share/swig/4.0.0/scilab/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/scilab/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/stl.i b/macx64/bin/swig/share/swig/4.3.0/scilab/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/stl.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/scilab/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/scilab/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/scilab/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/scilab/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/scilab/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/scilab/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/scilab/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.0.0/shared_ptr.i b/macx64/bin/swig/share/swig/4.3.0/shared_ptr.i similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/shared_ptr.i rename to macx64/bin/swig/share/swig/4.3.0/shared_ptr.i index eada0b9e..b450229c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/shared_ptr.i +++ b/macx64/bin/swig/share/swig/4.3.0/shared_ptr.i @@ -55,15 +55,3 @@ struct SWIG_null_deleter { SWIG_SHARED_PTR_TYPEMAPS(, TYPE) SWIG_SHARED_PTR_TYPEMAPS(const, TYPE) %enddef - -// Legacy macros -%define SWIG_SHARED_PTR(PROXYCLASS, TYPE...) -#warning "SWIG_SHARED_PTR(PROXYCLASS, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead." -%shared_ptr(TYPE) -%enddef - -%define SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...) -#warning "SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead." -%shared_ptr(TYPE) -%enddef - diff --git a/macx64/bin/swig/share/swig/4.0.0/std/_std_deque.i b/macx64/bin/swig/share/swig/4.3.0/std/_std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/_std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/std/_std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_alloc.i b/macx64/bin/swig/share/swig/4.3.0/std/std_alloc.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_alloc.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_alloc.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_array.i b/macx64/bin/swig/share/swig/4.3.0/std/std_array.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_array.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_array.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_basic_string.i b/macx64/bin/swig/share/swig/4.3.0/std/std_basic_string.i similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/std/std_basic_string.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_basic_string.i index fb7afc1e..e95cb476 100644 --- a/macx64/bin/swig/share/swig/4.0.0/std/std_basic_string.i +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/std/std_char_traits.i b/macx64/bin/swig/share/swig/4.3.0/std/std_char_traits.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_char_traits.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_char_traits.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_common.i b/macx64/bin/swig/share/swig/4.3.0/std/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_common.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_container.i b/macx64/bin/swig/share/swig/4.3.0/std/std_container.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_container.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_container.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/std/std_deque.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_deque.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_deque.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_except.i b/macx64/bin/swig/share/swig/4.3.0/std/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_ios.i b/macx64/bin/swig/share/swig/4.3.0/std/std_ios.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_ios.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_ios.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_iostream.i b/macx64/bin/swig/share/swig/4.3.0/std/std_iostream.i similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/std/std_iostream.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_iostream.i index 38a22963..4c126989 100644 --- a/macx64/bin/swig/share/swig/4.0.0/std/std_iostream.i +++ b/macx64/bin/swig/share/swig/4.3.0/std/std_iostream.i @@ -264,6 +264,14 @@ namespace std seekg(off_type, ios_base::seekdir); }; + %template(ostream) basic_ostream; + %template(istream) basic_istream; + +#if defined(SWIG_WCHAR) + %template(wostream) basic_ostream; + %template(wistream) basic_istream; +#endif + // 27.6.1.5 Template class basic_iostream template > class basic_iostream @@ -318,8 +326,6 @@ namespace std } namespace std { - %template(ostream) basic_ostream; - %template(istream) basic_istream; %template(iostream) basic_iostream; %template(endl) endl >; @@ -327,8 +333,6 @@ namespace std { %template(flush) flush >; #if defined(SWIG_WCHAR) - %template(wostream) basic_ostream; - %template(wistream) basic_istream; %template(wiostream) basic_iostream; %template(wendl) endl >; diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_list.i b/macx64/bin/swig/share/swig/4.3.0/std/std_list.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_list.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_list.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_map.i b/macx64/bin/swig/share/swig/4.3.0/std/std_map.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_map.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_multimap.i b/macx64/bin/swig/share/swig/4.3.0/std/std_multimap.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_multimap.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_multiset.i b/macx64/bin/swig/share/swig/4.3.0/std/std_multiset.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_multiset.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/std/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_queue.i b/macx64/bin/swig/share/swig/4.3.0/std/std_queue.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_queue.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_queue.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_set.i b/macx64/bin/swig/share/swig/4.3.0/std/std_set.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_set.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_set.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_sstream.i b/macx64/bin/swig/share/swig/4.3.0/std/std_sstream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_sstream.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_sstream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_stack.i b/macx64/bin/swig/share/swig/4.3.0/std/std_stack.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_stack.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_stack.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_streambuf.i b/macx64/bin/swig/share/swig/4.3.0/std/std_streambuf.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_streambuf.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_streambuf.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_string.i b/macx64/bin/swig/share/swig/4.3.0/std/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_string.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_unordered_map.i b/macx64/bin/swig/share/swig/4.3.0/std/std_unordered_map.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_unordered_map.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_unordered_map.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_unordered_multimap.i b/macx64/bin/swig/share/swig/4.3.0/std/std_unordered_multimap.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_unordered_multimap.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_unordered_multimap.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_unordered_multiset.i b/macx64/bin/swig/share/swig/4.3.0/std/std_unordered_multiset.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_unordered_multiset.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_unordered_multiset.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_unordered_set.i b/macx64/bin/swig/share/swig/4.3.0/std/std_unordered_set.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_unordered_set.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_unordered_set.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/std/std_vector.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_vector.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_vectora.i b/macx64/bin/swig/share/swig/4.3.0/std/std_vectora.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_vectora.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_vectora.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_wios.i b/macx64/bin/swig/share/swig/4.3.0/std/std_wios.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_wios.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_wios.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_wiostream.i b/macx64/bin/swig/share/swig/4.3.0/std/std_wiostream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_wiostream.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_wiostream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_wsstream.i b/macx64/bin/swig/share/swig/4.3.0/std/std_wsstream.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_wsstream.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_wsstream.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_wstreambuf.i b/macx64/bin/swig/share/swig/4.3.0/std/std_wstreambuf.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_wstreambuf.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_wstreambuf.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/std/std_wstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/std/std_wstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/std_except.i b/macx64/bin/swig/share/swig/4.3.0/std_except.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/std_except.i rename to macx64/bin/swig/share/swig/4.3.0/std_except.i diff --git a/macx64/bin/swig/share/swig/4.0.0/stdint.i b/macx64/bin/swig/share/swig/4.3.0/stdint.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/stdint.i rename to macx64/bin/swig/share/swig/4.3.0/stdint.i diff --git a/macx64/bin/swig/share/swig/4.0.0/stl.i b/macx64/bin/swig/share/swig/4.3.0/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/stl.i rename to macx64/bin/swig/share/swig/4.3.0/stl.i diff --git a/macx64/bin/swig/share/swig/4.0.0/swig.swg b/macx64/bin/swig/share/swig/4.3.0/swig.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/swig.swg rename to macx64/bin/swig/share/swig/4.3.0/swig.swg index 6dc215dc..a7d41a7a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swig.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swig.swg @@ -9,20 +9,6 @@ * User Directives * ----------------------------------------------------------------------------- */ -/* Deprecated SWIG-1.1 directives */ - -#define %disabledoc %warn "104:%disabledoc is deprecated" -#define %enabledoc %warn "105:%enabledoc is deprecated" -#define %doconly %warn "106:%doconly is deprecated" -#define %style %warn "107:%style is deprecated" /##/ -#define %localstyle %warn "108:%localstyle is deprecated" /##/ -#define %title %warn "109:%title is deprecated" /##/ -#define %section %warn "110:%section is deprecated" /##/ -#define %subsection %warn "111:%subsection is deprecated" /##/ -#define %subsubsection %warn "112:%subsubsection is deprecated" /##/ -#define %new %warn "117:%new is deprecated. Use %newobject" -#define %text %insert("null") - /* Code insertion directives such as %wrapper %{ ... %} */ #define %begin %insert("begin") @@ -31,10 +17,6 @@ #define %wrapper %insert("wrapper") #define %init %insert("init") -/* Class extension */ - -#define %addmethods %warn "113:%addmethods is now %extend" %extend - /* %ignore directive */ #define %ignore %rename($ignore) @@ -42,9 +24,6 @@ /* Access control directives */ -#define %readonly %warn "114:%readonly is deprecated. Use %immutable; " %feature("immutable"); -#define %readwrite %warn "115:%readwrite is deprecated. Use %mutable; " %feature("immutable",""); - #define %immutable %feature("immutable") #define %noimmutable %feature("immutable","0") #define %clearimmutable %feature("immutable","") @@ -136,11 +115,6 @@ #define %nocallback %feature("callback","0") #define %clearcallback %feature("callback","") -/* the %nestedworkaround directive (deprecated) */ -#define %nestedworkaround %feature("nestedworkaround") -#define %nonestedworkaround %feature("nestedworkaround","0") -#define %clearnestedworkaround %feature("nestedworkaround","") - /* the %flatnested directive */ #define %flatnested %feature("flatnested") #define %noflatnested %feature("flatnested","0") @@ -165,6 +139,7 @@ #define %nspace %feature("nspace") #define %nonspace %feature("nspace","0") #define %clearnspace %feature("nspace","") +#define %nspacemove(NAMESPACE) %feature("nspace", #NAMESPACE) /* valuewrapper directives */ #define %valuewrapper %feature("valuewrapper") @@ -172,7 +147,7 @@ #define %novaluewrapper %feature("novaluewrapper") #define %clearnovaluewrapper %feature("novaluewrapper","") -/* Contract support - Experimental and undocumented */ +/* Contract support - Experimental */ #define %contract %feature("contract") #define %nocontract %feature("contract","0") #define %clearcontract %feature("contract","") @@ -268,7 +243,9 @@ static int NAME(TYPE x) { */ -%define %$not "not" %enddef +/* Note that when %$not is used with another macro, say %enum as follows: %$not %$enum, the result is "notmatch=enum" */ +%define %$not "not" %enddef + %define %$isenum "match"="enum" %enddef %define %$isenumitem "match"="enumitem" %enddef %define %$isaccess "match"="access" %enddef @@ -279,6 +256,7 @@ static int NAME(TYPE x) { %define %$isnamespace "match"="namespace" %enddef %define %$istemplate "match"="template" %enddef %define %$isconstant "match"="constant" %enddef /* %constant definition */ +%define %$isusing "match"="using" %enddef %define %$isunion "match$kind"="union" %enddef %define %$isfunction "match$kind"="function" %enddef @@ -358,6 +336,11 @@ static int NAME(TYPE x) { %define SWIG_TYPECHECK_STDUNISTRING 115 %enddef %define SWIG_TYPECHECK_UNISTRING 120 %enddef %define SWIG_TYPECHECK_CHAR 130 %enddef +/* Give std::string_view a slightly higher precedence because if there are + * overloaded forms then it may be more efficient to pass as std::string_view + * (e.g. to pass as std::string requires copying the data into a std::string). + */ +%define SWIG_TYPECHECK_STRINGVIEW 134 %enddef %define SWIG_TYPECHECK_STDSTRING 135 %enddef %define SWIG_TYPECHECK_STRING 140 %enddef %define SWIG_TYPECHECK_PAIR 150 %enddef @@ -445,15 +428,15 @@ 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 */ #ifdef __cplusplus -%typemap(memberin) char * { +%typemap(memberin,fragment="") char * { delete [] $1; if ($input) { $1 = ($1_type) (new char[strlen((const char *)$input)+1]); @@ -462,7 +445,7 @@ namespace std { $1 = 0; } } -%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * { +%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="") const char * { if ($input) { $1 = ($1_type) (new char[strlen((const char *)$input)+1]); strcpy((char *)$1, (const char *)$input); @@ -470,7 +453,7 @@ namespace std { $1 = 0; } } -%typemap(globalin) char * { +%typemap(globalin,fragment="") char * { delete [] $1; if ($input) { $1 = ($1_type) (new char[strlen((const char *)$input)+1]); @@ -479,7 +462,7 @@ namespace std { $1 = 0; } } -%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * { +%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="") const char * { if ($input) { $1 = ($1_type) (new char[strlen((const char *)$input)+1]); strcpy((char *)$1, (const char *)$input); @@ -488,7 +471,7 @@ namespace std { } } #else -%typemap(memberin) char * { +%typemap(memberin,fragment="") char * { free($1); if ($input) { $1 = ($1_type) malloc(strlen((const char *)$input)+1); @@ -497,7 +480,7 @@ namespace std { $1 = 0; } } -%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * { +%typemap(memberin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="") const char * { if ($input) { $1 = ($1_type) malloc(strlen((const char *)$input)+1); strcpy((char *)$1, (const char *)$input); @@ -505,7 +488,7 @@ namespace std { $1 = 0; } } -%typemap(globalin) char * { +%typemap(globalin,fragment="") char * { free($1); if ($input) { $1 = ($1_type) malloc(strlen((const char *)$input)+1); @@ -514,7 +497,7 @@ namespace std { $1 = 0; } } -%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const char * { +%typemap(globalin,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG,fragment="") const char * { if ($input) { $1 = ($1_type) malloc(strlen((const char *)$input)+1); strcpy((char *)$1, (const char *)$input); @@ -527,7 +510,7 @@ namespace std { /* Character array handling */ -%typemap(memberin) char [ANY] { +%typemap(memberin,fragment="") char [ANY] { if($input) { strncpy((char*)$1, (const char *)$input, $1_dim0-1); $1[$1_dim0-1] = 0; @@ -536,7 +519,7 @@ namespace std { } } -%typemap(globalin) char [ANY] { +%typemap(globalin,fragment="") char [ANY] { if($input) { strncpy((char*)$1, (const char *)$input, $1_dim0-1); $1[$1_dim0-1] = 0; @@ -545,12 +528,12 @@ namespace std { } } -%typemap(memberin) char [] { +%typemap(memberin,fragment="") char [] { if ($input) strcpy((char *)$1, (const char *)$input); else $1[0] = 0; } -%typemap(globalin) char [] { +%typemap(globalin,fragment="") char [] { if ($input) strcpy((char *)$1, (const char *)$input); else $1[0] = 0; } @@ -599,6 +582,10 @@ namespace std { * Runtime code * ----------------------------------------------------------------------------- */ + +%insert("runtime") "swiglabels.swg" + + /* The SwigValueWrapper class */ /* @@ -649,33 +636,53 @@ 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" :-). */ #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: @@ -686,16 +693,18 @@ 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" - - +%insert("runtime") "swigcompat.swg" diff --git a/macx64/bin/swig/share/swig/4.3.0/swigarch.i b/macx64/bin/swig/share/swig/4.3.0/swigarch.i new file mode 100644 index 00000000..2f761494 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/swigarch.i @@ -0,0 +1,33 @@ +/* ----------------------------------------------------------------------------- + * swigarch.i + * + * SWIG library file for 32bit/64bit code specialization and checking. + * + * Use only in extreme cases, when no arch. independent code can be + * generated + * + * To activate 32-bit architecture checks, use + * + * swig -DSWIGWORDSIZE32 + * + * This adds checks that long is 32-bits when compiling the generated wrappers. + * + * To activate 64-bit architecture specific code, use + * + * swig -DSWIGWORDSIZE64 + * + * This adds checks that long is 64-bits when compiling the generated wrappers. + * Some target languages also generate code that expects long to be 64-bits. + * + * If you don't specify the SWIGWORDSIZE (the default case), SWIG will + * generate architecture independent and/or 32bits code, with no extra + * checks for the sizeof long. + * ----------------------------------------------------------------------------- */ + +#ifdef SWIGWORDSIZE32 +%fragment("long_check_wordsize32"); +#endif + +#ifdef SWIGWORDSIZE64 +%fragment("long_check_wordsize64"); +#endif diff --git a/macx64/bin/swig/share/swig/4.3.0/swigcompat.swg b/macx64/bin/swig/share/swig/4.3.0/swigcompat.swg new file mode 100644 index 00000000..cf69b921 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/swigcompat.swg @@ -0,0 +1,27 @@ +/* ----------------------------------------------------------------------------- + * swigcompat.swg + * + * Macros to provide support compatibility with older C and C++ standards. + * + * Note that SWIG expects __cplusplus to be defined to the appropriate C++ standard. + * MSVC users are urged to check and examine the /Zc:__cplusplus compiler option. + * See https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus. + * ----------------------------------------------------------------------------- */ + +/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF + * if you're missing it. + */ +#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ + (defined __cplusplus && __cplusplus >= 201103L) || \ + defined SWIG_HAVE_SNPRINTF) && \ + !defined SWIG_NO_SNPRINTF +# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) +# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) +#else +/* Fallback versions ignore the buffer size, but most of our uses either have a + * fixed maximum possible size or dynamically allocate a buffer that's large + * enough. + */ +# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) +# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/swigerrors.swg b/macx64/bin/swig/share/swig/4.3.0/swigerrors.swg similarity index 84% rename from macx64/bin/swig/share/swig/4.0.0/swigerrors.swg rename to macx64/bin/swig/share/swig/4.3.0/swigerrors.swg index 1a6d2036..4d5a8e47 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swigerrors.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/swigfragments.swg b/macx64/bin/swig/share/swig/4.3.0/swigfragments.swg similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/swigfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/swigfragments.swg index 2cbef7cc..75f05bc7 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swigfragments.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swigfragments.swg @@ -29,6 +29,10 @@ #include %} +%fragment("", "header") %{ +#include +%} + %fragment("", "header") %{ #include %} @@ -73,6 +77,10 @@ #include %} +%fragment("", "header") %{ +#include +%} + %fragment("", "header") %{ #include %} @@ -81,6 +89,41 @@ #include %} -%fragment("", "header") %{ -#include +%fragment("", "header") %{ +#include %} + +%fragment("", "header") %{ +#include +%} + +%fragment("", "header") %{ +#include +%} + +/* ----------------------------------------------------------------------------- + * Other common fragments + * ----------------------------------------------------------------------------- */ + +%fragment("long_check_wordsize32", "header", fragment="") %{ +#if !defined(SWIG_NO_WORDSIZE32_CHECK) +#if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX) +# error "SWIG generated code is invalid on this 64-bit architecture, please regenerate without defining SWIGWORDSIZE32 or define SWIGWORDSIZE64" +#endif +#endif +%} + +%fragment("long_check_wordsize64", "header", fragment="") %{ +#if !defined(SWIG_NO_WORDSIZE64_CHECK) +#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX) +# error "SWIG generated code is invalid on this 32-bit architecture, please regenerate without defining SWIGWORDSIZE64 or define SWIGWORDSIZE32" +#endif +#endif +%} + +#ifdef SWIGWORDSIZE64 +%fragment("long_check_wordsize", "header", fragment="long_check_wordsize64") {} +#else +%fragment("long_check_wordsize", "header", fragment="long_check_wordsize32") {} +#endif + diff --git a/macx64/bin/swig/share/swig/4.0.0/swiginit.swg b/macx64/bin/swig/share/swig/4.3.0/swiginit.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/swiginit.swg rename to macx64/bin/swig/share/swig/4.3.0/swiginit.swg index 33926b10..e50b1b46 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swiginit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swiginit.swg @@ -50,9 +50,12 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif +#ifndef SWIG_INIT_CLIENT_DATA_TYPE +#define SWIG_INIT_CLIENT_DATA_TYPE void * +#endif SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { +SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; swig_module_info *module_head, *iter; int init; diff --git a/macx64/bin/swig/share/swig/4.0.0/swiglabels.swg b/macx64/bin/swig/share/swig/4.3.0/swiglabels.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/swiglabels.swg rename to macx64/bin/swig/share/swig/4.3.0/swiglabels.swg index b3855665..58d87e92 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swiglabels.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swiglabels.swg @@ -121,3 +121,9 @@ #ifdef __INTEL_COMPILER # pragma warning disable 592 #endif + +#if defined(__cplusplus) && __cplusplus >=201103L +# define SWIG_NULLPTR nullptr +#else +# define SWIG_NULLPTR NULL +#endif diff --git a/macx64/bin/swig/share/swig/4.0.0/swigrun.i b/macx64/bin/swig/share/swig/4.3.0/swigrun.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/swigrun.i rename to macx64/bin/swig/share/swig/4.3.0/swigrun.i diff --git a/macx64/bin/swig/share/swig/4.0.0/swigrun.swg b/macx64/bin/swig/share/swig/4.3.0/swigrun.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/swigrun.swg rename to macx64/bin/swig/share/swig/4.3.0/swigrun.swg index 59118eca..824185c0 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swigrun.swg +++ b/macx64/bin/swig/share/swig/4.3.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 @@ -115,7 +117,7 @@ SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this + allows returning the 'cast rank', for example, if you have this int food(double) int fooi(int); @@ -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) @@ -137,14 +145,14 @@ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ +/* The TmpMask is for in/out typemaps that use temporary objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #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)) @@ -290,7 +298,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) { Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { +SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { @@ -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/macx64/bin/swig/share/swig/4.0.0/swigwarn.swg b/macx64/bin/swig/share/swig/4.3.0/swigwarn.swg similarity index 74% rename from macx64/bin/swig/share/swig/4.0.0/swigwarn.swg rename to macx64/bin/swig/share/swig/4.3.0/swigwarn.swg index ee3be116..0320db8f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swigwarn.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swigwarn.swg @@ -5,32 +5,32 @@ /* -- Deprecated features -- */ -%define SWIGWARN_DEPRECATED_EXTERN 101 %enddef -%define SWIGWARN_DEPRECATED_VAL 102 %enddef -%define SWIGWARN_DEPRECATED_OUT 103 %enddef -%define SWIGWARN_DEPRECATED_DISABLEDOC 104 %enddef -%define SWIGWARN_DEPRECATED_ENABLEDOC 105 %enddef -%define SWIGWARN_DEPRECATED_DOCONLY 106 %enddef -%define SWIGWARN_DEPRECATED_STYLE 107 %enddef -%define SWIGWARN_DEPRECATED_LOCALSTYLE 108 %enddef -%define SWIGWARN_DEPRECATED_TITLE 109 %enddef -%define SWIGWARN_DEPRECATED_SECTION 110 %enddef -%define SWIGWARN_DEPRECATED_SUBSECTION 111 %enddef -%define SWIGWARN_DEPRECATED_SUBSUBSECTION 112 %enddef -%define SWIGWARN_DEPRECATED_ADDMETHODS 113 %enddef -%define SWIGWARN_DEPRECATED_READONLY 114 %enddef -%define SWIGWARN_DEPRECATED_READWRITE 115 %enddef -%define SWIGWARN_DEPRECATED_EXCEPT 116 %enddef -%define SWIGWARN_DEPRECATED_NEW 117 %enddef -%define SWIGWARN_DEPRECATED_EXCEPT_TM 118 %enddef -%define SWIGWARN_DEPRECATED_IGNORE_TM 119 %enddef -%define SWIGWARN_DEPRECATED_OPTC 120 %enddef -%define SWIGWARN_DEPRECATED_NAME 121 %enddef -%define SWIGWARN_DEPRECATED_NOEXTERN 122 %enddef -%define SWIGWARN_DEPRECATED_NODEFAULT 123 %enddef -%define SWIGWARN_DEPRECATED_TYPEMAP_LANG 124 %enddef -%define SWIGWARN_DEPRECATED_INPUT_FILE 125 %enddef -%define SWIGWARN_DEPRECATED_NESTED_WORKAROUND 126 %enddef +/* Unused since 4.2.0: #define WARN_DEPRECATED_EXTERN 101 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_VAL 102 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_OUT 103 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_DISABLEDOC 104 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_ENABLEDOC 105 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_DOCONLY 106 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_STYLE 107 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_LOCALSTYLE 108 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_TITLE 109 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_SECTION 110 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_SUBSECTION 111 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_SUBSUBSECTION 112 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_ADDMETHODS 113 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_READONLY 114 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_READWRITE 115 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_EXCEPT 116 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_NEW 117 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_EXCEPT_TM 118 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_IGNORE_TM 119 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_OPTC 120 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_NAME 121 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_NOEXTERN 122 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_NODEFAULT 123 */ +/* Unused since 4.1.0: #define WARN_DEPRECATED_TYPEMAP_LANG 124 */ +/* Unused since 4.2.0: #define WARN_DEPRECATED_INPUT_FILE 125 */ +/* Unused since 4.3.0: #define WARN_DEPRECATED_NESTED_WORKAROUND 126 */ /* -- Preprocessor -- */ @@ -48,17 +48,17 @@ %define SWIGWARN_PARSE_EXTEND_UNDEF 303 %enddef %define SWIGWARN_PARSE_UNSUPPORTED_VALUE 304 %enddef %define SWIGWARN_PARSE_BAD_VALUE 305 %enddef -%define SWIGWARN_PARSE_PRIVATE 306 %enddef -%define SWIGWARN_PARSE_BAD_DEFAULT 307 %enddef +/* Unused since 1.3.32: #define WARN_PARSE_PRIVATE 306 */ +/* Unused since 4.2.0: #define WARN_PARSE_BAD_DEFAULT 307 */ %define SWIGWARN_PARSE_NAMESPACE_ALIAS 308 %enddef %define SWIGWARN_PARSE_PRIVATE_INHERIT 309 %enddef -%define SWIGWARN_PARSE_TEMPLATE_REPEAT 310 %enddef -%define SWIGWARN_PARSE_TEMPLATE_PARTIAL 311 %enddef +/* Unused since 1.3.18: #define WARN_PARSE_TEMPLATE_REPEAT 310 */ +/* Unused since 1.3.18: #define WARN_PARSE_TEMPLATE_PARTIAL 311 */ %define SWIGWARN_PARSE_UNNAMED_NESTED_CLASS 312 %enddef %define SWIGWARN_PARSE_UNDEFINED_EXTERN 313 %enddef %define SWIGWARN_PARSE_KEYWORD 314 %enddef %define SWIGWARN_PARSE_USING_UNDEF 315 %enddef -%define SWIGWARN_PARSE_MODULE_REPEAT 316 %enddef +/* Unused since 1.3.18: #define WARN_PARSE_MODULE_REPEAT 316 */ %define SWIGWARN_PARSE_TEMPLATE_SP_UNDEF 317 %enddef %define SWIGWARN_PARSE_TEMPLATE_AMBIG 318 %enddef %define SWIGWARN_PARSE_NO_ACCESS 319 %enddef @@ -69,11 +69,19 @@ %define SWIGWARN_PARSE_NESTED_TEMPLATE 324 %enddef %define SWIGWARN_PARSE_NAMED_NESTED_CLASS 325 %enddef %define SWIGWARN_PARSE_EXTEND_NAME 326 %enddef +%define SWIGWARN_PARSE_EXTERN_TEMPLATE 327 %enddef +%define SWIGWARN_PARSE_ASSIGNED_VALUE 328 %enddef +%define SWIGWARN_PARSE_USING_CONSTRUCTOR 329 %enddef +%define SWIGWARN_PARSE_TEMPLATE_FORWARD 330 %enddef +%define SWIGWARN_PARSE_TEMPLATE_NESTED 331 %enddef %define SWIGWARN_CPP11_LAMBDA 340 %enddef -%define SWIGWARN_CPP11_ALIAS_DECLARATION 341 %enddef /* redundant now */ -%define SWIGWARN_CPP11_ALIAS_TEMPLATE 342 %enddef /* redundant now */ -%define SWIGWARN_CPP11_VARIADIC_TEMPLATE 343 %enddef +/* Unused since 3.0.11: #define WARN_CPP11_ALIAS_DECLARATION 341 */ +/* Unused since 3.0.11: #define WARN_CPP11_ALIAS_TEMPLATE 342 */ +/* Unused since 4.2.0: #define WARN_CPP11_VARIADIC_TEMPLATE 343 */ +%define SWIGWARN_CPP11_DECLTYPE 344 %enddef +%define SWIGWARN_CPP14_AUTO 345 %enddef +%define SWIGWARN_CPP11_AUTO 346 %enddef %define SWIGWARN_IGNORE_OPERATOR_NEW 350 %enddef /* new */ %define SWIGWARN_IGNORE_OPERATOR_DELETE 351 %enddef /* delete */ @@ -122,8 +130,9 @@ %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 /* <=> */ -/* 394-399 are reserved */ +/* please leave 350-399 free for WARN_IGNORE_OPERATOR_* */ /* -- Type system and typemaps -- */ @@ -132,12 +141,14 @@ %define SWIGWARN_TYPE_ABSTRACT 403 %enddef %define SWIGWARN_TYPE_REDEFINED 404 %enddef %define SWIGWARN_TYPE_RVALUE_REF_QUALIFIER_IGNORED 405 %enddef +%define SWIGWARN_TYPE_NSPACE_SETTING 406 %enddef -%define SWIGWARN_TYPEMAP_SOURCETARGET 450 %enddef +/* Unused since 4.1.0: #define WARN_TYPEMAP_SOURCETARGET 450 */ %define SWIGWARN_TYPEMAP_CHARLEAK 451 %enddef -%define SWIGWARN_TYPEMAP_SWIGTYPE 452 %enddef +/* Unused since 1.3.32: #define WARN_TYPEMAP_SWIGTYPE 452 */ %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 @@ -172,7 +183,7 @@ %define SWIGWARN_LANG_NATIVE_UNIMPL 507 %enddef %define SWIGWARN_LANG_DEREF_SHADOW 508 %enddef %define SWIGWARN_LANG_OVERLOAD_SHADOW 509 %enddef -%define SWIGWARN_LANG_FRIEND_IGNORE 510 %enddef +%define SWIGWARN_LANG_FRIEND_IGNORE 510 %enddef /* No longer issued */ %define SWIGWARN_LANG_OVERLOAD_KEYWORD 511 %enddef %define SWIGWARN_LANG_OVERLOAD_CONST 512 %enddef %define SWIGWARN_LANG_CLASS_UNNAMED 513 %enddef @@ -188,6 +199,8 @@ %define SWIGWARN_LANG_EXTEND_DESTRUCTOR 523 %enddef %define SWIGWARN_LANG_EXPERIMENTAL 524 %enddef %define SWIGWARN_LANG_DIRECTOR_FINAL 525 %enddef +%define SWIGWARN_LANG_USING_NAME_DIFFERENT 526 %enddef +%define SWIGWARN_LANG_DEPRECATED 527 %enddef /* -- Doxygen comments -- */ @@ -197,8 +210,9 @@ %define SWIGWARN_DOXYGEN_HTML_ERROR 563 %enddef %define SWIGWARN_DOXYGEN_COMMAND_ERROR 564 %enddef %define SWIGWARN_DOXYGEN_UNKNOWN_CHARACTER 565 %enddef +%define SWIGWARN_DOXYGEN_UNEXPECTED_ITERATOR_VALUE 566 %enddef -/* -- Reserved (600-799) -- */ +/* -- Reserved (600-699) -- */ /* -- Language module specific warnings (700 - 899) -- */ @@ -226,7 +240,17 @@ %define SWIGWARN_PYTHON_INDENT_MISMATCH 740 %enddef -/* please leave 740-759 free for Python */ +/* please leave 740-749 free for Python */ + +/* Unused since 4.2.0: #define WARN_R_MISSING_RTYPECHECK_TYPEMAP 750 */ +%define SWIGWARN_R_TYPEMAP_RTYPECHECK_UNDEF 751 %enddef + +/* please leave 750-759 free for R */ + +%define SWIGWARN_C_TYPEMAP_CTYPE_UNDEF 760 %enddef +%define SWIGWARN_C_UNSUPPORTTED 761 %enddef + +/* please leave 760-779 free for C */ %define SWIGWARN_RUBY_WRONG_NAME 801 %enddef %define SWIGWARN_RUBY_MULTIPLE_INHERITANCE 802 %enddef @@ -250,6 +274,7 @@ %define SWIGWARN_JAVA_TYPEMAP_DIRECTORIN_NODESC 824 %enddef %define SWIGWARN_JAVA_NO_DIRECTORCONNECT_ATTR 825 %enddef %define SWIGWARN_JAVA_NSPACE_WITHOUT_PACKAGE 826 %enddef +%define SWIGWARN_JAVA_TYPEMAP_INTERFACEMODIFIERS_UNDEF 827 %enddef /* please leave 810-829 free for Java */ @@ -270,26 +295,15 @@ %define SWIGWARN_CSHARP_EXCODE 844 %enddef %define SWIGWARN_CSHARP_CANTHROW 845 %enddef %define SWIGWARN_CSHARP_NO_DIRECTORCONNECT_ATTR 846 %enddef +%define SWIGWARN_CSHARP_TYPEMAP_INTERFACEMODIFIERS_UNDEF 847 %enddef /* please leave 830-849 free for C# */ -%define SWIGWARN_MODULA3_TYPEMAP_TYPE_UNDEF 850 %enddef -%define SWIGWARN_MODULA3_TYPEMAP_GETCPTR_UNDEF 851 %enddef -%define SWIGWARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF 852 %enddef -%define SWIGWARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF 853 %enddef -%define SWIGWARN_MODULA3_TYPEMAP_MULTIPLE_RETURN 854 %enddef -%define SWIGWARN_MODULA3_MULTIPLE_INHERITANCE 855 %enddef -%define SWIGWARN_MODULA3_TYPECONSTRUCTOR_UNKNOWN 856 %enddef -%define SWIGWARN_MODULA3_UNKNOWN_PRAGMA 857 %enddef -%define SWIGWARN_MODULA3_BAD_ENUMERATION 858 %enddef -%define SWIGWARN_MODULA3_DOUBLE_ID 859 %enddef -%define SWIGWARN_MODULA3_BAD_IMPORT 860 %enddef - -/* please leave 850-869 free for Modula 3 */ +/* 850-860 were used by Modula 3 (removed in SWIG 4.1.0) - avoid reusing for now */ %define SWIGWARN_PHP_MULTIPLE_INHERITANCE 870 %enddef %define SWIGWARN_PHP_UNKNOWN_PRAGMA 871 %enddef -%define SWIGWARN_PHP_PUBLIC_BASE 872 %enddef +/* Unused since 4.1.0: define WARN_PHP_PUBLIC_BASE 872 */ /* please leave 870-889 free for PHP */ diff --git a/macx64/bin/swig/share/swig/4.0.0/swigwarnings.swg b/macx64/bin/swig/share/swig/4.3.0/swigwarnings.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/swigwarnings.swg rename to macx64/bin/swig/share/swig/4.3.0/swigwarnings.swg index 34c98fbd..2dfea660 100644 --- a/macx64/bin/swig/share/swig/4.0.0/swigwarnings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/swigwarnings.swg @@ -52,8 +52,9 @@ %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_DIRECTOROUT_PTR_MSG "473:Returning a reference, pointer or pointer wrapper 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/macx64/bin/swig/share/swig/4.3.0/tcl/argcargv.i b/macx64/bin/swig/share/swig/4.3.0/tcl/argcargv.i new file mode 100644 index 00000000..e93f6914 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/argcargv.i @@ -0,0 +1,27 @@ +/* ------------------------------------------------------------- + * SWIG library containing argc and argv multi-argument typemaps + * ------------------------------------------------------------- */ + +%typemap(in) (int ARGC, char **ARGV) { + Tcl_Size 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_GetString(listobjv[i]); + } + $2[i] = NULL; +} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) { + Tcl_Size len; + $1 = Tcl_ListObjLength(interp, $input, &len) == TCL_OK; +} + +%typemap(freearg) (int ARGC, char **ARGV) { + free((void *)$2); +} diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/attribute.i b/macx64/bin/swig/share/swig/4.3.0/tcl/attribute.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/attribute.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/attribute.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/carrays.i b/macx64/bin/swig/share/swig/4.3.0/tcl/carrays.i similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/tcl/carrays.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/carrays.i index 0236672d..c1e6db3f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/carrays.i +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/carrays.i @@ -1,4 +1 @@ %include - - - diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/cmalloc.i b/macx64/bin/swig/share/swig/4.3.0/tcl/cmalloc.i new file mode 100644 index 00000000..248f06b9 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/cmalloc.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/cpointer.i b/macx64/bin/swig/share/swig/4.3.0/tcl/cpointer.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/cpointer.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/cpointer.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/cstring.i b/macx64/bin/swig/share/swig/4.3.0/tcl/cstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/cstring.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/cstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/cwstring.i b/macx64/bin/swig/share/swig/4.3.0/tcl/cwstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/cwstring.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/cwstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/exception.i b/macx64/bin/swig/share/swig/4.3.0/tcl/exception.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/exception.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/exception.i diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/factory.i b/macx64/bin/swig/share/swig/4.3.0/tcl/factory.i new file mode 100644 index 00000000..46a0a873 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/factory.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/std_auto_ptr.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_auto_ptr.i new file mode 100644 index 00000000..b24809af --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/tcl/std_common.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_common.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_common.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_common.i diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/std_deque.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_deque.i new file mode 100644 index 00000000..cb98f6c2 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_deque.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/std_except.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_except.i new file mode 100644 index 00000000..af98428f --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_except.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_map.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_map.i similarity index 76% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_map.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_map.i index 2c7f40ac..5c8bc75f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/std_map.i +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_map.i @@ -47,7 +47,11 @@ namespace std { throw std::out_of_range("key not found"); } void set(const K& key, const T& x) { +%#ifdef __cpp_lib_map_try_emplace + (*self).insert_or_assign(key, x); +%#else (*self)[key] = x; +%#endif } void del(const K& key) throw (std::out_of_range) { std::map< K, T, C >::iterator i = self->find(key); @@ -63,17 +67,4 @@ namespace std { } }; -// Legacy macros (deprecated) -%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) -#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary" -%enddef - -%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) -#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary" -%enddef - } diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_pair.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_pair.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_pair.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_pair.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_string.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_string.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_string.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_string.i diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/std_string_view.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_string_view.i new file mode 100644 index 00000000..9d922bcc --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_string_view.i @@ -0,0 +1,2 @@ +%include + diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/std_unique_ptr.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_unique_ptr.i new file mode 100644 index 00000000..ed2141cf --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_unique_ptr.i @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + * std_unique_ptr.i + * + * SWIG library file for handling std::unique_ptr. + * + * Returning a std::unique_ptr from a wrapped function: + * Memory ownership is passed (moved) from the std::unique_ptr in the C++ layer + * to the proxy class when returning a std::unique_ptr by value from a function. + * Memory ownership is not moved when returning by any sort of reference. + * + * Passing a std::unique_ptr as a parameter to a wrapped function: + * Memory ownership is passed from the proxy class to the std::unique_ptr in the + * C++ layer when passed as a parameter by value, rvalue reference or non-const + * lvalue reference. Memory ownership is not transferred when passing by const + * lvalue reference. + * ----------------------------------------------------------------------------- */ + +%include + +%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(in, noblock=1) std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr), std::unique_ptr< TYPE > && (void *argp = 0, int res = 0, std::unique_ptr< TYPE > uptr) { + 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); + } + } + uptr.reset((TYPE *)argp); + $1 = &uptr; +} + +%typemap(in, noblock=1, fragment="SwigNoDeleteUniquePtr") const std::unique_ptr< TYPE > & (void *argp = 0, int res = 0, swig::NoDeleteUniquePtr< TYPE > ndup) { + res = SWIG_ConvertPtr($input, &argp, $descriptor(TYPE *), 0); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "TYPE *", $symname, $argnum); + } + ndup.uptr.reset((TYPE *)argp); + $1 = &ndup.uptr; +} + +%typemap (out) std::unique_ptr< TYPE > %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); +%} +%typemap (out) std::unique_ptr< TYPE > &, std::unique_ptr< TYPE > && %{ + Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1->get(), $descriptor(TYPE *), $owner)); +%} + +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE >, std::unique_ptr< TYPE > &, 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 diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_vector.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_vector.i similarity index 87% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_vector.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_vector.i index 5fba5379..f950ee3f 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/std_vector.i +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/std_vector.i @@ -34,11 +34,11 @@ %{ #include -Tcl_Obj* SwigString_FromString(const std::string &s) { - return Tcl_NewStringObj(s.data(), (int)s.length()); +SWIGINTERN Tcl_Obj* SwigString_FromString(const std::string &s) { + return Tcl_NewStringObj(s.data(), (Tcl_Size)s.length()); } -int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { +SWIGINTERN int SWIG_Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) { int v; int res = Tcl_GetBooleanFromObj(interp, o, &v); if (res == TCL_OK) { @@ -47,9 +47,10 @@ 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) { - int len; +SWIGINTERN int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) { + Tcl_Size len; const char* temp = Tcl_GetStringFromObj(o, &len); + (void)interp; if (temp == NULL) return TCL_ERROR; val->assign(temp, len); @@ -84,16 +85,16 @@ namespace std { template class vector { %typemap(in) vector< T > (std::vector< T > *v) { Tcl_Obj **listobjv; - int nitems; - int i; + Tcl_Size nitems; + Tcl_Size i; T* temp; - if (SWIG_ConvertPtr($input, (void **) &v, \ + if (SWIG_ConvertPtr($input, (void **) &v, $&1_descriptor, 0) == 0){ $1 = *v; } else { // It isn't a vector< T > so it should be a list of T's - if(Tcl_ListObjGetElements(interp, $input, \ + if(Tcl_ListObjGetElements(interp, $input, &nitems, &listobjv) == TCL_ERROR) return TCL_ERROR; $1 = std::vector< T >(); @@ -113,12 +114,12 @@ namespace std { %typemap(in) const vector< T >* (std::vector< T > *v, std::vector< T > w), const vector< T >& (std::vector< T > *v, std::vector< T > w) { Tcl_Obj **listobjv; - int nitems; - int i; + Tcl_Size nitems; + Tcl_Size i; T* temp; - if(SWIG_ConvertPtr($input, (void **) &v, \ - $&1_descriptor, 0) == 0) { + if(SWIG_ConvertPtr($input, (void **) &v, + $1_descriptor, 0) == 0) { $1 = v; } else { // It isn't a vector< T > so it should be a list of T's @@ -143,7 +144,7 @@ namespace std { %typemap(out) vector< T > { for (unsigned int i=0; i<$1.size(); i++) { T* ptr = new T((($1_type &)$1)[i]); - Tcl_ListObjAppendElement(interp, $result, \ + Tcl_ListObjAppendElement(interp, $result, SWIG_NewInstanceObj(ptr, $descriptor(T *), 0)); @@ -152,11 +153,11 @@ namespace std { %typecheck(SWIG_TYPECHECK_VECTOR) vector< T > { Tcl_Obj **listobjv; - int nitems; + Tcl_Size nitems; T* temp; std::vector< T > *v; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $&1_descriptor, 0) == 0) { /* wrapped vector */ $1 = 1; @@ -168,7 +169,7 @@ namespace std { else if (nitems == 0) $1 = 1; - //check the first value to see if it is of correct type + //check the first value to see if it is of correct type else if ((SWIG_ConvertPtr(listobjv[0], (void **) &temp, $descriptor(T *),0)) != 0) @@ -181,11 +182,11 @@ namespace std { %typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&, const vector< T >* { Tcl_Obj **listobjv; - int nitems; + Tcl_Size nitems; T* temp; std::vector< T > *v; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; @@ -197,7 +198,7 @@ namespace std { else if (nitems == 0) $1 = 1; - //check the first value to see if it is of correct type + //check the first value to see if it is of correct type else if ((SWIG_ConvertPtr(listobjv[0], (void **) &temp, $descriptor(T *),0)) != 0) @@ -260,11 +261,11 @@ namespace std { %typemap(in) vector< T > (std::vector< T > *v){ Tcl_Obj **listobjv; - int nitems; - int i; + Tcl_Size nitems; + Tcl_Size i; T temp; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $&1_descriptor, 0) == 0) { $1 = *v; } else { @@ -284,11 +285,11 @@ namespace std { %typemap(in) const vector< T >& (std::vector< T > *v,std::vector< T > w), const vector< T >* (std::vector< T > *v,std::vector< T > w) { Tcl_Obj **listobjv; - int nitems; - int i; + Tcl_Size nitems; + Tcl_Size i; T temp; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $1_descriptor, 0) == 0) { $1 = v; } else { @@ -308,18 +309,18 @@ namespace std { %typemap(out) vector< T > { for (unsigned int i=0; i<$1.size(); i++) { - Tcl_ListObjAppendElement(interp, $result, \ + Tcl_ListObjAppendElement(interp, $result, CONVERT_TO((($1_type &)$1)[i])); } } %typecheck(SWIG_TYPECHECK_VECTOR) vector< T > { Tcl_Obj **listobjv; - int nitems; + Tcl_Size nitems; T temp; std::vector< T > *v; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $&1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; @@ -331,22 +332,22 @@ namespace std { else if (nitems == 0) $1 = 1; - //check the first value to see if it is of correct type - if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR) - $1 = 0; - else - $1 = 1; + //check the first value to see if it is of correct type + else if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR) + $1 = 0; + else + $1 = 1; } } %typecheck(SWIG_TYPECHECK_VECTOR) const vector< T >&, const vector< T >*{ Tcl_Obj **listobjv; - int nitems; + Tcl_Size nitems; T temp; std::vector< T > *v; - if(SWIG_ConvertPtr($input, (void **) &v, \ + if(SWIG_ConvertPtr($input, (void **) &v, $1_descriptor, 0) == 0){ /* wrapped vector */ $1 = 1; @@ -358,11 +359,11 @@ namespace std { else if (nitems == 0) $1 = 1; - //check the first value to see if it is of correct type - if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR) - $1 = 0; - else - $1 = 1; + //check the first value to see if it is of correct type + else if (CONVERT_FROM(interp, listobjv[0], &temp) == TCL_ERROR) + $1 = 0; + else + $1 = 1; } } @@ -412,7 +413,7 @@ namespace std { }; %enddef - specialize_std_vector(bool, Tcl_GetBoolFromObj, Tcl_NewBooleanObj); + specialize_std_vector(bool, SWIG_Tcl_GetBoolFromObj, Tcl_NewBooleanObj); specialize_std_vector(char, SwigInt_As,Tcl_NewIntObj); specialize_std_vector(int, Tcl_GetIntFromObj,Tcl_NewIntObj); specialize_std_vector(short, SwigInt_As, Tcl_NewIntObj); diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/std_wstring.i b/macx64/bin/swig/share/swig/4.3.0/tcl/std_wstring.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/std_wstring.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/std_wstring.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/stl.i b/macx64/bin/swig/share/swig/4.3.0/tcl/stl.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/stl.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/stl.i diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/swigmove.i b/macx64/bin/swig/share/swig/4.3.0/tcl/swigmove.i new file mode 100644 index 00000000..62ecca76 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/swigmove.i @@ -0,0 +1 @@ +%include diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tcl8.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tcl8.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tcl8.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tcl8.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclapi.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclapi.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclapi.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclapi.swg index 2187de52..03c3967a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclapi.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclapi.swg @@ -23,8 +23,8 @@ typedef struct swig_const_info { swig_type_info **ptype; } swig_const_info; -typedef int (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []); -typedef int (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []); +typedef int (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []); +typedef int (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []); typedef char *(*swig_variable_func)(ClientData, Tcl_Interp *, char *, char *, int); typedef void (*swig_delete_func)(ClientData); @@ -63,7 +63,7 @@ typedef struct swig_instance { /* Structure for command table */ typedef struct { const char *name; - int (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []); + int (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *const []); ClientData clientdata; } swig_command_info; diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclerrors.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclerrors.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclerrors.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclerrors.swg index 889d3ad5..120bb3ea 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclerrors.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclerrors.swg @@ -39,6 +39,9 @@ SWIG_Tcl_ErrorType(int code) { case SWIG_AttributeError: type = "AttributeError"; break; + case SWIG_NullReferenceError: + type = "NullReferenceError"; + break; default: type = "RuntimeError"; } @@ -51,15 +54,15 @@ SWIG_Tcl_SetErrorObj(Tcl_Interp *interp, const char *ctype, Tcl_Obj *obj) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, obj); - Tcl_SetErrorCode(interp, "SWIG", ctype, NULL); + Tcl_SetErrorCode(interp, "SWIG", ctype, (char *)NULL); } SWIGINTERN void SWIG_Tcl_SetErrorMsg(Tcl_Interp *interp, const char *ctype, const char *mesg) { Tcl_ResetResult(interp); - Tcl_SetErrorCode(interp, "SWIG", ctype, NULL); - Tcl_AppendResult(interp, ctype, " ", mesg, NULL); + Tcl_SetErrorCode(interp, "SWIG", ctype, (char *)NULL); + Tcl_AppendResult(interp, ctype, " ", mesg, (char *)NULL); /* Tcl_AddErrorInfo(interp, ctype); Tcl_AddErrorInfo(interp, " "); diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclfragments.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclfragments.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclfragments.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclfragments.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclinit.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclinit.swg similarity index 95% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclinit.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclinit.swg index 3140bdcd..eb9e3eca 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclinit.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/tcl/tclinterp.i b/macx64/bin/swig/share/swig/4.3.0/tcl/tclinterp.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclinterp.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclinterp.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclkw.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclkw.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclkw.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclkw.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclmacros.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclmacros.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclmacros.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclmacros.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclopers.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclopers.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclopers.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclopers.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclprimtypes.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclprimtypes.swg similarity index 88% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclprimtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclprimtypes.swg index 3b6d04f5..ddefa7db 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclprimtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclprimtypes.swg @@ -61,7 +61,7 @@ SWIG_From_dec(unsigned long)(unsigned long value) return SWIG_From(long)(%numeric_cast(value, long)); } else { char temp[256]; - sprintf(temp, "%lu", value); + SWIG_snprintf(temp, sizeof(temp), "%lu", value); return Tcl_NewStringObj(temp,-1); } } @@ -82,7 +82,7 @@ SWIG_AsVal_dec(unsigned long)(Tcl_Obj *obj, unsigned long *val) { get it as a string so we can distinguish these cases. */ } { - int len = 0; + Tcl_Size len = 0; const char *nptr = Tcl_GetStringFromObj(obj, &len); if (nptr && len > 0) { char *endptr; @@ -122,7 +122,7 @@ SWIG_From_dec(long long)(long long value) return SWIG_From(long)(%numeric_cast(value,long)); } else { char temp[256]; - sprintf(temp, "%lld", value); + SWIG_snprintf(temp, sizeof(temp), "%lld", value); return Tcl_NewStringObj(temp,-1); } } @@ -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; } @@ -180,7 +163,7 @@ SWIG_From_dec(unsigned long long)(unsigned long long value) return SWIG_From(long long)(%numeric_cast(value, long long)); } else { char temp[256]; - sprintf(temp, "%llu", value); + SWIG_snprintf(temp, sizeof(temp), "%llu", value); return Tcl_NewStringObj(temp,-1); } } @@ -200,7 +183,7 @@ SWIG_AsVal_dec(unsigned long long)(Tcl_Obj *obj, unsigned long long *val) if (val) *val = (unsigned long) v; return SWIG_OK; } else { - int len = 0; + Tcl_Size len = 0; const char *nptr = Tcl_GetStringFromObj(obj, &len); if (nptr && len > 0) { char *endptr; diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclresult.i b/macx64/bin/swig/share/swig/4.3.0/tcl/tclresult.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclresult.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclresult.i diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclrun.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclrun.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclrun.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclrun.swg index 9010b9c8..debbd091 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclrun.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclrun.swg @@ -67,8 +67,8 @@ #define SWIG_GetConstant SWIG_GetConstantObj #define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj -#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 5 -#define SWIG_TCL_HASHTABLE_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) +#define SWIG_TCL_HASHTABLE_INIT {0, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0} #else #define SWIG_TCL_HASHTABLE_INIT {0} #endif @@ -118,10 +118,13 @@ SWIG_Tcl_Disown(void *ptr) { return 0; } +SWIGRUNTIME void SWIG_Tcl_ObjectDelete(ClientData clientData); + /* Convert a pointer value */ 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; @@ -137,7 +140,7 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi /* from being called when c is not a command, firing the unknown proc */ if (Tcl_VarEval(interp,"info commands ", c, (char *) NULL) == TCL_OK) { Tcl_Obj *result = Tcl_GetObjResult(interp); - if (*(Tcl_GetStringFromObj(result, NULL)) == 0) { + if (*(Tcl_GetString(result)) == 0) { /* It's not a command, so it can't be a pointer */ Tcl_ResetResult(interp); return SWIG_ERROR; @@ -155,32 +158,55 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi return SWIG_ERROR; } - c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL); + c = Tcl_GetString(Tcl_GetObjResult(interp)); } + cmd_name = c; c++; c = SWIG_UnpackData(c,ptr,sizeof(void *)); + if (ty) { + Tcl_CmdInfo info; tc = c ? SWIG_TypeCheck(c,ty) : 0; if (!tc) { 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 */ + if (Tcl_GetCommandInfo(interp, cmd_name, &info)) { + /* When creating a pointer string, SWIG_Tcl_NewInstanceObj calls Tcl_CreateObjCommand and sets + * info.objClientData to an instance of swig_instance. Detecting when we can cast any info.objClientData + * to swig_instance is not simple as it may be an unrelated command; we use deleteProc to determine this. */ + if (info.deleteProc == SWIG_Tcl_ObjectDelete) { + 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 */ + } + } + } } } + return SWIG_OK; } /* Convert a pointer value */ SWIGRUNTIMEINLINE int SWIG_Tcl_ConvertPtr(Tcl_Interp *interp, Tcl_Obj *oc, void **ptr, swig_type_info *ty, int flags) { - return SWIG_Tcl_ConvertPtrFromString(interp, Tcl_GetStringFromObj(oc,NULL), ptr, ty, flags); + return SWIG_Tcl_ConvertPtrFromString(interp, Tcl_GetString(oc), ptr, ty, flags); } /* Convert a pointer value */ @@ -207,7 +233,7 @@ SWIG_Tcl_ConvertPacked(Tcl_Interp *SWIGUNUSEDPARM(interp) , Tcl_Obj *obj, void * const char *c; if (!obj) goto type_error; - c = Tcl_GetStringFromObj(obj,NULL); + c = Tcl_GetString(obj); /* Pointer values must start with leading underscore */ if (*c != '_') goto type_error; c++; @@ -306,7 +332,7 @@ SWIG_Tcl_ObjectDelete(ClientData clientData) { /* Function to invoke object methods given an instance */ SWIGRUNTIME int -SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST _objv[]) { +SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const _objv[]) { char *method, *attrname; swig_instance *inst = (swig_instance *) clientData; swig_method *meth; @@ -326,7 +352,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_ Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC); return TCL_ERROR; } - method = Tcl_GetStringFromObj(objv[1],NULL); + method = Tcl_GetString(objv[1]); if (strcmp(method,"-acquire") == 0) { inst->destroy = 1; SWIG_Acquire(inst->thisvalue); @@ -389,7 +415,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_ Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC); return TCL_ERROR; } - attrname = Tcl_GetStringFromObj(objv[2],NULL); + attrname = Tcl_GetString(objv[2]); attr = cls->attributes; while (attr && attr->name) { if ((strcmp(attr->name, attrname) == 0) && (attr->getmethod)) { @@ -423,7 +449,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_ } i = 2; while (i < objc) { - attrname = Tcl_GetStringFromObj(objv[i],NULL); + attrname = Tcl_GetString(objv[i]); attr = cls->attributes; while (attr && attr->name) { if ((strcmp(attr->name, attrname) == 0) && (attr->setmethod)) { @@ -490,19 +516,30 @@ 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)) { + name = Tcl_GetString(robj); + 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); newinst->thisvalue = thisvalue; newinst->classptr = (swig_class *) type->clientdata; newinst->destroy = flags; - newinst->cmdtok = Tcl_CreateObjCommand(interp, Tcl_GetStringFromObj(robj,NULL), (swig_wrapper_func) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete); + newinst->cmdtok = Tcl_CreateObjCommand(interp, Tcl_GetString(robj), (swig_wrapper_func) SWIG_Tcl_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_Tcl_ObjectDelete); 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; @@ -510,7 +547,7 @@ SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *typ /* Function to create objects */ SWIGRUNTIME int -SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { +SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *newObj = 0; void *thisvalue = 0; swig_instance *newinst = 0; @@ -527,7 +564,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, } cons = classptr->constructor; if (objc > 1) { - char *s = Tcl_GetStringFromObj(objv[1],NULL); + char *s = Tcl_GetString(objv[1]); if (strcmp(s,"-this") == 0) { thisarg = 2; cons = 0; @@ -539,7 +576,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, } else if (objc >= 3) { char *s1; name = s; - s1 = Tcl_GetStringFromObj(objv[2],NULL); + s1 = Tcl_GetString(objv[2]); if (strcmp(s1,"-this") == 0) { thisarg = 3; cons = 0; @@ -555,12 +592,12 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, return result; } newObj = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); - if (!name) name = Tcl_GetStringFromObj(newObj,NULL); + if (!name) name = Tcl_GetString(newObj); } else if (thisarg > 0) { if (thisarg < objc) { destroy = 0; newObj = Tcl_DuplicateObj(objv[thisarg]); - if (!name) name = Tcl_GetStringFromObj(newObj,NULL); + if (!name) name = Tcl_GetString(newObj); } else { Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC); return TCL_ERROR; @@ -582,7 +619,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, if (destroy) { SWIG_Acquire(thisvalue); } - newinst->cmdtok = Tcl_CreateObjCommand(interp,name, (swig_wrapper) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete); + newinst->cmdtok = Tcl_CreateObjCommand(interp,name, (swig_wrapper) SWIG_Tcl_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_Tcl_ObjectDelete); return TCL_OK; } @@ -590,7 +627,7 @@ SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, * Get arguments * -----------------------------------------------------------------------------*/ SWIGRUNTIME int -SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char *fmt, ...) { +SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *fmt, ...) { int argno = 0, opt = 0; long tempi; double tempd; @@ -619,7 +656,7 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char vptr = va_arg(ap,void *); if (vptr) { if (isupper(*c)) { - obj = SWIG_Tcl_GetConstantObj(Tcl_GetStringFromObj(objv[argno+1],0)); + obj = SWIG_Tcl_GetConstantObj(Tcl_GetString(objv[argno+1])); if (!obj) obj = objv[argno+1]; } else { obj = objv[argno+1]; @@ -643,15 +680,15 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char break; case 's': case 'S': if (*(c+1) == '#') { - int *vlptr = (int *) va_arg(ap, void *); + Tcl_Size *vlptr = (Tcl_Size *) va_arg(ap, void *); *((char **) vptr) = Tcl_GetStringFromObj(obj, vlptr); c++; } else { - *((char **)vptr) = Tcl_GetStringFromObj(obj,NULL); + *((char **)vptr) = Tcl_GetString(obj); } break; case 'c': case 'C': - *((char *)vptr) = *(Tcl_GetStringFromObj(obj,NULL)); + *((char *)vptr) = *(Tcl_GetString(obj)); break; case 'p': case 'P': ty = (swig_type_info *) va_arg(ap, void *); @@ -676,11 +713,11 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char argerror: { char temp[32]; - sprintf(temp,"%d", argno+1); + SWIG_snprintf(temp, sizeof(temp), "%d", argno+1); c = strchr(fmt,':'); if (!c) c = strchr(fmt,';'); if (!c) c = (char *)""; - Tcl_AppendResult(interp,c," argument ", temp, NULL); + Tcl_AppendResult(interp,c," argument ", temp, (char *)NULL); va_end(ap); return TCL_ERROR; } diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclruntime.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclruntime.swg similarity index 56% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclruntime.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclruntime.swg index bb4edd74..3b34a76c 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclruntime.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclruntime.swg @@ -6,6 +6,22 @@ #include #include #include + +/* Check, if Tcl version supports Tcl_Size, + which was introduced in Tcl 8.7 and 9. +*/ +#ifndef TCL_SIZE_MAX + #include + #define TCL_SIZE_MAX INT_MAX + + #ifndef Tcl_Size + typedef int Tcl_Size; + #endif + + #define TCL_SIZE_MODIFIER "" + #define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj + #define Tcl_NewSizeIntObj Tcl_NewIntObj +#endif %} %insert(runtime) "swigrun.swg"; /* Common C API type-checking code */ diff --git a/macx64/bin/swig/share/swig/4.3.0/tcl/tclsh.i b/macx64/bin/swig/share/swig/4.3.0/tcl/tclsh.i new file mode 100644 index 00000000..e908756c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclsh.i @@ -0,0 +1,52 @@ +/* ----------------------------------------------------------------------------- + * tclsh.i + * + * SWIG File for building new tclsh program + * ----------------------------------------------------------------------------- */ + +// This module provides the Tcl_AppInit() function needed to build a +// new version of the tclsh executable. This file should not be used +// when using dynamic loading. To make an interface file work with +// both static and dynamic loading, put something like this in your +// interface file : +// +// #ifdef STATIC +// %include +// #endif + +%{ + +/* A TCL_AppInit() function that lets you build a new copy + * of tclsh. + * + * The macro SWIG_init contains the name of the initialization + * function in the wrapper file. + */ + +#ifndef SWIG_RcFileName +char *SWIG_RcFileName = "~/.myapprc"; +#endif + + +int Tcl_AppInit(Tcl_Interp *interp){ + + if (Tcl_Init(interp) == TCL_ERROR) + return TCL_ERROR; + + /* Now initialize our functions */ + + if (SWIG_init(interp) == TCL_ERROR) + return TCL_ERROR; + Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); + + return TCL_OK; +} + +int main(int argc, char **argv) { + Tcl_Main(argc, argv, Tcl_AppInit); + return(0); + +} + +%} + diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclstrings.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclstrings.swg similarity index 85% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclstrings.swg index 540d6270..738c8136 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclstrings.swg @@ -6,7 +6,7 @@ SWIGINTERN int SWIG_AsCharPtrAndSize(Tcl_Obj *obj, char** cptr, size_t* psize, int *alloc) { - int len = 0; + Tcl_Size len = 0; char *cstr = Tcl_GetStringFromObj(obj, &len); if (cstr) { if (cptr) *cptr = cstr; @@ -24,7 +24,7 @@ SWIG_AsCharPtrAndSize(Tcl_Obj *obj, char** cptr, size_t* psize, int *alloc) SWIGINTERNINLINE Tcl_Obj * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { - return (size < INT_MAX) ? Tcl_NewStringObj(carray, %numeric_cast(size,int)) : NULL; + return (size < TCL_SIZE_MAX) ? Tcl_NewStringObj(carray, %numeric_cast(size,Tcl_Size)) : NULL; } } diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tcltypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tcltypemaps.swg similarity index 94% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tcltypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tcltypemaps.swg index ad31bcfc..66cce47e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tcltypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/tcl/tcluserdir.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tcluserdir.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tcluserdir.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tcluserdir.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/tclwstrings.swg b/macx64/bin/swig/share/swig/4.3.0/tcl/tclwstrings.swg similarity index 81% rename from macx64/bin/swig/share/swig/4.0.0/tcl/tclwstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/tcl/tclwstrings.swg index b3b682e3..76da2ab0 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/tclwstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/tclwstrings.swg @@ -12,14 +12,14 @@ SWIGINTERN int SWIG_AsWCharPtrAndSize(Tcl_Obj *obj, wchar_t** cptr, size_t* psize, int *alloc) { - int len = 0; + Tcl_Size len = 0; Tcl_UniChar *ustr = Tcl_GetUnicodeFromObj(obj, &len); if (ustr) { if (cptr) { Tcl_Encoding encoding = NULL; char *src = (char *) ustr; - int srcLen = (len)*sizeof(Tcl_UniChar); - int dstLen = sizeof(wchar_t)*(len + 1); + Tcl_Size srcLen = (len)*sizeof(Tcl_UniChar); + Tcl_Size dstLen = sizeof(wchar_t)*(len + 1); char *dst = %new_array(dstLen, char); int flags = 0; Tcl_EncodingState *statePtr = 0; @@ -29,6 +29,7 @@ SWIG_AsWCharPtrAndSize(Tcl_Obj *obj, wchar_t** cptr, size_t* psize, int *alloc) Tcl_UtfToExternal(0, encoding, src, srcLen, flags, statePtr, dst, dstLen, &srcRead, &dstWrote, &dstChars); + *cptr = (wchar_t*)dst; if (alloc) *alloc = SWIG_NEWOBJ; } if (psize) *psize = len + 1; @@ -43,11 +44,11 @@ SWIGINTERNINLINE Tcl_Obj * SWIG_FromWCharPtrAndSize(const wchar_t* carray, size_t size) { Tcl_Obj *res = NULL; - if (size < INT_MAX) { + if (size < TCL_SIZE_MAX) { Tcl_Encoding encoding = NULL; char *src = (char *) carray; - int srcLen = (int)(size*sizeof(wchar_t)); - int dstLen = (int)(size*sizeof(Tcl_UniChar)); + Tcl_Size srcLen = (Tcl_Size)(size*sizeof(wchar_t)); + Tcl_Size dstLen = (Tcl_Size)(size*sizeof(Tcl_UniChar)); char *dst = %new_array(dstLen, char); int flags = 0; Tcl_EncodingState *statePtr = 0; @@ -58,7 +59,7 @@ SWIG_FromWCharPtrAndSize(const wchar_t* carray, size_t size) Tcl_ExternalToUtf(0, encoding, src, srcLen, flags, statePtr, dst, dstLen, &srcRead, &dstWrote, &dstChars); - res = Tcl_NewUnicodeObj((Tcl_UniChar*)dst, (int)size); + res = Tcl_NewUnicodeObj((Tcl_UniChar*)dst, (Tcl_Size)size); %delete_array(dst); } return res; diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/tcl/typemaps.i similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/tcl/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/typemaps.i index 04a5c78f..4f42cfc2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/typemaps.i +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/typemaps.i @@ -164,14 +164,14 @@ or you can use the %apply directive : %typemap(in) long long *INPUT($*1_ltype temp), long long &INPUT($*1_ltype temp) { - temp = ($*1_ltype) strtoll(Tcl_GetStringFromObj($input,NULL),0,0); + temp = ($*1_ltype) strtoll(Tcl_GetString($input),0,0); $1 = &temp; } %typemap(in) unsigned long long *INPUT($*1_ltype temp), unsigned long long &INPUT($*1_ltype temp) { - temp = ($*1_ltype) strtoull(Tcl_GetStringFromObj($input,NULL),0,0); + temp = ($*1_ltype) strtoull(Tcl_GetString($input),0,0); $1 = &temp; } @@ -275,7 +275,7 @@ output values. { char temp[256]; Tcl_Obj *o; - sprintf(temp,"%lld",(long long)*($1)); + SWIG_snprintf(temp,sizeof(temp),"%lld",(long long)*($1)); o = Tcl_NewStringObj(temp,-1); Tcl_ListObjAppendElement(interp,Tcl_GetObjResult(interp),o); } @@ -284,7 +284,7 @@ output values. { char temp[256]; Tcl_Obj *o; - sprintf(temp,"%llu",(unsigned long long)*($1)); + SWIG_snprintf(temp,sizeof(temp),"%llu",(unsigned long long)*($1)); o = Tcl_NewStringObj(temp,-1); Tcl_ListObjAppendElement(interp,Tcl_GetObjResult(interp),o); } diff --git a/macx64/bin/swig/share/swig/4.0.0/tcl/wish.i b/macx64/bin/swig/share/swig/4.3.0/tcl/wish.i similarity index 61% rename from macx64/bin/swig/share/swig/4.0.0/tcl/wish.i rename to macx64/bin/swig/share/swig/4.3.0/tcl/wish.i index 260032a8..6969b2ac 100644 --- a/macx64/bin/swig/share/swig/4.0.0/tcl/wish.i +++ b/macx64/bin/swig/share/swig/4.3.0/tcl/wish.i @@ -4,25 +4,20 @@ * SWIG File for making wish * ----------------------------------------------------------------------------- */ -#ifdef AUTODOC -%subsection "wish.i" -%text %{ -This module provides the Tk_AppInit() function needed to build a -new version of the wish executable. Like tclsh.i, this file should -not be used with dynamic loading. To make an interface file work with -both static and dynamic loading, put something like this in your -interface file : - - #ifdef STATIC - %include - #endif - -A startup file may be specified by defining the symbol SWIG_RcFileName -as follows (this should be included in a code-block) : - - #define SWIG_RcFileName "~/.mywishrc" -%} -#endif +// This module provides the Tk_AppInit() function needed to build a +// new version of the wish executable. Like tclsh.i, this file should +// not be used with dynamic loading. To make an interface file work with +// both static and dynamic loading, put something like this in your +// interface file : +// +// #ifdef STATIC +// %include +// #endif +// +// A startup file may be specified by defining the symbol SWIG_RcFileName +// as follows (this should be included in a code-block) : +// +// #define SWIG_RcFileName "~/.mywishrc" %{ @@ -35,11 +30,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 +51,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 +82,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,35 +89,12 @@ int Tcl_AppInit(Tcl_Interp *interp) * then no user-specific startup file will be run under any conditions. */ -#if TCL_MAJOR_VERSION >= 8 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5 - Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); -#else - tcl_RcFileName = SWIG_RcFileName; -#endif - -/* 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/macx64/bin/swig/share/swig/4.0.0/typemaps/attribute.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/attribute.swg similarity index 52% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/attribute.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/attribute.swg index 98811399..abdf44df 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/attribute.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/attribute.swg @@ -7,132 +7,6 @@ /* The following macros convert a pair of set/get methods into a "native" attribute. - - Use %attribute when you have a pair of get/set methods to a primitive type - like in: - - %attribute(A, int, a, get_a, set_a); - - struct A - { - int get_a() const; - void set_a(int aa); - }; - - If you don't provide a 'set' method, a 'read-only' attribute - is generated, ie, like in: - - %attribute(A, int, c, get_c); - - Use %attributeref when you have const/non-const reference access methods - for primitive types or class/structs, like in: - - %attributeref(A, int, b); - - struct A - { - const int& b() const; - int& b(); - }; - - %attributeref(B, int, c); - - struct B - { - int& c(); - }; - - You can also use - - %attributeref(Class, AttributeType, AttributeName, AccessorMethod) - - if the internal C++ reference methods have a different name from the - attribute you want, so - - %attributeref(B, int, d, c); - - is the same as the last example, but instead of the attribute 'c' being - called 'c', it is called 'd'. - - Now you can use the attributes like so: - - x = A() - x.a = 3 # calls A::set_a - print x.a # calls A::get_a - - x.b = 3 # calls A::b() - print x.b # calls A::b() const - - Use %attribute2 instead of %attribute to indicate that reference-pointer - translation is required. You use %attribute2 instead of %attribute in - cases like this: - - %attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo); - %inline %{ - struct MyFoo { - int x; - }; - class MyClass { - MyFoo foo; - public: - MyFoo& GetFoo() { return foo; } - void SetFoo(const MyFoo& other) { foo = other; } - }; - %} - - Here, the data type of the property is a wrapped type (MyFoo) and on the - C++ side it is passed by reference. The problem is that the SWIG wrapper will - pass around a pointer (MyFoo *) which is not compatible with the reference - type of the accessors (MyFoo &). Therefore, if you use %attribute, you'll get - an error from your C/C++ compiler. %attribute2 translates between a pointer - and a reference to eliminate the error. In case you're confused, let's make it - simple: just use %attribute at first, but if the C/C++ compiler gives an error - while compiling the wrapper, try %attribute2 instead. - - NOTE: remember that if the type contains commas, such as 'std::pair', - you need to use the macro like: - - %attributeref(A, %arg(std::pair), pval); - - where %arg() 'normalizes' the type to be understood as a single - argument, otherwise the macro will get confused by the comma. - - The %attributeval is the same as %attribute, but should be used when the type - is a class/struct (ie a non-primitive type) and when the get and set methods - return/pass by value. The following is very similar to the above example, but - note that the access is by value rather than reference. - - %attributeval(MyClassVal, MyFoo, ReadWriteFoo, GetFoo, SetFoo); - %attributeval(MyClassVal, MyFoo, ReadOnlyFoo, GetFoo); - %inline %{ - class MyClassVal { - MyFoo foo; - public: - MyFoo GetFoo() { return foo; } - void SetFoo(MyFoo other) { foo = other; } - }; - %} - - The %attributestring is the same as %attributeval, but should be used for string - class types, which are unusual as they are a class on the C++ side, but normally an - immutable/primitive type in the target language. Example usage for std::string: - - %include - %attributestring(MyStringyClass, std::string, ReadWriteString, GetString, SetString); - %attributestring(MyStringyClass, std::string, ReadOnlyString, GetString); - %inline %{ - class MyStringyClass { - std::string str; - public: - MyStringyClass(const std::string &val) : str(val) {} - std::string GetString() { return str; } - void SetString(std::string other) { str = other; } - }; - %} - - The %attributestring also works for class types that have %naturalvar turned - on and so is also useful for shared_ptr which has %naturalvar turned on in %shared_ptr. - */ // @@ -224,20 +98,10 @@ #if #AccessorMethod != "" %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, &self_->AccessorMethod(), self_->AccessorMethod() = *val_) #else - %attribute_custom(%arg(Class), %arg(AttributeType), AccessorName, AccessorName, AccessorName, &self_->AccessorName(), self_->AccessorName() = *val_) + %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AttributeName, AttributeName, &self_->AttributeName(), self_->AttributeName() = *val_) #endif %enddef -// deprecated (same as %attributeref, but there is an argument order inconsistency) -%define %attribute_ref(Class, AttributeType, AccessorMethod, AttributeName...) - #if #AttributeName != "" - %attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_) - #else - %attribute_custom(%arg(Class), %arg(AttributeType), AccessorMethod, AccessorMethod, AccessorMethod, self_->AccessorMethod(), self_->AccessorMethod() = val_) - #endif -%enddef - - %define %attributeval(Class, AttributeType, AttributeName, GetMethod, SetMethod...) %{ #define %mangle(Class) ##_## AttributeName ## _get(self_) new AttributeType(self_->GetMethod()) diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/carrays.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/carrays.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/carrays.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/carrays.swg index 462d60bc..d02e70fa 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/carrays.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/carrays.swg @@ -11,10 +11,10 @@ * Generates functions for creating and accessing elements of a C array * (as pointers). Creates the following functions: * - * TYPE *new_NAME(int nelements) + * TYPE *new_NAME(size_t nelements) * void delete_NAME(TYPE *); - * TYPE NAME_getitem(TYPE *, int index); - * void NAME_setitem(TYPE *, int index, TYPE value); + * TYPE NAME_getitem(TYPE *, size_t index); + * void NAME_setitem(TYPE *, size_t index, TYPE value); * * ----------------------------------------------------------------------------- */ @@ -51,10 +51,10 @@ void NAME##_setitem(TYPE *ary, size_t index, TYPE value); * interface: * * struct NAME { - * NAME(int nelements); + * NAME(size_t nelements); * ~NAME(); - * TYPE getitem(int index); - * void setitem(int index, TYPE value); + * TYPE getitem(size_t index); + * void setitem(size_t index, TYPE value); * TYPE * cast(); * static NAME *frompointer(TYPE *t); * } diff --git a/macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_begin.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_begin.swg new file mode 100644 index 00000000..6e914f58 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_begin.swg @@ -0,0 +1,12 @@ +/* ----------------------------------------------------------------------------- + * cdata_begin.swg + * + * raw C data struct. + * ----------------------------------------------------------------------------- */ + +%{ +typedef struct SWIGCDATA { + char *data; + size_t len; +} SWIGCDATA; +%} diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/cdata.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_end.swg similarity index 72% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cdata.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_end.swg index 8597b7b0..83068735 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/cdata.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/cdata_end.swg @@ -1,37 +1,36 @@ /* ----------------------------------------------------------------------------- - * cdata.swg + * cdata_end.swg * - * This library file contains macros for manipulating raw C data as strings. + * This library file contains macros for manipulating raw C data. * ----------------------------------------------------------------------------- */ -%{ -typedef struct SWIGCDATA { - char *data; - size_t len; -} SWIGCDATA; -%} +/* ------------------------------------------------------------ + * Typemap for passing bytes with length + * ------------------------------------------------------------ */ +#ifndef SWIG_CDATA_APPLIED + +%apply (const void *BYTES, size_t LENGTH) { (const void *BYTES, int LENGTH) } +%apply (void *BYTES, size_t LENGTH) { (void *BYTES, int LENGTH) } +/* typemap for memmove() function */ +%apply (const void *BYTES, size_t LENGTH) { (const void *indata, size_t inlen) } + +#endif /* ----------------------------------------------------------------------------- * Typemaps for returning binary data * ----------------------------------------------------------------------------- */ -%typemap(out,noblock=1,fragment="SWIG_FromCharPtrAndSize") SWIGCDATA { - %set_output(SWIG_FromCharPtrAndSize($1.data,$1.len)); -} -%typemap(in) (const void *indata, size_t inlen) = (char *STRING, size_t SIZE); - - /* ----------------------------------------------------------------------------- - * %cdata(TYPE [, NAME]) + * %cdata(TYPE [, NAME]) * - * Convert raw C data to a binary string. + * Convert raw C data to binary * ----------------------------------------------------------------------------- */ %define %cdata(TYPE,NAME...) %insert("header") { #ifdef __cplusplus -extern "C" { +extern "C" { #endif #if #NAME == "" static SWIGCDATA cdata_##TYPE(TYPE *ptr, size_t nelements) @@ -70,7 +69,3 @@ SWIGCDATA cdata_##NAME(TYPE *ptr, size_t nelements = 1); /* Memory move function. Due to multi-argument typemaps this appears to be wrapped as void memmove(void *data, const char *s); */ void memmove(void *data, const void *indata, size_t inlen); - - - - diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/cmalloc.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cmalloc.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cmalloc.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cmalloc.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/cpointer.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cpointer.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cpointer.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cpointer.swg index 94bbbd6b..a5ac07d8 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/cpointer.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/cpointer.swg @@ -55,7 +55,7 @@ typedef struct { return %new_instance(TYPE); } ~NAME() { - if ($self) %delete($self); + %delete($self); } } @@ -105,7 +105,7 @@ typedef struct { %define %pointer_functions(TYPE,NAME) %{ - static TYPE *new_##NAME() { + static TYPE *new_##NAME(void) { return %new_instance(TYPE); } @@ -114,7 +114,7 @@ typedef struct { } static void delete_##NAME(TYPE *obj) { - if (obj) %delete(obj); + %delete(obj); } static void NAME ##_assign(TYPE *obj, TYPE value) { @@ -126,7 +126,7 @@ typedef struct { } %} -TYPE *new_##NAME(); +TYPE *new_##NAME(void); TYPE *copy_##NAME(TYPE value); void delete_##NAME(TYPE *obj); void NAME##_assign(TYPE *obj, TYPE value); diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/cstring.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cstring.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cstring.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cstring.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/cstrings.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cstrings.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cstrings.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cstrings.swg index 0aca6110..332f9f85 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/cstrings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/cstrings.swg @@ -50,7 +50,7 @@ * * %cstring_bounded_output(Char *outx, 512); * void foo(Char *outx) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } * */ @@ -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); @@ -175,7 +175,7 @@ * * %cstring_output_maxsize(Char *outx, int max) { * void foo(Char *outx, int max) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } */ @@ -205,7 +205,7 @@ * * %cstring_output_withsize(Char *outx, int *max) { * void foo(Char *outx, int *max) { - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * *max = strlen(outx); * } */ @@ -236,10 +236,10 @@ * This macro is used to return Character data that was * allocated with new or malloc. * - * %cstring_output_allocate(Char **outx, free($1)); + * %cstring_output_allocate(Char **outx, free(*$1)); * void foo(Char **outx) { * *outx = (Char *) malloc(512); - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * } */ @@ -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)); @@ -263,10 +263,10 @@ * This macro is used to return Character data that was * allocated with new or malloc. * - * %cstring_output_allocate_size(Char **outx, int *sz, free($1)); + * %cstring_output_allocate_size(Char **outx, int *sz, free(*$1)); * void foo(Char **outx, int *sz) { * *outx = (Char *) malloc(512); - * sprintf(outx,"blah blah\n"); + * strcpy(outx,"blah blah\n"); * *sz = strlen(outx); * } */ @@ -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/macx64/bin/swig/share/swig/4.0.0/typemaps/cwstring.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/cwstring.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/cwstring.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/cwstring.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/enumint.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/enumint.swg similarity index 99% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/enumint.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/enumint.swg index d048bb6b..b7e2956a 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/enumint.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/enumint.swg @@ -29,7 +29,7 @@ %typemap(varin,fragment=SWIG_AsVal_frag(int),noblock=1) enum SWIGTYPE { if (sizeof(int) != sizeof($1)) { %variable_fail(SWIG_AttributeError,"$type", "arch, read-only $name"); - } else { + } else { int ecode = SWIG_AsVal(int)($input, %reinterpret_cast(&$1,int*)); if (!SWIG_IsOK(ecode)) { %variable_fail(ecode, "$type", "$name"); diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/exception.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/exception.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/exception.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/exception.swg index b60a3299..aece8326 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/exception.swg +++ b/macx64/bin/swig/share/swig/4.3.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) @@ -30,7 +31,7 @@ %define_as(SWIG_exception_fail(code, msg), %block(%error(code, msg); SWIG_fail)) -%define_as(SWIG_contract_assert(expr, msg), if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } else) +%define_as(SWIG_contract_assert(expr, msg), do { if (!(expr)) { %error(SWIG_RuntimeError, msg); SWIG_fail; } } while (0)) } diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/factory.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/factory.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/factory.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/factory.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/fragments.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/fragments.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/fragments.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/fragments.swg index e83f415c..789b649e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/fragments.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/fragments.swg @@ -14,7 +14,7 @@ SWIG_From_dec(bool)(bool value) { PyObject *obj = value ? Py_True : Py_False; - Py_INCREF(obj); + SWIG_Py_INCREF(obj); return obj; } } @@ -120,10 +120,6 @@ inline int SWIG_isfinite_func(T x) { # define SWIG_isfinite(X) (SWIG_isfinite_func(X)) # elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) # define SWIG_isfinite(X) (__builtin_isfinite(X)) -# elif defined(__clang__) && defined(__has_builtin) -# if __has_builtin(__builtin_isfinite) -# define SWIG_isfinite(X) (__builtin_isfinite(X)) -# endif # elif defined(_MSC_VER) # define SWIG_isfinite(X) (_finite(X)) # elif defined(__sun) && defined(__SVR4) diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/implicit.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/implicit.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/implicit.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/implicit.swg index 2fc3108e..5536e0a2 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/implicit.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/implicit.swg @@ -27,7 +27,7 @@ get(2.0) ==> get(A(2.0)) get(B()) ==> get(A(B())) - and swig will construct an 'A' temporal variable using the + and swig will construct an 'A' temporary variable using the corresponding implicit constructor. diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/inoutlist.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/inoutlist.swg similarity index 92% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/inoutlist.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/inoutlist.swg index 23fda85f..09f7b4e8 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/inoutlist.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/inoutlist.swg @@ -77,23 +77,11 @@ or you can use the %apply directive : #endif %define %_value_input_typemap(code, asval_meth, asval_frag, Type) - %typemap(in,noblock=1,fragment=asval_frag) Type *INPUT ($*ltype temp, int res = 0) { - if (!%check_input_ptr($input,&$1,$descriptor,$disown)) { - Type val; - int ecode = asval_meth($input, &val); - if (!SWIG_IsOK(ecode)) { - %argument_fail(ecode, "$*ltype",$symname, $argnum); - } - temp = %static_cast(val, $*ltype); - $1 = &temp; - res = SWIG_AddTmpMask(ecode); - } - } - %typemap(in,noblock=1,fragment=asval_frag) Type &INPUT($*ltype temp, int res = 0) { + %typemap(in,noblock=1,fragment=asval_frag) Type *INPUT ($*ltype temp, int res = 0), Type &INPUT($*ltype temp, int res = 0) { if (!%check_input_ptr($input,&$1,$descriptor,$disown)) { Type val; int ecode = asval_meth($input, &val); - if (!SWIG_IsOK(ecode)) { + if (!SWIG_IsOK(ecode)) { %argument_fail(ecode, "$*ltype",$symname, $argnum); } temp = %static_cast(val, $*ltype); @@ -115,19 +103,19 @@ or you can use the %apply directive : %enddef %define %_ptr_input_typemap(code,asptr_meth,asptr_frag,Type) - %typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res = 0) { + %typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res = 0) { res = asptr_meth($input, &$1); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type",$symname, $argnum); } res = SWIG_AddTmpMask(res); } - %typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res = 0) { + %typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res = 0) { res = asptr_meth($input, &$1); - if (!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { %argument_fail(res,"$type",$symname, $argnum); - } - if (!$1) { + } + if (!$1) { %argument_nullref("$type",$symname, $argnum); } res = SWIG_AddTmpMask(res); @@ -145,13 +133,12 @@ or you can use the %apply directive : // are output only. The output value is appended to the result as // a list element. -/* +/* The following methods can be applied to turn a pointer into an "output" value. When calling a function, no input value would be given for a parameter, but an output value would be returned. In the case of multiple output values, they are returned in the form of a list. - For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and returns the integer part in one of its parameters): @@ -221,10 +208,6 @@ this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ %define %_value_inout_typemap(Type) diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/misctypes.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/misctypes.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/misctypes.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/misctypes.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/primtypes.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/primtypes.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/primtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/primtypes.swg index dd80eb77..85a0b8d9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/primtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/primtypes.swg @@ -252,9 +252,11 @@ SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max) { double x = *d; if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + double fx, cx, rd; + errno = 0; + fx = floor(x); + cx = ceil(x); + rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ if ((errno == EDOM) || (errno == ERANGE)) { errno = 0; } else { diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/ptrtypes.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/ptrtypes.swg similarity index 85% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/ptrtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/ptrtypes.swg index e8439e6d..8619b318 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/ptrtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.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); @@ -183,14 +183,34 @@ %ptr_input_typemap(%arg(CheckCode),%arg(AsPtrMeth),%arg(AsPtrFrag),Type); %enddef +/*--------------------------------------------------------------------- + * typemap definition for types with from method for ptr types + * Same as typemaps_from but without varout typemap + *---------------------------------------------------------------------*/ + +%define %ptr_typemaps_from(FromMeth, FromFrag, Type...) + %value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type); + /* No varout typemap */ + %value_constcode_typemap(%arg(FromMeth), %arg(FromFrag), Type); + %value_directorin_typemap(%arg(FromMeth), %arg(FromFrag), Type); + %value_throws_typemap(%arg(FromMeth), %arg(FromFrag), Type); + %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type); +%enddef + /*--------------------------------------------------------------------- * typemap definition for types with asptr/from methods *---------------------------------------------------------------------*/ %define %typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...) + %typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type) + %ptr_typemaps_from(%arg(FromMeth), %arg(FromFrag), Type); + %ptr_inout_typemap(Type); +%enddef + +// Same as typemaps_asptrfrom but defines a varout typemap to wrap with value semantics instead of the default pointer semantics +%define %_typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...) %typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type) %typemaps_from(%arg(FromMeth), %arg(FromFrag), Type); - %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type); %ptr_inout_typemap(Type); %enddef @@ -199,7 +219,7 @@ *---------------------------------------------------------------------*/ %define %typemaps_asptrfromn(CheckCode, Type...) -%typemaps_asptrfrom(%arg(CheckCode), +%_typemaps_asptrfrom(%arg(CheckCode), %arg(SWIG_AsPtr(Type)), %arg(SWIG_From(Type)), %arg(SWIG_AsPtr_frag(Type)), diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/std_except.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_except.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/std_except.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/std_except.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/std_string.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_string.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/std_string.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/std_string.swg diff --git a/macx64/bin/swig/share/swig/4.3.0/typemaps/std_string_view.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_string_view.swg new file mode 100644 index 00000000..24f57c6c --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_string_view.swg @@ -0,0 +1,16 @@ +// +// string_view +// + + +%include + +%fragment(""); + +namespace std +{ + %naturalvar string_view; + class string_view; +} + +%typemaps_std_string_view(std::string_view, char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, %checkcode(STRINGVIEW)); diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/std_strings.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_strings.swg similarity index 67% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/std_strings.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/std_strings.swg index e9c23ba9..28ef5e48 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/std_strings.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_strings.swg @@ -17,12 +17,8 @@ SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val) return SWIG_OLDOBJ; } } else { - static int init = 0; - static swig_type_info* descriptor = 0; - if (!init) { - descriptor = SWIG_TypeQuery(#String " *"); - init = 1; - } + %error_clear; + static swig_type_info *descriptor = SWIG_TypeQuery(#String " *"); if (descriptor) { String *vptr; int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0); @@ -45,6 +41,16 @@ SWIG_From_dec(String)(const String& s) } %enddef +%define %std_string_view_from(String, SWIG_FromCharPtrAndSize, Frag) +%fragment(SWIG_From_frag(String),"header",fragment=Frag) { +SWIGINTERNINLINE SWIG_Object +SWIG_From_dec(String)(const String& s) +{ + return SWIG_FromCharPtrAndSize(s.data() ? s.data() : "", s.size()); +} +} +%enddef + %define %std_string_asval(String) %fragment(SWIG_AsVal_frag(String),"header", fragment=SWIG_AsPtr_frag(String)) { SWIGINTERN int @@ -76,3 +82,18 @@ SWIG_AsVal_dec(String)(SWIG_Object obj, String *val) %typemaps_asptrfromn(%arg(CheckCode), String); %enddef + + +/* An empty string_view returns NULL from data() but SWIG_FromCharPtrAndSize() + * implementations treat that as invalid and return None/Null/undef or similar + * in the target language so we can't just use %typemaps_std_string. + */ +%define %typemaps_std_string_view(String, Char, AsPtrMethod, FromMethod, CheckCode) + +%std_string_asptr(String, Char, AsPtrMethod, #AsPtrMethod) +%std_string_asval(String) +%std_string_view_from(String, FromMethod, #FromMethod) + +%typemaps_asptrfromn(%arg(CheckCode), String); + +%enddef diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/std_wstring.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/std_wstring.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/std_wstring.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/std_wstring.swg diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/string.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/string.swg similarity index 93% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/string.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/string.swg index 4b707236..59548d8e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/string.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/string.swg @@ -7,11 +7,9 @@ SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { - static int init = 0; static swig_type_info* info = 0; - if (!init) { + if (!info) { info = SWIG_TypeQuery("_p_char"); - init = 1; } return info; } @@ -30,6 +28,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/macx64/bin/swig/share/swig/4.0.0/typemaps/strings.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/strings.swg similarity index 86% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/strings.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/strings.swg index 87e97dd7..339d4a67 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/strings.swg +++ b/macx64/bin/swig/share/swig/4.3.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] @@ -413,8 +414,7 @@ /* Here len doesn't include the '0' terminator */ %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) - (Char *STRING, size_t LENGTH) (int res, Char *buf = 0, size_t size = 0, int alloc = 0), - (const Char *STRING, size_t LENGTH) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) + (Char *STRING, size_t LENGTH) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) { res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc); if (!SWIG_IsOK(res)) { @@ -426,81 +426,74 @@ %typemap(freearg,noblock=1,match="in") (Char *STRING, size_t LENGTH) { if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum); } +%typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtrAndSize) + (Char *STRING, size_t LENGTH) +{ + if ($1 && $2 > 0) { + $input = SWIG_FromCharPtrAndSize((const char*)$1, (size_t)$2); + } else { + $input = SWIG_FromCharPtrAndSize("", 0); + } +} + +%typemap(in) (const Char *STRING, size_t LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(freearg) (const Char *STRING, size_t LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(directorin) (const Char *STRING, size_t LENGTH) = (Char *STRING, size_t LENGTH); + /* old 'int' form */ %typemap(in) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); %typemap(freearg) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(directorin) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(in) (const Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(freearg) (const Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); +%typemap(directorin) (const Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH); +/* reverse order typemap */ -/* Here size includes the '0' terminator */ %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) - (Char *STRING, size_t SIZE) (int res, Char *buf = 0, size_t size = 0, int alloc = 0), - (const Char *STRING, size_t SIZE) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) + (size_t LENGTH, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) { res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type",$symname, $argnum); } - $1 = %reinterpret_cast(buf, $1_ltype); - $2 = %numeric_cast(size, $2_ltype); + $2 = %reinterpret_cast(buf, $2_ltype); + $1 = %numeric_cast(size - 1, $1_ltype); } -%typemap(freearg,noblock=1,match="in") (Char *STRING, size_t SIZE) { +%typemap(freearg,noblock=1,match="in") (size_t LENGTH, Char *STRING) { if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum); } -/* old 'int' form */ -%typemap(in) (Char *STRING, int SIZE) = (Char *STRING, size_t SIZE); -%typemap(freearg) (Char *STRING, int SIZE) = (Char *STRING, size_t SIZE); - - -/* reverse order versions */ - -/* Here len doesn't include the '0' terminator */ -%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) - (size_t LENGTH, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0), - (size_t LENGTH, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) +%typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtrAndSize) + (size_t LENGTH, Char *STRING) { - res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc); - if (!SWIG_IsOK(res)) { - %argument_fail(res,"$type",$symname, $argnum); - } - $2 = %reinterpret_cast(buf, $2_ltype) ; - $1 = %numeric_cast(size - 1, $1_ltype) ; -} -%typemap(freearg, noblock=1, match="in") (size_t LENGTH, Char *STRING) { - if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum); + if ($2 && $1 > 0) { + $input = SWIG_FromCharPtrAndSize((const char*)$2, (size_t)$1); + } else { + $input = SWIG_FromCharPtrAndSize("", 0); + } } + +%typemap(in) (size_t LENGTH, const Char *STRING) = (Char *STRING, size_t LENGTH); +%typemap(freearg) (size_t LENGTH, const Char *STRING) = (Char *STRING, size_t LENGTH); +%typemap(directorin) (size_t LENGTH, const Char *STRING) = (Char *STRING, size_t LENGTH); + /* old 'int' form */ %typemap(in) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING); %typemap(freearg) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING); - -/* Here size includes the '0' terminator */ -%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) - (size_t SIZE, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0), - (size_t SIZE, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0) -{ - res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type",$symname, $argnum); - } - $2 = %reinterpret_cast(buf, $2_ltype) ; - $1 = %numeric_cast(size, $1_ltype) ; -} -%typemap(freearg, noblock=1, match="in") (size_t SIZE, Char *STRING) { - if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum); -} -/* old 'int' form */ -%typemap(in) (int SIZE, Char *STRING) = (size_t SIZE, Char *STRING); -%typemap(freearg) (int SIZE, Char *STRING) = (size_t SIZE, Char *STRING); - +%typemap(directorin) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING); +%typemap(in) (int LENGTH, const Char *STRING) = (size_t LENGTH, Char *STRING); +%typemap(freearg) (int LENGTH, const Char *STRING) = (size_t LENGTH, Char *STRING); +%typemap(directorin) (int LENGTH, const Char *STRING) = (size_t LENGTH, Char *STRING); %enddef - /* ------------------------------------------------------------ * --- String fragment methods --- * ------------------------------------------------------------ */ #ifndef %_typemap2_string %define %_typemap2_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -591,6 +584,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) %_typemap_string(StringCode, Char, + WarningLeakMsg, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, @@ -609,6 +603,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) * ------------------------------------------------------------ */ %define %typemaps_string(StringCode, CharCode, + WarningLeakMsg, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, @@ -616,6 +611,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 +627,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 +637,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/macx64/bin/swig/share/swig/4.0.0/typemaps/swigmacros.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigmacros.swg similarity index 97% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/swigmacros.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/swigmacros.swg index 687b0680..b772eb04 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/swigmacros.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigmacros.swg @@ -109,16 +109,6 @@ nocppval #endif %enddef -/* 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 - - - /* ----------------------------------------------------------------------------- * Casting operators * ----------------------------------------------------------------------------- */ diff --git a/macx64/bin/swig/share/swig/4.3.0/typemaps/swigmove.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigmove.swg new file mode 100644 index 00000000..656e1410 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigmove.swg @@ -0,0 +1,21 @@ +/* ----------------------------------------------------------------------------- + * 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); +} + +%typemap(typecheck) SWIGTYPE MOVE = SWIGTYPE; diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/swigobject.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigobject.swg similarity index 83% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/swigobject.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/swigobject.swg index b1e6dc9d..26c6ba8e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/swigobject.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/typemaps/swigtype.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigtype.swg similarity index 88% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/swigtype.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/swigtype.swg index 581de1a9..ba8ce3c1 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/swigtype.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigtype.swg @@ -9,7 +9,7 @@ } $1 = %reinterpret_cast(argp, $ltype); } -%typemap(freearg) SWIGTYPE * ""; +%typemap(freearg) SWIGTYPE * "" %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) { res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); @@ -18,7 +18,7 @@ } $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) { @@ -29,7 +29,7 @@ temp = %reinterpret_cast(argp, $*ltype); $1 = %reinterpret_cast(&temp, $1_ltype); } -%typemap(freearg) SWIGTYPE *const& ""; +%typemap(freearg) SWIGTYPE *const& "" /* Reference */ @@ -41,7 +41,7 @@ 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) { @@ -56,51 +56,23 @@ { if (SWIG_IsNewObj(res$argnum)) %delete($1); } -#else -%typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) { - 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); -} #endif /* Rvalue reference */ -%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) { - res = SWIG_ConvertPtr($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_ConvertPtr($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_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); -} -#endif +%typemap(freearg) SWIGTYPE && "" /* By value */ #if defined(__cplusplus) && defined(%implicitconv_flag) @@ -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 --- @@ -194,12 +172,8 @@ if ($input) { size_t ii = 0; for (; ii < (size_t)$1_dim0; ++ii) { - if ($input[ii]) { - size_t jj = 0; - for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; - } else { - %variable_nullref("$type","$name"); - } + size_t jj = 0; + for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; } } else { %variable_nullref("$type","$name"); @@ -210,12 +184,8 @@ if ($input) { size_t ii = 0; for (; ii < (size_t)$1_dim0; ++ii) { - if ($input[ii]) { - size_t jj = 0; - for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; - } else { - %variable_nullref("$type","$name"); - } + size_t jj = 0; + for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; } } else { %variable_nullref("$type","$name"); @@ -230,12 +200,8 @@ } else if (inp) { size_t ii = 0; for (; ii < (size_t)$1_dim0; ++ii) { - if (inp[ii]) { - size_t jj = 0; - for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj]; - } else { - %variable_nullref("$type", "$name"); - } + size_t jj = 0; + for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj]; } } else { %variable_nullref("$type", "$name"); @@ -389,6 +355,7 @@ 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_ConvertPtr($input, &vptr, $descriptor, SWIG_POINTER_NO_NULL); @@ -411,7 +378,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 * { @@ -534,7 +501,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 * { @@ -562,29 +529,29 @@ * ------------------------------------------------------------ */ %typemap(in) SWIGTYPE (CLASS::*) { - int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor); + int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1),$descriptor); if (!SWIG_IsOK(res)) { %argument_fail(res,"$type",$symname, $argnum); } } %typemap(out,noblock=1) SWIGTYPE (CLASS::*) { - %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); + %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor)); } %typemap(varin) SWIGTYPE (CLASS::*) { - int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor); + int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } } %typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { - %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); + %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor)); } %typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) { - %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor)); + %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($value), $descriptor)); } #if defined(SWIG_DIRECTOR_TYPEMAPS) @@ -592,13 +559,13 @@ /* directorin */ %typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) { - $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor); + $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor); } /* directorout */ %typemap(directorout) SWIGTYPE (CLASS::*) { - int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor); + int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($result), $descriptor); if (!SWIG_IsOK(swig_res)) { %dirout_fail(swig_res,"$type"); } @@ -703,9 +670,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/macx64/bin/swig/share/swig/4.0.0/typemaps/swigtypemaps.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigtypemaps.swg similarity index 91% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/swigtypemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/swigtypemaps.swg index 4e5bb2b0..0c95c2f9 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/swigtypemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/swigtypemaps.swg @@ -121,6 +121,12 @@ #endif #endif +/*==== clear errors ====*/ + +#ifndef %error_clear +#define %error_clear +#endif + /*==== director output exception ====*/ #if defined(SWIG_DIRECTOR_TYPEMAPS) @@ -137,13 +143,14 @@ #define %error_block(Block...) %block(Block) #define %default_code(code) SWIG_ArgError(code) #define %argument_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %argfail_fmt(type, name, argn)) -#define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn)) +#define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_NullReferenceError, %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 %variable_nullref(type, name) SWIG_exception_fail(SWIG_NullReferenceError, %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)) -#define %dirout_nullref(type) SWIG_DirOutFail(SWIG_ValueError, %outnullref_fmt(type)) +#define %dirout_nullref(type) SWIG_DirOutFail(SWIG_NullReferenceError, %outnullref_fmt(type)) #endif /* ----------------------------------------------------------------------------- diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/typemaps.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/typemaps.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/typemaps.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/typemaps.swg index 4629e8df..7d013b04 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/typemaps.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/typemaps.swg @@ -140,10 +140,6 @@ to a Tcl variable you might do this : x = neg(x) -Note : previous versions of SWIG used the symbol 'BOTH' to mark -input/output arguments. This is still supported, but will be slowly -phased out in future releases. - */ diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/valtypes.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/valtypes.swg similarity index 98% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/valtypes.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/valtypes.swg index 11eac598..7623ff04 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/valtypes.swg +++ b/macx64/bin/swig/share/swig/4.3.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 */ @@ -180,6 +180,7 @@ /*--------------------------------------------------------------------- * typemap definition for types with from method *---------------------------------------------------------------------*/ + %define %typemaps_from(FromMeth, FromFrag, Type...) %value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type); %value_varout_typemap(%arg(FromMeth), %arg(FromFrag), Type); @@ -191,7 +192,7 @@ /*--------------------------------------------------------------------- - * typemap definition for types with alval/from method + * typemap definition for types with asval/from method *---------------------------------------------------------------------*/ %define %typemaps_asvalfrom(CheckCode, AsValMeth, FromMeth, diff --git a/macx64/bin/swig/share/swig/4.0.0/typemaps/void.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/void.swg similarity index 96% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/void.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/void.swg index bbd68ed8..795992bf 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/void.swg +++ b/macx64/bin/swig/share/swig/4.3.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/macx64/bin/swig/share/swig/4.0.0/typemaps/wstring.swg b/macx64/bin/swig/share/swig/4.3.0/typemaps/wstring.swg similarity index 89% rename from macx64/bin/swig/share/swig/4.0.0/typemaps/wstring.swg rename to macx64/bin/swig/share/swig/4.3.0/typemaps/wstring.swg index cd409d1c..25d2f77e 100644 --- a/macx64/bin/swig/share/swig/4.0.0/typemaps/wstring.swg +++ b/macx64/bin/swig/share/swig/4.3.0/typemaps/wstring.swg @@ -8,11 +8,9 @@ SWIGINTERN swig_type_info* SWIG_pwchar_descriptor() { - static int init = 0; - static swig_type_info* info = 0; - if (!init) { + static swig_type_info *info = 0; + if (!info) { info = SWIG_TypeQuery("_p_wchar_t"); - init = 1; } return info; } @@ -31,6 +29,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/macx64/bin/swig/share/swig/4.3.0/unique_ptr.swg b/macx64/bin/swig/share/swig/4.3.0/unique_ptr.swg new file mode 100644 index 00000000..a3503831 --- /dev/null +++ b/macx64/bin/swig/share/swig/4.3.0/unique_ptr.swg @@ -0,0 +1,22 @@ +/* ----------------------------------------------------------------------------- + * unique_ptr.swg + * + * Common std::unique_ptr support. + * Not for direct inclusion. + * ----------------------------------------------------------------------------- */ + + +%fragment("SwigNoDeleteUniquePtr", "header", fragment="") { +namespace swig { + template + struct NoDeleteUniquePtr { + std::unique_ptr uptr; + NoDeleteUniquePtr(T *p = 0) : uptr(p) {} + ~NoDeleteUniquePtr() {uptr.release();} + }; +} +} + +namespace std { + template class unique_ptr {}; +} diff --git a/macx64/bin/swig/share/swig/4.0.0/wchar.i b/macx64/bin/swig/share/swig/4.3.0/wchar.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/wchar.i rename to macx64/bin/swig/share/swig/4.3.0/wchar.i diff --git a/macx64/bin/swig/share/swig/4.0.0/windows.i b/macx64/bin/swig/share/swig/4.3.0/windows.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/windows.i rename to macx64/bin/swig/share/swig/4.3.0/windows.i diff --git a/macx64/bin/swig/share/swig/4.0.0/xml/typemaps.i b/macx64/bin/swig/share/swig/4.3.0/xml/typemaps.i similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/xml/typemaps.i rename to macx64/bin/swig/share/swig/4.3.0/xml/typemaps.i diff --git a/macx64/bin/swig/share/swig/4.0.0/xml/xml.swg b/macx64/bin/swig/share/swig/4.3.0/xml/xml.swg similarity index 100% rename from macx64/bin/swig/share/swig/4.0.0/xml/xml.swg rename to macx64/bin/swig/share/swig/4.3.0/xml/xml.swg