Merge branch 'bryanhatwood-java_directorargout'
* bryanhatwood-java_directorargout: Fix crash Java directors Java director typemaps.i testing for pointers added Fix Java directorargout typemap crash when argument pointer is null
This commit is contained in:
commit
934c402238
7 changed files with 685 additions and 24 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2018-08-12: brianhatwood,wsfulton
|
||||||
|
[Java] #1303 #1304 Fix crash in directors when using OUTPUT and INOUT typemaps in typemaps.i and
|
||||||
|
passing NULL pointers in C++ to director method overloaded and implemented in Java.
|
||||||
|
|
||||||
2018-08-10: wsfulton
|
2018-08-10: wsfulton
|
||||||
[Python] #1293 Improve TypeError message inconsistencies between default and fastdispatch
|
[Python] #1293 Improve TypeError message inconsistencies between default and fastdispatch
|
||||||
mode when handling overloaded C++ functions. Previously the error message did not always
|
mode when handling overloaded C++ functions. Previously the error message did not always
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ CPP_TEST_CASES = \
|
||||||
java_director_exception_feature_nspace \
|
java_director_exception_feature_nspace \
|
||||||
java_director_ptrclass \
|
java_director_ptrclass \
|
||||||
java_director_typemaps \
|
java_director_typemaps \
|
||||||
|
java_director_typemaps_ptr \
|
||||||
java_enums \
|
java_enums \
|
||||||
java_jnitypes \
|
java_jnitypes \
|
||||||
java_lib_arrays_dimensionless \
|
java_lib_arrays_dimensionless \
|
||||||
|
|
|
||||||
200
Examples/test-suite/java/java_director_typemaps_ptr_runme.java
Normal file
200
Examples/test-suite/java/java_director_typemaps_ptr_runme.java
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
// Test director pointer typemaps in typemaps.i - similar to java_director_typemaps.i testcase
|
||||||
|
|
||||||
|
import java_director_typemaps_ptr.*;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
public class java_director_typemaps_ptr_runme {
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("java_director_typemaps_ptr");
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String argv[]) {
|
||||||
|
java_director_typemaps_ptr_MyQuux myquux = new java_director_typemaps_ptr_MyQuux();
|
||||||
|
Quux quux = myquux;
|
||||||
|
quux.etest();
|
||||||
|
myquux.testing_nulls = true;
|
||||||
|
quux.nulltest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class java_director_typemaps_ptr_MyQuux extends Quux {
|
||||||
|
public java_director_typemaps_ptr_MyQuux() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
public boolean testing_nulls = false;
|
||||||
|
|
||||||
|
public void director_method_output(
|
||||||
|
boolean[] bool_arg,
|
||||||
|
|
||||||
|
byte[] signed_char_arg,
|
||||||
|
short[] unsigned_char_arg,
|
||||||
|
|
||||||
|
short[] short_arg,
|
||||||
|
int[] unsigned_short_arg,
|
||||||
|
|
||||||
|
int[] int_arg,
|
||||||
|
long[] unsigned_int_arg,
|
||||||
|
|
||||||
|
int[] long_arg,
|
||||||
|
long[] unsigned_long_arg,
|
||||||
|
|
||||||
|
long[] long_long_arg,
|
||||||
|
// BigInteger[] unsigned_long_long_arg,
|
||||||
|
|
||||||
|
float[] float_arg,
|
||||||
|
double[] double_arg)
|
||||||
|
{
|
||||||
|
if (testing_nulls) {
|
||||||
|
if (bool_arg != null) throw new RuntimeException("not null bool_arg");
|
||||||
|
if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
|
||||||
|
if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
|
||||||
|
if (short_arg != null) throw new RuntimeException("not null short_arg");
|
||||||
|
if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
|
||||||
|
if (int_arg != null) throw new RuntimeException("not null int_arg");
|
||||||
|
if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
|
||||||
|
if (long_arg != null) throw new RuntimeException("not null long_arg");
|
||||||
|
if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
|
||||||
|
if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
|
||||||
|
// if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
|
||||||
|
if (float_arg != null) throw new RuntimeException("not null float_arg");
|
||||||
|
if (double_arg != null) throw new RuntimeException("not null double_arg");
|
||||||
|
}
|
||||||
|
if (bool_arg != null) bool_arg[0] = true;
|
||||||
|
if (signed_char_arg != null) signed_char_arg[0] = 1;
|
||||||
|
if (unsigned_char_arg != null) unsigned_char_arg[0] = 2;
|
||||||
|
if (short_arg != null) short_arg[0] = 3;
|
||||||
|
if (unsigned_short_arg != null) unsigned_short_arg[0] = 4;
|
||||||
|
if (int_arg != null) int_arg[0] = 5;
|
||||||
|
if (unsigned_int_arg != null) unsigned_int_arg[0] = 6;
|
||||||
|
if (long_arg != null) long_arg[0] = 7;
|
||||||
|
if (unsigned_long_arg != null) unsigned_long_arg[0] = 8;
|
||||||
|
if (long_long_arg != null) long_long_arg[0] = 9;
|
||||||
|
// if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 10;
|
||||||
|
if (float_arg != null) float_arg[0] = 11;
|
||||||
|
if (double_arg != null) double_arg[0] = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void director_method_inout(
|
||||||
|
boolean[] bool_arg,
|
||||||
|
|
||||||
|
byte[] signed_char_arg,
|
||||||
|
short[] unsigned_char_arg,
|
||||||
|
|
||||||
|
short[] short_arg,
|
||||||
|
int[] unsigned_short_arg,
|
||||||
|
|
||||||
|
int[] int_arg,
|
||||||
|
long[] unsigned_int_arg,
|
||||||
|
|
||||||
|
int[] long_arg,
|
||||||
|
long[] unsigned_long_arg,
|
||||||
|
|
||||||
|
long[] long_long_arg,
|
||||||
|
// BigInteger[] unsigned_long_long_arg,
|
||||||
|
|
||||||
|
float[] float_arg,
|
||||||
|
double[] double_arg)
|
||||||
|
{
|
||||||
|
if (testing_nulls) {
|
||||||
|
if (bool_arg != null) throw new RuntimeException("not null bool_arg");
|
||||||
|
if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
|
||||||
|
if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
|
||||||
|
if (short_arg != null) throw new RuntimeException("not null short_arg");
|
||||||
|
if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
|
||||||
|
if (int_arg != null) throw new RuntimeException("not null int_arg");
|
||||||
|
if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
|
||||||
|
if (long_arg != null) throw new RuntimeException("not null long_arg");
|
||||||
|
if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
|
||||||
|
if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
|
||||||
|
// if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
|
||||||
|
if (float_arg != null) throw new RuntimeException("not null float_arg");
|
||||||
|
if (double_arg != null) throw new RuntimeException("not null double_arg");
|
||||||
|
} else {
|
||||||
|
if (bool_arg[0]) throw new RuntimeException("unexpected value for bool_arg");
|
||||||
|
if (signed_char_arg[0] != 101) throw new RuntimeException("unexpected value for signed_char_arg");
|
||||||
|
if (unsigned_char_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_char_arg");
|
||||||
|
if (short_arg[0] != 101) throw new RuntimeException("unexpected value for short_arg");
|
||||||
|
if (unsigned_short_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_short_arg");
|
||||||
|
if (int_arg[0] != 101) throw new RuntimeException("unexpected value for int_arg");
|
||||||
|
if (unsigned_int_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_int_arg");
|
||||||
|
if (long_arg[0] != 101) throw new RuntimeException("unexpected value for long_arg");
|
||||||
|
if (unsigned_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_arg");
|
||||||
|
if (long_long_arg[0] != 101) throw new RuntimeException("unexpected value for long_long_arg");
|
||||||
|
// if (unsigned_long_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_long_arg");
|
||||||
|
if (float_arg[0] != 101) throw new RuntimeException("unexpected value for float_arg");
|
||||||
|
if (double_arg[0] != 101) throw new RuntimeException("unexpected value for double_arg");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bool_arg != null) bool_arg[0] = false;
|
||||||
|
if (signed_char_arg != null) signed_char_arg[0] = 11;
|
||||||
|
if (unsigned_char_arg != null) unsigned_char_arg[0] = 12;
|
||||||
|
if (short_arg != null) short_arg[0] = 13;
|
||||||
|
if (unsigned_short_arg != null) unsigned_short_arg[0] = 14;
|
||||||
|
if (int_arg != null) int_arg[0] = 15;
|
||||||
|
if (unsigned_int_arg != null) unsigned_int_arg[0] = 16;
|
||||||
|
if (long_arg != null) long_arg[0] = 17;
|
||||||
|
if (unsigned_long_arg != null) unsigned_long_arg[0] = 18;
|
||||||
|
if (long_long_arg != null) long_long_arg[0] = 19;
|
||||||
|
// if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 110;
|
||||||
|
if (float_arg != null) float_arg[0] = 111;
|
||||||
|
if (double_arg != null) double_arg[0] = 112;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void director_method_nameless_args(
|
||||||
|
boolean[] bool_arg,
|
||||||
|
|
||||||
|
byte[] signed_char_arg,
|
||||||
|
short[] unsigned_char_arg,
|
||||||
|
|
||||||
|
short[] short_arg,
|
||||||
|
int[] unsigned_short_arg,
|
||||||
|
|
||||||
|
int[] int_arg,
|
||||||
|
long[] unsigned_int_arg,
|
||||||
|
|
||||||
|
int[] long_arg,
|
||||||
|
long[] unsigned_long_arg,
|
||||||
|
|
||||||
|
long[] long_long_arg,
|
||||||
|
// BigInteger[] unsigned_long_long_arg,
|
||||||
|
|
||||||
|
float[] float_arg,
|
||||||
|
double[] double_arg)
|
||||||
|
{
|
||||||
|
if (testing_nulls) {
|
||||||
|
if (bool_arg != null) throw new RuntimeException("not null bool_arg");
|
||||||
|
if (signed_char_arg != null) throw new RuntimeException("not null signed_char_arg");
|
||||||
|
if (unsigned_char_arg != null) throw new RuntimeException("not null unsigned_char_arg");
|
||||||
|
if (short_arg != null) throw new RuntimeException("not null short_arg");
|
||||||
|
if (unsigned_short_arg != null) throw new RuntimeException("not null unsigned_short_arg");
|
||||||
|
if (int_arg != null) throw new RuntimeException("not null int_arg");
|
||||||
|
if (unsigned_int_arg != null) throw new RuntimeException("not null unsigned_int_arg");
|
||||||
|
if (long_arg != null) throw new RuntimeException("not null long_arg");
|
||||||
|
if (unsigned_long_arg != null) throw new RuntimeException("not null unsigned_long_arg");
|
||||||
|
if (long_long_arg != null) throw new RuntimeException("not null long_long_arg");
|
||||||
|
// if (unsigned_long_long_arg != null) throw new RuntimeException("not null unsigned_long_long_arg");
|
||||||
|
if (float_arg != null) throw new RuntimeException("not null float_arg");
|
||||||
|
if (double_arg != null) throw new RuntimeException("not null double_arg");
|
||||||
|
}
|
||||||
|
if (bool_arg != null) bool_arg[0] = true;
|
||||||
|
if (signed_char_arg != null) signed_char_arg[0] = 12;
|
||||||
|
if (unsigned_char_arg != null) unsigned_char_arg[0] = 13;
|
||||||
|
if (short_arg != null) short_arg[0] = 14;
|
||||||
|
if (unsigned_short_arg != null) unsigned_short_arg[0] = 15;
|
||||||
|
if (int_arg != null) int_arg[0] = 16;
|
||||||
|
if (unsigned_int_arg != null) unsigned_int_arg[0] = 17;
|
||||||
|
if (long_arg != null) long_arg[0] = 18;
|
||||||
|
if (unsigned_long_arg != null) unsigned_long_arg[0] = 19;
|
||||||
|
if (long_long_arg != null) long_long_arg[0] = 20;
|
||||||
|
// if (unsigned_long_long_arg != null) unsigned_long_long_arg[0] = 111;
|
||||||
|
if (float_arg != null) float_arg[0] = 112;
|
||||||
|
if (double_arg != null) double_arg[0] = 113;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// tests for java/typemaps.i used for directors
|
// Test director reference typemaps in typemaps.i - similar to java_director_typemaps_ptr.i testcase
|
||||||
|
|
||||||
import java_director_typemaps.*;
|
import java_director_typemaps.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
@ -26,7 +26,7 @@ class java_director_typemaps_MyQuux extends Quux {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void director_method_bool_output(
|
public void director_method_output(
|
||||||
boolean[] bool_arg,
|
boolean[] bool_arg,
|
||||||
|
|
||||||
byte[] signed_char_arg,
|
byte[] signed_char_arg,
|
||||||
|
|
@ -62,7 +62,7 @@ class java_director_typemaps_MyQuux extends Quux {
|
||||||
double_arg[0] = 12;
|
double_arg[0] = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void director_method_bool_inout(
|
public void director_method_inout(
|
||||||
boolean[] bool_arg,
|
boolean[] bool_arg,
|
||||||
|
|
||||||
byte[] signed_char_arg,
|
byte[] signed_char_arg,
|
||||||
|
|
@ -113,7 +113,7 @@ class java_director_typemaps_MyQuux extends Quux {
|
||||||
double_arg[0] = 112;
|
double_arg[0] = 112;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void director_method_bool_nameless_args(
|
public void director_method_nameless_args(
|
||||||
boolean[] bool_arg,
|
boolean[] bool_arg,
|
||||||
|
|
||||||
byte[] signed_char_arg,
|
byte[] signed_char_arg,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
%module(directors="1") java_director_typemaps
|
%module(directors="1") java_director_typemaps
|
||||||
|
// Test director reference typemaps in typemaps.i - similar to java_director_typemaps_ptr.i testcase
|
||||||
|
|
||||||
%feature("director", assumeoverride=1) Quux;
|
%feature("director", assumeoverride=1) Quux;
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ public:
|
||||||
Quux() {}
|
Quux() {}
|
||||||
virtual ~Quux() {}
|
virtual ~Quux() {}
|
||||||
|
|
||||||
virtual void director_method_bool_output(
|
virtual void director_method_output(
|
||||||
bool& boolarg_output,
|
bool& boolarg_output,
|
||||||
|
|
||||||
signed char& signed_chararg_output,
|
signed char& signed_chararg_output,
|
||||||
|
|
@ -117,7 +118,7 @@ public:
|
||||||
doublearg_output = 50;
|
doublearg_output = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void director_method_bool_inout(
|
virtual void director_method_inout(
|
||||||
bool& boolarg_inout,
|
bool& boolarg_inout,
|
||||||
|
|
||||||
signed char& signed_chararg_inout,
|
signed char& signed_chararg_inout,
|
||||||
|
|
@ -159,7 +160,7 @@ public:
|
||||||
doublearg_inout = 50;
|
doublearg_inout = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void director_method_bool_nameless_args(
|
virtual void director_method_nameless_args(
|
||||||
bool& ,
|
bool& ,
|
||||||
|
|
||||||
signed char& ,
|
signed char& ,
|
||||||
|
|
@ -203,7 +204,7 @@ public:
|
||||||
float floatarg_inout = 150;
|
float floatarg_inout = 150;
|
||||||
double doublearg_inout = 150;
|
double doublearg_inout = 150;
|
||||||
|
|
||||||
director_method_bool_output(
|
director_method_output(
|
||||||
boolarg_inout,
|
boolarg_inout,
|
||||||
|
|
||||||
signed_chararg_inout,
|
signed_chararg_inout,
|
||||||
|
|
@ -263,7 +264,7 @@ public:
|
||||||
floatarg_inout = 101;
|
floatarg_inout = 101;
|
||||||
doublearg_inout = 101;
|
doublearg_inout = 101;
|
||||||
|
|
||||||
director_method_bool_inout(
|
director_method_inout(
|
||||||
boolarg_inout,
|
boolarg_inout,
|
||||||
|
|
||||||
signed_chararg_inout,
|
signed_chararg_inout,
|
||||||
|
|
@ -303,7 +304,7 @@ public:
|
||||||
verify(floatarg_inout == 111);
|
verify(floatarg_inout == 111);
|
||||||
verify(doublearg_inout == 112);
|
verify(doublearg_inout == 112);
|
||||||
|
|
||||||
director_method_bool_nameless_args(
|
director_method_nameless_args(
|
||||||
boolarg_inout,
|
boolarg_inout,
|
||||||
|
|
||||||
signed_chararg_inout,
|
signed_chararg_inout,
|
||||||
|
|
|
||||||
433
Examples/test-suite/java_director_typemaps_ptr.i
Normal file
433
Examples/test-suite/java_director_typemaps_ptr.i
Normal file
|
|
@ -0,0 +1,433 @@
|
||||||
|
%module(directors="1") java_director_typemaps
|
||||||
|
// Test director pointer typemaps in typemaps.i - similar to java_director_typemaps.i testcase
|
||||||
|
|
||||||
|
%feature("director", assumeoverride=1) Quux;
|
||||||
|
|
||||||
|
%include <typemaps.i>
|
||||||
|
|
||||||
|
%apply bool* OUTPUT {bool*};
|
||||||
|
|
||||||
|
%apply signed char* OUTPUT {signed char*};
|
||||||
|
%apply unsigned char* OUTPUT {unsigned char*};
|
||||||
|
|
||||||
|
%apply short* OUTPUT {short*};
|
||||||
|
%apply unsigned short* OUTPUT {unsigned short*};
|
||||||
|
|
||||||
|
%apply int* OUTPUT {int*};
|
||||||
|
%apply unsigned int* OUTPUT {unsigned int*};
|
||||||
|
|
||||||
|
%apply long* OUTPUT {long*};
|
||||||
|
%apply unsigned long* OUTPUT {unsigned long*};
|
||||||
|
|
||||||
|
%apply long long* OUTPUT {long long*};
|
||||||
|
// %apply unsigned long long* OUTPUT {unsigned long long*};
|
||||||
|
|
||||||
|
%apply float* OUTPUT {float*};
|
||||||
|
%apply double* OUTPUT {double*};
|
||||||
|
|
||||||
|
%apply bool* OUTPUT {bool* boolarg_output};
|
||||||
|
|
||||||
|
%apply signed char* OUTPUT {signed char* signed_chararg_output};
|
||||||
|
%apply unsigned char* OUTPUT {unsigned char* unsigned_chararg_output};
|
||||||
|
|
||||||
|
%apply short* OUTPUT {short* shortarg_output};
|
||||||
|
%apply unsigned short* OUTPUT {unsigned short* unsigned_shortarg_output};
|
||||||
|
|
||||||
|
%apply int* OUTPUT {int* intarg_output};
|
||||||
|
%apply unsigned int* OUTPUT {unsigned int* unsigned_intarg_output};
|
||||||
|
|
||||||
|
%apply long* OUTPUT {long* longarg_output};
|
||||||
|
%apply unsigned long* OUTPUT {unsigned long* unsigned_longarg_output};
|
||||||
|
|
||||||
|
%apply long long* OUTPUT {long long* long_longarg_output};
|
||||||
|
// %apply unsigned long long* OUTPUT {unsigned long long* unsigned_long_longarg_output};
|
||||||
|
|
||||||
|
%apply float* OUTPUT {float* floatarg_output};
|
||||||
|
%apply double* OUTPUT {double* doublearg_output};
|
||||||
|
|
||||||
|
%apply bool* INOUT {bool* boolarg_inout};
|
||||||
|
|
||||||
|
%apply signed char* INOUT {signed char* signed_chararg_inout};
|
||||||
|
%apply unsigned char* INOUT {unsigned char* unsigned_chararg_inout};
|
||||||
|
|
||||||
|
%apply short* INOUT {short* shortarg_inout};
|
||||||
|
%apply unsigned short* INOUT {unsigned short* unsigned_shortarg_inout};
|
||||||
|
|
||||||
|
%apply int* INOUT {int* intarg_inout};
|
||||||
|
%apply unsigned int* INOUT {unsigned int* unsigned_intarg_inout};
|
||||||
|
|
||||||
|
%apply long* INOUT {long* longarg_inout};
|
||||||
|
%apply unsigned long* INOUT {unsigned long* unsigned_longarg_inout};
|
||||||
|
|
||||||
|
%apply long long* INOUT {long long* long_longarg_inout};
|
||||||
|
// %apply unsigned long long* INOUT {unsigned long long* unsigned_long_longarg_inout};
|
||||||
|
|
||||||
|
%apply float* INOUT {float* floatarg_inout};
|
||||||
|
%apply double* INOUT {double* doublearg_inout};
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdexcept>
|
||||||
|
#define verify(ok) if (!(ok)) throw std::runtime_error(# ok);
|
||||||
|
%}
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class Quux {
|
||||||
|
public:
|
||||||
|
Quux() {}
|
||||||
|
virtual ~Quux() {}
|
||||||
|
|
||||||
|
virtual void director_method_output(
|
||||||
|
bool* boolarg_output,
|
||||||
|
|
||||||
|
signed char* signed_chararg_output,
|
||||||
|
unsigned char* unsigned_chararg_output,
|
||||||
|
|
||||||
|
short* shortarg_output,
|
||||||
|
unsigned short* unsigned_shortarg_output,
|
||||||
|
|
||||||
|
int* intarg_output,
|
||||||
|
unsigned int* unsigned_intarg_output,
|
||||||
|
|
||||||
|
long* longarg_output,
|
||||||
|
unsigned long* unsigned_longarg_output,
|
||||||
|
|
||||||
|
long long* long_longarg_output,
|
||||||
|
// unsigned long long* unsigned_long_longarg_output,
|
||||||
|
|
||||||
|
float* floatarg_output,
|
||||||
|
double* doublearg_output)
|
||||||
|
{
|
||||||
|
if (boolarg_output) *boolarg_output = false;
|
||||||
|
|
||||||
|
if (signed_chararg_output) *signed_chararg_output = 50;
|
||||||
|
if (unsigned_chararg_output) *unsigned_chararg_output = 50;
|
||||||
|
|
||||||
|
if (shortarg_output) *shortarg_output = 50;
|
||||||
|
if (unsigned_shortarg_output) *unsigned_shortarg_output = 50;
|
||||||
|
|
||||||
|
if (intarg_output) *intarg_output = 50;
|
||||||
|
if (unsigned_intarg_output) *unsigned_intarg_output = 50;
|
||||||
|
|
||||||
|
if (longarg_output) *longarg_output = 50;
|
||||||
|
if (unsigned_longarg_output) *unsigned_longarg_output = 50;
|
||||||
|
|
||||||
|
if (long_longarg_output) *long_longarg_output = 50;
|
||||||
|
// if (unsigned_long_longarg_output) *unsigned_long_longarg_output = 50;
|
||||||
|
|
||||||
|
if (floatarg_output) *floatarg_output = 50;
|
||||||
|
if (doublearg_output) *doublearg_output = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void director_method_inout(
|
||||||
|
bool* boolarg_inout,
|
||||||
|
|
||||||
|
signed char* signed_chararg_inout,
|
||||||
|
unsigned char* unsigned_chararg_inout,
|
||||||
|
|
||||||
|
short* shortarg_inout,
|
||||||
|
unsigned short* unsigned_shortarg_inout,
|
||||||
|
|
||||||
|
int* intarg_inout,
|
||||||
|
unsigned int* unsigned_intarg_inout,
|
||||||
|
|
||||||
|
long* longarg_inout,
|
||||||
|
unsigned long* unsigned_longarg_inout,
|
||||||
|
|
||||||
|
long long* long_longarg_inout,
|
||||||
|
// unsigned long long* unsigned_long_longarg_inout,
|
||||||
|
|
||||||
|
float* floatarg_inout,
|
||||||
|
double* doublearg_inout)
|
||||||
|
{
|
||||||
|
if (boolarg_inout) *boolarg_inout = false;
|
||||||
|
|
||||||
|
if (signed_chararg_inout) *signed_chararg_inout = 50;
|
||||||
|
if (unsigned_chararg_inout) *unsigned_chararg_inout = 50;
|
||||||
|
|
||||||
|
if (shortarg_inout) *shortarg_inout = 50;
|
||||||
|
if (unsigned_shortarg_inout) *unsigned_shortarg_inout = 50;
|
||||||
|
|
||||||
|
if (intarg_inout) *intarg_inout = 50;
|
||||||
|
if (unsigned_intarg_inout) *unsigned_intarg_inout = 50;
|
||||||
|
|
||||||
|
if (longarg_inout) *longarg_inout = 50;
|
||||||
|
if (unsigned_longarg_inout) *unsigned_longarg_inout = 50;
|
||||||
|
|
||||||
|
if (long_longarg_inout) *long_longarg_inout = 50;
|
||||||
|
// if (unsigned_long_longarg_inout) *unsigned_long_longarg_inout = 50;
|
||||||
|
|
||||||
|
if (floatarg_inout) *floatarg_inout = 50;
|
||||||
|
if (doublearg_inout) *doublearg_inout = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void director_method_nameless_args(
|
||||||
|
bool* ,
|
||||||
|
|
||||||
|
signed char* ,
|
||||||
|
unsigned char* ,
|
||||||
|
|
||||||
|
short* ,
|
||||||
|
unsigned short* ,
|
||||||
|
|
||||||
|
int* ,
|
||||||
|
unsigned int* ,
|
||||||
|
|
||||||
|
long* ,
|
||||||
|
unsigned long* ,
|
||||||
|
|
||||||
|
long long* ,
|
||||||
|
// unsigned long long* ,
|
||||||
|
|
||||||
|
float* ,
|
||||||
|
double*)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void etest() {
|
||||||
|
bool boolarg_inout = false;
|
||||||
|
|
||||||
|
signed char signed_chararg_inout = 111;
|
||||||
|
unsigned char unsigned_chararg_inout = 150;
|
||||||
|
|
||||||
|
short shortarg_inout = 150;
|
||||||
|
unsigned short unsigned_shortarg_inout = 150;
|
||||||
|
|
||||||
|
int intarg_inout = 150;
|
||||||
|
unsigned int unsigned_intarg_inout = 150;
|
||||||
|
|
||||||
|
long longarg_inout = 150;
|
||||||
|
unsigned long unsigned_longarg_inout = 150;
|
||||||
|
|
||||||
|
long long long_longarg_inout = 150;
|
||||||
|
// unsigned long long unsigned_long_longarg_inout = 150;
|
||||||
|
|
||||||
|
float floatarg_inout = 150;
|
||||||
|
double doublearg_inout = 150;
|
||||||
|
|
||||||
|
director_method_output(
|
||||||
|
&boolarg_inout,
|
||||||
|
|
||||||
|
&signed_chararg_inout,
|
||||||
|
&unsigned_chararg_inout,
|
||||||
|
|
||||||
|
&shortarg_inout,
|
||||||
|
&unsigned_shortarg_inout,
|
||||||
|
|
||||||
|
&intarg_inout,
|
||||||
|
&unsigned_intarg_inout,
|
||||||
|
|
||||||
|
&longarg_inout,
|
||||||
|
&unsigned_longarg_inout,
|
||||||
|
|
||||||
|
&long_longarg_inout,
|
||||||
|
// &unsigned_long_longarg_inout,
|
||||||
|
|
||||||
|
&floatarg_inout,
|
||||||
|
&doublearg_inout);
|
||||||
|
|
||||||
|
verify(boolarg_inout == true);
|
||||||
|
verify(signed_chararg_inout == 1);
|
||||||
|
verify(unsigned_chararg_inout == 2);
|
||||||
|
|
||||||
|
verify(shortarg_inout == 3);
|
||||||
|
verify(unsigned_shortarg_inout == 4);
|
||||||
|
|
||||||
|
verify(intarg_inout == 5);
|
||||||
|
verify(unsigned_intarg_inout == 6);
|
||||||
|
|
||||||
|
verify(longarg_inout == 7);
|
||||||
|
verify(unsigned_longarg_inout == 8);
|
||||||
|
|
||||||
|
verify(long_longarg_inout == 9);
|
||||||
|
// verify(unsigned_long_longarg_inout == 10);
|
||||||
|
|
||||||
|
verify(floatarg_inout == 11);
|
||||||
|
verify(doublearg_inout == 12);
|
||||||
|
|
||||||
|
boolarg_inout = false;
|
||||||
|
|
||||||
|
signed_chararg_inout = 101;
|
||||||
|
unsigned_chararg_inout = 101;
|
||||||
|
|
||||||
|
shortarg_inout = 101;
|
||||||
|
unsigned_shortarg_inout = 101;
|
||||||
|
|
||||||
|
intarg_inout = 101;
|
||||||
|
unsigned_intarg_inout = 101;
|
||||||
|
|
||||||
|
longarg_inout = 101;
|
||||||
|
unsigned_longarg_inout = 101;
|
||||||
|
|
||||||
|
long_longarg_inout = 101;
|
||||||
|
// unsigned_long_longarg_inout = 101;
|
||||||
|
|
||||||
|
floatarg_inout = 101;
|
||||||
|
doublearg_inout = 101;
|
||||||
|
|
||||||
|
director_method_inout(
|
||||||
|
&boolarg_inout,
|
||||||
|
|
||||||
|
&signed_chararg_inout,
|
||||||
|
&unsigned_chararg_inout,
|
||||||
|
|
||||||
|
&shortarg_inout,
|
||||||
|
&unsigned_shortarg_inout,
|
||||||
|
|
||||||
|
&intarg_inout,
|
||||||
|
&unsigned_intarg_inout,
|
||||||
|
|
||||||
|
&longarg_inout,
|
||||||
|
&unsigned_longarg_inout,
|
||||||
|
|
||||||
|
&long_longarg_inout,
|
||||||
|
// &unsigned_long_longarg_inout,
|
||||||
|
|
||||||
|
&floatarg_inout,
|
||||||
|
&doublearg_inout);
|
||||||
|
|
||||||
|
verify(boolarg_inout == false);
|
||||||
|
verify(signed_chararg_inout == 11);
|
||||||
|
verify(unsigned_chararg_inout == 12);
|
||||||
|
|
||||||
|
verify(shortarg_inout == 13);
|
||||||
|
verify(unsigned_shortarg_inout == 14);
|
||||||
|
|
||||||
|
verify(intarg_inout == 15);
|
||||||
|
verify(unsigned_intarg_inout == 16);
|
||||||
|
|
||||||
|
verify(longarg_inout == 17);
|
||||||
|
verify(unsigned_longarg_inout == 18);
|
||||||
|
|
||||||
|
verify(long_longarg_inout == 19);
|
||||||
|
// verify(unsigned_long_longarg_inout == 110);
|
||||||
|
|
||||||
|
verify(floatarg_inout == 111);
|
||||||
|
verify(doublearg_inout == 112);
|
||||||
|
|
||||||
|
director_method_nameless_args(
|
||||||
|
&boolarg_inout,
|
||||||
|
|
||||||
|
&signed_chararg_inout,
|
||||||
|
&unsigned_chararg_inout,
|
||||||
|
|
||||||
|
&shortarg_inout,
|
||||||
|
&unsigned_shortarg_inout,
|
||||||
|
|
||||||
|
&intarg_inout,
|
||||||
|
&unsigned_intarg_inout,
|
||||||
|
|
||||||
|
&longarg_inout,
|
||||||
|
&unsigned_longarg_inout,
|
||||||
|
|
||||||
|
&long_longarg_inout,
|
||||||
|
// &unsigned_long_longarg_inout,
|
||||||
|
|
||||||
|
&floatarg_inout,
|
||||||
|
&doublearg_inout);
|
||||||
|
|
||||||
|
verify(boolarg_inout == true);
|
||||||
|
verify(signed_chararg_inout == 12);
|
||||||
|
verify(unsigned_chararg_inout == 13);
|
||||||
|
|
||||||
|
verify(shortarg_inout == 14);
|
||||||
|
verify(unsigned_shortarg_inout == 15);
|
||||||
|
|
||||||
|
verify(intarg_inout == 16);
|
||||||
|
verify(unsigned_intarg_inout == 17);
|
||||||
|
|
||||||
|
verify(longarg_inout == 18);
|
||||||
|
verify(unsigned_longarg_inout == 19);
|
||||||
|
|
||||||
|
verify(long_longarg_inout == 20);
|
||||||
|
// verify(unsigned_long_longarg_inout == 111);
|
||||||
|
|
||||||
|
verify(floatarg_inout == 112);
|
||||||
|
verify(doublearg_inout == 113);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nulltest() {
|
||||||
|
director_method_output(
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
// NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
director_method_inout(
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
// NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
director_method_nameless_args(
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
// NULL,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%clear bool*;
|
||||||
|
|
||||||
|
%clear signed char*;
|
||||||
|
%clear unsigned char*;
|
||||||
|
|
||||||
|
%clear short*;
|
||||||
|
%clear unsigned short*;
|
||||||
|
|
||||||
|
%clear int*;
|
||||||
|
%clear unsigned int*;
|
||||||
|
|
||||||
|
%clear long*;
|
||||||
|
%clear unsigned long*;
|
||||||
|
|
||||||
|
%clear long long*;
|
||||||
|
// %clear unsigned long long*;
|
||||||
|
|
||||||
|
%clear float*;
|
||||||
|
%clear double*;
|
||||||
|
|
@ -212,8 +212,16 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
||||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
|
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT, TYPE *OUTPUT %{
|
%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT %{
|
||||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||||
|
if (!$input) return $null;
|
||||||
|
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||||
|
|
||||||
|
%typemap(directorin,descriptor=JNIDESC) TYPE *OUTPUT %{
|
||||||
|
if ($1) {
|
||||||
|
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||||
|
if (!$input) return $null;
|
||||||
|
}
|
||||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) TYPE &OUTPUT
|
%typemap(directorargout, noblock=1) TYPE &OUTPUT
|
||||||
|
|
@ -225,9 +233,11 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) TYPE *OUTPUT
|
%typemap(directorargout, noblock=1) TYPE *OUTPUT
|
||||||
{
|
{
|
||||||
JNITYPE $1_jvalue;
|
if ($result) {
|
||||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
JNITYPE $1_jvalue;
|
||||||
*$result = ($*1_ltype)$1_jvalue;
|
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
|
*$result = ($*1_ltype)$1_jvalue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
|
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
|
||||||
|
|
@ -273,9 +283,11 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) bool *OUTPUT
|
%typemap(directorargout, noblock=1) bool *OUTPUT
|
||||||
{
|
{
|
||||||
jboolean $1_jvalue;
|
if ($result) {
|
||||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
jboolean $1_jvalue;
|
||||||
*$result = $1_jvalue ? true : false;
|
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
|
*$result = $1_jvalue ? true : false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -388,14 +400,18 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
||||||
|
|
||||||
%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{
|
%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{
|
||||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||||
|
if (!$input) return $null;
|
||||||
JNITYPE $1_jvalue = (JNITYPE)$1;
|
JNITYPE $1_jvalue = (JNITYPE)$1;
|
||||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||||
|
|
||||||
%typemap(directorin,descriptor=JNIDESC) TYPE *INOUT %{
|
%typemap(directorin,descriptor=JNIDESC) TYPE *INOUT %{
|
||||||
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
if ($1) {
|
||||||
JNITYPE $1_jvalue = (JNITYPE)*$1;
|
$input = JCALL1(New##JAVATYPE##Array, jenv, 1);
|
||||||
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
if (!$input) return $null;
|
||||||
|
JNITYPE $1_jvalue = (JNITYPE)*$1;
|
||||||
|
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
|
}
|
||||||
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
Swig::LocalRefGuard $1_refguard(jenv, $input); %}
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) TYPE &INOUT
|
%typemap(directorargout, noblock=1) TYPE &INOUT
|
||||||
|
|
@ -406,8 +422,11 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) TYPE *INOUT
|
%typemap(directorargout, noblock=1) TYPE *INOUT
|
||||||
{
|
{
|
||||||
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
if ($result) {
|
||||||
*$result = ($*1_ltype)$1_jvalue;
|
JNITYPE $1_jvalue;
|
||||||
|
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
|
*$result = ($*1_ltype)$1_jvalue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
|
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
|
||||||
|
|
@ -459,8 +478,11 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
|
||||||
|
|
||||||
%typemap(directorargout, noblock=1) bool *INOUT
|
%typemap(directorargout, noblock=1) bool *INOUT
|
||||||
{
|
{
|
||||||
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
if ($result) {
|
||||||
*$result = $1_jvalue ? true : false;
|
jboolean $1_jvalue;
|
||||||
|
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
|
||||||
|
*$result = $1_jvalue ? true : false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue