[libinline-java-perl] 342/398: ok

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.55
in repository libinline-java-perl.

commit 2db8e905007c0026e5ecb50c974944c38e8fb7b5
Author: patrick_leb <>
Date:   Sun Apr 10 13:07:46 2005 +0000

    ok
---
 CHANGES                                            |   4 +-
 Java/Class.pm                                      |  18 +--
 Java/PerlInterpreter/dougm/PerlInterpreter.tar.gz  | Bin 3116 -> 0 bytes
 Java/PerlInterpreter/dougm/README                  |  20 ---
 Java/PerlInterpreter/dougm/build.xml               |  19 ---
 Java/PerlInterpreter/dougm/inline.pat              |  55 --------
 .../dougm/src/jni/PerlInterpreter.c                | 147 ---------------------
 .../dougm/src/org/perl/PerlException.java          |  12 --
 .../dougm/src/org/perl/PerlInterpreter.java        |  34 -----
 Java/PerlInterpreter/dougm/test.pl                 |  12 --
 Java/PerlInterpreter/dougm/test.sh                 |   5 -
 .../org/perl/inline/java/InlineJavaServer.java     |  36 +++--
 TODO                                               |   2 +-
 bug/Hi3.pm                                         |  19 +++
 bug/Higher.class                                   | Bin 0 -> 607 bytes
 bug/Higher.jar                                     | Bin 0 -> 1284 bytes
 bug/Higher.java                                    |  28 ++++
 bug/Lower.class                                    | Bin 0 -> 502 bytes
 bug/PKG1.pm                                        |  25 ++++
 bug/PKG2.pm                                        |  14 ++
 bug/XDB.class                                      | Bin 0 -> 1682 bytes
 bug/XDB_TestHarness.class                          | Bin 0 -> 1538 bytes
 bug/XDB_TestHarness.java                           | 109 +++++++++++++++
 bug/inline3.pl                                     |   8 ++
 gcj/java                                           |   3 -
 gcj/javac                                          |   3 -
 t/02_primitives.t                                  |  68 +++-------
 27 files changed, 263 insertions(+), 378 deletions(-)

diff --git a/CHANGES b/CHANGES
index dc4b030..67e9ac3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,7 +6,9 @@ Revision history for Perl extension Inline::Java
     - Fixed bug with regexp that was badly interpreted under the debugger
     - Extended InlineJavaClassLoader from current thread ClassLoader to enable it to work
       properly under Tomcat
-    - Fixed bug with longs over 32 bits in length
+    - Include patch by Ihab Awad that allows running the JVM server inside Tomcat
+    - Fixed bug with longs over 32 bits in length and loosened boundary checking in numeric values
+      since it was not portable
     - Other minor bug fixes
 
 0.49  
diff --git a/Java/Class.pm b/Java/Class.pm
index f69efcc..c2130db 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -28,24 +28,24 @@ my $RANGE = {
 		MAX => 2147483647,
 		MIN => -2147483648,
 	},
-	'java.lang.Long' => {
-		REGEXP => $INT_RE,
-		MAX => 9223372036854775807,
-		MIN => -9223372036854775808,
-	},
 	'java.lang.Float' => {
 		REGEXP => $FLOAT_RE,
 		MAX => 3.4028235e38,
 		MIN => -3.4028235e38,
-		POS_MIN	=> 1.4e-45,
-		NEG_MAX => -1.4e-45,
+		# POS_MIN	=> 1.4e-45,
+		# NEG_MAX => -1.4e-45,
+	},
+	'java.lang.Long' => {
+		REGEXP => $INT_RE,
+		# MAX => 9223372036854775807,
+		# MIN => -9223372036854775808,
 	},
 	'java.lang.Double' => {
 		REGEXP => $FLOAT_RE,
 		# MAX => 1.79e308,
 		# MIN => -1.79e308,
-		POS_MIN => 4.9e-324,
-		NEG_MAX => -4.9e-324,
+		# POS_MIN => 4.9e-324,
+		# NEG_MAX => -4.9e-324,
 	},
 } ;
 $RANGE->{byte} = $RANGE->{'java.lang.Byte'} ;
diff --git a/Java/PerlInterpreter/dougm/PerlInterpreter.tar.gz b/Java/PerlInterpreter/dougm/PerlInterpreter.tar.gz
deleted file mode 100644
index 91035e3..0000000
Binary files a/Java/PerlInterpreter/dougm/PerlInterpreter.tar.gz and /dev/null differ
diff --git a/Java/PerlInterpreter/dougm/README b/Java/PerlInterpreter/dougm/README
deleted file mode 100644
index 77fc580..0000000
--- a/Java/PerlInterpreter/dougm/README
+++ /dev/null
@@ -1,20 +0,0 @@
----------------------------- Original Message ----------------------------
-Subject: Re: PerlInterpreter in Java
-From:    "Doug MacEachern" <dougm at covalent.net>
-Date:    Fri, September 26, 2003 12:42 pm
-To:      "Patrick LeBoutillier" <patrick_leboutillier at hotmail.com>
---------------------------------------------------------------------------
-
-hi patrick,
-
-i never got around to publishing the code.  i've attached the basics, 
-which i haven't touched since march.  never got past the experimental 
-stage.  the libPerlInterpreter.so is actually built using perl -x 
-PerlInterpreter.c.  i think that's the toughest part, getting things to 
-link properly on all platforms.  the code itself is pretty simple. just
-skimmed it and noticed a few leaks, missing ReleaseString calls. there is
-a little test invoked via PerlInterpreter.main()
-you're welcome to use the attached code in Inline::Java.  i don't expect 
-to have time to work on it, the code would be better off in your hands 
-anyhow.  but i haven't lost interest and would be happy to try out any of 
-your work in progress.
diff --git a/Java/PerlInterpreter/dougm/build.xml b/Java/PerlInterpreter/dougm/build.xml
deleted file mode 100644
index 5eb6152..0000000
--- a/Java/PerlInterpreter/dougm/build.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<project name="PerlInterpreter" default="dist" basedir=".">
-  <target name="init">
-    <mkdir dir="build/classes"/>
-  </target>
-  
-  <target name="compile" depends="init">
-    <javac srcdir="src" destdir="build/classes"/>
-  </target>
-  
-  <target name="dist" depends="compile">
-    <mkdir dir="dist/lib"/>
-    <jar jarfile="dist/lib/PerlInterpreter.jar" basedir="build/classes"/>
-  </target>
-  
-  <target name="clean">
-    <delete dir="build"/>
-    <delete dir="dist"/>
-  </target>
-</project>
diff --git a/Java/PerlInterpreter/dougm/inline.pat b/Java/PerlInterpreter/dougm/inline.pat
deleted file mode 100644
index 3fea73e..0000000
--- a/Java/PerlInterpreter/dougm/inline.pat
+++ /dev/null
@@ -1,55 +0,0 @@
---- Java/JNI.xs~	Mon Jun  3 08:50:57 2002
-+++ Java/JNI.xs	Sat Dec 14 18:42:20 2002
-@@ -17,6 +17,7 @@
- 	jmethodID process_command_mid ;
- 	jint debug ;
- 	int destroyed ;
-+        int embedded ;
- } InlineJavaJNIVM ;
- 
- 
-@@ -137,6 +138,7 @@
- 	RETVAL->ijs = NULL ;
- 	RETVAL->debug = debug ;
- 	RETVAL->destroyed = 0 ;
-+	RETVAL->embedded = SvIV(get_sv("Inline::Java::JVM", TRUE)) == 2 ? 1 : 0;
- 
- 	options[0].optionString = ((RETVAL->debug > 5) ? "-verbose" : "-verbose:") ;
- 	cp = (char *)malloc((strlen(classpath) + 128) * sizeof(char)) ;
-@@ -148,8 +150,23 @@
- 	vm_args.nOptions = 2 ;
- 	vm_args.ignoreUnrecognized = JNI_FALSE ;
- 
--	/* Create the Java VM */
--	res = JNI_CreateJavaVM(&(RETVAL->jvm), (void **)&(env), &vm_args) ;
-+        if (RETVAL->embedded) {
-+            /* we are already inside a JVM */
-+            jint n = 0;
-+
-+            res = JNI_GetCreatedJavaVMs(&(RETVAL->jvm), 1, &n);
-+            env = get_env(RETVAL);
-+            RETVAL->destroyed = 1; /* do not shutdown */
-+
-+            if (n <= 0) {
-+                /* res == 0 even if no JVMs are alive */
-+                res = -1;
-+            }
-+        }
-+        else {
-+              /* Create the Java VM */
-+              res = JNI_CreateJavaVM(&(RETVAL->jvm), (void **)&(env), &vm_args) ;
-+        }
- 	if (res < 0) {
- 		croak("Can't create Java interpreter using JNI") ;
- 	}
---- Java/JVM.pm~	Thu Jul  4 09:56:25 2002
-+++ Java/JVM.pm	Sat Dec 14 18:41:10 2002
-@@ -37,7 +37,7 @@
- 	Inline::Java::debug(1, "starting JVM...") ;
- 
- 	$this->{owner} = 1 ;
--	if ($o->get_java_config('JNI')){
-+	if (($Inline::Java::JVM = $o->get_java_config('JNI'))){
- 		Inline::Java::debug(1, "JNI mode") ;
- 
- 		my $jni = new Inline::Java::JNI(
diff --git a/Java/PerlInterpreter/dougm/src/jni/PerlInterpreter.c b/Java/PerlInterpreter/dougm/src/jni/PerlInterpreter.c
deleted file mode 100644
index 5daeacc..0000000
--- a/Java/PerlInterpreter/dougm/src/jni/PerlInterpreter.c
+++ /dev/null
@@ -1,147 +0,0 @@
-#include "jni.h"
-#include "EXTERN.h"
-#include "perl.h"
-
-#define JENV (*env)
-
-#define PERL_PACKAGE "org/perl"
-
-void boot_DynaLoader(pTHX_ CV* cv);
-
-static void xs_init(pTHX)
-{
-    char *file = __FILE__;
-    dXSUB_SYS;
-    newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
-}
-
-static void perl_throw_exception(JNIEnv *env, char *msg)
-{
-    jclass errorClass = 
-        JENV->FindClass(env, PERL_PACKAGE "PerlException");
-
-    JENV->ThrowNew(env, errorClass, msg);
-}
-
-static PerlInterpreter *perl_get_pointer(JNIEnv *env, jobject obj) {
-    jfieldID pointer_field;
-    jclass cls;
-      
-    cls = JENV->GetObjectClass(env, obj);
-
-    pointer_field = JENV->GetFieldID(env, cls, "perlInterpreter", "I");
-
-    return (PerlInterpreter *)JENV->GetIntField(env, obj, pointer_field);
-}
-
-static void perl_set_pointer(JNIEnv *env, jobject obj, const void *ptr) {
-    jfieldID pointer_field;
-    int pointer_int;
-    jclass cls;
-    
-    cls = JENV->GetObjectClass(env, obj);
-
-    pointer_field = JENV->GetFieldID(env, cls, "perlInterpreter", "I");
-    pointer_int = (int)ptr;
-
-    JENV->SetIntField(env, obj, pointer_field, pointer_int);
-}
-
-JNIEXPORT jobject JNICALL Java_org_perl_PerlInterpreter_create
-(JNIEnv *env, jobject obj, jobject parent)
-{
-    PerlInterpreter *interp = NULL;
-
-    if (parent) {
-        PerlInterpreter *parent_perl = perl_get_pointer(env, parent);
-        interp = perl_clone(parent_perl, 0);
-    }
-    else {
-        char *args[] = {"java", "-e0"};
-
-        interp = perl_alloc();
-        perl_construct(interp);
-        perl_parse(interp, xs_init, 2, args, NULL);
-        perl_run(interp);
-    }
-
-    perl_set_pointer(env, obj, interp);
-
-    return NULL;
-}
-
-JNIEXPORT void JNICALL Java_org_perl_PerlInterpreter_destroy
-(JNIEnv *env, jobject obj)
-{
-    PerlInterpreter *perl = perl_get_pointer(env, obj);
-
-    perl_destruct(perl);
-    perl_free(perl);
-}
-
-JNIEXPORT jstring JNICALL Java_org_perl_PerlInterpreter_eval
-(JNIEnv *env, jobject obj, jstring jcode)
-{
-    PerlInterpreter *perl = perl_get_pointer(env, obj);
-    dTHXa(perl);
-    SV *sv = Nullsv;
-
-    const char *code = JENV->GetStringUTFChars(env, jcode, 0);
-
-    sv = eval_pv(code, FALSE);
-
-    if (SvTRUE(ERRSV)) {
-        perl_throw_exception(env, SvPVX(ERRSV));
-    }
-
-    if (SvTRUE(sv)) {
-        STRLEN n_a;
-        return JENV->NewStringUTF(env, SvPV(sv, n_a));
-    }
-
-    return NULL;
-}
-
-JNIEXPORT jstring JNICALL Java_org_perl_PerlInterpreter_call
-(JNIEnv *env, jobject obj, jstring jfunction, jobjectArray args)
-{
-    PerlInterpreter *perl = perl_get_pointer(env, obj);
-    dTHXa(perl);
-
-    const char *function = JENV->GetStringUTFChars(env, jfunction, 0);
-
-    if (SvTRUE(ERRSV)) {
-        perl_throw_exception(env, SvPVX(ERRSV));
-    }
-
-    return NULL;
-}
-
-/*
-#!perl
-
-use 5.8.0;
-use strict;
-use Config;
-use ExtUtils::Embed;
-
-my $cmodule = 'PerlInterpreter';
-
-chomp(my $ccopts = ccopts());
-chomp(my $ldopts = ldopts());
-
-$ccopts .= " -I$ENV{JAVA_HOME}/include/linux -I$ENV{JAVA_HOME}/include";
-$ldopts .= " $Config{lddlflags}";
-
-my $ar  = "-Wl,--whole-archive";
-my $nar = "-Wl,--no-whole-archive";
-
-run("$Config{cc} -Wall $ar $ccopts $ldopts $nar -o lib$cmodule.so $cmodule.c");
-
-sub run {
-    print "@_\n";
-    system "@_";
-}
-
-__END__
-*/
diff --git a/Java/PerlInterpreter/dougm/src/org/perl/PerlException.java b/Java/PerlInterpreter/dougm/src/org/perl/PerlException.java
deleted file mode 100644
index 5f22d74..0000000
--- a/Java/PerlInterpreter/dougm/src/org/perl/PerlException.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.perl;
-
-public class PerlException extends Exception {
-
-    public PerlException() {
-        super();
-    }
-
-    public PerlException(String msg) {
-        super(msg);
-    }
-}
diff --git a/Java/PerlInterpreter/dougm/src/org/perl/PerlInterpreter.java b/Java/PerlInterpreter/dougm/src/org/perl/PerlInterpreter.java
deleted file mode 100644
index e191680..0000000
--- a/Java/PerlInterpreter/dougm/src/org/perl/PerlInterpreter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.perl;
-
-public class PerlInterpreter {
-    int perlInterpreter = 0;
-
-    public PerlInterpreter() {
-        create(null);
-    }
-
-    public int getPerlInterpreter() {
-        return perlInterpreter;
-    }
-
-    private native PerlInterpreter create(PerlInterpreter perl)
-        throws RuntimeException;
-
-    public native String eval(String code) throws PerlException;
-
-    public native void destroy();
-
-    public static void main(String[] args) {
-        try {
-            System.loadLibrary("PerlInterpreter");
-
-            PerlInterpreter perl = new PerlInterpreter();
-            System.setProperty("PERL", "XXX");
-            String val = perl.eval("require 'test.pl'");
-            System.out.println(val);
-            perl.destroy();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}
diff --git a/Java/PerlInterpreter/dougm/test.pl b/Java/PerlInterpreter/dougm/test.pl
deleted file mode 100644
index 0269514..0000000
--- a/Java/PerlInterpreter/dougm/test.pl
+++ /dev/null
@@ -1,12 +0,0 @@
-use DynaLoader ();
-
-BEGIN {
-    use Config;
-    my $libperl = "$Config{installarchlib}/CORE/libperl.so";
-
-    DynaLoader::dl_load_file($libperl, 0x01);
-}
-
-
-use Cwd ;
-print "OK\n" ;
diff --git a/Java/PerlInterpreter/dougm/test.sh b/Java/PerlInterpreter/dougm/test.sh
deleted file mode 100755
index ad7435b..0000000
--- a/Java/PerlInterpreter/dougm/test.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/bash
-
-export LD_LIBRARY_PATH=`pwd`/src/jni
-
-/usr/java/j2sdk1.4.2_02/bin/java -cp ./dist/lib/PerlInterpreter.jar org.perl.PerlInterpreter
diff --git a/Java/sources/org/perl/inline/java/InlineJavaServer.java b/Java/sources/org/perl/inline/java/InlineJavaServer.java
index 9f2e27b..920ee17 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaServer.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaServer.java
@@ -26,8 +26,8 @@ public class InlineJavaServer {
 
 
 	// This constructor is used in JNI mode
-	private InlineJavaServer(int d){
-		init(d) ;
+	private InlineJavaServer(int debug){
+		init(debug) ;
 
 		jni = true ; 
 		AddThread(creator) ;
@@ -35,13 +35,14 @@ public class InlineJavaServer {
 
 
 	// This constructor is used in server mode
-	private InlineJavaServer(String[] argv){
-		init(new Integer(argv[0]).intValue()) ;
+	// Normally one would then call RunMainLoop()
+	public InlineJavaServer(int debug, int _port, boolean _shared_jvm, boolean _priv){
+		init(debug) ;
 
 		jni = false ;
-		port = Integer.parseInt(argv[1]) ;
-		shared_jvm = new Boolean(argv[2]).booleanValue() ;
-		priv = new Boolean(argv[3]).booleanValue() ;
+		port = _port ;
+		shared_jvm = _shared_jvm ;
+		priv = _priv ;
 
 		try {
 			server_socket = new ServerSocket(port) ;	
@@ -50,7 +51,10 @@ public class InlineJavaServer {
 			InlineJavaUtils.Fatal("Can't open server socket on port " + String.valueOf(port) +
 				": " + e.getMessage()) ;
 		}
+	}
+
 
+    public void RunMainLoop(){
 		while (! finished){
 			try {
 				String name = "IJST-#" + thread_count++ ;
@@ -73,8 +77,6 @@ public class InlineJavaServer {
 				}
 			}
 		}
-
-		System.exit(0) ;
 	}
 
 
@@ -247,7 +249,7 @@ public class InlineJavaServer {
 	}
 
 
-	synchronized void Shutdown(){
+	public synchronized void StopMainLoop(){
 		if (! jni){
 			try {
 				finished = true ;
@@ -258,6 +260,11 @@ public class InlineJavaServer {
 				System.err.flush() ;
 			}
 		}
+	}
+
+
+	synchronized void Shutdown(){
+		StopMainLoop() ;
 		System.exit(0) ;
 	}
 
@@ -283,7 +290,14 @@ public class InlineJavaServer {
 		Startup
 	*/
 	public static void main(String[] argv){
-		new InlineJavaServer(argv) ;
+		int debug = Integer.parseInt(argv[0]) ;
+		int port = Integer.parseInt(argv[1]) ;
+		boolean shared_jvm = new Boolean(argv[2]).booleanValue() ;
+		boolean priv = new Boolean(argv[3]).booleanValue() ;
+
+		InlineJavaServer ijs = new InlineJavaServer(debug, port, shared_jvm, priv) ;
+		ijs.RunMainLoop() ;
+		System.exit(0) ;
 	}
 
 
diff --git a/TODO b/TODO
index 09c205c..7436298 100644
--- a/TODO
+++ b/TODO
@@ -3,7 +3,7 @@ CODE:
 
 DOCUMENTATION:
 - Redocument Callbacks
-- Document InlineJavaPerlObject and InlineJavaPerlInterpreter`
+- Document InlineJavaPerlObject and InlineJavaPerlInterpreter
 
 TEST:
 - Alpha
diff --git a/bug/Hi3.pm b/bug/Hi3.pm
new file mode 100644
index 0000000..1bfb4a1
--- /dev/null
+++ b/bug/Hi3.pm
@@ -0,0 +1,19 @@
+package Hi3;
+use strict;
+use warnings;
+
+BEGIN {
+	$ENV{CLASSPATH} .= "./Higher.jar";
+}
+
+use Inline Java => 'STUDY', STUDY => ['Higher'];
+
+sub new {
+	my $class = shift;
+#	print "class name is $class \n";
+	my $a = shift;
+	my $b = shift;
+	return Hi3::Higher->Higher($a, $b);
+}
+
+1;
diff --git a/bug/Higher.class b/bug/Higher.class
new file mode 100644
index 0000000..89967df
Binary files /dev/null and b/bug/Higher.class differ
diff --git a/bug/Higher.jar b/bug/Higher.jar
new file mode 100644
index 0000000..1a3a478
Binary files /dev/null and b/bug/Higher.jar differ
diff --git a/bug/Higher.java b/bug/Higher.java
new file mode 100644
index 0000000..fbf7d20
--- /dev/null
+++ b/bug/Higher.java
@@ -0,0 +1,28 @@
+class Lower
+{
+	int a;
+    public Lower(int p)
+    {
+		a= p;
+	}
+	public String outPrintValues() {
+		return ("a = "+ this.a);
+	}
+
+}
+
+public class Higher extends Lower {
+	private int b;
+
+	public Higher(int p, int q) {
+		super(p);
+		this.b = q;
+	}
+
+	public int getHigherValues() {
+		return this.b;
+	}
+	public String printValues() {
+		return "a = "+ this.a + "\nb = " + b;
+	}
+}
diff --git a/bug/Lower.class b/bug/Lower.class
new file mode 100644
index 0000000..a7f1c6b
Binary files /dev/null and b/bug/Lower.class differ
diff --git a/bug/PKG1.pm b/bug/PKG1.pm
new file mode 100644
index 0000000..c638f8f
--- /dev/null
+++ b/bug/PKG1.pm
@@ -0,0 +1,25 @@
+package PKG1;
+
+use strict;
+use warnings;
+
+use Inline Java => "DATA";
+
+sub new
+{
+    my $class = shift;
+    return  PKG1::PKG1->new(@_);
+}
+
+1;
+
+__DATA__
+__Java__
+import java.util.*;
+import java.io.*;
+
+public class PKG1 {
+	public static String hello(){
+		return "hello" ;
+	}
+}
diff --git a/bug/PKG2.pm b/bug/PKG2.pm
new file mode 100644
index 0000000..74d3a46
--- /dev/null
+++ b/bug/PKG2.pm
@@ -0,0 +1,14 @@
+package PKG2;
+
+use strict;
+use warnings;
+use PKG1 ;
+
+sub callpkg1 {
+	print "allo1\n" ;
+	print PKG1::PKG1->hello() ;
+	print "allo2\n" ;
+}
+
+
+1 ;
diff --git a/bug/XDB.class b/bug/XDB.class
new file mode 100644
index 0000000..11b0e70
Binary files /dev/null and b/bug/XDB.class differ
diff --git a/bug/XDB_TestHarness.class b/bug/XDB_TestHarness.class
new file mode 100644
index 0000000..b275a1d
Binary files /dev/null and b/bug/XDB_TestHarness.class differ
diff --git a/bug/XDB_TestHarness.java b/bug/XDB_TestHarness.java
new file mode 100644
index 0000000..17865cc
--- /dev/null
+++ b/bug/XDB_TestHarness.java
@@ -0,0 +1,109 @@
+import java.util.*;
+import org.perl.inline.java.*;
+
+public class XDB_TestHarness extends InlineJavaPerlCaller
+        {
+        static private InlineJavaPerlInterpreter pi = null;
+
+        public XDB_TestHarness() throws InlineJavaException 
+                {
+    }
+
+        public static void main(String argv[]) throws InlineJavaPerlException,
+InlineJavaException
+                {
+                System.out.println("Test Harness for XDB Java <> Perl Bridge");
+                if(argv.length != 4)
+                        {
+                        System.out.println("Usage\n$java XDB_TestHarness dbUserName dbPassword dbHost xdbDbDefinitionFilePath");
+                        return;
+                        }
+                
+                String sDbUser                                                                = argv[0];
+                String sDbPassword                                                = argv[1];
+                String sDbHost                                                                = argv[2];
+                String sDbDefinitionFilePath        = argv[3];
+
+                XDB xdb = null;
+
+                System.out.println("Instantiating XDB...");
+                try
+                        {
+                        xdb = new XDB(sDbUser, sDbPassword, sDbHost, sDbDefinitionFilePath);
+                        }
+                catch(InlineJavaPerlException pe)
+                        {
+                        System.out.println("PerlException: " + pe.GetString());
+                        }
+                catch(InlineJavaException je)
+                        {
+                        System.out.println("JavaException: " + je.getMessage());
+                        }
+                
+                System.out.println("XDB object created.");
+
+    pi.destroy();
+
+                System.out.println("Done.");
+                }
+        };
+
+class XDB
+        {
+        static private InlineJavaPerlInterpreter pi = null;
+        static private InlineJavaPerlObject xdb = null;
+
+        public XDB(String sDbUser, String sDbPassword, String sDbHost, String
+sDbDefinitionFilePath) throws InlineJavaPerlException, InlineJavaException
+                {
+                System.out.print("Creating Perl interpreter...");
+                pi = InlineJavaPerlInterpreter.create();
+// this bit won't work unless you've got a module called "XDB" installed in @INC somewhere
+//                pi.require_module("XDB");
+                System.out.println("OK");
+
+                System.out.print("Creating XDB instance...");
+
+                HashMap hshDbConnection = new HashMap();
+                hshDbConnection.put("User", sDbUser);
+                hshDbConnection.put("Password", sDbPassword);
+                hshDbConnection.put("Host", sDbHost);
+
+/*
+// this bit won't work unless you've got a module called "XDB" installed in @INC
+somewhere
+                xdb = (InlineJavaPerlObject) pi.CallPerlSub("XDB::new", new Object [] {"XDB",
+hshDbConnection }, InlineJavaPerlObject.class);
+                System.out.println("OK");
+
+                System.out.print("Initializing XDB instance...");
+                Integer ok = (Integer) xdb.InvokeMethod("DataDefinition", new Object [] {
+sDbDefinitionFilePath }, Integer.class);
+                if(ok.intValue() == 0)
+                        {
+                        String sError = (String) xdb.InvokeMethod("LastError", new Object [] {
+sDbDefinitionFilePath }, String.class);
+                        throw new InlineJavaPerlException("Error setting DataDefinition property: " +
+sError);
+                        }
+*/
+                System.out.println("OK");
+    }
+
+        protected void finalize()
+                {
+                System.out.println("finalizing");
+                try
+                        {
+                        xdb.Dispose();
+                        }
+                catch(InlineJavaPerlException pe)
+                        {
+                        System.out.println("PerlException: " + pe.GetString());
+                        }
+                catch(InlineJavaException je)
+                        {
+                        System.out.println("JavaException: " + je.getMessage());
+                        }
+                }
+        };
diff --git a/bug/inline3.pl b/bug/inline3.pl
new file mode 100644
index 0000000..810b63a
--- /dev/null
+++ b/bug/inline3.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Hi3;
+
+my $Higher1 = Hi3->new(5,10);
+print $Higher1->printValues(), "\n";
diff --git a/gcj/java b/gcj/java
deleted file mode 100755
index 11256e9..0000000
--- a/gcj/java
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-gij $@
diff --git a/gcj/javac b/gcj/javac
deleted file mode 100755
index 1092a26..0000000
--- a/gcj/javac
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-gcj -C $@
diff --git a/t/02_primitives.t b/t/02_primitives.t
index ac10cac..139bde8 100644
--- a/t/02_primitives.t
+++ b/t/02_primitives.t
@@ -64,31 +64,13 @@ my $t = new types2() ;
 	ok($t->_Integer("$min") == $min) ;
 	eval {$t->_Integer($max + 1)} ; ok($@, qr/out of range/) ;
 	eval {$t->_Integer($min - 1)} ; ok($@, qr/out of range/) ;
-	
-	$max = '9223372036854775807' ;
-	$min = '-9223372036854775808' ;
-	ok($t->_long(undef) == 1) ;
-	ok($t->_long(0) == 1) ;
-	ok($t->_long('9223372036854775806') eq $max) ;
-	ok($t->_long("$min") eq '-9223372036854775807') ;
-	# Out of range testing is now impossible since Perl has a lesser range.
-	# eval {$t->_long($max + 1)} ; ok($@, qr/out of range/) ;
-	# eval {$t->_long($min - 1)} ; ok($@, qr/out of range/) ;
-	ok($t->_Long(undef) == 0) ;
-	ok($t->_Long(0) == 0) ;
-	ok($t->_Long($max) == $max) ;
-	ok($t->_Long("$min") == $min) ;
-	# Out of range testing is now impossible since Perl has a lesser range.
-	# eval {$t->_Long($max + 1)} ; ok($@, qr/out of range/) ;
-	# eval {$t->_Long($min - 1)} ; ok($@, qr/out of range/) ;
-	
+
 	$max = 3.4028235e38 ;
 	$min = -3.4028235e38 ;
 	ok($t->_float(undef) == 1) ;
 	ok($t->_float(0) == 1) ;
 	ok($t->_float($max / 2)) ;
 	ok($t->_float($min / 2)) ;
-	# Equality tests for such large floating point number are not always reliable
 	ok($t->_float($max - 1)) ;
 	ok($t->_float("$min")) ;
 	eval {$t->_float($max + $max)} ; ok($@, qr/out of range/) ;
@@ -103,41 +85,35 @@ my $t = new types2() ;
 	eval {$t->_Float($max + $max)} ; ok($@, qr/out of range/) ;
 	eval {$t->_Float($min + $min)} ; ok($@, qr/out of range/) ;
 
-	$max = 1.79e308 ;
-	$min = -1.79e308 ;
+	#
+	# Boundary testing for long, double are not predictable enough
+	# to be reliable.`
+	#	
+	my $val = 123456 ;
+	ok($t->_long(undef) == 1) ;
+	ok($t->_long(0) == 1) ;
+	ok($t->_long($val - 1) == $val) ;
+	ok($t->_long("-$val") == -$val + 1) ;
+	ok($t->_Long(undef) == 0) ;
+	ok($t->_Long(0) == 0) ;
+	ok($t->_Long($val) == $val) ;
+	ok($t->_Long("-$val") == -$val) ;
+
+	$val = 123456.789 ;
 	ok($t->_double(undef) == 1) ;
 	ok($t->_double(0) == 1) ;
-	ok($t->_double($max / 2)) ;
-	ok($t->_double($min / 2)) ;
-	# Equality tests for such large floating point number are not always reliable
-	# ok($t->_double($max - 1) == $max) ;
-	# ok($t->_double("$min") == $min + 1) ;
-	# Out of range testing is impossible since Perl has an equal range.
-	# eval {$t->_double($max + $max)} ; ok($@, qr/out of range/) ;
-	# eval {$t->_double($min + $min)} ; ok($@, qr/out of range/) ;
+	ok($t->_double($val - 1) == $val) ;
+	ok($t->_double("-$val") == -$val + 1) ;
 	ok($t->_Double(undef) == 0) ;
 	ok($t->_Double(0) == 0) ;
-	ok($t->_Double($max / 2)) ;
-	ok($t->_Double($min / 2)) ;
-	# Equality tests for such large floating point number are not always reliable
-	# ok($t->_Double($max) == $max) ;
-	# ok($t->_Double("$min") == $min) ;
-	# eval {$t->_Double($max + $max)} ; ok($@, qr/out of range/) ;
-	# eval {$t->_Double($min + $min)} ; ok($@, qr/out of range/) ;
+	ok($t->_Double($val) == $val) ;
+	ok($t->_Double("-$val") == -$val) ;
 	
 	# Number is forced to Double
-	$max = 1.79e308 ;
-	$min = -1.79e308 ;
 	ok($t->_Number(undef) == 0) ;
 	ok($t->_Number(0) == 0) ;
-	ok($t->_Number($max / 2)) ;
-	ok($t->_Number($min / 2)) ;
-	# Equality tests for such large floating point number are not always reliable
-	# ok($t->_Number($max) == $max) ;
-	# ok($t->_Number("$min") == $min) ;
-	# Out of range testing is impossible since Perl has an equal range.
-	# eval {$t->_Number($max + $max)} ; ok($@, qr/out of range/) ;
-	# eval {$t->_Number($min + $min)} ; ok($@, qr/out of range/) ;
+	ok($t->_Number($val) == $val) ;
+	ok($t->_Number("-$val") == -$val) ;
 	
 	ok(! $t->_boolean(undef)) ;
 	ok(! $t->_boolean(0)) ;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git



More information about the Pkg-perl-cvs-commits mailing list