Merge branch 'master' of https://github.com/swig/swig into Cmerge
This commit is contained in:
commit
5a06ca1ed7
312 changed files with 10813 additions and 7218 deletions
|
|
@ -1,286 +0,0 @@
|
|||
/* Define a C preprocessor symbol that can be used in interface files
|
||||
to distinguish between the SWIG language modules. */
|
||||
|
||||
#define SWIG_CFFI
|
||||
|
||||
/* Typespecs for basic types. */
|
||||
|
||||
%typemap(cin) void ":void"
|
||||
|
||||
%typemap(cin) char ":char"
|
||||
%typemap(cin) char * ":string"
|
||||
%typemap(cin) unsigned char ":unsigned-char"
|
||||
%typemap(cin) signed char ":char"
|
||||
|
||||
%typemap(cin) short ":short"
|
||||
%typemap(cin) signed short ":short"
|
||||
%typemap(cin) unsigned short ":unsigned-short"
|
||||
|
||||
%typemap(cin) int ":int"
|
||||
%typemap(cin) signed int ":int"
|
||||
%typemap(cin) unsigned int ":unsigned-int"
|
||||
|
||||
%typemap(cin) long ":long"
|
||||
%typemap(cin) signed long ":long"
|
||||
%typemap(cin) unsigned long ":unsigned-long"
|
||||
|
||||
%typemap(cin) long long ":long-long"
|
||||
%typemap(cin) signed long long ":long-long"
|
||||
%typemap(cin) unsigned long long ":unsigned-long-long"
|
||||
|
||||
%typemap(cin) float ":float"
|
||||
%typemap(cin) double ":double"
|
||||
%typemap(cin) SWIGTYPE ":pointer"
|
||||
|
||||
%typemap(cout) void ":void"
|
||||
|
||||
%typemap(cout) char ":char"
|
||||
%typemap(cout) char * ":string"
|
||||
%typemap(cout) unsigned char ":unsigned-char"
|
||||
%typemap(cout) signed char ":char"
|
||||
|
||||
%typemap(cout) short ":short"
|
||||
%typemap(cout) signed short ":short"
|
||||
%typemap(cout) unsigned short ":unsigned-short"
|
||||
|
||||
%typemap(cout) int ":int"
|
||||
%typemap(cout) signed int ":int"
|
||||
%typemap(cout) unsigned int ":unsigned-int"
|
||||
|
||||
%typemap(cout) long ":long"
|
||||
%typemap(cout) signed long ":long"
|
||||
%typemap(cout) unsigned long ":unsigned-long"
|
||||
|
||||
%typemap(cout) long long ":long-long"
|
||||
%typemap(cout) signed long long ":long-long"
|
||||
%typemap(cout) unsigned long long ":unsigned-long-long"
|
||||
|
||||
%typemap(cout) float ":float"
|
||||
%typemap(cout) double ":double"
|
||||
%typemap(cout) SWIGTYPE ":pointer"
|
||||
|
||||
|
||||
%typemap(ctype) bool "int"
|
||||
%typemap(ctype) char, unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype";
|
||||
%typemap(ctype) SWIGTYPE "$&1_type"
|
||||
|
||||
%typemap(in) bool "$1 = (bool)$input;"
|
||||
%typemap(in) char, unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
|
||||
%typemap(in) SWIGTYPE "$1 = *$input;"
|
||||
|
||||
%typemap(out) void ""
|
||||
%typemap(out) bool "$result = (int)$1;"
|
||||
%typemap(out) char, unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
%typemap(out) SWIGTYPE
|
||||
%{ $result = new $1_ltype($1); %}
|
||||
#else
|
||||
%typemap(out) SWIGTYPE {
|
||||
$result = ($&1_ltype) malloc(sizeof($1_type));
|
||||
memmove($result, &$1, sizeof($1_type));
|
||||
}
|
||||
#endif
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_INTEGER)
|
||||
unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
enum SWIGTYPE { $1 = 1; };
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
|
||||
SWIGTYPE[ANY], SWIGTYPE { $1 = 1; };
|
||||
/* This maps C/C++ types to Lisp classes for overload dispatch */
|
||||
|
||||
%typemap(lisptype) bool "cl:boolean"
|
||||
%typemap(lisptype) char "cl:character"
|
||||
%typemap(lisptype) unsigned char "cl:integer"
|
||||
%typemap(lisptype) signed char "cl:integer"
|
||||
|
||||
%typemap(lispclass) bool "t"
|
||||
%typemap(lispclass) char "cl:character"
|
||||
%typemap(lispclass) unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
enum SWIGTYPE "cl:integer";
|
||||
/* CLOS methods can't be specialized on single-float or double-float */
|
||||
%typemap(lispclass) float "cl:number"
|
||||
%typemap(lispclass) double "cl:number"
|
||||
%typemap(lispclass) char * "cl:string"
|
||||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
%{
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN extern "C"
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
#define EXPORT EXTERN SWIGEXPORT
|
||||
|
||||
#include <string.h>
|
||||
%}
|
||||
|
||||
%insert("swiglisp") %{
|
||||
;;;SWIG wrapper code starts here
|
||||
|
||||
(cl:defmacro defanonenum (cl:&body enums)
|
||||
"Converts anonymous enums to defconstants."
|
||||
`(cl:progn ,@(cl:loop for value in enums
|
||||
for index = 0 then (cl:1+ index)
|
||||
when (cl:listp value) do (cl:setf index (cl:second value)
|
||||
value (cl:first value))
|
||||
collect `(cl:defconstant ,value ,index))))
|
||||
|
||||
(cl:eval-when (:compile-toplevel :load-toplevel)
|
||||
(cl:unless (cl:fboundp 'swig-lispify)
|
||||
(cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
|
||||
(cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
|
||||
(cl:cond
|
||||
((cl:null lst)
|
||||
rest)
|
||||
((cl:upper-case-p c)
|
||||
(helper (cl:cdr lst) 'upper
|
||||
(cl:case last
|
||||
((lower digit) (cl:list* c #\- rest))
|
||||
(cl:t (cl:cons c rest)))))
|
||||
((cl:lower-case-p c)
|
||||
(helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
|
||||
((cl:digit-char-p c)
|
||||
(helper (cl:cdr lst) 'digit
|
||||
(cl:case last
|
||||
((upper lower) (cl:list* c #\- rest))
|
||||
(cl:t (cl:cons c rest)))))
|
||||
((cl:char-equal c #\_)
|
||||
(helper (cl:cdr lst) '_ (cl:cons #\- rest)))
|
||||
(cl:t
|
||||
(cl:error "Invalid character: ~A" c)))))
|
||||
(cl:let ((fix (cl:case flag
|
||||
((constant enumvalue) "+")
|
||||
(variable "*")
|
||||
(cl:t ""))))
|
||||
(cl:intern
|
||||
(cl:concatenate
|
||||
'cl:string
|
||||
fix
|
||||
(cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
|
||||
fix)
|
||||
package))))))
|
||||
|
||||
;;;SWIG wrapper code ends here
|
||||
%}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/* name conversion for overloaded operators. */
|
||||
#ifdef __cplusplus
|
||||
%rename(__add__) *::operator+;
|
||||
%rename(__pos__) *::operator+();
|
||||
%rename(__pos__) *::operator+() const;
|
||||
|
||||
%rename(__sub__) *::operator-;
|
||||
%rename(__neg__) *::operator-() const;
|
||||
%rename(__neg__) *::operator-();
|
||||
|
||||
%rename(__mul__) *::operator*;
|
||||
%rename(__deref__) *::operator*();
|
||||
%rename(__deref__) *::operator*() const;
|
||||
|
||||
%rename(__div__) *::operator/;
|
||||
%rename(__mod__) *::operator%;
|
||||
%rename(__logxor__) *::operator^;
|
||||
%rename(__logand__) *::operator&;
|
||||
%rename(__logior__) *::operator|;
|
||||
%rename(__lognot__) *::operator~();
|
||||
%rename(__lognot__) *::operator~() const;
|
||||
|
||||
%rename(__not__) *::operator!();
|
||||
%rename(__not__) *::operator!() const;
|
||||
|
||||
%rename(__assign__) *::operator=;
|
||||
|
||||
%rename(__add_assign__) *::operator+=;
|
||||
%rename(__sub_assign__) *::operator-=;
|
||||
%rename(__mul_assign__) *::operator*=;
|
||||
%rename(__div_assign__) *::operator/=;
|
||||
%rename(__mod_assign__) *::operator%=;
|
||||
%rename(__logxor_assign__) *::operator^=;
|
||||
%rename(__logand_assign__) *::operator&=;
|
||||
%rename(__logior_assign__) *::operator|=;
|
||||
|
||||
%rename(__lshift__) *::operator<<;
|
||||
%rename(__lshift_assign__) *::operator<<=;
|
||||
%rename(__rshift__) *::operator>>;
|
||||
%rename(__rshift_assign__) *::operator>>=;
|
||||
|
||||
%rename(__eq__) *::operator==;
|
||||
%rename(__ne__) *::operator!=;
|
||||
%rename(__lt__) *::operator<;
|
||||
%rename(__gt__) *::operator>;
|
||||
%rename(__lte__) *::operator<=;
|
||||
%rename(__gte__) *::operator>=;
|
||||
|
||||
%rename(__and__) *::operator&&;
|
||||
%rename(__or__) *::operator||;
|
||||
|
||||
%rename(__preincr__) *::operator++();
|
||||
%rename(__postincr__) *::operator++(int);
|
||||
%rename(__predecr__) *::operator--();
|
||||
%rename(__postdecr__) *::operator--(int);
|
||||
|
||||
%rename(__comma__) *::operator,();
|
||||
%rename(__comma__) *::operator,() const;
|
||||
|
||||
%rename(__member_ref__) *::operator->;
|
||||
%rename(__member_func_ref__) *::operator->*;
|
||||
|
||||
%rename(__funcall__) *::operator();
|
||||
%rename(__aref__) *::operator[];
|
||||
#endif
|
||||
|
||||
|
||||
%{
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN extern "C"
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
#define EXPORT EXTERN SWIGEXPORT
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
%}
|
||||
|
|
@ -49,8 +49,7 @@ static void * SWIG_csharp_wstring_callback(const wchar_t *s) {
|
|||
|
||||
byte[] buffer = new byte[length * 4];
|
||||
global::System.Runtime.InteropServices.Marshal.Copy(cString, buffer, 0, buffer.Length);
|
||||
byte[] utf8buffer = global::System.Text.Encoding.Convert(global::System.Text.Encoding.UTF32, global::System.Text.Encoding.UTF8, buffer);
|
||||
return global::System.Text.Encoding.Default.GetString(utf8buffer);
|
||||
return global::System.Text.Encoding.UTF32.GetString(buffer);
|
||||
}
|
||||
|
||||
static SWIGWStringHelper() {
|
||||
|
|
@ -102,9 +101,7 @@ static SWIG_CSharpWStringExceptionHelperCallback SWIG_csharp_ApplicationExceptio
|
|||
return string.Empty;
|
||||
|
||||
byte[] buffer = new byte[length * 4];
|
||||
global::System.Runtime.InteropServices.Marshal.Copy(cString, buffer, 0, buffer.Length);
|
||||
byte[] utf8buffer = global::System.Text.Encoding.Convert(global::System.Text.Encoding.UTF32, global::System.Text.Encoding.UTF8, buffer);
|
||||
return global::System.Text.Encoding.Default.GetString(utf8buffer);
|
||||
return global::System.Text.Encoding.UTF32.GetString(buffer);
|
||||
}
|
||||
|
||||
static void SetPendingApplicationExceptionUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
|
||||
|
|
|
|||
|
|
@ -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,6 +91,9 @@ class string;
|
|||
%typemap(godirectorin,fragment="CopyString") const string &
|
||||
%{ $result = swigCopyString($input) %}
|
||||
|
||||
%typemap(throws) const string &
|
||||
%{ _swig_gopanic($1.c_str()); %}
|
||||
|
||||
|
||||
%typemap(gotype) string * "*string"
|
||||
|
||||
|
|
|
|||
|
|
@ -83,4 +83,13 @@ namespace std {
|
|||
$result = SWIG_str02scm($1.c_str());
|
||||
}
|
||||
|
||||
%typemap(throws) string {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
%typemap(throws) const string & {
|
||||
scm_throw(scm_from_locale_symbol((char *) "swig-exception"),
|
||||
scm_list_n(SWIG_str02scm($1.c_str()), SCM_UNDEFINED));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ class set {
|
|||
public boolean hasNext() {
|
||||
return curr.isNot(end);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new java.lang.UnsupportedOperationException();
|
||||
}
|
||||
}.init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,10 @@ class unordered_set {
|
|||
public boolean hasNext() {
|
||||
return curr.isNot(end);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new java.lang.UnsupportedOperationException();
|
||||
}
|
||||
}.init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ int SWIG_AsVal_dec(long)(SWIGV8_VALUE obj, long* val)
|
|||
SWIGINTERNINLINE
|
||||
SWIGV8_VALUE SWIG_From_dec(unsigned long)(unsigned long value)
|
||||
{
|
||||
return SWIGV8_INTEGER_NEW_UNS(value);
|
||||
return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast<double>(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ int SWIG_AsVal_dec(long long)(SWIGV8_VALUE obj, long long* val)
|
|||
SWIGINTERNINLINE
|
||||
SWIGV8_VALUE SWIG_From_dec(unsigned long long)(unsigned long long value)
|
||||
{
|
||||
return SWIGV8_INTEGER_NEW_UNS(value);
|
||||
return value <= UINT32_MAX ? (SWIGV8_VALUE)SWIGV8_INTEGER_NEW_UNS(value) : (SWIGV8_VALUE)SWIGV8_NUMBER_NEW(static_cast<double>(value));
|
||||
}
|
||||
%#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ SWIGINTERN void SWIG_V8_Raise(const char *msg) {
|
|||
SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg)));
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_V8_Raise(SWIGV8_VALUE obj, const char *msg) {
|
||||
SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_TO_STRING(obj)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Note: There are two contexts for handling errors.
|
||||
A static V8ErrorHandler is used in not overloaded methods.
|
||||
|
|
|
|||
|
|
@ -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 <typemaps/swigtypemaps.swg>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ typedef struct swig_elua_entry {
|
|||
#endif
|
||||
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
||||
# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
|
||||
# define SWIG_LUA_CONSTTAB_INT(B, C...) LSTRKEY(B), LNUMVAL(C)
|
||||
# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
|
||||
# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
|
||||
# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
|
||||
|
|
@ -103,7 +103,7 @@ typedef struct swig_elua_entry {
|
|||
#define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL
|
||||
#endif
|
||||
#else /* SWIG_LUA_FLAVOR_LUA */
|
||||
# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
|
||||
# define SWIG_LUA_CONSTTAB_INT(B, C...) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
|
||||
# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
|
||||
# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
|
||||
# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
|
||||
|
|
@ -1789,7 +1789,7 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
|
|||
}
|
||||
else
|
||||
{
|
||||
cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
|
||||
cast=SWIG_TypeCheck(usr->type->name,type); /* performs normal type checking */
|
||||
if (cast)
|
||||
{
|
||||
int newmemory = 0;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -290,6 +290,10 @@ REF_MAP(float, SCHEME_REALP, scheme_real_to_double,
|
|||
REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
|
||||
scheme_make_double, real);
|
||||
|
||||
%typemap(throws) char * {
|
||||
scheme_signal_error("%s: %s", FUNC_NAME, $1);
|
||||
}
|
||||
|
||||
/* Void */
|
||||
|
||||
%typemap(out) void "$result = scheme_void;"
|
||||
|
|
|
|||
|
|
@ -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 <typemaps/swigtypemaps.swg>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ extern "C" {
|
|||
|
||||
#if __GNUC__ >= 10
|
||||
#if defined(__cplusplus)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wvolatile"
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -16,8 +17,10 @@ extern "C" {
|
|||
#include "XSUB.h"
|
||||
|
||||
#if __GNUC__ >= 10
|
||||
#if defined(__cplusplus)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* PERL_REVISION was added in Perl 5.6. */
|
||||
#if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8)
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@
|
|||
%typemap(directorin) SWIGTYPE
|
||||
%{
|
||||
ZVAL_UNDEF($input);
|
||||
SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1);
|
||||
SWIG_SetPointerZval($input, (new $1_ltype(SWIG_STD_MOVE($1))), $&1_descriptor, 1);
|
||||
%}
|
||||
|
||||
%typemap(out, phptype="void") void ""
|
||||
|
|
|
|||
|
|
@ -9,4 +9,8 @@
|
|||
SWIG_php_minit {
|
||||
zend_class_entry SWIGUNUSED internal_ce;
|
||||
SWIG_InitializeModule((void*)&module_number);
|
||||
#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0
|
||||
/* This hack is needed to avoid segfaults. */
|
||||
EG(class_table) = CG(class_table);
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#if PHP_MAJOR_VERSION < 7
|
||||
# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||
#endif
|
||||
|
|
@ -195,7 +193,7 @@ SWIG_ConvertPtrAndOwn(zval *z, void **ptr, swig_type_info *ty, int flags, swig_o
|
|||
/* They don't care about the target type, so just pass on the pointer! */
|
||||
*ptr = value->ptr;
|
||||
} else {
|
||||
swig_cast_info *tc = SWIG_TypeCheckStruct(value->type, ty);
|
||||
swig_cast_info *tc = SWIG_TypeCheck(value->type->name, ty);
|
||||
if (tc) {
|
||||
int newmemory = 0;
|
||||
*ptr = SWIG_TypeCast(tc, value->ptr, &newmemory);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|
||||
%echo "pointer.i is deprecated. Use cpointer.i instead."
|
||||
%echo "See http://www.swig.org/Doc3.0/Library.html"
|
||||
%echo "See https://www.swig.org/Doc3.0/Library.html"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -101,4 +101,3 @@ std_container.i general common code for the STD/STL containers
|
|||
|
||||
std_vectora.i vector + allocator (allocators are now supported in STD/STL)
|
||||
typemaps.i old in/out typemaps (doesn't need to be included)
|
||||
defarg.swg for processing default arguments with shadow classes
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
/* This file defines an internal function for processing default arguments
|
||||
with proxy classes.
|
||||
|
||||
There seems to be no straightforward way to write proxy functions
|
||||
involving default arguments. For example :
|
||||
|
||||
def foo(arg1,arg2,*args):
|
||||
proxyc.foo(arg1,arg2,args)
|
||||
|
||||
This fails because args is now a tuple and SWIG doesn't know what to
|
||||
do with it.
|
||||
|
||||
This file allows a different approach :
|
||||
|
||||
def foo(arg1,arg2,*args):
|
||||
proxyc.__call_defarg(proxyc.foo,(arg1,arg2,)+args)
|
||||
|
||||
Basically, we form a new tuple from the object, call this special
|
||||
__call_defarg method and it passes control to the real wrapper function.
|
||||
An ugly hack, but it works.
|
||||
*/
|
||||
|
||||
SWIGINTERN PyObject *swig_call_defargs(PyObject *self, PyObject *args) {
|
||||
PyObject *func;
|
||||
PyObject *parms;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO", &func, &parms))
|
||||
return NULL;
|
||||
|
||||
if (!PyCallable_Check(func)) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_TypeError, "__call_defarg : Need a callable object!");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
return PyObject_Call(func, parms, NULL);
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ As far as I know, this module is C++ safe.
|
|||
#endif
|
||||
|
||||
%wrapper %{
|
||||
#ifndef SWIG_NO_PY_SSIZE_T_CLEAN
|
||||
#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -386,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();
|
||||
|
|
@ -402,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();
|
||||
|
|
@ -478,7 +478,7 @@ namespace swig
|
|||
return swig::as<T>(item);
|
||||
} catch (const std::invalid_argument& e) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "in sequence element %d ", (int)_index);
|
||||
PyOS_snprintf(msg, sizeof(msg), "in sequence element %d ", (int)_index);
|
||||
if (!PyErr_Occurred()) {
|
||||
::%type_error(swig::type_name<T>());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,14 @@ SWIGINTERN char*
|
|||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
return (char *)PyUnicode_AsUTF8(str);
|
||||
# if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
|
||||
return (char*)PyUnicode_AsUTF8AndSize(str, NULL);
|
||||
# else
|
||||
PyObject* bytes = PyUnicode_AsUTF8String(str);
|
||||
char* chars = PyBytes_AsString(bytes);
|
||||
Py_DECREF(bytes);
|
||||
return chars;
|
||||
# endif
|
||||
#else
|
||||
return PyString_AsString(str);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ typedef struct swig_varlinkobject {
|
|||
} swig_varlinkobject;
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
|
||||
swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_InternFromString("<Swig global variables>");
|
||||
#else
|
||||
|
|
@ -249,7 +249,8 @@ swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
|
|||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
swig_varlink_str(swig_varlinkobject *v) {
|
||||
swig_varlink_str(PyObject *o) {
|
||||
swig_varlinkobject *v = (swig_varlinkobject *) o;
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyObject *str = PyUnicode_InternFromString("(");
|
||||
PyObject *tail;
|
||||
|
|
@ -287,7 +288,8 @@ swig_varlink_str(swig_varlinkobject *v) {
|
|||
}
|
||||
|
||||
SWIGINTERN void
|
||||
swig_varlink_dealloc(swig_varlinkobject *v) {
|
||||
swig_varlink_dealloc(PyObject *o) {
|
||||
swig_varlinkobject *v = (swig_varlinkobject *) o;
|
||||
swig_globalvar *var = v->vars;
|
||||
while (var) {
|
||||
swig_globalvar *n = var->next;
|
||||
|
|
@ -298,7 +300,8 @@ swig_varlink_dealloc(swig_varlinkobject *v) {
|
|||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
||||
swig_varlink_getattr(PyObject *o, char *n) {
|
||||
swig_varlinkobject *v = (swig_varlinkobject *) o;
|
||||
PyObject *res = NULL;
|
||||
swig_globalvar *var = v->vars;
|
||||
while (var) {
|
||||
|
|
@ -315,7 +318,8 @@ swig_varlink_getattr(swig_varlinkobject *v, char *n) {
|
|||
}
|
||||
|
||||
SWIGINTERN int
|
||||
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
|
||||
swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
|
||||
swig_varlinkobject *v = (swig_varlinkobject *) o;
|
||||
int res = 1;
|
||||
swig_globalvar *var = v->vars;
|
||||
while (var) {
|
||||
|
|
@ -1656,28 +1660,33 @@ SWIG_Python_TypeCache(void) {
|
|||
|
||||
SWIGRUNTIME swig_module_info *
|
||||
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
static void *type_pointer = (void *)0;
|
||||
/* first check if module already created */
|
||||
if (!type_pointer) {
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
|
||||
#else
|
||||
type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
type_pointer = (void *)0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
type_pointer = (void *)0;
|
||||
}
|
||||
#endif
|
||||
return (swig_module_info *) type_pointer;
|
||||
}
|
||||
|
||||
|
||||
static int interpreter_counter = 0; // how many (sub-)interpreters are using swig_module's types
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_DestroyModule(PyObject *obj)
|
||||
{
|
||||
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
|
||||
swig_type_info **types = swig_module->types;
|
||||
size_t i;
|
||||
if (--interpreter_counter != 0) // another sub-interpreter may still be using the swig_module's types
|
||||
return;
|
||||
for (i =0; i < swig_module->size; ++i) {
|
||||
swig_type_info *ty = types[i];
|
||||
if (ty->owndata) {
|
||||
|
|
@ -1707,6 +1716,7 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
|
|||
PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
|
||||
if (pointer && module) {
|
||||
if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) {
|
||||
++interpreter_counter;
|
||||
Swig_Capsule_global = pointer;
|
||||
} else {
|
||||
Py_DECREF(pointer);
|
||||
|
|
@ -1838,12 +1848,6 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg
|
|||
void *result;
|
||||
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
|
||||
PyErr_Clear();
|
||||
#if SWIG_POINTER_EXCEPTION
|
||||
if (flags) {
|
||||
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
|
||||
SWIG_Python_ArgFail(argnum);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_NO_PY_SSIZE_T_CLEAN
|
||||
#if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -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 >;
|
||||
|
||||
|
|
|
|||
10
Lib/r/r.swg
10
Lib/r/r.swg
|
|
@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) {
|
|||
assign(name, _obj);
|
||||
%end_block %enddef
|
||||
|
||||
%define %raise(obj,type,desc)
|
||||
return R_NilValue;
|
||||
%enddef
|
||||
%runtime %{
|
||||
SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) {
|
||||
Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg);
|
||||
}
|
||||
%}
|
||||
|
||||
#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue
|
||||
|
||||
%insert("sinit") "srun.swg"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ 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 <stdio.h>
|
||||
|
|
@ -314,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;
|
||||
|
|
@ -331,8 +334,15 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
|
|||
} 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;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
for use in class representations.
|
||||
*/
|
||||
|
||||
%typemap("rtype") bool, bool * "logical"
|
||||
%typemap("rtype") int, int *, int & "integer"
|
||||
%typemap("rtype") long, long *, long & "integer"
|
||||
%typemap("rtype") float, float*, float & "numeric"
|
||||
|
|
@ -11,15 +12,15 @@
|
|||
%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 *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"
|
||||
|
|
@ -29,8 +30,7 @@
|
|||
%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,41 @@
|
|||
%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) %}
|
||||
|
||||
#if 0
|
||||
// Replacement rtypecheck typemaps (for swig-4.2, see r.cxx)
|
||||
%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 %}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Set up type checks to insure overloading precedence.
|
||||
We would like non pointer items to shadow pointer items, so that
|
||||
|
|
@ -93,7 +128,7 @@
|
|||
%typemap(scoercein) enum SWIGTYPE *const
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE &&
|
||||
%{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %}
|
||||
|
||||
/*
|
||||
|
|
@ -172,6 +207,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,
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@
|
|||
struct traits_asptr < std::vector<T> > {
|
||||
static int asptr(SEXP obj, std::vector<T> **val) {
|
||||
std::vector<T> *p;
|
||||
int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0);
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
@ -660,6 +660,27 @@
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traits_from_ptr<std::vector<std::vector<std::basic_string<char> > > > {
|
||||
static SEXP from (std::vector< std::vector<std::basic_string<char> > > *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 <typename T>
|
||||
struct traits_from_ptr< std::vector < std::vector< T > > > {
|
||||
static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) {
|
||||
|
|
@ -806,7 +827,7 @@
|
|||
static int asptr(SEXP obj, std::vector< std::vector<T> > **val) {
|
||||
std::vector< std::vector<T> > *p;
|
||||
Rprintf("vector of vectors - unsupported content\n");
|
||||
int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0);
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
@ -887,8 +908,6 @@ std::vector< std::basic_string<char> > *,
|
|||
std::vector< std::basic_string<char> > &
|
||||
%{ %}
|
||||
|
||||
%apply std::vector< std::basic_string<char> > { std::vector< std::string> };
|
||||
|
||||
// all the related integer vectors
|
||||
// signed
|
||||
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<signed char>);
|
||||
|
|
@ -1005,6 +1024,13 @@ std::vector< std::basic_string<char> > *,
|
|||
%typemap("rtype") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "list"
|
||||
%typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "$input = lapply($input, as.logical);"
|
||||
|
||||
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<std::basic_string<char> > >);
|
||||
%traits_type_name(std::vector< std::vector<std::basic_string<char> > >);
|
||||
%typemap("rtypecheck") std::vector<std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > &
|
||||
%{ is.list($arg) && all(sapply($arg , is.character)) %}
|
||||
%typemap("rtype") std::vector<std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > & "list"
|
||||
%typemap("scoercein") std::vector< std::vector<std::basic_string<char> > >, std::vector<std::vector<std::basic_string<char> > > *, std::vector<std::vector<std::basic_string<char> > > & "$input = lapply($input, as.character);"
|
||||
|
||||
// we don't want these to be given R classes as they
|
||||
// have already been turned into R vectors.
|
||||
%typemap(scoerceout) std::vector<double>,
|
||||
|
|
@ -1049,7 +1075,10 @@ std::vector< std::basic_string<char> > *,
|
|||
std::vector< std::vector<double> >&,
|
||||
std::vector< std::vector<bool> >,
|
||||
std::vector< std::vector<bool> >*,
|
||||
std::vector< std::vector<bool> >&
|
||||
std::vector< std::vector<bool> >&,
|
||||
std::vector< std::vector<std::basic_string<char> > >,
|
||||
std::vector< std::vector<std::basic_string<char> > >*,
|
||||
std::vector< std::vector<std::basic_string<char> > >&
|
||||
%{ %}
|
||||
|
||||
#if defined(SWIGWORDSIZE64)
|
||||
|
|
@ -1071,3 +1100,6 @@ std::vector< std::basic_string<char> > *,
|
|||
%{ %}
|
||||
|
||||
#endif
|
||||
|
||||
%apply std::vector< std::basic_string<char> > { std::vector<std::string> };
|
||||
%apply std::vector< std::vector< std::basic_string<char> > > { std::vector< std::vector<std::string> > };
|
||||
|
|
|
|||
|
|
@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) {
|
|||
}
|
||||
|
||||
%include <typemaps/std_string.swg>
|
||||
|
||||
%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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@
|
|||
/* directorin */
|
||||
|
||||
%typemap(directorin,noblock=1) SWIGTYPE {
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype(SWIG_STD_MOVE($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 * {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue