rjb 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8d2fe4f37eb369c29fc25f688dbf8623142a59d
4
- data.tar.gz: 0cbd8d8975cbd3292ea1b02e287950412f14bf8f
3
+ metadata.gz: cb3a393975ffb900a204709a4c3d84520f0d30c0
4
+ data.tar.gz: e74ce433645a5bbc2cf701659de8a012e2dddc2d
5
5
  SHA512:
6
- metadata.gz: 0064fb940021e09cd18a5154096eb9abb64ec191b30f1aefccacf57b72a2dd2d8a1d211e99f841235c8bf63173b11fa4f11b2511bb2497f8f0ba5ac7dd543d68
7
- data.tar.gz: 6dfc1a8cbc9d11bc9e310186fb5340f3e2b68bcceccd7bf7b1c84a36abdcdd4904f5548fff298acf9e689593b9dcb15b614de50ea3393cd05b07cc5930551405
6
+ metadata.gz: a1065c8664fd657042733cde7011fe795782ad4fdb9dff29ccec3e0222fda5c7b411393dae203f39d2ff7b608a7e5d1fd156eb18e83e4c38eb662a043aae9886
7
+ data.tar.gz: f84147dadfeb90e296576d9a3cdfeac81c6726ed3e2047d2551184db6e8adb4a4bb60e08482f45a55868339d213ab118ca74a1c8e31c9713d45fd3789dab7eea
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ Sun Dec 14 2014 arton
2
+ *lib/rjb.rb
3
+ FakeDL for Rubinius
4
+ *ext/riconv.c
5
+ Change variable name for avoiding conflicion (Runinius)
6
+ *ext/rjb.
7
+ RJB_VERSION -> 1.5.2
8
+ Support Rubinius (Rubinius's block is T_OBJECT instead of T_DATA -> affected to anonclass)
9
+ *test/test.rb
10
+ skip fixnum range test if Rubinius
1
11
  Tue Sep 23 2014 arton
2
12
  *ext/rjb.c
3
13
  RJB_VERSION -> 1.5.1
@@ -4,5 +4,5 @@
4
4
  #define HAVE_NL_LANGINFO 1
5
5
  #define HAVE_SETLOCALE 1
6
6
  #define HAVE_GETENV 1
7
- #define RJB_RUBY_VERSION_CODE 210
7
+ #define RJB_RUBY_VERSION_CODE 220
8
8
  #endif
data/ext/load.c CHANGED
File without changes
@@ -192,10 +192,10 @@ VALUE exticonv_local_to_utf8(VALUE local_string)
192
192
  return local_string;
193
193
  }
194
194
  #else
195
- VALUE rb_cEncoding, encoding, utf8;
196
- rb_cEncoding = rb_const_get(rb_cObject, rb_intern("Encoding"));
195
+ VALUE cEncoding, encoding, utf8;
196
+ cEncoding = rb_const_get(rb_cObject, rb_intern("Encoding"));
197
197
  encoding = rb_funcall(local_string, rb_intern("encoding"), 0);
198
- utf8 = rb_const_get(rb_cEncoding, rb_intern("UTF_8"));
198
+ utf8 = rb_const_get(cEncoding, rb_intern("UTF_8"));
199
199
  if (encoding != utf8)
200
200
  {
201
201
  VALUE ret = rb_funcall(local_string, rb_intern("encode"), 2, utf8, encoding);
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,2009,2010,2011,2012 arton
3
+ * Copyright(c) 2004,2005,2006,2007,2008,2009,2010,2011,2012,2014 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,9 @@
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 199 2012-12-17 13:31:18Z arton $
16
15
  */
17
16
 
18
- #define RJB_VERSION "1.5.1"
17
+ #define RJB_VERSION "1.5.2"
19
18
 
20
19
  #include "ruby.h"
21
20
  #include "extconf.h"
@@ -847,8 +846,12 @@ static void rv2jobject(JNIEnv* jenv, VALUE val, jvalue* jv, const char* psig, in
847
846
  case T_OBJECT:
848
847
  default:
849
848
  #if defined(DEBUG)
849
+ {
850
+ VALUE v = rb_funcall(val, rb_intern("inspect"), 0);
850
851
  fprintf(stderr, "rtype:%d, sig=%s\n", TYPE(val), psig);
852
+ fprintf(stderr, "obj:%s\n", StringValueCStr(v));
851
853
  fflush(stderr);
854
+ }
852
855
  #endif
853
856
  rb_raise(rb_eRuntimeError, "can't convert to java type");
854
857
  break;
@@ -2180,6 +2183,7 @@ static int check_rtype(JNIEnv* jenv, VALUE* pv, char* p)
2180
2183
  case T_ARRAY:
2181
2184
  return (*p == '[') ? SOSO : UNMATCHED;
2182
2185
  case T_DATA:
2186
+ case T_OBJECT:
2183
2187
  if (IS_RJB_OBJECT(*pv) && pcls)
2184
2188
  {
2185
2189
  /* imported object */
@@ -2200,8 +2204,6 @@ static int check_rtype(JNIEnv* jenv, VALUE* pv, char* p)
2200
2204
  *pv = rjb_s_bind(rjbb, blockobj, rb_str_new2(pcls));
2201
2205
  }
2202
2206
  /* fall down to the next case */
2203
- case T_OBJECT:
2204
- /* fall down to the next case */
2205
2207
  default:
2206
2208
  if (pcls || *p == '[')
2207
2209
  {
data/lib/rjb.rb CHANGED
@@ -4,6 +4,35 @@
4
4
 
5
5
  require 'rbconfig'
6
6
 
7
+ begin
8
+ require 'rubinius/ffi'
9
+ module DL
10
+ extend FFI::Library
11
+ class FakeDL
12
+ def initialize(lib)
13
+ @lib = lib
14
+ end
15
+ def [](fun)
16
+ f = @lib.find_function(fun)
17
+ if f
18
+ f.to_i
19
+ else
20
+ nil
21
+ end
22
+ end
23
+ end
24
+ def self.dlopen(lib)
25
+ a = ffi_lib(lib)
26
+ if Array === a && a.size >= 1
27
+ FakeDL.new(a[0])
28
+ else
29
+ nil
30
+ end
31
+ end
32
+ end
33
+ rescue LoadError
34
+ end
35
+
7
36
  module RjbConf
8
37
  if /darwin/ =~ RUBY_PLATFORM
9
38
  if ENV['JVM_LIB'].nil? || ENV['JVM_LIB'] == ''
@@ -802,13 +802,12 @@ class TestRjb < Test::Unit::TestCase
802
802
  end
803
803
 
804
804
  def test_reraise_exception()
805
- unless /^1\.8/ =~ RUBY_VERSION
806
- begin
807
- cause_exception
808
- rescue
809
- assert($!.to_s =~ /NumberFormatException/)
810
- end
811
- end
805
+ skip('1.8 does not support reraise') if /^1\.8/ =~ RUBY_VERSION
806
+ begin
807
+ cause_exception
808
+ rescue
809
+ assert($!.inspect =~ /NumberFormatException/)
810
+ end
812
811
  end
813
812
 
814
813
 
@@ -874,10 +873,11 @@ class TestRjb < Test::Unit::TestCase
874
873
  assert_equal(cons._classname, sys._invoke('console')._classname)
875
874
  end
876
875
  def test_longarg
876
+ skip('rbx can handle 64bits long') if RUBY_ENGINE == 'rbx'
877
877
  assert_equal(597899502607411822, @jLong.reverse(0x7654321076543210))
878
878
  begin
879
879
  @jLong.reverse(0x76543210765432101)
880
- fail 'no exception for gibnum it doesn\'t convert Java long'
880
+ fail 'no exception for bigbnum it doesn\'t convert Java long'
881
881
  rescue RangeError
882
882
  assert true
883
883
  end
@@ -907,7 +907,7 @@ class TestRjb < Test::Unit::TestCase
907
907
  e = @jString.new("\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8".force_encoding Encoding::EUC_JP)
908
908
  u = @jString.new("\xE6\xBC\xA2\xE5\xAD\x97\xE3\x83\x86\xE3\x82\xAD\xE3\x82\xB9\xE3\x83\x88".force_encoding Encoding::UTF_8)
909
909
  if encoding == 'MS932'
910
- s1 = @jString.new_with_sig('[B', "\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67".bytes)
910
+ s1 = @jString.new("\x8a\xbf\x8e\x9a\x83\x65\x83\x4c\x83\x58\x83\x67".bytes)
911
911
  elsif encoding.upcase == 'EUC-JP'
912
912
  s1 = @jString.new("\xb4\xc1\xbb\xfa\xa5\xc6\xa5\xad\xa5\xb9\xa5\xc8".bytes)
913
913
  elsif encoding.upcase == 'UTF-8'
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.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - arton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2014-12-14 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.
@@ -18,35 +18,29 @@ extensions:
18
18
  - ext/extconf.rb
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - COPYING
22
+ - ChangeLog
23
+ - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
21
24
  - ext/RBridge.java
22
- - ext/load.c
23
- - ext/riconv.c
24
- - ext/rjb.c
25
- - ext/rjbexception.c
25
+ - ext/depend
26
26
  - ext/extconf.h
27
+ - ext/extconf.rb
27
28
  - ext/jniwrap.h
28
29
  - ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
30
+ - ext/load.c
31
+ - ext/riconv.c
29
32
  - ext/riconv.h
33
+ - ext/rjb.c
30
34
  - ext/rjb.h
31
- - ext/depend
32
- - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
35
+ - ext/rjbexception.c
33
36
  - lib/rjb.rb
34
- - lib/rjbextension.rb
35
37
  - lib/rjb/extension.rb
36
38
  - lib/rjb/list.rb
39
+ - lib/rjbextension.rb
40
+ - readme.sj
41
+ - readme.txt
37
42
  - samples/filechooser.rb
38
43
  - samples/unzip.rb
39
- - test/exttest.rb
40
- - test/gctest.rb
41
- - test/jartest.rb
42
- - test/jartest2.rb
43
- - test/jartest3.rb
44
- - test/listtest.rb
45
- - test/osx_jvmcheck.rb
46
- - test/test.rb
47
- - test/test_osxjvm.rb
48
- - test/test_osxload.rb
49
- - test/test_unload.rb
50
44
  - test/Base.class
51
45
  - test/CallbackTest$Callback.class
52
46
  - test/CallbackTest.class
@@ -57,20 +51,26 @@ files:
57
51
  - test/Test.class
58
52
  - test/Two.class
59
53
  - test/TwoCaller.class
54
+ - test/exttest.rb
55
+ - test/gctest.rb
56
+ - test/jartest.jar
57
+ - test/jartest.rb
58
+ - test/jartest2.jar
59
+ - test/jartest2.rb
60
+ - test/jartest3.rb
60
61
  - test/jp/co/infoseek/hp/arton/rjb/CallbackTest$Callback.class
61
62
  - test/jp/co/infoseek/hp/arton/rjb/CallbackTest.class
62
63
  - test/jp/co/infoseek/hp/arton/rjb/IBase.class
63
64
  - test/jp/co/infoseek/hp/arton/rjb/JTest.class
64
65
  - test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
65
66
  - test/jp/co/infoseek/hp/arton/rjb/Test.class
66
- - test/jartest.jar
67
- - test/jartest2.jar
67
+ - test/listtest.rb
68
+ - test/osx_jvmcheck.rb
68
69
  - test/rjbtest.jar
69
- - COPYING
70
- - ChangeLog
71
- - readme.sj
72
- - readme.txt
73
- - ext/extconf.rb
70
+ - test/test.rb
71
+ - test/test_osxjvm.rb
72
+ - test/test_osxload.rb
73
+ - test/test_unload.rb
74
74
  homepage: http://rjb.rubyforge.org/
75
75
  licenses:
76
76
  - LGPL
@@ -81,19 +81,19 @@ require_paths:
81
81
  - lib
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: 1.8.2
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements:
93
93
  - none
94
94
  - JDK 5.0
95
95
  rubyforge_project: rjb
96
- rubygems_version: 2.0.2
96
+ rubygems_version: 2.4.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Ruby Java bridge