[libinline-java-perl] 356/398: ok, version number change
Jonas Smedegaard
dr at jones.dk
Thu Feb 26 11:43:22 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 401055b541482ea1dcc3d275c6f00362d669d40e
Author: patrick_leb <>
Date: Thu Sep 29 00:58:09 2005 +0000
ok, version number change
---
Java/Array.pm | 2 +-
Java/Callback.pm | 2 +-
Java/Class.pm | 2 +-
Java/Handle.pm | 2 +-
Java/JNI.pm | 2 +-
Java/JNI.xs | 40 ++++++++--------------
Java/JVM.pm | 8 +++--
Java/Object.pm | 2 +-
Java/PerlInterpreter/PerlInterpreter.pm | 2 +-
Java/PerlNatives/PerlNatives.pm | 2 +-
Java/Portable.pm | 2 +-
Java/Protocol.pm | 5 +--
Java/Server.pm | 2 +-
.../org/perl/inline/java/InlineJavaProtocol.java | 18 ++++++++--
.../org/perl/inline/java/InlineJavaServer.java | 10 +++++-
.../perl/inline/java/InlineJavaServerThread.java | 18 +++++++---
README | 4 +--
TODO | 7 ++--
18 files changed, 78 insertions(+), 52 deletions(-)
diff --git a/Java/Array.pm b/Java/Array.pm
index baf060d..c4feef5 100644
--- a/Java/Array.pm
+++ b/Java/Array.pm
@@ -4,7 +4,7 @@ package Inline::Java::Array ;
use strict ;
use Carp ;
-$Inline::Java::Array::VERSION = '0.50_90' ;
+$Inline::Java::Array::VERSION = '0.50_91' ;
# Here we store as keys the knots and as values our blessed objects
my $OBJECTS = {} ;
diff --git a/Java/Callback.pm b/Java/Callback.pm
index 3daf2eb..1c6e82d 100644
--- a/Java/Callback.pm
+++ b/Java/Callback.pm
@@ -3,7 +3,7 @@ package Inline::Java::Callback ;
use strict ;
use Carp ;
-$Inline::Java::Callback::VERSION = '0.50_90' ;
+$Inline::Java::Callback::VERSION = '0.50_91' ;
$Inline::Java::Callback::OBJECT_HOOK = undef ;
diff --git a/Java/Class.pm b/Java/Class.pm
index 7e99093..6a1f9ff 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -3,7 +3,7 @@ package Inline::Java::Class ;
use strict ;
use Carp ;
-$Inline::Java::Class::VERSION = '0.50_90' ;
+$Inline::Java::Class::VERSION = '0.50_91' ;
$Inline::Java::Class::MAX_SCORE = 10 ;
diff --git a/Java/Handle.pm b/Java/Handle.pm
index f0f9394..f713e7c 100644
--- a/Java/Handle.pm
+++ b/Java/Handle.pm
@@ -5,7 +5,7 @@ use strict ;
use Symbol ;
use Carp ;
-$Inline::Java::Handle::VERSION = '0.50_90' ;
+$Inline::Java::Handle::VERSION = '0.50_91' ;
# Here we store as keys the knots and as values our blessed objects
diff --git a/Java/JNI.pm b/Java/JNI.pm
index 52d9499..8905372 100644
--- a/Java/JNI.pm
+++ b/Java/JNI.pm
@@ -4,7 +4,7 @@ package Inline::Java::JNI ;
use strict ;
-$Inline::Java::JNI::VERSION = '0.50_90' ;
+$Inline::Java::JNI::VERSION = '0.50_91' ;
use DynaLoader ;
use Carp ;
diff --git a/Java/JNI.xs b/Java/JNI.xs
index f625b30..86ebbdc 100644
--- a/Java/JNI.xs
+++ b/Java/JNI.xs
@@ -134,20 +134,21 @@ InlineJavaJNIVM *
new(CLASS, classpath, args, embedded, debug)
char * CLASS
char * classpath
- char * args
+ AV * args
int embedded
int debug
PREINIT:
JavaVMInitArgs vm_args ;
- JavaVMOption options[128] ;
+ JavaVMOption *options ;
JNIEnv *env ;
JNINativeMethod nm ;
jint res ;
char *cp ;
- char *al ;
- char *alsep ;
- char *tmp ;
+ int args_len ;
+ int i ;
+ SV ** val = NULL ;
+ STRLEN n_a ;
CODE:
RETVAL = (InlineJavaJNIVM *)safemalloc(sizeof(InlineJavaJNIVM)) ;
@@ -159,7 +160,11 @@ new(CLASS, classpath, args, embedded, debug)
RETVAL->debug = debug ;
RETVAL->destroyed = 0 ;
+ /* Figure out the length of the args array */
+ args_len = av_len(args) + 1 ;
vm_args.version = JNI_VERSION_1_2 ;
+
+ options = (JavaVMOption *)malloc((2 + args_len) * sizeof(JavaVMOption)) ;
vm_args.options = options ;
vm_args.nOptions = 0 ;
vm_args.ignoreUnrecognized = JNI_FALSE ;
@@ -170,24 +175,11 @@ new(CLASS, classpath, args, embedded, debug)
sprintf(cp, "-Djava.class.path=%s", classpath) ;
options[vm_args.nOptions++].optionString = cp ;
- al = NULL ;
- if (strlen(args) > 0){
- tmp = (char *)malloc((strlen(args) + 1) * sizeof(char)) ;
- strcpy(tmp, args) ;
- al = (char *)malloc((strlen(tmp) + 1) * sizeof(char)) ;
- strcpy(al, "") ;
- alsep = strtok(tmp, "\"'") ;
- while (alsep != NULL){
- strcat(al, alsep) ;
- alsep = strtok(NULL, "\"'") ;
+ for (i = 0 ; i < args_len ; i++){
+ val = av_fetch(args, i, 0) ;
+ if (val != NULL){
+ options[vm_args.nOptions++].optionString = SvPV(*val, n_a) ;
}
- free(tmp) ;
-
- alsep = strtok(al, " ") ;
- while (alsep != NULL){
- options[vm_args.nOptions++].optionString = alsep ;
- alsep = strtok(NULL, " ") ;
- }
}
/* Embedded patch and idea by Doug MacEachern */
@@ -214,10 +206,8 @@ new(CLASS, classpath, args, embedded, debug)
}
}
+ free(options) ;
free(cp) ;
- if (al != NULL){
- free(al) ;
- }
/* Load the classes that we will use */
diff --git a/Java/JVM.pm b/Java/JVM.pm
index b8bec65..8364675 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -6,9 +6,10 @@ use Carp ;
use IO::File ;
use IPC::Open3 ;
use IO::Socket ;
+use Text::ParseWords ;
use Inline::Java::Portable ;
-$Inline::Java::JVM::VERSION = '0.50_90' ;
+$Inline::Java::JVM::VERSION = '0.50_91' ;
my %SIGS = () ;
@@ -47,9 +48,12 @@ sub new {
if ($o->get_java_config('JNI')){
Inline::Java::debug(1, "JNI mode") ;
+ # Split args and remove quotes
+ my @args = map {s/(['"])(.*)\1/$2/ ; $_}
+ parse_line('\s+', 1, $args) ;
my $jni = new Inline::Java::JNI(
$ENV{CLASSPATH} || '',
- $args || '',
+ \@args,
$this->{embedded},
Inline::Java::get_DEBUG(),
) ;
diff --git a/Java/Object.pm b/Java/Object.pm
index d055da9..900c0f5 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -5,7 +5,7 @@ use strict ;
use Inline::Java::Protocol ;
use Carp ;
-$Inline::Java::Object::VERSION = '0.50_90' ;
+$Inline::Java::Object::VERSION = '0.50_91' ;
# Here we store as keys the knots and as values our blessed private objects
my $PRIVATES = {} ;
diff --git a/Java/PerlInterpreter/PerlInterpreter.pm b/Java/PerlInterpreter/PerlInterpreter.pm
index 3b3b62f..0f2965b 100644
--- a/Java/PerlInterpreter/PerlInterpreter.pm
+++ b/Java/PerlInterpreter/PerlInterpreter.pm
@@ -3,7 +3,7 @@ package Inline::Java::PerlInterpreter ;
use strict ;
use Inline::Java ;
-$Inline::Java::PerlInterpreter::VERSION = '0.50_90' ;
+$Inline::Java::PerlInterpreter::VERSION = '0.50_91' ;
use Inline (
diff --git a/Java/PerlNatives/PerlNatives.pm b/Java/PerlNatives/PerlNatives.pm
index 3ff6e60..bfa901a 100644
--- a/Java/PerlNatives/PerlNatives.pm
+++ b/Java/PerlNatives/PerlNatives.pm
@@ -2,6 +2,6 @@ package Inline::Java::PerlNatives ;
use strict ;
-$Inline::Java::PerlNatives::VERSION = '0.50_90' ;
+$Inline::Java::PerlNatives::VERSION = '0.50_91' ;
1 ;
diff --git a/Java/Portable.pm b/Java/Portable.pm
index 1902ea3..b3bff35 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -9,7 +9,7 @@ use Config ;
use File::Find ;
use File::Spec ;
-$Inline::Java::Portable::VERSION = '0.50_90' ;
+$Inline::Java::Portable::VERSION = '0.50_91' ;
# Here is some code to figure out if we are running on command.com
# shell under Windows.
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index 51d4496..49103c0 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -7,7 +7,7 @@ use Carp ;
use MIME::Base64 ;
use Encode qw(encode_utf8 decode_utf8) ;
-$Inline::Java::Protocol::VERSION = '0.50_90' ;
+$Inline::Java::Protocol::VERSION = '0.50_91' ;
my %CLASSPATH_ENTRIES = () ;
@@ -54,8 +54,9 @@ sub ServerType {
Inline::Java::debug(3, "getting server type") ;
my $data = "server_type" ;
+ my $info = $this->Send($data) ;
- return $this->Send($data) ;
+ return split("\n", $info) ;
}
diff --git a/Java/Server.pm b/Java/Server.pm
index c609d1b..90989c8 100644
--- a/Java/Server.pm
+++ b/Java/Server.pm
@@ -13,7 +13,7 @@ require Inline::Java ;
use File::Spec ;
-$Inline::Java::Server::VERSION = '0.50_90' ;
+$Inline::Java::Server::VERSION = '0.50_91' ;
# Create a dummy Inline::Java object in order to
diff --git a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
index 2f5177c..bc6d73b 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
@@ -15,6 +15,8 @@ class InlineJavaProtocol {
private InlineJavaArray ija ;
private String cmd ;
private String response = null ;
+ // For later use maybe...
+ private String encoding = "UTF-8" ;
static private HashMap member_cache = new HashMap() ;
static private String report_version = "V2" ;
@@ -795,12 +797,24 @@ class InlineJavaProtocol {
String Decode(String s){
- return new String(InlineJavaUtils.DecodeBase64(s.toCharArray())) ;
+ // try {
+ return new String(InlineJavaUtils.DecodeBase64(s.toCharArray())) ;
+ // }
+ // catch (UnsupportedEncodingException e){
+ // e.printStackTrace() ;
+ // return null ;
+ // }
}
String Encode(String s){
- return new String(InlineJavaUtils.EncodeBase64(s.getBytes())) ;
+ // try {
+ return new String(InlineJavaUtils.EncodeBase64(s.getBytes())) ;
+ // }
+ // catch (UnsupportedEncodingException e){
+ // e.printStackTrace() ;
+ // return null ;
+ // }
}
diff --git a/Java/sources/org/perl/inline/java/InlineJavaServer.java b/Java/sources/org/perl/inline/java/InlineJavaServer.java
index 920ee17..018e3bf 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaServer.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaServer.java
@@ -23,6 +23,8 @@ public class InlineJavaServer {
private boolean jni = false ;
private Thread creator = null ;
private int thread_count = 0 ;
+ private String file_encoding = null ;
+ private String socket_encodings = null ;
// This constructor is used in JNI mode
@@ -60,6 +62,10 @@ public class InlineJavaServer {
String name = "IJST-#" + thread_count++ ;
InlineJavaServerThread ijt = new InlineJavaServerThread(name, this, server_socket.accept(),
(priv ? new InlineJavaUserClassLoader() : ijucl)) ;
+ if (socket_encodings == null){
+ file_encoding = System.getProperty("file.encoding") ;
+ socket_encodings = ijt.GetEncodings() ;
+ }
ijt.start() ;
if (! shared_jvm){
try {
@@ -110,7 +116,9 @@ public class InlineJavaServer {
String GetType(){
- return (shared_jvm ? "shared" : "private") ;
+ return (shared_jvm ? "shared" : "private") +
+ "\n" + file_encoding +
+ "\n" + socket_encodings ;
}
diff --git a/Java/sources/org/perl/inline/java/InlineJavaServerThread.java b/Java/sources/org/perl/inline/java/InlineJavaServerThread.java
index bd76f3b..77234d4 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaServerThread.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaServerThread.java
@@ -11,6 +11,8 @@ class InlineJavaServerThread extends Thread {
private BufferedReader br ;
private BufferedWriter bw ;
private InlineJavaUserClassLoader ijucl ;
+ private String encoding_in = null ;
+ private String encoding_out = null ;
InlineJavaServerThread(String name, InlineJavaServer _ijs, Socket _client, InlineJavaUserClassLoader _ijucl) throws IOException {
@@ -19,10 +21,13 @@ class InlineJavaServerThread extends Thread {
ijs = _ijs ;
ijucl = _ijucl ;
- br = new BufferedReader(
- new InputStreamReader(client.getInputStream())) ;
- bw = new BufferedWriter(
- new OutputStreamWriter(client.getOutputStream())) ;
+ InputStreamReader ir = new InputStreamReader(client.getInputStream()) ;
+ OutputStreamWriter or = new OutputStreamWriter(client.getOutputStream()) ;
+ encoding_in = ir.getEncoding() ;
+ encoding_out = or.getEncoding() ;
+
+ br = new BufferedReader(ir) ;
+ bw = new BufferedWriter(or) ;
}
@@ -35,6 +40,11 @@ class InlineJavaServerThread extends Thread {
return bw ;
}
+
+ String GetEncodings(){
+ return encoding_in + "/" + encoding_out ;
+ }
+
InlineJavaUserClassLoader GetUserClassLoader(){
return ijucl ;
diff --git a/README b/README
index 796289a..88823dc 100644
--- a/README
+++ b/README
@@ -68,9 +68,9 @@ FEATURES FOR THIS VERSION:
Inline::Java version 0.51 is a major upgrade that includes:
- Several major speed optimizations
- - Introduction of support for I/O mapping between Perl and Java
+ - Introduction of support for I/O mapping between Perl and Java
- Applied patches by Andrew Bruno and Tim Bunce for MAC OSX
- - JNI fix for system property passing
+ - JNI fix for system property passing
(thanks to Brian Gugliemetti and Jason Stelzer)
- Other minor bug fixes
diff --git a/TODO b/TODO
index 6be55c6..4463853 100644
--- a/TODO
+++ b/TODO
@@ -1,11 +1,10 @@
CODE:
- Finish PerlInterpreter test suite
-- Send doubles and floats bytes instead of string representation to preserve precision. If that
- doesn't work, use sprintf with a user configurable precision.
-
+- Send doubles and floats bytes instead of string representation to preserve precision. If that doesn't work, use sprintf with a user configurable precision.
+- Finish PerlHandle stuff
DOCUMENTATION:
-- Document InlineJavaPerlObject
+- Document InlineJavaPerlObject when finished
TEST:
- Alpha
--
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