2 * Copyright 1997, O'Reilly & Associate, Inc.
\r
4 * This package may be copied under the same terms as Perl itself.
\r
14 #ifndef PERL_VERSION
\r
15 # include <patchlevel.h>
\r
16 # define PERL_REVISION 5
\r
17 # define PERL_VERSION PATCHLEVEL
\r
18 # define PERL_SUBVERSION SUBVERSION
\r
21 #if PERL_REVISION == 5 && (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION <= 75))
\r
23 # define PL_sv_no sv_no
\r
24 # define PL_sv_undef sv_undef
\r
25 # define PL_dowarn dowarn
\r
29 # define newSVpvn(a,b) newSVpv(a,b)
\r
37 # define dTHX extern int JNI___notused
\r
45 extern JNIEnv* jplcurenv;
\r
46 extern int jpldebug;
\r
55 static void JNICALL call_my_exit(jint status)
\r
60 static void call_my_exit(jint status)
\r
67 makeargs(char *sig, SV** svp, int items)
\r
69 jvalue* jv = (jvalue*)safemalloc(sizeof(jvalue) * items);
\r
72 JNIEnv* env = jplcurenv;
\r
77 fprintf(stderr, "sig = %s, items = %d\n", sig, items);
\r
86 jv[ix++].z = (jboolean)(SvIV(sv) != 0);
\r
89 jv[ix++].b = (jbyte)SvIV(sv);
\r
92 jv[ix++].c = (jchar)SvIV(sv);
\r
95 jv[ix++].s = (jshort)SvIV(sv);
\r
98 jv[ix++].i = (jint)SvIV(sv);
\r
101 jv[ix++].j = (jlong)SvNV(sv);
\r
104 jv[ix++].f = (jfloat)SvNV(sv);
\r
107 jv[ix++].d = (jdouble)SvNV(sv);
\r
113 SV* rv = (SV*)SvRV(sv);
\r
115 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
116 else if (SvTYPE(rv) == SVt_PVAV) {
\r
117 jsize len = av_len((AV*)rv) + 1;
\r
118 jboolean* buf = (jboolean*)malloc(len * sizeof(jboolean));
\r
122 jbooleanArray ja = (*env)->NewBooleanArray(env, len);
\r
123 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
124 buf[i] = (jboolean)SvIV(*esv);
\r
125 (*env)->SetBooleanArrayRegion(env, ja, 0, len, buf);
\r
127 jv[ix++].l = (jobject)ja;
\r
130 jv[ix++].l = (jobject)(void*)0;
\r
132 else if (SvPOK(sv)) {
\r
133 jsize len = sv_len(sv) / sizeof(jboolean);
\r
135 jbooleanArray ja = (*env)->NewBooleanArray(env, len);
\r
136 (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));
\r
137 jv[ix++].l = (jobject)ja;
\r
140 jv[ix++].l = (jobject)(void*)0;
\r
144 SV* rv = (SV*)SvRV(sv);
\r
146 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
147 else if (SvTYPE(rv) == SVt_PVAV) {
\r
148 jsize len = av_len((AV*)rv) + 1;
\r
149 jbyte* buf = (jbyte*)malloc(len * sizeof(jbyte));
\r
153 jbyteArray ja = (*env)->NewByteArray(env, len);
\r
154 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
155 buf[i] = (jbyte)SvIV(*esv);
\r
156 (*env)->SetByteArrayRegion(env, ja, 0, len, buf);
\r
158 jv[ix++].l = (jobject)ja;
\r
161 jv[ix++].l = (jobject)(void*)0;
\r
163 else if (SvPOK(sv)) {
\r
164 jsize len = sv_len(sv) / sizeof(jbyte);
\r
166 jbyteArray ja = (*env)->NewByteArray(env, len);
\r
167 (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));
\r
168 jv[ix++].l = (jobject)ja;
\r
171 jv[ix++].l = (jobject)(void*)0;
\r
175 SV* rv = (SV*)SvRV(sv);
\r
177 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
178 else if (SvTYPE(rv) == SVt_PVAV) {
\r
179 jsize len = av_len((AV*)rv) + 1;
\r
180 jchar* buf = (jchar*)malloc(len * sizeof(jchar));
\r
184 jcharArray ja = (*env)->NewCharArray(env, len);
\r
185 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
186 buf[i] = (jchar)SvIV(*esv);
\r
187 (*env)->SetCharArrayRegion(env, ja, 0, len, buf);
\r
189 jv[ix++].l = (jobject)ja;
\r
192 jv[ix++].l = (jobject)(void*)0;
\r
194 else if (SvPOK(sv)) {
\r
195 jsize len = sv_len(sv) / sizeof(jchar);
\r
197 jcharArray ja = (*env)->NewCharArray(env, len);
\r
198 (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));
\r
199 jv[ix++].l = (jobject)ja;
\r
202 jv[ix++].l = (jobject)(void*)0;
\r
206 SV* rv = (SV*)SvRV(sv);
\r
208 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
209 else if (SvTYPE(rv) == SVt_PVAV) {
\r
210 jsize len = av_len((AV*)rv) + 1;
\r
211 jshort* buf = (jshort*)malloc(len * sizeof(jshort));
\r
215 jshortArray ja = (*env)->NewShortArray(env, len);
\r
216 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
217 buf[i] = (jshort)SvIV(*esv);
\r
218 (*env)->SetShortArrayRegion(env, ja, 0, len, buf);
\r
220 jv[ix++].l = (jobject)ja;
\r
223 jv[ix++].l = (jobject)(void*)0;
\r
225 else if (SvPOK(sv)) {
\r
226 jsize len = sv_len(sv) / sizeof(jshort);
\r
228 jshortArray ja = (*env)->NewShortArray(env, len);
\r
229 (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));
\r
230 jv[ix++].l = (jobject)ja;
\r
233 jv[ix++].l = (jobject)(void*)0;
\r
237 SV* rv = (SV*)SvRV(sv);
\r
239 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
240 else if (SvTYPE(rv) == SVt_PVAV) {
\r
241 jsize len = av_len((AV*)rv) + 1;
\r
242 jint* buf = (jint*)malloc(len * sizeof(jint));
\r
246 jintArray ja = (*env)->NewIntArray(env, len);
\r
247 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
248 buf[i] = (jint)SvIV(*esv);
\r
249 (*env)->SetIntArrayRegion(env, ja, 0, len, buf);
\r
251 jv[ix++].l = (jobject)ja;
\r
254 jv[ix++].l = (jobject)(void*)0;
\r
256 else if (SvPOK(sv)) {
\r
257 jsize len = sv_len(sv) / sizeof(jint);
\r
259 jintArray ja = (*env)->NewIntArray(env, len);
\r
260 (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));
\r
261 jv[ix++].l = (jobject)ja;
\r
264 jv[ix++].l = (jobject)(void*)0;
\r
268 SV* rv = (SV*)SvRV(sv);
\r
270 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
271 else if (SvTYPE(rv) == SVt_PVAV) {
\r
272 jsize len = av_len((AV*)rv) + 1;
\r
273 jlong* buf = (jlong*)malloc(len * sizeof(jlong));
\r
277 jlongArray ja = (*env)->NewLongArray(env, len);
\r
278 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
279 buf[i] = (jlong)SvNV(*esv);
\r
280 (*env)->SetLongArrayRegion(env, ja, 0, len, buf);
\r
282 jv[ix++].l = (jobject)ja;
\r
285 jv[ix++].l = (jobject)(void*)0;
\r
287 else if (SvPOK(sv)) {
\r
288 jsize len = sv_len(sv) / sizeof(jlong);
\r
290 jlongArray ja = (*env)->NewLongArray(env, len);
\r
291 (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));
\r
292 jv[ix++].l = (jobject)ja;
\r
295 jv[ix++].l = (jobject)(void*)0;
\r
299 SV* rv = (SV*)SvRV(sv);
\r
301 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
302 else if (SvTYPE(rv) == SVt_PVAV) {
\r
303 jsize len = av_len((AV*)rv) + 1;
\r
304 jfloat* buf = (jfloat*)malloc(len * sizeof(jfloat));
\r
308 jfloatArray ja = (*env)->NewFloatArray(env, len);
\r
309 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
310 buf[i] = (jfloat)SvNV(*esv);
\r
311 (*env)->SetFloatArrayRegion(env, ja, 0, len, buf);
\r
313 jv[ix++].l = (jobject)ja;
\r
316 jv[ix++].l = (jobject)(void*)0;
\r
318 else if (SvPOK(sv)) {
\r
319 jsize len = sv_len(sv) / sizeof(jfloat);
\r
321 jfloatArray ja = (*env)->NewFloatArray(env, len);
\r
322 (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));
\r
323 jv[ix++].l = (jobject)ja;
\r
326 jv[ix++].l = (jobject)(void*)0;
\r
330 SV* rv = (SV*)SvRV(sv);
\r
332 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
333 else if (SvTYPE(rv) == SVt_PVAV) {
\r
334 jsize len = av_len((AV*)rv) + 1;
\r
335 jdouble* buf = (jdouble*)malloc(len * sizeof(jdouble));
\r
339 jdoubleArray ja = (*env)->NewDoubleArray(env, len);
\r
340 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++)
\r
341 buf[i] = (jdouble)SvNV(*esv);
\r
342 (*env)->SetDoubleArrayRegion(env, ja, 0, len, buf);
\r
344 jv[ix++].l = (jobject)ja;
\r
347 jv[ix++].l = (jobject)(void*)0;
\r
349 else if (SvPOK(sv)) {
\r
350 jsize len = sv_len(sv) / sizeof(jdouble);
\r
352 jdoubleArray ja = (*env)->NewDoubleArray(env, len);
\r
353 (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));
\r
354 jv[ix++].l = (jobject)ja;
\r
357 jv[ix++].l = (jobject)(void*)0;
\r
360 while (*s != ';') s++;
\r
362 if (strnEQ(start, "[Ljava/lang/String;", 19)) {
\r
364 SV* rv = (SV*)SvRV(sv);
\r
366 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
367 else if (SvTYPE(rv) == SVt_PVAV) {
\r
368 jsize len = av_len((AV*)rv) + 1;
\r
371 static jclass jcl = 0;
\r
375 jcl = (*env)->FindClass(env, "java/lang/String");
\r
376 ja = (*env)->NewObjectArray(env, len, jcl, 0);
\r
377 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
\r
378 jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
\r
379 (*env)->SetObjectArrayElement(env, ja, i, str);
\r
381 jv[ix++].l = (jobject)ja;
\r
384 jv[ix++].l = (jobject)(void*)0;
\r
387 jv[ix++].l = (jobject)(void*)0;
\r
393 SV* rv = (SV*)SvRV(sv);
\r
395 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
396 else if (SvTYPE(rv) == SVt_PVAV) {
\r
397 jsize len = av_len((AV*)rv) + 1;
\r
400 static jclass jcl = 0;
\r
404 jcl = (*env)->FindClass(env, "java/lang/Object");
\r
405 ja = (*env)->NewObjectArray(env, len, jcl, 0);
\r
406 for (esv = AvARRAY((AV*)rv), i = 0; i < len; esv++, i++) {
\r
407 if (SvROK(*esv) && (rv = SvRV(*esv)) && SvOBJECT(rv)) {
\r
408 (*env)->SetObjectArrayElement(env, ja, i, (jobject)(void*)SvIV(rv));
\r
411 jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
\r
412 (*env)->SetObjectArrayElement(env, ja, i, str);
\r
415 jv[ix++].l = (jobject)ja;
\r
418 jv[ix++].l = (jobject)(void*)0;
\r
421 jv[ix++].l = (jobject)(void*)0;
\r
426 if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {
\r
428 jv[ix++].l = (jobject)(*env)->NewStringUTF(env, (char*) SvPV(sv,n_a));
\r
431 while (*s != ';') s++;
\r
435 jv[ix++].l = (jobject)(void*)SvIV(rv);
\r
439 croak("too many arguments, signature: %s", sig);
\r
442 croak("panic: malformed signature: %s", s-1);
\r
448 croak("not enough arguments, signature: %s", sig);
\r
454 safefree((char*)jv);
\r
461 croak("%s not implemented on this architecture", s);
\r
466 constant(char *name, int arg)
\r
489 if (strEQ(name, "JNI_ABORT"))
\r
495 if (strEQ(name, "JNI_COMMIT"))
\r
501 if (strEQ(name, "JNI_ERR"))
\r
507 if (strEQ(name, "JNI_FALSE"))
\r
513 if (strEQ(name, "JNI_H"))
\r
523 if (strEQ(name, "JNI_OK"))
\r
529 if (strEQ(name, "JNI_TRUE"))
\r
577 #define FETCHENV jplcurenv
\r
578 #define RESTOREENV jplcurenv = env
\r
580 MODULE = JNI PACKAGE = JNI
\r
591 JNIEnv * env = FETCHENV;
\r
594 RETVAL = (*env)->GetVersion(env);
\r
601 DefineClass(name, loader, buf)
\r
602 JNIEnv * env = FETCHENV;
\r
603 STRLEN tmplen = NO_INIT;
\r
604 jsize buf_len_ = NO_INIT;
\r
611 RETVAL = (*env)->DefineClass(env, loader, buf, (jsize)buf_len_);
\r
613 RETVAL = (*env)->DefineClass(env, name, loader, buf, (jsize)buf_len_);
\r
622 JNIEnv * env = FETCHENV;
\r
626 RETVAL = (*env)->FindClass(env, name);
\r
634 JNIEnv * env = FETCHENV;
\r
638 RETVAL = (*env)->GetSuperclass(env, sub);
\r
645 IsAssignableFrom(sub, sup)
\r
646 JNIEnv * env = FETCHENV;
\r
651 RETVAL = (*env)->IsAssignableFrom(env, sub, sup);
\r
659 JNIEnv * env = FETCHENV;
\r
663 RETVAL = (*env)->Throw(env, obj);
\r
670 ThrowNew(clazz, msg)
\r
671 JNIEnv * env = FETCHENV;
\r
676 RETVAL = (*env)->ThrowNew(env, clazz, msg);
\r
683 ExceptionOccurred()
\r
684 JNIEnv * env = FETCHENV;
\r
687 RETVAL = (*env)->ExceptionOccurred(env);
\r
694 ExceptionDescribe()
\r
695 JNIEnv * env = FETCHENV;
\r
698 (*env)->ExceptionDescribe(env);
\r
704 JNIEnv * env = FETCHENV;
\r
707 (*env)->ExceptionClear(env);
\r
713 JNIEnv * env = FETCHENV;
\r
717 (*env)->FatalError(env, msg);
\r
723 JNIEnv * env = FETCHENV;
\r
727 RETVAL = (*env)->NewGlobalRef(env, lobj);
\r
734 DeleteGlobalRef(gref)
\r
735 JNIEnv * env = FETCHENV;
\r
739 (*env)->DeleteGlobalRef(env, gref);
\r
744 DeleteLocalRef(obj)
\r
745 JNIEnv * env = FETCHENV;
\r
749 (*env)->DeleteLocalRef(env, obj);
\r
754 IsSameObject(obj1,obj2)
\r
755 JNIEnv * env = FETCHENV;
\r
760 RETVAL = (*env)->IsSameObject(env, obj1,obj2);
\r
768 JNIEnv * env = FETCHENV;
\r
772 RETVAL = (*env)->AllocObject(env, clazz);
\r
779 NewObject(clazz,methodID,...)
\r
780 JNIEnv * env = FETCHENV;
\r
784 int argoff = $min_args;
\r
787 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
788 RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
\r
795 NewObjectA(clazz,methodID,args)
\r
796 JNIEnv * env = FETCHENV;
\r
803 RETVAL = (*env)->NewObjectA(env, clazz,methodID,args);
\r
810 GetObjectClass(obj)
\r
811 JNIEnv * env = FETCHENV;
\r
815 RETVAL = (*env)->GetObjectClass(env, obj);
\r
822 IsInstanceOf(obj,clazz)
\r
823 JNIEnv * env = FETCHENV;
\r
828 RETVAL = (*env)->IsInstanceOf(env, obj,clazz);
\r
835 GetMethodID(clazz,name,sig)
\r
836 JNIEnv * env = FETCHENV;
\r
842 RETVAL = (*env)->GetMethodID(env, clazz,name,sig);
\r
849 CallObjectMethod(obj,methodID,...)
\r
850 JNIEnv * env = FETCHENV;
\r
854 int argoff = $min_args;
\r
857 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
858 RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
\r
865 CallObjectMethodA(obj,methodID,args)
\r
866 JNIEnv * env = FETCHENV;
\r
873 RETVAL = (*env)->CallObjectMethodA(env, obj,methodID,args);
\r
880 CallBooleanMethod(obj,methodID,...)
\r
881 JNIEnv * env = FETCHENV;
\r
885 int argoff = $min_args;
\r
888 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
889 RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID,args);
\r
896 CallBooleanMethodA(obj,methodID, args)
\r
897 JNIEnv * env = FETCHENV;
\r
904 RETVAL = (*env)->CallBooleanMethodA(env, obj,methodID, args);
\r
911 CallByteMethod(obj,methodID,...)
\r
912 JNIEnv * env = FETCHENV;
\r
916 int argoff = $min_args;
\r
919 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
920 RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
\r
927 CallByteMethodA(obj,methodID,args)
\r
928 JNIEnv * env = FETCHENV;
\r
935 RETVAL = (*env)->CallByteMethodA(env, obj,methodID,args);
\r
942 CallCharMethod(obj,methodID,...)
\r
943 JNIEnv * env = FETCHENV;
\r
947 int argoff = $min_args;
\r
950 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
951 RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
\r
958 CallCharMethodA(obj,methodID,args)
\r
959 JNIEnv * env = FETCHENV;
\r
966 RETVAL = (*env)->CallCharMethodA(env, obj,methodID,args);
\r
973 CallShortMethod(obj,methodID,...)
\r
974 JNIEnv * env = FETCHENV;
\r
978 int argoff = $min_args;
\r
981 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
982 RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
\r
989 CallShortMethodA(obj,methodID,args)
\r
990 JNIEnv * env = FETCHENV;
\r
997 RETVAL = (*env)->CallShortMethodA(env, obj,methodID,args);
\r
1004 CallIntMethod(obj,methodID,...)
\r
1005 JNIEnv * env = FETCHENV;
\r
1007 jmethodID methodID
\r
1009 int argoff = $min_args;
\r
1012 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1013 RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
\r
1020 CallIntMethodA(obj,methodID,args)
\r
1021 JNIEnv * env = FETCHENV;
\r
1023 jmethodID methodID
\r
1028 RETVAL = (*env)->CallIntMethodA(env, obj,methodID,args);
\r
1035 CallLongMethod(obj,methodID,...)
\r
1036 JNIEnv * env = FETCHENV;
\r
1038 jmethodID methodID
\r
1040 int argoff = $min_args;
\r
1043 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1044 RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
\r
1051 CallLongMethodA(obj,methodID,args)
\r
1052 JNIEnv * env = FETCHENV;
\r
1054 jmethodID methodID
\r
1059 RETVAL = (*env)->CallLongMethodA(env, obj,methodID,args);
\r
1066 CallFloatMethod(obj,methodID,...)
\r
1067 JNIEnv * env = FETCHENV;
\r
1069 jmethodID methodID
\r
1071 int argoff = $min_args;
\r
1074 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1075 RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
\r
1082 CallFloatMethodA(obj,methodID,args)
\r
1083 JNIEnv * env = FETCHENV;
\r
1085 jmethodID methodID
\r
1090 RETVAL = (*env)->CallFloatMethodA(env, obj,methodID,args);
\r
1097 CallDoubleMethod(obj,methodID,...)
\r
1098 JNIEnv * env = FETCHENV;
\r
1100 jmethodID methodID
\r
1102 int argoff = $min_args;
\r
1105 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1106 RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
\r
1113 CallDoubleMethodA(obj,methodID,args)
\r
1114 JNIEnv * env = FETCHENV;
\r
1116 jmethodID methodID
\r
1121 RETVAL = (*env)->CallDoubleMethodA(env, obj,methodID,args);
\r
1128 CallVoidMethod(obj,methodID,...)
\r
1129 JNIEnv * env = FETCHENV;
\r
1131 jmethodID methodID
\r
1133 int argoff = $min_args;
\r
1136 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1137 (*env)->CallVoidMethodA(env, obj,methodID,args);
\r
1142 CallVoidMethodA(obj,methodID,args)
\r
1143 JNIEnv * env = FETCHENV;
\r
1145 jmethodID methodID
\r
1150 (*env)->CallVoidMethodA(env, obj,methodID,args);
\r
1155 CallNonvirtualObjectMethod(obj,clazz,methodID,...)
\r
1156 JNIEnv * env = FETCHENV;
\r
1159 jmethodID methodID
\r
1161 int argoff = $min_args;
\r
1164 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1165 RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
\r
1172 CallNonvirtualObjectMethodA(obj,clazz,methodID,args)
\r
1173 JNIEnv * env = FETCHENV;
\r
1176 jmethodID methodID
\r
1181 RETVAL = (*env)->CallNonvirtualObjectMethodA(env, obj,clazz,methodID,args);
\r
1188 CallNonvirtualBooleanMethod(obj,clazz,methodID,...)
\r
1189 JNIEnv * env = FETCHENV;
\r
1192 jmethodID methodID
\r
1194 int argoff = $min_args;
\r
1197 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1198 RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID,args);
\r
1205 CallNonvirtualBooleanMethodA(obj,clazz,methodID, args)
\r
1206 JNIEnv * env = FETCHENV;
\r
1209 jmethodID methodID
\r
1214 RETVAL = (*env)->CallNonvirtualBooleanMethodA(env, obj,clazz,methodID, args);
\r
1221 CallNonvirtualByteMethod(obj,clazz,methodID,...)
\r
1222 JNIEnv * env = FETCHENV;
\r
1225 jmethodID methodID
\r
1227 int argoff = $min_args;
\r
1230 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1231 RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
\r
1238 CallNonvirtualByteMethodA(obj,clazz,methodID,args)
\r
1239 JNIEnv * env = FETCHENV;
\r
1242 jmethodID methodID
\r
1247 RETVAL = (*env)->CallNonvirtualByteMethodA(env, obj,clazz,methodID,args);
\r
1254 CallNonvirtualCharMethod(obj,clazz,methodID,...)
\r
1255 JNIEnv * env = FETCHENV;
\r
1258 jmethodID methodID
\r
1260 int argoff = $min_args;
\r
1263 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1264 RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
\r
1271 CallNonvirtualCharMethodA(obj,clazz,methodID,args)
\r
1272 JNIEnv * env = FETCHENV;
\r
1275 jmethodID methodID
\r
1280 RETVAL = (*env)->CallNonvirtualCharMethodA(env, obj,clazz,methodID,args);
\r
1287 CallNonvirtualShortMethod(obj,clazz,methodID,...)
\r
1288 JNIEnv * env = FETCHENV;
\r
1291 jmethodID methodID
\r
1293 int argoff = $min_args;
\r
1296 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1297 RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
\r
1304 CallNonvirtualShortMethodA(obj,clazz,methodID,args)
\r
1305 JNIEnv * env = FETCHENV;
\r
1308 jmethodID methodID
\r
1313 RETVAL = (*env)->CallNonvirtualShortMethodA(env, obj,clazz,methodID,args);
\r
1320 CallNonvirtualIntMethod(obj,clazz,methodID,...)
\r
1321 JNIEnv * env = FETCHENV;
\r
1324 jmethodID methodID
\r
1326 int argoff = $min_args;
\r
1329 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1330 RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
\r
1337 CallNonvirtualIntMethodA(obj,clazz,methodID,args)
\r
1338 JNIEnv * env = FETCHENV;
\r
1341 jmethodID methodID
\r
1346 RETVAL = (*env)->CallNonvirtualIntMethodA(env, obj,clazz,methodID,args);
\r
1353 CallNonvirtualLongMethod(obj,clazz,methodID,...)
\r
1354 JNIEnv * env = FETCHENV;
\r
1357 jmethodID methodID
\r
1359 int argoff = $min_args;
\r
1362 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1363 RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
\r
1370 CallNonvirtualLongMethodA(obj,clazz,methodID,args)
\r
1371 JNIEnv * env = FETCHENV;
\r
1374 jmethodID methodID
\r
1379 RETVAL = (*env)->CallNonvirtualLongMethodA(env, obj,clazz,methodID,args);
\r
1386 CallNonvirtualFloatMethod(obj,clazz,methodID,...)
\r
1387 JNIEnv * env = FETCHENV;
\r
1390 jmethodID methodID
\r
1392 int argoff = $min_args;
\r
1395 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1396 RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
\r
1403 CallNonvirtualFloatMethodA(obj,clazz,methodID,args)
\r
1404 JNIEnv * env = FETCHENV;
\r
1407 jmethodID methodID
\r
1412 RETVAL = (*env)->CallNonvirtualFloatMethodA(env, obj,clazz,methodID,args);
\r
1419 CallNonvirtualDoubleMethod(obj,clazz,methodID,...)
\r
1420 JNIEnv * env = FETCHENV;
\r
1423 jmethodID methodID
\r
1425 int argoff = $min_args;
\r
1428 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1429 RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
\r
1436 CallNonvirtualDoubleMethodA(obj,clazz,methodID,args)
\r
1437 JNIEnv * env = FETCHENV;
\r
1440 jmethodID methodID
\r
1445 RETVAL = (*env)->CallNonvirtualDoubleMethodA(env, obj,clazz,methodID,args);
\r
1452 CallNonvirtualVoidMethod(obj,clazz,methodID,...)
\r
1453 JNIEnv * env = FETCHENV;
\r
1456 jmethodID methodID
\r
1458 int argoff = $min_args;
\r
1461 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1462 (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
\r
1467 CallNonvirtualVoidMethodA(obj,clazz,methodID,args)
\r
1468 JNIEnv * env = FETCHENV;
\r
1471 jmethodID methodID
\r
1476 (*env)->CallNonvirtualVoidMethodA(env, obj,clazz,methodID,args);
\r
1481 GetFieldID(clazz,name,sig)
\r
1482 JNIEnv * env = FETCHENV;
\r
1488 RETVAL = (*env)->GetFieldID(env, clazz,name,sig);
\r
1495 GetObjectField(obj,fieldID)
\r
1496 JNIEnv * env = FETCHENV;
\r
1502 RETVAL = (*env)->GetObjectField(env, obj,fieldID);
\r
1509 GetBooleanField(obj,fieldID)
\r
1510 JNIEnv * env = FETCHENV;
\r
1516 RETVAL = (*env)->GetBooleanField(env, obj,fieldID);
\r
1523 GetByteField(obj,fieldID)
\r
1524 JNIEnv * env = FETCHENV;
\r
1530 RETVAL = (*env)->GetByteField(env, obj,fieldID);
\r
1537 GetCharField(obj,fieldID)
\r
1538 JNIEnv * env = FETCHENV;
\r
1544 RETVAL = (*env)->GetCharField(env, obj,fieldID);
\r
1551 GetShortField(obj,fieldID)
\r
1552 JNIEnv * env = FETCHENV;
\r
1558 RETVAL = (*env)->GetShortField(env, obj,fieldID);
\r
1565 GetIntField(obj,fieldID)
\r
1566 JNIEnv * env = FETCHENV;
\r
1572 RETVAL = (*env)->GetIntField(env, obj,fieldID);
\r
1579 GetLongField(obj,fieldID)
\r
1580 JNIEnv * env = FETCHENV;
\r
1586 RETVAL = (*env)->GetLongField(env, obj,fieldID);
\r
1593 GetFloatField(obj,fieldID)
\r
1594 JNIEnv * env = FETCHENV;
\r
1600 RETVAL = (*env)->GetFloatField(env, obj,fieldID);
\r
1607 GetDoubleField(obj,fieldID)
\r
1608 JNIEnv * env = FETCHENV;
\r
1614 RETVAL = (*env)->GetDoubleField(env, obj,fieldID);
\r
1621 SetObjectField(obj,fieldID,val)
\r
1622 JNIEnv * env = FETCHENV;
\r
1629 (*env)->SetObjectField(env, obj,fieldID,val);
\r
1634 SetBooleanField(obj,fieldID,val)
\r
1635 JNIEnv * env = FETCHENV;
\r
1642 (*env)->SetBooleanField(env, obj,fieldID,val);
\r
1647 SetByteField(obj,fieldID,val)
\r
1648 JNIEnv * env = FETCHENV;
\r
1655 (*env)->SetByteField(env, obj,fieldID,val);
\r
1660 SetCharField(obj,fieldID,val)
\r
1661 JNIEnv * env = FETCHENV;
\r
1668 (*env)->SetCharField(env, obj,fieldID,val);
\r
1673 SetShortField(obj,fieldID,val)
\r
1674 JNIEnv * env = FETCHENV;
\r
1681 (*env)->SetShortField(env, obj,fieldID,val);
\r
1686 SetIntField(obj,fieldID,val)
\r
1687 JNIEnv * env = FETCHENV;
\r
1694 (*env)->SetIntField(env, obj,fieldID,val);
\r
1699 SetLongField(obj,fieldID,val)
\r
1700 JNIEnv * env = FETCHENV;
\r
1707 (*env)->SetLongField(env, obj,fieldID,val);
\r
1712 SetFloatField(obj,fieldID,val)
\r
1713 JNIEnv * env = FETCHENV;
\r
1720 (*env)->SetFloatField(env, obj,fieldID,val);
\r
1725 SetDoubleField(obj,fieldID,val)
\r
1726 JNIEnv * env = FETCHENV;
\r
1733 (*env)->SetDoubleField(env, obj,fieldID,val);
\r
1738 GetStaticMethodID(clazz,name,sig)
\r
1739 JNIEnv * env = FETCHENV;
\r
1745 RETVAL = (*env)->GetStaticMethodID(env, clazz,name,sig);
\r
1752 CallStaticObjectMethod(clazz,methodID,...)
\r
1753 JNIEnv * env = FETCHENV;
\r
1755 jmethodID methodID
\r
1757 int argoff = $min_args;
\r
1760 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1761 RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
\r
1768 CallStaticObjectMethodA(clazz,methodID,args)
\r
1769 JNIEnv * env = FETCHENV;
\r
1771 jmethodID methodID
\r
1776 RETVAL = (*env)->CallStaticObjectMethodA(env, clazz,methodID,args);
\r
1783 CallStaticBooleanMethod(clazz,methodID,...)
\r
1784 JNIEnv * env = FETCHENV;
\r
1786 jmethodID methodID
\r
1788 int argoff = $min_args;
\r
1791 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1792 RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
\r
1799 CallStaticBooleanMethodA(clazz,methodID,args)
\r
1800 JNIEnv * env = FETCHENV;
\r
1802 jmethodID methodID
\r
1807 RETVAL = (*env)->CallStaticBooleanMethodA(env, clazz,methodID,args);
\r
1814 CallStaticByteMethod(clazz,methodID,...)
\r
1815 JNIEnv * env = FETCHENV;
\r
1817 jmethodID methodID
\r
1819 int argoff = $min_args;
\r
1822 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1823 RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
\r
1830 CallStaticByteMethodA(clazz,methodID,args)
\r
1831 JNIEnv * env = FETCHENV;
\r
1833 jmethodID methodID
\r
1838 RETVAL = (*env)->CallStaticByteMethodA(env, clazz,methodID,args);
\r
1845 CallStaticCharMethod(clazz,methodID,...)
\r
1846 JNIEnv * env = FETCHENV;
\r
1848 jmethodID methodID
\r
1850 int argoff = $min_args;
\r
1853 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1854 RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
\r
1861 CallStaticCharMethodA(clazz,methodID,args)
\r
1862 JNIEnv * env = FETCHENV;
\r
1864 jmethodID methodID
\r
1869 RETVAL = (*env)->CallStaticCharMethodA(env, clazz,methodID,args);
\r
1876 CallStaticShortMethod(clazz,methodID,...)
\r
1877 JNIEnv * env = FETCHENV;
\r
1879 jmethodID methodID
\r
1881 int argoff = $min_args;
\r
1884 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1885 RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
\r
1892 CallStaticShortMethodA(clazz,methodID,args)
\r
1893 JNIEnv * env = FETCHENV;
\r
1895 jmethodID methodID
\r
1900 RETVAL = (*env)->CallStaticShortMethodA(env, clazz,methodID,args);
\r
1907 CallStaticIntMethod(clazz,methodID,...)
\r
1908 JNIEnv * env = FETCHENV;
\r
1910 jmethodID methodID
\r
1912 int argoff = $min_args;
\r
1915 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1916 RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
\r
1923 CallStaticIntMethodA(clazz,methodID,args)
\r
1924 JNIEnv * env = FETCHENV;
\r
1926 jmethodID methodID
\r
1931 RETVAL = (*env)->CallStaticIntMethodA(env, clazz,methodID,args);
\r
1938 CallStaticLongMethod(clazz,methodID,...)
\r
1939 JNIEnv * env = FETCHENV;
\r
1941 jmethodID methodID
\r
1943 int argoff = $min_args;
\r
1946 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1947 RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
\r
1954 CallStaticLongMethodA(clazz,methodID,args)
\r
1955 JNIEnv * env = FETCHENV;
\r
1957 jmethodID methodID
\r
1962 RETVAL = (*env)->CallStaticLongMethodA(env, clazz,methodID,args);
\r
1969 CallStaticFloatMethod(clazz,methodID,...)
\r
1970 JNIEnv * env = FETCHENV;
\r
1972 jmethodID methodID
\r
1974 int argoff = $min_args;
\r
1977 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
1978 RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
\r
1985 CallStaticFloatMethodA(clazz,methodID,args)
\r
1986 JNIEnv * env = FETCHENV;
\r
1988 jmethodID methodID
\r
1993 RETVAL = (*env)->CallStaticFloatMethodA(env, clazz,methodID,args);
\r
2000 CallStaticDoubleMethod(clazz,methodID,...)
\r
2001 JNIEnv * env = FETCHENV;
\r
2003 jmethodID methodID
\r
2005 int argoff = $min_args;
\r
2008 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
2009 RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
\r
2016 CallStaticDoubleMethodA(clazz,methodID,args)
\r
2017 JNIEnv * env = FETCHENV;
\r
2019 jmethodID methodID
\r
2024 RETVAL = (*env)->CallStaticDoubleMethodA(env, clazz,methodID,args);
\r
2031 CallStaticVoidMethod(cls,methodID,...)
\r
2032 JNIEnv * env = FETCHENV;
\r
2034 jmethodID methodID
\r
2036 int argoff = $min_args;
\r
2039 jvalue * args = makeargs(sig, &ST(argoff), items - argoff);
\r
2040 (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
\r
2045 CallStaticVoidMethodA(cls,methodID,args)
\r
2046 JNIEnv * env = FETCHENV;
\r
2048 jmethodID methodID
\r
2053 (*env)->CallStaticVoidMethodA(env, cls,methodID,args);
\r
2058 GetStaticFieldID(clazz,name,sig)
\r
2059 JNIEnv * env = FETCHENV;
\r
2065 RETVAL = (*env)->GetStaticFieldID(env, clazz,name,sig);
\r
2072 GetStaticObjectField(clazz,fieldID)
\r
2073 JNIEnv * env = FETCHENV;
\r
2079 RETVAL = (*env)->GetStaticObjectField(env, clazz,fieldID);
\r
2086 GetStaticBooleanField(clazz,fieldID)
\r
2087 JNIEnv * env = FETCHENV;
\r
2093 RETVAL = (*env)->GetStaticBooleanField(env, clazz,fieldID);
\r
2100 GetStaticByteField(clazz,fieldID)
\r
2101 JNIEnv * env = FETCHENV;
\r
2107 RETVAL = (*env)->GetStaticByteField(env, clazz,fieldID);
\r
2114 GetStaticCharField(clazz,fieldID)
\r
2115 JNIEnv * env = FETCHENV;
\r
2121 RETVAL = (*env)->GetStaticCharField(env, clazz,fieldID);
\r
2128 GetStaticShortField(clazz,fieldID)
\r
2129 JNIEnv * env = FETCHENV;
\r
2135 RETVAL = (*env)->GetStaticShortField(env, clazz,fieldID);
\r
2142 GetStaticIntField(clazz,fieldID)
\r
2143 JNIEnv * env = FETCHENV;
\r
2149 RETVAL = (*env)->GetStaticIntField(env, clazz,fieldID);
\r
2156 GetStaticLongField(clazz,fieldID)
\r
2157 JNIEnv * env = FETCHENV;
\r
2163 RETVAL = (*env)->GetStaticLongField(env, clazz,fieldID);
\r
2170 GetStaticFloatField(clazz,fieldID)
\r
2171 JNIEnv * env = FETCHENV;
\r
2177 RETVAL = (*env)->GetStaticFloatField(env, clazz,fieldID);
\r
2184 GetStaticDoubleField(clazz,fieldID)
\r
2185 JNIEnv * env = FETCHENV;
\r
2191 RETVAL = (*env)->GetStaticDoubleField(env, clazz,fieldID);
\r
2198 SetStaticObjectField(clazz,fieldID,value)
\r
2199 JNIEnv * env = FETCHENV;
\r
2206 (*env)->SetStaticObjectField(env, clazz,fieldID,value);
\r
2211 SetStaticBooleanField(clazz,fieldID,value)
\r
2212 JNIEnv * env = FETCHENV;
\r
2219 (*env)->SetStaticBooleanField(env, clazz,fieldID,value);
\r
2224 SetStaticByteField(clazz,fieldID,value)
\r
2225 JNIEnv * env = FETCHENV;
\r
2232 (*env)->SetStaticByteField(env, clazz,fieldID,value);
\r
2237 SetStaticCharField(clazz,fieldID,value)
\r
2238 JNIEnv * env = FETCHENV;
\r
2245 (*env)->SetStaticCharField(env, clazz,fieldID,value);
\r
2250 SetStaticShortField(clazz,fieldID,value)
\r
2251 JNIEnv * env = FETCHENV;
\r
2258 (*env)->SetStaticShortField(env, clazz,fieldID,value);
\r
2263 SetStaticIntField(clazz,fieldID,value)
\r
2264 JNIEnv * env = FETCHENV;
\r
2271 (*env)->SetStaticIntField(env, clazz,fieldID,value);
\r
2276 SetStaticLongField(clazz,fieldID,value)
\r
2277 JNIEnv * env = FETCHENV;
\r
2284 (*env)->SetStaticLongField(env, clazz,fieldID,value);
\r
2289 SetStaticFloatField(clazz,fieldID,value)
\r
2290 JNIEnv * env = FETCHENV;
\r
2297 (*env)->SetStaticFloatField(env, clazz,fieldID,value);
\r
2302 SetStaticDoubleField(clazz,fieldID,value)
\r
2303 JNIEnv * env = FETCHENV;
\r
2310 (*env)->SetStaticDoubleField(env, clazz,fieldID,value);
\r
2315 NewString(unicode)
\r
2316 JNIEnv * env = FETCHENV;
\r
2317 STRLEN tmplen = NO_INIT;
\r
2318 jsize unicode_len_ = NO_INIT;
\r
2319 const jchar * unicode
\r
2322 RETVAL = (*env)->NewString(env, unicode, unicode_len_);
\r
2329 GetStringLength(str)
\r
2330 JNIEnv * env = FETCHENV;
\r
2334 RETVAL = (*env)->GetStringLength(env, str);
\r
2341 GetStringChars(str)
\r
2342 JNIEnv * env = FETCHENV;
\r
2344 jboolean isCopy = NO_INIT;
\r
2345 jsize RETVAL_len_ = NO_INIT;
\r
2348 RETVAL = (*env)->GetStringChars(env, str,&isCopy);
\r
2349 RETVAL_len_ = (*env)->GetStringLength(env, str);
\r
2355 (*env)->ReleaseStringChars(env, str,RETVAL);
\r
2359 JNIEnv * env = FETCHENV;
\r
2363 RETVAL = (*env)->NewStringUTF(env, utf);
\r
2370 GetStringUTFLength(str)
\r
2371 JNIEnv * env = FETCHENV;
\r
2375 RETVAL = (*env)->GetStringUTFLength(env, str);
\r
2382 GetStringUTFChars(str)
\r
2383 JNIEnv * env = FETCHENV;
\r
2385 jboolean isCopy = NO_INIT;
\r
2388 RETVAL = (*env)->GetStringUTFChars(env, str,&isCopy);
\r
2394 (*env)->ReleaseStringUTFChars(env, str, RETVAL);
\r
2398 GetArrayLength(array)
\r
2399 JNIEnv * env = FETCHENV;
\r
2403 RETVAL = (*env)->GetArrayLength(env, array);
\r
2410 NewObjectArray(len,clazz,init)
\r
2411 JNIEnv * env = FETCHENV;
\r
2417 RETVAL = (*env)->NewObjectArray(env, len,clazz,init);
\r
2424 GetObjectArrayElement(array,index)
\r
2425 JNIEnv * env = FETCHENV;
\r
2426 jobjectArray array
\r
2430 RETVAL = (*env)->GetObjectArrayElement(env, array,index);
\r
2437 SetObjectArrayElement(array,index,val)
\r
2438 JNIEnv * env = FETCHENV;
\r
2439 jobjectArray array
\r
2444 (*env)->SetObjectArrayElement(env, array,index,val);
\r
2449 NewBooleanArray(len)
\r
2450 JNIEnv * env = FETCHENV;
\r
2454 RETVAL = (*env)->NewBooleanArray(env, len);
\r
2462 JNIEnv * env = FETCHENV;
\r
2466 RETVAL = (*env)->NewByteArray(env, len);
\r
2474 JNIEnv * env = FETCHENV;
\r
2478 RETVAL = (*env)->NewCharArray(env, len);
\r
2485 NewShortArray(len)
\r
2486 JNIEnv * env = FETCHENV;
\r
2490 RETVAL = (*env)->NewShortArray(env, len);
\r
2498 JNIEnv * env = FETCHENV;
\r
2502 RETVAL = (*env)->NewIntArray(env, len);
\r
2510 JNIEnv * env = FETCHENV;
\r
2514 RETVAL = (*env)->NewLongArray(env, len);
\r
2521 NewFloatArray(len)
\r
2522 JNIEnv * env = FETCHENV;
\r
2526 RETVAL = (*env)->NewFloatArray(env, len);
\r
2533 NewDoubleArray(len)
\r
2534 JNIEnv * env = FETCHENV;
\r
2538 RETVAL = (*env)->NewDoubleArray(env, len);
\r
2545 GetBooleanArrayElements(array)
\r
2546 JNIEnv * env = FETCHENV;
\r
2547 jsize RETVAL_len_ = NO_INIT;
\r
2548 jbooleanArray array
\r
2549 jboolean isCopy = NO_INIT;
\r
2552 RETVAL = (*env)->GetBooleanArrayElements(env, array,&isCopy);
\r
2553 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2554 if (GIMME == G_ARRAY) {
\r
2556 jboolean* r = RETVAL;
\r
2557 EXTEND(sp, RETVAL_len_);
\r
2558 for (i = RETVAL_len_; i; --i) {
\r
2559 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2563 if (RETVAL_len_) {
\r
2564 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2565 (STRLEN)RETVAL_len_ * sizeof(jboolean))));
\r
2570 (*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2575 GetByteArrayElements(array)
\r
2576 JNIEnv * env = FETCHENV;
\r
2577 jsize RETVAL_len_ = NO_INIT;
\r
2579 jboolean isCopy = NO_INIT;
\r
2582 RETVAL = (*env)->GetByteArrayElements(env, array,&isCopy);
\r
2583 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2584 if (GIMME == G_ARRAY) {
\r
2586 jbyte* r = RETVAL;
\r
2587 EXTEND(sp, RETVAL_len_);
\r
2588 for (i = RETVAL_len_; i; --i) {
\r
2589 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2593 if (RETVAL_len_) {
\r
2594 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2595 (STRLEN)RETVAL_len_ * sizeof(jbyte))));
\r
2600 (*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2605 GetCharArrayElements(array)
\r
2606 JNIEnv * env = FETCHENV;
\r
2607 jsize RETVAL_len_ = NO_INIT;
\r
2609 jboolean isCopy = NO_INIT;
\r
2612 RETVAL = (*env)->GetCharArrayElements(env, array,&isCopy);
\r
2613 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2614 if (GIMME == G_ARRAY) {
\r
2616 jchar* r = RETVAL;
\r
2617 EXTEND(sp, RETVAL_len_);
\r
2618 for (i = RETVAL_len_; i; --i) {
\r
2619 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2623 if (RETVAL_len_) {
\r
2624 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2625 (STRLEN)RETVAL_len_ * sizeof(jchar))));
\r
2630 (*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2635 GetShortArrayElements(array)
\r
2636 JNIEnv * env = FETCHENV;
\r
2637 jsize RETVAL_len_ = NO_INIT;
\r
2639 jboolean isCopy = NO_INIT;
\r
2642 RETVAL = (*env)->GetShortArrayElements(env, array,&isCopy);
\r
2643 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2644 if (GIMME == G_ARRAY) {
\r
2646 jshort* r = RETVAL;
\r
2647 EXTEND(sp, RETVAL_len_);
\r
2648 for (i = RETVAL_len_; i; --i) {
\r
2649 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2653 if (RETVAL_len_) {
\r
2654 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2655 (STRLEN)RETVAL_len_ * sizeof(jshort))));
\r
2660 (*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2665 GetIntArrayElements(array)
\r
2666 JNIEnv * env = FETCHENV;
\r
2667 jsize RETVAL_len_ = NO_INIT;
\r
2669 jboolean isCopy = NO_INIT;
\r
2672 RETVAL = (*env)->GetIntArrayElements(env, array,&isCopy);
\r
2673 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2674 if (GIMME == G_ARRAY) {
\r
2677 EXTEND(sp, RETVAL_len_);
\r
2678 for (i = RETVAL_len_; i; --i) {
\r
2679 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2683 if (RETVAL_len_) {
\r
2684 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2685 (STRLEN)RETVAL_len_ * sizeof(jint))));
\r
2690 (*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2695 GetLongArrayElements(array)
\r
2696 JNIEnv * env = FETCHENV;
\r
2697 jsize RETVAL_len_ = NO_INIT;
\r
2699 jboolean isCopy = NO_INIT;
\r
2702 RETVAL = (*env)->GetLongArrayElements(env, array,&isCopy);
\r
2703 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2704 if (GIMME == G_ARRAY) {
\r
2706 jlong* r = RETVAL;
\r
2707 EXTEND(sp, RETVAL_len_);
\r
2708 for (i = RETVAL_len_; i; --i) {
\r
2709 PUSHs(sv_2mortal(newSViv(*r++)));
\r
2713 if (RETVAL_len_) {
\r
2714 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2715 (STRLEN)RETVAL_len_ * sizeof(jlong))));
\r
2720 (*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2725 GetFloatArrayElements(array)
\r
2726 JNIEnv * env = FETCHENV;
\r
2727 jsize RETVAL_len_ = NO_INIT;
\r
2729 jboolean isCopy = NO_INIT;
\r
2732 RETVAL = (*env)->GetFloatArrayElements(env, array,&isCopy);
\r
2733 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2734 if (GIMME == G_ARRAY) {
\r
2736 jfloat* r = RETVAL;
\r
2737 EXTEND(sp, RETVAL_len_);
\r
2738 for (i = RETVAL_len_; i; --i) {
\r
2739 PUSHs(sv_2mortal(newSVnv(*r++)));
\r
2743 if (RETVAL_len_) {
\r
2744 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2745 (STRLEN)RETVAL_len_ * sizeof(jfloat))));
\r
2750 (*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2755 GetDoubleArrayElements(array)
\r
2756 JNIEnv * env = FETCHENV;
\r
2757 jsize RETVAL_len_ = NO_INIT;
\r
2758 jdoubleArray array
\r
2759 jboolean isCopy = NO_INIT;
\r
2762 RETVAL = (*env)->GetDoubleArrayElements(env, array,&isCopy);
\r
2763 RETVAL_len_ = (*env)->GetArrayLength(env, array);
\r
2764 if (GIMME == G_ARRAY) {
\r
2766 jdouble* r = RETVAL;
\r
2767 EXTEND(sp, RETVAL_len_);
\r
2768 for (i = RETVAL_len_; i; --i) {
\r
2769 PUSHs(sv_2mortal(newSVnv(*r++)));
\r
2773 if (RETVAL_len_) {
\r
2774 PUSHs(sv_2mortal(newSVpvn((char*)RETVAL,
\r
2775 (STRLEN)RETVAL_len_ * sizeof(jdouble))));
\r
2780 (*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);
\r
2785 GetBooleanArrayRegion(array,start,len,buf)
\r
2786 JNIEnv * env = FETCHENV;
\r
2787 jbooleanArray array
\r
2790 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2791 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2792 jboolean * buf = (jboolean*)sv_grow(ST(3),len * sizeof(jboolean)+1);
\r
2795 (*env)->GetBooleanArrayRegion(env, array,start,len,buf);
\r
2796 SvCUR_set(ST(3), len * sizeof(jboolean));
\r
2797 *SvEND(ST(3)) = '\0';
\r
2802 GetByteArrayRegion(array,start,len,buf)
\r
2803 JNIEnv * env = FETCHENV;
\r
2807 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2808 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2809 jbyte * buf = (jbyte*)sv_grow(ST(3),len * sizeof(jbyte)+1);
\r
2812 (*env)->GetByteArrayRegion(env, array,start,len,buf);
\r
2813 SvCUR_set(ST(3), len * sizeof(jbyte));
\r
2814 *SvEND(ST(3)) = '\0';
\r
2819 GetCharArrayRegion(array,start,len,buf)
\r
2820 JNIEnv * env = FETCHENV;
\r
2824 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2825 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2826 jchar * buf = (jchar*)sv_grow(ST(3),len * sizeof(jchar)+1);
\r
2829 (*env)->GetCharArrayRegion(env, array,start,len,buf);
\r
2830 SvCUR_set(ST(3), len * sizeof(jchar));
\r
2831 *SvEND(ST(3)) = '\0';
\r
2836 GetShortArrayRegion(array,start,len,buf)
\r
2837 JNIEnv * env = FETCHENV;
\r
2841 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2842 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2843 jshort * buf = (jshort*)sv_grow(ST(3),len * sizeof(jshort)+1);
\r
2846 (*env)->GetShortArrayRegion(env, array,start,len,buf);
\r
2847 SvCUR_set(ST(3), len * sizeof(jshort));
\r
2848 *SvEND(ST(3)) = '\0';
\r
2853 GetIntArrayRegion(array,start,len,buf)
\r
2854 JNIEnv * env = FETCHENV;
\r
2858 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2859 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2860 jint * buf = (jint*)sv_grow(ST(3),len * sizeof(jint)+1);
\r
2863 (*env)->GetIntArrayRegion(env, array,start,len,buf);
\r
2864 SvCUR_set(ST(3), len * sizeof(jint));
\r
2865 *SvEND(ST(3)) = '\0';
\r
2870 GetLongArrayRegion(array,start,len,buf)
\r
2871 JNIEnv * env = FETCHENV;
\r
2875 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2876 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2877 jlong * buf = (jlong*)sv_grow(ST(3),len * sizeof(jlong)+1);
\r
2880 (*env)->GetLongArrayRegion(env, array,start,len,buf);
\r
2881 SvCUR_set(ST(3), len * sizeof(jlong));
\r
2882 *SvEND(ST(3)) = '\0';
\r
2887 GetFloatArrayRegion(array,start,len,buf)
\r
2888 JNIEnv * env = FETCHENV;
\r
2892 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2893 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2894 jfloat * buf = (jfloat*)sv_grow(ST(3),len * sizeof(jfloat)+1);
\r
2897 (*env)->GetFloatArrayRegion(env, array,start,len,buf);
\r
2898 SvCUR_set(ST(3), len * sizeof(jfloat));
\r
2899 *SvEND(ST(3)) = '\0';
\r
2904 GetDoubleArrayRegion(array,start,len,buf)
\r
2905 JNIEnv * env = FETCHENV;
\r
2906 jdoubleArray array
\r
2909 STRLEN tmplen = len * sizeof(jboolean) + 1;
\r
2910 char * tmpbuf = (char*)sv_pvn_force(ST(3), &tmplen);
\r
2911 jdouble * buf = (jdouble*)sv_grow(ST(3),len * sizeof(jdouble)+1);
\r
2914 (*env)->GetDoubleArrayRegion(env, array,start,len,buf);
\r
2915 SvCUR_set(ST(3), len * sizeof(jdouble));
\r
2916 *SvEND(ST(3)) = '\0';
\r
2921 SetBooleanArrayRegion(array,start,len,buf)
\r
2922 JNIEnv * env = FETCHENV;
\r
2923 STRLEN tmplen = NO_INIT;
\r
2924 jbooleanArray array
\r
2927 jsize buf_len_ = NO_INIT;
\r
2931 if (buf_len_ < len)
\r
2932 croak("string is too short");
\r
2933 else if (buf_len_ > len && PL_dowarn)
\r
2934 warn("string is too long");
\r
2935 (*env)->SetBooleanArrayRegion(env, array,start,len,buf);
\r
2940 SetByteArrayRegion(array,start,len,buf)
\r
2941 JNIEnv * env = FETCHENV;
\r
2942 STRLEN tmplen = NO_INIT;
\r
2946 jsize buf_len_ = NO_INIT;
\r
2950 if (buf_len_ < len)
\r
2951 croak("string is too short");
\r
2952 else if (buf_len_ > len && PL_dowarn)
\r
2953 warn("string is too long");
\r
2954 (*env)->SetByteArrayRegion(env, array,start,len,buf);
\r
2959 SetCharArrayRegion(array,start,len,buf)
\r
2960 JNIEnv * env = FETCHENV;
\r
2961 STRLEN tmplen = NO_INIT;
\r
2965 jsize buf_len_ = NO_INIT;
\r
2969 if (buf_len_ < len)
\r
2970 croak("string is too short");
\r
2971 else if (buf_len_ > len && PL_dowarn)
\r
2972 warn("string is too long");
\r
2973 (*env)->SetCharArrayRegion(env, array,start,len,buf);
\r
2978 SetShortArrayRegion(array,start,len,buf)
\r
2979 JNIEnv * env = FETCHENV;
\r
2980 STRLEN tmplen = NO_INIT;
\r
2984 jsize buf_len_ = NO_INIT;
\r
2988 if (buf_len_ < len)
\r
2989 croak("string is too short");
\r
2990 else if (buf_len_ > len && PL_dowarn)
\r
2991 warn("string is too long");
\r
2992 (*env)->SetShortArrayRegion(env, array,start,len,buf);
\r
2997 SetIntArrayRegion(array,start,len,buf)
\r
2998 JNIEnv * env = FETCHENV;
\r
2999 STRLEN tmplen = NO_INIT;
\r
3003 jsize buf_len_ = NO_INIT;
\r
3007 if (buf_len_ < len)
\r
3008 croak("string is too short");
\r
3009 else if (buf_len_ > len && PL_dowarn)
\r
3010 warn("string is too long");
\r
3011 (*env)->SetIntArrayRegion(env, array,start,len,buf);
\r
3016 SetLongArrayRegion(array,start,len,buf)
\r
3017 JNIEnv * env = FETCHENV;
\r
3018 STRLEN tmplen = NO_INIT;
\r
3022 jsize buf_len_ = NO_INIT;
\r
3026 if (buf_len_ < len)
\r
3027 croak("string is too short");
\r
3028 else if (buf_len_ > len && PL_dowarn)
\r
3029 warn("string is too long");
\r
3030 (*env)->SetLongArrayRegion(env, array,start,len,buf);
\r
3035 SetFloatArrayRegion(array,start,len,buf)
\r
3036 JNIEnv * env = FETCHENV;
\r
3037 STRLEN tmplen = NO_INIT;
\r
3041 jsize buf_len_ = NO_INIT;
\r
3045 if (buf_len_ < len)
\r
3046 croak("string is too short");
\r
3047 else if (buf_len_ > len && PL_dowarn)
\r
3048 warn("string is too long");
\r
3049 (*env)->SetFloatArrayRegion(env, array,start,len,buf);
\r
3054 SetDoubleArrayRegion(array,start,len,buf)
\r
3055 JNIEnv * env = FETCHENV;
\r
3056 STRLEN tmplen = NO_INIT;
\r
3057 jdoubleArray array
\r
3060 jsize buf_len_ = NO_INIT;
\r
3064 if (buf_len_ < len)
\r
3065 croak("string is too short");
\r
3066 else if (buf_len_ > len && PL_dowarn)
\r
3067 warn("string is too long");
\r
3068 (*env)->SetDoubleArrayRegion(env, array,start,len,buf);
\r
3073 RegisterNatives(clazz,methods,nMethods)
\r
3074 JNIEnv * env = FETCHENV;
\r
3076 JNINativeMethod * methods
\r
3080 RETVAL = (*env)->RegisterNatives(env, clazz,methods,nMethods);
\r
3084 UnregisterNatives(clazz)
\r
3085 JNIEnv * env = FETCHENV;
\r
3089 RETVAL = (*env)->UnregisterNatives(env, clazz);
\r
3096 JNIEnv * env = FETCHENV;
\r
3100 RETVAL = (*env)->MonitorEnter(env, obj);
\r
3108 JNIEnv * env = FETCHENV;
\r
3112 RETVAL = (*env)->MonitorExit(env, obj);
\r
3120 JNIEnv * env = FETCHENV;
\r
3128 if (env) { /* We're embedded. */
\r
3129 if ((*env)->GetJavaVM(env, &RETVAL) < 0)
\r
3132 else { /* We're embedding. */
\r
3134 JavaVMInitArgs vm_args;
\r
3136 JDK1_1InitArgs vm_args;
\r
3140 fprintf(stderr, "We're embedding Java in Perl.\n");
\r
3145 lib = SvPV(*mark, PL_na);
\r
3150 fprintf(stderr, "lib is %s.\n", lib);
\r
3153 if (LoadLibrary("jvm.dll")) {
\r
3154 if (!LoadLibrary("javai.dll")) {
\r
3155 warn("Can't load javai.dll");
\r
3158 if (lib && !LoadLibrary(lib))
\r
3159 croak("Can't load javai.dll");
\r
3163 fprintf(stderr, "Opening Java shared library.\n");
\r
3166 if (!dlopen("libkaffevm.so", RTLD_LAZY|RTLD_GLOBAL)) {
\r
3168 if (!dlopen("libjava.so", RTLD_LAZY|RTLD_GLOBAL)) {
\r
3170 if (lib && !dlopen(lib, RTLD_LAZY|RTLD_GLOBAL))
\r
3171 croak("Can't load Java shared library.");
\r
3174 /* Kaffe seems to get very upset if vm_args.version isn't set */
\r
3176 vm_args.version = JNI_VERSION_1_1;
\r
3178 JNI_GetDefaultJavaVMInitArgs(&vm_args);
\r
3179 vm_args.exit = &call_my_exit;
\r
3181 fprintf(stderr, "items = %d\n", items);
\r
3182 fprintf(stderr, "mark = %s\n", SvPV(*mark, PL_na));
\r
3184 while (items > 1) {
\r
3187 s = SvPV(*mark,PL_na);
\r
3190 fprintf(stderr, "*s = %s\n", s);
\r
3191 fprintf(stderr, "val = %s\n", SvPV(*mark, PL_na));
\r
3194 if (strEQ(s, "checkSource"))
\r
3195 vm_args.checkSource = (jint)SvIV(*mark);
\r
3196 else if (strEQ(s, "nativeStackSize"))
\r
3197 vm_args.nativeStackSize = (jint)SvIV(*mark);
\r
3198 else if (strEQ(s, "javaStackSize"))
\r
3199 vm_args.javaStackSize = (jint)SvIV(*mark);
\r
3200 else if (strEQ(s, "minHeapSize"))
\r
3201 vm_args.minHeapSize = (jint)SvIV(*mark);
\r
3202 else if (strEQ(s, "maxHeapSize"))
\r
3203 vm_args.maxHeapSize = (jint)SvIV(*mark);
\r
3204 else if (strEQ(s, "verifyMode"))
\r
3205 vm_args.verifyMode = (jint)SvIV(*mark);
\r
3206 else if (strEQ(s, "classpath"))
\r
3207 vm_args.classpath = savepv(SvPV(*mark,PL_na));
\r
3208 else if (strEQ(s, "enableClassGC"))
\r
3209 vm_args.enableClassGC = (jint)SvIV(*mark);
\r
3210 else if (strEQ(s, "enableVerboseGC"))
\r
3211 vm_args.enableVerboseGC = (jint)SvIV(*mark);
\r
3212 else if (strEQ(s, "disableAsyncGC"))
\r
3213 vm_args.disableAsyncGC = (jint)SvIV(*mark);
\r
3215 else if (strEQ(s, "libraryhome"))
\r
3216 vm_args.libraryhome = savepv(SvPV(*mark,PL_na));
\r
3217 else if (strEQ(s, "classhome"))
\r
3218 vm_args.classhome = savepv(SvPV(*mark,PL_na));
\r
3219 else if (strEQ(s, "enableVerboseJIT"))
\r
3220 vm_args.enableVerboseJIT = (jint)SvIV(*mark);
\r
3221 else if (strEQ(s, "enableVerboseClassloading"))
\r
3222 vm_args.enableVerboseClassloading = (jint)SvIV(*mark);
\r
3223 else if (strEQ(s, "enableVerboseCall"))
\r
3224 vm_args.enableVerboseCall = (jint)SvIV(*mark);
\r
3225 else if (strEQ(s, "allocHeapSize"))
\r
3226 vm_args.allocHeapSize = (jint)SvIV(*mark);
\r
3228 else if (strEQ(s, "verbose"))
\r
3229 vm_args.verbose = (jint)SvIV(*mark);
\r
3230 else if (strEQ(s, "debugging"))
\r
3231 vm_args.debugging = (jboolean)SvIV(*mark);
\r
3232 else if (strEQ(s, "debugPort"))
\r
3233 vm_args.debugPort = (jint)SvIV(*mark);
\r
3236 croak("unrecognized option: %s", s);
\r
3240 fprintf(stderr, "Creating Java VM...\n");
\r
3241 fprintf(stderr, "Working CLASSPATH: %s\n",
\r
3242 vm_args.classpath);
\r
3244 if (JNI_CreateJavaVM(&RETVAL, &jplcurenv, &vm_args) < 0) {
\r
3245 croak("Unable to create instance of JVM");
\r
3248 fprintf(stderr, "Created Java VM.\n");
\r