summaryrefslogtreecommitdiff
path: root/jpl/JNI
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-11-30 01:30:44 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-11-30 01:30:44 +0000
commit93e0cdbd0f68fd8d8d75c3510f7893c1ebaa26ae (patch)
treea6c84af1c502bc73fa1730324995f4e1fcb207b3 /jpl/JNI
parenta8710ca18eb34a984d0dfab8503448f77a53b379 (diff)
parent57dea26d80db9a1b455ef89cc843930fe18b0369 (diff)
downloadperl-93e0cdbd0f68fd8d8d75c3510f7893c1ebaa26ae.tar.gz
branch jpl from perlext to perl
p4raw-id: //depot/perl@2410
Diffstat (limited to 'jpl/JNI')
-rw-r--r--jpl/JNI/Changes5
-rw-r--r--jpl/JNI/JNI.pm280
-rw-r--r--jpl/JNI/JNI.xs3138
-rw-r--r--jpl/JNI/MANIFEST6
-rw-r--r--jpl/JNI/Makefile.PL24
-rw-r--r--jpl/JNI/test.pl20
-rw-r--r--jpl/JNI/typemap386
7 files changed, 3859 insertions, 0 deletions
diff --git a/jpl/JNI/Changes b/jpl/JNI/Changes
new file mode 100644
index 0000000000..dd2edf7c0c
--- /dev/null
+++ b/jpl/JNI/Changes
@@ -0,0 +1,5 @@
+Revision history for Perl extension JNI.
+
+0.01 Wed Jun 4 13:16:03 1997
+ - original version; created by h2xs 1.18
+
diff --git a/jpl/JNI/JNI.pm b/jpl/JNI/JNI.pm
new file mode 100644
index 0000000000..b0e87afa3d
--- /dev/null
+++ b/jpl/JNI/JNI.pm
@@ -0,0 +1,280 @@
+package JNI;
+
+use strict;
+use Carp;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD $JVM @JVM_ARGS $JAVALIB);
+
+require Exporter;
+require DynaLoader;
+require AutoLoader;
+
+@ISA = qw(Exporter DynaLoader);
+
+@EXPORT = qw(
+ JNI_ABORT
+ JNI_COMMIT
+ JNI_ERR
+ JNI_FALSE
+ JNI_H
+ JNI_OK
+ JNI_TRUE
+ GetVersion
+ DefineClass
+ FindClass
+ GetSuperclass
+ IsAssignableFrom
+ Throw
+ ThrowNew
+ ExceptionOccurred
+ ExceptionDescribe
+ ExceptionClear
+ FatalError
+ NewGlobalRef
+ DeleteGlobalRef
+ DeleteLocalRef
+ IsSameObject
+ AllocObject
+ NewObject
+ NewObjectA
+ GetObjectClass
+ IsInstanceOf
+ GetMethodID
+ CallObjectMethod
+ CallObjectMethodA
+ CallBooleanMethod
+ CallBooleanMethodA
+ CallByteMethod
+ CallByteMethodA
+ CallCharMethod
+ CallCharMethodA
+ CallShortMethod
+ CallShortMethodA
+ CallIntMethod
+ CallIntMethodA
+ CallLongMethod
+ CallLongMethodA
+ CallFloatMethod
+ CallFloatMethodA
+ CallDoubleMethod
+ CallDoubleMethodA
+ CallVoidMethod
+ CallVoidMethodA
+ CallNonvirtualObjectMethod
+ CallNonvirtualObjectMethodA
+ CallNonvirtualBooleanMethod
+ CallNonvirtualBooleanMethodA
+ CallNonvirtualByteMethod
+ CallNonvirtualByteMethodA
+ CallNonvirtualCharMethod
+ CallNonvirtualCharMethodA
+ CallNonvirtualShortMethod
+ CallNonvirtualShortMethodA
+ CallNonvirtualIntMethod
+ CallNonvirtualIntMethodA
+ CallNonvirtualLongMethod
+ CallNonvirtualLongMethodA
+ CallNonvirtualFloatMethod
+ CallNonvirtualFloatMethodA
+ CallNonvirtualDoubleMethod
+ CallNonvirtualDoubleMethodA
+ CallNonvirtualVoidMethod
+ CallNonvirtualVoidMethodA
+ GetFieldID
+ GetObjectField
+ GetBooleanField
+ GetByteField
+ GetCharField
+ GetShortField
+ GetIntField
+ GetLongField
+ GetFloatField
+ GetDoubleField
+ SetObjectField
+ SetBooleanField
+ SetByteField
+ SetCharField
+ SetShortField
+ SetIntField
+ SetLongField
+ SetFloatField
+ SetDoubleField
+ GetStaticMethodID
+ CallStaticObjectMethod
+ CallStaticObjectMethodA
+ CallStaticBooleanMethod
+ CallStaticBooleanMethodA
+ CallStaticByteMethod
+ CallStaticByteMethodA
+ CallStaticCharMethod
+ CallStaticCharMethodA
+ CallStaticShortMethod
+ CallStaticShortMethodA
+ CallStaticIntMethod
+ CallStaticIntMethodA
+ CallStaticLongMethod
+ CallStaticLongMethodA
+ CallStaticFloatMethod
+ CallStaticFloatMethodA
+ CallStaticDoubleMethod
+ CallStaticDoubleMethodA
+ CallStaticVoidMethod
+ CallStaticVoidMethodA
+ GetStaticFieldID
+ GetStaticObjectField
+ GetStaticBooleanField
+ GetStaticByteField
+ GetStaticCharField
+ GetStaticShortField
+ GetStaticIntField
+ GetStaticLongField
+ GetStaticFloatField
+ GetStaticDoubleField
+ SetStaticObjectField
+ SetStaticBooleanField
+ SetStaticByteField
+ SetStaticCharField
+ SetStaticShortField
+ SetStaticIntField
+ SetStaticLongField
+ SetStaticFloatField
+ SetStaticDoubleField
+ NewString
+ GetStringLength
+ GetStringChars
+ NewStringUTF
+ GetStringUTFLength
+ GetStringUTFChars
+ GetArrayLength
+ NewObjectArray
+ GetObjectArrayElement
+ SetObjectArrayElement
+ NewBooleanArray
+ NewByteArray
+ NewCharArray
+ NewShortArray
+ NewIntArray
+ NewLongArray
+ NewFloatArray
+ NewDoubleArray
+ GetBooleanArrayElements
+ GetByteArrayElements
+ GetCharArrayElements
+ GetShortArrayElements
+ GetIntArrayElements
+ GetLongArrayElements
+ GetFloatArrayElements
+ GetDoubleArrayElements
+ GetBooleanArrayRegion
+ GetByteArrayRegion
+ GetCharArrayRegion
+ GetShortArrayRegion
+ GetIntArrayRegion
+ GetLongArrayRegion
+ GetFloatArrayRegion
+ GetDoubleArrayRegion
+ SetBooleanArrayRegion
+ SetByteArrayRegion
+ SetCharArrayRegion
+ SetShortArrayRegion
+ SetIntArrayRegion
+ SetLongArrayRegion
+ SetFloatArrayRegion
+ SetDoubleArrayRegion
+ RegisterNatives
+ UnregisterNatives
+ MonitorEnter
+ MonitorExit
+ GetJavaVM
+);
+
+$VERSION = '0.01';
+
+sub AUTOLOAD {
+ # This AUTOLOAD is used to 'autoload' constants from the constant()
+ # XS function. If a constant is not found then control is passed
+ # to the AUTOLOAD in AutoLoader.
+
+ my $constname;
+ ($constname = $AUTOLOAD) =~ s/.*:://;
+ my $val = constant($constname, @_ ? $_[0] : 0);
+ if ($! != 0) {
+ if ($! =~ /Invalid/) {
+ $AutoLoader::AUTOLOAD = $AUTOLOAD;
+ goto &AutoLoader::AUTOLOAD;
+ }
+ else {
+ croak "Your vendor has not defined JNI macro $constname";
+ }
+ }
+ eval "sub $AUTOLOAD { $val }";
+ goto &$AUTOLOAD;
+}
+
+bootstrap JNI $VERSION;
+
+if (not $JPL::_env_) {
+ $ENV{JAVA_HOME} ||= "/usr/local/java";
+
+ chop(my $arch = `uname -p`);
+ chop($arch = `uname -m`) unless -d "$ENV{JAVA_HOME}/lib/$arch";
+
+ my @CLASSPATH = split(/:/, $ENV{CLASSPATH});
+ @CLASSPATH = "." unless @CLASSPATH;
+ push @CLASSPATH,
+ "$ENV{JAVA_HOME}/classes",
+ "$ENV{JAVA_HOME}/lib/classes.zip";
+ $ENV{CLASSPATH} = join(':', @CLASSPATH);
+
+ $ENV{THREADS_TYPE} ||= "green_threads";
+
+ $JAVALIB = "$ENV{JAVA_HOME}/lib/$arch/$ENV{THREADS_TYPE}";
+ $ENV{LD_LIBRARY_PATH} .= ":$JAVALIB";
+
+ $JVM = GetJavaVM("$JAVALIB/libjava.so",@JVM_ARGS);
+}
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is the stub of documentation for your module. You better edit it!
+
+=head1 NAME
+
+JNI - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+ use JNI;
+ blah blah blah
+
+=head1 DESCRIPTION
+
+Stub documentation for JNI was created by h2xs. It looks like the
+author of the extension was negligent enough to leave the stub
+unedited.
+
+Blah blah blah.
+
+=head1 Exported constants
+
+ JNI_ABORT
+ JNI_COMMIT
+ JNI_ERR
+ JNI_FALSE
+ JNI_H
+ JNI_OK
+ JNI_TRUE
+
+
+=head1 AUTHOR
+
+A. U. Thor, a.u.thor@a.galaxy.far.far.away
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
diff --git a/jpl/JNI/JNI.xs b/jpl/JNI/JNI.xs
new file mode 100644
index 0000000000..10eb2cf4ab
--- /dev/null
+++ b/jpl/JNI/JNI.xs
@@ -0,0 +1,3138 @@
+/*
+ * Copyright 1997, O'Reilly & Associate, Inc.
+ *
+ * This package may be copied under the same terms as Perl itself.
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <perl.h>
+#include <jni.h>
+#include <dlfcn.h>
+
+extern SV** stack_sp;
+extern JNIEnv* jplcurenv;
+extern int jpldebug;
+
+#define SysRet jint
+
+static void call_my_exit(jint status)
+{
+ my_exit(status);
+}
+
+jvalue*
+makeargs(char *sig, SV** svp, int items)
+{
+ jvalue* jv = (jvalue*)safemalloc(sizeof(jvalue) * items);
+ int ix = 0;
+ char *s = sig;
+ JNIEnv* env = jplcurenv;
+ char *start;
+ STRLEN n_a;
+
+ if (jpldebug)
+ fprintf(stderr, "sig = %s, items = %d\n", sig, items);
+ if (*s++ != '(')
+ goto cleanup;
+
+ while (items--) {
+ SV *sv = *svp++;
+ start = s;
+ switch (*s++) {
+ case 'Z':
+ jv[ix++].z = (jboolean)(SvIV(sv) != 0);
+ break;
+ case 'B':
+ jv[ix++].b = (jbyte)SvIV(sv);
+ break;
+ case 'C':
+ jv[ix++].c = (jchar)SvIV(sv);
+ break;
+ case 'S':
+ jv[ix++].s = (jshort)SvIV(sv);
+ break;
+ case 'I':
+ jv[ix++].i = (jint)SvIV(sv);
+ break;
+ case 'J':
+ jv[ix++].j = (jlong)SvNV(sv);
+ break;
+ case 'F':
+ jv[ix++].f = (jfloat)SvNV(sv);
+ break;
+ case 'D':
+ jv[ix++].d = (jdouble)SvNV(sv);
+ break;
+ case '[':
+ switch (*s++) {
+ case 'Z':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jboolean* buf = (jboolean*)malloc(len * sizeof(jboolean));
+ int i;
+ SV** esv;
+
+ jbooleanArray ja = (*env)->NewBooleanArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jboolean)SvIV(*esv);
+ (*env)->SetBooleanArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jboolean);
+
+ jbooleanArray ja = (*env)->NewBooleanArray(env, len);
+ (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'B':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jbyte* buf = (jbyte*)malloc(len * sizeof(jbyte));
+ int i;
+ SV** esv;
+
+ jbyteArray ja = (*env)->NewByteArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jbyte)SvIV(*esv);
+ (*env)->SetByteArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jbyte);
+
+ jbyteArray ja = (*env)->NewByteArray(env, len);
+ (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'C':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jchar* buf = (jchar*)malloc(len * sizeof(jchar));
+ int i;
+ SV** esv;
+
+ jcharArray ja = (*env)->NewCharArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jchar)SvIV(*esv);
+ (*env)->SetCharArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jchar);
+
+ jcharArray ja = (*env)->NewCharArray(env, len);
+ (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'S':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jshort* buf = (jshort*)malloc(len * sizeof(jshort));
+ int i;
+ SV** esv;
+
+ jshortArray ja = (*env)->NewShortArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jshort)SvIV(*esv);
+ (*env)->SetShortArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jshort);
+
+ jshortArray ja = (*env)->NewShortArray(env, len);
+ (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'I':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jint* buf = (jint*)malloc(len * sizeof(jint));
+ int i;
+ SV** esv;
+
+ jintArray ja = (*env)->NewIntArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jint)SvIV(*esv);
+ (*env)->SetIntArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jint);
+
+ jintArray ja = (*env)->NewIntArray(env, len);
+ (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'J':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jlong* buf = (jlong*)malloc(len * sizeof(jlong));
+ int i;
+ SV** esv;
+
+ jlongArray ja = (*env)->NewLongArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jlong)SvNV(*esv);
+ (*env)->SetLongArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jlong);
+
+ jlongArray ja = (*env)->NewLongArray(env, len);
+ (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'F':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jfloat* buf = (jfloat*)malloc(len * sizeof(jfloat));
+ int i;
+ SV** esv;
+
+ jfloatArray ja = (*env)->NewFloatArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jfloat)SvNV(*esv);
+ (*env)->SetFloatArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jfloat);
+
+ jfloatArray ja = (*env)->NewFloatArray(env, len);
+ (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'D':
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ jdouble* buf = (jdouble*)malloc(len * sizeof(jdouble));
+ int i;
+ SV** esv;
+
+ jdoubleArray ja = (*env)->NewDoubleArray(env, len);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+ buf[i] = (jdouble)SvNV(*esv);
+ (*env)->SetDoubleArrayRegion(env, ja, 0, len, buf);
+ free((void*)buf);
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else if (SvPOK(sv)) {
+ jsize len = sv_len(sv) / sizeof(jdouble);
+
+ jdoubleArray ja = (*env)->NewDoubleArray(env, len);
+ (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ case 'L':
+ while (*s != ';') s++;
+ s++;
+ if (strnEQ(start, "[Ljava/lang/String;", 19)) {
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ int i;
+ SV** esv;
+ static jclass jcl = 0;
+ jarray ja;
+
+ if (!jcl)
+ jcl = (*env)->FindClass(env, "java/lang/String");
+ ja = (*env)->NewObjectArray(env, len, jcl, 0);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
+ jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
+ (*env)->SetObjectArrayElement(env, ja, i, str);
+ }
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ }
+ /* FALL THROUGH */
+ default:
+ if (SvROK(sv)) {
+ SV* rv = (SV*)SvRV(sv);
+ if (SvOBJECT(rv))
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ else if (SvTYPE(rv) == SVt_PVAV) {
+ jsize len = av_len((AV*)rv) + 1;
+ int i;
+ SV** esv;
+ static jclass jcl = 0;
+ jarray ja;
+
+ if (!jcl)
+ jcl = (*env)->FindClass(env, "java/lang/Object");
+ ja = (*env)->NewObjectArray(env, len, jcl, 0);
+ for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
+ if (SvROK(*esv) && (rv = SvRV(*esv)) && SvOBJECT(rv)) {
+ (*env)->SetObjectArrayElement(env, ja, i,
+ (jobject)(void*)SvIV(rv));
+ }
+ else {
+ jobject str = (jobject)(*env)->NewStringUTF(env,
+ SvPV(*esv,n_a));
+ (*env)->SetObjectArrayElement(env, ja, i, str);
+ }
+ }
+ jv[ix++].l = (jobject)ja;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ }
+ else
+ jv[ix++].l = (jobject)(void*)0;
+ break;
+ }
+ break;
+ case 'L':
+ if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {
+ s += 17;
+ jv[ix++].l = (jobject)(*env)->NewStringUTF(env,
+ (char*) SvPV(sv,n_a));
+ break;
+ }
+ while (*s != ';') s++;
+ s++;
+ if (SvROK(sv)) {
+ SV* rv = SvRV(sv);
+ jv[ix++].l = (jobject)(void*)SvIV(rv);
+ }
+ break;
+ case ')':
+ croak("too many arguments, signature: %s", sig);
+ goto cleanup;
+ default:
+ croak("panic: malformed signature: %s", s-1);
+ goto cleanup;
+ }
+
+ }
+ if (*s != ')') {
+ croak("not enough arguments, signature: %s", sig);
+ goto cleanup;
+ }
+ return jv;
+
+cleanup:
+ safefree((char*)jv);
+ return 0;
+}
+
+static int
+not_here(s)
+char *s;
+{
+ croak("%s not implemented on this architecture", s);
+ return -1;
+}
+
+static double
+constant(name, arg)
+char *name;
+int arg;
+{
+ errno = 0;
+ switch (*name) {
+ case 'A':
+ break;
+ case 'B':
+ break;
+ case 'C':
+ break;
+ case 'D':
+ break;
+ case 'E':
+ break;
+ case 'F':
+ break;
+ case 'G':
+ break;
+ case 'H':
+ break;
+ case 'I':
+ break;
+ case 'J':
+ if (strEQ(name, "JNI_ABORT"))
+#ifdef JNI_ABORT
+ return JNI_ABORT;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_COMMIT"))
+#ifdef JNI_COMMIT
+ return JNI_COMMIT;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_ERR"))
+#ifdef JNI_ERR
+ return JNI_ERR;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_FALSE"))
+#ifdef JNI_FALSE
+ return JNI_FALSE;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_H"))
+#ifdef JNI_H
+ return JNI_H;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_OK"))
+#ifdef JNI_OK
+ return JNI_OK;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "JNI_TRUE"))
+#ifdef JNI_TRUE
+ return JNI_TRUE;
+#else
+ goto not_there;
+#endif
+ break;
+ case 'K':
+ break;
+ case 'L':
+ break;
+ case 'M':
+ break;
+ case 'N':
+ break;
+ case 'O':
+ break;
+ case 'P':
+ break;
+ case 'Q':
+ break;
+ case 'R':
+ break;
+ case 'S':
+ break;
+ case 'T':
+ break;
+ case 'U':
+ break;
+ case 'V':
+ break;
+ case 'W':
+ break;
+ case 'X':
+ break;
+ case 'Y':
+ break;
+ case 'Z':
+ break;
+ }
+ errno = EINVAL;
+ return 0;
+
+not_there:
+ errno = ENOENT;
+ return 0;
+}
+
+#define FETCHENV jplcurenv
+#define RESTOREENV jplcurenv = env
+
+MODULE = JNI PACKAGE = JNI
+
+PROTOTYPES: ENABLE
+
+double
+constant(name,arg)
+ char * name
+ int arg
+
+jint
+GetVersion()
+ JNIEnv * env = FETCHENV;
+ CODE:
+ {
+ RETVAL = (*env)->GetVersion(env);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jclass
+DefineClass(name, loader, buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jsize buf_len_ = NO_INIT;
+ const char * name
+ jobject loader
+ const jbyte * buf
+ CODE:
+ {
+ RETVAL = (*env)->DefineClass(env, name, loader, buf, (jsize)buf_len_);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jclass
+FindClass(name)
+ JNIEnv * env = FETCHENV;
+ const char * name
+ CODE:
+ {
+ RETVAL = (*env)->FindClass(env, name);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jclass
+GetSuperclass(sub)
+ JNIEnv * env = FETCHENV;
+ jclass sub
+ CODE:
+ {
+ RETVAL = (*env)->GetSuperclass(env, sub);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+IsAssignableFrom(sub, sup)
+ JNIEnv * env = FETCHENV;
+ jclass sub
+ jclass sup
+ CODE:
+ {
+ RETVAL = (*env)->IsAssignableFrom(env, sub, sup);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+SysRet
+Throw(obj)
+ JNIEnv * env = FETCHENV;
+ jthrowable obj
+ CODE:
+ {
+ RETVAL = (*env)->Throw(env, obj);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+SysRet
+ThrowNew(clazz, msg)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ const char * msg
+ CODE:
+ {
+ RETVAL = (*env)->ThrowNew(env, clazz, msg);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jthrowable
+ExceptionOccurred()
+ JNIEnv * env = FETCHENV;
+ CODE:
+ {
+ RETVAL = (*env)->ExceptionOccurred(env);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+ExceptionDescribe()
+ JNIEnv * env = FETCHENV;
+ CODE:
+ {
+ (*env)->ExceptionDescribe(env);
+ RESTOREENV;
+ }
+
+void
+ExceptionClear()
+ JNIEnv * env = FETCHENV;
+ CODE:
+ {
+ (*env)->ExceptionClear(env);
+ RESTOREENV;
+ }
+
+void
+FatalError(msg)
+ JNIEnv * env = FETCHENV;
+ const char * msg
+ CODE:
+ {
+ (*env)->FatalError(env, msg);
+ RESTOREENV;
+ }
+
+jobject
+NewGlobalRef(lobj)
+ JNIEnv * env = FETCHENV;
+ jobject lobj
+ CODE:
+ {
+ RETVAL = (*env)->NewGlobalRef(env, lobj);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+DeleteGlobalRef(gref)
+ JNIEnv * env = FETCHENV;
+ jobject gref
+ CODE:
+ {
+ (*env)->DeleteGlobalRef(env, gref);
+ RESTOREENV;
+ }
+
+void
+DeleteLocalRef(obj)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ CODE:
+ {
+ (*env)->DeleteLocalRef(env, obj);
+ RESTOREENV;
+ }
+
+jboolean
+IsSameObject(obj1,obj2)
+ JNIEnv * env = FETCHENV;
+ jobject obj1
+ jobject obj2
+ CODE:
+ {
+ RETVAL = (*env)->IsSameObject(env, obj1,obj2);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+AllocObject(clazz)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ CODE:
+ {
+ RETVAL = (*env)->AllocObject(env, clazz);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+NewObject(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+NewObjectA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jclass
+GetObjectClass(obj)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ CODE:
+ {
+ RETVAL = (*env)->GetObjectClass(env, obj);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+IsInstanceOf(obj,clazz)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ CODE:
+ {
+ RETVAL = (*env)->IsInstanceOf(env, obj,clazz);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jmethodID
+GetMethodID(clazz,name,sig)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ const char * name
+ const char * sig
+ CODE:
+ {
+ RETVAL = (*env)->GetMethodID(env, clazz,name,sig);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+CallObjectMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+CallObjectMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallBooleanMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallBooleanMethodA(obj,methodID, args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID, args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallByteMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallByteMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallCharMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallCharMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallShortMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallShortMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallIntMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallIntMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallLongMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallLongMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallFloatMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallFloatMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallDoubleMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallDoubleMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+CallVoidMethod(obj,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ (*env)->CallVoidMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+
+void
+CallVoidMethodA(obj,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ (*env)->CallVoidMethodA(env, obj,methodID,args);
+ RESTOREENV;
+ }
+
+jobject
+CallNonvirtualObjectMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+CallNonvirtualObjectMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallNonvirtualBooleanMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallNonvirtualBooleanMethodA(obj,clazz,methodID, args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID, args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallNonvirtualByteMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallNonvirtualByteMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallNonvirtualCharMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallNonvirtualCharMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallNonvirtualShortMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallNonvirtualShortMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallNonvirtualIntMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallNonvirtualIntMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallNonvirtualLongMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallNonvirtualLongMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallNonvirtualFloatMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallNonvirtualFloatMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallNonvirtualDoubleMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallNonvirtualDoubleMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+CallNonvirtualVoidMethod(obj,clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+
+void
+CallNonvirtualVoidMethodA(obj,clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
+ RESTOREENV;
+ }
+
+jfieldID
+GetFieldID(clazz,name,sig)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ const char * name
+ const char * sig
+ CODE:
+ {
+ RETVAL = (*env)->GetFieldID(env, clazz,name,sig);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+GetObjectField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetObjectField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+GetBooleanField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetBooleanField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+GetByteField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetByteField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+GetCharField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetCharField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+GetShortField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetShortField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+GetIntField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetIntField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+GetLongField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetLongField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+GetFloatField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetFloatField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+GetDoubleField(obj,fieldID)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetDoubleField(env, obj,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+SetObjectField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jobject val
+ CODE:
+ {
+ (*env)->SetObjectField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetBooleanField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jboolean val
+ CODE:
+ {
+ (*env)->SetBooleanField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetByteField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jbyte val
+ CODE:
+ {
+ (*env)->SetByteField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetCharField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jchar val
+ CODE:
+ {
+ (*env)->SetCharField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetShortField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jshort val
+ CODE:
+ {
+ (*env)->SetShortField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetIntField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jint val
+ CODE:
+ {
+ (*env)->SetIntField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetLongField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jlong val
+ CODE:
+ {
+ (*env)->SetLongField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetFloatField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jfloat val
+ CODE:
+ {
+ (*env)->SetFloatField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+void
+SetDoubleField(obj,fieldID,val)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ jfieldID fieldID
+ char * sig = 0;
+ jdouble val
+ CODE:
+ {
+ (*env)->SetDoubleField(env, obj,fieldID,val);
+ RESTOREENV;
+ }
+
+jmethodID
+GetStaticMethodID(clazz,name,sig)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ const char * name
+ const char * sig
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticMethodID(env, clazz,name,sig);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+CallStaticObjectMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+CallStaticObjectMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallStaticBooleanMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+CallStaticBooleanMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallStaticByteMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+CallStaticByteMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallStaticCharMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+CallStaticCharMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallStaticShortMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+CallStaticShortMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallStaticIntMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+CallStaticIntMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallStaticLongMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+CallStaticLongMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallStaticFloatMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+CallStaticFloatMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallStaticDoubleMethod(clazz,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+CallStaticDoubleMethodA(clazz,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+CallStaticVoidMethod(cls,methodID,...)
+ JNIEnv * env = FETCHENV;
+ jclass cls
+ jmethodID methodID
+ char * sig = 0;
+ int argoff = $min_args;
+ CODE:
+ {
+ jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+ (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
+ RESTOREENV;
+ }
+
+void
+CallStaticVoidMethodA(cls,methodID,args)
+ JNIEnv * env = FETCHENV;
+ jclass cls
+ jmethodID methodID
+ char * sig = 0;
+ jvalue * args
+ CODE:
+ {
+ (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
+ RESTOREENV;
+ }
+
+jfieldID
+GetStaticFieldID(clazz,name,sig)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ const char * name
+ const char * sig
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticFieldID(env, clazz,name,sig);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+GetStaticObjectField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticObjectField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean
+GetStaticBooleanField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticBooleanField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyte
+GetStaticByteField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticByteField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jchar
+GetStaticCharField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticCharField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshort
+GetStaticShortField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticShortField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jint
+GetStaticIntField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticIntField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlong
+GetStaticLongField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticLongField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloat
+GetStaticFloatField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticFloatField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdouble
+GetStaticDoubleField(clazz,fieldID)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ CODE:
+ {
+ RETVAL = (*env)->GetStaticDoubleField(env, clazz,fieldID);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+SetStaticObjectField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jobject value
+ CODE:
+ {
+ (*env)->SetStaticObjectField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticBooleanField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jboolean value
+ CODE:
+ {
+ (*env)->SetStaticBooleanField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticByteField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jbyte value
+ CODE:
+ {
+ (*env)->SetStaticByteField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticCharField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jchar value
+ CODE:
+ {
+ (*env)->SetStaticCharField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticShortField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jshort value
+ CODE:
+ {
+ (*env)->SetStaticShortField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticIntField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jint value
+ CODE:
+ {
+ (*env)->SetStaticIntField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticLongField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jlong value
+ CODE:
+ {
+ (*env)->SetStaticLongField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticFloatField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jfloat value
+ CODE:
+ {
+ (*env)->SetStaticFloatField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+void
+SetStaticDoubleField(clazz,fieldID,value)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ jfieldID fieldID
+ char * sig = 0;
+ jdouble value
+ CODE:
+ {
+ (*env)->SetStaticDoubleField(env, clazz,fieldID,value);
+ RESTOREENV;
+ }
+
+jstring
+NewString(unicode)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jsize unicode_len_ = NO_INIT;
+ const jchar * unicode
+ CODE:
+ {
+ RETVAL = (*env)->NewString(env, unicode, unicode_len_);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jsize
+GetStringLength(str)
+ JNIEnv * env = FETCHENV;
+ jstring str
+ CODE:
+ {
+ RETVAL = (*env)->GetStringLength(env, str);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+const jchar *
+GetStringChars(str)
+ JNIEnv * env = FETCHENV;
+ jstring str
+ jboolean isCopy = NO_INIT;
+ jsize RETVAL_len_ = NO_INIT;
+ CODE:
+ {
+ RETVAL = (*env)->GetStringChars(env, str,&isCopy);
+ RETVAL_len_ = (*env)->GetStringLength(env, str);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+ CLEANUP:
+ (*env)->ReleaseStringChars(env, str,RETVAL);
+
+jstring
+NewStringUTF(utf)
+ JNIEnv * env = FETCHENV;
+ const char * utf
+ CODE:
+ {
+ RETVAL = (*env)->NewStringUTF(env, utf);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jsize
+GetStringUTFLength(str)
+ JNIEnv * env = FETCHENV;
+ jstring str
+ CODE:
+ {
+ RETVAL = (*env)->GetStringUTFLength(env, str);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+const char *
+GetStringUTFChars(str)
+ JNIEnv * env = FETCHENV;
+ jstring str
+ jboolean isCopy = NO_INIT;
+ CODE:
+ {
+ RETVAL = (*env)->GetStringUTFChars(env, str,&isCopy);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+ CLEANUP:
+ (*env)->ReleaseStringUTFChars(env, str, RETVAL);
+
+
+jsize
+GetArrayLength(array)
+ JNIEnv * env = FETCHENV;
+ jarray array
+ CODE:
+ {
+ RETVAL = (*env)->GetArrayLength(env, array);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobjectArray
+NewObjectArray(len,clazz,init)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ jclass clazz
+ jobject init
+ CODE:
+ {
+ RETVAL = (*env)->NewObjectArray(env, len,clazz,init);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jobject
+GetObjectArrayElement(array,index)
+ JNIEnv * env = FETCHENV;
+ jobjectArray array
+ jsize index
+ CODE:
+ {
+ RETVAL = (*env)->GetObjectArrayElement(env, array,index);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+SetObjectArrayElement(array,index,val)
+ JNIEnv * env = FETCHENV;
+ jobjectArray array
+ jsize index
+ jobject val
+ CODE:
+ {
+ (*env)->SetObjectArrayElement(env, array,index,val);
+ RESTOREENV;
+ }
+
+jbooleanArray
+NewBooleanArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewBooleanArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jbyteArray
+NewByteArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewByteArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jcharArray
+NewCharArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewCharArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jshortArray
+NewShortArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewShortArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jintArray
+NewIntArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewIntArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jlongArray
+NewLongArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewLongArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jfloatArray
+NewFloatArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewFloatArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jdoubleArray
+NewDoubleArray(len)
+ JNIEnv * env = FETCHENV;
+ jsize len
+ CODE:
+ {
+ RETVAL = (*env)->NewDoubleArray(env, len);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+jboolean *
+GetBooleanArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jbooleanArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetBooleanArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jboolean* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jboolean))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jbyte *
+GetByteArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jbyteArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetByteArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jbyte* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jbyte))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jchar *
+GetCharArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jcharArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetCharArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jchar* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jchar))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jshort *
+GetShortArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jshortArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetShortArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jshort* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jshort))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jint *
+GetIntArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jintArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetIntArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jint* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jint))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jlong *
+GetLongArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jlongArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetLongArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jlong* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSViv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jlong))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jfloat *
+GetFloatArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jfloatArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetFloatArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jfloat* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSVnv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jfloat))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+jdouble *
+GetDoubleArrayElements(array)
+ JNIEnv * env = FETCHENV;
+ jsize RETVAL_len_ = NO_INIT;
+ jdoubleArray array
+ jboolean isCopy = NO_INIT;
+ PPCODE:
+ {
+ RETVAL = (*env)->GetDoubleArrayElements(env, array,&isCopy);
+ RETVAL_len_ = (*env)->GetArrayLength(env, array);
+ if (GIMME == G_ARRAY) {
+ int i;
+ jdouble* r = RETVAL;
+ EXTEND(sp, RETVAL_len_);
+ for (i = RETVAL_len_; i; --i) {
+ PUSHs(sv_2mortal(newSVnv(*r++)));
+ }
+ }
+ else {
+ if (RETVAL_len_) {
+ PUSHs(sv_2mortal(newSVpv((char*)RETVAL,
+ (STRLEN)RETVAL_len_ * sizeof(jdouble))));
+ }
+ else
+ PUSHs(&PL_sv_no);
+ }
+ (*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);
+ RESTOREENV;
+ }
+
+void
+GetBooleanArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jbooleanArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jboolean * buf = (jboolean*)sv_grow(ST(3),len * sizeof(jboolean)+1);
+ CODE:
+ {
+ (*env)->GetBooleanArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jboolean));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetByteArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jbyteArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jbyte * buf = (jbyte*)sv_grow(ST(3),len * sizeof(jbyte)+1);
+ CODE:
+ {
+ (*env)->GetByteArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jbyte));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetCharArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jcharArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jchar * buf = (jchar*)sv_grow(ST(3),len * sizeof(jchar)+1);
+ CODE:
+ {
+ (*env)->GetCharArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jchar));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetShortArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jshortArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jshort * buf = (jshort*)sv_grow(ST(3),len * sizeof(jshort)+1);
+ CODE:
+ {
+ (*env)->GetShortArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jshort));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetIntArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jintArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jint * buf = (jint*)sv_grow(ST(3),len * sizeof(jint)+1);
+ CODE:
+ {
+ (*env)->GetIntArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jint));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetLongArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jlongArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jlong * buf = (jlong*)sv_grow(ST(3),len * sizeof(jlong)+1);
+ CODE:
+ {
+ (*env)->GetLongArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jlong));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetFloatArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jfloatArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jfloat * buf = (jfloat*)sv_grow(ST(3),len * sizeof(jfloat)+1);
+ CODE:
+ {
+ (*env)->GetFloatArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jfloat));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+GetDoubleArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ jdoubleArray array
+ jsize start
+ jsize len
+ STRLEN tmplen = len * sizeof(jboolean) + 1;
+ char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+ jdouble * buf = (jdouble*)sv_grow(ST(3),len * sizeof(jdouble)+1);
+ CODE:
+ {
+ (*env)->GetDoubleArrayRegion(env, array,start,len,buf);
+ SvCUR_set(ST(3), len * sizeof(jdouble));
+ *SvEND(ST(3)) = '\0';
+ RESTOREENV;
+ }
+
+void
+SetBooleanArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jbooleanArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jboolean * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetBooleanArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetByteArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jbyteArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jbyte * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetByteArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetCharArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jcharArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jchar * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetCharArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetShortArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jshortArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jshort * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetShortArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetIntArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jintArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jint * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetIntArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetLongArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jlongArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jlong * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetLongArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetFloatArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jfloatArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jfloat * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetFloatArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+void
+SetDoubleArrayRegion(array,start,len,buf)
+ JNIEnv * env = FETCHENV;
+ STRLEN tmplen = NO_INIT;
+ jdoubleArray array
+ jsize start
+ jsize len
+ jsize buf_len_ = NO_INIT;
+ jdouble * buf
+ CODE:
+ {
+ if (buf_len_ < len)
+ croak("string is too short");
+ else if (buf_len_ > len && PL_dowarn)
+ warn("string is too long");
+ (*env)->SetDoubleArrayRegion(env, array,start,len,buf);
+ RESTOREENV;
+ }
+
+SysRet
+RegisterNatives(clazz,methods,nMethods)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ JNINativeMethod * methods
+ jint nMethods
+ CODE:
+ {
+ RETVAL = (*env)->RegisterNatives(env, clazz,methods,nMethods);
+ }
+
+SysRet
+UnregisterNatives(clazz)
+ JNIEnv * env = FETCHENV;
+ jclass clazz
+ CODE:
+ {
+ RETVAL = (*env)->UnregisterNatives(env, clazz);
+ }
+ OUTPUT:
+ RETVAL
+
+SysRet
+MonitorEnter(obj)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ CODE:
+ {
+ RETVAL = (*env)->MonitorEnter(env, obj);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+SysRet
+MonitorExit(obj)
+ JNIEnv * env = FETCHENV;
+ jobject obj
+ CODE:
+ {
+ RETVAL = (*env)->MonitorExit(env, obj);
+ RESTOREENV;
+ }
+ OUTPUT:
+ RETVAL
+
+JavaVM *
+GetJavaVM(...)
+ JNIEnv * env = FETCHENV;
+ CODE:
+ {
+ if (env) { /* We're embedded. */
+ if ((*env)->GetJavaVM(env, &RETVAL) < 0)
+ RETVAL = 0;
+ }
+ else { /* We're embedding. */
+ JDK1_1InitArgs vm_args;
+ char *lib;
+
+ if (items--) {
+ ++mark;
+ lib = SvPV(*mark, PL_na);
+ }
+ else
+ lib = 0;
+
+ if (!dlopen("libjava.so", RTLD_LAZY|RTLD_GLOBAL)) {
+ if (lib && !dlopen(lib, RTLD_LAZY|RTLD_GLOBAL))
+ croak("Can't load libjava.so");
+ }
+
+ JNI_GetDefaultJavaVMInitArgs(&vm_args);
+ vm_args.exit = &call_my_exit;
+ while (items > 1) {
+ char *s = SvPV(*++mark,PL_na);
+ items -= 2;
+ if (strEQ(s, "checkSource"))
+ vm_args.checkSource = (jint)SvIV(*++mark);
+ else if (strEQ(s, "nativeStackSize"))
+ vm_args.nativeStackSize = (jint)SvIV(*++mark);
+ else if (strEQ(s, "javaStackSize"))
+ vm_args.javaStackSize = (jint)SvIV(*++mark);
+ else if (strEQ(s, "minHeapSize"))
+ vm_args.minHeapSize = (jint)SvIV(*++mark);
+ else if (strEQ(s, "maxHeapSize"))
+ vm_args.maxHeapSize = (jint)SvIV(*++mark);
+ else if (strEQ(s, "verifyMode"))
+ vm_args.verifyMode = (jint)SvIV(*++mark);
+ else if (strEQ(s, "classpath"))
+ vm_args.classpath = savepv(SvPV(*++mark,PL_na));
+ else if (strEQ(s, "enableClassGC"))
+ vm_args.enableClassGC = (jint)SvIV(*++mark);
+ else if (strEQ(s, "enableVerboseGC"))
+ vm_args.enableVerboseGC = (jint)SvIV(*++mark);
+ else if (strEQ(s, "disableAsyncGC"))
+ vm_args.disableAsyncGC = (jint)SvIV(*++mark);
+ else if (strEQ(s, "verbose"))
+ vm_args.verbose = (jint)SvIV(*++mark);
+ else if (strEQ(s, "debugging"))
+ vm_args.debugging = (jboolean)SvIV(*++mark);
+ else if (strEQ(s, "debugPort"))
+ vm_args.debugPort = (jint)SvIV(*++mark);
+ else
+ croak("unrecognized option: %s", s);
+ }
+ JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args);
+ }
+ }
+
diff --git a/jpl/JNI/MANIFEST b/jpl/JNI/MANIFEST
new file mode 100644
index 0000000000..14a0f6ccd0
--- /dev/null
+++ b/jpl/JNI/MANIFEST
@@ -0,0 +1,6 @@
+Changes
+JNI.pm
+JNI.xs
+MANIFEST
+Makefile.PL
+test.pl
diff --git a/jpl/JNI/Makefile.PL b/jpl/JNI/Makefile.PL
new file mode 100644
index 0000000000..2611ff172c
--- /dev/null
+++ b/jpl/JNI/Makefile.PL
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+$JPL_SRC = "..";
+
+use ExtUtils::MakeMaker;
+use Config;
+
+eval `$JPL_SRC/setvars -perl`;
+
+$java = $ENV{JAVA_HOME};
+$jpl = $ENV{JPL_HOME};
+
+$ARCHNAME = $Config{archname};
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ NAME => 'JNI',
+ VERSION_FROM => 'JNI.pm',
+ LIBS => ["-R$Config{archlib}/CORE -L$Config{archlib}/CORE -R$jpl/lib/$ARCHNAME -L$jpl/lib/$ARCHNAME -lperl -lPerlInterpreter"],
+ DEFINE => '',
+ LINKTYPE => 'dynamic',
+ INC => "-I$java/include -I$java/include/$^O -I$java/include/genunix",
+);
diff --git a/jpl/JNI/test.pl b/jpl/JNI/test.pl
new file mode 100644
index 0000000000..816e28bcf2
--- /dev/null
+++ b/jpl/JNI/test.pl
@@ -0,0 +1,20 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use JNI;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
diff --git a/jpl/JNI/typemap b/jpl/JNI/typemap
new file mode 100644
index 0000000000..9bd0691be2
--- /dev/null
+++ b/jpl/JNI/typemap
@@ -0,0 +1,386 @@
+JavaVM * T_JPTROBJ
+JNINativeMethod * T_JPTROBJ
+const char * T_PV
+const jbyte * T_JMEM
+const jchar * T_JMEM
+jarray T_JPTROBJ
+jboolean T_IV
+jboolean * T_JMEM
+jbooleanArray T_JPTROBJ
+jbyte T_IV
+jbyte * T_JMEM
+jbyteArray T_JPTROBJ
+jchar T_IV
+jchar * T_JMEM
+jcharArray T_JPTROBJ
+jclass T_JPTROBJ
+jdouble T_NV
+jdouble * T_JMEM
+jdoubleArray T_JPTROBJ
+jfieldID T_JIDSIG
+jfloat T_NV
+jfloat * T_JMEM
+jfloatArray T_JPTROBJ
+jint T_IV
+jint * T_JMEM
+jintArray T_JPTROBJ
+jlong T_NV
+jlong * T_JMEM
+jlongArray T_JPTROBJ
+jmethodID T_JIDSIG
+jobject T_JPTROBJ
+jobjectArray T_JPTROBJ
+jshort T_IV
+jshort * T_JMEM
+jshortArray T_JPTROBJ
+jsize T_IV
+jstring T_JSTRING
+jthrowable T_JPTROBJ
+jvalue * T_JVALUELIST
+
+INPUT
+T_JMEM
+ {
+ $var = ($type)SvPV($arg,tmplen);
+ ${var}_len_ = (jsize) tmplen / sizeof(${subtype});
+ }
+T_JSTRING
+ if (SvROK($arg)) {
+ $var = ($type)(void*)SvIV(SvRV($arg));
+ }
+ else
+ $var = ($type)(*env)->NewStringUTF(env, (char *) SvPV($arg,PL_na))
+T_JVALUELIST
+ if (SvROK($arg)) {
+ AV* av = (AV*)SvRV($arg);
+ if (SvTYPE(av) == SVt_PVAV) {
+ I32 maxarg = AvFILL(av) + 1;
+ $var = makeargs(sig, AvARRAY(av), maxarg);
+ }
+ else
+ croak(\"$var is not an array reference\");
+ }
+ else
+ croak(\"$var is not a reference\")
+T_JIDSIG
+ {
+ $var = ($type)SvIV($arg);
+ sig = (char*)SvPV($arg,PL_na);
+ }
+T_JPTROBJ
+ if (SvROK($arg) && SvOBJECT(SvRV($arg))) {
+ IV tmp = SvIV((SV*)SvRV($arg));
+ $var = ($type) tmp;
+ }
+ else
+ croak(\"$var is not of type ${ntype}\")
+
+OUTPUT
+T_JMEM
+ sv_setpvn((SV*)$arg, (char*)$var, (STRLEN)${var}_len_ * sizeof(${subtype}));
+T_JSTRING
+ {
+ static HV* ${var}_stashhv_ = 0;
+ if (!${var}_stashhv_)
+ ${var}_stashhv_ = gv_stashpv("java::lang::String", TRUE);
+
+ sv_bless(
+ sv_setref_iv($arg, Nullch, (IV)(void*)${var}),
+ ${var}_stashhv_);
+
+ }
+T_JIDSIG
+ sv_setiv($arg, (IV)(void*)$var);
+ sv_setpv($arg, (char*)sig);
+ SvIOK_on($arg);
+T_JPTROBJ
+ sv_setref_pv($arg, \"${ntype}\", (void*)$var);
+
+# basic C types
+# int T_IV
+# unsigned T_IV
+# unsigned int T_IV
+# long T_IV
+# unsigned long T_IV
+# short T_IV
+# unsigned short T_IV
+# char T_CHAR
+# unsigned char T_U_CHAR
+# char * T_PV
+# unsigned char * T_PV
+# caddr_t T_PV
+# wchar_t * T_PV
+# wchar_t T_IV
+# bool_t T_IV
+# size_t T_IV
+# ssize_t T_IV
+# time_t T_NV
+# unsigned long * T_OPAQUEPTR
+# char ** T_PACKED
+# void * T_PTR
+# Time_t * T_PV
+# SV * T_SV
+# SVREF T_SVREF
+# AV * T_AVREF
+# HV * T_HVREF
+# CV * T_CVREF
+#
+# IV T_IV
+# I32 T_IV
+# I16 T_IV
+# I8 T_IV
+# U32 T_U_LONG
+# U16 T_U_SHORT
+# U8 T_IV
+# Result T_U_CHAR
+# Boolean T_IV
+# double T_DOUBLE
+# SysRet T_SYSRET
+# SysRetLong T_SYSRET
+# FILE * T_IN
+# FileHandle T_PTROBJ
+# InputStream T_IN
+# InOutStream T_INOUT
+# OutputStream T_OUT
+# bool T_BOOL
+#
+#############################################################################
+# INPUT
+# T_SV
+# $var = $arg
+# T_SVREF
+# if (sv_isa($arg, \"${ntype}\"))
+# $var = (SV*)SvRV($arg);
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_AVREF
+# if (sv_isa($arg, \"${ntype}\"))
+# $var = (AV*)SvRV($arg);
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_HVREF
+# if (sv_isa($arg, \"${ntype}\"))
+# $var = (HV*)SvRV($arg);
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_CVREF
+# if (sv_isa($arg, \"${ntype}\"))
+# $var = (CV*)SvRV($arg);
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_SYSRET
+# $var NOT IMPLEMENTED
+# T_IV
+# $var = ($type)SvIV($arg)
+# T_INT
+# $var = (int)SvIV($arg)
+# T_ENUM
+# $var = ($type)SvIV($arg)
+# T_BOOL
+# $var = (int)SvIV($arg)
+# T_U_INT
+# $var = (unsigned int)SvIV($arg)
+# T_SHORT
+# $var = (short)SvIV($arg)
+# T_U_SHORT
+# $var = (unsigned short)SvIV($arg)
+# T_LONG
+# $var = (long)SvIV($arg)
+# T_U_LONG
+# $var = (unsigned long)SvIV($arg)
+# T_CHAR
+# $var = (char)*SvPV($arg,PL_na)
+# T_U_CHAR
+# $var = (unsigned char)SvIV($arg)
+# T_FLOAT
+# $var = (float)SvNV($arg)
+# T_NV
+# $var = ($type)SvNV($arg)
+# T_DOUBLE
+# $var = (double)SvNV($arg)
+# T_PV
+# $var = ($type)SvPV($arg,PL_na)
+# T_PTR
+# $var = ($type)SvIV($arg)
+# T_PTRREF
+# if (SvROK($arg)) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = ($type) tmp;
+# }
+# else
+# croak(\"$var is not a reference\")
+# T_REF_IV_REF
+# if (sv_isa($arg, \"${type}\")) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = *($type *) tmp;
+# }
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_REF_IV_PTR
+# if (sv_isa($arg, \"${type}\")) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = ($type) tmp;
+# }
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_PTROBJ
+# if (sv_derived_from($arg, \"${ntype}\")) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = ($type) tmp;
+# }
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_PTRDESC
+# if (sv_isa($arg, \"${ntype}\")) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# ${type}_desc = (\U${type}_DESC\E*) tmp;
+# $var = ${type}_desc->ptr;
+# }
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_REFREF
+# if (SvROK($arg)) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = *($type) tmp;
+# }
+# else
+# croak(\"$var is not a reference\")
+# T_REFOBJ
+# if (sv_isa($arg, \"${ntype}\")) {
+# IV tmp = SvIV((SV*)SvRV($arg));
+# $var = *($type) tmp;
+# }
+# else
+# croak(\"$var is not of type ${ntype}\")
+# T_OPAQUE
+# $var NOT IMPLEMENTED
+# T_OPAQUEPTR
+# $var = ($type)SvPV($arg,PL_na)
+# T_PACKED
+# $var = XS_unpack_$ntype($arg)
+# T_PACKEDARRAY
+# $var = XS_unpack_$ntype($arg)
+# T_CALLBACK
+# $var = make_perl_cb_$type($arg)
+# T_ARRAY
+# $var = $ntype(items -= $argoff);
+# U32 ix_$var = $argoff;
+# while (items--) {
+# DO_ARRAY_ELEM;
+# }
+# T_IN
+# $var = IoIFP(sv_2io($arg))
+# T_INOUT
+# $var = IoIFP(sv_2io($arg))
+# T_OUT
+# $var = IoOFP(sv_2io($arg))
+##############################################################################
+# OUTPUT
+# T_SV
+# $arg = $var;
+# T_SVREF
+# $arg = newRV((SV*)$var);
+# T_AVREF
+# $arg = newRV((SV*)$var);
+# T_HVREF
+# $arg = newRV((SV*)$var);
+# T_CVREF
+# $arg = newRV((SV*)$var);
+# T_IV
+# sv_setiv($arg, (IV)$var);
+# T_INT
+# sv_setiv($arg, (IV)$var);
+# T_SYSRET
+# if ($var != -1) {
+# if ($var == 0)
+# sv_setpvn($arg, "0 but true", 10);
+# else
+# sv_setiv($arg, (IV)$var);
+# }
+# T_ENUM
+# sv_setiv($arg, (IV)$var);
+# T_BOOL
+# $arg = boolSV($var);
+# T_U_INT
+# sv_setiv($arg, (IV)$var);
+# T_SHORT
+# sv_setiv($arg, (IV)$var);
+# T_U_SHORT
+# sv_setiv($arg, (IV)$var);
+# T_LONG
+# sv_setiv($arg, (IV)$var);
+# T_U_LONG
+# sv_setiv($arg, (IV)$var);
+# T_CHAR
+# sv_setpvn($arg, (char *)&$var, 1);
+# T_U_CHAR
+# sv_setiv($arg, (IV)$var);
+# T_FLOAT
+# sv_setnv($arg, (double)$var);
+# T_NV
+# sv_setnv($arg, (double)$var);
+# T_DOUBLE
+# sv_setnv($arg, (double)$var);
+# T_PV
+# sv_setpv((SV*)$arg, $var);
+# T_PTR
+# sv_setiv($arg, (IV)$var);
+# T_PTRREF
+# sv_setref_pv($arg, Nullch, (void*)$var);
+# T_REF_IV_REF
+# sv_setref_pv($arg, \"${ntype}\", (void*)new $ntype($var));
+# T_REF_IV_PTR
+# sv_setref_pv($arg, \"${ntype}\", (void*)$var);
+# T_PTROBJ
+# sv_setref_pv($arg, \"${ntype}\", (void*)$var);
+# T_PTRDESC
+# sv_setref_pv($arg, \"${ntype}\", (void*)new\U${type}_DESC\E($var));
+# T_REFREF
+# sv_setrefref($arg, \"${ntype}\", XS_service_$ntype,
+# ($var ? (void*)new $ntype($var) : 0));
+# T_REFOBJ
+# NOT IMPLEMENTED
+# T_OPAQUE
+# sv_setpvn($arg, (char *)&$var, sizeof($var));
+# T_OPAQUEPTR
+# sv_setpvn($arg, (char *)$var, sizeof(*$var)), XFree((char *)$var);
+# T_PACKED
+# XS_pack_$ntype($arg, $var);
+# T_PACKEDARRAY
+# XS_pack_$ntype($arg, $var, count_$ntype);
+# T_DATAUNIT
+# sv_setpvn($arg, $var.chp(), $var.size());
+# T_CALLBACK
+# sv_setpvn($arg, $var.context.value().chp(),
+# $var.context.value().size());
+# T_ARRAY
+# ST_EXTEND($var.size);
+# for (U32 ix_$var = 0; ix_$var < $var.size; ix_$var++) {
+# ST(ix_$var) = sv_newmortal();
+# DO_ARRAY_ELEM
+# }
+# sp += $var.size - 1;
+# T_IN
+# {
+# GV *gv = newGVgen("$Package");
+# if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) )
+# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
+# else
+# $arg = &PL_sv_undef;
+# }
+# T_INOUT
+# {
+# GV *gv = newGVgen("$Package");
+# if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
+# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
+# else
+# $arg = &PL_sv_undef;
+# }
+# T_OUT
+# {
+# GV *gv = newGVgen("$Package");
+# if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
+# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
+# else
+# $arg = &PL_sv_undef;
+# }