diff --git a/ChangeLog b/ChangeLog index 3f739b9589..278426b33b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed May 21 01:28:47 2008 NARUSE, Yui + + * transcode.c, include/ruby/encodng.h (rb_str_transcode): + C API of encoding conversion for Ruby object. + VALUE rb_str_transcode(VALUE str, VALUE to). + + * transcode.c (str_encode, str_encode_bang): + rename from rb_tr_transcode or rb_str_transcode_bang. + Tue May 20 23:26:05 2008 Yusuke Endoh * test/ruby/test_array.rb: fix tests for 64bit CPU. diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 0a6b7c18e2..e5820beb7c 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -193,4 +193,6 @@ rb_enc_dummy_p(rb_encoding *enc) return ENC_DUMMY_P(ENC_FROM_ENCODING(enc)); } +VALUE rb_str_transcode(VALUE str, VALUE to); + #endif /* RUBY_ENCODING_H */ diff --git a/transcode.c b/transcode.c index c6e6a3eded..60aee66d5d 100644 --- a/transcode.c +++ b/transcode.c @@ -397,7 +397,7 @@ str_transcode(int argc, VALUE *argv, VALUE *self) */ static VALUE -rb_str_transcode_bang(int argc, VALUE *argv, VALUE str) +str_encode_bang(int argc, VALUE *argv, VALUE str) { VALUE newstr = str; int encidx = str_transcode(argc, argv, &newstr); @@ -432,10 +432,19 @@ rb_str_transcode_bang(int argc, VALUE *argv, VALUE str) */ static VALUE -rb_str_transcode(int argc, VALUE *argv, VALUE str) +str_encode(int argc, VALUE *argv, VALUE str) { str = rb_str_dup(str); - return rb_str_transcode_bang(argc, argv, str); + return str_encode_bang(argc, argv, str); +} + +VALUE +rb_str_transcode(VALUE str, VALUE to) +{ + int argc = 1; + VALUE argv = rb_ary_new2(1); + rb_ary_push(argv, to); + return str_encode(argc, &argv, str); } void @@ -447,6 +456,6 @@ Init_transcode(void) sym_invalid = ID2SYM(rb_intern("invalid")); sym_ignore = ID2SYM(rb_intern("ignore")); - rb_define_method(rb_cString, "encode", rb_str_transcode, -1); - rb_define_method(rb_cString, "encode!", rb_str_transcode_bang, -1); + rb_define_method(rb_cString, "encode", str_encode, -1); + rb_define_method(rb_cString, "encode!", str_encode_bang, -1); } diff --git a/version.h b/version.h index 29ddf70ea9..f278b39eac 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2008-05-20" +#define RUBY_RELEASE_DATE "2008-05-21" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20080520 +#define RUBY_RELEASE_CODE 20080521 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 5 -#define RUBY_RELEASE_DAY 20 +#define RUBY_RELEASE_DAY 21 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];