remove CRs from a couple of files (these show up as CRCRLF
Gurusamy Sarathy [Wed, 18 Dec 2002 02:32:20 +0000 (02:32 +0000)]
on windows)

p4raw-id: //depot/perl@18330

jpl/JNI/JNI.xs
jpl/JNI/Makefile.PL

index ea67a2e..f482695 100644 (file)
-/*\r
- * Copyright 1997, O'Reilly & Associate, Inc.\r
- *\r
- * This package may be copied under the same terms as Perl itself.\r
- */\r
-\r
-#include "EXTERN.h"\r
-#include "perl.h"\r
-#include "XSUB.h"\r
-\r
-#include <stdio.h>\r
-#include <jni.h>\r
-\r
-#ifndef PERL_VERSION\r
-#  include <patchlevel.h>\r
-#  define PERL_REVISION                5\r
-#  define PERL_VERSION         PATCHLEVEL\r
-#  define PERL_SUBVERSION      SUBVERSION\r
-#endif\r
-\r
-#if PERL_REVISION == 5 && (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION <= 75))\r
-#  define PL_na                na\r
-#  define PL_sv_no     sv_no\r
-#  define PL_sv_undef  sv_undef\r
-#  define PL_dowarn    dowarn\r
-#endif\r
-\r
-#ifndef newSVpvn\r
-#  define newSVpvn(a,b)        newSVpv(a,b)\r
-#endif\r
-\r
-#ifndef pTHX\r
-#  define pTHX         void\r
-#  define pTHX_\r
-#  define aTHX\r
-#  define aTHX_\r
-#  define dTHX         extern int JNI___notused\r
-#endif\r
-\r
-#ifndef WIN32\r
-#  include <dlfcn.h>\r
-#endif\r
-\r
-#ifdef EMBEDDEDPERL\r
-extern JNIEnv* jplcurenv;\r
-extern int jpldebug;\r
-#else\r
-JNIEnv* jplcurenv;\r
-int jpldebug = 1;\r
-#endif\r
-\r
-#define SysRet jint\r
-\r
-#ifdef WIN32\r
-static void JNICALL call_my_exit(jint status)\r
-{\r
-    my_exit(status);\r
-}\r
-#else\r
-static void call_my_exit(jint status)\r
-{\r
-    my_exit(status);\r
-}\r
-#endif\r
-\r
-jvalue*\r
-makeargs(char *sig, SV** svp, int items)\r
-{\r
-    jvalue* jv = (jvalue*)safemalloc(sizeof(jvalue) * items);\r
-    int ix = 0;\r
-    char *s = sig;\r
-    JNIEnv* env = jplcurenv;\r
-    char *start;\r
-    STRLEN n_a;\r
-\r
-    if (jpldebug)\r
-       fprintf(stderr, "sig = %s, items = %d\n", sig, items);\r
-    if (*s++ != '(')\r
-       goto cleanup;\r
-\r
-    while (items--) {\r
-       SV *sv = *svp++;\r
-       start = s;\r
-       switch (*s++) {\r
-       case 'Z':\r
-           jv[ix++].z = (jboolean)(SvIV(sv) != 0);\r
-           break;\r
-       case 'B':\r
-           jv[ix++].b = (jbyte)SvIV(sv);\r
-           break;\r
-       case 'C':\r
-           jv[ix++].c = (jchar)SvIV(sv);\r
-           break;\r
-       case 'S':\r
-           jv[ix++].s = (jshort)SvIV(sv);\r
-           break;\r
-       case 'I':\r
-           jv[ix++].i = (jint)SvIV(sv);\r
-           break;\r
-       case 'J':\r
-           jv[ix++].j = (jlong)SvNV(sv);\r
-           break;\r
-       case 'F':\r
-           jv[ix++].f = (jfloat)SvNV(sv);\r
-           break;\r
-       case 'D':\r
-           jv[ix++].d = (jdouble)SvNV(sv);\r
-           break;\r
-       case '[':\r
-           switch (*s++) {\r
-           case 'Z':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jboolean* buf = (jboolean*)malloc(len * sizeof(jboolean));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jbooleanArray ja = (*env)->NewBooleanArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jboolean)SvIV(*esv);\r
-                       (*env)->SetBooleanArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jboolean);\r
-\r
-                   jbooleanArray ja = (*env)->NewBooleanArray(env, len);\r
-                   (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'B':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jbyte* buf = (jbyte*)malloc(len * sizeof(jbyte));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jbyteArray ja = (*env)->NewByteArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jbyte)SvIV(*esv);\r
-                       (*env)->SetByteArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jbyte);\r
-\r
-                   jbyteArray ja = (*env)->NewByteArray(env, len);\r
-                   (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'C':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jchar* buf = (jchar*)malloc(len * sizeof(jchar));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jcharArray ja = (*env)->NewCharArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jchar)SvIV(*esv);\r
-                       (*env)->SetCharArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jchar);\r
-\r
-                   jcharArray ja = (*env)->NewCharArray(env, len);\r
-                   (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'S':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jshort* buf = (jshort*)malloc(len * sizeof(jshort));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jshortArray ja = (*env)->NewShortArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jshort)SvIV(*esv);\r
-                       (*env)->SetShortArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jshort);\r
-\r
-                   jshortArray ja = (*env)->NewShortArray(env, len);\r
-                   (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'I':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jint* buf = (jint*)malloc(len * sizeof(jint));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jintArray ja = (*env)->NewIntArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jint)SvIV(*esv);\r
-                       (*env)->SetIntArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jint);\r
-\r
-                   jintArray ja = (*env)->NewIntArray(env, len);\r
-                   (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'J':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jlong* buf = (jlong*)malloc(len * sizeof(jlong));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jlongArray ja = (*env)->NewLongArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jlong)SvNV(*esv);\r
-                       (*env)->SetLongArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jlong);\r
-\r
-                   jlongArray ja = (*env)->NewLongArray(env, len);\r
-                   (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'F':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jfloat* buf = (jfloat*)malloc(len * sizeof(jfloat));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jfloatArray ja = (*env)->NewFloatArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jfloat)SvNV(*esv);\r
-                       (*env)->SetFloatArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jfloat);\r
-\r
-                   jfloatArray ja = (*env)->NewFloatArray(env, len);\r
-                   (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'D':\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       jdouble* buf = (jdouble*)malloc(len * sizeof(jdouble));\r
-                       int i;\r
-                       SV** esv;\r
-\r
-                       jdoubleArray ja = (*env)->NewDoubleArray(env, len);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)\r
-                           buf[i] = (jdouble)SvNV(*esv);\r
-                       (*env)->SetDoubleArrayRegion(env, ja, 0, len, buf);\r
-                       free((void*)buf);\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else if (SvPOK(sv)) {\r
-                   jsize len = sv_len(sv) / sizeof(jdouble);\r
-\r
-                   jdoubleArray ja = (*env)->NewDoubleArray(env, len);\r
-                   (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));\r
-                   jv[ix++].l = (jobject)ja;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           case 'L':\r
-               while (*s != ';') s++;\r
-               s++;\r
-               if (strnEQ(start, "[Ljava/lang/String;", 19)) {\r
-                   if (SvROK(sv)) {\r
-                       SV* rv = (SV*)SvRV(sv);\r
-                       if (SvOBJECT(rv))\r
-                           jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                       else if (SvTYPE(rv) == SVt_PVAV) {\r
-                           jsize len = av_len((AV*)rv) + 1;\r
-                           int i;\r
-                           SV** esv;\r
-                           static jclass jcl = 0;\r
-                           jobjectArray ja;\r
-\r
-                           if (!jcl)\r
-                               jcl = (*env)->FindClass(env, "java/lang/String");\r
-                           ja = (*env)->NewObjectArray(env, len, jcl, 0);\r
-                           for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {\r
-                               jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));\r
-                               (*env)->SetObjectArrayElement(env, ja, i, str);\r
-                           }\r
-                           jv[ix++].l = (jobject)ja;\r
-                       }\r
-                       else\r
-                           jv[ix++].l = (jobject)(void*)0;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-                   break;\r
-               }\r
-               /* FALL THROUGH */\r
-           default:\r
-               if (SvROK(sv)) {\r
-                   SV* rv = (SV*)SvRV(sv);\r
-                   if (SvOBJECT(rv))\r
-                       jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-                   else if (SvTYPE(rv) == SVt_PVAV) {\r
-                       jsize len = av_len((AV*)rv) + 1;\r
-                       int i;\r
-                       SV** esv;\r
-                      static jclass jcl = 0;\r
-                       jobjectArray ja;\r
-\r
-                       if (!jcl)\r
-                           jcl = (*env)->FindClass(env, "java/lang/Object");\r
-                       ja = (*env)->NewObjectArray(env, len, jcl, 0);\r
-                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {\r
-                           if (SvROK(*esv) && (rv = SvRV(*esv)) && SvOBJECT(rv)) {\r
-                               (*env)->SetObjectArrayElement(env, ja, i, (jobject)(void*)SvIV(rv));\r
-                           }\r
-                           else {\r
-                               jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));\r
-                               (*env)->SetObjectArrayElement(env, ja, i, str);\r
-                           }\r
-                       }\r
-                       jv[ix++].l = (jobject)ja;\r
-                   }\r
-                   else\r
-                       jv[ix++].l = (jobject)(void*)0;\r
-               }\r
-               else\r
-                   jv[ix++].l = (jobject)(void*)0;\r
-               break;\r
-           }\r
-           break;\r
-       case 'L':\r
-           if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {\r
-               s += 17;\r
-               jv[ix++].l = (jobject)(*env)->NewStringUTF(env, (char*) SvPV(sv,n_a));\r
-               break;\r
-           }\r
-           while (*s != ';') s++;\r
-           s++;\r
-           if (SvROK(sv)) {\r
-               SV* rv = SvRV(sv);\r
-               jv[ix++].l = (jobject)(void*)SvIV(rv);\r
-           }\r
-           break;\r
-       case ')':\r
-           croak("too many arguments, signature: %s", sig);\r
-           goto cleanup;\r
-       default:\r
-           croak("panic: malformed signature: %s", s-1);\r
-           goto cleanup;\r
-       }\r
-\r
-    }\r
-    if (*s != ')') {\r
-       croak("not enough arguments, signature: %s", sig);\r
-       goto cleanup;\r
-    }\r
-    return jv;\r
-\r
-cleanup:\r
-    safefree((char*)jv);\r
-    return 0;\r
-}\r
-\r
-static int\r
-not_here(char *s)\r
-{\r
-    croak("%s not implemented on this architecture", s);\r
-    return -1;\r
-}\r
-\r
-static double\r
-constant(char *name, int arg)\r
-{\r
-    errno = 0;\r
-    switch (*name) {\r
-    case 'A':\r
-       break;\r
-    case 'B':\r
-       break;\r
-    case 'C':\r
-       break;\r
-    case 'D':\r
-       break;\r
-    case 'E':\r
-       break;\r
-    case 'F':\r
-       break;\r
-    case 'G':\r
-       break;\r
-    case 'H':\r
-       break;\r
-    case 'I':\r
-       break;\r
-    case 'J':\r
-       if (strEQ(name, "JNI_ABORT"))\r
-#ifdef JNI_ABORT\r
-           return JNI_ABORT;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_COMMIT"))\r
-#ifdef JNI_COMMIT\r
-           return JNI_COMMIT;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_ERR"))\r
-#ifdef JNI_ERR\r
-           return JNI_ERR;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_FALSE"))\r
-#ifdef JNI_FALSE\r
-           return JNI_FALSE;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_H"))\r
-#ifdef JNI_H\r
-#ifdef WIN32\r
-           return 1;\r
-#else\r
-           return JNI_H;\r
-#endif\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_OK"))\r
-#ifdef JNI_OK\r
-           return JNI_OK;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       if (strEQ(name, "JNI_TRUE"))\r
-#ifdef JNI_TRUE\r
-           return JNI_TRUE;\r
-#else\r
-           goto not_there;\r
-#endif\r
-       break;\r
-    case 'K':\r
-       break;\r
-    case 'L':\r
-       break;\r
-    case 'M':\r
-       break;\r
-    case 'N':\r
-       break;\r
-    case 'O':\r
-       break;\r
-    case 'P':\r
-       break;\r
-    case 'Q':\r
-       break;\r
-    case 'R':\r
-       break;\r
-    case 'S':\r
-       break;\r
-    case 'T':\r
-       break;\r
-    case 'U':\r
-       break;\r
-    case 'V':\r
-       break;\r
-    case 'W':\r
-       break;\r
-    case 'X':\r
-       break;\r
-    case 'Y':\r
-       break;\r
-    case 'Z':\r
-       break;\r
-    }\r
-    errno = EINVAL;\r
-    return 0;\r
-\r
-not_there:\r
-    errno = ENOENT;\r
-    return 0;\r
-}\r
-\r
-#define FETCHENV jplcurenv\r
-#define RESTOREENV jplcurenv = env\r
-\r
-MODULE = JNI           PACKAGE = JNI           \r
-\r
-PROTOTYPES: ENABLE\r
-\r
-double\r
-constant(name,arg)\r
-       char *          name\r
-       int             arg\r
-\r
-jint\r
-GetVersion()\r
-       JNIEnv *                env = FETCHENV;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetVersion(env);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jclass\r
-DefineClass(name, loader, buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jsize                   buf_len_ = NO_INIT;\r
-       const char *            name\r
-       jobject                 loader\r
-       const jbyte *           buf\r
-    CODE:\r
-       {\r
-#ifdef KAFFE\r
-           RETVAL = (*env)->DefineClass(env,  loader, buf, (jsize)buf_len_);\r
-#else\r
-           RETVAL = (*env)->DefineClass(env,  name, loader, buf, (jsize)buf_len_); \r
-#endif\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jclass\r
-FindClass(name)\r
-       JNIEnv *                env = FETCHENV;\r
-       const char *            name\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->FindClass(env,  name);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jclass\r
-GetSuperclass(sub)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  sub\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetSuperclass(env,  sub);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-IsAssignableFrom(sub, sup)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  sub\r
-       jclass                  sup\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->IsAssignableFrom(env,  sub, sup);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-SysRet\r
-Throw(obj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jthrowable              obj\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->Throw(env,  obj);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL    \r
-\r
-SysRet\r
-ThrowNew(clazz, msg)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       const char *            msg\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->ThrowNew(env,  clazz, msg);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jthrowable\r
-ExceptionOccurred()\r
-       JNIEnv *                env = FETCHENV;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->ExceptionOccurred(env);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-ExceptionDescribe()\r
-       JNIEnv *                env = FETCHENV;\r
-    CODE:\r
-       {\r
-           (*env)->ExceptionDescribe(env);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-ExceptionClear()\r
-       JNIEnv *                env = FETCHENV;\r
-    CODE:\r
-       {\r
-           (*env)->ExceptionClear(env);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-FatalError(msg)\r
-       JNIEnv *                env = FETCHENV;\r
-       const char *            msg\r
-    CODE:\r
-       {\r
-           (*env)->FatalError(env,  msg);\r
-           RESTOREENV;\r
-       }\r
-\r
-jobject\r
-NewGlobalRef(lobj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 lobj\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewGlobalRef(env, lobj);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-DeleteGlobalRef(gref)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 gref\r
-    CODE:\r
-       {\r
-           (*env)->DeleteGlobalRef(env, gref);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-DeleteLocalRef(obj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-    CODE:\r
-       {\r
-           (*env)->DeleteLocalRef(env,  obj);\r
-           RESTOREENV;\r
-       }\r
-\r
-jboolean\r
-IsSameObject(obj1,obj2)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj1\r
-       jobject                 obj2\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->IsSameObject(env, obj1,obj2);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-AllocObject(clazz)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->AllocObject(env, clazz);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-NewObject(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-NewObjectA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jclass\r
-GetObjectClass(obj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetObjectClass(env, obj);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-IsInstanceOf(obj,clazz)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->IsInstanceOf(env, obj,clazz);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jmethodID\r
-GetMethodID(clazz,name,sig)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       const char *            name\r
-       const char *            sig\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetMethodID(env, clazz,name,sig);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-CallObjectMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-CallObjectMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallBooleanMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallBooleanMethodA(obj,methodID, args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID, args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallByteMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallByteMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallCharMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallCharMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallShortMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallShortMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallIntMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallIntMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallLongMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallLongMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallFloatMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallFloatMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallDoubleMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallDoubleMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-CallVoidMethod(obj,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           (*env)->CallVoidMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-CallVoidMethodA(obj,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           (*env)->CallVoidMethodA(env, obj,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-jobject\r
-CallNonvirtualObjectMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-CallNonvirtualObjectMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallNonvirtualBooleanMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallNonvirtualBooleanMethodA(obj,clazz,methodID, args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID, args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallNonvirtualByteMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallNonvirtualByteMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallNonvirtualCharMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallNonvirtualCharMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallNonvirtualShortMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallNonvirtualShortMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallNonvirtualIntMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallNonvirtualIntMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallNonvirtualLongMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallNonvirtualLongMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallNonvirtualFloatMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallNonvirtualFloatMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallNonvirtualDoubleMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallNonvirtualDoubleMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-CallNonvirtualVoidMethod(obj,clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-CallNonvirtualVoidMethodA(obj,clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-jfieldID\r
-GetFieldID(clazz,name,sig)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       const char *            name\r
-       const char *            sig\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetFieldID(env, clazz,name,sig);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-GetObjectField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetObjectField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-GetBooleanField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetBooleanField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-GetByteField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetByteField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-GetCharField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetCharField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-GetShortField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetShortField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-GetIntField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetIntField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-GetLongField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetLongField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-GetFloatField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetFloatField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-GetDoubleField(obj,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetDoubleField(env, obj,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-SetObjectField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jobject                 val\r
-    CODE:\r
-       {\r
-           (*env)->SetObjectField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetBooleanField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jboolean                val\r
-    CODE:\r
-       {\r
-           (*env)->SetBooleanField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetByteField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jbyte                   val\r
-    CODE:\r
-       {\r
-           (*env)->SetByteField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetCharField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jchar                   val\r
-    CODE:\r
-       {\r
-           (*env)->SetCharField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetShortField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jshort                  val\r
-    CODE:\r
-       {\r
-           (*env)->SetShortField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetIntField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jint                    val\r
-    CODE:\r
-       {\r
-           (*env)->SetIntField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetLongField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jlong                   val\r
-    CODE:\r
-       {\r
-           (*env)->SetLongField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetFloatField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jfloat                  val\r
-    CODE:\r
-       {\r
-           (*env)->SetFloatField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetDoubleField(obj,fieldID,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jdouble                 val\r
-    CODE:\r
-       {\r
-           (*env)->SetDoubleField(env, obj,fieldID,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-jmethodID\r
-GetStaticMethodID(clazz,name,sig)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       const char *            name\r
-       const char *            sig\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticMethodID(env, clazz,name,sig);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-CallStaticObjectMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-CallStaticObjectMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallStaticBooleanMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-CallStaticBooleanMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallStaticByteMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-CallStaticByteMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallStaticCharMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-CallStaticCharMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallStaticShortMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-CallStaticShortMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallStaticIntMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-CallStaticIntMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallStaticLongMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-CallStaticLongMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallStaticFloatMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-CallStaticFloatMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallStaticDoubleMethod(clazz,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-CallStaticDoubleMethodA(clazz,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-CallStaticVoidMethod(cls,methodID,...)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  cls\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       int                     argoff = $min_args;\r
-    CODE:\r
-       {\r
-           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);\r
-           (*env)->CallStaticVoidMethodA(env, cls,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-CallStaticVoidMethodA(cls,methodID,args)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  cls\r
-       jmethodID               methodID\r
-       char *                  sig = 0;\r
-       jvalue *                args\r
-    CODE:\r
-       {\r
-           (*env)->CallStaticVoidMethodA(env, cls,methodID,args);\r
-           RESTOREENV;\r
-       }\r
-\r
-jfieldID\r
-GetStaticFieldID(clazz,name,sig)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       const char *            name\r
-       const char *            sig\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticFieldID(env, clazz,name,sig);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-GetStaticObjectField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticObjectField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean\r
-GetStaticBooleanField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticBooleanField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyte\r
-GetStaticByteField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticByteField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jchar\r
-GetStaticCharField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticCharField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshort\r
-GetStaticShortField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticShortField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jint\r
-GetStaticIntField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticIntField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlong\r
-GetStaticLongField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticLongField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloat\r
-GetStaticFloatField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticFloatField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdouble\r
-GetStaticDoubleField(clazz,fieldID)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStaticDoubleField(env, clazz,fieldID);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-SetStaticObjectField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jobject                 value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticObjectField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticBooleanField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jboolean                value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticBooleanField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticByteField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jbyte                   value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticByteField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticCharField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jchar                   value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticCharField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticShortField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jshort                  value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticShortField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticIntField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jint                    value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticIntField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticLongField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jlong                   value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticLongField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticFloatField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jfloat                  value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticFloatField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetStaticDoubleField(clazz,fieldID,value)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       jfieldID                fieldID\r
-       char *                  sig = 0;\r
-       jdouble                 value\r
-    CODE:\r
-       {\r
-         (*env)->SetStaticDoubleField(env, clazz,fieldID,value);\r
-           RESTOREENV;\r
-       }\r
-\r
-jstring\r
-NewString(unicode)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jsize                   unicode_len_ = NO_INIT;\r
-       const jchar *           unicode\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewString(env, unicode, unicode_len_);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jsize\r
-GetStringLength(str)\r
-       JNIEnv *                env = FETCHENV;\r
-       jstring                 str\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStringLength(env, str);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-const jchar *\r
-GetStringChars(str)\r
-       JNIEnv *                env = FETCHENV;\r
-       jstring                 str\r
-       jboolean                isCopy = NO_INIT;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStringChars(env, str,&isCopy);\r
-           RETVAL_len_ = (*env)->GetStringLength(env, str);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-    CLEANUP:\r
-           (*env)->ReleaseStringChars(env, str,RETVAL);\r
-\r
-jstring\r
-NewStringUTF(utf)\r
-       JNIEnv *                env = FETCHENV;\r
-       const char *            utf\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewStringUTF(env, utf);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jsize\r
-GetStringUTFLength(str)\r
-       JNIEnv *                env = FETCHENV;\r
-       jstring                 str\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStringUTFLength(env, str);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-const char *\r
-GetStringUTFChars(str)\r
-       JNIEnv *                env = FETCHENV;\r
-       jstring                 str\r
-       jboolean                isCopy = NO_INIT;\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetStringUTFChars(env, str,&isCopy);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-    CLEANUP:\r
-       (*env)->ReleaseStringUTFChars(env, str, RETVAL);\r
-\r
-\r
-jsize\r
-GetArrayLength(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jarray                  array\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetArrayLength(env, array);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobjectArray\r
-NewObjectArray(len,clazz,init)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-       jclass                  clazz\r
-       jobject                 init\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewObjectArray(env, len,clazz,init);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jobject\r
-GetObjectArrayElement(array,index)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobjectArray            array\r
-       jsize                   index\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->GetObjectArrayElement(env, array,index);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-void\r
-SetObjectArrayElement(array,index,val)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobjectArray            array\r
-       jsize                   index\r
-       jobject                 val\r
-    CODE:\r
-       {\r
-           (*env)->SetObjectArrayElement(env, array,index,val);\r
-           RESTOREENV;\r
-       }\r
-\r
-jbooleanArray\r
-NewBooleanArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewBooleanArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jbyteArray\r
-NewByteArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewByteArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jcharArray\r
-NewCharArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewCharArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jshortArray\r
-NewShortArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewShortArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jintArray\r
-NewIntArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewIntArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jlongArray\r
-NewLongArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewLongArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jfloatArray\r
-NewFloatArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewFloatArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jdoubleArray\r
-NewDoubleArray(len)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   len\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->NewDoubleArray(env, len);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-jboolean *\r
-GetBooleanArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jbooleanArray           array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetBooleanArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jboolean* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jboolean))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jbyte *\r
-GetByteArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jbyteArray              array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetByteArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jbyte* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jbyte))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jchar *\r
-GetCharArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jcharArray              array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetCharArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jchar* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jchar))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jshort *\r
-GetShortArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jshortArray             array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetShortArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jshort* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jshort))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jint *\r
-GetIntArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jintArray               array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetIntArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jint* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jint))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jlong *\r
-GetLongArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jlongArray              array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetLongArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jlong* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSViv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jlong))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jfloat *\r
-GetFloatArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jfloatArray             array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetFloatArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jfloat* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSVnv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jfloat))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-jdouble *\r
-GetDoubleArrayElements(array)\r
-       JNIEnv *                env = FETCHENV;\r
-       jsize                   RETVAL_len_ = NO_INIT;\r
-       jdoubleArray            array\r
-       jboolean                isCopy = NO_INIT;\r
-    PPCODE:\r
-       {\r
-           RETVAL = (*env)->GetDoubleArrayElements(env, array,&isCopy);\r
-           RETVAL_len_ = (*env)->GetArrayLength(env, array);\r
-           if (GIMME == G_ARRAY) {\r
-               int i;\r
-               jdouble* r = RETVAL;\r
-               EXTEND(sp, RETVAL_len_);\r
-               for (i = RETVAL_len_; i; --i) {\r
-                   PUSHs(sv_2mortal(newSVnv(*r++)));\r
-               }\r
-           }\r
-           else {\r
-               if (RETVAL_len_) {\r
-                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,\r
-                       (STRLEN)RETVAL_len_ * sizeof(jdouble))));\r
-               }\r
-               else\r
-                   PUSHs(&PL_sv_no);\r
-           }\r
-           (*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetBooleanArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jbooleanArray           array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jboolean *              buf = (jboolean*)sv_grow(ST(3),len * sizeof(jboolean)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetBooleanArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jboolean));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetByteArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jbyteArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jbyte *                 buf = (jbyte*)sv_grow(ST(3),len * sizeof(jbyte)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetByteArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jbyte));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetCharArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jcharArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jchar *                 buf = (jchar*)sv_grow(ST(3),len * sizeof(jchar)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetCharArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jchar));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetShortArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jshortArray             array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jshort *                buf = (jshort*)sv_grow(ST(3),len * sizeof(jshort)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetShortArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jshort));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetIntArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jintArray               array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jint *                  buf = (jint*)sv_grow(ST(3),len * sizeof(jint)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetIntArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jint));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetLongArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jlongArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jlong *                 buf = (jlong*)sv_grow(ST(3),len * sizeof(jlong)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetLongArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jlong));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetFloatArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jfloatArray             array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jfloat *                buf = (jfloat*)sv_grow(ST(3),len * sizeof(jfloat)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetFloatArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jfloat));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-GetDoubleArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       jdoubleArray            array\r
-       jsize                   start\r
-       jsize                   len\r
-       STRLEN                  tmplen = len * sizeof(jboolean) + 1;\r
-       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);\r
-       jdouble *               buf = (jdouble*)sv_grow(ST(3),len * sizeof(jdouble)+1);\r
-    CODE:\r
-       {\r
-           (*env)->GetDoubleArrayRegion(env, array,start,len,buf);\r
-           SvCUR_set(ST(3), len * sizeof(jdouble));\r
-           *SvEND(ST(3)) = '\0';\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetBooleanArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jbooleanArray           array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jboolean *              buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetBooleanArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetByteArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jbyteArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jbyte *                 buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetByteArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetCharArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jcharArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jchar *                 buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetCharArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetShortArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jshortArray             array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jshort *                buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetShortArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetIntArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jintArray               array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jint *                  buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetIntArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetLongArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jlongArray              array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jlong *                 buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetLongArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetFloatArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jfloatArray             array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jfloat *                buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetFloatArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-void\r
-SetDoubleArrayRegion(array,start,len,buf)\r
-       JNIEnv *                env = FETCHENV;\r
-       STRLEN                  tmplen = NO_INIT;\r
-       jdoubleArray            array\r
-       jsize                   start\r
-       jsize                   len\r
-       jsize                   buf_len_ = NO_INIT;\r
-       jdouble *               buf\r
-    CODE:\r
-       {\r
-           if (buf_len_ < len)\r
-               croak("string is too short");\r
-           else if (buf_len_ > len && PL_dowarn)\r
-               warn("string is too long");\r
-           (*env)->SetDoubleArrayRegion(env, array,start,len,buf);\r
-           RESTOREENV;\r
-       }\r
-\r
-SysRet\r
-RegisterNatives(clazz,methods,nMethods)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-       JNINativeMethod *       methods\r
-       jint                    nMethods\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->RegisterNatives(env, clazz,methods,nMethods);\r
-       }\r
-\r
-SysRet\r
-UnregisterNatives(clazz)\r
-       JNIEnv *                env = FETCHENV;\r
-       jclass                  clazz\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->UnregisterNatives(env, clazz);\r
-       }\r
-    OUTPUT:\r
-       RETVAL  \r
-   \r
-SysRet\r
-MonitorEnter(obj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->MonitorEnter(env, obj);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-SysRet\r
-MonitorExit(obj)\r
-       JNIEnv *                env = FETCHENV;\r
-       jobject                 obj\r
-    CODE:\r
-       {\r
-           RETVAL = (*env)->MonitorExit(env, obj);\r
-           RESTOREENV;\r
-       }\r
-    OUTPUT:\r
-       RETVAL\r
-\r
-JavaVM *\r
-GetJavaVM(...)\r
-       JNIEnv *                env = FETCHENV;\r
-    CODE:\r
-       {\r
-#ifdef JPL_DEBUG\r
-           jpldebug = 1;\r
-#else\r
-           jpldebug = 0;\r
-#endif\r
-           if (env) {  /* We're embedded. */\r
-               if ((*env)->GetJavaVM(env, &RETVAL) < 0)\r
-                   RETVAL = 0;\r
-           }\r
-           else {      /* We're embedding. */\r
-#ifdef KAFFE\r
-                JavaVMInitArgs vm_args;\r
-#else\r
-                JDK1_1InitArgs vm_args;\r
-#endif\r
-               char *lib;\r
-               if (jpldebug) {\r
-                   fprintf(stderr, "We're embedding Java in Perl.\n");\r
-               }\r
-\r
-               if (items--) {\r
-                   ++mark;\r
-                   lib = SvPV(*mark, PL_na);\r
-               }\r
-               else\r
-                   lib = 0;\r
-               if (jpldebug) {\r
-                   fprintf(stderr, "lib is %s.\n", lib);\r
-               }\r
-#ifdef WIN32\r
-        if (LoadLibrary("jvm.dll")) {\r
-            if (!LoadLibrary("javai.dll")) {\r
-                warn("Can't load javai.dll");\r
-            }\r
-        } else {\r
-            if (lib && !LoadLibrary(lib))\r
-                croak("Can't load javai.dll"); \r
-        }\r
-#else\r
-               if (jpldebug) {\r
-                   fprintf(stderr, "Opening Java shared library.\n");\r
-                }\r
-#ifdef KAFFE\r
-               if (!dlopen("libkaffevm.so", RTLD_LAZY|RTLD_GLOBAL)) {\r
-#else\r
-               if (!dlopen("libjava.so", RTLD_LAZY|RTLD_GLOBAL)) {\r
-#endif\r
-                   if (lib && !dlopen(lib, RTLD_LAZY|RTLD_GLOBAL))\r
-                       croak("Can't load Java shared library.");\r
-               }\r
-#endif\r
-               /* Kaffe seems to get very upset if vm_args.version isn't set */\r
-#ifdef KAFFE\r
-               vm_args.version = JNI_VERSION_1_1;\r
-#endif\r
-               JNI_GetDefaultJavaVMInitArgs(&vm_args);\r
-               vm_args.exit = &call_my_exit;\r
-               if (jpldebug) {\r
-            fprintf(stderr, "items = %d\n", items);\r
-            fprintf(stderr, "mark = %s\n", SvPV(*mark, PL_na));\r
-        }\r
-               while (items > 1) {\r
-                 char *s;\r
-                   ++mark;\r
-                   s = SvPV(*mark,PL_na);\r
-                   ++mark;\r
-                   if (jpldebug) {\r
-                fprintf(stderr, "*s = %s\n", s);\r
-                fprintf(stderr, "val = %s\n", SvPV(*mark, PL_na));\r
-            }\r
-                   items -= 2;\r
-                   if (strEQ(s, "checkSource"))\r
-                       vm_args.checkSource = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "nativeStackSize"))\r
-                       vm_args.nativeStackSize = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "javaStackSize"))\r
-                       vm_args.javaStackSize = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "minHeapSize"))\r
-                       vm_args.minHeapSize = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "maxHeapSize"))\r
-                       vm_args.maxHeapSize = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "verifyMode"))\r
-                       vm_args.verifyMode = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "classpath"))\r
-                       vm_args.classpath = savepv(SvPV(*mark,PL_na));\r
-                   else if (strEQ(s, "enableClassGC"))\r
-                       vm_args.enableClassGC = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "enableVerboseGC"))\r
-                       vm_args.enableVerboseGC = (jint)SvIV(*mark);\r
-                   else if (strEQ(s, "disableAsyncGC"))\r
-                       vm_args.disableAsyncGC = (jint)SvIV(*mark);\r
-#ifdef KAFFE\r
-                   else if (strEQ(s, "libraryhome"))\r
-                       vm_args.libraryhome = savepv(SvPV(*mark,PL_na));\r
-                   else if (strEQ(s, "classhome"))\r
-                       vm_args.classhome = savepv(SvPV(*mark,PL_na));\r
-                   else if (strEQ(s, "enableVerboseJIT"))\r
-                       vm_args.enableVerboseJIT = (jint)SvIV(*mark); \r
-                   else if (strEQ(s, "enableVerboseClassloading"))\r
-                       vm_args.enableVerboseClassloading = (jint)SvIV(*mark); \r
-                   else if (strEQ(s, "enableVerboseCall"))\r
-                       vm_args.enableVerboseCall = (jint)SvIV(*mark); \r
-                   else if (strEQ(s, "allocHeapSize"))\r
-                       vm_args.allocHeapSize = (jint)SvIV(*mark); \r
-#else\r
-                   else if (strEQ(s, "verbose"))\r
-                       vm_args.verbose = (jint)SvIV(*mark); \r
-                   else if (strEQ(s, "debugging"))\r
-                       vm_args.debugging = (jboolean)SvIV(*mark);\r
-                   else if (strEQ(s, "debugPort"))\r
-                       vm_args.debugPort = (jint)SvIV(*mark); \r
-#endif\r
-                   else\r
-                       croak("unrecognized option: %s", s);\r
-               }\r
-\r
-               if (jpldebug) {\r
-                   fprintf(stderr, "Creating Java VM...\n");\r
-                   fprintf(stderr, "Working CLASSPATH: %s\n", \r
-                       vm_args.classpath);\r
-               }\r
-               if (JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args) < 0) {\r
-                  croak("Unable to create instance of JVM");\r
-                }\r
-               if (jpldebug) {\r
-                   fprintf(stderr, "Created Java VM.\n");\r
-               }\r
-\r
-           }\r
-       }\r
-\r
+/*
+ * Copyright 1997, O'Reilly & Associate, Inc.
+ *
+ * This package may be copied under the same terms as Perl itself.
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <stdio.h>
+#include <jni.h>
+
+#ifndef PERL_VERSION
+#  include <patchlevel.h>
+#  define PERL_REVISION                5
+#  define PERL_VERSION         PATCHLEVEL
+#  define PERL_SUBVERSION      SUBVERSION
+#endif
+
+#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
+#  define PL_dowarn    dowarn
+#endif
+
+#ifndef newSVpvn
+#  define newSVpvn(a,b)        newSVpv(a,b)
+#endif
+
+#ifndef pTHX
+#  define pTHX         void
+#  define pTHX_
+#  define aTHX
+#  define aTHX_
+#  define dTHX         extern int JNI___notused
+#endif
+
+#ifndef WIN32
+#  include <dlfcn.h>
+#endif
+
+#ifdef EMBEDDEDPERL
+extern JNIEnv* jplcurenv;
+extern int jpldebug;
+#else
+JNIEnv* jplcurenv;
+int jpldebug = 1;
+#endif
+
+#define SysRet jint
+
+#ifdef WIN32
+static void JNICALL call_my_exit(jint status)
+{
+    my_exit(status);
+}
+#else
+static void call_my_exit(jint status)
+{
+    my_exit(status);
+}
+#endif
+
+jvalue*
+makeargs(char *sig, SV** svp, int items)
+{
+    jvalue* jv = (jvalue*)safemalloc(sizeof(jvalue) * items);
+    int ix = 0;
+    char *s = sig;
+    JNIEnv* env = jplcurenv;
+    char *start;
+    STRLEN n_a;
+
+    if (jpldebug)
+       fprintf(stderr, "sig = %s, items = %d\n", sig, items);
+    if (*s++ != '(')
+       goto cleanup;
+
+    while (items--) {
+       SV *sv = *svp++;
+       start = s;
+       switch (*s++) {
+       case 'Z':
+           jv[ix++].z = (jboolean)(SvIV(sv) != 0);
+           break;
+       case 'B':
+           jv[ix++].b = (jbyte)SvIV(sv);
+           break;
+       case 'C':
+           jv[ix++].c = (jchar)SvIV(sv);
+           break;
+       case 'S':
+           jv[ix++].s = (jshort)SvIV(sv);
+           break;
+       case 'I':
+           jv[ix++].i = (jint)SvIV(sv);
+           break;
+       case 'J':
+           jv[ix++].j = (jlong)SvNV(sv);
+           break;
+       case 'F':
+           jv[ix++].f = (jfloat)SvNV(sv);
+           break;
+       case 'D':
+           jv[ix++].d = (jdouble)SvNV(sv);
+           break;
+       case '[':
+           switch (*s++) {
+           case 'Z':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jboolean* buf = (jboolean*)malloc(len * sizeof(jboolean));
+                       int i;
+                       SV** esv;
+
+                       jbooleanArray ja = (*env)->NewBooleanArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jboolean)SvIV(*esv);
+                       (*env)->SetBooleanArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jboolean);
+
+                   jbooleanArray ja = (*env)->NewBooleanArray(env, len);
+                   (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'B':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jbyte* buf = (jbyte*)malloc(len * sizeof(jbyte));
+                       int i;
+                       SV** esv;
+
+                       jbyteArray ja = (*env)->NewByteArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jbyte)SvIV(*esv);
+                       (*env)->SetByteArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jbyte);
+
+                   jbyteArray ja = (*env)->NewByteArray(env, len);
+                   (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'C':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jchar* buf = (jchar*)malloc(len * sizeof(jchar));
+                       int i;
+                       SV** esv;
+
+                       jcharArray ja = (*env)->NewCharArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jchar)SvIV(*esv);
+                       (*env)->SetCharArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jchar);
+
+                   jcharArray ja = (*env)->NewCharArray(env, len);
+                   (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'S':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jshort* buf = (jshort*)malloc(len * sizeof(jshort));
+                       int i;
+                       SV** esv;
+
+                       jshortArray ja = (*env)->NewShortArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jshort)SvIV(*esv);
+                       (*env)->SetShortArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jshort);
+
+                   jshortArray ja = (*env)->NewShortArray(env, len);
+                   (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'I':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jint* buf = (jint*)malloc(len * sizeof(jint));
+                       int i;
+                       SV** esv;
+
+                       jintArray ja = (*env)->NewIntArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jint)SvIV(*esv);
+                       (*env)->SetIntArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jint);
+
+                   jintArray ja = (*env)->NewIntArray(env, len);
+                   (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'J':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jlong* buf = (jlong*)malloc(len * sizeof(jlong));
+                       int i;
+                       SV** esv;
+
+                       jlongArray ja = (*env)->NewLongArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jlong)SvNV(*esv);
+                       (*env)->SetLongArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jlong);
+
+                   jlongArray ja = (*env)->NewLongArray(env, len);
+                   (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'F':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jfloat* buf = (jfloat*)malloc(len * sizeof(jfloat));
+                       int i;
+                       SV** esv;
+
+                       jfloatArray ja = (*env)->NewFloatArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jfloat)SvNV(*esv);
+                       (*env)->SetFloatArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jfloat);
+
+                   jfloatArray ja = (*env)->NewFloatArray(env, len);
+                   (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'D':
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       jdouble* buf = (jdouble*)malloc(len * sizeof(jdouble));
+                       int i;
+                       SV** esv;
+
+                       jdoubleArray ja = (*env)->NewDoubleArray(env, len);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
+                           buf[i] = (jdouble)SvNV(*esv);
+                       (*env)->SetDoubleArrayRegion(env, ja, 0, len, buf);
+                       free((void*)buf);
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else if (SvPOK(sv)) {
+                   jsize len = sv_len(sv) / sizeof(jdouble);
+
+                   jdoubleArray ja = (*env)->NewDoubleArray(env, len);
+                   (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));
+                   jv[ix++].l = (jobject)ja;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           case 'L':
+               while (*s != ';') s++;
+               s++;
+               if (strnEQ(start, "[Ljava/lang/String;", 19)) {
+                   if (SvROK(sv)) {
+                       SV* rv = (SV*)SvRV(sv);
+                       if (SvOBJECT(rv))
+                           jv[ix++].l = (jobject)(void*)SvIV(rv);
+                       else if (SvTYPE(rv) == SVt_PVAV) {
+                           jsize len = av_len((AV*)rv) + 1;
+                           int i;
+                           SV** esv;
+                           static jclass jcl = 0;
+                           jobjectArray ja;
+
+                           if (!jcl)
+                               jcl = (*env)->FindClass(env, "java/lang/String");
+                           ja = (*env)->NewObjectArray(env, len, jcl, 0);
+                           for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
+                               jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
+                               (*env)->SetObjectArrayElement(env, ja, i, str);
+                           }
+                           jv[ix++].l = (jobject)ja;
+                       }
+                       else
+                           jv[ix++].l = (jobject)(void*)0;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+                   break;
+               }
+               /* FALL THROUGH */
+           default:
+               if (SvROK(sv)) {
+                   SV* rv = (SV*)SvRV(sv);
+                   if (SvOBJECT(rv))
+                       jv[ix++].l = (jobject)(void*)SvIV(rv);
+                   else if (SvTYPE(rv) == SVt_PVAV) {
+                       jsize len = av_len((AV*)rv) + 1;
+                       int i;
+                       SV** esv;
+                      static jclass jcl = 0;
+                       jobjectArray ja;
+
+                       if (!jcl)
+                           jcl = (*env)->FindClass(env, "java/lang/Object");
+                       ja = (*env)->NewObjectArray(env, len, jcl, 0);
+                       for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
+                           if (SvROK(*esv) && (rv = SvRV(*esv)) && SvOBJECT(rv)) {
+                               (*env)->SetObjectArrayElement(env, ja, i, (jobject)(void*)SvIV(rv));
+                           }
+                           else {
+                               jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
+                               (*env)->SetObjectArrayElement(env, ja, i, str);
+                           }
+                       }
+                       jv[ix++].l = (jobject)ja;
+                   }
+                   else
+                       jv[ix++].l = (jobject)(void*)0;
+               }
+               else
+                   jv[ix++].l = (jobject)(void*)0;
+               break;
+           }
+           break;
+       case 'L':
+           if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {
+               s += 17;
+               jv[ix++].l = (jobject)(*env)->NewStringUTF(env, (char*) SvPV(sv,n_a));
+               break;
+           }
+           while (*s != ';') s++;
+           s++;
+           if (SvROK(sv)) {
+               SV* rv = SvRV(sv);
+               jv[ix++].l = (jobject)(void*)SvIV(rv);
+           }
+           break;
+       case ')':
+           croak("too many arguments, signature: %s", sig);
+           goto cleanup;
+       default:
+           croak("panic: malformed signature: %s", s-1);
+           goto cleanup;
+       }
+
+    }
+    if (*s != ')') {
+       croak("not enough arguments, signature: %s", sig);
+       goto cleanup;
+    }
+    return jv;
+
+cleanup:
+    safefree((char*)jv);
+    return 0;
+}
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant(char *name, int arg)
+{
+    errno = 0;
+    switch (*name) {
+    case 'A':
+       break;
+    case 'B':
+       break;
+    case 'C':
+       break;
+    case 'D':
+       break;
+    case 'E':
+       break;
+    case 'F':
+       break;
+    case 'G':
+       break;
+    case 'H':
+       break;
+    case 'I':
+       break;
+    case 'J':
+       if (strEQ(name, "JNI_ABORT"))
+#ifdef JNI_ABORT
+           return JNI_ABORT;
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_COMMIT"))
+#ifdef JNI_COMMIT
+           return JNI_COMMIT;
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_ERR"))
+#ifdef JNI_ERR
+           return JNI_ERR;
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_FALSE"))
+#ifdef JNI_FALSE
+           return JNI_FALSE;
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_H"))
+#ifdef JNI_H
+#ifdef WIN32
+           return 1;
+#else
+           return JNI_H;
+#endif
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_OK"))
+#ifdef JNI_OK
+           return JNI_OK;
+#else
+           goto not_there;
+#endif
+       if (strEQ(name, "JNI_TRUE"))
+#ifdef JNI_TRUE
+           return JNI_TRUE;
+#else
+           goto not_there;
+#endif
+       break;
+    case 'K':
+       break;
+    case 'L':
+       break;
+    case 'M':
+       break;
+    case 'N':
+       break;
+    case 'O':
+       break;
+    case 'P':
+       break;
+    case 'Q':
+       break;
+    case 'R':
+       break;
+    case 'S':
+       break;
+    case 'T':
+       break;
+    case 'U':
+       break;
+    case 'V':
+       break;
+    case 'W':
+       break;
+    case 'X':
+       break;
+    case 'Y':
+       break;
+    case 'Z':
+       break;
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+#define FETCHENV jplcurenv
+#define RESTOREENV jplcurenv = env
+
+MODULE = JNI           PACKAGE = JNI           
+
+PROTOTYPES: ENABLE
+
+double
+constant(name,arg)
+       char *          name
+       int             arg
+
+jint
+GetVersion()
+       JNIEnv *                env = FETCHENV;
+    CODE:
+       {
+           RETVAL = (*env)->GetVersion(env);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jclass
+DefineClass(name, loader, buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jsize                   buf_len_ = NO_INIT;
+       const char *            name
+       jobject                 loader
+       const jbyte *           buf
+    CODE:
+       {
+#ifdef KAFFE
+           RETVAL = (*env)->DefineClass(env,  loader, buf, (jsize)buf_len_);
+#else
+           RETVAL = (*env)->DefineClass(env,  name, loader, buf, (jsize)buf_len_); 
+#endif
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jclass
+FindClass(name)
+       JNIEnv *                env = FETCHENV;
+       const char *            name
+    CODE:
+       {
+           RETVAL = (*env)->FindClass(env,  name);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jclass
+GetSuperclass(sub)
+       JNIEnv *                env = FETCHENV;
+       jclass                  sub
+    CODE:
+       {
+           RETVAL = (*env)->GetSuperclass(env,  sub);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+IsAssignableFrom(sub, sup)
+       JNIEnv *                env = FETCHENV;
+       jclass                  sub
+       jclass                  sup
+    CODE:
+       {
+           RETVAL = (*env)->IsAssignableFrom(env,  sub, sup);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+SysRet
+Throw(obj)
+       JNIEnv *                env = FETCHENV;
+       jthrowable              obj
+    CODE:
+       {
+           RETVAL = (*env)->Throw(env,  obj);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL    
+
+SysRet
+ThrowNew(clazz, msg)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       const char *            msg
+    CODE:
+       {
+           RETVAL = (*env)->ThrowNew(env,  clazz, msg);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jthrowable
+ExceptionOccurred()
+       JNIEnv *                env = FETCHENV;
+    CODE:
+       {
+           RETVAL = (*env)->ExceptionOccurred(env);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+ExceptionDescribe()
+       JNIEnv *                env = FETCHENV;
+    CODE:
+       {
+           (*env)->ExceptionDescribe(env);
+           RESTOREENV;
+       }
+
+void
+ExceptionClear()
+       JNIEnv *                env = FETCHENV;
+    CODE:
+       {
+           (*env)->ExceptionClear(env);
+           RESTOREENV;
+       }
+
+void
+FatalError(msg)
+       JNIEnv *                env = FETCHENV;
+       const char *            msg
+    CODE:
+       {
+           (*env)->FatalError(env,  msg);
+           RESTOREENV;
+       }
+
+jobject
+NewGlobalRef(lobj)
+       JNIEnv *                env = FETCHENV;
+       jobject                 lobj
+    CODE:
+       {
+           RETVAL = (*env)->NewGlobalRef(env, lobj);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+DeleteGlobalRef(gref)
+       JNIEnv *                env = FETCHENV;
+       jobject                 gref
+    CODE:
+       {
+           (*env)->DeleteGlobalRef(env, gref);
+           RESTOREENV;
+       }
+
+void
+DeleteLocalRef(obj)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+    CODE:
+       {
+           (*env)->DeleteLocalRef(env,  obj);
+           RESTOREENV;
+       }
+
+jboolean
+IsSameObject(obj1,obj2)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj1
+       jobject                 obj2
+    CODE:
+       {
+           RETVAL = (*env)->IsSameObject(env, obj1,obj2);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+AllocObject(clazz)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+    CODE:
+       {
+           RETVAL = (*env)->AllocObject(env, clazz);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+NewObject(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+NewObjectA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jclass
+GetObjectClass(obj)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+    CODE:
+       {
+           RETVAL = (*env)->GetObjectClass(env, obj);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+IsInstanceOf(obj,clazz)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+    CODE:
+       {
+           RETVAL = (*env)->IsInstanceOf(env, obj,clazz);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jmethodID
+GetMethodID(clazz,name,sig)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       const char *            name
+       const char *            sig
+    CODE:
+       {
+           RETVAL = (*env)->GetMethodID(env, clazz,name,sig);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+CallObjectMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+CallObjectMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallBooleanMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallBooleanMethodA(obj,methodID, args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID, args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallByteMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallByteMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallCharMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallCharMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallShortMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallShortMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallIntMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallIntMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallLongMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallLongMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallFloatMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallFloatMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallDoubleMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallDoubleMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+CallVoidMethod(obj,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           (*env)->CallVoidMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+
+void
+CallVoidMethodA(obj,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           (*env)->CallVoidMethodA(env, obj,methodID,args);
+           RESTOREENV;
+       }
+
+jobject
+CallNonvirtualObjectMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+CallNonvirtualObjectMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallNonvirtualBooleanMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallNonvirtualBooleanMethodA(obj,clazz,methodID, args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID, args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallNonvirtualByteMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallNonvirtualByteMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallNonvirtualCharMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallNonvirtualCharMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallNonvirtualShortMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallNonvirtualShortMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallNonvirtualIntMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallNonvirtualIntMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallNonvirtualLongMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallNonvirtualLongMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallNonvirtualFloatMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallNonvirtualFloatMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallNonvirtualDoubleMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallNonvirtualDoubleMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+CallNonvirtualVoidMethod(obj,clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+
+void
+CallNonvirtualVoidMethodA(obj,clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
+           RESTOREENV;
+       }
+
+jfieldID
+GetFieldID(clazz,name,sig)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       const char *            name
+       const char *            sig
+    CODE:
+       {
+           RETVAL = (*env)->GetFieldID(env, clazz,name,sig);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+GetObjectField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetObjectField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+GetBooleanField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetBooleanField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+GetByteField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetByteField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+GetCharField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetCharField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+GetShortField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetShortField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+GetIntField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetIntField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+GetLongField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetLongField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+GetFloatField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetFloatField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+GetDoubleField(obj,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetDoubleField(env, obj,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+SetObjectField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jobject                 val
+    CODE:
+       {
+           (*env)->SetObjectField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetBooleanField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jboolean                val
+    CODE:
+       {
+           (*env)->SetBooleanField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetByteField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jbyte                   val
+    CODE:
+       {
+           (*env)->SetByteField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetCharField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jchar                   val
+    CODE:
+       {
+           (*env)->SetCharField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetShortField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jshort                  val
+    CODE:
+       {
+           (*env)->SetShortField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetIntField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jint                    val
+    CODE:
+       {
+           (*env)->SetIntField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetLongField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jlong                   val
+    CODE:
+       {
+           (*env)->SetLongField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetFloatField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jfloat                  val
+    CODE:
+       {
+           (*env)->SetFloatField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+void
+SetDoubleField(obj,fieldID,val)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jdouble                 val
+    CODE:
+       {
+           (*env)->SetDoubleField(env, obj,fieldID,val);
+           RESTOREENV;
+       }
+
+jmethodID
+GetStaticMethodID(clazz,name,sig)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       const char *            name
+       const char *            sig
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticMethodID(env, clazz,name,sig);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+CallStaticObjectMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+CallStaticObjectMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallStaticBooleanMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+CallStaticBooleanMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallStaticByteMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+CallStaticByteMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallStaticCharMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+CallStaticCharMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallStaticShortMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+CallStaticShortMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallStaticIntMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+CallStaticIntMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallStaticLongMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+CallStaticLongMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallStaticFloatMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+CallStaticFloatMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallStaticDoubleMethod(clazz,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+CallStaticDoubleMethodA(clazz,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+CallStaticVoidMethod(cls,methodID,...)
+       JNIEnv *                env = FETCHENV;
+       jclass                  cls
+       jmethodID               methodID
+       char *                  sig = 0;
+       int                     argoff = $min_args;
+    CODE:
+       {
+           jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
+           (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
+           RESTOREENV;
+       }
+
+void
+CallStaticVoidMethodA(cls,methodID,args)
+       JNIEnv *                env = FETCHENV;
+       jclass                  cls
+       jmethodID               methodID
+       char *                  sig = 0;
+       jvalue *                args
+    CODE:
+       {
+           (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
+           RESTOREENV;
+       }
+
+jfieldID
+GetStaticFieldID(clazz,name,sig)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       const char *            name
+       const char *            sig
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticFieldID(env, clazz,name,sig);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+GetStaticObjectField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticObjectField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean
+GetStaticBooleanField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticBooleanField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyte
+GetStaticByteField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticByteField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jchar
+GetStaticCharField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticCharField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshort
+GetStaticShortField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticShortField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jint
+GetStaticIntField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticIntField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlong
+GetStaticLongField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticLongField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloat
+GetStaticFloatField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticFloatField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdouble
+GetStaticDoubleField(clazz,fieldID)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+    CODE:
+       {
+           RETVAL = (*env)->GetStaticDoubleField(env, clazz,fieldID);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+SetStaticObjectField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jobject                 value
+    CODE:
+       {
+         (*env)->SetStaticObjectField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticBooleanField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jboolean                value
+    CODE:
+       {
+         (*env)->SetStaticBooleanField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticByteField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jbyte                   value
+    CODE:
+       {
+         (*env)->SetStaticByteField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticCharField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jchar                   value
+    CODE:
+       {
+         (*env)->SetStaticCharField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticShortField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jshort                  value
+    CODE:
+       {
+         (*env)->SetStaticShortField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticIntField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jint                    value
+    CODE:
+       {
+         (*env)->SetStaticIntField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticLongField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jlong                   value
+    CODE:
+       {
+         (*env)->SetStaticLongField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticFloatField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jfloat                  value
+    CODE:
+       {
+         (*env)->SetStaticFloatField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+void
+SetStaticDoubleField(clazz,fieldID,value)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       jfieldID                fieldID
+       char *                  sig = 0;
+       jdouble                 value
+    CODE:
+       {
+         (*env)->SetStaticDoubleField(env, clazz,fieldID,value);
+           RESTOREENV;
+       }
+
+jstring
+NewString(unicode)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jsize                   unicode_len_ = NO_INIT;
+       const jchar *           unicode
+    CODE:
+       {
+           RETVAL = (*env)->NewString(env, unicode, unicode_len_);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jsize
+GetStringLength(str)
+       JNIEnv *                env = FETCHENV;
+       jstring                 str
+    CODE:
+       {
+           RETVAL = (*env)->GetStringLength(env, str);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+const jchar *
+GetStringChars(str)
+       JNIEnv *                env = FETCHENV;
+       jstring                 str
+       jboolean                isCopy = NO_INIT;
+       jsize                   RETVAL_len_ = NO_INIT;
+    CODE:
+       {
+           RETVAL = (*env)->GetStringChars(env, str,&isCopy);
+           RETVAL_len_ = (*env)->GetStringLength(env, str);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+    CLEANUP:
+           (*env)->ReleaseStringChars(env, str,RETVAL);
+
+jstring
+NewStringUTF(utf)
+       JNIEnv *                env = FETCHENV;
+       const char *            utf
+    CODE:
+       {
+           RETVAL = (*env)->NewStringUTF(env, utf);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jsize
+GetStringUTFLength(str)
+       JNIEnv *                env = FETCHENV;
+       jstring                 str
+    CODE:
+       {
+           RETVAL = (*env)->GetStringUTFLength(env, str);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+const char *
+GetStringUTFChars(str)
+       JNIEnv *                env = FETCHENV;
+       jstring                 str
+       jboolean                isCopy = NO_INIT;
+    CODE:
+       {
+           RETVAL = (*env)->GetStringUTFChars(env, str,&isCopy);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+    CLEANUP:
+       (*env)->ReleaseStringUTFChars(env, str, RETVAL);
+
+
+jsize
+GetArrayLength(array)
+       JNIEnv *                env = FETCHENV;
+       jarray                  array
+    CODE:
+       {
+           RETVAL = (*env)->GetArrayLength(env, array);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobjectArray
+NewObjectArray(len,clazz,init)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+       jclass                  clazz
+       jobject                 init
+    CODE:
+       {
+           RETVAL = (*env)->NewObjectArray(env, len,clazz,init);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jobject
+GetObjectArrayElement(array,index)
+       JNIEnv *                env = FETCHENV;
+       jobjectArray            array
+       jsize                   index
+    CODE:
+       {
+           RETVAL = (*env)->GetObjectArrayElement(env, array,index);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+void
+SetObjectArrayElement(array,index,val)
+       JNIEnv *                env = FETCHENV;
+       jobjectArray            array
+       jsize                   index
+       jobject                 val
+    CODE:
+       {
+           (*env)->SetObjectArrayElement(env, array,index,val);
+           RESTOREENV;
+       }
+
+jbooleanArray
+NewBooleanArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewBooleanArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jbyteArray
+NewByteArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewByteArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jcharArray
+NewCharArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewCharArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jshortArray
+NewShortArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewShortArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jintArray
+NewIntArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewIntArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jlongArray
+NewLongArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewLongArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jfloatArray
+NewFloatArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewFloatArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jdoubleArray
+NewDoubleArray(len)
+       JNIEnv *                env = FETCHENV;
+       jsize                   len
+    CODE:
+       {
+           RETVAL = (*env)->NewDoubleArray(env, len);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+jboolean *
+GetBooleanArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jbooleanArray           array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetBooleanArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jboolean* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jboolean))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jbyte *
+GetByteArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jbyteArray              array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetByteArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jbyte* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jbyte))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jchar *
+GetCharArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jcharArray              array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetCharArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jchar* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jchar))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jshort *
+GetShortArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jshortArray             array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetShortArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jshort* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jshort))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jint *
+GetIntArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jintArray               array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetIntArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jint* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jint))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jlong *
+GetLongArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jlongArray              array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetLongArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jlong* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSViv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jlong))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jfloat *
+GetFloatArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jfloatArray             array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetFloatArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jfloat* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSVnv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jfloat))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+jdouble *
+GetDoubleArrayElements(array)
+       JNIEnv *                env = FETCHENV;
+       jsize                   RETVAL_len_ = NO_INIT;
+       jdoubleArray            array
+       jboolean                isCopy = NO_INIT;
+    PPCODE:
+       {
+           RETVAL = (*env)->GetDoubleArrayElements(env, array,&isCopy);
+           RETVAL_len_ = (*env)->GetArrayLength(env, array);
+           if (GIMME == G_ARRAY) {
+               int i;
+               jdouble* r = RETVAL;
+               EXTEND(sp, RETVAL_len_);
+               for (i = RETVAL_len_; i; --i) {
+                   PUSHs(sv_2mortal(newSVnv(*r++)));
+               }
+           }
+           else {
+               if (RETVAL_len_) {
+                   PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
+                       (STRLEN)RETVAL_len_ * sizeof(jdouble))));
+               }
+               else
+                   PUSHs(&PL_sv_no);
+           }
+           (*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);
+           RESTOREENV;
+       }
+
+void
+GetBooleanArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jbooleanArray           array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jboolean *              buf = (jboolean*)sv_grow(ST(3),len * sizeof(jboolean)+1);
+    CODE:
+       {
+           (*env)->GetBooleanArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jboolean));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetByteArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jbyteArray              array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jbyte *                 buf = (jbyte*)sv_grow(ST(3),len * sizeof(jbyte)+1);
+    CODE:
+       {
+           (*env)->GetByteArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jbyte));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetCharArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jcharArray              array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jchar *                 buf = (jchar*)sv_grow(ST(3),len * sizeof(jchar)+1);
+    CODE:
+       {
+           (*env)->GetCharArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jchar));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetShortArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jshortArray             array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jshort *                buf = (jshort*)sv_grow(ST(3),len * sizeof(jshort)+1);
+    CODE:
+       {
+           (*env)->GetShortArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jshort));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetIntArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jintArray               array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jint *                  buf = (jint*)sv_grow(ST(3),len * sizeof(jint)+1);
+    CODE:
+       {
+           (*env)->GetIntArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jint));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetLongArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jlongArray              array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jlong *                 buf = (jlong*)sv_grow(ST(3),len * sizeof(jlong)+1);
+    CODE:
+       {
+           (*env)->GetLongArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jlong));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetFloatArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jfloatArray             array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jfloat *                buf = (jfloat*)sv_grow(ST(3),len * sizeof(jfloat)+1);
+    CODE:
+       {
+           (*env)->GetFloatArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jfloat));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+GetDoubleArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       jdoubleArray            array
+       jsize                   start
+       jsize                   len
+       STRLEN                  tmplen = len * sizeof(jboolean) + 1;
+       char *                  tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
+       jdouble *               buf = (jdouble*)sv_grow(ST(3),len * sizeof(jdouble)+1);
+    CODE:
+       {
+           (*env)->GetDoubleArrayRegion(env, array,start,len,buf);
+           SvCUR_set(ST(3), len * sizeof(jdouble));
+           *SvEND(ST(3)) = '\0';
+           RESTOREENV;
+       }
+
+void
+SetBooleanArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jbooleanArray           array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jboolean *              buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetBooleanArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetByteArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jbyteArray              array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jbyte *                 buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetByteArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetCharArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jcharArray              array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jchar *                 buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetCharArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetShortArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jshortArray             array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jshort *                buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetShortArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetIntArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jintArray               array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jint *                  buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetIntArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetLongArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jlongArray              array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jlong *                 buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetLongArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetFloatArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jfloatArray             array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jfloat *                buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetFloatArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+void
+SetDoubleArrayRegion(array,start,len,buf)
+       JNIEnv *                env = FETCHENV;
+       STRLEN                  tmplen = NO_INIT;
+       jdoubleArray            array
+       jsize                   start
+       jsize                   len
+       jsize                   buf_len_ = NO_INIT;
+       jdouble *               buf
+    CODE:
+       {
+           if (buf_len_ < len)
+               croak("string is too short");
+           else if (buf_len_ > len && PL_dowarn)
+               warn("string is too long");
+           (*env)->SetDoubleArrayRegion(env, array,start,len,buf);
+           RESTOREENV;
+       }
+
+SysRet
+RegisterNatives(clazz,methods,nMethods)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+       JNINativeMethod *       methods
+       jint                    nMethods
+    CODE:
+       {
+           RETVAL = (*env)->RegisterNatives(env, clazz,methods,nMethods);
+       }
+
+SysRet
+UnregisterNatives(clazz)
+       JNIEnv *                env = FETCHENV;
+       jclass                  clazz
+    CODE:
+       {
+           RETVAL = (*env)->UnregisterNatives(env, clazz);
+       }
+    OUTPUT:
+       RETVAL  
+   
+SysRet
+MonitorEnter(obj)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+    CODE:
+       {
+           RETVAL = (*env)->MonitorEnter(env, obj);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+SysRet
+MonitorExit(obj)
+       JNIEnv *                env = FETCHENV;
+       jobject                 obj
+    CODE:
+       {
+           RETVAL = (*env)->MonitorExit(env, obj);
+           RESTOREENV;
+       }
+    OUTPUT:
+       RETVAL
+
+JavaVM *
+GetJavaVM(...)
+       JNIEnv *                env = FETCHENV;
+    CODE:
+       {
+#ifdef JPL_DEBUG
+           jpldebug = 1;
+#else
+           jpldebug = 0;
+#endif
+           if (env) {  /* We're embedded. */
+               if ((*env)->GetJavaVM(env, &RETVAL) < 0)
+                   RETVAL = 0;
+           }
+           else {      /* We're embedding. */
+#ifdef KAFFE
+                JavaVMInitArgs vm_args;
+#else
+                JDK1_1InitArgs vm_args;
+#endif
+               char *lib;
+               if (jpldebug) {
+                   fprintf(stderr, "We're embedding Java in Perl.\n");
+               }
+
+               if (items--) {
+                   ++mark;
+                   lib = SvPV(*mark, PL_na);
+               }
+               else
+                   lib = 0;
+               if (jpldebug) {
+                   fprintf(stderr, "lib is %s.\n", lib);
+               }
+#ifdef WIN32
+        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");
+                }
+#ifdef KAFFE
+               if (!dlopen("libkaffevm.so", RTLD_LAZY|RTLD_GLOBAL)) {
+#else
+               if (!dlopen("libjava.so", RTLD_LAZY|RTLD_GLOBAL)) {
+#endif
+                   if (lib && !dlopen(lib, RTLD_LAZY|RTLD_GLOBAL))
+                       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));
+        }
+               while (items > 1) {
+                 char *s;
+                   ++mark;
+                   s = SvPV(*mark,PL_na);
+                   ++mark;
+                   if (jpldebug) {
+                fprintf(stderr, "*s = %s\n", s);
+                fprintf(stderr, "val = %s\n", SvPV(*mark, PL_na));
+            }
+                   items -= 2;
+                   if (strEQ(s, "checkSource"))
+                       vm_args.checkSource = (jint)SvIV(*mark);
+                   else if (strEQ(s, "nativeStackSize"))
+                       vm_args.nativeStackSize = (jint)SvIV(*mark);
+                   else if (strEQ(s, "javaStackSize"))
+                       vm_args.javaStackSize = (jint)SvIV(*mark);
+                   else if (strEQ(s, "minHeapSize"))
+                       vm_args.minHeapSize = (jint)SvIV(*mark);
+                   else if (strEQ(s, "maxHeapSize"))
+                       vm_args.maxHeapSize = (jint)SvIV(*mark);
+                   else if (strEQ(s, "verifyMode"))
+                       vm_args.verifyMode = (jint)SvIV(*mark);
+                   else if (strEQ(s, "classpath"))
+                       vm_args.classpath = savepv(SvPV(*mark,PL_na));
+                   else if (strEQ(s, "enableClassGC"))
+                       vm_args.enableClassGC = (jint)SvIV(*mark);
+                   else if (strEQ(s, "enableVerboseGC"))
+                       vm_args.enableVerboseGC = (jint)SvIV(*mark);
+                   else if (strEQ(s, "disableAsyncGC"))
+                       vm_args.disableAsyncGC = (jint)SvIV(*mark);
+#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"))
+                       vm_args.debugging = (jboolean)SvIV(*mark);
+                   else if (strEQ(s, "debugPort"))
+                       vm_args.debugPort = (jint)SvIV(*mark); 
+#endif
+                   else
+                       croak("unrecognized option: %s", s);
+               }
+
+               if (jpldebug) {
+                   fprintf(stderr, "Creating Java VM...\n");
+                   fprintf(stderr, "Working CLASSPATH: %s\n", 
+                       vm_args.classpath);
+               }
+               if (JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args) < 0) {
+                  croak("Unable to create instance of JVM");
+                }
+               if (jpldebug) {
+                   fprintf(stderr, "Created Java VM.\n");
+               }
+
+           }
+       }
+
index 146e3d0..a4865b5 100644 (file)
-#!/usr/bin/perl\r
-use ExtUtils::MakeMaker;\r
-use Getopt::Std;\r
-use Config;\r
-$ARCHNAME = $Config{archname};\r
-use File::Basename;\r
-\r
-getopts('e'); # embedding?\r
-\r
-$CCFLAGS .= $ENV{CCFLAGS} if defined $ENV{CCFLAGS};\r
-\r
-# $USE_KAFFE is a boolean that tells us whether or not we should use Kaffe.\r
-# Set by find_includes (it seemed as good a place as any).\r
-\r
-# Note that we don't check to see the version of Kaffe is one we support.\r
-#  Currently, the only one we support is the one from CVS.\r
-\r
-my $USE_KAFFE = 0;\r
-\r
-#require "JNIConfig";\r
-\r
-if ($^O eq 'solaris') {\r
-    $LIBPATH = " -R$Config{archlib}/CORE -L$Config{archlib}/CORE";\r
-} elsif ($^O eq 'MSWin32') {\r
-    $LIBPATH = " -L$Config{archlib}\\CORE";\r
-    # MSR - added MS VC++ default library path\r
-    # bjepson - fixed to support path names w/spaces in them.\r
-    push(@WINLIBS, (split"\;",$ENV{LIB}));\r
-    grep s/\\$//, @WINLIBS; # eliminate trailing \\r
-    grep s/\/$//, @WINLIBS; # eliminate trailing /\r
-    $LIBPATH .= join(" ", "", map { qq["-L$_" ] } @WINLIBS);\r
-} else {\r
-    $LIBPATH = " -L$Config{archlib}/CORE";\r
-}\r
-#$LIBS = " -lperl";\r
-\r
-# Figure out where Java might live\r
-#\r
-# MSR - added JDK 1.3\r
-#\r
-\r
-my @JAVA_HOME_GUESSES = qw(/usr/local/java /usr/java /usr/local/jdk117_v3\r
-                         C:\\JDK1.1.8 C:\\JDK1.2.1 C:\\JDK1.2.2 C:\\JDK1.3 );\r
-\r
-my @KAFFE_PREFIX_GUESSES = qw(/usr/local /usr);\r
-\r
-if (! defined $ENV{JAVA_HOME}) {\r
-        print "You didn't define JAVA_HOME, so I'm trying a few guesses.\n";\r
-        print "If this fails, you might want to try setting JAVA_HOME and\n";\r
-        print "running me again.\n";\r
-} else {\r
-        @JAVA_HOME_GUESSES = ( $ENV{JAVA_HOME} );\r
-}\r
-\r
-if (! defined $ENV{KAFFE_PREFIX}) {\r
-        print "\nYou didn't define KAFFE_PREFIX, so I'm trying a few guesses.",\r
-          "\nIf this fails, and you are using Kaffe, you might want to try\n",\r
-          "setting KAFFE_PREFIX and running me again.\n",\r
-          "If you want to ignore any possible Kaffe installation, set the\n",\r
-          "KAFFE_PREFIX to and empty string.\n\n";\r
-} else {\r
-        @KAFFE_PREFIX_GUESSES = ($ENV{KAFFE_PREFIX} eq "") ? () :\r
-                                                       ( $ENV{KAFFE_PREFIX} );\r
-}\r
-\r
-my(@KAFFE_INCLUDE_GUESSES, @KAFFE_LIB_GUESSES);\r
-foreach my $kaffePrefix (@KAFFE_PREFIX_GUESSES) {\r
-     push(@KAFFE_INCLUDE_GUESSES, "$kaffePrefix/include/kaffe");\r
-     push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib");\r
-     push(@KAFFE_LIB_GUESSES, "$kaffePrefix/lib/kaffe");\r
-}\r
-    $guess .= "/include/kaffe";\r
-\r
-# Let's find out where jni.h lives\r
-#\r
-my @INCLUDE = find_includes();\r
-\r
-if ($^O eq 'MSWin32') {\r
-  # MSR - added MS VC++ default include path\r
-  push(@INCLUDE,(split"\;",$ENV{INCLUDE}));\r
-  grep s/\\$//, @INCLUDE; # remove trailing \\r
-  grep s/\/$//, @INCLUDE; # remove trailing \\r
-  $INC = join("", map { qq["-I$_" ] } @INCLUDE);\r
-\r
-} else {\r
-  $INC = join(" -I", ("", @INCLUDE));\r
-}\r
-\r
-# Let's find out the name of the Java shared library\r
-#\r
-my @JAVALIBS = find_libs();\r
-\r
-# Find out some defines based on the library we are linking to\r
-#\r
-foreach (@JAVALIBS) {\r
-    if ( $^O eq 'MSWin32') { # We're on Win32\r
-        $INC =~ s#/#\\#g;\r
-        $INC =~ s#\\$##;\r
-         print $INC, "\n";\r
-        $CCFLAGS .= " -DWIN32 -Z7 -D_DEBUG";\r
-        $MYEXTLIB = "$libjava";\r
-      }\r
-}\r
-\r
-$CCFLAGS .= " -DKAFFE" if ($USE_KAFFE);\r
-\r
-# Let's find out the path of the library we need to link against.\r
-#\r
-foreach (@JAVALIBS) {\r
-    if ($^O eq 'MSWin32') { # We're on Win32\r
-        $_ =~ s#/#\\\\#g;\r
-    }\r
-    my ($libname, $libpath, $libsuffix) = fileparse($_, ("\.so", "\.lib"));\r
-    $libname =~ s/^lib//;\r
-    if ($^O eq 'solaris') {\r
-        $LIBPATH .= " -R$libpath -L$libpath"\r
-    } else {\r
-        $LIBPATH .= " -L$libpath"\r
-    }\r
-    $LIBS .= " -l$libname";\r
-}\r
-\r
-# Do we need -D_REENTRANT?\r
-if ($LIBPATH =~ /native/) {\r
-    print "Looks like native threads...\n";\r
-    $CCFLAGS .= " -D_REENTRANT";\r
-}\r
-\r
-if ($opt_e) {\r
-    print "We're embedding Perl in Java via libPerlInterpreter.so.\n";\r
-    eval `../setvars -perl`;\r
-    $CCFLAGS .= " -DEMBEDDEDPERL";\r
-    $LIBPATH .= " -R$ENV{JPL_HOME}/lib/$ARCHNAME -L$ENV{JPL_HOME}/lib/$ARCHNAME";\r
-    $LIBS    .= " -lPerlInterpreter";\r
-}\r
-\r
-# Needed for JNI.\r
-if ($^O eq 'solaris') {\r
-    $LIBS = " -lthread -lc $LIBS"; #-lthread must be first!!!\r
-    $CCFLAGS .= " -D_REENTRANT";\r
-}\r
-\r
-# MSR - clean up LIBS\r
-$LIBS =~ s/-l$//;\r
-\r
-#\r
-# Next, build JNI/Config.pm.  This is a superfluous thing for the SUN and\r
-# Microsoft JDKs, but absolutely necessary for Kaffe.  I think at some\r
-# point, the Microsoft and SUN implementations should use JNI::Config, too.\r
-#\r
-\r
-if (! -d "JNI") {\r
-    mkdir("JNI", 0755) || die "Unable to make JNI directory: $!";\r
-}\r
-open(JNICONFIG, ">JNI/Config.pm") || die "Unable to open JNI/Config.pm: $!";\r
-\r
-print JNICONFIG "# DO NOT EDIT!   Autogenerated by JNI/Makefile.PL\n\n",\r
-                "package JNI::Config;\nuse strict;\nuse Carp;\n",\r
-                "\nuse vars qw(\$KAFFE \$LIB_JAVA \$CLASS_HOME ",\r
-                "\$LIB_HOME);\n\n",\r
-                "\$KAFFE = $USE_KAFFE;\n\$LIB_JAVA = \"$JAVALIBS[0]\";\n";\r
-if ($USE_KAFFE) {\r
-  my $path = $JAVALIBS[0];\r
-  $path =~ s%/(kaffe/)?libkaffevm.so$%%;\r
-\r
-  print JNICONFIG "\$LIB_HOME = \"$path/kaffe\";\n";\r
-  $path =~ s%/lib%%;\r
-  print JNICONFIG "\$CLASS_HOME = \"$path/share/kaffe\";\n";\r
-}\r
-print JNICONFIG "\n\n1;\n";\r
-close JNICONFIG;\r
-\r
-\r
-my %Makefile = (\r
-    NAME        => 'JNI',\r
-    VERSION_FROM => 'JNI.pm',\r
-    DEFINE        => '',\r
-    LINKTYPE => 'dynamic',\r
-    INC        => $INC,\r
-    CCFLAGS => "$Config{ccflags} $CCFLAGS", \r
-    ($Config{archname} =~ /mswin32.*-object/i ? ('CAPI' => 'TRUE') : ()),\r
-\r
-    clean => {FILES => "JNI/* JNI"}\r
-);\r
-\r
-$Makefile{LIBS} = ["$LIBPATH $LIBS"];\r
-if ($MYEXTLIB) {\r
-    $Makefile{MYEXTLIB} = $MYEXTLIB;\r
-}\r
-\r
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence\r
-# the contents of the Makefile that is written.\r
-#\r
-WriteMakefile(%Makefile);\r
-\r
-if ($USE_KAFFE) {\r
-  my $path = $JAVALIBS[0];\r
-  $path =~ s%/libkaffevm.so$%%;\r
-  print "\n\n***NOTE: be sure to have:\n",\r
-            "              LD_LIBRARY_PATH=$path\n",\r
-            "         in your enviornment (or installed as a system dynamic\n",\r
-            "         library location) when you compile and run this.\n";\r
-}\r
-\r
-# subroutine to find a library\r
-#\r
-sub find_stuff {\r
-\r
-    my ($candidates, $locations) = @_;\r
-    my $lib;\r
-    $wanted = sub {\r
-        foreach my $name (@$candidates) {\r
-            if (/$name$/ and ! /green_threads/ and !/include-old/) {\r
-                    $lib = $File::Find::name;\r
-            }\r
-        }\r
-    };\r
-    \r
-    use File::Find;\r
-    foreach my $guess (@$locations) {\r
-        next unless -d $guess;\r
-        find (\&$wanted, $guess);\r
-    }\r
-    if (! $lib) {\r
-        print "Could not find @$candidates\n";\r
-    } else {\r
-        print "Found @$candidates as $lib\n\n";\r
-    }\r
-    return $lib;\r
-}\r
-\r
-# Extra lib for Java 1.2\r
-#\r
-#  if we want KAFFE, check for it, otherwise search for Java\r
-\r
-sub find_libs {\r
-  my($libjava, $libawt, $libjvm);\r
-\r
-  if ($USE_KAFFE) {\r
-    $libjava = find_stuff(['libkaffevm.so'], \@KAFFE_LIB_GUESSES);\r
-    $libawt = find_stuff(['libawt.so'], \@KAFFE_LIB_GUESSES);\r
-  } else {\r
-    $libjava = find_stuff(['libjava.so', 'javai.lib', 'jvm.lib'],\r
-                             \@JAVA_HOME_GUESSES);\r
-    $libjvm  = find_stuff(['libjvm.so'],  \@JAVA_HOME_GUESSES);\r
-    $libawt  = find_stuff(['libawt.so'], \@JAVA_HOME_GUESSES);\r
-    if (defined $libjvm) { # JDK 1.2\r
-      my $libhpi  = find_stuff(['libhpi.so'], \@JAVA_HOME_GUESSES);\r
-      return($libjava, $libjvm, $libhpi, $libawt);\r
-    }\r
-  }\r
-  return($libjava, $libawt);\r
-}\r
-\r
-# We need to find jni.h and jni_md.h\r
-#\r
-\r
-# Always do find_includes as the first operation, as it has the side effect\r
-# of deciding whether or not we are looking for Kaffe.  --bkuhn\r
-\r
-sub find_includes {\r
-\r
-  my @CANDIDATES = qw(jni.h jni_md.h);\r
-  my @includes;\r
-\r
-  sub find_inc {\r
-    foreach my $name (@CANDIDATES) {\r
-      if (/$name$/) {\r
-       my ($hname, $hpath, $hsuffix) = \r
-         fileparse($File::Find::name, ("\.h", "\.H"));\r
-       unless ($hpath =~ /include-old/) {\r
-         print "Found $hname$hsuffix in $hpath\n";\r
-         push @includes, $hpath;\r
-       } \r
-      }\r
-    }\r
-  }\r
-    \r
-  use File::Find;\r
-  foreach my $guess (@KAFFE_INCLUDE_GUESSES) {\r
-    next unless -d $guess;\r
-    find (\&find_inc, $guess);\r
-  }\r
-  # If we have found includes, then we are using Kaffe.\r
-  if (@includes > 0) {\r
-    $USE_KAFFE = 1;\r
-  } else {\r
-    foreach my $guess (@JAVA_HOME_GUESSES) {\r
-      next unless -d $guess;\r
-      find (\&find_inc, $guess);\r
-    }\r
-  }\r
-  die "Could not find Java includes!" unless (@includes);\r
-\r
-  return @includes;\r
-}\r
-\r
+#!/usr/bin/perl
+use ExtUtils::MakeMaker;
+use Getopt::Std;
+use Config;
+$ARCHNAME = $Config{archname};
+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";
+}
+#$LIBS = " -lperl";
+
+# 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
+                         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";
+        print "running me again.\n";
+} else {
+        @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();
+
+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
+#
+my @JAVALIBS = find_libs();
+
+# Find out some defines based on the library we are linking to
+#
+foreach (@JAVALIBS) {
+    if ( $^O eq 'MSWin32') { # We're on Win32
+        $INC =~ s#/#\\#g;
+        $INC =~ s#\\$##;
+         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 ($^O eq 'MSWin32') { # We're on Win32
+        $_ =~ s#/#\\\\#g;
+    }
+    my ($libname, $libpath, $libsuffix) = fileparse($_, ("\.so", "\.lib"));
+    $libname =~ s/^lib//;
+    if ($^O eq 'solaris') {
+        $LIBPATH .= " -R$libpath -L$libpath"
+    } else {
+        $LIBPATH .= " -L$libpath"
+    }
+    $LIBS .= " -l$libname";
+}
+
+# Do we need -D_REENTRANT?
+if ($LIBPATH =~ /native/) {
+    print "Looks like native threads...\n";
+    $CCFLAGS .= " -D_REENTRANT";
+}
+
+if ($opt_e) {
+    print "We're embedding Perl in Java via libPerlInterpreter.so.\n";
+    eval `../setvars -perl`;
+    $CCFLAGS .= " -DEMBEDDEDPERL";
+    $LIBPATH .= " -R$ENV{JPL_HOME}/lib/$ARCHNAME -L$ENV{JPL_HOME}/lib/$ARCHNAME";
+    $LIBS    .= " -lPerlInterpreter";
+}
+
+# Needed for JNI.
+if ($^O eq 'solaris') {
+    $LIBS = " -lthread -lc $LIBS"; #-lthread must be first!!!
+    $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',
+    DEFINE        => '',
+    LINKTYPE => 'dynamic',
+    INC        => $INC,
+    CCFLAGS => "$Config{ccflags} $CCFLAGS", 
+    ($Config{archname} =~ /mswin32.*-object/i ? ('CAPI' => 'TRUE') : ()),
+
+    clean => {FILES => "JNI/* JNI"}
+);
+
+$Makefile{LIBS} = ["$LIBPATH $LIBS"];
+if ($MYEXTLIB) {
+    $Makefile{MYEXTLIB} = $MYEXTLIB;
+}
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+#
+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 $lib;
+    $wanted = sub {
+        foreach my $name (@$candidates) {
+            if (/$name$/ and ! /green_threads/ and !/include-old/) {
+                    $lib = $File::Find::name;
+            }
+        }
+    };
+    
+    use File::Find;
+    foreach my $guess (@$locations) {
+        next unless -d $guess;
+        find (\&$wanted, $guess);
+    }
+    if (! $lib) {
+        print "Could not find @$candidates\n";
+    } else {
+        print "Found @$candidates as $lib\n\n";
+    }
+    return $lib;
+}
+
+# Extra lib for Java 1.2
+#
+#  if we want KAFFE, check for it, otherwise search for Java
+
+sub find_libs {
+  my($libjava, $libawt, $libjvm);
+
+  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;
+       } 
+      }
+    }
+  }
+    
+  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);
+    }
+  }
+  die "Could not find Java includes!" unless (@includes);
+
+  return @includes;
+}
+