rjb 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +7 -1
- data/ext/extconf.h +1 -2
- data/ext/rjb.c +35 -2
- data/test/js.rb +54 -0
- data/test/test.rb +10 -6
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83926ee6e9439e6f61436c5045886ef3e773965d
|
4
|
+
data.tar.gz: b00c978c98273e226533c6bbf35a47cee7256082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aef85ae6c2ccece3faf84cd42f47cbf856cd4a65123c417746900af2f002910751a0ead2f28c3af1a7a6422a5c7202bb92fe54a148dce241c23cafb16cc36e6c
|
7
|
+
data.tar.gz: de168714ca12bf586fa9e08bc5b552640fb0cf7c9e99774bebd8906313a170bcdca8ada5787ee3e603f349eaf5573af78e84d69ffddb69997ee4a3d1e8bfa419
|
data/ChangeLog
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
Sat Dec 20 2014 arton
|
2
|
+
*ext/rjb.c
|
3
|
+
RJB_VERSION -> 1.5.3
|
4
|
+
select preferable constructor if argument is an array (for java.lang.String)
|
5
|
+
*test/test.rb
|
6
|
+
change literals to constants for kanji strings
|
1
7
|
Sun Dec 14 2014 arton
|
2
8
|
*lib/rjb.rb
|
3
9
|
FakeDL for Rubinius
|
4
10
|
*ext/riconv.c
|
5
11
|
Change variable name for avoiding conflicion (Runinius)
|
6
|
-
*ext/rjb.
|
12
|
+
*ext/rjb.c
|
7
13
|
RJB_VERSION -> 1.5.2
|
8
14
|
Support Rubinius (Rubinius's block is T_OBJECT instead of T_DATA -> affected to anonclass)
|
9
15
|
*test/test.rb
|
data/ext/extconf.h
CHANGED
data/ext/rjb.c
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
*
|
15
15
|
*/
|
16
16
|
|
17
|
-
#define RJB_VERSION "1.5.
|
17
|
+
#define RJB_VERSION "1.5.3"
|
18
18
|
|
19
19
|
#include "ruby.h"
|
20
20
|
#include "extconf.h"
|
@@ -2130,6 +2130,8 @@ static VALUE register_instance(JNIEnv* jenv, VALUE klass, struct jv_data* org, j
|
|
2130
2130
|
return v;
|
2131
2131
|
}
|
2132
2132
|
|
2133
|
+
#define IS_BYTE(b) (!((b) & 0xffffff00))
|
2134
|
+
#define IS_SHORT(b) (!((b) & 0xffff0000))
|
2133
2135
|
/*
|
2134
2136
|
* temporary signature check
|
2135
2137
|
* return !0 if found
|
@@ -2140,6 +2142,7 @@ static VALUE register_instance(JNIEnv* jenv, VALUE klass, struct jv_data* org, j
|
|
2140
2142
|
#define PREFERABLE 3
|
2141
2143
|
static int check_rtype(JNIEnv* jenv, VALUE* pv, char* p)
|
2142
2144
|
{
|
2145
|
+
size_t i;
|
2143
2146
|
char* pcls = NULL;
|
2144
2147
|
if (*p == 'L')
|
2145
2148
|
{
|
@@ -2181,7 +2184,33 @@ static int check_rtype(JNIEnv* jenv, VALUE* pv, char* p)
|
|
2181
2184
|
case T_FALSE:
|
2182
2185
|
return (*p == 'Z') ? SOSO : UNMATCHED;
|
2183
2186
|
case T_ARRAY:
|
2184
|
-
|
2187
|
+
if (*p == '[')
|
2188
|
+
{
|
2189
|
+
int weight = (*(p + 1) == 'C') ? SOSO : PREFERABLE;
|
2190
|
+
size_t len = RARRAY_LEN(*pv);
|
2191
|
+
VALUE* ppv = RARRAY_PTR(*pv);
|
2192
|
+
unsigned long ul;
|
2193
|
+
if (!strchr("BCSI", *(p + 1))) return SOSO; // verify later
|
2194
|
+
if (len > 32) len = 32;
|
2195
|
+
for (i = 0; i < len; i++, ppv++)
|
2196
|
+
{
|
2197
|
+
if (!FIXNUM_P(*ppv))
|
2198
|
+
{
|
2199
|
+
return UNMATCHED;
|
2200
|
+
}
|
2201
|
+
ul = (unsigned long)FIX2LONG(*ppv);
|
2202
|
+
if (*(p + 1) == 'B')
|
2203
|
+
{
|
2204
|
+
if (!IS_BYTE(ul)) return UNMATCHED;
|
2205
|
+
}
|
2206
|
+
else if (*(p + 1) == 'C' || *(p + 1) == 'S')
|
2207
|
+
{
|
2208
|
+
if (!IS_SHORT(ul)) return UNMATCHED;
|
2209
|
+
}
|
2210
|
+
}
|
2211
|
+
return weight;
|
2212
|
+
}
|
2213
|
+
return UNMATCHED;
|
2185
2214
|
case T_DATA:
|
2186
2215
|
case T_OBJECT:
|
2187
2216
|
if (IS_RJB_OBJECT(*pv) && pcls)
|
@@ -2296,6 +2325,10 @@ static VALUE rjb_newinstance(int argc, VALUE* argv, VALUE self)
|
|
2296
2325
|
}
|
2297
2326
|
if (found_pc)
|
2298
2327
|
{
|
2328
|
+
#if defined(DEBUG)
|
2329
|
+
fprintf(stderr, "ctr sig=%s\n", (*found_pc)->method_signature);
|
2330
|
+
fflush(stderr);
|
2331
|
+
#endif
|
2299
2332
|
ret = createinstance(jenv, argc, argv, self, *found_pc);
|
2300
2333
|
}
|
2301
2334
|
}
|
data/test/js.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
begin
|
2
|
+
require 'rjb'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rjb'
|
6
|
+
end
|
7
|
+
require 'test/unit'
|
8
|
+
require 'fileutils'
|
9
|
+
|
10
|
+
FileUtils.rm_f 'jp/co/infoseek/hp/arton/rjb/Base.class'
|
11
|
+
FileUtils.rm_f 'jp/co/infoseek/hp/arton/rjb/ExtBase.class'
|
12
|
+
|
13
|
+
puts "start RJB(#{Rjb::VERSION}) test"
|
14
|
+
class TestRjb < Test::Unit::TestCase
|
15
|
+
include Rjb
|
16
|
+
def setup
|
17
|
+
Rjb::load('.')
|
18
|
+
Rjb::add_jar(File.expand_path('rjbtest.jar'))
|
19
|
+
Rjb::primitive_conversion = false
|
20
|
+
|
21
|
+
@jString = import('java.lang.String')
|
22
|
+
@jInteger = import('java.lang.Integer')
|
23
|
+
@jShort = import('java.lang.Short')
|
24
|
+
@jDouble = import('java.lang.Double')
|
25
|
+
@jFloat = import('java.lang.Float')
|
26
|
+
@jBoolean = import('java.lang.Boolean')
|
27
|
+
@jByte = import('java.lang.Byte')
|
28
|
+
@jLong = import('java.lang.Long')
|
29
|
+
@jChar = import('java.lang.Character')
|
30
|
+
end
|
31
|
+
|
32
|
+
SJIS_STR = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
33
|
+
EUCJP_STR = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
34
|
+
UTF8_STR = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
35
|
+
def test_jsconv
|
36
|
+
sys = import('java.lang.System')
|
37
|
+
encoding = sys.property('file.encoding')
|
38
|
+
s = @jString.new(SJIS_STR.force_encoding Encoding::SHIFT_JIS)
|
39
|
+
e = @jString.new(EUCJP_STR.force_encoding Encoding::EUC_JP)
|
40
|
+
u = @jString.new(UTF8_STR.force_encoding Encoding::UTF_8)
|
41
|
+
if encoding == 'MS932'
|
42
|
+
s1 = @jString.new(SJIS_STR.bytes)
|
43
|
+
elsif encoding.upcase == 'EUC-JP'
|
44
|
+
s1 = @jString.new(EUCJP_STR.bytes)
|
45
|
+
elsif encoding.upcase == 'UTF-8'
|
46
|
+
s1 = @jString.new(UTF8_STR.bytes)
|
47
|
+
else
|
48
|
+
skip 'no checkable encoding'
|
49
|
+
end
|
50
|
+
assert_equal s1.toString, s.toString
|
51
|
+
assert_equal s1.toString, e.toString
|
52
|
+
assert_equal s1.toString, u.toString
|
53
|
+
end
|
54
|
+
end
|
data/test/test.rb
CHANGED
@@ -899,19 +899,23 @@ class TestRjb < Test::Unit::TestCase
|
|
899
899
|
assert_equal '[Ljava.lang.Integer;', ret[1]
|
900
900
|
assert_equal '[Ljava.net.URI;', ret[2]
|
901
901
|
end
|
902
|
+
|
903
|
+
SJIS_STR = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67"
|
904
|
+
EUCJP_STR = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
905
|
+
UTF8_STR = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88"
|
902
906
|
def test_auto_constructor_selection
|
903
907
|
skip 'no encoding' unless Object::const_defined?(:Encoding)
|
904
908
|
sys = import('java.lang.System')
|
905
909
|
encoding = sys.property('file.encoding')
|
906
|
-
s = @jString.new(
|
907
|
-
e = @jString.new(
|
908
|
-
u = @jString.new(
|
910
|
+
s = @jString.new(SJIS_STR.force_encoding Encoding::SHIFT_JIS)
|
911
|
+
e = @jString.new(EUCJP_STR.force_encoding Encoding::EUC_JP)
|
912
|
+
u = @jString.new(UTF8_STR.force_encoding Encoding::UTF_8)
|
909
913
|
if encoding == 'MS932'
|
910
|
-
s1 = @jString.new(
|
914
|
+
s1 = @jString.new(SJIS_STR.bytes)
|
911
915
|
elsif encoding.upcase == 'EUC-JP'
|
912
|
-
s1 = @jString.new(
|
916
|
+
s1 = @jString.new(EUCJP_STR.bytes)
|
913
917
|
elsif encoding.upcase == 'UTF-8'
|
914
|
-
s1 = @jString.new(
|
918
|
+
s1 = @jString.new(UTF8_STR.bytes)
|
915
919
|
else
|
916
920
|
skip 'no checkable encoding'
|
917
921
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
RJB is a bridge program that connect between Ruby and Java with Java Native Interface.
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- test/jp/co/infoseek/hp/arton/rjb/JTest.class
|
65
65
|
- test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
|
66
66
|
- test/jp/co/infoseek/hp/arton/rjb/Test.class
|
67
|
+
- test/js.rb
|
67
68
|
- test/listtest.rb
|
68
69
|
- test/osx_jvmcheck.rb
|
69
70
|
- test/rjbtest.jar
|
@@ -71,7 +72,7 @@ files:
|
|
71
72
|
- test/test_osxjvm.rb
|
72
73
|
- test/test_osxload.rb
|
73
74
|
- test/test_unload.rb
|
74
|
-
homepage: http://
|
75
|
+
homepage: http://www.artonx.org/collabo/backyard/?RubyJavaBridge
|
75
76
|
licenses:
|
76
77
|
- LGPL
|
77
78
|
metadata: {}
|
@@ -93,7 +94,7 @@ requirements:
|
|
93
94
|
- none
|
94
95
|
- JDK 5.0
|
95
96
|
rubyforge_project: rjb
|
96
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.2.2
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Ruby Java bridge
|