rjb 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +15 -0
- data/ext/extconf.rb +2 -2
- data/ext/jniwrap.h +1 -1
- data/ext/load.c +10 -2
- data/ext/rjb.c +4 -6
- data/ext/rjb.h +1 -1
- data/test/jp/co/infoseek/hp/arton/rjb/Base.class +0 -0
- data/test/jp/co/infoseek/hp/arton/rjb/ExtBase.class +0 -0
- data/test/jp/co/infoseek/hp/arton/rjb/IBase.class +0 -0
- data/test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class +0 -0
- data/test/jp/co/infoseek/hp/arton/rjb/Test.class +0 -0
- data/test/test.rb +59 -35
- metadata +7 -7
data/ChangeLog
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
Sun Feb 15 arton
|
2
|
+
*test/test/rb
|
3
|
+
add $KCODE and magic comment for iconv
|
4
|
+
*ext/rjb.c
|
5
|
+
RJB_VERSION -> 1.1.7
|
6
|
+
Thu Feb 5 kuwa1
|
7
|
+
*test/Test.java
|
8
|
+
*test/test.rb
|
9
|
+
add tests(Umlaut)
|
10
|
+
*ext/rjb.c
|
11
|
+
*ext/load.c
|
12
|
+
fix for ruby19
|
13
|
+
Sun Nov 16 arton
|
14
|
+
*ext/load.c
|
15
|
+
apply hpux patch, contributed by Ittay Dror. thanks
|
1
16
|
Tue Aug 26 arton
|
2
17
|
*ext/load.c, rjb.c, rjb.h
|
3
18
|
export safe_funcall under the prefix 'rjb'.
|
data/ext/extconf.rb
CHANGED
@@ -29,7 +29,7 @@ class Path
|
|
29
29
|
end
|
30
30
|
|
31
31
|
javahome = ENV['JAVA_HOME']
|
32
|
-
|
32
|
+
unless javahome.nil?
|
33
33
|
raise "JAVA_HOME is not directory." unless File.directory?(javahome)
|
34
34
|
p = Path.new
|
35
35
|
inc = p.include(javahome, 'include')
|
@@ -42,7 +42,7 @@ if !javahome.nil?
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
else
|
45
|
-
raise "JAVA_HOME is not
|
45
|
+
raise "JAVA_HOME is not set."
|
46
46
|
end
|
47
47
|
|
48
48
|
|
data/ext/jniwrap.h
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: jniwrap.h
|
15
|
+
* $Id: jniwrap.h 4 2006-09-11 15:21:38Z arton $
|
16
16
|
*/
|
17
17
|
#ifndef _Included_jniwrap
|
18
18
|
#define _Included_jniwrap
|
data/ext/load.c
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: load.c
|
15
|
+
* $Id: load.c 85 2009-02-04 16:14:22Z kuwa1 $
|
16
16
|
*/
|
17
17
|
|
18
18
|
#include <stdlib.h>
|
@@ -53,7 +53,15 @@
|
|
53
53
|
#define DEFAULT_HOME "/System/Library/Frameworks/JavaVM.framework"
|
54
54
|
#elif defined(_AIX)
|
55
55
|
#define ARCH "ppc"
|
56
|
+
#undef JVM_TYPE
|
56
57
|
#define JVM_TYPE "j9vm"
|
58
|
+
#elif defined(__hpux)
|
59
|
+
#define JVMDLL "%s/jre/lib/%s/%s/libjvm.sl"
|
60
|
+
#define ARCH "PA_RISC"
|
61
|
+
#undef JVM_TYPE
|
62
|
+
#define JVM_TYPE "server"
|
63
|
+
#define DIRSEPARATOR '/'
|
64
|
+
#define CLASSPATH_SEP ':'
|
57
65
|
#else /* defined(_WIN32) || defined(__CYGWIN__) */
|
58
66
|
#if defined(__sparc_v9__)
|
59
67
|
#define ARCH "sparcv9"
|
@@ -282,7 +290,7 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
|
|
282
290
|
optlen = 0;
|
283
291
|
if (!NIL_P(argv))
|
284
292
|
{
|
285
|
-
optlen +=
|
293
|
+
optlen += RARRAY_LEN(argv);
|
286
294
|
}
|
287
295
|
optlen += COUNTOF(soptions);
|
288
296
|
options = ALLOCA_N(JavaVMOption, optlen);
|
data/ext/rjb.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Rjb - Ruby <-> Java Bridge
|
3
|
-
* Copyright(c) 2004,2005,2006,2007,2008 arton
|
3
|
+
* Copyright(c) 2004,2005,2006,2007,2008,2009 arton
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -12,10 +12,10 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: rjb.c
|
15
|
+
* $Id: rjb.c 89 2009-02-15 12:31:40Z arton $
|
16
16
|
*/
|
17
17
|
|
18
|
-
#define RJB_VERSION "1.1.
|
18
|
+
#define RJB_VERSION "1.1.7"
|
19
19
|
|
20
20
|
#include "ruby.h"
|
21
21
|
#include "extconf.h"
|
@@ -447,11 +447,9 @@ static VALUE call_conv(JNIEnv* jenv, jvalue val, size_t sz, void* p, CONV conv,
|
|
447
447
|
char* cp = (char*)p;
|
448
448
|
jsize len = (*jenv)->GetArrayLength(jenv, val.l);
|
449
449
|
VALUE v = rb_ary_new2(len);
|
450
|
-
VALUE* pv = RARRAY_PTR(v);
|
451
|
-
RARRAY_LEN(v) = len;
|
452
450
|
for (i = 0; i < len; i++)
|
453
451
|
{
|
454
|
-
|
452
|
+
rb_ary_push(v, conv(jenv, cp));
|
455
453
|
cp += sz;
|
456
454
|
}
|
457
455
|
(*(RELEASEARRAY*)(((char*)*jenv) + fnc))(jenv, val.l, p, JNI_ABORT);
|
data/ext/rjb.h
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
13
|
* Lesser General Public License for more details.
|
14
14
|
*
|
15
|
-
* $Id: rjb.h
|
15
|
+
* $Id: rjb.h 81 2008-08-26 12:44:44Z arton $
|
16
16
|
* $Log: rjb.h,v $
|
17
17
|
* Revision 1.1 2005/01/16 17:36:10 arton
|
18
18
|
* Initial revision
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/test.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#!/usr/local/env ruby
|
2
|
-
#
|
1
|
+
#!/usr/local/env ruby -Ku
|
2
|
+
# encoding: utf-8
|
3
|
+
# $Id: test.rb 87 2009-02-15 12:25:36Z arton $
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'rjb'
|
@@ -167,40 +168,63 @@ class TestRjb < Test::Unit::TestCase
|
|
167
168
|
assert_equal(@jString.new("abcdef".force_encoding(Encoding::ASCII_8BIT)).toString(), "abcdef")
|
168
169
|
assert_equal(@jString.new("abcdef".force_encoding(Encoding::find("us-ascii"))).toString(), "abcdef")
|
169
170
|
else
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
171
|
+
default_kcode = $KCODE
|
172
|
+
begin
|
173
|
+
$KCODE = 'euc'
|
174
|
+
euc_kj = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
175
|
+
s = @jString.new(euc_kj)
|
176
|
+
assert_equal(s.toString(), euc_kj)
|
177
|
+
$KCODE = 'sjis'
|
178
|
+
sjis_kj = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
179
|
+
s = @jString.new(sjis_kj)
|
180
|
+
assert_equal(s.toString(), sjis_kj)
|
181
|
+
$KCODE = 'utf8'
|
182
|
+
utf8_kj = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
183
|
+
s = @jString.new(utf8_kj)
|
184
|
+
assert_equal(s.toString(), utf8_kj)
|
185
|
+
$KCODE = 'none'
|
186
|
+
if /mswin(?!ce)|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM
|
187
|
+
#expecting shift_jis on windows
|
188
|
+
none_kj = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
189
|
+
else
|
190
|
+
#expecting utf-8 unless windows
|
191
|
+
none_kj = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
192
|
+
end
|
193
|
+
s = @jString.new(none_kj)
|
194
|
+
assert_equal(s.toString(), none_kj)
|
195
|
+
$KCODE = 'utf8'
|
196
|
+
utf8_kj = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
197
|
+
s = @jString.new(utf8_kj)
|
198
|
+
assert_equal(s.toString(), utf8_kj)
|
199
|
+
$KCODE = 'sjis'
|
200
|
+
sjis_kj = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
201
|
+
s = @jString.new(sjis_kj)
|
202
|
+
assert_equal(s.toString(), sjis_kj)
|
203
|
+
$KCODE = 'euc'
|
204
|
+
euc_kj = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
205
|
+
s = @jString.new(euc_kj)
|
206
|
+
assert_equal(s.toString(), euc_kj)
|
207
|
+
ensure
|
208
|
+
$KCODE = default_kcode
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_combination_charcters
|
214
|
+
teststr = "\xc7\x96\xc3\xbc\xcc\x84\x75\xcc\x88\xcc\x84\xed\xa1\xa9\xed\xba\xb2\xe3\x81\x8b\xe3\x82\x9a"
|
215
|
+
test = import('jp.co.infoseek.hp.arton.rjb.Test').new
|
216
|
+
s = test.getUmlaut()
|
217
|
+
if Object::const_defined?(:Encoding) #>=1.9
|
218
|
+
teststr = teststr.force_encoding(Encoding::UTF_8)
|
219
|
+
assert_equal(s, teststr)
|
220
|
+
else
|
221
|
+
default_kcode = $KCODE
|
222
|
+
begin
|
223
|
+
$KCODE = "utf8"
|
224
|
+
assert_equal(s, teststr)
|
225
|
+
ensure
|
226
|
+
$KCODE = default_kcode
|
189
227
|
end
|
190
|
-
s = @jString.new(none_kj)
|
191
|
-
assert_equal(s.toString(), none_kj)
|
192
|
-
$KCODE = 'utf8'
|
193
|
-
utf8_kj = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
194
|
-
s = @jString.new(utf8_kj)
|
195
|
-
assert_equal(s.toString(), utf8_kj)
|
196
|
-
$KCODE = 'sjis'
|
197
|
-
sjis_kj = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
198
|
-
s = @jString.new(sjis_kj)
|
199
|
-
assert_equal(s.toString(), sjis_kj)
|
200
|
-
$KCODE = 'euc'
|
201
|
-
euc_kj = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
202
|
-
s = @jString.new(euc_kj)
|
203
|
-
assert_equal(s.toString(), euc_kj)
|
204
228
|
end
|
205
229
|
end
|
206
230
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rjb
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date:
|
6
|
+
version: 1.1.7
|
7
|
+
date: 2009-02-15 00:00:00 +09:00
|
8
8
|
summary: Ruby Java bridge
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,26 +30,26 @@ authors:
|
|
30
30
|
- arton
|
31
31
|
files:
|
32
32
|
- ext/RBridge.java
|
33
|
-
- ext/load.c
|
34
|
-
- ext/riconv.c
|
35
33
|
- ext/rjbexception.c
|
34
|
+
- ext/riconv.c
|
35
|
+
- ext/load.c
|
36
36
|
- ext/rjb.c
|
37
37
|
- ext/jniwrap.h
|
38
|
-
- ext/rjb.h
|
39
38
|
- ext/riconv.h
|
40
39
|
- ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
|
41
40
|
- ext/extconf.h
|
41
|
+
- ext/rjb.h
|
42
42
|
- ext/depend
|
43
43
|
- data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
|
44
44
|
- lib/rjb.rb
|
45
45
|
- samples/filechooser.rb
|
46
|
-
- test/test.rb
|
47
46
|
- test/gctest.rb
|
47
|
+
- test/test.rb
|
48
48
|
- test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
|
49
49
|
- test/jp/co/infoseek/hp/arton/rjb/Test.class
|
50
50
|
- test/jp/co/infoseek/hp/arton/rjb/IBase.class
|
51
|
-
- test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
|
52
51
|
- test/jp/co/infoseek/hp/arton/rjb/Base.class
|
52
|
+
- test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
|
53
53
|
- COPYING
|
54
54
|
- ChangeLog
|
55
55
|
- readme.sj
|