summaryrefslogtreecommitdiff
path: root/jpl/PerlInterpreter
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-09-15 02:57:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-09-15 02:57:08 +0000
commitb83c0eaa789c1e1527712ef4c3c985dde6539c3a (patch)
tree1d9da4e0d93624e886b42e699519739dcf6c0d7f /jpl/PerlInterpreter
parent30944b6df13d14ca352a3fdf86275e7fe6eb44b5 (diff)
downloadperl-b83c0eaa789c1e1527712ef4c3c985dde6539c3a.tar.gz
update to JPL snapshot v09141999, with minor tweaks (from Brian
Jepson <bjepson@home.com>) p4raw-id: //depot/perl@4159
Diffstat (limited to 'jpl/PerlInterpreter')
-rw-r--r--jpl/PerlInterpreter/Makefile.PL8
-rw-r--r--jpl/PerlInterpreter/PerlInterpreter.c45
-rw-r--r--jpl/PerlInterpreter/PerlInterpreter.h2
3 files changed, 45 insertions, 10 deletions
diff --git a/jpl/PerlInterpreter/Makefile.PL b/jpl/PerlInterpreter/Makefile.PL
index 76852c6cc8..b8b20f1e69 100644
--- a/jpl/PerlInterpreter/Makefile.PL
+++ b/jpl/PerlInterpreter/Makefile.PL
@@ -9,12 +9,16 @@ eval `$JPL_SRC/setvars -perl`;
if ($^O eq 'linux') {
$flags = "-Dbool=char"; # avoid builtin bool altogether
$libs = "-lc -lm -ldl";
-}
-else {
+} else {
$flags = "";
$libs = "-lc -lm -ldl";
}
+# Needed for JNI.
+if ($^O eq 'solaris') {
+ $libs .= " -lthread";
+}
+
open(MAKEFILE, ">Makefile");
print MAKEFILE <<"SUBS";
diff --git a/jpl/PerlInterpreter/PerlInterpreter.c b/jpl/PerlInterpreter/PerlInterpreter.c
index b229d130b3..8134f0c9f5 100644
--- a/jpl/PerlInterpreter/PerlInterpreter.c
+++ b/jpl/PerlInterpreter/PerlInterpreter.c
@@ -8,6 +8,37 @@
#include "EXTERN.h"
#include "perl.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
+# define PL_curinterp curinterp
+# define PL_do_undump do_undump
+# define PL_perl_destruct_level perl_destruct_level
+# define ERRSV GvSV(errgv)
+#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 EXTERN_C
# ifdef __cplusplus
# define EXTERN_C extern "C"
@@ -46,6 +77,8 @@ Java_PerlInterpreter_init(JNIEnv *env, jobject obj, jstring js)
if (PL_curinterp)
return;
+ perl_init_i18nl10n(1);
+
if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
@@ -62,21 +95,20 @@ Java_PerlInterpreter_init(JNIEnv *env, jobject obj, jstring js)
}
JNIEXPORT void JNICALL
-Java_PerlInterpreter_eval(void *perl, JNIEnv *env, jobject obj, jstring js)
+Java_PerlInterpreter_eval(JNIEnv *env, jobject obj, jstring js)
{
SV* envsv;
SV* objsv;
dSP;
jbyte* jb;
- dTHXa(perl);
ENTER;
SAVETMPS;
jplcurenv = env;
- envsv = get_sv("JPL::_env_", 1);
+ envsv = perl_get_sv("JPL::_env_", 1);
sv_setiv(envsv, (IV)(void*)env);
- objsv = get_sv("JPL::_obj_", 1);
+ objsv = perl_get_sv("JPL::_obj_", 1);
sv_setiv(objsv, (IV)(void*)obj);
jb = (jbyte*)(*env)->GetStringUTFChars(env,js,0);
@@ -84,7 +116,7 @@ Java_PerlInterpreter_eval(void *perl, JNIEnv *env, jobject obj, jstring js)
if (jpldebug)
fprintf(stderr, "eval %s\n", (char*)jb);
- eval_pv( (char*)jb, 0 );
+ perl_eval_pv( (char*)jb, 0 );
if (SvTRUE(ERRSV)) {
jthrowable newExcCls;
@@ -105,9 +137,8 @@ Java_PerlInterpreter_eval(void *perl, JNIEnv *env, jobject obj, jstring js)
/*
JNIEXPORT jint JNICALL
-Java_PerlInterpreter_eval(void *perl, JNIEnv *env, jobject obj, jint ji)
+Java_PerlInterpreter_eval(JNIEnv *env, jobject obj, jint ji)
{
- dTHXa(perl);
op = (OP*)(void*)ji;
op = (*op->op_ppaddr)(pTHX);
return (jint)(void*)op;
diff --git a/jpl/PerlInterpreter/PerlInterpreter.h b/jpl/PerlInterpreter/PerlInterpreter.h
index 4927a5f6fb..22fdf526dc 100644
--- a/jpl/PerlInterpreter/PerlInterpreter.h
+++ b/jpl/PerlInterpreter/PerlInterpreter.h
@@ -21,7 +21,7 @@ JNIEXPORT void JNICALL Java_PerlInterpreter_init
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_PerlInterpreter_eval
- (void *perl, JNIEnv *, jobject, jstring);
+ (JNIEnv *, jobject, jstring);
#ifdef __cplusplus
}