ruby-bsdconv 9.1.1 → 10.0.0

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
- !binary "U0hBMQ==":
3
- metadata.gz: 54a67adad3a37bdadd7c228cf646c550639c3699
4
- data.tar.gz: 390d6efe3f26711152c6470a863f23f09c032a8f
5
- !binary "U0hBNTEy":
6
- metadata.gz: ecac181bd594764a69ddcd7d404bfd620f4fa6cbaa905e33c073e3f3981afcd2718c16b3783c9af2a36b6c18339463353da7bfc9dd35f44a74f6ab11ed2c0a9c
7
- data.tar.gz: eb2479c38dd3afebd4b374cc16d19344dcf25eb3554d05c36014fb987a51527b86bb09958fd16d916ea839f06120fb89af208cd7eed5553cf9a1dfd28e8db395
2
+ SHA1:
3
+ metadata.gz: f2b05eed033029fa06160d0f3a36ab6e41d5bf99
4
+ data.tar.gz: e98db25abc50cfd0ea3e6266c714f3f0d9f0eecf
5
+ SHA512:
6
+ metadata.gz: 95ebfc61ac166317a0bd57f4545369df61375cd73557a9aa8a1dbc5252213d95c7180895fb9cd89a2789dd8ea2447f9e9875bdcc5e6e53e4692898adf5cbf6c4
7
+ data.tar.gz: 5f532a41a2064a6a157514e205c867103be6479728850aed95b39c0ed345994bfe1c5f0d46c05e1b712bec7b551fc22273004724357e7e1e0706b59bd2d850c6
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ desc 'Generate gemspec'
9
9
  task 'gem:spec' do
10
10
  Gemgem.spec = Gemgem.create do |s|
11
11
  s.name = 'ruby-bsdconv'
12
- s.version = '9.1.1'
12
+ s.version = '10.0.0'
13
13
  s.extensions = 'ext/ruby-bsdconv/extconf.rb'
14
14
  s.authors = ['Buganini Q']
15
15
  s.homepage = 'https://github.com/buganini/ruby-bsdconv'
@@ -17,10 +17,6 @@
17
17
 
18
18
  void Init_bsdconv();
19
19
  static VALUE m_new(VALUE, VALUE);
20
- static VALUE m_insert_phase(VALUE, VALUE, VALUE, VALUE);
21
- static VALUE m_insert_codec(VALUE, VALUE, VALUE, VALUE);
22
- static VALUE m_replace_phase(VALUE, VALUE, VALUE, VALUE);
23
- static VALUE m_replace_codec(VALUE, VALUE, VALUE, VALUE);
24
20
  static VALUE m_conv(VALUE, VALUE);
25
21
  static VALUE m_init(VALUE);
26
22
  static VALUE m_ctl(VALUE, VALUE, VALUE, VALUE);
@@ -31,6 +27,10 @@ static VALUE m_info(VALUE);
31
27
  static VALUE m_nil(VALUE);
32
28
  static VALUE m_inspect(VALUE);
33
29
 
30
+ static VALUE f_insert_phase(VALUE, VALUE, VALUE, VALUE, VALUE);
31
+ static VALUE f_insert_codec(VALUE, VALUE, VALUE, VALUE, VALUE);
32
+ static VALUE f_replace_phase(VALUE, VALUE, VALUE, VALUE, VALUE);
33
+ static VALUE f_replace_codec(VALUE, VALUE, VALUE, VALUE, VALUE);
34
34
  static VALUE f_error(VALUE);
35
35
  static VALUE f_codecs_list(VALUE, VALUE);
36
36
  static VALUE f_codec_check(VALUE, VALUE, VALUE);
@@ -42,10 +42,6 @@ VALUE Bsdconv_file;
42
42
  void Init_bsdconv(){
43
43
  VALUE Bsdconv = rb_define_class("Bsdconv", rb_cObject);
44
44
  rb_define_singleton_method(Bsdconv, "new", m_new, 1);
45
- rb_define_method(Bsdconv, "insert_phase", m_insert_phase, 3);
46
- rb_define_method(Bsdconv, "insert_codec", m_insert_codec, 3);
47
- rb_define_method(Bsdconv, "replace_phase", m_replace_phase, 3);
48
- rb_define_method(Bsdconv, "replace_codec", m_replace_codec, 3);
49
45
  rb_define_method(Bsdconv, "conv", m_conv, 1);
50
46
  rb_define_method(Bsdconv, "init", m_init, 0);
51
47
  rb_define_method(Bsdconv, "ctl", m_ctl, 3);
@@ -64,6 +60,10 @@ void Init_bsdconv(){
64
60
  rb_define_const(Bsdconv, "CTL_SET_TRIM_WIDTH", INT2NUM(BSDCONV_SET_TRIM_WIDTH));
65
61
  rb_define_const(Bsdconv, "CTL_ATTACH_OUTPUT_FILE", INT2NUM(BSDCONV_ATTACH_OUTPUT_FILE));
66
62
 
63
+ rb_define_singleton_method(Bsdconv, "insert_phase", f_insert_phase, 4);
64
+ rb_define_singleton_method(Bsdconv, "insert_codec", f_insert_codec, 4);
65
+ rb_define_singleton_method(Bsdconv, "replace_phase", f_replace_phase, 4);
66
+ rb_define_singleton_method(Bsdconv, "replace_codec", f_replace_codec, 4);
67
67
  rb_define_singleton_method(Bsdconv, "error", f_error, 0);
68
68
  rb_define_singleton_method(Bsdconv, "codecs_list", f_codecs_list, 1);
69
69
  rb_define_singleton_method(Bsdconv, "codec_check", f_codec_check, 2);
@@ -84,30 +84,6 @@ static VALUE m_new(VALUE class, VALUE conversion){
84
84
  return Data_Wrap_Struct(class, 0, bsdconv_destroy, ins);
85
85
  }
86
86
 
87
- static VALUE m_insert_phase(VALUE self, VALUE conversion, VALUE phase_type, VALUE phasen){
88
- struct bsdconv_instance *ins;
89
- Data_Get_Struct(self, struct bsdconv_instance, ins);
90
- return INT2NUM(bsdconv_insert_phase(ins, RSTRING_PTR(conversion), NUM2INT(phase_type), NUM2INT(phasen)));
91
- }
92
-
93
- static VALUE m_insert_codec(VALUE self, VALUE conversion, VALUE phasen, VALUE codecn){
94
- struct bsdconv_instance *ins;
95
- Data_Get_Struct(self, struct bsdconv_instance, ins);
96
- return INT2NUM(bsdconv_insert_phase(ins, RSTRING_PTR(conversion), NUM2INT(phasen), NUM2INT(codecn)));
97
- }
98
-
99
- static VALUE m_replace_phase(VALUE self, VALUE conversion, VALUE phase_type, VALUE phasen){
100
- struct bsdconv_instance *ins;
101
- Data_Get_Struct(self, struct bsdconv_instance, ins);
102
- return INT2NUM(bsdconv_insert_phase(ins, RSTRING_PTR(conversion), NUM2INT(phase_type), NUM2INT(phasen)));
103
- }
104
-
105
- static VALUE m_replace_codec(VALUE self, VALUE conversion, VALUE phasen, VALUE codecn){
106
- struct bsdconv_instance *ins;
107
- Data_Get_Struct(self, struct bsdconv_instance, ins);
108
- return INT2NUM(bsdconv_insert_phase(ins, RSTRING_PTR(conversion), NUM2INT(phasen), NUM2INT(codecn)));
109
- }
110
-
111
87
  static VALUE m_conv(VALUE self, VALUE str){
112
88
  VALUE ret;
113
89
  struct bsdconv_instance *ins;
@@ -263,6 +239,34 @@ static VALUE m_inspect(VALUE self){
263
239
  return ret;
264
240
  }
265
241
 
242
+ static VALUE f_insert_phase(VALUE self, VALUE conversion, VALUE codec, VALUE phase_type, VALUE phasen){
243
+ char *s=bsdconv_insert_phase(RSTRING_PTR(conversion), RSTRING_PTR(codec), NUM2INT(phase_type), NUM2INT(phasen));
244
+ char *ret=rb_str_new2(s);
245
+ bsdconv_free(s);
246
+ return ret;
247
+ }
248
+
249
+ static VALUE f_insert_codec(VALUE self, VALUE conversion, VALUE codec, VALUE phasen, VALUE codecn){
250
+ char *s=bsdconv_insert_codec(RSTRING_PTR(conversion), RSTRING_PTR(codec), NUM2INT(phasen), NUM2INT(codecn));
251
+ char *ret=rb_str_new2(s);
252
+ bsdconv_free(s);
253
+ return ret;
254
+ }
255
+
256
+ static VALUE f_replace_phase(VALUE self, VALUE conversion, VALUE codec, VALUE phase_type, VALUE phasen){
257
+ char *s=bsdconv_replace_phase(RSTRING_PTR(conversion), RSTRING_PTR(codec), NUM2INT(phase_type), NUM2INT(phasen));
258
+ char *ret=rb_str_new2(s);
259
+ bsdconv_free(s);
260
+ return ret;
261
+ }
262
+
263
+ static VALUE f_replace_codec(VALUE self, VALUE conversion, VALUE codec, VALUE phasen, VALUE codecn){
264
+ char *s=bsdconv_replace_codec(RSTRING_PTR(conversion), RSTRING_PTR(codec), NUM2INT(phasen), NUM2INT(codecn));
265
+ char *ret=rb_str_new2(s);
266
+ bsdconv_free(s);
267
+ return ret;
268
+ }
269
+
266
270
  static VALUE f_error(VALUE self){
267
271
  VALUE ret;
268
272
  char *s=bsdconv_error();
data/ruby-bsdconv.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ruby-bsdconv"
5
- s.version = "9.1.1"
5
+ s.version = "10.0.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Buganini Q"]
9
- s.date = "2013-03-02"
9
+ s.date = "2013-04-24"
10
10
  s.description = "ruby wrapper for bsdconv. bsdconv is a BSD licensed charset/encoding converter library with more functionalities than libiconv"
11
11
  s.extensions = ["ext/ruby-bsdconv/extconf.rb"]
12
12
  s.files = [
data/test/test_basic.rb CHANGED
@@ -9,5 +9,21 @@ class TestBasic < Test::Unit::TestCase
9
9
  c.init
10
10
  assert_equal '許功蓋',
11
11
  c.conv_chunk("\263\134\245\134\273\134").force_encoding('utf-8')
12
+
13
+ sin="utf-8:utf-8,ascii"
14
+ sout=Bsdconv.insert_phase(sin, "upper", Bsdconv::INTER, 1)
15
+ assert_equal "UTF-8:UPPER:UTF-8,ASCII", sout
16
+
17
+ sin=sout
18
+ sout=Bsdconv.replace_phase(sin, "full", Bsdconv::INTER, 1)
19
+ assert_equal "UTF-8:FULL:UTF-8,ASCII", sout
20
+
21
+ sin=sout
22
+ sout=Bsdconv.replace_codec(sin, "big5", 2, 1)
23
+ assert_equal "UTF-8:FULL:UTF-8,BIG5", sout
24
+
25
+ sin=sout
26
+ sout=Bsdconv.insert_codec(sin, "ascii", 0, 1)
27
+ assert_equal "UTF-8,ASCII:FULL:UTF-8,BIG5", sout
12
28
  end
13
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bsdconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.1
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Buganini Q
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-02 00:00:00.000000000 Z
11
+ date: 2013-04-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ruby wrapper for bsdconv. bsdconv is a BSD licensed charset/encoding
14
14
  converter library with more functionalities than libiconv
@@ -38,12 +38,12 @@ require_paths:
38
38
  - lib
39
39
  required_ruby_version: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ! '>='
41
+ - - '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  requirements: []