Merge branch 'master' into tmp
Conflicts: .travis.yml Examples/Makefile.in Examples/test-suite/director_nspace.i Examples/test-suite/nspace.i Examples/test-suite/nspace_extend.i Source/Modules/lang.cxx configure.ac
This commit is contained in:
commit
a234542543
871 changed files with 29690 additions and 7800 deletions
|
|
@ -130,6 +130,9 @@
|
|||
};
|
||||
%}
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
|
|
@ -275,7 +278,7 @@
|
|||
%ignore Class::GetMethod();
|
||||
%ignore Class::GetMethod() const;
|
||||
%newobject Class::AttributeName;
|
||||
%typemap(newfree) const AttributeType &AttributeName "delete $1;// my newfree override"
|
||||
%typemap(newfree) const AttributeType &AttributeName "delete $1;"
|
||||
%extend Class {
|
||||
AttributeType AttributeName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,20 @@
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
%apply int { enum SWIGTYPE };
|
||||
%apply const int& { const enum SWIGTYPE& };
|
||||
%apply const int& { const enum SWIGTYPE & };
|
||||
%apply const int& { const enum SWIGTYPE && };
|
||||
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE& (int val, int ecode, $basetype temp) {
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE & (int val, int ecode, $basetype temp) {
|
||||
ecode = SWIG_AsVal(int)($input, &val);
|
||||
if (!SWIG_IsOK(ecode)) {
|
||||
%argument_fail(ecode, "$type", $symname, $argnum);
|
||||
} else {
|
||||
temp = %static_cast(val,$basetype);
|
||||
$1 = &temp;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE && (int val, int ecode, $basetype temp) {
|
||||
ecode = SWIG_AsVal(int)($input, &val);
|
||||
if (!SWIG_IsOK(ecode)) {
|
||||
%argument_fail(ecode, "$type", $symname, $argnum);
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@
|
|||
}
|
||||
}
|
||||
*/
|
||||
%{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%define SWIG_CATCH_STDEXCEPT
|
||||
/* catching std::exception */
|
||||
catch (std::invalid_argument& e) {
|
||||
|
|
|
|||
|
|
@ -149,8 +149,43 @@
|
|||
#endif
|
||||
%}
|
||||
|
||||
%fragment("<stddef.h>", "header") %{
|
||||
#include <stddef.h>
|
||||
%fragment("<stddef.h>", "header") %{
|
||||
#include <stddef.h>
|
||||
%}
|
||||
|
||||
%fragment("<string>", "header") %{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%fragment("<stdexcept>", "header") %{
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
%fragment("<algorithm>", "header") %{
|
||||
#include <algorithm>
|
||||
%}
|
||||
|
||||
%fragment("SWIG_isfinite","header",fragment="<math.h>,<float.h>") %{
|
||||
/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
|
||||
#ifndef SWIG_isfinite
|
||||
# if defined(isfinite)
|
||||
# define SWIG_isfinite(X) (isfinite(X))
|
||||
# elif defined(_MSC_VER)
|
||||
# define SWIG_isfinite(X) (_finite(X))
|
||||
# elif defined(__sun) && defined(__SVR4)
|
||||
# include <ieeefp.h>
|
||||
# define SWIG_isfinite(X) (finite(X))
|
||||
# endif
|
||||
#endif
|
||||
%}
|
||||
|
||||
%fragment("SWIG_Float_Overflow_Check","header",fragment="<float.h>,SWIG_isfinite") %{
|
||||
/* Accept infinite as a valid float value unless we are unable to check if a value is finite */
|
||||
#ifdef SWIG_isfinite
|
||||
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
|
||||
#else
|
||||
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
|
||||
#endif
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -213,13 +248,20 @@ SWIG_AsVal_dec(Type)(SWIG_Object obj, Type *val)
|
|||
%enddef
|
||||
|
||||
|
||||
/* Macro for 'double' derived types */
|
||||
/* Macro for floating point derived types (original macro) */
|
||||
|
||||
%define %numeric_double(Type, Frag, Min, Max)
|
||||
%numeric_type_from(Type, double)
|
||||
%numeric_signed_type_asval(Type, double, Frag , Min, Max)
|
||||
%enddef
|
||||
|
||||
/* Macro for floating point derived types */
|
||||
|
||||
%define %numeric_float(Type, Frag, OverflowCond)
|
||||
%numeric_type_from(Type, double)
|
||||
%numeric_type_asval(Type, double, Frag, OverflowCond)
|
||||
%enddef
|
||||
|
||||
|
||||
/* Macros for missing fragments */
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ SWIG_AsVal_dec(bool)(SWIG_Object obj, bool *val)
|
|||
|
||||
/* float */
|
||||
|
||||
%numeric_double(float, "<float.h>", -FLT_MAX, FLT_MAX)
|
||||
%numeric_float(float, "SWIG_Float_Overflow_Check", SWIG_Float_Overflow_Check(v))
|
||||
|
||||
/* long/unsigned long */
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@
|
|||
|
||||
%include <typemaps/std_strings.swg>
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
%}
|
||||
|
||||
%fragment("<string>");
|
||||
|
||||
namespace std
|
||||
{
|
||||
%naturalvar string;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
%{
|
||||
#include <cwchar>
|
||||
#include <string>
|
||||
%}
|
||||
%fragment("<string>");
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,8 +17,19 @@ SWIG_pchar_descriptor(void)
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_strnlen","header",fragment="SWIG_FromCharPtrAndSize") {
|
||||
size_t
|
||||
SWIG_strnlen(const char* s, size_t maxlen)
|
||||
{
|
||||
const char *p;
|
||||
for (p = s; maxlen-- && *p; p++)
|
||||
;
|
||||
return p - s;
|
||||
}
|
||||
}
|
||||
|
||||
%include <typemaps/strings.swg>
|
||||
%typemaps_string(%checkcode(STRING), %checkcode(CHAR),
|
||||
char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, strlen,
|
||||
char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize,
|
||||
strlen, SWIG_strnlen,
|
||||
"<limits.h>", CHAR_MIN, CHAR_MAX)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
SWIG_AsCharPtr,
|
||||
SWIG_FromCharPtr,
|
||||
SWIG_AsCharArray,
|
||||
|
|
@ -276,12 +277,13 @@
|
|||
}
|
||||
%typemap(freearg) const Char (&)[ANY] "";
|
||||
|
||||
%typemap(out,fragment=#SWIG_FromCharPtrAndSize)
|
||||
%typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char[ANY]
|
||||
{
|
||||
size_t size = $1_dim0;
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
while (size && ($1[size - 1] == '\0')) --size;
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
%#else
|
||||
size_t size = $1_dim0;
|
||||
%#endif
|
||||
%set_output(SWIG_FromCharPtrAndSize($1, size));
|
||||
}
|
||||
|
|
@ -298,23 +300,25 @@
|
|||
|
||||
/* varout */
|
||||
|
||||
%typemap(varout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
|
||||
%typemap(varout,noblock=1,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char [ANY] {
|
||||
size_t size = $1_dim0;
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
while (size && ($1[size - 1] == '\0')) --size;
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
%#else
|
||||
size_t size = $1_dim0;
|
||||
%#endif
|
||||
%set_varoutput(SWIG_FromCharPtrAndSize($1, size));
|
||||
}
|
||||
|
||||
/* constant */
|
||||
|
||||
%typemap(constcode,fragment=#SWIG_FromCharPtrAndSize)
|
||||
%typemap(constcode,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char [ANY]
|
||||
{
|
||||
size_t size = $value_dim0;
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
while (size && ($value[size - 1] == '\0')) --size;
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
%#else
|
||||
size_t size = $value_dim0;
|
||||
%#endif
|
||||
%set_constant("$symname", SWIG_FromCharPtrAndSize($value,size));
|
||||
}
|
||||
|
|
@ -323,12 +327,13 @@
|
|||
#if defined(SWIG_DIRECTOR_TYPEMAPS)
|
||||
|
||||
/* directorin */
|
||||
%typemap(directorin,fragment=#SWIG_FromCharPtrAndSize)
|
||||
%typemap(directorin,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char [ANY]
|
||||
{
|
||||
size_t size = $1_dim0;
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
while (size && ($1[size - 1] == '\0')) --size;
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
%#else
|
||||
size_t size = $1_dim0;
|
||||
%#endif
|
||||
$input = SWIG_FromCharPtrAndSize($1, size);
|
||||
}
|
||||
|
|
@ -360,12 +365,13 @@
|
|||
|
||||
/* throws */
|
||||
|
||||
%typemap(throws,fragment=#SWIG_FromCharPtrAndSize)
|
||||
%typemap(throws,fragment=#SWIG_CharBufLen)
|
||||
Char [ANY], const Char[ANY]
|
||||
{
|
||||
size_t size = $1_dim0;
|
||||
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
|
||||
while (size && ($1[size - 1] == '\0')) --size;
|
||||
size_t size = SWIG_CharBufLen($1, $1_dim0);
|
||||
%#else
|
||||
size_t size = $1_dim0;
|
||||
%#endif
|
||||
%raise(SWIG_FromCharPtrAndSize($1, size), "$type", 0);
|
||||
}
|
||||
|
|
@ -499,6 +505,7 @@
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
SWIG_NewCopyCharArray,
|
||||
SWIG_DeleteCharArray,
|
||||
FragLimits, CHAR_MIN, CHAR_MAX)
|
||||
|
|
@ -530,7 +537,8 @@ SWIG_As##CharName##Array(SWIG_Object obj, Char *val, size_t size)
|
|||
Char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
|
||||
int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
|
||||
if (SWIG_IsOK(res)) {
|
||||
if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
|
||||
/* special case of single char conversion when we don't need space for NUL */
|
||||
if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize;
|
||||
if (csize <= size) {
|
||||
if (val) {
|
||||
if (csize) memcpy(val, cptr, csize*sizeof(Char));
|
||||
|
|
@ -586,6 +594,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
SWIG_As##CharName##Ptr,
|
||||
SWIG_From##CharName##Ptr,
|
||||
SWIG_As##CharName##Array,
|
||||
|
|
@ -604,12 +613,14 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
FragLimits, CHAR_MIN, CHAR_MAX)
|
||||
%_typemap2_string(StringCode, CharCode,
|
||||
Char, CharName,
|
||||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
%new_copy_array,
|
||||
%delete_array,
|
||||
FragLimits, CHAR_MIN, CHAR_MAX)
|
||||
|
|
@ -624,6 +635,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
SWIG_NewCopyCharArray,
|
||||
SWIG_DeleteCharArray,
|
||||
FragLimits, CHAR_MIN, CHAR_MAX)
|
||||
|
|
@ -632,6 +644,7 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
|
|||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtrAndSize,
|
||||
SWIG_CharPtrLen,
|
||||
SWIG_CharBufLen,
|
||||
SWIG_NewCopyCharArray,
|
||||
SWIG_DeleteCharArray,
|
||||
FragLimits, CHAR_MIN, CHAR_MAX)
|
||||
|
|
|
|||
|
|
@ -3,49 +3,49 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
/*
|
||||
This file implements the internal macros of the 'SWIG API', which
|
||||
are useful to implement all the SWIG target languges.
|
||||
are useful to implement all the SWIG target languages.
|
||||
|
||||
Basic preprocessor macros:
|
||||
--------------------------
|
||||
|
||||
%arg(Arg) Safe argument wrap
|
||||
%str(Arg) Stringtify the argument
|
||||
%begin_block Begin a execution block
|
||||
%end_block End a execution block
|
||||
%block(Block) Execute Block as a excecution block
|
||||
%str(Arg) Stringify the argument
|
||||
%begin_block Begin an execution block
|
||||
%end_block End an execution block
|
||||
%block(Block) Execute Block as an execution block
|
||||
%define_as(Def, Val) Define 'Def' as 'Val', expanding Def and Val first
|
||||
%ifcplusplus(V1, V2) if C++ Mode; then V1; else V2; fi
|
||||
|
||||
|
||||
Casting Operations:
|
||||
-------------------
|
||||
|
||||
|
||||
SWIG provides the following casting macros, which implement the
|
||||
corresponding C++ casting operations:
|
||||
|
||||
%const_cast(a, Type) const_cast<Type >(a)
|
||||
%static_cast(a, Type) static_cast<Type >(a)
|
||||
%reinterpret_cast(a, Type) reinterpret_cast<Type >(a)
|
||||
%numeric_cast(a, Type) static_cast<Type >(a)
|
||||
%as_voidptr(a) const_cast<void *>(static_cast<const void *>(a))
|
||||
%as_voidptrptr(a) reinterpret_cast<void **>(a)
|
||||
|
||||
%const_cast(a, Type) const_cast<Type >(a)
|
||||
%static_cast(a, Type) static_cast<Type >(a)
|
||||
%reinterpret_cast(a, Type) reinterpret_cast<Type >(a)
|
||||
%numeric_cast(a, Type) static_cast<Type >(a)
|
||||
%as_voidptr(a) const_cast<void *>(static_cast<const void *>(a))
|
||||
%as_voidptrptr(a) reinterpret_cast<void **>(a)
|
||||
|
||||
or their C unsafe versions. In C++ we use the safe version unless
|
||||
SWIG_NO_CPLUSPLUS_CAST is defined (usually via the -nocppcast swig flag).
|
||||
|
||||
|
||||
Memory allocation:
|
||||
------------------
|
||||
|
||||
|
||||
These allocation/freeing macros are safe to use in C or C++ and
|
||||
dispatch the proper new/delete/delete[] or free/malloc calls as
|
||||
needed.
|
||||
|
||||
|
||||
%new_instance(Type) Allocate a new instance of given Type
|
||||
%new_copy(value,Type) Allocate and initialize a new instance with 'value'
|
||||
%new_array(size,Type) Allocate a new array with given size and Type
|
||||
%new_copy_array(cptr,size,Type) Allocate and initialize a new array from 'cptr'
|
||||
%delete(cptr) Delete an instance
|
||||
%delete(cptr) Delete an instance
|
||||
%delete_array(cptr) Delete an array
|
||||
|
||||
|
||||
|
|
@ -54,13 +54,13 @@
|
|||
|
||||
%formacro(Macro, Args...) or %formacro_1(Macro, Args...)
|
||||
for i in Args
|
||||
do
|
||||
do
|
||||
Macro($i)
|
||||
done
|
||||
|
||||
%formacro_2(Macro2, Args...)
|
||||
for i,j in Args
|
||||
do
|
||||
do
|
||||
Macro2($i, $j)
|
||||
done
|
||||
|
||||
|
|
@ -71,12 +71,12 @@
|
|||
%mark_flag(flag)
|
||||
flag := True
|
||||
|
||||
%evalif(flag,expr)
|
||||
%evalif(flag,expr)
|
||||
if flag; then
|
||||
expr
|
||||
fi
|
||||
|
||||
%evalif_2(flag1 flag2,expr)
|
||||
%evalif_2(flag1 flag2,expr)
|
||||
if flag1 and flag2; then
|
||||
expr
|
||||
fi
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
*/
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Basic preprocessor macros
|
||||
* Basic preprocessor macros
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define %arg(Arg...) Arg
|
||||
|
|
@ -115,7 +115,7 @@ nocppval
|
|||
%define_as(SWIGVERSION, SWIG_VERSION)
|
||||
%#define SWIG_VERSION SWIGVERSION
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -153,10 +153,10 @@ nocppval
|
|||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Allocating/freeing elements
|
||||
* Allocating/freeing elements
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
# define %new_instance(Type...) (new Type)
|
||||
# define %new_copy(val,Type...) (new Type(%static_cast(val, const Type&)))
|
||||
# define %new_array(size,Type...) (new Type[size])
|
||||
|
|
@ -184,7 +184,7 @@ nocppval
|
|||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Auxiliary loop macros
|
||||
* Auxiliary loop macros
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
|
@ -213,10 +213,10 @@ nocppval
|
|||
* SWIG flags
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
/*
|
||||
mark a flag, ie, define a macro name but ignore it in
|
||||
the interface.
|
||||
|
||||
the interface.
|
||||
|
||||
the flag can be later used with %evalif
|
||||
*/
|
||||
|
||||
|
|
@ -224,16 +224,16 @@ nocppval
|
|||
|
||||
|
||||
/*
|
||||
%evalif and %evalif_2 are use to evaluate or process
|
||||
%evalif and %evalif_2 are use to evaluate or process
|
||||
an expression if the given predicate is 'true' (1).
|
||||
*/
|
||||
%define %_evalif(_x,_expr)
|
||||
%define %_evalif(_x,_expr)
|
||||
#if _x == 1
|
||||
_expr
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%define %_evalif_2(_x,_y,_expr)
|
||||
%define %_evalif_2(_x,_y,_expr)
|
||||
#if _x == 1 && _y == 1
|
||||
_expr
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -67,6 +67,41 @@
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Rvalue reference */
|
||||
%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, 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);
|
||||
}
|
||||
%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
|
||||
|
||||
/* By value */
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) {
|
||||
|
|
@ -102,7 +137,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Pointers, references */
|
||||
%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] {
|
||||
%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[] {
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags));
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +159,7 @@
|
|||
%typemap(memberin) SWIGTYPE [ANY] {
|
||||
if ($input) {
|
||||
size_t ii = 0;
|
||||
for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii];
|
||||
for (; ii < (size_t)$1_dim0; ++ii) *($1_ltype)&$1[ii] = ($*1_ltype)$input[ii];
|
||||
} else {
|
||||
%variable_nullref("$type","$name");
|
||||
}
|
||||
|
|
@ -133,7 +168,7 @@
|
|||
%typemap(globalin) SWIGTYPE [ANY] {
|
||||
if ($input) {
|
||||
size_t ii = 0;
|
||||
for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii];
|
||||
for (; ii < (size_t)$1_dim0; ++ii) *($1_ltype)&$1[ii] = ($*1_ltype)$input[ii];
|
||||
} else {
|
||||
%variable_nullref("$type","$name");
|
||||
}
|
||||
|
|
@ -146,7 +181,7 @@
|
|||
%variable_fail(res, "$type", "$name");
|
||||
} else if (inp) {
|
||||
size_t ii = 0;
|
||||
for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = inp[ii];
|
||||
for (; ii < (size_t)$1_dim0; ++ii) *($1_ltype)&$1[ii] = ($*1_ltype)inp[ii];
|
||||
} else {
|
||||
%variable_nullref("$type", "$name");
|
||||
}
|
||||
|
|
@ -235,6 +270,18 @@
|
|||
$1 = *(%reinterpret_cast(argp, $ltype));
|
||||
}
|
||||
|
||||
%typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && {
|
||||
void *argp = 0;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(res, "$type", "$name");
|
||||
}
|
||||
if (!argp) {
|
||||
%variable_nullref("$type", "$name");
|
||||
}
|
||||
$1 = *(%reinterpret_cast(argp, $ltype));
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(varin,implicitconv=1) SWIGTYPE {
|
||||
void *argp = 0;
|
||||
|
|
@ -284,6 +331,10 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags));
|
||||
}
|
||||
|
||||
%typemap(varout, noblock=1) SWIGTYPE && {
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags));
|
||||
}
|
||||
|
||||
/* Value */
|
||||
%typemap(varout, noblock=1) SWIGTYPE {
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags));
|
||||
|
|
@ -311,12 +362,23 @@
|
|||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & {
|
||||
int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && {
|
||||
int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE {
|
||||
int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
|
|
@ -327,6 +389,11 @@
|
|||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE {
|
||||
void *vptr = 0;
|
||||
|
|
@ -355,6 +422,10 @@
|
|||
$input = SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags);
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIGTYPE && {
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
|
||||
}
|
||||
|
||||
/* directorout */
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) {
|
||||
|
|
@ -406,6 +477,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG)
|
||||
SWIGTYPE &&(void *swig_argp, int swig_res, swig_owntype own) {
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res,"$type");
|
||||
}
|
||||
if (!swig_argp) { %dirout_nullref("$type"); }
|
||||
$result = %reinterpret_cast(swig_argp, $ltype);
|
||||
swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_OWN */);
|
||||
}
|
||||
%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE && {
|
||||
if (director) {
|
||||
SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input)));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SWIG_DIRECTOR_TYPEMAPS */
|
||||
|
||||
|
||||
|
|
@ -413,7 +500,7 @@
|
|||
* --- Constants ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
%set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags));
|
||||
}
|
||||
|
||||
|
|
@ -441,6 +528,10 @@
|
|||
%raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor);
|
||||
}
|
||||
|
||||
%typemap(throws,noblock=1) SWIGTYPE && {
|
||||
%raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor);
|
||||
}
|
||||
|
||||
%typemap(throws,noblock=1) (...) {
|
||||
SWIG_exception_fail(SWIG_RuntimeError,"unknown exception");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
and then include this file.
|
||||
|
||||
Typically you will create a 'mytypemaps.swg' file in each target
|
||||
languge, where you will have the following sections:
|
||||
language, where you will have the following sections:
|
||||
|
||||
=== mytypemaps.swg ===
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,10 @@
|
|||
// Common code for supporting the STD C++ namespace
|
||||
//
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
%}
|
||||
%fragment("<string>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%fragment("Traits","header")
|
||||
%fragment("Traits","header",fragment="<string>")
|
||||
{
|
||||
namespace swig {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -18,8 +18,20 @@ SWIG_pwchar_descriptor()
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_wcsnlen","header",fragment="SWIG_FromWCharPtrAndSize") {
|
||||
size_t
|
||||
SWIG_wcsnlen(const wchar_t* s, size_t maxlen)
|
||||
{
|
||||
const wchar_t *p;
|
||||
for (p = s; maxlen-- && *p; p++)
|
||||
;
|
||||
return p - s;
|
||||
}
|
||||
}
|
||||
|
||||
%include <typemaps/strings.swg>
|
||||
%typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR),
|
||||
wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, wcslen,
|
||||
wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize,
|
||||
wcslen, SWIG_wcsnlen,
|
||||
"<wchar.h>", WCHAR_MIN, WCHAR_MAX)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue