rjb 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/ext/extconf.h +1 -1
- data/ext/extconf.rb +5 -1
- data/ext/riconv.c +10 -23
- data/ext/rjb.c +22 -19
- 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 +25 -19
- metadata +40 -47
data/ChangeLog
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
Fri Feb 22 arton
|
2
|
+
*ext/rjb.c
|
3
|
+
fix field reference (bug# 18238)
|
1
4
|
Wed Jan 9 arton
|
2
5
|
*ext/rjb.h
|
3
6
|
add some ruby macros that defined after 1.8.6 for compatibility
|
4
7
|
Change RBridge.class by 1.4.2
|
5
8
|
*data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
|
6
9
|
compiled by 1.4.2 version of Java
|
10
|
+
*rjb.c
|
11
|
+
mark version 1.1.2 for the next release.
|
7
12
|
Tue Dec 27 Kuwashima
|
8
13
|
*test/Test.java
|
9
14
|
*test/test.rb
|
data/ext/extconf.h
CHANGED
data/ext/extconf.rb
CHANGED
@@ -30,6 +30,7 @@ end
|
|
30
30
|
|
31
31
|
javahome = ENV['JAVA_HOME']
|
32
32
|
if !javahome.nil?
|
33
|
+
raise "JAVA_HOME is not directory." unless File.directory?(javahome)
|
33
34
|
p = Path.new
|
34
35
|
inc = p.include(javahome, 'include')
|
35
36
|
Dir.open(inc).each do |d|
|
@@ -39,10 +40,13 @@ if !javahome.nil?
|
|
39
40
|
break
|
40
41
|
end
|
41
42
|
end
|
43
|
+
else
|
44
|
+
raise "JAVA_HOME is not setted."
|
42
45
|
end
|
43
46
|
|
47
|
+
|
44
48
|
def create_rjb_makefile
|
45
|
-
if have_header("jni.h") && have_header("dl.h") || have_header("ruby/dl.h")
|
49
|
+
if have_header("jni.h") && (have_header("dl.h") || have_header("ruby/dl.h")) #for ruby_1_9
|
46
50
|
have_func("locale_charset", "iconv.h")
|
47
51
|
have_func("nl_langinfo", "langinfo.h")
|
48
52
|
have_func("setlocale", "locale.h")
|
data/ext/riconv.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: riconv.c
|
15
|
+
* $Id: riconv.c 58 2008-01-14 08:25:07Z kuwa1 $
|
16
16
|
*/
|
17
17
|
|
18
18
|
#include "ruby.h"
|
@@ -176,21 +176,21 @@ VALUE exticonv_local_to_utf8(VALUE local_string)
|
|
176
176
|
return local_string;
|
177
177
|
}
|
178
178
|
#else
|
179
|
-
VALUE rb_cEncoding,
|
179
|
+
VALUE rb_cEncoding, encoding, sjis, eucjp, iso2022jp;
|
180
180
|
rb_cEncoding = rb_const_get(rb_cObject, rb_intern("Encoding"));
|
181
|
-
|
182
|
-
|
181
|
+
sjis = rb_const_get(rb_cEncoding, rb_intern("SHIFT_JIS"));
|
182
|
+
eucjp = rb_const_get(rb_cEncoding, rb_intern("EUC_JP"));
|
183
|
+
iso2022jp = rb_const_get(rb_cEncoding, rb_intern("ISO_2022_JP"));
|
183
184
|
encoding = rb_funcall(local_string, rb_intern("encoding"), 0);
|
184
185
|
|
185
|
-
if (
|
186
|
+
if (encoding == sjis || encoding == eucjp || encoding == iso2022jp)
|
186
187
|
{
|
187
|
-
|
188
|
+
return rb_funcall(local_string, rb_intern("encode"), 1, rb_str_new2("utf-8"));
|
188
189
|
}
|
189
|
-
else
|
190
|
+
else
|
190
191
|
{
|
191
|
-
|
192
|
+
return local_string;
|
192
193
|
}
|
193
|
-
return rb_funcall(local_string, rb_intern("encode"), 1, rb_str_new2("utf-8"));
|
194
194
|
#endif
|
195
195
|
}
|
196
196
|
|
@@ -207,19 +207,6 @@ VALUE exticonv_utf8_to_local(VALUE utf8_string)
|
|
207
207
|
return utf8_string;
|
208
208
|
}
|
209
209
|
#else
|
210
|
-
|
211
|
-
rb_cEncoding = rb_const_get(rb_cObject, rb_intern("Encoding"));
|
212
|
-
encoding = rb_funcall(rb_cEncoding, rb_intern("default_external"), 0);
|
213
|
-
ascii8bit = rb_const_get(rb_cEncoding, rb_intern("ASCII_8BIT"));
|
214
|
-
|
215
|
-
utf8_string = rb_funcall(utf8_string, rb_intern("force_encoding"), 1, rb_str_new2("utf-8"));
|
216
|
-
if (ascii8bit == encoding)
|
217
|
-
{
|
218
|
-
return utf8_string; //don't know default encoding
|
219
|
-
}
|
220
|
-
else
|
221
|
-
{
|
222
|
-
return rb_funcall(utf8_string, rb_intern("encode"), 1, encoding);
|
223
|
-
}
|
210
|
+
return rb_funcall(utf8_string, rb_intern("force_encoding"), 1, rb_str_new2("utf-8"));
|
224
211
|
#endif
|
225
212
|
}
|
data/ext/rjb.c
CHANGED
@@ -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 59 2008-02-21 19:37:15Z arton $
|
16
16
|
*/
|
17
17
|
|
18
|
-
#define RJB_VERSION "1.1.
|
18
|
+
#define RJB_VERSION "1.1.2"
|
19
19
|
|
20
20
|
#include "ruby.h"
|
21
21
|
#include "extconf.h"
|
@@ -2534,25 +2534,28 @@ static VALUE invoke_by_instance(ID rmid, int argc, VALUE* argv,
|
|
2534
2534
|
{
|
2535
2535
|
ret = getter(jenv, pf, ptr);
|
2536
2536
|
}
|
2537
|
-
else
|
2537
|
+
else
|
2538
2538
|
{
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2539
|
+
if (argc == 1 && *(tname + strlen(tname) - 1) == '=')
|
2540
|
+
{
|
2541
|
+
char* fname = ALLOCA_N(char, strlen(tname) + 1);
|
2542
|
+
strcpy(fname, tname);
|
2543
|
+
fname[strlen(tname) - 1] = '\0';
|
2544
|
+
if (st_lookup(ptr->fields, rb_intern(fname), (st_data_t*)&pf))
|
2545
|
+
{
|
2546
|
+
setter(jenv, pf, ptr, *argv);
|
2547
|
+
return ret;
|
2548
|
+
}
|
2549
|
+
// fall through for the setter alias name
|
2550
|
+
}
|
2551
|
+
if (st_lookup(ptr->methods, rmid, (st_data_t*)&pm))
|
2552
|
+
{
|
2553
|
+
ret = invoke(jenv, pm, ptr, argc, argv, sig);
|
2554
|
+
}
|
2555
|
+
else
|
2556
|
+
{
|
2557
|
+
rb_raise(rb_eRuntimeError, "Fail: unknown method name `%s'", tname);
|
2546
2558
|
}
|
2547
|
-
// fall through for the setter alias name
|
2548
|
-
}
|
2549
|
-
if (st_lookup(ptr->methods, rmid, (st_data_t*)&pm))
|
2550
|
-
{
|
2551
|
-
ret = invoke(jenv, pm, ptr, argc, argv, sig);
|
2552
|
-
}
|
2553
|
-
else
|
2554
|
-
{
|
2555
|
-
rb_raise(rb_eRuntimeError, "Fail: unknown method name `%s'", tname);
|
2556
2559
|
}
|
2557
2560
|
return ret;
|
2558
2561
|
}
|
Binary file
|
Binary file
|
data/test/test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/local/env ruby
|
2
|
-
# $Id: test.rb
|
2
|
+
# $Id: test.rb 58 2008-01-14 08:25:07Z kuwa1 $
|
3
3
|
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rjb'
|
@@ -135,27 +135,33 @@ class TestRjb < Test::Unit::TestCase
|
|
135
135
|
|
136
136
|
def test_kjconv()
|
137
137
|
if Object::const_defined?(:Encoding)
|
138
|
-
|
138
|
+
test = import('jp.co.infoseek.hp.arton.rjb.Test').new
|
139
|
+
euc_kj = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8".force_encoding Encoding::EUC_JP
|
139
140
|
s = @jString.new(euc_kj)
|
140
141
|
assert_equal(s.toString().encoding, Encoding::UTF_8)
|
141
|
-
|
142
|
-
|
142
|
+
assert(test.isSameString(s))
|
143
|
+
assert(test.isSameString(euc_kj))
|
144
|
+
assert_equal(s.toString().encode(Encoding::EUC_JP), euc_kj)
|
145
|
+
sjis_kj = "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67".force_encoding Encoding::SHIFT_JIS
|
143
146
|
s = @jString.new(sjis_kj)
|
144
|
-
assert_equal(s.toString().
|
145
|
-
|
146
|
-
|
147
|
-
assert_equal(s.toString(),
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
147
|
+
assert_equal(s.toString().encoding, Encoding::UTF_8)
|
148
|
+
assert(test.isSameString(s))
|
149
|
+
assert(test.isSameString(sjis_kj))
|
150
|
+
assert_equal(s.toString().encode(Encoding::SHIFT_JIS), sjis_kj)
|
151
|
+
utf8_kj = "\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88".force_encoding Encoding::UTF_8
|
152
|
+
s = @jString.new(utf8_kj)
|
153
|
+
assert_equal(s.toString().encoding, Encoding::UTF_8)
|
154
|
+
assert(test.isSameString(s))
|
155
|
+
assert(test.isSameString(utf8_kj))
|
156
|
+
assert_equal(s.toString().encode(Encoding::UTF_8), utf8_kj)
|
157
|
+
iso2022jp_kj = "\x1b\x24\x42\x34\x41\x3b\x7a\x25\x46\x25\x2d\x25\x39\x25\x48\x1b\x28\x42".force_encoding Encoding::ISO_2022_JP
|
158
|
+
s = @jString.new(iso2022jp_kj)
|
159
|
+
assert_equal(s.toString().encoding, Encoding::UTF_8)
|
160
|
+
assert(test.isSameString(s))
|
161
|
+
assert(test.isSameString(iso2022jp_kj))
|
162
|
+
assert_equal(s.toString().encode(Encoding::ISO_2022_JP), iso2022jp_kj)
|
163
|
+
assert_equal(@jString.new("abcdef".force_encoding(Encoding::ASCII_8BIT)).toString(), "abcdef")
|
164
|
+
assert_equal(@jString.new("abcdef".force_encoding(Encoding::find("us-ascii"))).toString(), "abcdef")
|
159
165
|
else
|
160
166
|
$KCODE = 'euc'
|
161
167
|
euc_kj = "\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8"
|
metadata
CHANGED
@@ -1,78 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
2
4
|
name: rjb
|
3
5
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
6
|
+
version: 1.1.2
|
7
|
+
date: 2008-02-22 00:00:00 +09:00
|
8
|
+
summary: Ruby Java bridge
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: artonx@gmail.com
|
12
|
+
homepage: http://rjb.rubyforge.org/
|
13
|
+
rubyforge_project:
|
14
|
+
description: RJB is a bridge program that connect between Ruby and Java with Java Native Interface.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.8.2
|
24
|
+
version:
|
5
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
6
29
|
authors:
|
7
30
|
- arton
|
8
|
-
autorequire:
|
9
|
-
bindir: bin
|
10
|
-
cert_chain: []
|
11
|
-
|
12
|
-
date: 2008-01-09 00:00:00 +09:00
|
13
|
-
default_executable:
|
14
|
-
dependencies: []
|
15
|
-
|
16
|
-
description: RJB is a bridge program that connect between Ruby and Java with Java Native Interface.
|
17
|
-
email: artonx@gmail.com
|
18
|
-
executables: []
|
19
|
-
|
20
|
-
extensions:
|
21
|
-
- ext/extconf.rb
|
22
|
-
extra_rdoc_files: []
|
23
|
-
|
24
31
|
files:
|
25
32
|
- ext/RBridge.java
|
26
33
|
- ext/load.c
|
34
|
+
- ext/rjbexception.c
|
27
35
|
- ext/riconv.c
|
28
36
|
- ext/rjb.c
|
29
|
-
- ext/rjbexception.c
|
30
|
-
- ext/extconf.h
|
31
37
|
- ext/jniwrap.h
|
32
|
-
- ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
|
33
|
-
- ext/riconv.h
|
34
38
|
- ext/rjb.h
|
39
|
+
- ext/riconv.h
|
40
|
+
- ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
|
41
|
+
- ext/extconf.h
|
35
42
|
- ext/depend
|
36
43
|
- data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
|
37
44
|
- lib/rjb.rb
|
38
45
|
- samples/filechooser.rb
|
39
46
|
- test/gctest.rb
|
40
47
|
- test/test.rb
|
41
|
-
- test/jp/co/infoseek/hp/arton/rjb/Base.class
|
42
48
|
- test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
|
49
|
+
- test/jp/co/infoseek/hp/arton/rjb/Test.class
|
43
50
|
- test/jp/co/infoseek/hp/arton/rjb/IBase.class
|
51
|
+
- test/jp/co/infoseek/hp/arton/rjb/Base.class
|
44
52
|
- test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
|
45
|
-
- test/jp/co/infoseek/hp/arton/rjb/Test.class
|
46
53
|
- COPYING
|
47
54
|
- ChangeLog
|
48
55
|
- readme.sj
|
49
56
|
- readme.txt
|
50
|
-
|
51
|
-
|
52
|
-
post_install_message:
|
57
|
+
test_files:
|
58
|
+
- test/test.rb
|
53
59
|
rdoc_options: []
|
54
60
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
version: 1.8.2
|
62
|
-
version:
|
63
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0"
|
68
|
-
version:
|
61
|
+
extra_rdoc_files: []
|
62
|
+
|
63
|
+
executables: []
|
64
|
+
|
65
|
+
extensions:
|
66
|
+
- ext/extconf.rb
|
69
67
|
requirements:
|
70
68
|
- none
|
71
69
|
- JDK 5.0
|
72
|
-
|
73
|
-
|
74
|
-
signing_key:
|
75
|
-
specification_version: 2
|
76
|
-
summary: Ruby Java bridge
|
77
|
-
test_files:
|
78
|
-
- test/test.rb
|
70
|
+
dependencies: []
|
71
|
+
|