mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c051ec7bc0
commit
95698ff2a4
4 changed files with 28 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
Wed May 21 01:28:47 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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 <mame@tsg.ne.jp>
|
||||
|
||||
* test/ruby/test_array.rb: fix tests for 64bit CPU.
|
||||
|
|
|
@ -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 */
|
||||
|
|
19
transcode.c
19
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);
|
||||
}
|
||||
|
|
|
@ -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[];
|
||||
|
|
Loading…
Reference in a new issue