typemap name changes:
inv => directorin outv => directorout argoutv => directorargout git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5137 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
20fabf7ff3
commit
7ee01311b2
24 changed files with 500 additions and 501 deletions
|
|
@ -225,7 +225,7 @@ JAVA_ARRAYS_IMPL(double, jdouble, Double, Double) /* double[] */
|
|||
if (!SWIG_JavaArrayIn##JFUNCNAME(jenv, &jarr, &$1, $input)) return $null; %}
|
||||
%typemap(argout) CTYPE[ANY]
|
||||
%{ SWIG_JavaArrayArgout##JFUNCNAME(jenv, jarr$argnum, $1, $input); %}
|
||||
%typemap(inv,parse=JNIDESC) CTYPE[ANY]
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE[ANY]
|
||||
%{$input = SWIG_JavaArrayOut##JFUNCNAME(jenv, $1, $1_dim0); %}
|
||||
%typemap(out) CTYPE[ANY]
|
||||
%{$result = SWIG_JavaArrayOut##JFUNCNAME(jenv, $1, $1_dim0); %}
|
||||
|
|
|
|||
|
|
@ -179,49 +179,49 @@
|
|||
enum SWIGTYPE
|
||||
%{ $1 = ($1_ltype)$input; %}
|
||||
|
||||
%typemap(inv, parse="Z") bool "$input = (jboolean) $1;"
|
||||
%typemap(inv, parse="C") char "$input = (jint) $1;"
|
||||
%typemap(inv, parse="B") signed char "$input = (jbyte) $1;"
|
||||
%typemap(inv, parse="S") unsigned char "$input = (jshort) $1;"
|
||||
%typemap(inv, parse="S") short "$input = (jshort) $1;"
|
||||
%typemap(inv, parse="I") unsigned short "$input = (jint) $1;"
|
||||
%typemap(inv, parse="I") int "$input = (jint) $1;"
|
||||
%typemap(inv, parse="J") unsigned int "$input = (jlong) $1;"
|
||||
%typemap(inv, parse="I") long "$input = (jint) $1;"
|
||||
%typemap(inv, parse="J") unsigned long "$input = (jlong) $1;"
|
||||
%typemap(inv, parse="J") long long "$input = (jlong) $1;"
|
||||
%typemap(inv, parse="F") float "$input = (jfloat) $1;"
|
||||
%typemap(inv, parse="D") double "$input = (jdouble) $1;"
|
||||
%typemap(inv, parse="I") enum SWIGTYPE "$input = (jint) $1;"
|
||||
%typemap(directorin, parse="Z") bool "$input = (jboolean) $1;"
|
||||
%typemap(directorin, parse="C") char "$input = (jint) $1;"
|
||||
%typemap(directorin, parse="B") signed char "$input = (jbyte) $1;"
|
||||
%typemap(directorin, parse="S") unsigned char "$input = (jshort) $1;"
|
||||
%typemap(directorin, parse="S") short "$input = (jshort) $1;"
|
||||
%typemap(directorin, parse="I") unsigned short "$input = (jint) $1;"
|
||||
%typemap(directorin, parse="I") int "$input = (jint) $1;"
|
||||
%typemap(directorin, parse="J") unsigned int "$input = (jlong) $1;"
|
||||
%typemap(directorin, parse="I") long "$input = (jint) $1;"
|
||||
%typemap(directorin, parse="J") unsigned long "$input = (jlong) $1;"
|
||||
%typemap(directorin, parse="J") long long "$input = (jlong) $1;"
|
||||
%typemap(directorin, parse="F") float "$input = (jfloat) $1;"
|
||||
%typemap(directorin, parse="D") double "$input = (jdouble) $1;"
|
||||
%typemap(directorin, parse="I") enum SWIGTYPE "$input = (jint) $1;"
|
||||
|
||||
%typemap(javadirectorin) char,
|
||||
signed char,
|
||||
unsigned char,
|
||||
short,
|
||||
unsigned short,
|
||||
int,
|
||||
unsigned int,
|
||||
long,
|
||||
unsigned long,
|
||||
long long,
|
||||
float,
|
||||
double,
|
||||
enum SWIGTYPE
|
||||
signed char,
|
||||
unsigned char,
|
||||
short,
|
||||
unsigned short,
|
||||
int,
|
||||
unsigned int,
|
||||
long,
|
||||
unsigned long,
|
||||
long long,
|
||||
float,
|
||||
double,
|
||||
enum SWIGTYPE
|
||||
"$jniinput"
|
||||
|
||||
%typemap(javadirectorout) char,
|
||||
signed char,
|
||||
unsigned char,
|
||||
short,
|
||||
unsigned short,
|
||||
int,
|
||||
unsigned int,
|
||||
long,
|
||||
unsigned long,
|
||||
long long,
|
||||
float,
|
||||
double,
|
||||
enum SWIGTYPE
|
||||
signed char,
|
||||
unsigned char,
|
||||
short,
|
||||
unsigned short,
|
||||
int,
|
||||
unsigned int,
|
||||
long,
|
||||
unsigned long,
|
||||
long long,
|
||||
float,
|
||||
double,
|
||||
enum SWIGTYPE
|
||||
"$javacall"
|
||||
|
||||
%typemap(out) bool %{ $result = (jboolean)$1; %}
|
||||
|
|
@ -292,7 +292,7 @@
|
|||
}
|
||||
|
||||
/* Convert to BigInteger (see out typemap) */
|
||||
%typemap(inv, parse="Ljava/math/Biginteger;") unsigned long long, const unsigned long long & {
|
||||
%typemap(directorin, parse="Ljava/math/Biginteger;") 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");
|
||||
|
|
@ -322,7 +322,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(inv, parse="Ljava/lang/String;") char * {
|
||||
%typemap(directorin, parse="Ljava/lang/String;") char * {
|
||||
$input = 0;
|
||||
if ($1) {
|
||||
$input = JCALL1(NewStringUTF, jenv, $1);
|
||||
|
|
@ -337,7 +337,7 @@
|
|||
%typemap(out) void ""
|
||||
%typemap(javadirectorin) void "$jniinput"
|
||||
%typemap(javadirectorout) void "$javacall"
|
||||
%typemap(inv, parse="V") void ""
|
||||
%typemap(directorin, parse="V") void ""
|
||||
|
||||
/* primitive types by reference */
|
||||
%typemap(in) const bool & (bool temp)
|
||||
|
|
@ -362,46 +362,46 @@
|
|||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = &temp; %}
|
||||
|
||||
%typemap(inv, parse="Z") const bool & "$input = (jboolean)$1_name;"
|
||||
%typemap(inv, parse="C") const char & "$input = (jchar)$1_name;"
|
||||
%typemap(inv, parse="B") const signed char & "$input = (jbyte)$1_name;"
|
||||
%typemap(inv, parse="S") const unsigned char & "$input = (jshort)$1_name;"
|
||||
%typemap(inv, parse="S") const short & "$input = (jshort)$1_name;"
|
||||
%typemap(inv, parse="I") const unsigned short & "$input = (jint)$1_name;"
|
||||
%typemap(inv, parse="I") const int & "$input = (jint)$1_name;"
|
||||
%typemap(inv, parse="J") const unsigned int & "$input = (jlong)$1_name;"
|
||||
%typemap(inv, parse="I") const long & "$input = (jint)$1_name;"
|
||||
%typemap(inv, parse="J") const unsigned long & "$input = (jlong)$1_name;"
|
||||
%typemap(inv, parse="J") const long long & "$input = (jlong)$1_name;"
|
||||
%typemap(inv, parse="F") const float & "$input = (jfloat)$1_name;"
|
||||
%typemap(inv, parse="D") const double & "$input = (jdouble)$1_name;"
|
||||
%typemap(directorin, parse="Z") const bool & "$input = (jboolean)$1_name;"
|
||||
%typemap(directorin, parse="C") const char & "$input = (jchar)$1_name;"
|
||||
%typemap(directorin, parse="B") const signed char & "$input = (jbyte)$1_name;"
|
||||
%typemap(directorin, parse="S") const unsigned char & "$input = (jshort)$1_name;"
|
||||
%typemap(directorin, parse="S") const short & "$input = (jshort)$1_name;"
|
||||
%typemap(directorin, parse="I") const unsigned short & "$input = (jint)$1_name;"
|
||||
%typemap(directorin, parse="I") const int & "$input = (jint)$1_name;"
|
||||
%typemap(directorin, parse="J") const unsigned int & "$input = (jlong)$1_name;"
|
||||
%typemap(directorin, parse="I") const long & "$input = (jint)$1_name;"
|
||||
%typemap(directorin, parse="J") const unsigned long & "$input = (jlong)$1_name;"
|
||||
%typemap(directorin, parse="J") const long long & "$input = (jlong)$1_name;"
|
||||
%typemap(directorin, parse="F") const float & "$input = (jfloat)$1_name;"
|
||||
%typemap(directorin, parse="D") const double & "$input = (jdouble)$1_name;"
|
||||
|
||||
%typemap(javadirectorin) const char & (char temp),
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp),
|
||||
const short & (short temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const int & (int temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const long & (long temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const float & (float temp),
|
||||
const double & (double temp)
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp),
|
||||
const short & (short temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const int & (int temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const long & (long temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const float & (float temp),
|
||||
const double & (double temp)
|
||||
"$jniinput"
|
||||
|
||||
%typemap(javadirectorout) const char & (char temp),
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp),
|
||||
const short & (short temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const int & (int temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const long & (long temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const float & (float temp),
|
||||
const double & (double temp)
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp),
|
||||
const short & (short temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const int & (int temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const long & (long temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const float & (float temp),
|
||||
const double & (double temp)
|
||||
"$javacall"
|
||||
|
||||
|
||||
|
|
@ -494,7 +494,7 @@
|
|||
}
|
||||
#endif
|
||||
|
||||
%typemap(inv,parse="L$packagepath/$javaclassname;") SWIGTYPE "*(($&1_type)&$input) = &$1;"
|
||||
%typemap(directorin,parse="L$packagepath/$javaclassname;") SWIGTYPE "*(($&1_type)&$input) = &$1;"
|
||||
%typemap(javadirectorin) SWIGTYPE "new $javaclassname($jniinput, false)"
|
||||
%typemap(javadirectorout) SWIGTYPE "$javaclassname.getCPtr($javacall)"
|
||||
|
||||
|
|
@ -510,10 +510,10 @@
|
|||
%typemap(out) SWIGTYPE &
|
||||
%{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
%typemap(inv,parse="L$packagepath/$javaclassname;") SWIGTYPE *, SWIGTYPE (CLASS::*)
|
||||
%typemap(directorin,parse="L$packagepath/$javaclassname;") SWIGTYPE *, SWIGTYPE (CLASS::*)
|
||||
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
|
||||
|
||||
%typemap(inv,parse="L$packagepath/$javaclassname;") SWIGTYPE &
|
||||
%typemap(directorin,parse="L$packagepath/$javaclassname;") SWIGTYPE &
|
||||
%{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
|
||||
|
||||
%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, const SWIGTYPE & "new $javaclassname($jniinput, false)"
|
||||
|
|
@ -532,7 +532,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") char[ANY] "$input = JCALL1(NewStringUTF, jenv, $1_name);"
|
||||
%typemap(directorin,parse="Ljava/lang/String;") char[ANY] "$input = JCALL1(NewStringUTF, jenv, $1_name);"
|
||||
|
||||
%typemap(argout) char[ANY] ""
|
||||
%typemap(freearg) char[ANY] { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1); }
|
||||
|
|
@ -583,66 +583,66 @@
|
|||
jobjectArray
|
||||
%{ $result = $1; %}
|
||||
|
||||
%typemap(inv,parse="Z") jboolean "$input = $1;"
|
||||
%typemap(inv,parse="C") jchar "$input = $1;"
|
||||
%typemap(inv,parse="B") jbyte "$input = $1;"
|
||||
%typemap(inv,parse="S") jshort "$input = $1;"
|
||||
%typemap(inv,parse="I") jint "$input = $1;"
|
||||
%typemap(inv,parse="J") jlong "$input = $1;"
|
||||
%typemap(inv,parse="F") jfloat "$input = $1;"
|
||||
%typemap(inv,parse="D") jdouble "$input = $1;"
|
||||
%typemap(inv,parse="Ljava/lang/String;") jstring "$input = $1;"
|
||||
%typemap(inv,parse="Ljava/lang/Object;") jobject "$input = $1;"
|
||||
%typemap(inv,parse="[Z") jbooleanArray "$input = $1;"
|
||||
%typemap(inv,parse="[C") jcharArray "$input = $1;"
|
||||
%typemap(inv,parse="[B") jbyteArray "$input = $1;"
|
||||
%typemap(inv,parse="[S") jshortArray "$input = $1;"
|
||||
%typemap(inv,parse="[I") jintArray "$input = $1;"
|
||||
%typemap(inv,parse="[J") jlongArray "$input = $1;"
|
||||
%typemap(inv,parse="[F") jfloatArray "$input = $1;"
|
||||
%typemap(inv,parse="[D") jdoubleArray "$input = $1;"
|
||||
%typemap(inv,parse="[Ljava/lang/Object;") jobjectArray "$input = $1;"
|
||||
%typemap(directorin,parse="Z") jboolean "$input = $1;"
|
||||
%typemap(directorin,parse="C") jchar "$input = $1;"
|
||||
%typemap(directorin,parse="B") jbyte "$input = $1;"
|
||||
%typemap(directorin,parse="S") jshort "$input = $1;"
|
||||
%typemap(directorin,parse="I") jint "$input = $1;"
|
||||
%typemap(directorin,parse="J") jlong "$input = $1;"
|
||||
%typemap(directorin,parse="F") jfloat "$input = $1;"
|
||||
%typemap(directorin,parse="D") jdouble "$input = $1;"
|
||||
%typemap(directorin,parse="Ljava/lang/String;") jstring "$input = $1;"
|
||||
%typemap(directorin,parse="Ljava/lang/Object;") jobject "$input = $1;"
|
||||
%typemap(directorin,parse="[Z") jbooleanArray "$input = $1;"
|
||||
%typemap(directorin,parse="[C") jcharArray "$input = $1;"
|
||||
%typemap(directorin,parse="[B") jbyteArray "$input = $1;"
|
||||
%typemap(directorin,parse="[S") jshortArray "$input = $1;"
|
||||
%typemap(directorin,parse="[I") jintArray "$input = $1;"
|
||||
%typemap(directorin,parse="[J") jlongArray "$input = $1;"
|
||||
%typemap(directorin,parse="[F") jfloatArray "$input = $1;"
|
||||
%typemap(directorin,parse="[D") jdoubleArray "$input = $1;"
|
||||
%typemap(directorin,parse="[Ljava/lang/Object;") jobjectArray "$input = $1;"
|
||||
|
||||
%typemap(javadirectorin) jboolean,
|
||||
jchar,
|
||||
jbyte,
|
||||
jshort,
|
||||
jint,
|
||||
jlong,
|
||||
jfloat,
|
||||
jdouble,
|
||||
jstring,
|
||||
jobject,
|
||||
jbooleanArray,
|
||||
jcharArray,
|
||||
jbyteArray,
|
||||
jshortArray,
|
||||
jintArray,
|
||||
jlongArray,
|
||||
jfloatArray,
|
||||
jdoubleArray,
|
||||
jobjectArray
|
||||
jchar,
|
||||
jbyte,
|
||||
jshort,
|
||||
jint,
|
||||
jlong,
|
||||
jfloat,
|
||||
jdouble,
|
||||
jstring,
|
||||
jobject,
|
||||
jbooleanArray,
|
||||
jcharArray,
|
||||
jbyteArray,
|
||||
jshortArray,
|
||||
jintArray,
|
||||
jlongArray,
|
||||
jfloatArray,
|
||||
jdoubleArray,
|
||||
jobjectArray
|
||||
"$jniinput"
|
||||
|
||||
%typemap(javadirectorout) jboolean,
|
||||
jchar,
|
||||
jbyte,
|
||||
jshort,
|
||||
jint,
|
||||
jlong,
|
||||
jfloat,
|
||||
jdouble,
|
||||
jstring,
|
||||
jobject,
|
||||
jbooleanArray,
|
||||
jcharArray,
|
||||
jbyteArray,
|
||||
jshortArray,
|
||||
jintArray,
|
||||
jlongArray,
|
||||
jfloatArray,
|
||||
jdoubleArray,
|
||||
jobjectArray
|
||||
jchar,
|
||||
jbyte,
|
||||
jshort,
|
||||
jint,
|
||||
jlong,
|
||||
jfloat,
|
||||
jdouble,
|
||||
jstring,
|
||||
jobject,
|
||||
jbooleanArray,
|
||||
jcharArray,
|
||||
jbyteArray,
|
||||
jshortArray,
|
||||
jintArray,
|
||||
jlongArray,
|
||||
jfloatArray,
|
||||
jdoubleArray,
|
||||
jobjectArray
|
||||
"$javacall"
|
||||
|
||||
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class string;
|
|||
return $null;
|
||||
} %}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") string
|
||||
%typemap(directorin,parse="Ljava/lang/String;") string
|
||||
%{ $input = jenv->NewStringUTF($1.c_str()); %}
|
||||
|
||||
%typemap(out) string
|
||||
|
|
@ -80,7 +80,7 @@ class string;
|
|||
%typemap(freearg) const string &
|
||||
%{ delete $1; %}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") const string &
|
||||
%typemap(directorin,parse="Ljava/lang/String;") const string &
|
||||
%{ $input = jenv->NewStringUTF($1.c_str()); %}
|
||||
|
||||
%typemap(out) const string &
|
||||
|
|
@ -142,7 +142,7 @@ class wstring;
|
|||
return $null;
|
||||
} %}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") wstring
|
||||
%typemap(directorin,parse="Ljava/lang/String;") wstring
|
||||
%{jsize len = $1.length();
|
||||
jchar *conv_buf = new jchar[len];
|
||||
for (jsize i = 0; i < len; ++i) {
|
||||
|
|
@ -194,7 +194,7 @@ class wstring;
|
|||
return $null;
|
||||
} %}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") const wstring &
|
||||
%typemap(directorin,parse="Ljava/lang/String;") const wstring &
|
||||
%{jsize len = $1->length();
|
||||
jchar *conv_buf = new jchar[len];
|
||||
for (jsize i = 0; i < len; ++i) {
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ In Java you could then use it like this:
|
|||
%typemap(in) CTYPE *INPUT, CTYPE &INPUT
|
||||
%{ $1 = ($1_ltype)&$input; %}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CYTPE &INPUT
|
||||
%typemap(directorin,parse=JNIDESC) CYTPE &INPUT
|
||||
%{ *(($&1_ltype) $input) = (JNITYPE *) &$1; %}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CTYPE *INPUT
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE *INPUT
|
||||
%{ *(($&1_ltype) $input) = (JNITYPE *) $1; %}
|
||||
|
||||
%typemap(typecheck) CTYPE *INPUT = CTYPE;
|
||||
|
|
@ -220,12 +220,12 @@ value in the single element array. In Java you would use it like this:
|
|||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CTYPE &OUTPUT
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE &OUTPUT
|
||||
%{ *(($&1_ltype) $input = &$1; %}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CTYPE *OUTPUT
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE *OUTPUT
|
||||
%{
|
||||
#error "Need to provide OUT inv typemap, CTYPE array length is unknown"
|
||||
#error "Need to provide OUT directorin typemap, CTYPE array length is unknown"
|
||||
%}
|
||||
|
||||
%typemap(argout) CTYPE *OUTPUT, CTYPE &OUTPUT
|
||||
|
|
@ -354,12 +354,12 @@ of the function return value. This difference is due to Java being a typed langu
|
|||
$1 = ($1_ltype) JCALL2(Get##JAVATYPE##ArrayElements, jenv, $input, 0);
|
||||
}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CTYPE &INOUT
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE &INOUT
|
||||
%{ *(($&1_ltype)&$input) = &$1; %}
|
||||
|
||||
%typemap(inv,parse=JNIDESC) CTYPE *INOUT, CTYPE &INOUT
|
||||
%typemap(directorin,parse=JNIDESC) CTYPE *INOUT, CTYPE &INOUT
|
||||
{
|
||||
#error "Need to provide INOUT inv typemap, CTYPE array length is unknown"
|
||||
#error "Need to provide INOUT directorin typemap, CTYPE array length is unknown"
|
||||
}
|
||||
|
||||
%typemap(argout) CTYPE *INOUT, CTYPE &INOUT
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
%typemap(freearg) char **STRING_IN
|
||||
%{ free($1); %}
|
||||
|
||||
%typemap(inv, parse="Ljava/lang/String;") char **STRING_IN
|
||||
%typemap(directorin, parse="Ljava/lang/String;") char **STRING_IN
|
||||
%{ $input = JCALL1(NewStringUTF, jenv, *$1); %}
|
||||
|
||||
/* char **STRING_OUT - result must be a null terminated string */
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") char **STRING_OUT
|
||||
%typemap(directorin,parse="Ljava/lang/String;") char **STRING_OUT
|
||||
%{ $input = JCALL1(NewStringUTF, jenv, *$1); %}
|
||||
|
||||
/* char **STRING_RET - a NULL terminated array of char* */
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(inv,parse="Ljava/lang/String;") char **STRING_RET
|
||||
%typemap(directorin,parse="Ljava/lang/String;") char **STRING_RET
|
||||
%{ $input = JCALL1(NewStringUTF, jenv, *$1; %}
|
||||
|
||||
/* float *FLOAT_ARRAY_RETURN */
|
||||
|
|
@ -106,9 +106,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(inv,parse="[F") float *FLOATARRAYRETURN
|
||||
%typemap(directorin,parse="[F") float *FLOATARRAYRETURN
|
||||
%{
|
||||
#error "Need inv typemape for FLOATARRAYRETURN, array input size is unknown."
|
||||
#error "Need directorin typemape for FLOATARRAYRETURN, array input size is unknown."
|
||||
%}
|
||||
|
||||
/* char *BYTE */
|
||||
|
|
@ -125,9 +125,9 @@
|
|||
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0);
|
||||
}
|
||||
|
||||
%typemap(inv,parse="[B") char *BYTE
|
||||
%typemap(directorin,parse="[B") char *BYTE
|
||||
%{
|
||||
#error "Need inv typemape for BYTE, array input size is unknown."
|
||||
#error "Need directorin typemape for BYTE, array input size is unknown."
|
||||
%}
|
||||
|
||||
/* Prevent default freearg typemap from being used */
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ type _value = c_obj
|
|||
%define %make_simple_array_typemap(type,out_f,in_f)
|
||||
%array_tmap_out(out,type,out_f);
|
||||
%array_tmap_out(varout,type,out_f);
|
||||
%array_tmap_out(inv,type,out_f);
|
||||
%array_tmap_out(directorin,type,out_f);
|
||||
|
||||
%array_tmap_in(in,type,in_f);
|
||||
%array_tmap_in(varin,type,in_f);
|
||||
%array_tmap_in(outv,type,in_f);
|
||||
%array_tmap_in(directorout,type,in_f);
|
||||
%enddef
|
||||
|
||||
%make_simple_array_typemap(bool,caml_val_bool,caml_long_val);
|
||||
|
|
|
|||
|
|
@ -49,33 +49,33 @@ private:
|
|||
/* reset the _up flag once the routing direction has been determined */
|
||||
#ifdef __PTHREAD__
|
||||
void __clear_up() const {
|
||||
__DIRECTOR__::_up = 0;
|
||||
__DIRECTOR__::_mutex_active = 0;
|
||||
pthread_mutex_unlock(&_mutex_up);
|
||||
__DIRECTOR__::_up = 0;
|
||||
__DIRECTOR__::_mutex_active = 0;
|
||||
pthread_mutex_unlock(&_mutex_up);
|
||||
}
|
||||
#else
|
||||
void __clear_up() const {
|
||||
__DIRECTOR__::_up = 0;
|
||||
__DIRECTOR__::_up = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
/* wrap a ocaml object, optionally taking ownership */
|
||||
__DIRECTOR__(CAML_VALUE self, int disown): _self(self), _disown(disown) {
|
||||
register_global_root(&_self);
|
||||
register_global_root(&_self);
|
||||
}
|
||||
|
||||
/* discard our reference at destruction */
|
||||
virtual ~__DIRECTOR__() {
|
||||
remove_global_root(&_self);
|
||||
__disown();
|
||||
remove_global_root(&_self);
|
||||
__disown();
|
||||
// Disown is safe here because we're just divorcing a reference that
|
||||
// points to us.
|
||||
// points to us.
|
||||
}
|
||||
|
||||
/* return a pointer to the wrapped ocaml object */
|
||||
CAML_VALUE __get_self() const {
|
||||
return callback(*caml_named_value("caml_director_get_self"),_self);
|
||||
return callback(*caml_named_value("caml_director_get_self"),_self);
|
||||
}
|
||||
|
||||
/* get the _up flag to determine if the method call should be routed
|
||||
|
|
@ -83,20 +83,20 @@ public:
|
|||
*/
|
||||
#ifdef __PTHREAD__
|
||||
int __get_up() const {
|
||||
if (__DIRECTOR__::_mutex_active) {
|
||||
if (pthread_equal(__DIRECTOR__::_mutex_thread, pthread_self())) {
|
||||
int up = _up;
|
||||
__clear_up();
|
||||
return up;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (__DIRECTOR__::_mutex_active) {
|
||||
if (pthread_equal(__DIRECTOR__::_mutex_thread, pthread_self())) {
|
||||
int up = _up;
|
||||
__clear_up();
|
||||
return up;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int __get_up() const {
|
||||
int up = _up;
|
||||
_up = 0;
|
||||
return up;
|
||||
int up = _up;
|
||||
_up = 0;
|
||||
return up;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -105,24 +105,24 @@ public:
|
|||
*/
|
||||
#ifdef __PTHREAD__
|
||||
void __set_up() const {
|
||||
pthread_mutex_lock(&__DIRECTOR__::_mutex_up);
|
||||
__DIRECTOR__::_mutex_thread = pthread_self();
|
||||
__DIRECTOR__::_mutex_active = 1;
|
||||
__DIRECTOR__::_up = 1;
|
||||
pthread_mutex_lock(&__DIRECTOR__::_mutex_up);
|
||||
__DIRECTOR__::_mutex_thread = pthread_self();
|
||||
__DIRECTOR__::_mutex_active = 1;
|
||||
__DIRECTOR__::_up = 1;
|
||||
}
|
||||
#else
|
||||
void __set_up() const {
|
||||
__DIRECTOR__::_up = 1;
|
||||
__DIRECTOR__::_up = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* acquire ownership of the wrapped ocaml object (the sense of "disown"
|
||||
* is from ocaml) */
|
||||
void __disown() const {
|
||||
if (!_disown) {
|
||||
_disown=1;
|
||||
callback(*caml_named_value("caml_obj_disown"),_self);
|
||||
}
|
||||
if (!_disown) {
|
||||
_disown=1;
|
||||
callback(*caml_named_value("caml_obj_disown"),_self);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -140,9 +140,9 @@ int __DIRECTOR__::_mutex_active = 0;
|
|||
|
||||
%insert(mli) %{
|
||||
val new_derived_object:
|
||||
(c_obj -> c_obj) ->
|
||||
(c_obj -> string -> c_obj -> c_obj) ->
|
||||
c_obj -> c_obj
|
||||
(c_obj -> c_obj) ->
|
||||
(c_obj -> string -> c_obj -> c_obj) ->
|
||||
c_obj -> c_obj
|
||||
%}
|
||||
|
||||
%insert(ml) %{
|
||||
|
|
@ -160,9 +160,9 @@ let new_derived_object cfun x_class args =
|
|||
let obj =
|
||||
cfun (match args with
|
||||
C_list argl ->
|
||||
(C_list ((C_director_core (C_obj new_class,ob_ref)) :: argl))
|
||||
| a -> (C_list [ C_director_core
|
||||
(C_obj new_class,ob_ref) ; a ])) in
|
||||
(C_list ((C_director_core (C_obj new_class,ob_ref)) :: argl))
|
||||
| a -> (C_list [ C_director_core
|
||||
(C_obj new_class,ob_ref) ; a ])) in
|
||||
ob_ref := Some obj ;
|
||||
obj
|
||||
end
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
%typemap(varin) C_NAME & {
|
||||
$1 = MZ_TO_C($input);
|
||||
}
|
||||
%typemap(outv) C_NAME {
|
||||
%typemap(directorout) C_NAME {
|
||||
$1 = MZ_TO_C($input);
|
||||
}
|
||||
%typemap(in) C_NAME *INPUT ($*1_ltype temp) {
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
%typemap(argout) C_NAME & {
|
||||
swig_result = caml_list_append(swig_result,C_TO_MZ((long)*$1));
|
||||
}
|
||||
%typemap(inv) C_NAME {
|
||||
%typemap(directorin) C_NAME {
|
||||
args = caml_list_append(args,C_TO_MZ($1_name));
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -225,7 +225,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
|
||||
%char_ptr_in(in);
|
||||
%char_ptr_in(varin);
|
||||
%char_ptr_in(outv);
|
||||
%char_ptr_in(directorout);
|
||||
|
||||
%define %char_ptr_out(how)
|
||||
%typemap(how)
|
||||
|
|
@ -242,7 +242,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
|
||||
%char_ptr_out(out);
|
||||
%char_ptr_out(varout);
|
||||
%char_ptr_out(invv);
|
||||
%char_ptr_out(directorin);
|
||||
|
||||
%define %swigtype_ptr_in(how)
|
||||
%typemap(how) SWIGTYPE * {
|
||||
|
|
@ -276,10 +276,10 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
|
||||
%swigtype_ptr_in(in);
|
||||
%swigtype_ptr_in(varin);
|
||||
%swigtype_ptr_in(outv);
|
||||
%swigtype_ptr_in(directorout);
|
||||
%swigtype_ptr_out(out);
|
||||
%swigtype_ptr_out(varout);
|
||||
%swigtype_ptr_out(inv);
|
||||
%swigtype_ptr_out(directorin);
|
||||
|
||||
/* C++ References */
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ namespace std {
|
|||
|
||||
%typemap(in, pikedesc="tStr") string {
|
||||
if ($input.type != T_STRING)
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
$1 = std::string(STR0($input.u.string));
|
||||
}
|
||||
|
||||
%typemap(in, pikedesc="tStr") const string & (std::string temp) {
|
||||
if ($input.type != T_STRING)
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
temp = std::string(STR0($input.u.string));
|
||||
$1 = &temp;
|
||||
}
|
||||
|
|
@ -35,23 +35,23 @@ namespace std {
|
|||
|
||||
%typemap(out, pikedesc="tStr") const string & "push_text($1->c_str());";
|
||||
|
||||
%typemap(inv) string, const string &, string & "$1_name.c_str()";
|
||||
%typemap(directorin) string, const string &, string & "$1_name.c_str()";
|
||||
|
||||
%typemap(inv) string *, const string * "$1_name->c_str()";
|
||||
%typemap(directorin) string *, const string * "$1_name->c_str()";
|
||||
|
||||
%typemap(outv) string {
|
||||
%typemap(directorout) string {
|
||||
if ($input.type == T_STRING)
|
||||
$result = std::string(STR0($input.u.string));
|
||||
$result = std::string(STR0($input.u.string));
|
||||
else
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
}
|
||||
|
||||
%typemap(outv) const string & (std::string temp) {
|
||||
%typemap(directorout) const string & (std::string temp) {
|
||||
if ($input.type == T_STRING) {
|
||||
temp = std::string(STR0($input.u.string));
|
||||
$result = &temp;
|
||||
temp = std::string(STR0($input.u.string));
|
||||
$result = &temp;
|
||||
} else {
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
|
|||
statichere PyTypeObject varlinktype = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
(char *)"swigvarlink", /* Type name */
|
||||
(char *)"swigvarlink", /* Type name */
|
||||
sizeof(swig_varlinkobject), /* Basic size */
|
||||
0, /* Itemsize */
|
||||
0, /* Deallocator */
|
||||
|
|
@ -143,8 +143,7 @@ SWIG_newvarlink(void) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME(void)
|
||||
SWIG_addvarlink(PyObject *p, char *name,
|
||||
PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
|
||||
SWIG_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
|
||||
swig_varlinkobject *v;
|
||||
swig_globalvar *gv;
|
||||
v= (swig_varlinkobject *) p;
|
||||
|
|
@ -277,7 +276,7 @@ type_error:
|
|||
if (flags & SWIG_POINTER_EXCEPTION) {
|
||||
if (ty && c) {
|
||||
char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
|
||||
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
|
||||
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
|
||||
PyErr_SetString(PyExc_TypeError, temp);
|
||||
free((char *) temp);
|
||||
} else {
|
||||
|
|
@ -310,7 +309,7 @@ type_error:
|
|||
if (flags) {
|
||||
if (ty && c) {
|
||||
char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
|
||||
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
|
||||
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
|
||||
PyErr_SetString(PyExc_TypeError, temp);
|
||||
free((char *) temp);
|
||||
} else {
|
||||
|
|
@ -349,9 +348,9 @@ SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) {
|
|||
Py_DECREF(args);
|
||||
if (inst) {
|
||||
if (own) {
|
||||
PyObject *n = PyInt_FromLong(1);
|
||||
PyObject_SetAttrString(inst,(char*)"thisown",n);
|
||||
Py_DECREF(n);
|
||||
PyObject *n = PyInt_FromLong(1);
|
||||
PyObject_SetAttrString(inst,(char*)"thisown",n);
|
||||
Py_DECREF(n);
|
||||
}
|
||||
robj = inst;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
%typemap(in,parse="b") signed char "";
|
||||
|
||||
%typemap(in) unsigned int, unsigned short, unsigned long, unsigned char
|
||||
"$1 = ($1_ltype) PyInt_AsLong($input);
|
||||
"$1 = ($1_ltype) PyInt_AsLong($input);
|
||||
if (PyErr_Occurred()) SWIG_fail;";
|
||||
|
||||
%typemap(in) long long
|
||||
|
|
@ -82,25 +82,25 @@
|
|||
/* Const primitive references. Passed by value */
|
||||
|
||||
%typemap(in) const int & (int temp),
|
||||
const short & (short temp),
|
||||
const short & (short temp),
|
||||
const long & (long temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp)
|
||||
"temp = ($*1_ltype) PyInt_AsLong($input);
|
||||
"temp = ($*1_ltype) PyInt_AsLong($input);
|
||||
if (PyErr_Occurred()) SWIG_fail;
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const bool & (bool temp)
|
||||
"temp = PyInt_AsLong($input) ? true : false;
|
||||
"temp = PyInt_AsLong($input) ? true : false;
|
||||
if (PyErr_Occurred()) SWIG_fail;
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const float & (float temp),
|
||||
const double & (double temp)
|
||||
"temp = ($*1_ltype) PyFloat_AsDouble($input);
|
||||
const double & (double temp)
|
||||
"temp = ($*1_ltype) PyFloat_AsDouble($input);
|
||||
if (PyErr_Occurred()) SWIG_fail;
|
||||
$1 = &temp;";
|
||||
|
||||
|
|
@ -423,41 +423,41 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* --- Inverse arguments --- */
|
||||
/* directorin typemaps */
|
||||
|
||||
/* Primitive datatypes. These only supply a parse code to PyObject_CallMethod */
|
||||
|
||||
%typemap(inv,parse="i") int "";
|
||||
%typemap(inv,parse="h") short "";
|
||||
%typemap(inv,parse="l") long "";
|
||||
%typemap(inv,parse="b") signed char "";
|
||||
%typemap(inv,parse="f") float "";
|
||||
%typemap(inv,parse="d") double "";
|
||||
%typemap(inv,parse="s") char* "";
|
||||
%typemap(inv,parse="i") bool "";
|
||||
%typemap(inv,parse="i") enum SWIGTYPE "";
|
||||
%typemap(directorin,parse="i") int "";
|
||||
%typemap(directorin,parse="h") short "";
|
||||
%typemap(directorin,parse="l") long "";
|
||||
%typemap(directorin,parse="b") signed char "";
|
||||
%typemap(directorin,parse="f") float "";
|
||||
%typemap(directorin,parse="d") double "";
|
||||
%typemap(directorin,parse="s") char* "";
|
||||
%typemap(directorin,parse="i") bool "";
|
||||
%typemap(directorin,parse="i") enum SWIGTYPE "";
|
||||
|
||||
%typemap(inv,parse="l") unsigned int, unsigned short, unsigned long, unsigned char "(long) $1_name";
|
||||
|
||||
%typemap(inv) long long
|
||||
"$input = PyLong_FromLongLong($1_name);";
|
||||
%typemap(inv) unsigned long long
|
||||
"$input = PyLong_FromUnsignedLongLong($1_name);";
|
||||
%typemap(directorin,parse="l") unsigned int, unsigned short, unsigned long, unsigned char "(long) $1_name";
|
||||
|
||||
%typemap(directorin) long long
|
||||
"$input = PyLong_FromLongLong($1_name);";
|
||||
%typemap(directorin) unsigned long long
|
||||
"$input = PyLong_FromUnsignedLongLong($1_name);";
|
||||
|
||||
%typemap(inv, parse="l") int *INV, long* INV,
|
||||
unsigned int *INV, unsigned long *INV,
|
||||
short *INV, unsigned short *INV,
|
||||
char *INV, unsigned char *INV
|
||||
"(long) *$1_name";
|
||||
%typemap(inv, parse="f") float *INV "*$1_name";
|
||||
%typemap(inv, parse="d") double *INV "*$1_name";
|
||||
%typemap(directorin, parse="l") int *DIRECTORIN, long* DIRECTORIN,
|
||||
unsigned int *DIRECTORIN, unsigned long *DIRECTORIN,
|
||||
short *DIRECTORIN, unsigned short *DIRECTORIN,
|
||||
char *DIRECTORIN, unsigned char *DIRECTORIN
|
||||
"(long) *$1_name";
|
||||
%typemap(directorin, parse="f") float *DIRECTORIN "*$1_name";
|
||||
%typemap(directorin, parse="d") double *DIRECTORIN "*$1_name";
|
||||
|
||||
%typemap(inv, parse="O") PyObject* "";
|
||||
%typemap(directorin, parse="O") PyObject* "";
|
||||
|
||||
%typemap(inv, parse="l") std::size_t "(long) $input";
|
||||
%typemap(directorin, parse="l") std::size_t "(long) $input";
|
||||
|
||||
/* // this is rather dangerous
|
||||
%typemap(inv) SWIGTYPE {
|
||||
%typemap(directorin) SWIGTYPE {
|
||||
{
|
||||
$input = SWIG_NewPointerObj((void *) &$1_name, $&1_descriptor, $owner);
|
||||
}
|
||||
|
|
@ -465,68 +465,68 @@
|
|||
*/
|
||||
|
||||
/* no can do... see python.cxx
|
||||
%typemap(inv) DIRECTORTYPE * {
|
||||
{
|
||||
__DIRECTOR__$1_ltype proxy = dynamic_cast<__DIRECTOR__$1_ltype>($1_name);
|
||||
if (!proxy) {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
}
|
||||
%typemap(directorin) DIRECTORTYPE * {
|
||||
{
|
||||
__DIRECTOR__$1_ltype proxy = dynamic_cast<__DIRECTOR__$1_ltype>($1_name);
|
||||
if (!proxy) {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
}
|
||||
}
|
||||
%typemap(inv) SWIGTYPE * {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
%typemap(directorin) SWIGTYPE * {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/* // not currently needed, see python.cxx
|
||||
%typemap(inv) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
|
||||
%typemap(directorin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
|
||||
}
|
||||
%typemap(inv, parse="s") void "0";
|
||||
%typemap(directorin, parse="s") void "0";
|
||||
*/
|
||||
|
||||
|
||||
/* --- Outverse arguments --- */
|
||||
/* --- directorout typemaps --- */
|
||||
|
||||
%define OUTV_TYPEMAP(type, converter)
|
||||
%typemap(argoutv) type *OUTV
|
||||
%define DIRECTOROUT_TYPEMAP(type, converter)
|
||||
%typemap(directorargout) type *DIRECTOROUT
|
||||
"*$result = (type) converter($input);
|
||||
if (PyErr_Occurred()) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Error converting Python object using converter\");";
|
||||
%typemap(outv) type
|
||||
%typemap(directorout) type
|
||||
"$result = (type) converter($input);
|
||||
if (PyErr_Occurred()) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Error converting Python object using converter\");";
|
||||
%typemap(outv) type &OUTV = type
|
||||
%typemap(directorout) type &DIRECTOROUT = type
|
||||
%enddef
|
||||
|
||||
OUTV_TYPEMAP(char, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(unsigned char, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(short, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(unsigned short, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(int, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(unsigned int, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(long, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(unsigned long, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(long long, PyLong_AsLongLong);
|
||||
OUTV_TYPEMAP(unsigned long long, PyLong_AsUnsignedLongLong);
|
||||
OUTV_TYPEMAP(float, PyFloat_AsDouble);
|
||||
OUTV_TYPEMAP(double, PyFloat_AsDouble);
|
||||
OUTV_TYPEMAP(bool, PyInt_AsLong);
|
||||
OUTV_TYPEMAP(PyObject *, );
|
||||
OUTV_TYPEMAP(char *, PyString_AsString);
|
||||
OUTV_TYPEMAP(std::size_t, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(char, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(unsigned char, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(short, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(unsigned short, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(int, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(unsigned int, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(long, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(unsigned long, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(long long, PyLong_AsLongLong);
|
||||
DIRECTOROUT_TYPEMAP(unsigned long long, PyLong_AsUnsignedLongLong);
|
||||
DIRECTOROUT_TYPEMAP(float, PyFloat_AsDouble);
|
||||
DIRECTOROUT_TYPEMAP(double, PyFloat_AsDouble);
|
||||
DIRECTOROUT_TYPEMAP(bool, PyInt_AsLong);
|
||||
DIRECTOROUT_TYPEMAP(PyObject *, );
|
||||
DIRECTOROUT_TYPEMAP(char *, PyString_AsString);
|
||||
DIRECTOROUT_TYPEMAP(std::size_t, PyInt_AsLong);
|
||||
|
||||
/* Object returned by value. Convert from a pointer */
|
||||
%typemap(outv) SWIGTYPE ($<ype argp)
|
||||
%typemap(directorout) SWIGTYPE ($<ype argp)
|
||||
"if ((SWIG_ConvertPtr($input,(void **) &argp, $&descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\"); $result = *argp;";
|
||||
|
||||
%typemap(outv) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE []
|
||||
%typemap(directorout) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE []
|
||||
"if ((SWIG_ConvertPtr($input,(void **) &$result, $descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
|
||||
%typemap(outv) void * "if ((SWIG_ConvertPtr($input,(void **) &$result, 0, SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
%typemap(directorout) void * "if ((SWIG_ConvertPtr($input,(void **) &$result, 0, SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
|
||||
|
||||
|
||||
|
|
@ -569,22 +569,22 @@ OUTV_TYPEMAP(std::size_t, PyInt_AsLong);
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INTEGER)
|
||||
int, short, long,
|
||||
unsigned int, unsigned short, unsigned long,
|
||||
signed char, unsigned char,
|
||||
long long, unsigned long long,
|
||||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE,
|
||||
int, short, long,
|
||||
unsigned int, unsigned short, unsigned long,
|
||||
signed char, unsigned char,
|
||||
long long, unsigned long long,
|
||||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE,
|
||||
bool, const bool &
|
||||
{
|
||||
$1 = (PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE)
|
||||
float, double,
|
||||
const float &, const double &
|
||||
float, double,
|
||||
const float &, const double &
|
||||
{
|
||||
$1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,22 +67,22 @@ SwigComplex_AsComplexDouble(PyObject *o)
|
|||
|
||||
// C++ proxy class typemaps
|
||||
|
||||
%typemap(inv) Complex {
|
||||
%typemap(directorin) Complex {
|
||||
$input = PyComplex_FromDoubles($1_name.real(), $1_name.imag());
|
||||
}
|
||||
|
||||
%typemap(inv) const Complex & {
|
||||
%typemap(directorin) const Complex & {
|
||||
$input = PyComplex_FromDoubles($1_name.real(), $1_name.imag());
|
||||
}
|
||||
|
||||
%typemap(outv) Complex {
|
||||
%typemap(directorout) Complex {
|
||||
$result = SwigComplex_As< Complex >($input);
|
||||
if (PyErr_Occurred()) {
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("Expecting a complex or compatible type");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(outv) const complex<T>& (Complex temp) {
|
||||
%typemap(directorout) const complex<T>& (Complex temp) {
|
||||
temp = SwigComplex_As< Complex >($input);
|
||||
if (PyErr_Occurred()) {
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("Expecting a complex or compatible type");
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ namespace std {
|
|||
$result = PyString_FromStringAndSize($1->data(),$1->size());
|
||||
}
|
||||
|
||||
%typemap(inv, parse="s") string, const string &, string & "$1_name.c_str()";
|
||||
%typemap(directorin, parse="s") string, const string &, string & "$1_name.c_str()";
|
||||
|
||||
%typemap(inv, parse="s") string *, const string * "$1_name->c_str()";
|
||||
%typemap(directorin, parse="s") string *, const string * "$1_name->c_str()";
|
||||
|
||||
%typemap(outv) string {
|
||||
%typemap(directorout) string {
|
||||
if (PyString_Check($input))
|
||||
$result = std::string(PyString_AsString($input),
|
||||
PyString_Size($input));
|
||||
|
|
@ -65,7 +65,7 @@ namespace std {
|
|||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
}
|
||||
|
||||
%typemap(outv) const string & (std::string temp) {
|
||||
%typemap(directorout) const string & (std::string temp) {
|
||||
if (PyString_Check($input)) {
|
||||
temp = std::string(PyString_AsString($input),
|
||||
PyString_Size($input));
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) vector<T> (std::vector<T>* v) {
|
||||
%typemap(directorout) vector<T> (std::vector<T>* v) {
|
||||
if (PyTuple_Check($input) || PyList_Check($input)) {
|
||||
unsigned int size = (PyTuple_Check($input) ?
|
||||
PyTuple_Size($input) :
|
||||
|
|
@ -164,7 +164,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) const vector<T>& (std::vector<T> temp,
|
||||
%typemap(directorout) const vector<T>& (std::vector<T> temp,
|
||||
std::vector<T>* v),
|
||||
const vector<T>* (std::vector<T> temp,
|
||||
std::vector<T>* v) {
|
||||
|
|
@ -183,7 +183,7 @@ namespace std {
|
|||
Py_DECREF(o);
|
||||
} else {
|
||||
Py_DECREF(o);
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
||||
}
|
||||
}
|
||||
} else if (SWIG_ConvertPtr($input,(void **) &v,
|
||||
|
|
@ -202,7 +202,7 @@ namespace std {
|
|||
$descriptor(T *), 1));
|
||||
}
|
||||
}
|
||||
%typemap(inv) vector<T> {
|
||||
%typemap(directorin) vector<T> {
|
||||
$input = PyTuple_New($1_name.size());
|
||||
for (unsigned int i=0; i<$1_name.size(); i++) {
|
||||
T* ptr = new T((($1_type &)$1_name)[i]);
|
||||
|
|
@ -334,7 +334,7 @@ namespace std {
|
|||
self->insert(self->begin()+i,v.begin(),v.end());
|
||||
} else {
|
||||
self->insert(self->end(),v.begin(),v.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void __delitem__(int i) {
|
||||
|
|
@ -388,7 +388,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) vector<T*> (std::vector<T*>* v) {
|
||||
%typemap(directorout) vector<T*> (std::vector<T*>* v) {
|
||||
if (PyTuple_Check($input) || PyList_Check($input)) {
|
||||
unsigned int size = (PyTuple_Check($input) ?
|
||||
PyTuple_Size($input) :
|
||||
|
|
@ -445,7 +445,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) const vector<T *>& (std::vector<T *> temp,
|
||||
%typemap(directorout) const vector<T *>& (std::vector<T *> temp,
|
||||
std::vector<T *>* v),
|
||||
const vector<T *>* (std::vector<T *> temp,
|
||||
std::vector<T *>* v) {
|
||||
|
|
@ -483,7 +483,7 @@ namespace std {
|
|||
$descriptor(T*), 0));
|
||||
}
|
||||
}
|
||||
%typemap(inv) vector<T*> {
|
||||
%typemap(directorin) vector<T*> {
|
||||
$input = PyTuple_New($1_name.size());
|
||||
for (unsigned int i=0; i<$1_name.size(); i++) {
|
||||
T *ptr = (($1_type &)$1_name)[i];
|
||||
|
|
@ -665,7 +665,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) vector<T> (std::vector<T>* v) {
|
||||
%typemap(directorout) vector<T> (std::vector<T>* v) {
|
||||
if (PyTuple_Check($input) || PyList_Check($input)) {
|
||||
unsigned int size = (PyTuple_Check($input) ?
|
||||
PyTuple_Size($input) :
|
||||
|
|
@ -718,7 +718,7 @@ namespace std {
|
|||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
%typemap(outv) const vector<T>& (std::vector<T> temp,
|
||||
%typemap(directorout) const vector<T>& (std::vector<T> temp,
|
||||
std::vector<T>* v),
|
||||
const vector<T>* (std::vector<T> temp,
|
||||
std::vector<T>* v) {
|
||||
|
|
@ -735,7 +735,7 @@ namespace std {
|
|||
Py_DECREF(o);
|
||||
} else {
|
||||
Py_DECREF(o);
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
||||
}
|
||||
}
|
||||
} else if (SWIG_ConvertPtr($input,(void **) &v,
|
||||
|
|
@ -751,7 +751,7 @@ namespace std {
|
|||
PyTuple_SetItem($result,i,
|
||||
CONVERT_TO((($1_type &)$1)[i]));
|
||||
}
|
||||
%typemap(inv) vector<T> {
|
||||
%typemap(directorin) vector<T> {
|
||||
$input = PyTuple_New($1_name.size());
|
||||
for (unsigned int i=0; i<$1_name.size(); i++)
|
||||
PyTuple_SetItem($input,i,
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@
|
|||
|
||||
%typemap(in) SWIGTYPE *,
|
||||
SWIGTYPE []
|
||||
"SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);"
|
||||
"SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1);"
|
||||
|
||||
/* Additional check for null references */
|
||||
%typemap(in) SWIGTYPE &
|
||||
"SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1); if ($1 == NULL) rb_raise(rb_eTypeError, \"null reference\");"
|
||||
"SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 1); if ($1 == NULL) rb_raise(rb_eTypeError, \"null reference\");"
|
||||
|
||||
/* Void pointer. Accepts any kind of pointer */
|
||||
%typemap(in) void *
|
||||
|
|
@ -75,36 +75,36 @@
|
|||
%typemap(in) const int & (int temp),
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp)
|
||||
"temp = ($*1_ltype) NUM2INT($input);
|
||||
"temp = ($*1_ltype) NUM2INT($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const short & (short temp)
|
||||
"temp = ($*1_ltype) NUM2SHRT($input);
|
||||
"temp = ($*1_ltype) NUM2SHRT($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const long & (long temp)
|
||||
"temp = ($*1_ltype) NUM2LONG($input);
|
||||
"temp = ($*1_ltype) NUM2LONG($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const unsigned int & (unsigned int temp)
|
||||
"temp = ($*1_ltype) NUM2UINT($input);
|
||||
"temp = ($*1_ltype) NUM2UINT($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const unsigned short & (unsigned short temp)
|
||||
"temp = ($*1_ltype) NUM2USHRT($input);
|
||||
"temp = ($*1_ltype) NUM2USHRT($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const unsigned long & (unsigned long temp)
|
||||
"temp = ($*1_ltype) NUM2ULONG($input);
|
||||
"temp = ($*1_ltype) NUM2ULONG($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const bool & (bool temp)
|
||||
"temp = ($*1_ltype) RTEST($input);
|
||||
"temp = ($*1_ltype) RTEST($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const float & (float temp),
|
||||
const double & (double temp)
|
||||
"temp = ($*1_ltype) NUM2DBL($input);
|
||||
const double & (double temp)
|
||||
"temp = ($*1_ltype) NUM2DBL($input);
|
||||
$1 = &temp;";
|
||||
|
||||
%typemap(in) const long long & ($*1_ltype temp)
|
||||
|
|
@ -124,10 +124,10 @@
|
|||
/* --- Output typemaps --- */
|
||||
|
||||
%typemap(out) int, short, long, signed char, enum SWIGTYPE
|
||||
"$result = INT2NUM($1);";
|
||||
"$result = INT2NUM($1);";
|
||||
|
||||
%typemap(out) unsigned int, unsigned short, unsigned long, unsigned char
|
||||
"$result = UINT2NUM($1);";
|
||||
"$result = UINT2NUM($1);";
|
||||
|
||||
|
||||
/* Long long */
|
||||
|
|
@ -137,19 +137,19 @@
|
|||
|
||||
/* Floating point output values */
|
||||
%typemap(out) double, float
|
||||
"$result = rb_float_new($1);";
|
||||
"$result = rb_float_new($1);";
|
||||
|
||||
/* Character */
|
||||
%typemap(out) char
|
||||
"$result = rb_str_new(&$1,1);";
|
||||
"$result = rb_str_new(&$1,1);";
|
||||
|
||||
/* Boolean */
|
||||
%typemap(out) bool
|
||||
"$result = $1 ? Qtrue : Qfalse;";
|
||||
"$result = $1 ? Qtrue : Qfalse;";
|
||||
|
||||
/* C string */
|
||||
%typemap(out) char *
|
||||
"$result = rb_str_new2($1);";
|
||||
"$result = rb_str_new2($1);";
|
||||
|
||||
/* Pointers, references, and arrays */
|
||||
%typemap(out) SWIGTYPE*, SWIGTYPE &, SWIGTYPE []
|
||||
|
|
@ -309,29 +309,29 @@
|
|||
/* --- Output typemaps --- */
|
||||
|
||||
%typemap(varout) int, short, long, signed char, enum SWIGTYPE
|
||||
"$result = INT2NUM($1);";
|
||||
"$result = INT2NUM($1);";
|
||||
|
||||
%typemap(varout) unsigned int, unsigned short, unsigned long, unsigned char
|
||||
"$result = UINT2NUM($1);";
|
||||
"$result = UINT2NUM($1);";
|
||||
|
||||
%typemap(varout) long long "$result = LL2NUM($1);";
|
||||
%typemap(varout) unsigned long long "$result = ULL2NUM($1);";
|
||||
|
||||
/* Floats and doubles */
|
||||
%typemap(varout) double, float
|
||||
"$result = rb_float_new($1);";
|
||||
"$result = rb_float_new($1);";
|
||||
|
||||
/* Character */
|
||||
%typemap(varout) char
|
||||
"$result = rb_str_new(&$1,1);";
|
||||
"$result = rb_str_new(&$1,1);";
|
||||
|
||||
/* Boolean */
|
||||
%typemap(varout) bool
|
||||
"$result = $1 ? Qtrue : Qfalse;";
|
||||
"$result = $1 ? Qtrue : Qfalse;";
|
||||
|
||||
/* C string */
|
||||
%typemap(varout) char *
|
||||
"$result = rb_str_new2($1);";
|
||||
"$result = rb_str_new2($1);";
|
||||
|
||||
/* Pointers, references, and arrays */
|
||||
%typemap(varout) SWIGTYPE*, SWIGTYPE []
|
||||
|
|
@ -355,28 +355,28 @@
|
|||
/* --- Constants --- */
|
||||
|
||||
%typemap(constant) int, short, long, signed char, enum SWIGTYPE
|
||||
"rb_define_const($module,\"$symname\", INT2NUM($1));";
|
||||
"rb_define_const($module,\"$symname\", INT2NUM($1));";
|
||||
|
||||
%typemap(constant) unsigned int, unsigned short, unsigned long, unsigned char
|
||||
"rb_define_const($module,\"$symname\", UINT2NUM($1));";
|
||||
"rb_define_const($module,\"$symname\", UINT2NUM($1));";
|
||||
|
||||
%typemap(constant) long long
|
||||
"rb_define_const($module,\"$symname\", LL2NUM($1));";
|
||||
"rb_define_const($module,\"$symname\", LL2NUM($1));";
|
||||
|
||||
%typemap(constant) unsigned long long
|
||||
"rb_define_const($module,\"$symname\", ULL2NUM($1));";
|
||||
"rb_define_const($module,\"$symname\", ULL2NUM($1));";
|
||||
|
||||
%typemap(constant) double, float
|
||||
"rb_define_const($module,\"$symname\", rb_float_new($1));";
|
||||
"rb_define_const($module,\"$symname\", rb_float_new($1));";
|
||||
|
||||
%typemap(constant) char
|
||||
"rb_define_const($module,\"$symname\", rb_str_new(\"$1\",1));";
|
||||
"rb_define_const($module,\"$symname\", rb_str_new(\"$1\",1));";
|
||||
|
||||
%typemap(constant) bool
|
||||
"rb_define_const($module,\"$symname\", ($1 ? Qtrue : Qfalse));";
|
||||
"rb_define_const($module,\"$symname\", ($1 ? Qtrue : Qfalse));";
|
||||
|
||||
%typemap(constant) char *
|
||||
"rb_define_const($module,\"$symname\", rb_str_new2(\"$1\"));";
|
||||
"rb_define_const($module,\"$symname\", rb_str_new2(\"$1\"));";
|
||||
|
||||
%typemap(constant) SWIGTYPE*, SWIGTYPE &, SWIGTYPE []
|
||||
"rb_define_const($module,\"$symname\", SWIG_NewPointerObj((void *) $1, $1_descriptor,0));";
|
||||
|
|
@ -392,28 +392,28 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* --- Inverse arguments --- */
|
||||
/* directorin typemaps */
|
||||
|
||||
/* Primitive datatypes */
|
||||
|
||||
%typemap(inv) int "$input = INT2NUM($1);";
|
||||
%typemap(inv) short "$input = INT2NUM($1);";
|
||||
%typemap(inv) long "$input = LONG2NUM($1);";
|
||||
%typemap(inv) signed char "$input = INT2NUM($1);";
|
||||
%typemap(inv) float "$input = rb_float_new($1);";
|
||||
%typemap(inv) double "$input = rb_float_new($1);";
|
||||
%typemap(inv) char* "$input = rb_str_new2($1);";
|
||||
%typemap(inv) bool "$input = $1 ? Qtrue : Qfalse;";
|
||||
%typemap(directorin) int "$input = INT2NUM($1);";
|
||||
%typemap(directorin) short "$input = INT2NUM($1);";
|
||||
%typemap(directorin) long "$input = LONG2NUM($1);";
|
||||
%typemap(directorin) signed char "$input = INT2NUM($1);";
|
||||
%typemap(directorin) float "$input = rb_float_new($1);";
|
||||
%typemap(directorin) double "$input = rb_float_new($1);";
|
||||
%typemap(directorin) char* "$input = rb_str_new2($1);";
|
||||
%typemap(directorin) bool "$input = $1 ? Qtrue : Qfalse;";
|
||||
|
||||
%typemap(inv) unsigned int "$input = UINT2NUM($1);";
|
||||
%typemap(inv) unsigned short "$input = UINT2NUM($1);";
|
||||
%typemap(inv) unsigned long "$input = ULONG2NUM($1);";
|
||||
%typemap(inv) unsigned char "$input = UINT2NUM($1);";
|
||||
|
||||
%typemap(inv) VALUE "$input = $1;";
|
||||
%typemap(directorin) unsigned int "$input = UINT2NUM($1);";
|
||||
%typemap(directorin) unsigned short "$input = UINT2NUM($1);";
|
||||
%typemap(directorin) unsigned long "$input = ULONG2NUM($1);";
|
||||
%typemap(directorin) unsigned char "$input = UINT2NUM($1);";
|
||||
|
||||
%typemap(directorin) VALUE "$input = $1;";
|
||||
|
||||
/*
|
||||
%typemap(inv, parse="s") SWIGTYPE {
|
||||
%typemap(directorin, parse="s") SWIGTYPE {
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
|
|
@ -423,60 +423,60 @@
|
|||
*/
|
||||
|
||||
/* no can do... see python.cxx
|
||||
%typemap(inv) DIRECTORTYPE * {
|
||||
{
|
||||
__DIRECTOR__$1_ltype proxy = dynamic_cast<__DIRECTOR__$1_ltype>($1_name);
|
||||
if (!proxy) {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
}
|
||||
%typemap(directorin) DIRECTORTYPE * {
|
||||
{
|
||||
__DIRECTOR__$1_ltype proxy = dynamic_cast<__DIRECTOR__$1_ltype>($1_name);
|
||||
if (!proxy) {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
}
|
||||
}
|
||||
%typemap(inv) SWIGTYPE * {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
%typemap(directorin) SWIGTYPE * {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
%typemap(inv, parse="s") void "0";
|
||||
%typemap(directorin, parse="s") void "0";
|
||||
*/
|
||||
/*
|
||||
%typemap(inv) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
|
||||
%typemap(directorin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
$input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* --- Outverse arguments --- */
|
||||
/* --- directorout typemaps --- */
|
||||
|
||||
%define OUTV_TYPEMAP(type, converter)
|
||||
%typemap(argoutv) type *OUTV "*$result = (type) converter($input);";
|
||||
%typemap(outv) type "$result = (type) converter($input);";
|
||||
%typemap(outv) type &OUTV = type
|
||||
%define DIRECTOROUT_TYPEMAP(type, converter)
|
||||
%typemap(directorargout) type *DIRECTOROUT "*$result = (type) converter($input);";
|
||||
%typemap(directorout) type "$result = (type) converter($input);";
|
||||
%typemap(directorout) type &DIRECTOROUT = type
|
||||
%enddef
|
||||
|
||||
OUTV_TYPEMAP(char, NUM2INT);
|
||||
OUTV_TYPEMAP(unsigned char, NUM2UINT);
|
||||
OUTV_TYPEMAP(short, NUM2INT);
|
||||
OUTV_TYPEMAP(unsigned short, NUM2INT);
|
||||
OUTV_TYPEMAP(int, NUM2INT);
|
||||
OUTV_TYPEMAP(unsigned int, NUM2INT);
|
||||
OUTV_TYPEMAP(long, NUM2INT);
|
||||
OUTV_TYPEMAP(unsigned long, NUM2INT);
|
||||
OUTV_TYPEMAP(long long, NUM2INT);
|
||||
OUTV_TYPEMAP(unsigned long long, NUM2INT);
|
||||
OUTV_TYPEMAP(float, NUM2DBL);
|
||||
OUTV_TYPEMAP(double, NUM2DBL);
|
||||
OUTV_TYPEMAP(bool, RTEST);
|
||||
DIRECTOROUT_TYPEMAP(char, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(unsigned char, NUM2UINT);
|
||||
DIRECTOROUT_TYPEMAP(short, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(unsigned short, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(int, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(unsigned int, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(long, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(unsigned long, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(long long, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(unsigned long long, NUM2INT);
|
||||
DIRECTOROUT_TYPEMAP(float, NUM2DBL);
|
||||
DIRECTOROUT_TYPEMAP(double, NUM2DBL);
|
||||
DIRECTOROUT_TYPEMAP(bool, RTEST);
|
||||
|
||||
|
||||
%typemap(outv) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE []
|
||||
%typemap(directorout) SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE []
|
||||
"if ((SWIG_ConvertPtr($input,(void **) &$result, $descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
|
||||
%typemap(outv) void * "if ((SWIG_ConvertPtr($input,(void **) &$result, 0, SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
%typemap(directorout) void * "if ((SWIG_ConvertPtr($input,(void **) &$result, 0, SWIG_POINTER_EXCEPTION | $disown )) == -1) throw SWIG_DIRECTOR_TYPE_MISMATCH(\"Pointer conversion failed.\");";
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* typedef & typemaps for VALUE (passed through unmodified and unchecked)
|
||||
|
|
@ -525,21 +525,21 @@ typedef unsigned long VALUE;
|
|||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INTEGER)
|
||||
int, short, long,
|
||||
unsigned int, unsigned short, unsigned long,
|
||||
signed char, unsigned char,
|
||||
long long, unsigned long long,
|
||||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE
|
||||
int, short, long,
|
||||
unsigned int, unsigned short, unsigned long,
|
||||
signed char, unsigned char,
|
||||
long long, unsigned long long,
|
||||
const int &, const short &, const long &,
|
||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||
const long long &, const unsigned long long &,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
$1 = ((TYPE($input) == T_FIXNUM) || (TYPE($input) == T_BIGNUM)) ? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE)
|
||||
float, double,
|
||||
const float &, const double &
|
||||
float, double,
|
||||
const float &, const double &
|
||||
{
|
||||
$1 = ((TYPE($input) == T_FLOAT) || (TYPE($input) == T_FIXNUM) || (TYPE($input) == T_BIGNUM)) ? 1 : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,18 +54,18 @@ namespace std {
|
|||
$result = rb_str_new2($1->c_str());
|
||||
}
|
||||
|
||||
%typemap(inv) string, const string &, string & "$1_name.c_str()";
|
||||
%typemap(directorin) string, const string &, string & "$1_name.c_str()";
|
||||
|
||||
%typemap(inv) string *, const string * "$1_name->c_str()";
|
||||
%typemap(directorin) string *, const string * "$1_name->c_str()";
|
||||
|
||||
%typemap(outv) string {
|
||||
%typemap(directorout) string {
|
||||
if (TYPE($input) == T_STRING)
|
||||
$result = std::string(StringValuePtr($input));
|
||||
else
|
||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
|
||||
}
|
||||
|
||||
%typemap(outv) const string & (std::string temp) {
|
||||
%typemap(directorout) const string & (std::string temp) {
|
||||
if (TYPE($input) == T_STRING) {
|
||||
temp = std::string(StringValuePtr($input));
|
||||
$result = &temp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue