Merge branch 'master' into doxygen
Merge 3.0.12 release changes from master.
This commit is contained in:
commit
294ab27b90
254 changed files with 4158 additions and 2457 deletions
|
|
@ -71,8 +71,6 @@ static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) {
|
|||
return $jnicall;
|
||||
}
|
||||
|
||||
#else
|
||||
%echo "cdata.i module not supported."
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -995,6 +995,7 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
|||
#define %csmethodmodifiers %feature("cs:methodmodifiers")
|
||||
#define %csnothrowexception %feature("except")
|
||||
#define %csattributes %feature("cs:attributes")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
||||
%pragma(csharp) imclassclassmodifiers="class"
|
||||
%pragma(csharp) moduleclassmodifiers="public class"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
%define SWIG_STD_ARRAY_INTERNAL(T, N)
|
||||
%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n";
|
||||
%typemap(cscode) std::array< T, N > %{
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
%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(cscode) std::map<K, T, C > %{
|
||||
%proxycode %{
|
||||
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
get {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,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\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
|
||||
%typemap(cscode) std::vector< CTYPE > %{
|
||||
%proxycode %{
|
||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new global::System.ArgumentNullException("c");
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@
|
|||
#define %dconstvalue(value) %feature("d:constvalue",value)
|
||||
#define %dmethodmodifiers %feature("d:methodmodifiers")
|
||||
#define %dnothrowexception %feature("except")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...)
|
||||
#if (SWIG_D_VERSION == 1)
|
||||
%typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;"
|
||||
%typemap(dcode) std::vector< CTYPE > %{
|
||||
%proxycode %{
|
||||
public this($typemap(dtype, CTYPE)[] values) {
|
||||
this();
|
||||
append(values);
|
||||
|
|
@ -185,7 +185,7 @@ static import std.exception;
|
|||
static import std.range;
|
||||
static import std.traits;
|
||||
%}
|
||||
%typemap(dcode) std::vector< CTYPE > %{
|
||||
%proxycode %{
|
||||
alias size_t KeyType;
|
||||
alias $typemap(dtype, CTYPE) ValueType;
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,11 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
|
|||
if (SCM_NULLP(smob)) {
|
||||
*result = NULL;
|
||||
return SWIG_OK;
|
||||
#if SCM_MAJOR_VERSION >= 2
|
||||
} else if (SCM_POINTER_P(s)) {
|
||||
*result = SCM_POINTER_VALUE(s);
|
||||
return SWIG_OK;
|
||||
#endif /* if SCM_MAJOR_VERSION >= 2 */
|
||||
} else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
|
||||
/* we do not accept smobs representing destroyed pointers */
|
||||
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
%{
|
||||
#include <string>
|
||||
|
||||
inline std::string SWIG_scm2string(SCM x) {
|
||||
SWIGINTERNINLINE
|
||||
std::string SWIG_scm2string(SCM x) {
|
||||
char* temp;
|
||||
temp = SWIG_scm2str(x);
|
||||
std::string s(temp);
|
||||
|
|
|
|||
|
|
@ -337,7 +337,8 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
|
||||
/* Add some code to the proxy class of the array type for converting between type used in
|
||||
* JNI class (long[]) and type used in proxy class ( ARRAYSOFCLASSES[] ) */
|
||||
%typemap(javacode) ARRAYSOFCLASSES %{
|
||||
%extend ARRAYSOFCLASSES {
|
||||
%proxycode %{
|
||||
protected static long[] cArrayUnwrap($javaclassname[] arrayWrapper) {
|
||||
long[] cArray = new long[arrayWrapper.length];
|
||||
for (int i=0; i<arrayWrapper.length; i++)
|
||||
|
|
@ -352,6 +353,7 @@ JAVA_ARRAYS_TYPEMAPS(double, double, jdouble, Double, "[D") /* double[ANY] *
|
|||
return arrayWrapper;
|
||||
}
|
||||
%}
|
||||
}
|
||||
|
||||
%enddef /* JAVA_ARRAYSOFCLASSES */
|
||||
|
||||
|
|
|
|||
|
|
@ -363,11 +363,13 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$result = bigint;
|
||||
}
|
||||
|
||||
/* Convert to BigInteger (see out typemap) */
|
||||
%typemap(directorin, descriptor="Ljava/math/BigInteger;") unsigned long long, const unsigned long long & {
|
||||
%typemap(directorin, descriptor="Ljava/math/BigInteger;", noblock=1) unsigned long long, const unsigned long long & {
|
||||
{
|
||||
jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
|
||||
jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
|
||||
jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
|
||||
|
|
@ -382,8 +384,10 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$input = bigint;
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
||||
|
||||
%typemap(javadirectorin) unsigned long long "$jniinput"
|
||||
%typemap(javadirectorout) unsigned long long "$javacall"
|
||||
|
|
@ -611,6 +615,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
$result = bigint;
|
||||
}
|
||||
|
||||
|
|
@ -1317,6 +1322,7 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
#define %javaexception(exceptionclasses) %feature("except",throws=exceptionclasses)
|
||||
#define %nojavaexception %feature("except","0",throws="")
|
||||
#define %clearjavaexception %feature("except","",throws="")
|
||||
#define %proxycode %insert("proxycode")
|
||||
|
||||
%pragma(java) jniclassclassmodifiers="public class"
|
||||
%pragma(java) moduleclassmodifiers="public class"
|
||||
|
|
@ -1351,14 +1357,17 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
%typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) {
|
||||
jbyteArray jb = (jenv)->NewByteArray((jsize)$2);
|
||||
(jenv)->SetByteArrayRegion(jb, 0, (jsize)$2, (jbyte *)$1);
|
||||
$input = jb;
|
||||
%typemap(directorin, descriptor="[B", noblock=1) (char *STRING, 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(directorargout) (char *STRING, size_t LENGTH)
|
||||
%{(jenv)->GetByteArrayRegion($input, 0, (jsize)$2, (jbyte *)$1);
|
||||
(jenv)->DeleteLocalRef($input);%}
|
||||
%typemap(directorargout, noblock=1) (char *STRING, size_t LENGTH)
|
||||
{ if ($input && $1) JCALL4(GetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); }
|
||||
%typemap(javadirectorin, descriptor="[B") (char *STRING, size_t LENGTH) "$jniinput"
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
%typemap(jtype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
|
||||
%typemap(jstype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
|
||||
%typemap(javain) TYPE *OUTPUT, TYPE &OUTPUT "$javainput"
|
||||
%typemap(javadirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$jniinput"
|
||||
%typemap(javadirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$javacall"
|
||||
|
||||
%typemap(in) TYPE *OUTPUT($*1_ltype temp), TYPE &OUTPUT($*1_ltype temp)
|
||||
{
|
||||
|
|
@ -204,29 +206,47 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
|||
|
||||
%typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT ""
|
||||
|
||||
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
|
||||
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
|
||||
{
|
||||
JNITYPE jvalue = (JNITYPE)temp$argnum;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
|
||||
}
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT, TYPE *OUTPUT %{
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE &OUTPUT
|
||||
{
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *OUTPUT
|
||||
{
|
||||
JNITYPE $1_jvalue;
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
|
||||
%typemap(typecheck) TYPE &OUTPUT = TYPECHECKTYPE;
|
||||
%enddef
|
||||
|
||||
OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray);
|
||||
OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray);
|
||||
OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
OUTPUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava/lang/BigInteger;", SWIGBIGINTEGERARRAY);
|
||||
OUTPUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray);
|
||||
OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray);
|
||||
OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray);
|
||||
OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray);
|
||||
OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray);
|
||||
OUTPUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray);
|
||||
OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(int, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(long, jint, int, Int, "[I", jintArray);
|
||||
OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray);
|
||||
OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[Ljava/math/BigInteger;", jobjectArray);
|
||||
OUTPUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray);
|
||||
OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||
|
||||
#undef OUTPUT_TYPEMAP
|
||||
|
||||
|
|
@ -262,6 +282,7 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleAr
|
|||
|
||||
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
|
||||
bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
|
||||
JCALL1(DeleteLocalRef, jenv, ba);
|
||||
JCALL3(SetObjectArrayElement, jenv, $input, 0, bigint);
|
||||
}
|
||||
|
||||
|
|
@ -330,6 +351,8 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
|||
%typemap(jtype) TYPE *INOUT, TYPE &INOUT "JTYPE[]"
|
||||
%typemap(jstype) TYPE *INOUT, TYPE &INOUT "JTYPE[]"
|
||||
%typemap(javain) TYPE *INOUT, TYPE &INOUT "$javainput"
|
||||
%typemap(javadirectorin) TYPE *INOUT, TYPE &INOUT "$jniinput"
|
||||
%typemap(javadirectorout) TYPE *INOUT, TYPE &INOUT "$javacall"
|
||||
|
||||
%typemap(in) TYPE *INOUT, TYPE &INOUT {
|
||||
if (!$input) {
|
||||
|
|
@ -348,24 +371,47 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
|||
%typemap(argout) TYPE *INOUT, TYPE &INOUT
|
||||
{ JCALL3(Release##JAVATYPE##ArrayElements, jenv, $input, (JNITYPE *)$1, 0); }
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
JNITYPE $1_jvalue = (JNITYPE)$1;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorin,descriptor=JNIDESC) TYPE *INOUT %{
|
||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||
JNITYPE $1_jvalue = (JNITYPE)*$1;
|
||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE &INOUT
|
||||
{
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
$result = $1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(directorargout, noblock=1) TYPE *INOUT
|
||||
{
|
||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||
*$result = $1_jvalue;
|
||||
}
|
||||
|
||||
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
|
||||
%typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE;
|
||||
%enddef
|
||||
|
||||
INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray);
|
||||
INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray);
|
||||
INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
INOUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray);
|
||||
INOUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray);
|
||||
INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray);
|
||||
INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava.math.BigInteger;", SWIGBIGINTEGERARRAY);
|
||||
INOUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray);
|
||||
INOUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray);
|
||||
INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray);
|
||||
INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray);
|
||||
INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray);
|
||||
INOUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray);
|
||||
INOUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(int, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(long, jint, int, Int, "[I", jintArray);
|
||||
INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray);
|
||||
INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[java/math/BigInteger;", jobjectArray);
|
||||
INOUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray);
|
||||
INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||
|
||||
#undef INOUT_TYPEMAP
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,13 @@
|
|||
%{
|
||||
#include <string>
|
||||
|
||||
std::string swig_scm_to_string(Scheme_Object* x) {
|
||||
SWIGINTERNINLINE
|
||||
std::string swig_scm_to_string(Scheme_Object *x) {
|
||||
return std::string(SCHEME_STR_VAL(x));
|
||||
}
|
||||
Scheme_Object* swig_make_string(const std::string& s) {
|
||||
|
||||
SWIGINTERNINLINE
|
||||
Scheme_Object *swig_make_string(const std::string &s) {
|
||||
return scheme_make_string(s.c_str());
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,13 @@
|
|||
|
||||
%{
|
||||
#include <string>
|
||||
CAML_VALUE SwigString_FromString(const std::string& s) {
|
||||
return caml_val_string((char *)s.c_str());
|
||||
}
|
||||
std::string SwigString_AsString(CAML_VALUE o) {
|
||||
return std::string((char *)caml_ptr_val(o,0));
|
||||
}
|
||||
SWIGINTERNINLINE
|
||||
CAML_VALUE SwigString_FromString(const std::string &s) {
|
||||
return caml_val_string((char *)s.c_str());
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE
|
||||
std::string SwigString_AsString(CAML_VALUE o) {
|
||||
return std::string((char *)caml_ptr_val(o,0));
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
%include <typemaps/exception.swg>
|
||||
|
||||
|
||||
%insert("runtime") {
|
||||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; ))
|
||||
}
|
||||
|
||||
%define SWIG_RETHROW_OCTAVE_EXCEPTIONS
|
||||
/* rethrow any exceptions thrown by Octave */
|
||||
%#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
catch (octave::execution_exception& _e) { throw; }
|
||||
catch (octave::exit_exception& _e) { throw; }
|
||||
catch (octave::interrupt_exception& _e) { throw; }
|
||||
%#endif
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace swig {
|
|||
|
||||
namespace std {
|
||||
template <>
|
||||
struct less <octave_value>: public binary_function<octave_value, octave_value, bool>
|
||||
struct less <octave_value>
|
||||
{
|
||||
bool
|
||||
operator()(const octave_value& v, const octave_value& w) const
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
// __div__ a / b
|
||||
// __pow__ a ^ b
|
||||
// __ldiv__ a \ b
|
||||
// __lshift__ a << b
|
||||
// __rshift__ a >> b
|
||||
// __lt__ a < b
|
||||
// __le__ a <= b
|
||||
// __eq__ a == b
|
||||
|
|
@ -51,8 +49,6 @@
|
|||
%rename(__mul__) *::operator*;
|
||||
%rename(__div__) *::operator/;
|
||||
%rename(__mod__) *::operator%;
|
||||
%rename(__lshift__) *::operator<<;
|
||||
%rename(__rshift__) *::operator>>;
|
||||
%rename(__el_and__) *::operator&&;
|
||||
%rename(__el_or__) *::operator||;
|
||||
%rename(__xor__) *::operator^;
|
||||
|
|
@ -84,5 +80,7 @@
|
|||
// Ignored operators
|
||||
%ignoreoperator(EQ) operator=;
|
||||
%ignoreoperator(ARROWSTAR) operator->*;
|
||||
%ignoreoperator(LSHIFT) operator<<;
|
||||
%ignoreoperator(RSHIFT) operator>>;
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
|
|
@ -1,87 +1,3 @@
|
|||
|
||||
#include <octave/version.h>
|
||||
|
||||
// Macro for enabling features which require Octave version >= major.minor.patch
|
||||
#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
|
||||
( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + OCTAVE_PATCH_VERSION >= ((major)<<16) + ((minor)<<8) + (patch) )
|
||||
|
||||
// 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 <octave/ov.h>
|
||||
# if defined(octave_ov_h)
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 8
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
# else
|
||||
|
||||
// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
|
||||
# define ComplexLU __ignore
|
||||
# include <octave/CmplxLU.h>
|
||||
# undef ComplexLU
|
||||
# if defined(octave_Complex_LU_h)
|
||||
|
||||
// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 1
|
||||
# define OCTAVE_PATCH_VERSION 99
|
||||
|
||||
# else
|
||||
|
||||
// OCTAVE_API_VERSION_NUMBER == 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 2
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# endif // defined(octave_Complex_LU_h)
|
||||
|
||||
# endif // defined(octave_ov_h)
|
||||
|
||||
// Correlation between Octave API and version numbers extracted from Octave's
|
||||
// ChangeLogs; version is the *earliest* released Octave with that API number
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 48
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 6
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 45
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 4
|
||||
# define OCTAVE_PATCH_VERSION 1
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 42
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 54
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 41
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 53
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 40
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 52
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 39
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 51
|
||||
|
||||
# else // OCTAVE_API_VERSION_NUMBER == 38
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 50
|
||||
|
||||
# endif // !defined(OCTAVE_API_VERSION_NUMBER)
|
||||
|
||||
#endif // !defined(OCTAVE_MAJOR_VERSION)
|
||||
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
#define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, FS ## cname, args, nargout, doc)
|
||||
#else
|
||||
|
|
@ -824,6 +740,24 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
return ret.scalar_value();
|
||||
}
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
virtual octave_value as_double(void) const {
|
||||
octave_value ret;
|
||||
if (!dispatch_unary_op("__float__", ret)) {
|
||||
error("__float__ method not defined");
|
||||
}
|
||||
return ret.as_double();
|
||||
}
|
||||
|
||||
virtual octave_value as_single(void) const {
|
||||
octave_value ret;
|
||||
if (!dispatch_unary_op("__float__", ret)) {
|
||||
error("__float__ method not defined");
|
||||
}
|
||||
return ret.as_single();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(3,8,0)
|
||||
virtual octave_value map(octave_base_value::unary_mapper_t umap) const {
|
||||
const std::string opname = std::string("__") + octave_base_value::get_umap_name(umap) + std::string("__");
|
||||
|
|
@ -1092,6 +1026,14 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
virtual double scalar_value(bool frc_str_conv = false) const
|
||||
{ return ptr->scalar_value(frc_str_conv); }
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
virtual octave_value as_double(void) const
|
||||
{ return ptr->as_double(); }
|
||||
|
||||
virtual octave_value as_single(void) const
|
||||
{ return ptr->as_single(); }
|
||||
#endif
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(3,8,0)
|
||||
virtual octave_value map(octave_base_value::unary_mapper_t umap) const
|
||||
{ return ptr->map(umap); }
|
||||
|
|
@ -1340,8 +1282,10 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig
|
|||
swig_binary_op(div);
|
||||
swig_binary_op(pow);
|
||||
swig_binary_op(ldiv);
|
||||
#if !SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
swig_binary_op(lshift);
|
||||
swig_binary_op(rshift);
|
||||
#endif
|
||||
swig_binary_op(lt);
|
||||
swig_binary_op(le);
|
||||
swig_binary_op(eq);
|
||||
|
|
@ -1371,8 +1315,10 @@ octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig
|
|||
swigreg_binary_op(div);
|
||||
swigreg_binary_op(pow);
|
||||
swigreg_binary_op(ldiv);
|
||||
#if !SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
swigreg_binary_op(lshift);
|
||||
swigreg_binary_op(rshift);
|
||||
#endif
|
||||
swigreg_binary_op(lt);
|
||||
swigreg_binary_op(le);
|
||||
swigreg_binary_op(eq);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,93 @@
|
|||
%insert(runtime) %{
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include <octave/oct.h>
|
||||
#include <octave/version.h>
|
||||
|
||||
// Macro for enabling features which require Octave version >= major.minor.patch
|
||||
// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (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 <octave/ov.h>
|
||||
# if defined(octave_ov_h)
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 8
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
# else
|
||||
|
||||
// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
|
||||
# define ComplexLU __ignore
|
||||
# include <octave/CmplxLU.h>
|
||||
# undef ComplexLU
|
||||
# if defined(octave_Complex_LU_h)
|
||||
|
||||
// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 1
|
||||
# define OCTAVE_PATCH_VERSION 99
|
||||
|
||||
# else
|
||||
|
||||
// OCTAVE_API_VERSION_NUMBER == 37
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 2
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# endif // defined(octave_Complex_LU_h)
|
||||
|
||||
# endif // defined(octave_ov_h)
|
||||
|
||||
// Correlation between Octave API and version numbers extracted from Octave's
|
||||
// ChangeLogs; version is the *earliest* released Octave with that API number
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 48
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 6
|
||||
# define OCTAVE_PATCH_VERSION 0
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 45
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 4
|
||||
# define OCTAVE_PATCH_VERSION 1
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 42
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 54
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 41
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 53
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 40
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 52
|
||||
|
||||
# elif OCTAVE_API_VERSION_NUMBER >= 39
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 51
|
||||
|
||||
# else // OCTAVE_API_VERSION_NUMBER == 38
|
||||
# define OCTAVE_MAJOR_VERSION 3
|
||||
# define OCTAVE_MINOR_VERSION 3
|
||||
# define OCTAVE_PATCH_VERSION 50
|
||||
|
||||
# endif // !defined(OCTAVE_API_VERSION_NUMBER)
|
||||
|
||||
#endif // !defined(OCTAVE_MAJOR_VERSION)
|
||||
|
||||
#include <octave/Cell.h>
|
||||
#include <octave/dynamic-ld.h>
|
||||
#include <octave/oct-env.h>
|
||||
|
|
@ -9,8 +95,16 @@
|
|||
#include <octave/ov-scalar.h>
|
||||
#include <octave/ov-fcn-handle.h>
|
||||
#include <octave/parse.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/interpreter.h>
|
||||
#else
|
||||
#include <octave/toplev.h>
|
||||
#endif
|
||||
#include <octave/unwind-prot.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/call-stack.h>
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg";
|
||||
|
|
@ -24,27 +118,34 @@
|
|||
static bool SWIG_init_user(octave_swig_type* module_ns);
|
||||
|
||||
SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
||||
bool retn;
|
||||
bool retn = false;
|
||||
{
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::begin_frame("SWIG_Octave_LoadModule");
|
||||
unwind_protect_int(error_state);
|
||||
unwind_protect_int(warning_state);
|
||||
unwind_protect_bool(discard_error_messages);
|
||||
unwind_protect_bool(discard_warning_messages);
|
||||
#else
|
||||
#if 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;
|
||||
#elif SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect frame;
|
||||
frame.protect_var(error_state);
|
||||
frame.protect_var(warning_state);
|
||||
frame.protect_var(discard_error_messages);
|
||||
frame.protect_var(discard_warning_messages);
|
||||
frame.protect_var(error_state); error_state = 0;
|
||||
frame.protect_var(warning_state); warning_state = 0;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
#else
|
||||
unwind_protect::begin_frame("SWIG_Octave_LoadModule");
|
||||
unwind_protect_int(error_state); error_state = 0;
|
||||
unwind_protect_int(warning_state); warning_state = 0;
|
||||
unwind_protect_bool(discard_error_messages); discard_error_messages = true;
|
||||
unwind_protect_bool(discard_warning_messages); discard_warning_messages = true;
|
||||
#endif
|
||||
error_state = 0;
|
||||
warning_state = 0;
|
||||
discard_error_messages = true;
|
||||
discard_warning_messages = true;
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
try {
|
||||
feval(name, octave_value_list(), 0);
|
||||
retn = true;
|
||||
} catch (octave::execution_exception&) { }
|
||||
#else
|
||||
feval(name, octave_value_list(), 0);
|
||||
retn = (error_state == 0);
|
||||
#endif
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::run_frame("SWIG_Octave_LoadModule");
|
||||
#endif
|
||||
|
|
@ -56,31 +157,37 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
|||
}
|
||||
|
||||
SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
|
||||
bool retn;
|
||||
bool retn = false;
|
||||
{
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::begin_frame("SWIG_Octave_InstallFunction");
|
||||
unwind_protect_int(error_state);
|
||||
unwind_protect_int(warning_state);
|
||||
unwind_protect_bool(discard_error_messages);
|
||||
unwind_protect_bool(discard_warning_messages);
|
||||
#else
|
||||
#if 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;
|
||||
#elif SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect frame;
|
||||
frame.protect_var(error_state);
|
||||
frame.protect_var(warning_state);
|
||||
frame.protect_var(discard_error_messages);
|
||||
frame.protect_var(discard_warning_messages);
|
||||
frame.protect_var(error_state); error_state = 0;
|
||||
frame.protect_var(warning_state); warning_state = 0;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
#else
|
||||
unwind_protect::begin_frame("SWIG_Octave_LoadModule");
|
||||
unwind_protect_int(error_state); error_state = 0;
|
||||
unwind_protect_int(warning_state); warning_state = 0;
|
||||
unwind_protect_bool(discard_error_messages); discard_error_messages = true;
|
||||
unwind_protect_bool(discard_warning_messages); discard_warning_messages = true;
|
||||
#endif
|
||||
error_state = 0;
|
||||
warning_state = 0;
|
||||
discard_error_messages = true;
|
||||
discard_warning_messages = true;
|
||||
octave_value_list args;
|
||||
args.append(name);
|
||||
args.append(octloadfcn->fcn_file_name());
|
||||
error_state = 0;
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
try {
|
||||
feval("autoload", args, 0);
|
||||
retn = true;
|
||||
} catch (octave::execution_exception&) { }
|
||||
#else
|
||||
feval("autoload", args, 0);
|
||||
retn = (error_state == 0);
|
||||
#endif
|
||||
#if !SWIG_OCTAVE_PREREQ(3,3,50)
|
||||
unwind_protect::run_frame("SWIG_Octave_InstallFunction");
|
||||
#endif
|
||||
|
|
@ -211,10 +318,11 @@ 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 affects version 3.2.*, not sure about 3.3.*, seems to be fixed in
|
||||
// version 3.4.* and above. can be turned off with macro definition.
|
||||
// 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.*.
|
||||
// can be turned off with macro definition.
|
||||
#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
|
||||
#if SWIG_OCTAVE_PREREQ(3,2,0) && !SWIG_OCTAVE_PREREQ(3,4,1)
|
||||
#if SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
octave_exit = ::_Exit;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,12 +69,16 @@
|
|||
value_type *vp = %new_instance(std::pair<T,U>);
|
||||
T *pfirst = &(vp->first);
|
||||
int res1 = swig::asval(first, pfirst);
|
||||
if (!SWIG_IsOK(res1))
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
%delete(vp);
|
||||
return res1;
|
||||
}
|
||||
U *psecond = &(vp->second);
|
||||
int res2 = swig::asval(second, psecond);
|
||||
if (!SWIG_IsOK(res2))
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
%delete(vp);
|
||||
return res2;
|
||||
}
|
||||
*val = vp;
|
||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||
} else {
|
||||
|
|
|
|||
1
Lib/octave/std_wstring.i
Normal file
1
Lib/octave/std_wstring.i
Normal file
|
|
@ -0,0 +1 @@
|
|||
%include <typemaps/std_string.swg>
|
||||
|
|
@ -10,14 +10,17 @@
|
|||
|
||||
%fragment("<string>");
|
||||
%{
|
||||
SWIGINTERN
|
||||
double SwigSvToNumber(SV* sv) {
|
||||
return SvIOK(sv) ? double(SvIVX(sv)) : SvNVX(sv);
|
||||
}
|
||||
SWIGINTERN
|
||||
std::string SwigSvToString(SV* sv) {
|
||||
STRLEN len;
|
||||
char *ptr = SvPV(sv, len);
|
||||
return std::string(ptr, len);
|
||||
}
|
||||
SWIGINTERN
|
||||
void SwigSvFromString(SV* sv, const std::string& s) {
|
||||
sv_setpvn(sv,s.data(),s.size());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,5 +235,5 @@ static swig_module_info *SWIG_Php_GetModule() {
|
|||
}
|
||||
|
||||
static void SWIG_Php_SetModule(swig_module_info *pointer) {
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0);
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,5 +276,5 @@ static swig_module_info *SWIG_Php_GetModule() {
|
|||
|
||||
static void SWIG_Php_SetModule(swig_module_info *pointer) {
|
||||
TSRMLS_FETCH();
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0);
|
||||
REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ SWIGINTERN Py_hash_t
|
|||
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
||||
Py_hash_t result = -1;
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
if (PyInt_Check(obj))
|
||||
result = PyInt_AsLong(obj);
|
||||
else
|
||||
#endif
|
||||
if (PyLong_Check(obj))
|
||||
result = PyLong_AsLong(obj);
|
||||
#else
|
||||
|
|
@ -21,7 +26,7 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
|||
#endif
|
||||
else
|
||||
PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
|
||||
return result;
|
||||
return PyErr_Occurred() ? -1 : result;
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
|
|
|
|||
|
|
@ -2,48 +2,8 @@
|
|||
#if defined(SWIGPYTHON_BUILTIN)
|
||||
%feature("python:slot", "sq_item", functype="ssizeargfunc") NAME::__getitem__;
|
||||
%feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__;
|
||||
|
||||
%inline %{
|
||||
typedef struct {
|
||||
TYPE *el;
|
||||
} NAME;
|
||||
%}
|
||||
|
||||
%extend NAME {
|
||||
|
||||
NAME(size_t nelements) {
|
||||
NAME *arr = %new_instance(NAME);
|
||||
arr->el = %new_array(nelements, TYPE);
|
||||
return arr;
|
||||
}
|
||||
|
||||
~NAME() {
|
||||
%delete_array(self->el);
|
||||
%delete(self);
|
||||
}
|
||||
|
||||
TYPE __getitem__(size_t index) {
|
||||
return self->el[index];
|
||||
}
|
||||
|
||||
void __setitem__(size_t index, TYPE value) {
|
||||
self->el[index] = value;
|
||||
}
|
||||
|
||||
TYPE * cast() {
|
||||
return self->el;
|
||||
}
|
||||
|
||||
static NAME *frompointer(TYPE *t) {
|
||||
return %reinterpret_cast(t, NAME *);
|
||||
}
|
||||
};
|
||||
|
||||
%types(NAME = TYPE);
|
||||
|
||||
#else
|
||||
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||
#endif
|
||||
%array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
|
||||
%enddef
|
||||
|
||||
%include <typemaps/carrays.swg>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace swig {
|
|||
|
||||
namespace std {
|
||||
template <>
|
||||
struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool>
|
||||
struct less <PyObject *>
|
||||
{
|
||||
bool
|
||||
operator()(PyObject * v, PyObject *w) const
|
||||
|
|
@ -133,7 +133,7 @@ namespace std {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
|
||||
struct less <swig::SwigPtr_PyObject>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
|
||||
|
|
@ -143,7 +143,7 @@ namespace std {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
|
||||
struct less <swig::SwigVar_PyObject>
|
||||
{
|
||||
bool
|
||||
operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asval(PyObject *obj, std::pair<T,U> *val) {
|
||||
|
|
@ -68,10 +68,16 @@
|
|||
value_type *vp = %new_instance(std::pair<T,U>);
|
||||
T *pfirst = &(vp->first);
|
||||
int res1 = swig::asval((PyObject*)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
%delete(vp);
|
||||
return res1;
|
||||
}
|
||||
U *psecond = &(vp->second);
|
||||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
%delete(vp);
|
||||
return res2;
|
||||
}
|
||||
*val = vp;
|
||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||
} else {
|
||||
|
|
@ -82,7 +88,7 @@
|
|||
int res2 = swig::asval((PyObject*)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asptr(PyObject *obj, std::pair<T,U> **val) {
|
||||
|
|
|
|||
|
|
@ -1,43 +1,5 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
// These are auto-supported by the Perl-module
|
||||
%rename(__plusplus__) *::operator++;
|
||||
%rename(__minmin__) *::operator--;
|
||||
%rename(__add__) *::operator+;
|
||||
%rename(__sub__) *::operator-;
|
||||
%rename(__neg__) *::operator-();
|
||||
%rename(__neg__) *::operator-() const;
|
||||
%rename(__mul__) *::operator*;
|
||||
%rename(__div__) *::operator/;
|
||||
%rename(__eq__) *::operator==;
|
||||
%rename(__ne__) *::operator!=;
|
||||
%rename(__mod__) *::operator%;
|
||||
%rename(__gt__) *::operator>;
|
||||
%rename(__lt__) *::operator<;
|
||||
%rename(__not__) *::operator!;
|
||||
|
||||
// These are renamed, but no 'use overload...' is added
|
||||
%rename(__lshift__) *::operator<<;
|
||||
%rename(__rshift__) *::operator>>;
|
||||
%rename(__and__) *::operator&;
|
||||
%rename(__or__) *::operator|;
|
||||
%rename(__xor__) *::operator^;
|
||||
%rename(__invert__) *::operator~;
|
||||
%rename(__le__) *::operator<=;
|
||||
%rename(__ge__) *::operator>=;
|
||||
%rename(__call__) *::operator();
|
||||
%rename(__getitem__) *::operator[];
|
||||
|
||||
%rename(__seteq__) *::operator=;
|
||||
|
||||
|
||||
%rename(__land__) operator&&;
|
||||
%rename(__lor__) operator||;
|
||||
%rename(__plusplus__) *::operator++;
|
||||
%rename(__minusminus__) *::operator--;
|
||||
%rename(__arrowstar__) *::operator->*;
|
||||
%rename(__index__) *::operator[];
|
||||
|
||||
%rename(Equal) operator =;
|
||||
%rename(PlusEqual) operator +=;
|
||||
%rename(MinusEqual) operator -=;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
namespace swig {
|
||||
template < class T >
|
||||
struct yield : public std::unary_function< T, bool >
|
||||
struct yield
|
||||
{
|
||||
bool
|
||||
operator()( const T& v ) const
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace swig {
|
|||
static ID call_id = rb_intern("call");
|
||||
|
||||
template <class _T = GC_VALUE, class _DefaultFunc = std::less<GC_VALUE> >
|
||||
struct BinaryPredicate : GC_VALUE, std::binary_function< _T, _T, bool >
|
||||
struct BinaryPredicate : GC_VALUE
|
||||
{
|
||||
BinaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { }
|
||||
bool operator()(_T a, _T b) const
|
||||
|
|
@ -109,7 +109,7 @@ namespace swig {
|
|||
};
|
||||
|
||||
template <class _T = GC_VALUE, class _DefaultFunc = std::less< _T > >
|
||||
struct BinaryFunction : GC_VALUE, std::binary_function< _T, _T, _T >
|
||||
struct BinaryFunction : GC_VALUE
|
||||
{
|
||||
BinaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { }
|
||||
_T operator()(_T a, _T b) const
|
||||
|
|
@ -128,7 +128,7 @@ namespace swig {
|
|||
};
|
||||
|
||||
template< class _T = GC_VALUE >
|
||||
struct UnaryPredicate : GC_VALUE, std::unary_function< _T, bool >
|
||||
struct UnaryPredicate : GC_VALUE
|
||||
{
|
||||
UnaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { }
|
||||
bool operator()(_T a) const
|
||||
|
|
@ -142,7 +142,7 @@ namespace swig {
|
|||
};
|
||||
|
||||
template< class _T = GC_VALUE >
|
||||
struct UnaryFunction : GC_VALUE, std::unary_function< _T, _T >
|
||||
struct UnaryFunction : GC_VALUE
|
||||
{
|
||||
UnaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { }
|
||||
_T operator()(_T a) const
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
int res2 = swig::asval((VALUE)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asval(VALUE obj, std::pair<T,U> *val) {
|
||||
|
|
@ -63,10 +63,16 @@
|
|||
value_type *vp = %new_instance(std::pair<T,U>);
|
||||
T *pfirst = &(vp->first);
|
||||
int res1 = swig::asval((VALUE)first, pfirst);
|
||||
if (!SWIG_IsOK(res1)) return res1;
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
%delete(vp);
|
||||
return res1;
|
||||
}
|
||||
U *psecond = &(vp->second);
|
||||
int res2 = swig::asval((VALUE)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
%delete(vp);
|
||||
return res2;
|
||||
}
|
||||
*val = vp;
|
||||
return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
|
||||
} else {
|
||||
|
|
@ -77,7 +83,7 @@
|
|||
int res2 = swig::asval((VALUE)second, psecond);
|
||||
if (!SWIG_IsOK(res2)) return res2;
|
||||
return res1 > res2 ? res1 : res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int asptr(VALUE obj, std::pair<T,U> **val) {
|
||||
|
|
|
|||
|
|
@ -251,8 +251,7 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
|
|||
void *pvTypeinfo = NULL;
|
||||
|
||||
sciErr = getListItemNumber(pvApiCtx, piAddrVar, &iItemCount);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
@ -335,7 +334,6 @@ SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info
|
|||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
|
||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 3, pvObj);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
|
|
@ -448,27 +446,36 @@ int SWIG_this(SWIG_GatewayParameters) {
|
|||
extern "C"
|
||||
#endif
|
||||
int SWIG_ptr(SWIG_GatewayParameters) {
|
||||
void *ptrValue = NULL;
|
||||
double dValue = 0;
|
||||
int *piAddr;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
|
||||
if(sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (getScalarDouble(pvApiCtx, piAddr, &dValue) == 0) {
|
||||
if (dValue != (uintptr_t)dValue) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_ValueError;
|
||||
}
|
||||
if ((dValue < 0) || (dValue > ULONG_MAX)) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_OverflowError;
|
||||
}
|
||||
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL));
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, ptrValue, NULL, 0, NULL));
|
||||
}
|
||||
else {
|
||||
return SWIG_ERROR;
|
||||
int *piAddr;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
|
||||
if(sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (getScalarDouble(pvApiCtx, piAddr, &dValue) == 0) {
|
||||
if (dValue != (uintptr_t)dValue) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_ValueError;
|
||||
}
|
||||
if ((dValue < 0) || (dValue > ULONG_MAX)) {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1);
|
||||
return SWIG_OverflowError;
|
||||
}
|
||||
SWIG_Scilab_SetOutputPosition(1);
|
||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL));
|
||||
}
|
||||
else {
|
||||
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A pointer or a double expected.\n"), "SWIG_ptr", 1);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,28 +122,37 @@
|
|||
}
|
||||
%enddef
|
||||
|
||||
/* Scilab equivalent for C integers can be sci_ints or sci_matrix */
|
||||
%define %scilab_typecheck_integer(PRECEDENCE, INTTYPE, TYPE)
|
||||
%typecheck(PRECEDENCE) TYPE {
|
||||
%fragment("SWIG_Check_SciDoubleOrInt", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_Check_SciDoubleOrInt(void *pvApiCtx, SwigSciObject iVar, int iIntegerType) {
|
||||
int *piAddrVar = NULL;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, $input, &piAddrVar);
|
||||
int ret = 0;
|
||||
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
return 0;
|
||||
}
|
||||
$1 = isIntegerType(pvApiCtx, piAddrVar);
|
||||
if ($1 == 1) {
|
||||
ret = isIntegerType(pvApiCtx, piAddrVar);
|
||||
if (ret == 1) {
|
||||
int iPrec = 0;
|
||||
sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
return 0;
|
||||
}
|
||||
$1 = (iPrec == INTTYPE) ? 1 : 0;
|
||||
ret = (iPrec == iIntegerType) ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
$1 = isDoubleType(pvApiCtx, piAddrVar);
|
||||
ret = isDoubleType(pvApiCtx, piAddrVar);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scilab equivalent for C integers can be sci_intXX or sci_matrix */
|
||||
%define %scilab_typecheck_integer(PRECEDENCE, INTTYPE, TYPE)
|
||||
%typecheck(PRECEDENCE, fragment="SWIG_Check_SciDoubleOrInt") TYPE {
|
||||
$1 = SWIG_Check_SciDoubleOrInt(pvApiCtx, $input, INTTYPE);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,24 @@
|
|||
size_type size() const;
|
||||
void swap(container& v);
|
||||
|
||||
%enddef
|
||||
|
||||
%define %std_container_methods_forward_iterators(container...)
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
class iterator;
|
||||
class reverse_iterator;
|
||||
class const_iterator;
|
||||
class const_reverse_iterator;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
#endif
|
||||
|
||||
%enddef
|
||||
|
||||
%define %std_container_methods_reverse_iterators(container...)
|
||||
|
||||
#ifdef SWIG_EXPORT_ITERATOR_METHODS
|
||||
class reverse_iterator;
|
||||
class const_reverse_iterator;
|
||||
reverse_iterator rbegin();
|
||||
reverse_iterator rend();
|
||||
#endif
|
||||
|
|
@ -34,7 +44,20 @@
|
|||
// Common container methods
|
||||
|
||||
%define %std_container_methods(container...)
|
||||
|
||||
%std_container_methods_non_resizable(%arg(container))
|
||||
%std_container_methods_forward_iterators(%arg(container))
|
||||
%std_container_methods_reverse_iterators(%arg(container))
|
||||
|
||||
void clear();
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
%enddef
|
||||
|
||||
%define %std_container_methods_without_reverse_iterators(container...)
|
||||
|
||||
%std_container_methods_non_resizable(%arg(container))
|
||||
%std_container_methods_forward_iterators(%arg(container))
|
||||
|
||||
void clear();
|
||||
allocator_type get_allocator() const;
|
||||
|
|
@ -65,6 +88,8 @@
|
|||
%define %std_sequence_methods_non_resizable(sequence)
|
||||
|
||||
%std_container_methods_non_resizable(%arg(sequence))
|
||||
%std_container_methods_forward_iterators(%arg(container))
|
||||
%std_container_methods_reverse_iterators(%arg(container))
|
||||
|
||||
const value_type& front() const;
|
||||
const value_type& back() const;
|
||||
|
|
@ -97,6 +122,8 @@
|
|||
%define %std_sequence_methods_non_resizable_val(sequence...)
|
||||
|
||||
%std_container_methods_non_resizable(%arg(sequence))
|
||||
%std_container_methods_forward_iterators(%arg(container))
|
||||
%std_container_methods_reverse_iterators(%arg(container))
|
||||
|
||||
value_type front() const;
|
||||
value_type back() const;
|
||||
|
|
|
|||
|
|
@ -225,15 +225,14 @@ SWIG_Tcl_ConvertPacked(Tcl_Interp *SWIGUNUSEDPARM(interp) , Tcl_Obj *obj, void *
|
|||
|
||||
/* Take a pointer and convert it to a string */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Tcl_MakePtr(char *c, void *ptr, swig_type_info *ty, int flags) {
|
||||
SWIG_Tcl_MakePtr(char *c, void *ptr, swig_type_info *ty, int SWIGUNUSEDPARM(flags)) {
|
||||
if (ptr) {
|
||||
*(c++) = '_';
|
||||
c = SWIG_PackData(c,&ptr,sizeof(void *));
|
||||
strcpy(c,ty->name);
|
||||
} else {
|
||||
strcpy(c,(char *)"NULL");
|
||||
strcpy(c,"NULL");
|
||||
}
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
/* Create a new pointer object */
|
||||
|
|
@ -287,14 +286,15 @@ SWIG_Tcl_SetModule(Tcl_Interp *interp, swig_module_info *module) {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------*
|
||||
* Object auxiliars
|
||||
* Object auxiliaries
|
||||
* -----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Tcl_ObjectDelete(ClientData clientData) {
|
||||
swig_instance *si = (swig_instance *) clientData;
|
||||
if ((si) && (si->destroy) && (SWIG_Disown(si->thisvalue))) {
|
||||
if (!si) return;
|
||||
if (si->destroy && SWIG_Disown(si->thisvalue)) {
|
||||
if (si->classptr->destructor) {
|
||||
(si->classptr->destructor)(si->thisvalue);
|
||||
}
|
||||
|
|
@ -344,7 +344,6 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
|
|||
}
|
||||
cls_stack[cls_stack_top] = inst->classptr;
|
||||
cls_stack_bi[cls_stack_top] = -1;
|
||||
cls = inst->classptr;
|
||||
while (1) {
|
||||
Tcl_HashEntry* hashentry;
|
||||
bi = cls_stack_bi[cls_stack_top];
|
||||
|
|
|
|||
|
|
@ -168,11 +168,25 @@
|
|||
%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
|
||||
/* isfinite() is a macro for C99, but a function in namespace std for C++11. */
|
||||
/* isfinite() is a macro for C99 */
|
||||
# if defined(isfinite)
|
||||
# define SWIG_isfinite(X) (isfinite(X))
|
||||
# elif defined __cplusplus && __cplusplus >= 201103L
|
||||
# define SWIG_isfinite(X) (std::isfinite(X))
|
||||
/* Use a template so that this works whether isfinite() is std::isfinite() or
|
||||
* in the global namespace. The reality seems to vary between compiler
|
||||
* versions.
|
||||
*
|
||||
* Make sure namespace std exists to avoid compiler warnings.
|
||||
*
|
||||
* extern "C++" is required as this fragment can end up inside an extern "C" { } block
|
||||
*/
|
||||
namespace std { }
|
||||
extern "C++" template<typename T>
|
||||
inline int SWIG_isfinite_func(T x) {
|
||||
using namespace std;
|
||||
return isfinite(x);
|
||||
}
|
||||
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
|
||||
# elif defined(_MSC_VER)
|
||||
# define SWIG_isfinite(X) (_finite(X))
|
||||
# elif defined(__sun) && defined(__SVR4)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ SWIG_pchar_descriptor(void)
|
|||
}
|
||||
|
||||
%fragment("SWIG_strnlen","header",fragment="SWIG_FromCharPtrAndSize") {
|
||||
size_t
|
||||
SWIGINTERN size_t
|
||||
SWIG_strnlen(const char* s, size_t maxlen)
|
||||
{
|
||||
const char *p;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
%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_array(size,Type) Allocate a new array with given size and Type and zero initialize
|
||||
%new_copy_array(cptr,size,Type) Allocate and initialize a new array from 'cptr'
|
||||
%delete(cptr) Delete an instance
|
||||
%delete_array(cptr) Delete an array
|
||||
|
|
@ -157,17 +157,17 @@ nocppval
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define %new_instance(Type...) (new Type)
|
||||
# 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])
|
||||
# define %new_copy_array(ptr,size,Type...) %reinterpret_cast(memcpy(%new_array(size,Type), ptr, sizeof(Type)*(size)), Type*)
|
||||
# define %new_array(size,Type...) (new Type[size]())
|
||||
# define %new_copy_array(ptr,size,Type...) %reinterpret_cast(memcpy(new Type[size], ptr, sizeof(Type)*(size)), Type*)
|
||||
# define %delete(cptr) delete cptr
|
||||
# define %delete_array(cptr) delete[] cptr
|
||||
#else /* C case */
|
||||
# define %new_instance(Type...) (Type *)malloc(sizeof(Type))
|
||||
# define %new_instance(Type...) (Type *)calloc(1,sizeof(Type))
|
||||
# define %new_copy(val,Type...) (Type *)memcpy(%new_instance(Type),&val,sizeof(Type))
|
||||
# define %new_array(size,Type...) (Type *)malloc((size)*sizeof(Type))
|
||||
# define %new_copy_array(ptr,size,Type...) (Type *)memcpy(%new_array(size,Type), ptr, sizeof(Type)*(size))
|
||||
# define %new_array(size,Type...) (Type *)calloc(size, sizeof(Type))
|
||||
# define %new_copy_array(ptr,size,Type...) (Type *)memcpy(malloc((size)*sizeof(Type)), ptr, sizeof(Type)*(size))
|
||||
# define %delete(cptr) free((char*)cptr)
|
||||
# define %delete_array(cptr) free((char*)cptr)
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ SWIG_pwchar_descriptor()
|
|||
}
|
||||
|
||||
%fragment("SWIG_wcsnlen","header",fragment="SWIG_FromWCharPtrAndSize") {
|
||||
size_t
|
||||
SWIGINTERN size_t
|
||||
SWIG_wcsnlen(const wchar_t* s, size_t maxlen)
|
||||
{
|
||||
const wchar_t *p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue