summaryrefslogtreecommitdiff
path: root/jpl
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-04-08 19:57:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-08 19:57:17 +0000
commit35ef589f8a1ef7477ab32439f10c2e24fb7e16c2 (patch)
tree09b5a8deeea5c8de7ac9aa9c685edb883363acd7 /jpl
parent3b131e016eab048d0a2e73bbf3cf4d44f4aa7945 (diff)
downloadperl-35ef589f8a1ef7477ab32439f10c2e24fb7e16c2.tar.gz
Integrate change #9638 from maintperl into mainline:
update to latest JPL from the anoncvs repository p4raw-link: @9638 on //depot/maint-5.6/perl: 938d38c3258f3c3cfcda1601950a894c23717286 p4raw-id: //depot/perl@9642 p4raw-branched: from //depot/maint-5.6/perl@9641 'branch in' jpl/ChangeLog jpl/README.JUST-JNI jpl/docs/Tutorial.pod p4raw-integrated: from //depot/maint-5.6/perl@9641 'copy in' jpl/JNI/JNI.xs jpl/PerlInterpreter/PerlInterpreter.h (@5902..) jpl/README (@7887..) jpl/JNI/Makefile.PL (@9312..) 'merge in' jpl/JNI/JNI.pm (@5902..) MANIFEST (@9587..)
Diffstat (limited to 'jpl')
-rw-r--r--jpl/ChangeLog30
-rw-r--r--jpl/JNI/JNI.pm63
-rw-r--r--jpl/JNI/JNI.xs968
-rw-r--r--jpl/JNI/Makefile.PL203
-rw-r--r--jpl/PerlInterpreter/PerlInterpreter.h1
-rw-r--r--jpl/README120
-rw-r--r--jpl/README.JUST-JNI113
-rw-r--r--jpl/docs/Tutorial.pod1047
8 files changed, 1470 insertions, 1075 deletions
diff --git a/jpl/ChangeLog b/jpl/ChangeLog
new file mode 100644
index 0000000000..a3e3b0044c
--- /dev/null
+++ b/jpl/ChangeLog
@@ -0,0 +1,30 @@
+2000-12-18 Bradley M. Kuhn <bkuhn@ebb.org>
+
+ * JNI/JNI.pm: Updated version to 0.1
+
+2000-12-16 Bradley M. Kuhn <bkuhn@ebb.org>
+
+ * JNI/JNI.pm (AUTOLOAD): Added check to make sure fiels only
+ appear once in CLASSPATH.
+
+2000-12-07 Bradley M. Kuhn <bkuhn@ebb.org>
+
+ * JNI/JNI.xs: Added a requirement that -DJPL_DEBUG be defined for
+ JNI.xs to print out jpldebug options
+
+2000-12-06 Bradley M. Kuhn <bkuhn@ebb.org>
+
+ * JNI/JNI.pm: removed some stray C-m's floating in the file
+
+ * README.JUST-JNI: Added instructions concerning Kaffe.
+
+ * JNI/JNI.xs (GetJavaVM): Added support for Kaffe's options, and
+ made sure version number gets set. Also did error checking on
+ creating the JVM.
+ Fixed bug on option processing.
+
+ * JNI/Makefile.PL: Added support to configure Kaffe, including
+ automatic creation of JNI/Config.pm (a new file).
+
+ * JNI/JNI.pm (AUTOLOAD): Added support for Kaffe.
+
diff --git a/jpl/JNI/JNI.pm b/jpl/JNI/JNI.pm
index cee17791cc..c91ae9c998 100644
--- a/jpl/JNI/JNI.pm
+++ b/jpl/JNI/JNI.pm
@@ -187,7 +187,7 @@ require AutoLoader;
GetJavaVM
);
-$VERSION = '0.01';
+$VERSION = '0.1';
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
@@ -213,28 +213,77 @@ sub AUTOLOAD {
bootstrap JNI $VERSION;
if (not $JPL::_env_) {
+ # Note that only Kaffe support only cares about what JNI::Config says
+ use JNI::Config qw($KAFFE $LD_LIBRARY_PATH $CLASS_HOME $LIB_HOME $JAVA_LIB);
+
+ # Win32 and Sun JDK pay attention to $ENV{JAVA_HOME}; Kaffe doesn't
$ENV{JAVA_HOME} ||= "/usr/local/java";
my ($arch, @CLASSPATH);
- if ($^O eq 'MSWin32') {
+ if ($^O eq 'MSWin32' and (! $JNI::Config::KAFFE) ) {
$arch = 'MSWin32' unless -d "$ENV{JAVA_HOME}/lib/$arch";
@CLASSPATH = split(/;/, $ENV{CLASSPATH});
@CLASSPATH = "." unless @CLASSPATH;
push @CLASSPATH,
"$ENV{JAVA_HOME}\\classes",
- "$ENV{JAVA_HOME}\\lib\\classes.zip";
+ "$ENV{JAVA_HOME}\\lib\\classes.zip",
+ # MSR - added for JDK 1.3
+ "$ENV{JAVA_HOME}\\jre\\lib\\rt.jar",
+ # MSR - added to find Closer.class
+ '.';
$ENV{CLASSPATH} = join(';', @CLASSPATH);
$ENV{THREADS_TYPE} ||= "green_threads";
- $JAVALIB = "$ENV{JAVA_HOME}/lib/$arch/$ENV{THREADS_TYPE}";
+ #$JAVALIB = "$ENV{JAVA_HOME}/lib/$arch/$ENV{THREADS_TYPE}";
+ # MSR - changed above for JDK 1.3
+ $JAVALIB = "$ENV{JAVA_HOME}/lib/";
+
$ENV{LD_LIBRARY_PATH} .= ":$JAVALIB";
push @JVM_ARGS, "classpath", $ENV{CLASSPATH};
- print "JVM_ARGS=@JVM_ARGS!\n";
+ print "JVM_ARGS=@JVM_ARGS!\n" if $JPL::DEBUG;
$JVM = GetJavaVM("$JAVALIB/javai.dll",@JVM_ARGS);
-
+ } elsif ($^O eq 'MSWin32' and $JNI::Config::KAFFE) {
+ croak "Kaffe is not yet supported on MSWin32 platform!";
+ } elsif ($JNI::Config::KAFFE) {
+ # The following code has to build a classpath for us. It would be
+ # better if we could have *both* a classpath and a classhome, and
+ # not have to "guess" at the classpath like this. We should be able
+ # to send in, say, a classpath of ".", and classhome of
+ # ".../share/kaffe", and have it build the right classpath. That
+ # doesn't work. The function initClasspath() in findInJar.c in the
+ # Kaffe source says: "Oh, you have a classpath, well forget
+ # classhome!" This seems brain-dead to me. But, anyway, that's why
+ # I don't use the classhome option on GetJavaVM. I have to build
+ # the classpath by hand. *sigh*
+ # -- bkuhn
+
+ my $classpath = $ENV{CLASSPATH} || ".";
+ my %classCheck;
+ @classCheck{split(/\s*:\s*/, $classpath)} = 1;
+ foreach my $jarFile (qw(Klasses.jar comm.jar pjava.jar
+ tools.jar microsoft.jar rmi.jar)) {
+ $classpath .= ":$JNI::Config::CLASS_HOME/$jarFile"
+ unless defined $classCheck{"$JNI::Config::CLASS_HOME/$jarFile"};
+ # Assume that if someone else already put these here, they knew
+ # what they were doing and have the order right.
+ }
+ $classpath = ".:$classpath" unless defined $classCheck{"."};
+
+ $ENV{CLASSPATH} = $classpath; # Not needed for GetJavaVM(), since
+ # we pass it in as a JVM option, but
+ # something else might expect it.
+ # (also see comment above)
+ print STDERR "bkuhn: JNI classpath=$classpath\n";
+ unshift(@JVM_ARGS, "classpath", $classpath,
+ "libraryhome", $JNI::Config::LIB_HOME);
+
+ # The following line is useless; see comment above.
+ # "classhome", $JNI::Config::CLASS_HOME);
+
+ $JVM = GetJavaVM($JNI::Config::JAVA_LIB, @JVM_ARGS);
} else {
chop($arch = `uname -p`);
chop($arch = `uname -m`) unless -d "$ENV{JAVA_HOME}/lib/$arch";
@@ -251,7 +300,7 @@ if (not $JPL::_env_) {
$JAVALIB = "$ENV{JAVA_HOME}/lib/$arch/$ENV{THREADS_TYPE}";
$ENV{LD_LIBRARY_PATH} .= ":$JAVALIB";
push @JVM_ARGS, "classpath", $ENV{CLASSPATH};
- print "JVM_ARGS=@JVM_ARGS!\n";
+ print "JVM_ARGS=@JVM_ARGS!\n" if $JPL::DEBUG;
$JVM = GetJavaVM("$JAVALIB/libjava.so",@JVM_ARGS);
}
}
diff --git a/jpl/JNI/JNI.xs b/jpl/JNI/JNI.xs
index e5e0af3b53..f4826954e7 100644
--- a/jpl/JNI/JNI.xs
+++ b/jpl/JNI/JNI.xs
@@ -18,8 +18,7 @@
# define PERL_SUBVERSION SUBVERSION
#endif
-#if PERL_REVISION == 5 && (PERL_VERSION < 4 || \
- (PERL_VERSION == 4 && PERL_SUBVERSION <= 75))
+#if PERL_REVISION == 5 && (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION <= 75))
# define PL_na na
# define PL_sv_no sv_no
# define PL_sv_undef sv_undef
@@ -120,18 +119,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jbooleanArray ja = env->NewBooleanArray(len);
-#else
jbooleanArray ja = (*env)->NewBooleanArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jboolean)SvIV(*esv);
-#ifdef WIN32
- env->SetBooleanArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetBooleanArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -141,16 +132,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jboolean);
-#ifdef WIN32
- jbooleanArray ja = env->NewBooleanArray(len);
-#else
jbooleanArray ja = (*env)->NewBooleanArray(env, len);
-#endif
-#ifdef WIN32
- env->SetBooleanArrayRegion(ja, 0, len, (jboolean*)SvPV(sv,n_a));
-#else
(*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -167,18 +150,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jbyteArray ja = env->NewByteArray(len);
-#else
jbyteArray ja = (*env)->NewByteArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jbyte)SvIV(*esv);
-#ifdef WIN32
- env->SetByteArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetByteArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -188,16 +163,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jbyte);
-#ifdef WIN32
- jbyteArray ja = env->NewByteArray(len);
-#else
jbyteArray ja = (*env)->NewByteArray(env, len);
-#endif
-#ifdef WIN32
- env->SetByteArrayRegion(ja, 0, len, (jbyte*)SvPV(sv,n_a));
-#else
(*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -214,18 +181,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jcharArray ja = env->NewCharArray(len);
-#else
jcharArray ja = (*env)->NewCharArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jchar)SvIV(*esv);
-#ifdef WIN32
- env->SetCharArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetCharArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -235,16 +194,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jchar);
-#ifdef WIN32
- jcharArray ja = env->NewCharArray(len);
-#else
jcharArray ja = (*env)->NewCharArray(env, len);
-#endif
-#ifdef WIN32
- env->SetCharArrayRegion(ja, 0, len, (jchar*)SvPV(sv,n_a));
-#else
(*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -261,18 +212,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jshortArray ja = env->NewShortArray(len);
-#else
jshortArray ja = (*env)->NewShortArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jshort)SvIV(*esv);
-#ifdef WIN32
- env->SetShortArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetShortArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -282,16 +225,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jshort);
-#ifdef WIN32
- jshortArray ja = env->NewShortArray(len);
-#else
jshortArray ja = (*env)->NewShortArray(env, len);
-#endif
-#ifdef WIN32
- env->SetShortArrayRegion(ja, 0, len, (jshort*)SvPV(sv,n_a));
-#else
(*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -308,18 +243,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jintArray ja = env->NewIntArray(len);
-#else
jintArray ja = (*env)->NewIntArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jint)SvIV(*esv);
-#ifdef WIN32
- env->SetIntArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetIntArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -329,16 +256,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jint);
-#ifdef WIN32
- jintArray ja = env->NewIntArray(len);
-#else
jintArray ja = (*env)->NewIntArray(env, len);
-#endif
-#ifdef WIN32
- env->SetIntArrayRegion(ja, 0, len, (jint*)SvPV(sv,n_a));
-#else
(*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -355,18 +274,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jlongArray ja = env->NewLongArray(len);
-#else
jlongArray ja = (*env)->NewLongArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jlong)SvNV(*esv);
-#ifdef WIN32
- env->SetLongArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetLongArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -376,16 +287,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jlong);
-#ifdef WIN32
- jlongArray ja = env->NewLongArray(len);
-#else
jlongArray ja = (*env)->NewLongArray(env, len);
-#endif
-#ifdef WIN32
- env->SetLongArrayRegion(ja, 0, len, (jlong*)SvPV(sv,n_a));
-#else
(*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -402,18 +305,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jfloatArray ja = env->NewFloatArray(len);
-#else
jfloatArray ja = (*env)->NewFloatArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jfloat)SvNV(*esv);
-#ifdef WIN32
- env->SetFloatArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetFloatArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -423,16 +318,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jfloat);
-#ifdef WIN32
- jfloatArray ja = env->NewFloatArray(len);
-#else
jfloatArray ja = (*env)->NewFloatArray(env, len);
-#endif
-#ifdef WIN32
- env->SetFloatArrayRegion(ja, 0, len, (jfloat*)SvPV(sv,n_a));
-#else
(*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -449,18 +336,10 @@ makeargs(char *sig, SV** svp, int items)
int i;
SV** esv;
-#ifdef WIN32
- jdoubleArray ja = env->NewDoubleArray(len);
-#else
jdoubleArray ja = (*env)->NewDoubleArray(env, len);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
buf[i] = (jdouble)SvNV(*esv);
-#ifdef WIN32
- env->SetDoubleArrayRegion(ja, 0, len, buf);
-#else
(*env)->SetDoubleArrayRegion(env, ja, 0, len, buf);
-#endif
free((void*)buf);
jv[ix++].l = (jobject)ja;
}
@@ -470,16 +349,8 @@ makeargs(char *sig, SV** svp, int items)
else if (SvPOK(sv)) {
jsize len = sv_len(sv) / sizeof(jdouble);
-#ifdef WIN32
- jdoubleArray ja = env->NewDoubleArray(len);
-#else
jdoubleArray ja = (*env)->NewDoubleArray(env, len);
-#endif
-#ifdef WIN32
- env->SetDoubleArrayRegion(ja, 0, len, (jdouble*)SvPV(sv,n_a));
-#else
(*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));
-#endif
jv[ix++].l = (jobject)ja;
}
else
@@ -501,27 +372,11 @@ makeargs(char *sig, SV** svp, int items)
jobjectArray ja;
if (!jcl)
-#ifdef WIN32
- jcl = env->FindClass("java/lang/String");
-#else
jcl = (*env)->FindClass(env, "java/lang/String");
-#endif
-#ifdef WIN32
- ja = env->NewObjectArray(len, jcl, 0);
-#else
ja = (*env)->NewObjectArray(env, len, jcl, 0);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
-#ifdef WIN32
- jobject str = (jobject)env->NewStringUTF(SvPV(*esv,n_a));
-#else
jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
-#endif
-#ifdef WIN32
- env->SetObjectArrayElement(ja, i, str);
-#else
(*env)->SetObjectArrayElement(env, ja, i, str);
-#endif
}
jv[ix++].l = (jobject)ja;
}
@@ -546,35 +401,15 @@ makeargs(char *sig, SV** svp, int items)
jobjectArray ja;
if (!jcl)
-#ifdef WIN32
- jcl = env->FindClass("java/lang/Object");
-#else
jcl = (*env)->FindClass(env, "java/lang/Object");
-#endif
-#ifdef WIN32
- ja = env->NewObjectArray(len, jcl, 0);
-#else
ja = (*env)->NewObjectArray(env, len, jcl, 0);
-#endif
for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
if (SvROK(*esv) && (rv = SvRV(*esv)) && SvOBJECT(rv)) {
-#ifdef WIN32
- env->SetObjectArrayElement(ja, i, (jobject)(void*)SvIV(rv));
-#else
(*env)->SetObjectArrayElement(env, ja, i, (jobject)(void*)SvIV(rv));
-#endif
}
else {
-#ifdef WIN32
- jobject str = (jobject)env->NewStringUTF(SvPV(*esv,n_a));
-#else
jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
-#endif
-#ifdef WIN32
- env->SetObjectArrayElement(ja, i, str);
-#else
(*env)->SetObjectArrayElement(env, ja, i, str);
-#endif
}
}
jv[ix++].l = (jobject)ja;
@@ -590,11 +425,7 @@ makeargs(char *sig, SV** svp, int items)
case 'L':
if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {
s += 17;
-#ifdef WIN32
- jv[ix++].l = (jobject)env->NewStringUTF((char*) SvPV(sv,n_a));
-#else
jv[ix++].l = (jobject)(*env)->NewStringUTF(env, (char*) SvPV(sv,n_a));
-#endif
break;
}
while (*s != ';') s++;
@@ -760,11 +591,7 @@ GetVersion()
JNIEnv * env = FETCHENV;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetVersion();
-#else
RETVAL = (*env)->GetVersion(env);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -781,18 +608,10 @@ DefineClass(name, loader, buf)
CODE:
{
#ifdef KAFFE
-#ifdef WIN32
- RETVAL = env->DefineClass( loader, buf, (jsize)buf_len_);
-#else
RETVAL = (*env)->DefineClass(env, loader, buf, (jsize)buf_len_);
-#endif
-#else
-#ifdef WIN32
- RETVAL = env->DefineClass( name, loader, buf, (jsize)buf_len_);
#else
RETVAL = (*env)->DefineClass(env, name, loader, buf, (jsize)buf_len_);
#endif
-#endif
RESTOREENV;
}
OUTPUT:
@@ -804,11 +623,7 @@ FindClass(name)
const char * name
CODE:
{
-#ifdef WIN32
- RETVAL = env->FindClass( name);
-#else
RETVAL = (*env)->FindClass(env, name);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -820,11 +635,7 @@ GetSuperclass(sub)
jclass sub
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetSuperclass( sub);
-#else
RETVAL = (*env)->GetSuperclass(env, sub);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -837,11 +648,7 @@ IsAssignableFrom(sub, sup)
jclass sup
CODE:
{
-#ifdef WIN32
- RETVAL = env->IsAssignableFrom( sub, sup);
-#else
RETVAL = (*env)->IsAssignableFrom(env, sub, sup);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -853,11 +660,7 @@ Throw(obj)
jthrowable obj
CODE:
{
-#ifdef WIN32
- RETVAL = env->Throw( obj);
-#else
RETVAL = (*env)->Throw(env, obj);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -870,11 +673,7 @@ ThrowNew(clazz, msg)
const char * msg
CODE:
{
-#ifdef WIN32
- RETVAL = env->ThrowNew( clazz, msg);
-#else
RETVAL = (*env)->ThrowNew(env, clazz, msg);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -885,11 +684,7 @@ ExceptionOccurred()
JNIEnv * env = FETCHENV;
CODE:
{
-#ifdef WIN32
- RETVAL = env->ExceptionOccurred();
-#else
RETVAL = (*env)->ExceptionOccurred(env);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -900,11 +695,7 @@ ExceptionDescribe()
JNIEnv * env = FETCHENV;
CODE:
{
-#ifdef WIN32
- env->ExceptionDescribe();
-#else
(*env)->ExceptionDescribe(env);
-#endif
RESTOREENV;
}
@@ -913,11 +704,7 @@ ExceptionClear()
JNIEnv * env = FETCHENV;
CODE:
{
-#ifdef WIN32
- env->ExceptionClear();
-#else
(*env)->ExceptionClear(env);
-#endif
RESTOREENV;
}
@@ -927,11 +714,7 @@ FatalError(msg)
const char * msg
CODE:
{
-#ifdef WIN32
- env->FatalError( msg);
-#else
(*env)->FatalError(env, msg);
-#endif
RESTOREENV;
}
@@ -941,11 +724,7 @@ NewGlobalRef(lobj)
jobject lobj
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewGlobalRef(lobj);
-#else
RETVAL = (*env)->NewGlobalRef(env, lobj);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -957,11 +736,7 @@ DeleteGlobalRef(gref)
jobject gref
CODE:
{
-#ifdef WIN32
- env->DeleteGlobalRef(gref);
-#else
(*env)->DeleteGlobalRef(env, gref);
-#endif
RESTOREENV;
}
@@ -971,11 +746,7 @@ DeleteLocalRef(obj)
jobject obj
CODE:
{
-#ifdef WIN32
- env->DeleteLocalRef( obj);
-#else
(*env)->DeleteLocalRef(env, obj);
-#endif
RESTOREENV;
}
@@ -986,11 +757,7 @@ IsSameObject(obj1,obj2)
jobject obj2
CODE:
{
-#ifdef WIN32
- RETVAL = env->IsSameObject(obj1,obj2);
-#else
RETVAL = (*env)->IsSameObject(env, obj1,obj2);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1002,11 +769,7 @@ AllocObject(clazz)
jclass clazz
CODE:
{
-#ifdef WIN32
- RETVAL = env->AllocObject(clazz);
-#else
RETVAL = (*env)->AllocObject(env, clazz);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1022,11 +785,7 @@ NewObject(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->NewObjectA(clazz,methodID,args);
-#else
RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1041,11 +800,7 @@ NewObjectA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewObjectA(clazz,methodID,args);
-#else
RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1057,11 +812,7 @@ GetObjectClass(obj)
jobject obj
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetObjectClass(obj);
-#else
RETVAL = (*env)->GetObjectClass(env, obj);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1074,11 +825,7 @@ IsInstanceOf(obj,clazz)
jclass clazz
CODE:
{
-#ifdef WIN32
- RETVAL = env->IsInstanceOf(obj,clazz);
-#else
RETVAL = (*env)->IsInstanceOf(env, obj,clazz);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1092,11 +839,7 @@ GetMethodID(clazz,name,sig)
const char * sig
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetMethodID(clazz,name,sig);
-#else
RETVAL = (*env)->GetMethodID(env, clazz,name,sig);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1112,11 +855,7 @@ CallObjectMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallObjectMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1131,11 +870,7 @@ CallObjectMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallObjectMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1151,11 +886,7 @@ CallBooleanMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallBooleanMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1170,11 +901,7 @@ CallBooleanMethodA(obj,methodID, args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallBooleanMethodA(obj,methodID, args);
-#else
RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID, args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1190,11 +917,7 @@ CallByteMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallByteMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1209,11 +932,7 @@ CallByteMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallByteMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1229,11 +948,7 @@ CallCharMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallCharMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1248,11 +963,7 @@ CallCharMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallCharMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1268,11 +979,7 @@ CallShortMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallShortMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1287,11 +994,7 @@ CallShortMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallShortMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1307,11 +1010,7 @@ CallIntMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallIntMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1326,11 +1025,7 @@ CallIntMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallIntMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1346,11 +1041,7 @@ CallLongMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallLongMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1365,11 +1056,7 @@ CallLongMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallLongMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1385,11 +1072,7 @@ CallFloatMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallFloatMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1404,11 +1087,7 @@ CallFloatMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallFloatMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1424,11 +1103,7 @@ CallDoubleMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallDoubleMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1443,11 +1118,7 @@ CallDoubleMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallDoubleMethodA(obj,methodID,args);
-#else
RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1463,11 +1134,7 @@ CallVoidMethod(obj,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- env->CallVoidMethodA(obj,methodID,args);
-#else
(*env)->CallVoidMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
@@ -1480,11 +1147,7 @@ CallVoidMethodA(obj,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- env->CallVoidMethodA(obj,methodID,args);
-#else
(*env)->CallVoidMethodA(env, obj,methodID,args);
-#endif
RESTOREENV;
}
@@ -1499,11 +1162,7 @@ CallNonvirtualObjectMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualObjectMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1519,11 +1178,7 @@ CallNonvirtualObjectMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualObjectMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1540,11 +1195,7 @@ CallNonvirtualBooleanMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualBooleanMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1560,11 +1211,7 @@ CallNonvirtualBooleanMethodA(obj,clazz,methodID, args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualBooleanMethodA(obj,clazz,methodID, args);
-#else
RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID, args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1581,11 +1228,7 @@ CallNonvirtualByteMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualByteMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1601,11 +1244,7 @@ CallNonvirtualByteMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualByteMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1622,11 +1261,7 @@ CallNonvirtualCharMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualCharMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1642,11 +1277,7 @@ CallNonvirtualCharMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualCharMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1663,11 +1294,7 @@ CallNonvirtualShortMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualShortMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1683,11 +1310,7 @@ CallNonvirtualShortMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualShortMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1704,11 +1327,7 @@ CallNonvirtualIntMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualIntMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1724,11 +1343,7 @@ CallNonvirtualIntMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualIntMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1745,11 +1360,7 @@ CallNonvirtualLongMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualLongMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1765,11 +1376,7 @@ CallNonvirtualLongMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualLongMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1786,11 +1393,7 @@ CallNonvirtualFloatMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualFloatMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1806,11 +1409,7 @@ CallNonvirtualFloatMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualFloatMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1827,11 +1426,7 @@ CallNonvirtualDoubleMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallNonvirtualDoubleMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1847,11 +1442,7 @@ CallNonvirtualDoubleMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallNonvirtualDoubleMethodA(obj,clazz,methodID,args);
-#else
RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1868,11 +1459,7 @@ CallNonvirtualVoidMethod(obj,clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- env->CallNonvirtualVoidMethodA(obj,clazz,methodID,args);
-#else
(*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
@@ -1886,11 +1473,7 @@ CallNonvirtualVoidMethodA(obj,clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- env->CallNonvirtualVoidMethodA(obj,clazz,methodID,args);
-#else
(*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
-#endif
RESTOREENV;
}
@@ -1902,11 +1485,7 @@ GetFieldID(clazz,name,sig)
const char * sig
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetFieldID(clazz,name,sig);
-#else
RETVAL = (*env)->GetFieldID(env, clazz,name,sig);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1920,11 +1499,7 @@ GetObjectField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetObjectField(obj,fieldID);
-#else
RETVAL = (*env)->GetObjectField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1938,11 +1513,7 @@ GetBooleanField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetBooleanField(obj,fieldID);
-#else
RETVAL = (*env)->GetBooleanField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1956,11 +1527,7 @@ GetByteField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetByteField(obj,fieldID);
-#else
RETVAL = (*env)->GetByteField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1974,11 +1541,7 @@ GetCharField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetCharField(obj,fieldID);
-#else
RETVAL = (*env)->GetCharField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -1992,11 +1555,7 @@ GetShortField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetShortField(obj,fieldID);
-#else
RETVAL = (*env)->GetShortField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2010,11 +1569,7 @@ GetIntField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetIntField(obj,fieldID);
-#else
RETVAL = (*env)->GetIntField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2028,11 +1583,7 @@ GetLongField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetLongField(obj,fieldID);
-#else
RETVAL = (*env)->GetLongField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2046,11 +1597,7 @@ GetFloatField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetFloatField(obj,fieldID);
-#else
RETVAL = (*env)->GetFloatField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2064,11 +1611,7 @@ GetDoubleField(obj,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetDoubleField(obj,fieldID);
-#else
RETVAL = (*env)->GetDoubleField(env, obj,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2083,11 +1626,7 @@ SetObjectField(obj,fieldID,val)
jobject val
CODE:
{
-#ifdef WIN32
- env->SetObjectField(obj,fieldID,val);
-#else
(*env)->SetObjectField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2100,11 +1639,7 @@ SetBooleanField(obj,fieldID,val)
jboolean val
CODE:
{
-#ifdef WIN32
- env->SetBooleanField(obj,fieldID,val);
-#else
(*env)->SetBooleanField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2117,11 +1652,7 @@ SetByteField(obj,fieldID,val)
jbyte val
CODE:
{
-#ifdef WIN32
- env->SetByteField(obj,fieldID,val);
-#else
(*env)->SetByteField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2134,11 +1665,7 @@ SetCharField(obj,fieldID,val)
jchar val
CODE:
{
-#ifdef WIN32
- env->SetCharField(obj,fieldID,val);
-#else
(*env)->SetCharField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2151,11 +1678,7 @@ SetShortField(obj,fieldID,val)
jshort val
CODE:
{
-#ifdef WIN32
- env->SetShortField(obj,fieldID,val);
-#else
(*env)->SetShortField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2168,11 +1691,7 @@ SetIntField(obj,fieldID,val)
jint val
CODE:
{
-#ifdef WIN32
- env->SetIntField(obj,fieldID,val);
-#else
(*env)->SetIntField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2185,11 +1704,7 @@ SetLongField(obj,fieldID,val)
jlong val
CODE:
{
-#ifdef WIN32
- env->SetLongField(obj,fieldID,val);
-#else
(*env)->SetLongField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2202,11 +1717,7 @@ SetFloatField(obj,fieldID,val)
jfloat val
CODE:
{
-#ifdef WIN32
- env->SetFloatField(obj,fieldID,val);
-#else
(*env)->SetFloatField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2219,11 +1730,7 @@ SetDoubleField(obj,fieldID,val)
jdouble val
CODE:
{
-#ifdef WIN32
- env->SetDoubleField(obj,fieldID,val);
-#else
(*env)->SetDoubleField(env, obj,fieldID,val);
-#endif
RESTOREENV;
}
@@ -2235,11 +1742,7 @@ GetStaticMethodID(clazz,name,sig)
const char * sig
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticMethodID(clazz,name,sig);
-#else
RETVAL = (*env)->GetStaticMethodID(env, clazz,name,sig);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2255,11 +1758,7 @@ CallStaticObjectMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticObjectMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2274,11 +1773,7 @@ CallStaticObjectMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticObjectMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2294,11 +1789,7 @@ CallStaticBooleanMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticBooleanMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2313,11 +1804,7 @@ CallStaticBooleanMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticBooleanMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2333,11 +1820,7 @@ CallStaticByteMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticByteMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2352,11 +1835,7 @@ CallStaticByteMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticByteMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2372,11 +1851,7 @@ CallStaticCharMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticCharMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2391,11 +1866,7 @@ CallStaticCharMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticCharMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2411,11 +1882,7 @@ CallStaticShortMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticShortMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2430,11 +1897,7 @@ CallStaticShortMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticShortMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2450,11 +1913,7 @@ CallStaticIntMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticIntMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2469,11 +1928,7 @@ CallStaticIntMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticIntMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2489,11 +1944,7 @@ CallStaticLongMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticLongMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2508,11 +1959,7 @@ CallStaticLongMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticLongMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2528,11 +1975,7 @@ CallStaticFloatMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticFloatMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2547,11 +1990,7 @@ CallStaticFloatMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticFloatMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2567,11 +2006,7 @@ CallStaticDoubleMethod(clazz,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- RETVAL = env->CallStaticDoubleMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2586,11 +2021,7 @@ CallStaticDoubleMethodA(clazz,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- RETVAL = env->CallStaticDoubleMethodA(clazz,methodID,args);
-#else
RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2606,11 +2037,7 @@ CallStaticVoidMethod(cls,methodID,...)
CODE:
{
jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
-#ifdef WIN32
- env->CallStaticVoidMethodA(cls,methodID,args);
-#else
(*env)->CallStaticVoidMethodA(env, cls,methodID,args);
-#endif
RESTOREENV;
}
@@ -2623,11 +2050,7 @@ CallStaticVoidMethodA(cls,methodID,args)
jvalue * args
CODE:
{
-#ifdef WIN32
- env->CallStaticVoidMethodA(cls,methodID,args);
-#else
(*env)->CallStaticVoidMethodA(env, cls,methodID,args);
-#endif
RESTOREENV;
}
@@ -2639,11 +2062,7 @@ GetStaticFieldID(clazz,name,sig)
const char * sig
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticFieldID(clazz,name,sig);
-#else
RETVAL = (*env)->GetStaticFieldID(env, clazz,name,sig);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2657,11 +2076,7 @@ GetStaticObjectField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticObjectField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticObjectField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2675,11 +2090,7 @@ GetStaticBooleanField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticBooleanField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticBooleanField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2693,11 +2104,7 @@ GetStaticByteField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticByteField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticByteField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2711,11 +2118,7 @@ GetStaticCharField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticCharField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticCharField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2729,11 +2132,7 @@ GetStaticShortField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticShortField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticShortField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2747,11 +2146,7 @@ GetStaticIntField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticIntField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticIntField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2765,11 +2160,7 @@ GetStaticLongField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticLongField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticLongField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2783,11 +2174,7 @@ GetStaticFloatField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticFloatField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticFloatField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2801,11 +2188,7 @@ GetStaticDoubleField(clazz,fieldID)
char * sig = 0;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStaticDoubleField(clazz,fieldID);
-#else
RETVAL = (*env)->GetStaticDoubleField(env, clazz,fieldID);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2820,11 +2203,7 @@ SetStaticObjectField(clazz,fieldID,value)
jobject value
CODE:
{
-#ifdef WIN32
- env->SetStaticObjectField(clazz,fieldID,value);
-#else
(*env)->SetStaticObjectField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2837,11 +2216,7 @@ SetStaticBooleanField(clazz,fieldID,value)
jboolean value
CODE:
{
-#ifdef WIN32
- env->SetStaticBooleanField(clazz,fieldID,value);
-#else
(*env)->SetStaticBooleanField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2854,11 +2229,7 @@ SetStaticByteField(clazz,fieldID,value)
jbyte value
CODE:
{
-#ifdef WIN32
- env->SetStaticByteField(clazz,fieldID,value);
-#else
(*env)->SetStaticByteField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2871,11 +2242,7 @@ SetStaticCharField(clazz,fieldID,value)
jchar value
CODE:
{
-#ifdef WIN32
- env->SetStaticCharField(clazz,fieldID,value);
-#else
(*env)->SetStaticCharField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2888,11 +2255,7 @@ SetStaticShortField(clazz,fieldID,value)
jshort value
CODE:
{
-#ifdef WIN32
- env->SetStaticShortField(clazz,fieldID,value);
-#else
(*env)->SetStaticShortField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2905,11 +2268,7 @@ SetStaticIntField(clazz,fieldID,value)
jint value
CODE:
{
-#ifdef WIN32
- env->SetStaticIntField(clazz,fieldID,value);
-#else
(*env)->SetStaticIntField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2922,11 +2281,7 @@ SetStaticLongField(clazz,fieldID,value)
jlong value
CODE:
{
-#ifdef WIN32
- env->SetStaticLongField(clazz,fieldID,value);
-#else
(*env)->SetStaticLongField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2939,11 +2294,7 @@ SetStaticFloatField(clazz,fieldID,value)
jfloat value
CODE:
{
-#ifdef WIN32
- env->SetStaticFloatField(clazz,fieldID,value);
-#else
(*env)->SetStaticFloatField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2956,11 +2307,7 @@ SetStaticDoubleField(clazz,fieldID,value)
jdouble value
CODE:
{
-#ifdef WIN32
- env->SetStaticDoubleField(clazz,fieldID,value);
-#else
(*env)->SetStaticDoubleField(env, clazz,fieldID,value);
-#endif
RESTOREENV;
}
@@ -2972,11 +2319,7 @@ NewString(unicode)
const jchar * unicode
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewString(unicode, unicode_len_);
-#else
RETVAL = (*env)->NewString(env, unicode, unicode_len_);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -2988,11 +2331,7 @@ GetStringLength(str)
jstring str
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStringLength(str);
-#else
RETVAL = (*env)->GetStringLength(env, str);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3006,26 +2345,14 @@ GetStringChars(str)
jsize RETVAL_len_ = NO_INIT;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStringChars(str,&isCopy);
-#else
RETVAL = (*env)->GetStringChars(env, str,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetStringLength(str);
-#else
RETVAL_len_ = (*env)->GetStringLength(env, str);
-#endif
RESTOREENV;
}
OUTPUT:
RETVAL
CLEANUP:
-#ifdef WIN32
- env->ReleaseStringChars(str,RETVAL);
-#else
(*env)->ReleaseStringChars(env, str,RETVAL);
-#endif
jstring
NewStringUTF(utf)
@@ -3033,11 +2360,7 @@ NewStringUTF(utf)
const char * utf
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewStringUTF(utf);
-#else
RETVAL = (*env)->NewStringUTF(env, utf);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3049,11 +2372,7 @@ GetStringUTFLength(str)
jstring str
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStringUTFLength(str);
-#else
RETVAL = (*env)->GetStringUTFLength(env, str);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3066,21 +2385,13 @@ GetStringUTFChars(str)
jboolean isCopy = NO_INIT;
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetStringUTFChars(str,&isCopy);
-#else
RETVAL = (*env)->GetStringUTFChars(env, str,&isCopy);
-#endif
RESTOREENV;
}
OUTPUT:
RETVAL
CLEANUP:
-#ifdef WIN32
- env->ReleaseStringUTFChars(str, RETVAL);
-#else
(*env)->ReleaseStringUTFChars(env, str, RETVAL);
-#endif
jsize
@@ -3089,11 +2400,7 @@ GetArrayLength(array)
jarray array
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetArrayLength(array);
-#else
RETVAL = (*env)->GetArrayLength(env, array);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3107,11 +2414,7 @@ NewObjectArray(len,clazz,init)
jobject init
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewObjectArray(len,clazz,init);
-#else
RETVAL = (*env)->NewObjectArray(env, len,clazz,init);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3124,11 +2427,7 @@ GetObjectArrayElement(array,index)
jsize index
CODE:
{
-#ifdef WIN32
- RETVAL = env->GetObjectArrayElement(array,index);
-#else
RETVAL = (*env)->GetObjectArrayElement(env, array,index);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3142,11 +2441,7 @@ SetObjectArrayElement(array,index,val)
jobject val
CODE:
{
-#ifdef WIN32
- env->SetObjectArrayElement(array,index,val);
-#else
(*env)->SetObjectArrayElement(env, array,index,val);
-#endif
RESTOREENV;
}
@@ -3156,11 +2451,7 @@ NewBooleanArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewBooleanArray(len);
-#else
RETVAL = (*env)->NewBooleanArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3172,11 +2463,7 @@ NewByteArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewByteArray(len);
-#else
RETVAL = (*env)->NewByteArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3188,11 +2475,7 @@ NewCharArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewCharArray(len);
-#else
RETVAL = (*env)->NewCharArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3204,11 +2487,7 @@ NewShortArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewShortArray(len);
-#else
RETVAL = (*env)->NewShortArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3220,11 +2499,7 @@ NewIntArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewIntArray(len);
-#else
RETVAL = (*env)->NewIntArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3236,11 +2511,7 @@ NewLongArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewLongArray(len);
-#else
RETVAL = (*env)->NewLongArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3252,11 +2523,7 @@ NewFloatArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewFloatArray(len);
-#else
RETVAL = (*env)->NewFloatArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3268,11 +2535,7 @@ NewDoubleArray(len)
jsize len
CODE:
{
-#ifdef WIN32
- RETVAL = env->NewDoubleArray(len);
-#else
RETVAL = (*env)->NewDoubleArray(env, len);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -3286,16 +2549,8 @@ GetBooleanArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetBooleanArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetBooleanArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jboolean* r = RETVAL;
@@ -3312,11 +2567,7 @@ GetBooleanArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseBooleanArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3328,16 +2579,8 @@ GetByteArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetByteArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetByteArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jbyte* r = RETVAL;
@@ -3354,11 +2597,7 @@ GetByteArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseByteArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3370,16 +2609,8 @@ GetCharArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetCharArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetCharArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jchar* r = RETVAL;
@@ -3396,11 +2627,7 @@ GetCharArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseCharArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3412,16 +2639,8 @@ GetShortArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetShortArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetShortArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jshort* r = RETVAL;
@@ -3438,11 +2657,7 @@ GetShortArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseShortArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3454,16 +2669,8 @@ GetIntArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetIntArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetIntArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jint* r = RETVAL;
@@ -3480,11 +2687,7 @@ GetIntArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseIntArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3496,16 +2699,8 @@ GetLongArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetLongArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetLongArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jlong* r = RETVAL;
@@ -3522,11 +2717,7 @@ GetLongArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseLongArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3538,16 +2729,8 @@ GetFloatArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetFloatArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetFloatArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jfloat* r = RETVAL;
@@ -3564,11 +2747,7 @@ GetFloatArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseFloatArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3580,16 +2759,8 @@ GetDoubleArrayElements(array)
jboolean isCopy = NO_INIT;
PPCODE:
{
-#ifdef WIN32
- RETVAL = env->GetDoubleArrayElements(array,&isCopy);
-#else
RETVAL = (*env)->GetDoubleArrayElements(env, array,&isCopy);
-#endif
-#ifdef WIN32
- RETVAL_len_ = env->GetArrayLength(array);
-#else
RETVAL_len_ = (*env)->GetArrayLength(env, array);
-#endif
if (GIMME == G_ARRAY) {
int i;
jdouble* r = RETVAL;
@@ -3606,11 +2777,7 @@ GetDoubleArrayElements(array)
else
PUSHs(&PL_sv_no);
}
-#ifdef WIN32
- env->ReleaseDoubleArrayElements(array,RETVAL,JNI_ABORT);
-#else
(*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);
-#endif
RESTOREENV;
}
@@ -3625,11 +2792,7 @@ GetBooleanArrayRegion(array,start,len,buf)
jboolean * buf = (jboolean*)sv_grow(ST(3),len * sizeof(jboolean)+1);
CODE:
{
-#ifdef WIN32
- env->GetBooleanArrayRegion(array,start,len,buf);
-#else
(*env)->GetBooleanArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jboolean));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3646,11 +2809,7 @@ GetByteArrayRegion(array,start,len,buf)
jbyte * buf = (jbyte*)sv_grow(ST(3),len * sizeof(jbyte)+1);
CODE:
{
-#ifdef WIN32
- env->GetByteArrayRegion(array,start,len,buf);
-#else
(*env)->GetByteArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jbyte));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3667,11 +2826,7 @@ GetCharArrayRegion(array,start,len,buf)
jchar * buf = (jchar*)sv_grow(ST(3),len * sizeof(jchar)+1);
CODE:
{
-#ifdef WIN32
- env->GetCharArrayRegion(array,start,len,buf);
-#else
(*env)->GetCharArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jchar));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3688,11 +2843,7 @@ GetShortArrayRegion(array,start,len,buf)
jshort * buf = (jshort*)sv_grow(ST(3),len * sizeof(jshort)+1);
CODE:
{
-#ifdef WIN32
- env->GetShortArrayRegion(array,start,len,buf);
-#else
(*env)->GetShortArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jshort));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3709,11 +2860,7 @@ GetIntArrayRegion(array,start,len,buf)
jint * buf = (jint*)sv_grow(ST(3),len * sizeof(jint)+1);
CODE:
{
-#ifdef WIN32
- env->GetIntArrayRegion(array,start,len,buf);
-#else
(*env)->GetIntArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jint));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3730,11 +2877,7 @@ GetLongArrayRegion(array,start,len,buf)
jlong * buf = (jlong*)sv_grow(ST(3),len * sizeof(jlong)+1);
CODE:
{
-#ifdef WIN32
- env->GetLongArrayRegion(array,start,len,buf);
-#else
(*env)->GetLongArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jlong));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3751,11 +2894,7 @@ GetFloatArrayRegion(array,start,len,buf)
jfloat * buf = (jfloat*)sv_grow(ST(3),len * sizeof(jfloat)+1);
CODE:
{
-#ifdef WIN32
- env->GetFloatArrayRegion(array,start,len,buf);
-#else
(*env)->GetFloatArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jfloat));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3772,11 +2911,7 @@ GetDoubleArrayRegion(array,start,len,buf)
jdouble * buf = (jdouble*)sv_grow(ST(3),len * sizeof(jdouble)+1);
CODE:
{
-#ifdef WIN32
- env->GetDoubleArrayRegion(array,start,len,buf);
-#else
(*env)->GetDoubleArrayRegion(env, array,start,len,buf);
-#endif
SvCUR_set(ST(3), len * sizeof(jdouble));
*SvEND(ST(3)) = '\0';
RESTOREENV;
@@ -3797,11 +2932,7 @@ SetBooleanArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetBooleanArrayRegion(array,start,len,buf);
-#else
(*env)->SetBooleanArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3820,11 +2951,7 @@ SetByteArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetByteArrayRegion(array,start,len,buf);
-#else
(*env)->SetByteArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3843,11 +2970,7 @@ SetCharArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetCharArrayRegion(array,start,len,buf);
-#else
(*env)->SetCharArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3866,11 +2989,7 @@ SetShortArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetShortArrayRegion(array,start,len,buf);
-#else
(*env)->SetShortArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3889,11 +3008,7 @@ SetIntArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetIntArrayRegion(array,start,len,buf);
-#else
(*env)->SetIntArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3912,11 +3027,7 @@ SetLongArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetLongArrayRegion(array,start,len,buf);
-#else
(*env)->SetLongArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3935,11 +3046,7 @@ SetFloatArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetFloatArrayRegion(array,start,len,buf);
-#else
(*env)->SetFloatArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3958,11 +3065,7 @@ SetDoubleArrayRegion(array,start,len,buf)
croak("string is too short");
else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
-#ifdef WIN32
- env->SetDoubleArrayRegion(array,start,len,buf);
-#else
(*env)->SetDoubleArrayRegion(env, array,start,len,buf);
-#endif
RESTOREENV;
}
@@ -3974,11 +3077,7 @@ RegisterNatives(clazz,methods,nMethods)
jint nMethods
CODE:
{
-#ifdef WIN32
- RETVAL = env->RegisterNatives(clazz,methods,nMethods);
-#else
RETVAL = (*env)->RegisterNatives(env, clazz,methods,nMethods);
-#endif
}
SysRet
@@ -3987,11 +3086,7 @@ UnregisterNatives(clazz)
jclass clazz
CODE:
{
-#ifdef WIN32
- RETVAL = env->UnregisterNatives(clazz);
-#else
RETVAL = (*env)->UnregisterNatives(env, clazz);
-#endif
}
OUTPUT:
RETVAL
@@ -4002,11 +3097,7 @@ MonitorEnter(obj)
jobject obj
CODE:
{
-#ifdef WIN32
- RETVAL = env->MonitorEnter(obj);
-#else
RETVAL = (*env)->MonitorEnter(env, obj);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -4018,11 +3109,7 @@ MonitorExit(obj)
jobject obj
CODE:
{
-#ifdef WIN32
- RETVAL = env->MonitorExit(obj);
-#else
RETVAL = (*env)->MonitorExit(env, obj);
-#endif
RESTOREENV;
}
OUTPUT:
@@ -4033,12 +3120,13 @@ GetJavaVM(...)
JNIEnv * env = FETCHENV;
CODE:
{
- if (env) { /* We're embedded. */
-#ifdef WIN32
- if (env->GetJavaVM(&RETVAL) < 0)
+#ifdef JPL_DEBUG
+ jpldebug = 1;
#else
- if ((*env)->GetJavaVM(env, &RETVAL) < 0)
+ jpldebug = 0;
#endif
+ if (env) { /* We're embedded. */
+ if ((*env)->GetJavaVM(env, &RETVAL) < 0)
RETVAL = 0;
}
else { /* We're embedding. */
@@ -4053,7 +3141,7 @@ GetJavaVM(...)
}
if (items--) {
- ++mark;
+ ++mark;
lib = SvPV(*mark, PL_na);
}
else
@@ -4062,10 +3150,14 @@ GetJavaVM(...)
fprintf(stderr, "lib is %s.\n", lib);
}
#ifdef WIN32
- if (!LoadLibrary("javai.dll")) {
- if (lib && !LoadLibrary(lib))
- croak("Can't load javai.dll");
- }
+ if (LoadLibrary("jvm.dll")) {
+ if (!LoadLibrary("javai.dll")) {
+ warn("Can't load javai.dll");
+ }
+ } else {
+ if (lib && !LoadLibrary(lib))
+ croak("Can't load javai.dll");
+ }
#else
if (jpldebug) {
fprintf(stderr, "Opening Java shared library.\n");
@@ -4079,16 +3171,20 @@ GetJavaVM(...)
croak("Can't load Java shared library.");
}
#endif
-
+ /* Kaffe seems to get very upset if vm_args.version isn't set */
+#ifdef KAFFE
+ vm_args.version = JNI_VERSION_1_1;
+#endif
JNI_GetDefaultJavaVMInitArgs(&vm_args);
vm_args.exit = &call_my_exit;
if (jpldebug) {
fprintf(stderr, "items = %d\n", items);
fprintf(stderr, "mark = %s\n", SvPV(*mark, PL_na));
}
- ++mark;
while (items > 1) {
- char *s = SvPV(*mark,PL_na);
+ char *s;
+ ++mark;
+ s = SvPV(*mark,PL_na);
++mark;
if (jpldebug) {
fprintf(stderr, "*s = %s\n", s);
@@ -4115,7 +3211,20 @@ GetJavaVM(...)
vm_args.enableVerboseGC = (jint)SvIV(*mark);
else if (strEQ(s, "disableAsyncGC"))
vm_args.disableAsyncGC = (jint)SvIV(*mark);
-#ifndef KAFFE
+#ifdef KAFFE
+ else if (strEQ(s, "libraryhome"))
+ vm_args.libraryhome = savepv(SvPV(*mark,PL_na));
+ else if (strEQ(s, "classhome"))
+ vm_args.classhome = savepv(SvPV(*mark,PL_na));
+ else if (strEQ(s, "enableVerboseJIT"))
+ vm_args.enableVerboseJIT = (jint)SvIV(*mark);
+ else if (strEQ(s, "enableVerboseClassloading"))
+ vm_args.enableVerboseClassloading = (jint)SvIV(*mark);
+ else if (strEQ(s, "enableVerboseCall"))
+ vm_args.enableVerboseCall = (jint)SvIV(*mark);
+ else if (strEQ(s, "allocHeapSize"))
+ vm_args.allocHeapSize = (jint)SvIV(*mark);
+#else
else if (strEQ(s, "verbose"))
vm_args.verbose = (jint)SvIV(*mark);
else if (strEQ(s, "debugging"))
@@ -4132,10 +3241,13 @@ GetJavaVM(...)
fprintf(stderr, "Working CLASSPATH: %s\n",
vm_args.classpath);
}
- JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args);
+ if (JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args) < 0) {
+ croak("Unable to create instance of JVM");
+ }
if (jpldebug) {
fprintf(stderr, "Created Java VM.\n");
}
+
}
}
diff --git a/jpl/JNI/Makefile.PL b/jpl/JNI/Makefile.PL
index 754bde68ed..a4865b5503 100644
--- a/jpl/JNI/Makefile.PL
+++ b/jpl/JNI/Makefile.PL
@@ -7,12 +7,28 @@ use File::Basename;
getopts('e'); # embedding?
+$CCFLAGS .= $ENV{CCFLAGS} if defined $ENV{CCFLAGS};
+
+# $USE_KAFFE is a boolean that tells us whether or not we should use Kaffe.
+# Set by find_includes (it seemed as good a place as any).
+
+# Note that we don't check to see the version of Kaffe is one we support.
+# Currently, the only one we support is the one from CVS.
+
+my $USE_KAFFE = 0;
+
#require "JNIConfig";
if ($^O eq 'solaris') {
$LIBPATH = " -R$Config{archlib}/CORE -L$Config{archlib}/CORE";
} elsif ($^O eq 'MSWin32') {
$LIBPATH = " -L$Config{archlib}\\CORE";
+ # MSR - added MS VC++ default library path
+ # bjepson - fixed to support path names w/spaces in them.
+ push(@WINLIBS, (split"\;",$ENV{LIB}));
+ grep s/\\$//, @WINLIBS; # eliminate trailing \
+ grep s/\/$//, @WINLIBS; # eliminate trailing /
+ $LIBPATH .= join(" ", "", map { qq["-L$_" ] } @WINLIBS);
} else {
$LIBPATH = " -L$Config{archlib}/CORE";
}
@@ -20,9 +36,14 @@ if ($^O eq 'solaris') {
# Figure out where Java might live
#
+# MSR - added JDK 1.3
+#
+
my @JAVA_HOME_GUESSES = qw(/usr/local/java /usr/java /usr/local/jdk117_v3
- /usr/local/lib/kaffe C:\\JDK1.1.8
- C:\\JDK1.2.1 );
+ C:\\JDK1.1.8 C:\\JDK1.2.1 C:\\JDK1.2.2 C:\\JDK1.3 );
+
+my @KAFFE_PREFIX_GUESSES = qw(/usr/local /usr);
+
if (! defined $ENV{JAVA_HOME}) {
print "You didn't define JAVA_HOME, so I'm trying a few guesses.\n";
print "If this fails, you might want to try setting JAVA_HOME and\n";
@@ -31,10 +52,39 @@ if (! defined $ENV{JAVA_HOME}) {
@JAVA_HOME_GUESSES = ( $ENV{JAVA_HOME} );
}
+if (! defined $ENV{KAFFE_PREFIX}) {
+ print "\nYou didn't define KAFFE_PREFIX, so I'm trying a few guesses.",
+ "\nIf this fails, and you are using Kaffe, you might want to try\n",
+ "setting KAFFE_PREFIX and running me again.\n",
+ "If you want to ignore any possible Kaffe installation, set the\n",
+ "KAFFE_PREFIX to and empty string.\n\n";
+} else {
+ @KAFFE_PREFIX_GUESSES = ($ENV{KAFFE_PREFIX} eq "") ? () :
+ ( $ENV{KAFFE_PREFIX} );
+}
+
+my(@KAFFE_INCLUDE_GUESSES, @KAFFE_LIB_GUESSES);
+foreach my $kaffePrefix (@KAFFE_PREFIX_GUESSES) {
+ push(@KAFFE_INCLUDE_GUESSES, "$kaffePrefix/include/kaffe");
+ push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib");
+ push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib/kaffe");
+}
+ $guess .= "/include/kaffe";
+
# Let's find out where jni.h lives
#
my @INCLUDE = find_includes();
-$INC = join(" -I", ("", @INCLUDE));
+
+if ($^O eq 'MSWin32') {
+ # MSR - added MS VC++ default include path
+ push(@INCLUDE,(split"\;",$ENV{INCLUDE}));
+ grep s/\\$//, @INCLUDE; # remove trailing \
+ grep s/\/$//, @INCLUDE; # remove trailing \
+ $INC = join("", map { qq["-I$_" ] } @INCLUDE);
+
+} else {
+ $INC = join(" -I", ("", @INCLUDE));
+}
# Let's find out the name of the Java shared library
#
@@ -43,20 +93,21 @@ my @JAVALIBS = find_libs();
# Find out some defines based on the library we are linking to
#
foreach (@JAVALIBS) {
- if ( /javai.lib$/ or /jvm.lib$/) { # We're on Win32
+ if ( $^O eq 'MSWin32') { # We're on Win32
$INC =~ s#/#\\#g;
$INC =~ s#\\$##;
- $CCFLAGS .= "-DWIN32 -Z7 -D_DEBUG";
- $MYEXTLIB = $libjava;
- } elsif (/libkaffevm.so$/) {
- $CCFLAGS .= "-DKAFFE";
- }
+ print $INC, "\n";
+ $CCFLAGS .= " -DWIN32 -Z7 -D_DEBUG";
+ $MYEXTLIB = "$libjava";
+ }
}
+$CCFLAGS .= " -DKAFFE" if ($USE_KAFFE);
+
# Let's find out the path of the library we need to link against.
#
foreach (@JAVALIBS) {
- if ( /javai.lib$/ or /jvm.lib$/) { # We're on Win32
+ if ($^O eq 'MSWin32') { # We're on Win32
$_ =~ s#/#\\\\#g;
}
my ($libname, $libpath, $libsuffix) = fileparse($_, ("\.so", "\.lib"));
@@ -89,6 +140,37 @@ if ($^O eq 'solaris') {
$CCFLAGS .= " -D_REENTRANT";
}
+# MSR - clean up LIBS
+$LIBS =~ s/-l$//;
+
+#
+# Next, build JNI/Config.pm. This is a superfluous thing for the SUN and
+# Microsoft JDKs, but absolutely necessary for Kaffe. I think at some
+# point, the Microsoft and SUN implementations should use JNI::Config, too.
+#
+
+if (! -d "JNI") {
+ mkdir("JNI", 0755) || die "Unable to make JNI directory: $!";
+}
+open(JNICONFIG, ">JNI/Config.pm") || die "Unable to open JNI/Config.pm: $!";
+
+print JNICONFIG "# DO NOT EDIT! Autogenerated by JNI/Makefile.PL\n\n",
+ "package JNI::Config;\nuse strict;\nuse Carp;\n",
+ "\nuse vars qw(\$KAFFE \$LIB_JAVA \$CLASS_HOME ",
+ "\$LIB_HOME);\n\n",
+ "\$KAFFE = $USE_KAFFE;\n\$LIB_JAVA = \"$JAVALIBS[0]\";\n";
+if ($USE_KAFFE) {
+ my $path = $JAVALIBS[0];
+ $path =~ s%/(kaffe/)?libkaffevm.so$%%;
+
+ print JNICONFIG "\$LIB_HOME = \"$path/kaffe\";\n";
+ $path =~ s%/lib%%;
+ print JNICONFIG "\$CLASS_HOME = \"$path/share/kaffe\";\n";
+}
+print JNICONFIG "\n\n1;\n";
+close JNICONFIG;
+
+
my %Makefile = (
NAME => 'JNI',
VERSION_FROM => 'JNI.pm',
@@ -97,6 +179,8 @@ my %Makefile = (
INC => $INC,
CCFLAGS => "$Config{ccflags} $CCFLAGS",
($Config{archname} =~ /mswin32.*-object/i ? ('CAPI' => 'TRUE') : ()),
+
+ clean => {FILES => "JNI/* JNI"}
);
$Makefile{LIBS} = ["$LIBPATH $LIBS"];
@@ -109,18 +193,25 @@ if ($MYEXTLIB) {
#
WriteMakefile(%Makefile);
+if ($USE_KAFFE) {
+ my $path = $JAVALIBS[0];
+ $path =~ s%/libkaffevm.so$%%;
+ print "\n\n***NOTE: be sure to have:\n",
+ " LD_LIBRARY_PATH=$path\n",
+ " in your enviornment (or installed as a system dynamic\n",
+ " library location) when you compile and run this.\n";
+}
+
# subroutine to find a library
#
sub find_stuff {
my ($candidates, $locations) = @_;
-
- my ($pos,$lib);
+ my $lib;
$wanted = sub {
foreach my $name (@$candidates) {
- $pos = $File::Find::name;
- if (/$name$/ && $pos !~ /green_threads/ && $pos !~ /include-old/) {
- $lib = $pos;
+ if (/$name$/ and ! /green_threads/ and !/include-old/) {
+ $lib = $File::Find::name;
}
}
};
@@ -140,51 +231,67 @@ sub find_stuff {
# Extra lib for Java 1.2
#
+# if we want KAFFE, check for it, otherwise search for Java
+
sub find_libs {
+ my($libjava, $libawt, $libjvm);
- my $libjava = find_stuff(['libjava.so', 'libkaffevm.so', 'javai.lib', 'jvm.lib'],
- \@JAVA_HOME_GUESSES);
- my $libjvm = find_stuff(['libjvm.so'], \@JAVA_HOME_GUESSES);
- if ($libjvm) { # JDK 1.2
- my $libhpi = find_stuff(['libhpi.so'], \@JAVA_HOME_GUESSES);
- my $libawt = find_stuff(['libawt.so'], \@JAVA_HOME_GUESSES);
- return($libjava, $libjvm, $libhpi, $libawt);
- } else {
- return($libjava);
+ if ($USE_KAFFE) {
+ $libjava = find_stuff(['libkaffevm.so'], \@KAFFE_LIB_GUESSES);
+ $libawt = find_stuff(['libawt.so'], \@KAFFE_LIB_GUESSES);
+ } else {
+ $libjava = find_stuff(['libjava.so', 'javai.lib', 'jvm.lib'],
+ \@JAVA_HOME_GUESSES);
+ $libjvm = find_stuff(['libjvm.so'], \@JAVA_HOME_GUESSES);
+ $libawt = find_stuff(['libawt.so'], \@JAVA_HOME_GUESSES);
+ if (defined $libjvm) { # JDK 1.2
+ my $libhpi = find_stuff(['libhpi.so'], \@JAVA_HOME_GUESSES);
+ return($libjava, $libjvm, $libhpi, $libawt);
}
-
+ }
+ return($libjava, $libawt);
}
# We need to find jni.h and jni_md.h
#
+
+# Always do find_includes as the first operation, as it has the side effect
+# of deciding whether or not we are looking for Kaffe. --bkuhn
+
sub find_includes {
- my @CANDIDATES = qw(jni.h jni_md.h);
- my @includes;
-
- sub find_inc {
- foreach my $name (@CANDIDATES) {
- if (/$name$/) {
- my ($hname, $hpath, $hsuffix) =
- fileparse($File::Find::name, ("\.h", "\.H"));
- unless ($hpath =~ /include-old/) {
- print "Found $hname$hsuffix in $hpath\n";
- push @includes, $hpath;
- }
- }
- }
+ my @CANDIDATES = qw(jni.h jni_md.h);
+ my @includes;
+
+ sub find_inc {
+ foreach my $name (@CANDIDATES) {
+ if (/$name$/) {
+ my ($hname, $hpath, $hsuffix) =
+ fileparse($File::Find::name, ("\.h", "\.H"));
+ unless ($hpath =~ /include-old/) {
+ print "Found $hname$hsuffix in $hpath\n";
+ push @includes, $hpath;
+ }
+ }
}
+ }
- use File::Find;
+ use File::Find;
+ foreach my $guess (@KAFFE_INCLUDE_GUESSES) {
+ next unless -d $guess;
+ find (\&find_inc, $guess);
+ }
+ # If we have found includes, then we are using Kaffe.
+ if (@includes > 0) {
+ $USE_KAFFE = 1;
+ } else {
foreach my $guess (@JAVA_HOME_GUESSES) {
- next unless -d $guess;
- find (\&find_inc, $guess);
+ next unless -d $guess;
+ find (\&find_inc, $guess);
}
- if (! @includes) {
- die "Could not find Java includes!";
- } else {
- print join("\n", @includes), "\n";
- }
- return @includes;
+ }
+ die "Could not find Java includes!" unless (@includes);
+
+ return @includes;
}
diff --git a/jpl/PerlInterpreter/PerlInterpreter.h b/jpl/PerlInterpreter/PerlInterpreter.h
index 22fdf526dc..95e80505a9 100644
--- a/jpl/PerlInterpreter/PerlInterpreter.h
+++ b/jpl/PerlInterpreter/PerlInterpreter.h
@@ -7,6 +7,7 @@
#ifdef __cplusplus
extern "C" {
#endif
+/* Inaccessible static: initted */
/*
* Class: PerlInterpreter
* Method: init
diff --git a/jpl/README b/jpl/README
index 66da2ec5a0..23405a76ea 100644
--- a/jpl/README
+++ b/jpl/README
@@ -9,18 +9,20 @@ from the network. Don't expect not to be surprised occasionally.
Requirements
------------
-Under Solaris and Linux (and other Unix-like systems), Perl 5.005 (or later)
-must be compiled and installed as a shared library (libperl.so). I had to use
-the system's malloc. JPL was originally built and tested with 5.004_04 and
-early Java 1.1 development kits. This version has not been well tested under
-other versions, so you can expect some rough edges.
+Under Solaris and GNU/Linux (and other Unix-like systems), Perl 5.005 (or
+later) must be compiled and installed as a shared library (libperl.so). I
+had to use the system's malloc. JPL was originally built and tested with
+5.004_04 and early Java 1.1 development kits. This version has not been
+well tested under other versions, so you can expect some rough edges.
-You need JDK 1.1. On Solaris, 1.1.5 has been verified to work. Linux
+You need JDK 1.1. On Solaris, 1.1.5 has been verified to work. GNU/Linux
users can try the latest version (1.1.3 or later) available from (for
example):
ftp://ftp.blackdown.org/pub/Linux/JDK/1.1.3/updates/libjava-1.1.3v2-1.tar.gz
+(GNU/Linux users can also try Kaffe (see below).)
+
The get_jdk directory contains a script that will download JDK (but not
the patch file above) off of the net for you. (This presumes you've
already installed the modules mentioned in ../README.)
@@ -40,9 +42,20 @@ with JDK 1.2 (aka Java 2) or any Microsoft implementation of Java.
Kaffe
-----
-You might notice some mention of Kaffe (www.kaffe.org) in the source files.
-This is because some preliminary work is being done in this area, but JPL
-doesn't yet work with Kaffe.
+You might notice some mention of Kaffe (www.kaffe.org) in the source files.
+This is because support has been added for Kaffe for JNI:: and JPL::. In
+other words, you can now call to Java from Perl using Kaffe.
+
+You'll likely need the a checkout circa 2000-12-03 or later from Kaffe's
+CVS. It has been verified that Kaffe 1.0.5 definitely *will not work*.
+Kaffe 1.0.6 might work, but the CVS tree definitely works (as of
+2000-12-06).
+
+You can get the CVS tree from:
+
+cvs -z3 -d ':pserver:readonly@cvs.kaffe.org:/cvs/kaffe' checkout kaffe
+
+(password is 'readonly')
What the heck is JPL?
---------------------
@@ -85,11 +98,12 @@ The second way lets you embed Java in Perl, but doesn't provide support
for the other direction. This is good, in theory, if you need to work with
a lot of Java classes from within Perl. I say "in theory," because this
doesn't actually work a lot of the time. To use this second way, you
-must be using a JDK with native threads.
+must be using a JDK with native threads. Please see README.JUST-JNI for
+details.
At this point, the second way is the only way to use JPL under Microsoft
-Windows. Oddly enough, this is the only platform under which the second
-way works!
+Windows, and probably the only way to use JPL if you're using a version
+of Perl compiled by someone else (such as the Perl that comes with RedHat).
Installation the First Way (All of JPL)
---------------------------------------
@@ -131,85 +145,6 @@ builds Sample.jpl:
it will abort when it tries to run 'perl -c' on the generated .pl
file. However, you can continue building by typing 'make' again.
-Just-JNI (call into Java from Perl only)
-----------------------------------------
-
-This has been tested with:
-
- Debian 2.1 SPARC, Perl 5.005_60, JDK 1.2 beta (crashes with AWT, though)
- Windows NT 4.0 SP4, ActivePerl 519, JDK 1.1.8, Visual C++
- Solaris 7, Perl 5.005_03, JDK 1.1.6, GCC 2.8.1
-
-Solaris 7 Note (this probably applies to all native thread situations):
-
- Native threads were tricky. I had to build my own Perl, configured with:
-
- sh Configure -Dprefix=/opt/perl5.005 -Duseshrplib -Doptimize=-g \
- -Uusemymalloc -D cc=gcc -Dusethreads -d
-
- When Configure let me edit config.sh, I changed libs to:
-
- libs='-lthread -lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt'
-
- The leading -lthread is the only thing I had to add.
-
-How do I do this crazy thing?
-
-1) Cd into the JPL directory. Type the following:
-
- perl Makefile.PL
- make
- make install
-
- Under windows, that's:
-
- perl Makefile.PL
- nmake
- nmake install
-
-3) cd into the JNI directory (cd ../JNI or cd ..\JNI)
-
-4) We now need to compile and make the Closer.class available to your
- JPL program. Closer is a WindowListener that closes the Frame we
- make in the test program.
-
- It seems that we've managed to fix the problem with CLASSPATH not
- getting propagated to the JVM, so if '.' is in your CLASSPATH, you
- should be able to compile Closer.java and leave it in the current
- directory:
-
- javac Closer.java
-
-5) Make the demo:
-
- a) If you are on Windows, copy typemap.win32:
-
- copy typemap.win32 typemap
-
- (this step will probably go away when we clean up some of the
- WIN32 #defines)
-
- b) type the following:
-
- perl Makefile.PL
- make
- make test
-
- Under Windows:
-
- perl Makefile.PL
- nmake
- nmake test
-
-
- c) if all went well, type:
-
- make install
-
- or, under Windows:
-
- nmake install
-
Mailing List
------------
To subscribe to the jpl mailing list, send an email message to
@@ -224,7 +159,8 @@ Information on accessing the bleeding edge JPL via CVS can be found at:
More Info
---------
-You can look at the Sample and Test directories.
+You can look at the Sample and Test directories, as well as the ../eg
+directory for examples.
Perhaps the most important bit of advice we can give you is to watch
diff --git a/jpl/README.JUST-JNI b/jpl/README.JUST-JNI
new file mode 100644
index 0000000000..03aa34d322
--- /dev/null
+++ b/jpl/README.JUST-JNI
@@ -0,0 +1,113 @@
+Just-JNI (call into Java from Perl only)
+----------------------------------------
+
+This has been tested with:
+
+ Debian GNU/Linux 2.2 i386, perl 5.6.0, Kaffe (CVS, 2000-12-05 or later)
+ RedHat 6.1, perl-5.00503-6 (RedHat RPM), IBM JDK 1.1.8
+ Debian 2.1 SPARC, Perl 5.005_60, JDK 1.2 beta (crashes with AWT, though)
+ Windows NT 4.0 SP4, ActivePerl 519, JDK 1.1.8, Visual C++
+ Solaris 7, Perl 5.005_03, JDK 1.1.6, GCC 2.8.1
+
+Solaris 7 Note (this probably applies to all native thread situations):
+
+ Native threads were tricky. I had to build my own Perl, configured with:
+
+ sh Configure -Dprefix=/opt/perl5.005 -Duseshrplib -Doptimize=-g \
+ -Uusemymalloc -D cc=gcc -Dusethreads -d
+
+ When Configure let me edit config.sh, I changed libs to:
+
+ libs='-lthread -lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt'
+
+ The leading -lthread is the only thing I had to add.
+
+Kaffe Note:
+
+I believe that Kaffe with JIT enabled will likely be problematic. I had a
+lot of trouble with it, that simply went away with interpreter-based Kaffe.
+FWIW, here's how I configured Kaffe:
+
+ env AM_CPPFLAGS=-DDEBUG CFLAGS="-O0 -ggdb" ./configure --disable-gcj \
+ --with-engine=intrp
+
+Likely you don't need all that debugging stuff.
+
+Also, when I build perl, I do this, to be on the safe side. I was worried
+about thread interaction, but realized there was no need to build threaded
+perl, but I thought that the perl code should probably be reentrant, so, I
+did this:
+
+ sh ./Configure -Dcc=gcc -Doptimize='-D_REENTRANT -DDEBUGGING -ggdb' \
+ -Dlibperl='libperl.so' -Duseshrplib='true'
+
+Again, you likely don't need the debugging flags.
+
+
+How do I do this crazy thing?
+-----------------------------
+
+1) Cd into the JPL directory. Type the following:
+
+ perl Makefile.PL
+ make
+ make install
+
+ Under windows, that's:
+
+ perl Makefile.PL
+ nmake
+ nmake install
+
+3) cd into the JNI directory (cd ../JNI or cd ..\JNI)
+
+4) We now need to compile and make the Closer.class available to your
+ JPL program. Closer is a WindowListener that closes the Frame we
+ make in the test program.
+
+ It seems that we've managed to fix the problem with CLASSPATH not
+ getting propagated to the JVM, so if '.' is in your CLASSPATH, you
+ should be able to compile Closer.java and leave it in the current
+ directory:
+
+ javac Closer.java
+
+ or perhaps
+
+ jikes Closer.java
+
+5) Make the demo:
+
+ a) type the following:
+
+ for SUN's proprietary software Java:
+
+ env JAVA_HOME=/path/to/java perl Makefile.PL
+ # setting the JAVA_HOME enviornment variable might not be needed
+ # if Java is in installed in a canonical location
+ make
+ make test
+
+ for Kaffe:
+
+ env KAFFE_PREFIX=/kaffe/installation/prefix perl Makefile.PL
+ # setting the KAFFE_PREFIX enviornment variable might not be needed
+ # if Kaffe is in a canonical location
+ make
+ make test
+
+ Under Windows:
+
+ perl Makefile.PL
+ nmake
+ nmake test
+
+
+ b) if all went well, type:
+
+ make install
+
+ or, under Windows:
+
+ nmake install
+
diff --git a/jpl/docs/Tutorial.pod b/jpl/docs/Tutorial.pod
new file mode 100644
index 0000000000..d8f92c145c
--- /dev/null
+++ b/jpl/docs/Tutorial.pod
@@ -0,0 +1,1047 @@
+=head1 NAME
+
+Tutorial - Perl and Java
+
+=head1 SYNOPSIS
+
+Java and Perl have different strengths and complement each other well.
+
+You can connect them at runtime with tools such as JPL, PJC, or
+ActiveX. In theory, you can convert Perl to Java bytecode, and
+vice-versa.
+
+=head2 Note:
+
+Not actually a conversion.
+
+At this stage, we are generating Java opcodes by walking Perl's syntax
+tree. This is very different from converting Perl to Java. It's a lot
+easier!
+
+=head1 1.1 Perl and Java, Compared
+
+Perl offers rich text processing features, high-level network APIs,
+excellent database integration, and a centralized repository of
+reusable code:
+
+=over 4
+
+=item *
+
+Regular expression engine is a powerful sub language that can perform
+complex text manipulations and extract data.
+
+=item *
+
+Packages such as libwww-perl (LWP) and libnet are powerful, high-level
+interfaces to network functionality.
+
+=item *
+
+The Perl DBI is an interface to SQL data sources.
+
+=item *
+
+CPAN provides a centralized, organized archive of reusable code.
+
+=back
+
+Java has a powerful graphical API, has numerous embedded
+implementations, excellent database integration, but no single
+recognized repository of reusable code.
+
+=over 4
+
+=item *
+
+The Swing (JFC) toolkit is a powerful toolkit for developing user
+interfaces. Java also boasts 2D and 3D graphics APIs.
+
+=item *
+
+Java comes in embedded flavors, such as:
+
+=over 4
+
+=item *
+
+Kaffe C<http://www.transvirtual.com/> - embedded implementations for
+different platforms
+
+=item *
+
+Waba C<http://www.wabasoft.com/> - a subset of Java for Windows CE and
+PalmOS
+
+=item *
+
+It's embedded into web browsers (Netscape and MS Internet Explorer)
+
+=item *
+
+and more...
+
+=back
+
+=item *
+
+Java's JDBC is similar to Perl's DBI
+
+=item *
+
+Java has many different repositories of code. Efforts such as the
+Giant Java Tree C<http://www.gjt.org/> attempt to create a unified
+repository.
+
+=back
+
+=head1 1.2 Opportunities to Combine Java and Perl
+
+You have a Java program with a lot of data that needs to be parsed,
+filed, briefed, debriefed, and numbered.
+
+You want to build your GUI in Java, but let Perl do the heavy lifting.
+
+You've adopted the "Java is a systems language, Perl is a scripting
+language" paradigm, and it works for you.
+
+You're not sure which regex implementation to use:
+
+C<org.teeth.green.loony.raving.monster.regex.*;>
+
+C<com.zeppelin.regex.*;>
+
+You want the I<B<best of both worlds>>.
+
+=head1 1.3 Important Differences between Java and Perl
+
+=over 4
+
+=item *
+
+C<perl> compiles and executes programs each time you run them (unless you
+use the Perl compiler).
+
+=item *
+
+C<javac> compiles programs in advance, C<java> runs them in the Java
+interpreter.
+
+=item *
+
+The Java interpreter supports method overloading (methods can have the
+same name, but are differentiated on the basis of their argument
+types). Overloaded methods generally perform the same function, but
+methods with a shorter argument list often use defaults:
+
+=back
+
+ // Draw a circle in the center of the screen
+ int drawCircle(int radius);
+
+ // Draw a circle at specified coordinates
+ int drawCircle(int radius, int h, int k);
+
+=over 4
+
+=item *
+
+The Perl interpreter doesn't support method overloading. In JPL, when
+we call Java from Perl, we need to use some tricks to specify the Java
+method we want to invoke. We'll learn about this when we see JPL's
+C<getmeth> function.
+
+=back
+
+=head2 Note:
+
+At the time this presentation was prepared, JPL did not work with Perl
+for Win32. However, JPL is in the core Perl distribution, and there
+are plans to make it work with Perl for Win32.
+
+With that in mind, I'm presenting the JPL material first, because it
+is of interest to both Win32 and Unix Perl people. The Win32-specific
+stuff (alternatives to JPL) will come last. I won't be offended if the
+Unix people leave when I move to this section of the tutorial, since
+there is no Unix material in that section. I'm perfectly happy to take
+questions between JPL and ActiveX sections.
+
+A subset of JPL now works on Win32. You can embed Java in Perl, but
+you cannot embed Perl in Java (yet).
+
+=head1 2.1 JPL Overview
+
+Let's look at an overview of JPL.
+
+=head2 2.1.1 Calling Perl from Java
+
+Well-supported by JPL, but it is a complicated process:
+
+=over 4
+
+=item *
+
+The JPL preprocessor parses the I<.jpl> file and generates C code
+wrappers for Perl methods. It also generates Java and Perl source
+files.
+
+=item *
+
+The C compiler compiles the wrapper and links it to the
+I<libPerlInterpreter.so> shared library, producing a shared library for
+the wrapper.
+
+=item *
+
+The Java compiler compiles the Java source file, which uses native
+methods to load the wrapper.
+
+=item *
+
+The wrapper connects the Java code to the Perl code in the Perl source
+file.
+
+=back
+
+Fortunately, a generic F<Makefile.PL> simplifies the process. This is a
+Perl script that generates a I<Makefile> for you.
+
+=head2 2.1.2 Calling Java from Perl
+
+This works best when Perl is embedded within a Java program.
+
+The JNI Perl module creates and loads a JVM. There is no precompiler,
+nothing extra -- it's just a Perl module and extension.
+
+ B<A Problem, Though>. In theory, you can call Java from standalone
+ Perl programs, but this doesn't work because some implementations
+ of Java use a user-level threads package (green threads) that
+ override some functions in the C library. Perl is comfortable
+ using these functions, but Java is not happy using the standard C
+ library functions.
+
+So, with green threads, you can't reliably embed Java in a standalone
+Perl program.
+
+Many Java implementations now use native threads. JPL has been tested
+on Solaris with JDK 1.1.x and native threads, but not on Linux.
+
+=head2 Note:
+
+Oddly enough, this is the only way it works on Win32.
+
+On Unix, I've still had trouble, even with native threads. I might
+need to recompile perl with -DREENTRANT, but I'm not sure.
+
+
+=head1 2.2 Working with JPL
+
+How to set up a JPL application, compile, and install it.
+
+=head2 2.2.1 Setting up a Project
+
+=over 4
+
+=item 1
+
+The I<install-jpl> script creates the I<setvars> script. Source the
+output of I<setvars> into your shell when you want to develop or run
+JPL applications.
+
+=item 2
+
+Create a directory with the name of your project, such as
+I<Frotz>. (if you want to use the generic F<Makefile.PL>, you need a
+separate directory for each JPL class you create).
+
+=item 3
+
+Copy the generic F<Makefile.PL> into the project directory. The
+I<jpl/Sample> directory in the Perl distribution includes the generic
+F<Makefile.PL>.
+
+=item 4
+
+Write a I<.jpl> program with the same name as the project (such as
+F<Frotz.jpl>)
+
+=back
+
+=head2 2.2.2 Compiling and Installing a Project
+
+Type C<make> to compile the application, and C<make install> to
+install it. This installs the application in the I<jpl> directory you
+created when you installed JPL.
+
+ B<Beware>. The default I<jpl> directory is the same as the
+ directory you install it I<from>. If you go with the default and
+ delete your Perl source, you'll delete your JPL installation!
+
+Type C<java Frotz> (or the name you chose in step 2 of section 2.2.1)
+to run it
+
+=head2 2.2.3 What's in the jpl Directory?
+
+=over 4
+
+=item *
+
+B<libPerlInterpreter.so>: a shared library that loads the Perl
+interpreter.
+
+=item *
+
+Compiled F<.class> files for JPL applications you have written.
+
+=item *
+
+Native code shared library wrappers for JPL applications you have
+written.
+
+=item *
+
+Perl scripts that contain the Perl code to load at runtime.
+
+=back
+
+ Beware. If you issue the C<make> command and then run the examples
+ in your development directory, you might be in for a surprise! If
+ the JPL directories come first in your CLASSPATH and
+ LD_LIBRARY_PATH, you'll keep running the installed, older version,
+ rather than the one you are developing
+
+=head2 Note:
+
+"Source" means to load it into your current shell, with something
+like:
+
+C<eval-backtick-setvars-backtick>
+
+as opposed to just executing it, because then only the subshell gets
+the environment vars.
+
+=head1 2.3 Calling Perl from Java
+
+Now, we'll look at how you can invoke Perl from Java.
+
+=head2 2.3.1 Perl Methods
+
+You can put Perl methods in your F<.jpl> file. Perl methods are
+declared C<perl> and use double curly braces to make life easier on
+the JPL preprocessor:
+
+ perl int perlMultiply(int a, int b) {{
+ my $result = $a * $b;
+ return $result;
+ }}
+
+In your Java code, you can invoke Perl methods like a Java method. The
+native code wrappers take care of running the Perl code:
+
+ public void invokePerlFunction() {
+ int x = 3;
+ int y = 6;
+ int retval = perlMultiply(x, y);
+ System.out.println(x + " * " + y + " = " + retval);
+ }
+
+class MethodDemo
+
+ class MethodDemo {
+ // A Perl method to multiply two numbers and
+ // return the result.
+ //
+ perl int perlMultiply(int a, int b) {{
+ my $result = $a * $b;
+ return $result;
+ }}
+
+ // A Java method to call the Perl function.
+ //
+ public void invokePerlFunction() {
+ int x = 3;
+ int y = 6;
+ int retval = perlMultiply(x, y);
+ System.out.println(x +" * "+ y +" = "+ retval);
+ }
+
+ public static void main(String[] args) {
+ MethodDemo demo = new MethodDemo();
+ demo.invokePerlFunction();
+ }
+ }
+
+=head2 Where did $self go?
+
+Don't worry, C<$self> is still there. JPL takes care of fetching it, as
+well as all the other arguments:
+
+ perl int perlMultiply(int a, int b) {{
+ my $result = $a * $b;
+ return $result;
+ }}
+
+ perl void calculateProduct() {{
+ my $x = 3;
+ my $y = 6;
+ my $retval = $self->perlMultiply($x, $y);
+ print "$x * $y = $retval\n";
+ }}
+
+ B<Note>. JPL takes care of putting all the arguments, including
+ C<$self>, into variables. If you see a variable in the function
+ header, you will get a variable of the same name without having to
+ use C<shift> or C<@_>, guaranteed.
+
+
+
+NOTE: I've added a line that prints the output of "ref dollar sign self"
+You'll see this when I run the demo.
+
+ class SelfDemo {
+
+ // A Perl method to multiply two values.
+ //
+ perl int perlMultiply(int a, int b) {{
+ my $result = $a * $b;
+ return $result;
+ }}
+
+ // A Perl method to invoke another Perl method.
+ //
+ perl void calculateProduct() {{
+ my $x = 3;
+ my $y = 6;
+ # Ahhh. There's our old friend, $self!
+ #
+ my $retval = $self->perlMultiply($x, $y);
+ # Display the results.
+ #
+ print "$x * $y = $retval\n";
+ }}
+
+ public static void main(String[] args) {
+ SelfDemo demo = new SelfDemo();
+ demo.calculateProduct();
+ }
+ }
+
+=head2 Passing Arrays
+
+If you pass an array from Java into a Perl method, it arrives in the
+form of a scalar reference.
+
+Use the GetIntArrayElements() JNI function to convert that scalar into
+an array of integers.
+
+ perl void min_max( int[] data ) {{
+
+ # Get the array elements
+ #
+ my @new_array = GetIntArrayElements( $data );
+
+ # Sort the array numerically
+ #
+ my @sorted = sort {$a <=> $b} @new_array;
+
+ print "Min: $sorted[0], ",
+ "Max: $sorted[$#sorted]\n";
+ }}
+
+ void minMaxDemo() {
+ int[] data = {101, 99, 42, 666, 23};
+ min_max( data );
+ }
+
+Some JNI Array Functions
+
+=over 4
+
+=item GetBooleanArrayElements( scalar)
+
+Converts scalar to an array of booleans.
+
+=item GetByteArrayElements( scalar )
+
+Converts scalar to an array of bytes.
+
+=item GetCharArrayElements( scalar )
+
+Converts scalar to an array of characters.
+
+=item GetShortArrayElements( scalar )
+
+Converts scalar to an array of short integers.
+
+=item GetIntArrayElements( scalar )
+
+Converts scalar to an array of integers.
+
+=item GetLongArrayElements( scalar )
+
+Converts scalar to an array of long integers.
+
+=item GetFloatArrayElements( scalar )
+
+Converts scalar to an array of floating point numbers.
+
+=item GetDoubleArrayElements( scalar )
+
+Converts scalar to an array of double precision numbers.
+
+=item GetArrayLength( scalar )
+
+Returns the length of the array.
+
+=back
+
+PerlTakesArray.jpl
+ // Show how to pass an array from Java to Perl.
+ //
+
+ public class PerlTakesArray {
+
+ perl void min_max( int[] data ) {{
+ # Get the array elements
+ #
+ my @new_array = GetIntArrayElements( $data );
+
+ # Sort the array numerically
+ #
+ my @sorted = sort {$a <=> $b} @new_array;
+ print "Min: $sorted[0], ",
+ "Max: $sorted[$#sorted]\n";
+ }}
+
+ void minMaxDemo() {
+ // Create an array and ask Perl to tell us
+ // the min and max values.
+ int[] data = {101, 99, 42, 666, 23};
+ min_max( data );
+ }
+
+ public static void main(String[] argv) {
+ PerlTakesArray demo = new PerlTakesArray();
+ demo.minMaxDemo();
+ }
+
+ }
+
+=head2 2.3.4 Passing Arrays of Objects
+
+Working with arrays of objects is a little more complicated, because you
+need to work with them one at a time.
+
+Fetch one element at a time with GetObjectArrayElement(), which returns
+an object of type java.lang.Object (the most generic type).
+
+Explicitly cast the Object to its real type with bless().
+
+ perl void sortArray( String[] names ) {{
+ my @new_array;
+ for (my $i = 0; $i < GetArrayLength($names); $i++) {
+ my $string = GetObjectArrayElement($names, $i);
+ bless $string, "java::lang::String";
+ push @new_array, $string;
+ }
+ print join(', ', sort @new_array), "\n";
+ }}
+
+ void arrayDemo() {
+ String[] names = {"Omega", "Gamma", "Beta", "Alpha"};
+ sortArray( names );
+ }
+
+Note. String is not a primitive type: it is a class (java.lang.String).
+So, you need to use this technique for Strings as well. You can't use
+the technique in 2.3.3.
+
+PerlTakesObjectArray.jpl
+
+ public class PerlTakesObjectArray {
+
+ // Perl method to sort an array of strings.
+ //
+ perl void sortArray( String[] names ) {{
+ my @new_array; # an array to copy names[] to
+
+ # Fetch each element from the array.
+ for (my $i = 0; $i < GetArrayLength($names); $i++) {
+
+ # Get the object (it's not a String yet!) at
+ # the current index ($i).
+ my $string = GetObjectArrayElement($names, $i);
+
+ # Cast (bless) it into a String.
+ bless $string, "java::lang::String";
+
+ # Add it to the array.
+ push @new_array, $string;
+ }
+
+ # Print the sorted, comma-delimited array.
+ print join(', ', sort @new_array), "\n";
+
+ }}
+
+ // Create a String array and ask Perl to sort it for us.
+ //
+
+ void arrayDemo() {
+ String[] names = {"Omega", "Gamma", "Beta", "Alpha"};
+ sortArray( names );
+ }
+
+ public static void main(String[] argv) {
+ PerlTakesObjectArray demo = new PerlTakesObjectArray();
+ demo.arrayDemo();
+ }
+ }
+
+=head2 2.3.5 Returning Arrays from Perl to Java
+
+To write a Perl method that returns an array, declare its return value
+as an array type. Make sure you return a reference to the array, not a
+list:
+
+ perl int[] getTime() {{
+ my ($sec, $min, $hour, @unused) = localtime(time);
+ # Return an array with seconds, minutes, hours
+ my @time_array = ($sec, $min, $hour);
+ return \@time_array;
+ }}
+
+ void testArray() {
+ int time[] = getTime();
+ System.out.println(time[2] + ":" + time[1]);
+ }
+
+PerlGivesArray.jpl
+
+ // Simple JPL demo to show how to send an array to Java
+ // from Perl
+
+ class PerlGivesArray {
+ // Call the Perl method to get an array and print
+ // the hour and minute elements.
+
+ void testArray() {
+ int time[] = getTime();
+ System.out.println(time[2] + ":" + time[1]);
+ }
+
+ // Perl method that returns an array reference.
+ //
+ perl int[] getTime() {{
+ # Get the first three arguments from localtime,
+ # discard the rest.
+ my ($sec, $min, $hour, @unused) = localtime(time);
+
+ # Return an array with seconds, minutes, hours
+ my @time_array = ($sec, $min, $hour);
+ return \@time_array;
+ }}
+
+ public static void main(String[] argv) {
+ PerlGivesArray demo = new PerlGivesArray();
+ demo.testArray();
+ }
+ }
+
+=head2 2.3.6 Arrays from Strings
+
+JPL will slice Perl strings up into Java arrays for you. If you declare
+a Perl method as an array type and return a string (instead of an array
+reference), JPL splits up the elements into an array.
+
+Consider this example, where a GIF stored in a string gets turned into
+an array of bytes so Java can make an Image out of it:
+
+ void generateImage() {
+ Toolkit kit = Toolkit.getDefaultToolkit();
+ byte[] image_data = mkImage();
+ img = kit.createImage( image_data );
+ }
+
+ perl byte[] mkImage() {{
+ use GD;
+ my $im = new GD::Image( $self->width, $self->height);
+ my $white = $im->colorAllocate(255, 255, 255);
+ my $blue = $im->colorAllocate(0, 0, 255);
+ $im->fill($white, 0, 0);
+ $im->string(gdLargeFont, 10, 10, "Hello, World", $blue);
+ return $im->gif;
+ }}
+
+GifDemo.jpl
+
+ import java.awt.*;
+ import java.awt.event.*;
+ import java.awt.image.*;
+
+ /*
+ * A JPL program that demonstrates passing byte arrays
+ * between Java and Perl
+ *
+ */
+
+ class GIFDemo extends Canvas {
+ Image img;
+ int width = 200;
+ int height = 30;
+
+ // Constructor for this class.
+ public GIFDemo() {
+ this.setSize(width, height);
+ }
+
+ // Java method to create an image.
+ //
+ void generateImage() {
+ Toolkit kit = Toolkit.getDefaultToolkit();
+
+ // Invoke the mkImage() Perl method to generate an
+ // image.
+
+ byte[] image_data = mkImage();
+
+ // Create the image with the byte array we got
+ // from the Perl method.
+
+ img = kit.createImage( image_data );
+ }
+
+ // A Perl method to generate an image.
+
+ perl byte[] mkImage() {{
+
+ # Use the GD image manipulation extension.
+
+ use GD;
+
+ # Create a new image with the height and width specified
+ # in the enclosing Java class.
+
+ my $im = new GD::Image( $self->width, $self->height);
+
+ # Allocate two colors.
+
+ my $white = $im->colorAllocate(255, 255, 255);
+ my $blue = $im->colorAllocate(0, 0, 255);
+
+ # Fill the image with white and draw a greeting.
+
+ $im->fill($white, 0, 0);
+ $im->string(gdLargeFont, 10, 10,
+ "Hello, World", $blue);
+ return $im->gif;
+ }}
+
+ // Java uses this to repaint the image when necessary.
+
+ public void paint(Graphics g) {
+ g.drawImage(img, 0, 0, this);
+ }
+
+ // The entry point.
+
+ public static void main(String[] argv) {
+
+ // Set up a frame and create an image.
+
+ Frame f = new Frame("GD Example");
+ f.setLayout(new BorderLayout());
+
+ GIFDemo demo = new GIFDemo();
+ demo.generateImage();
+
+ f.add("Center", demo);
+ f.addWindowListener( new Handler() );
+
+ f.pack();
+ f.show();
+
+ }
+ }
+
+ // A handler to process a request to close a window.
+
+ class Handler extends WindowAdapter {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ }
+
+=head2 2.3.7 Summary: Calling Perl from Java
+
+=over 4
+
+=item 1
+
+Put your embedded Perl code in methods that are declared C<perl>.
+
+=item 2
+
+Use double, rather than single, curly braces ({{ and }}).
+
+=item 3
+
+Invoke the Perl methods from Java just like any other Java method.
+
+=item 4
+
+No need to pull arguments off of C<@_> with C<shift>: JPL takes care of
+this for you. This includes C<$self>.
+
+=item 5
+
+If you pass a Java array into a Perl method, it comes in as a scalar
+reference.
+
+=item 6
+
+Convert references to arrays of primitives with C<Get*ArrayElements>
+
+=item 7
+
+Use C<GetObjectArrayElement> to get elements from arrays of strings and
+other objects.
+
+=item 8
+
+To return an array from a C<perl> method, declare the method as returning
+an array type, and either:
+
+=item 9
+
+Return an array reference.
+
+=item 10
+
+Return a string: JPL slices it up for you.
+
+=back
+
+=head1 2.4 Calling Java from Perl
+
+Next, let's look at how to invoke Java from Perl.
+
+=head2 2.4.1 Java in Perl in Java
+
+Remember the issues from 2.1.2 - this is unstable unless you are calling Java from Perl methods that are themselves embedded in a Java program.
+
+=head2 2.4.2 Java in Perl: Simple Constructors
+
+Use JPL::Class to load the class:
+
+C<use JPL::Class "java::awt::Frame";>
+
+Invoke the constructor to create an instance of the class:
+
+C<my $f = java::awt::Frame->new;>
+
+You've got a reference to a Java object in $f, a Perl scalar. I think
+this is cool.
+
+=head2 2.4.3 Constructors that Take Parameters
+
+If the constructor has parameters, look up the method signature with
+C<getmeth>:
+
+my $new = getmeth("new", ['java.lang.String'], []);
+
+The first argument to C<getmeth> is the name of the method. The second
+argument is a reference to an array that contains a list of the argument
+types. The final argument to C<getmeth> is a reference to an array
+containing a single element with the return type. Constructors always
+have a null (void) return type, even though they return an instance of
+an object.
+
+Invoke the method through the variable you created:
+
+my $f = java::awt::Frame->$new( "Frame Demo" );
+
+Because Java supports method overloading, the only way Java can
+distinguish between different methods that have the same name is through
+the method signature. The C<getmeth> function simply returns a mangled,
+Perl-friendly version of the signature. JPL's AutoLoader takes care of
+finding the right class.
+
+For example, the method signature for $new is C<(Ljava/lang/String;)V>.
+In Perl, this is translated to C<new__Ljava_lang_String_2__V>. Sure, it
+means something to Java, but thanks to C<getmeth> and JPL's AutoLoader,
+we don't have to worry about it!
+
+=head2 2.4.4 More on getmeth
+
+The C<getmeth> function is not just for constructors. You'll use it to look
+up method signatures for any method that takes arguments.
+
+To use C<getmeth>, just supply the Java names of the types and objects in
+the argument or return value list. Here are a few examples:
+
+=over 4
+
+=item *
+
+Two int arguments, void return type:
+
+ $setSize = getmeth("setSize", ['int', 'int'], []);
+
+=item *
+
+One argument (java.awt.Component), with a return type of the same:
+
+ $add = getmeth("add", ['java.awt.Component'],
+
+ ['java.awt.Component']);
+
+=item *
+
+Two arguments, a String object and a boolean value, and a void return
+type:
+
+ $new = getmeth("new",
+
+ ['java.lang.String', 'boolean'], []);
+
+=item *
+
+A String argument with a java.lang.Class return type:
+
+ $forName = getmeth("forName",
+
+ ['java.lang.String'],
+
+ ['java.lang.Class']);
+
+=item *
+
+No arguments, but a boolean return value:
+
+ $next = getmeth("next", [], ['boolean']);
+
+=back
+
+=head2 2.4.5 Instance Variables
+
+Java instance variables that belong to a class can be reached through
+$self and a method with the same name as the instance variables:
+
+ $frame->$setSize( $self->width, $self->height );
+
+Here is an example:
+
+ class VarDemo {
+
+ int foo = 100;
+
+ perl int perlChange() {{
+ my $current_value = $self->foo;
+
+ # Change foo to ten times itself.
+
+ $self->foo( $current_value * 10 );
+
+ }}
+
+ void executeChange() {
+
+ perlChange();
+ System.out.println(foo);
+
+ }
+
+ public static void main(String[] args) {
+
+ VarDemo demo = new VarDemo();
+ demo.executeChange();
+
+ }
+
+ }
+
+Note. JPL creates these methods with the same name as the variable. You
+can also supply a value to set the variable's value. If you create a
+method with this name, it will collide with the one that JPL defines.
+
+FrameDemo.jpl
+
+ /*
+ * FrameDemo - create and show a Frame in Perl.
+ *
+ */
+
+ public class FrameDemo {
+
+ int height = 50;
+ int width = 200;
+ perl void make_frame () {{
+
+ # Import two Java classes.
+
+ use JPL::Class "java::awt::Frame";
+ use JPL::Class "java::awt::Button";
+
+ # Create a Frame and a Button. The two calls to new()
+ # have the same signature.
+
+ my $new = getmeth("new", ['java.lang.String'], []);
+ my $frame = java::awt::Frame->$new( "Frame Demo" );
+ my $btn = java::awt::Button->$new( "Do Not Press Me" );
+
+ # Add the button to the frame.
+
+ my $add = getmeth("add", ['java.awt.Component'],
+ ['java.awt.Component']);
+ $frame->$add( $btn );
+
+ # Set the size of the frame and show it.
+
+ my $setSize = getmeth("setSize", ['int', 'int'], []);
+ $frame->$setSize($self->width, $self->height);
+ $frame->show;
+
+ }}
+
+ public static void main(String[] argv) {
+
+ FrameDemo demo = new FrameDemo();
+ demo.make_frame();
+
+ }
+
+ }
+
+=head2 2.4.6 Summary: Calling Java from Perl
+
+=over 4
+
+=item 1
+
+Use JPL::Class to specify a Java class to import.
+
+=item 2
+
+You can directly invoke constructors and methods that take no arguments.
+
+=item 3
+
+If the constructor or method takes arguments, use getmeth to look up its
+signature.
+
+=item 4
+
+Use $self to access Java instance variables and methods.
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (c) 1999, Brian Jepson
+
+You may distribute this file under the same terms as Perl itself.
+
+Converted from FrameMaker by Kevin Falcone.
+
+=cut