260
277
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
280
%typemap(directorout) unsigned long long {
289
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
292
clazz = JCALL1(GetObjectClass, jenv, $input);
293
mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
294
ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
295
bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
296
sz = JCALL1(GetArrayLength, jenv, ba);
299
for(i=sz-1; i>0; i-- ) {
300
$1 = ($1 << 8) | (unsigned char)bae[sz-i];
304
for(i=sz; i>=0; i-- ) {
305
$1 = ($1 << 8) | (unsigned char)bae[sz-1-i];
308
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
263
312
/* Convert to BigInteger - byte array holds number in 2's complement big endian format */
264
313
%typemap(out) unsigned long long {
265
314
jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
282
331
/* Convert to BigInteger (see out typemap) */
283
%typemap(directorin, descriptor="Ljava/math/Biginteger;") unsigned long long, const unsigned long long & {
332
%typemap(directorin, descriptor="Ljava/math/BigInteger;") unsigned long long, const unsigned long long & {
284
333
jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
285
334
jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
286
335
jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
351
413
%{ temp = ($*1_ltype)$input;
416
%typemap(directorout,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) const char &,
418
const unsigned char &,
420
const unsigned short &,
422
const unsigned int &,
424
const unsigned long &,
428
%{ static $*1_ltype temp;
429
temp = ($*1_ltype)$input;
354
432
%typemap(directorin, descriptor="Z") const bool & "$input = (jboolean)$1_name;"
355
433
%typemap(directorin, descriptor="C") const char & "$input = (jchar)$1_name;"
356
434
%typemap(directorin, descriptor="B") const signed char & "$input = (jbyte)$1_name;"
442
520
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
523
%typemap(directorout,warning=SWIG_WARN_TYPEMAP_THREAD_UNSAFE) const unsigned long long & {
524
static $*1_ltype temp;
533
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
536
clazz = JCALL1(GetObjectClass, jenv, $input);
537
mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
538
ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
539
bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
540
sz = JCALL1(GetArrayLength, jenv, ba);
544
for(i=sz-1; i>0; i-- ) {
545
temp = (temp << 8) | (unsigned char)bae[sz-i];
549
for(i=sz; i>=0; i-- ) {
550
temp = (temp << 8) | (unsigned char)bae[sz-1-i];
553
JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
445
556
%typemap(out) const unsigned long long & {
446
557
jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
447
558
jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
466
577
/* Default handling. Object passed by value. Convert to a pointer */
467
578
%typemap(in) SWIGTYPE ($&1_type argp)
468
%{ argp = *($&1_ltype*)&$input;
579
%{ argp = *($&1_ltype*)(void *)&$input;
470
581
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
586
%typemap(directorout) SWIGTYPE ($1_ltype argp)
587
%{ argp = *($&1_ltype)(void *)&$input;
589
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
475
594
%typemap(out) SWIGTYPE
476
595
#ifdef __cplusplus
477
%{*($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
596
%{*($&1_ltype*)(void *)&$result = new $1_ltype(($1_ltype &)$1); %}
480
599
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
481
600
memmove($1ptr, &$1, sizeof($1_type));
482
*($&1_ltype*)&$result = $1ptr;
601
*($&1_ltype*)(void *)&$result = $1ptr;
486
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE "*(($&1_type)&$input) = &$1;"
605
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE
607
*(($&1_ltype*)(void *)&$input) = &$1; %}
487
608
%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, false)"
488
609
%typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)"
490
611
/* Generic pointers and references */
491
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
492
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
612
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)(void *)&$input; %}
613
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)(void *)&$input;
494
615
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
497
618
%typemap(out) SWIGTYPE *, SWIGTYPE (CLASS::*)
498
%{ *($&1_ltype)&$result = $1; %}
619
%{ *($&1_ltype)(void *)&$result = $1; %}
499
620
%typemap(out) SWIGTYPE &
500
%{ *($&1_ltype)&$result = $1; %}
621
%{ *($&1_ltype)(void *)&$result = $1; %}
623
%typemap(directorout) SWIGTYPE *, SWIGTYPE (CLASS::*)
624
%{ $1 = *($&1_ltype)(void *)&$input; %}
502
625
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE *, SWIGTYPE (CLASS::*)
503
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
626
%{ *(($&1_ltype)(void *)&$input) = ($1_ltype) $1; %}
505
628
%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE &
506
%{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
629
%{ *($&1_ltype)(void *)&$input = ($1_ltype) &$1; %}
508
631
%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, const SWIGTYPE & "new $javaclassname($jniinput, false)"
509
632
%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, const SWIGTYPE & "$javaclassname.getCPtr($javacall)"
511
634
/* Default array handling */
512
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
513
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
635
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)(void *)&$input; %}
636
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)(void *)&$result = $1; %}
514
637
%typemap(freearg) SWIGTYPE [ANY], SWIGTYPE [] ""
516
639
/* char arrays - treat as String */
891
1043
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
892
1044
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
894
// Proxy classes (base classes, ie, not derived classes)
895
%typemap(javabody) SWIGTYPE %{
1046
/* javabody typemaps */
1048
%define SWIG_JAVABODY_METHODS(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPENAME...)
1049
// Base proxy classes
1050
%typemap(javabody) TYPENAME %{
896
1051
private long swigCPtr;
897
1052
protected boolean swigCMemOwn;
899
protected $javaclassname(long cPtr, boolean cMemoryOwn) {
1054
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
900
1055
swigCMemOwn = cMemoryOwn;
901
1056
swigCPtr = cPtr;
904
protected static long getCPtr($javaclassname obj) {
1059
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
905
1060
return (obj == null) ? 0 : obj.swigCPtr;
909
1064
// Derived proxy classes
910
%typemap(javabody_derived) SWIGTYPE %{
1065
%typemap(javabody_derived) TYPENAME %{
911
1066
private long swigCPtr;
913
protected $javaclassname(long cPtr, boolean cMemoryOwn) {
1068
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
914
1069
super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
915
1070
swigCPtr = cPtr;
918
protected static long getCPtr($javaclassname obj) {
1073
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
919
1074
return (obj == null) ? 0 : obj.swigCPtr;
1079
/* Set the default for SWIGTYPE: pointer constructor is protected,
1080
getCPtr is protected. Season to your own taste! */
1082
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
923
1084
// Typewrapper classes
924
1085
%typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
925
1086
private long swigCPtr;
927
protected $javaclassname(long cPtr, boolean bFutureUse) {
1088
protected $javaclassname(long cPtr, boolean futureUse) {
928
1089
swigCPtr = cPtr;
1108
* Java constructor typemaps:
1110
* The javaconstruct typemap is inserted when a proxy class's constructor is generated.
1111
* This typemap allows control over what code is executed in the constructor as
1112
* well as specifying who owns the underlying C/C++ object. Normally, Java has
1113
* ownership and the underlying C/C++ object is deallocated when the Java object
1114
* is finalized (swigCMemOwn is true.) If swigCMemOwn is false, C/C++ is
1115
* ultimately responsible for deallocating the underlying object's memory.
1117
* The SWIG_PROXY_CONSTRUCTOR macro defines the javaconstruct typemap for a proxy
1118
* class for a particular TYPENAME. OWNERSHIP is passed as the value of
1119
* swigCMemOwn to the pointer constructor method. WEAKREF determines which kind
1120
* of Java object reference will be used by the C++ director class (WeakGlobalRef
1123
* The SWIG_DIRECTOR_OWNED macro sets the ownership of director-based proxy
1124
* classes and the weak reference flag to false, meaning that the underlying C++
1125
* object will be reclaimed by C++.
1128
%define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
1129
%typemap(javaconstruct,directorconnect="\n $moduleJNI.$javaclassname_director_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
1130
this($imcall, OWNERSHIP);$directorconnect
1134
%define SWIG_DIRECTOR_OWNED(TYPENAME...)
1135
SWIG_PROXY_CONSTRUCTOR(true, false, TYPENAME)
1138
// Set the default for SWIGTYPE: Java owns the C/C++ object.
1139
SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
946
1141
%typemap(javadestruct, methodname="delete") SWIGTYPE {
947
1142
if(swigCPtr != 0 && swigCMemOwn) {
948
1143
swigCMemOwn = false;
963
%typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE {
968
%typemap(directordisconnect_derived, methodname="swigDirectorDisconnect") SWIGTYPE {
1158
%typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
1159
protected void $methodname() {
1160
swigCMemOwn = false;
1165
%typemap(directorowner_release, methodname="swigReleaseOwnership") SWIGTYPE %{
1166
public void $methodname() {
1167
swigCMemOwn = false;
1172
%typemap(directorowner_take, methodname="swigTakeOwnership") SWIGTYPE %{
1173
public void $methodname() {
973
1179
/* Java specific directives */
974
1180
#define %javaconst(flag) %feature("java:const","flag")