* This package may be copied under the same terms as Perl itself.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
-#ifdef __cplusplus
-}
-#endif
#include <perl.h>
#include <jni.h>
char *s = sig;
JNIEnv* env = jplcurenv;
char *start;
+ STRLEN n_a;
if (jpldebug)
fprintf(stderr, "sig = %s, items = %d\n", sig, items);
jsize len = sv_len(sv) / sizeof(jboolean);
jbooleanArray ja = (*env)->NewBooleanArray(env, len);
- (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,na));
+ (*env)->SetBooleanArrayRegion(env, ja, 0, len, (jboolean*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jbyte);
jbyteArray ja = (*env)->NewByteArray(env, len);
- (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,na));
+ (*env)->SetByteArrayRegion(env, ja, 0, len, (jbyte*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jchar);
jcharArray ja = (*env)->NewCharArray(env, len);
- (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,na));
+ (*env)->SetCharArrayRegion(env, ja, 0, len, (jchar*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jshort);
jshortArray ja = (*env)->NewShortArray(env, len);
- (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,na));
+ (*env)->SetShortArrayRegion(env, ja, 0, len, (jshort*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jint);
jintArray ja = (*env)->NewIntArray(env, len);
- (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,na));
+ (*env)->SetIntArrayRegion(env, ja, 0, len, (jint*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jlong);
jlongArray ja = (*env)->NewLongArray(env, len);
- (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,na));
+ (*env)->SetLongArrayRegion(env, ja, 0, len, (jlong*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jfloat);
jfloatArray ja = (*env)->NewFloatArray(env, len);
- (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,na));
+ (*env)->SetFloatArrayRegion(env, ja, 0, len, (jfloat*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
jsize len = sv_len(sv) / sizeof(jdouble);
jdoubleArray ja = (*env)->NewDoubleArray(env, len);
- (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,na));
+ (*env)->SetDoubleArrayRegion(env, ja, 0, len, (jdouble*)SvPV(sv,n_a));
jv[ix++].l = (jobject)ja;
}
else
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,na));
+ jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,n_a));
(*env)->SetObjectArrayElement(env, ja, i, str);
}
jv[ix++].l = (jobject)ja;
}
else {
jobject str = (jobject)(*env)->NewStringUTF(env,
- SvPV(*esv,na));
+ SvPV(*esv,n_a));
(*env)->SetObjectArrayElement(env, ja, i, str);
}
}
if (!SvROK(sv) || strnEQ(s, "java/lang/String;", 17)) {
s += 17;
jv[ix++].l = (jobject)(*env)->NewStringUTF(env,
- (char*) SvPV(sv,na));
+ (char*) SvPV(sv,n_a));
break;
}
while (*s != ';') s++;
(STRLEN)RETVAL_len_ * sizeof(jboolean))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseBooleanArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jbyte))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseByteArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jchar))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseCharArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jshort))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseShortArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jint))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseIntArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jlong))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseLongArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jfloat))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseFloatArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
(STRLEN)RETVAL_len_ * sizeof(jdouble))));
}
else
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
(*env)->ReleaseDoubleArrayElements(env, array,RETVAL,JNI_ABORT);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetBooleanArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetByteArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetCharArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetShortArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetIntArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetLongArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetFloatArrayRegion(env, array,start,len,buf);
RESTOREENV;
{
if (buf_len_ < len)
croak("string is too short");
- else if (buf_len_ > len && dowarn)
+ else if (buf_len_ > len && PL_dowarn)
warn("string is too long");
(*env)->SetDoubleArrayRegion(env, array,start,len,buf);
RESTOREENV;
if (items--) {
++mark;
- lib = SvPV(*mark, na);
+ lib = SvPV(*mark, PL_na);
}
else
lib = 0;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
vm_args.exit = &call_my_exit;
while (items > 1) {
- char *s = SvPV(*++mark,na);
+ char *s = SvPV(*++mark,PL_na);
items -= 2;
if (strEQ(s, "checkSource"))
vm_args.checkSource = (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,na));
+ vm_args.classpath = savepv(SvPV(*++mark,PL_na));
else if (strEQ(s, "enableClassGC"))
vm_args.enableClassGC = (jint)SvIV(*++mark);
else if (strEQ(s, "enableVerboseGC"))
$var = ($type)(void*)SvIV(SvRV($arg));
}
else
- $var = ($type)(*env)->NewStringUTF(env, (char *) SvPV($arg,na))
+ $var = ($type)(*env)->NewStringUTF(env, (char *) SvPV($arg,PL_na))
T_JVALUELIST
if (SvROK($arg)) {
AV* av = (AV*)SvRV($arg);
T_JIDSIG
{
$var = ($type)SvIV($arg);
- sig = (char*)SvPV($arg,na);
+ sig = (char*)SvPV($arg,PL_na);
}
T_JPTROBJ
if (SvROK($arg) && SvOBJECT(SvRV($arg))) {
# T_U_LONG
# $var = (unsigned long)SvIV($arg)
# T_CHAR
-# $var = (char)*SvPV($arg,na)
+# $var = (char)*SvPV($arg,PL_na)
# T_U_CHAR
# $var = (unsigned char)SvIV($arg)
# T_FLOAT
# T_DOUBLE
# $var = (double)SvNV($arg)
# T_PV
-# $var = ($type)SvPV($arg,na)
+# $var = ($type)SvPV($arg,PL_na)
# T_PTR
# $var = ($type)SvIV($arg)
# T_PTRREF
# T_OPAQUE
# $var NOT IMPLEMENTED
# T_OPAQUEPTR
-# $var = ($type)SvPV($arg,na)
+# $var = ($type)SvPV($arg,PL_na)
# T_PACKED
# $var = XS_unpack_$ntype($arg)
# T_PACKEDARRAY
# if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) )
# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
# else
-# $arg = &sv_undef;
+# $arg = &PL_sv_undef;
# }
# T_INOUT
# {
# if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
# else
-# $arg = &sv_undef;
+# $arg = &PL_sv_undef;
# }
# T_OUT
# {
# if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
# sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
# else
-# $arg = &sv_undef;
+# $arg = &PL_sv_undef;
# }
emit <<"";
! PUTBACK;
! if (perl_call_sv(methodsv, G_EVAL|G_KEEPERR))
-! retsv = *stack_sp--;
+! retsv = *PL_stack_sp--;
! else
-! retsv = &sv_undef;
+! retsv = &PL_sv_undef;
!
}
emit <<"";
-! if (SvTRUE(GvSV(errgv))) {
+! if (SvTRUE(ERRSV)) {
! jthrowable newExcCls;
!
! (*env)->ExceptionDescribe(env);
!
! newExcCls = (*env)->FindClass(env, "java/lang/RuntimeException");
! if (newExcCls)
-! (*env)->ThrowNew(env, newExcCls, SvPV(GvSV(errgv),na));
+! (*env)->ThrowNew(env, newExcCls, SvPV(ERRSV,PL_na));
! }
!
}
elsif ($sig =~ s#^Ljava/lang/String;##) {
emit <<"";
-! retval = (*env)->NewStringUTF(env, SvPV(retsv,na));
+! retval = (*env)->NewStringUTF(env, SvPV(retsv,PL_na));
! FREETMPS;
! LEAVE;
! return retval;
! jsize len = sv_len(retsv) / sizeof($ntype);
!
! ${ntype}Array ja = (*env)->New${ptype}Array(env, len);
-! (*env)->Set${ptype}ArrayRegion(env, ja, 0, len, ($ntype*)SvPV(retsv,na));
+! (*env)->Set${ptype}ArrayRegion(env, ja, 0, len, ($ntype*)SvPV(retsv,PL_na));
! retval = ($rettype)ja;
! }
! else
! 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,na));
+! jobject str = (jobject)(*env)->NewStringUTF(env, SvPV(*esv,PL_na));
! (*env)->SetObjectArrayElement(env, ja, i, str);
! }
! retval = ($rettype)ja;
! }
! else {
! jobject str = (jobject)(*env)->NewStringUTF(env,
-! SvPV(*esv,na));
+! SvPV(*esv,PL_na));
! (*env)->SetObjectArrayElement(env, ja, i, str);
! }
! }
!
!#include "$hfile"
!
-!#ifdef __cplusplus
-!extern "C" {
-!#endif
-!
!#include "EXTERN.h"
!#include "perl.h"
!
-!#ifdef __cplusplus
-!}
-!# define EXTERN_C extern "C"
-!#else
-!# define EXTERN_C extern
+!#ifndef EXTERN_C
+!# ifdef __cplusplus
+!# define EXTERN_C extern "C"
+!# else
+!# define EXTERN_C extern
+!# endif
!#endif
!
!extern int jpldebug;