Permalink
Browse files

added #default_external=, #default_internal=

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@3908 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
lrz committed Apr 5, 2010
1 parent dab3af8 commit 505141386322f5bdf32e4cf67d7ef24465b3a868
Showing with 18 additions and 2 deletions.
  1. +18 −2 encoding.c
View
@@ -86,12 +86,26 @@ mr_enc_s_default_internal(VALUE klass, SEL sel)
return (VALUE)default_internal;
}
+static VALUE
+mr_enc_set_default_internal(VALUE klass, SEL sel, VALUE enc)
+{
+ default_internal = rb_to_encoding(enc);
+ return (VALUE)default_internal;
+}
+
static VALUE
mr_enc_s_default_external(VALUE klass, SEL sel)
{
return (VALUE)default_external;
}
+static VALUE
+mr_enc_set_default_external(VALUE klass, SEL sel, VALUE enc)
+{
+ default_external = rb_to_encoding(enc);
+ return (VALUE)default_external;
+}
+
static VALUE
mr_enc_name(VALUE self, SEL sel)
{
@@ -286,10 +300,12 @@ Init_Encoding(void)
rb_objc_define_method(*(VALUE *)rb_cEncoding, "default_external",
mr_enc_s_default_external, 0);
- //rb_define_singleton_method(rb_cEncoding, "default_external=", set_default_external, 1);
+ rb_objc_define_method(*(VALUE *)rb_cEncoding, "default_external=",
+ mr_enc_set_default_external, 1);
rb_objc_define_method(*(VALUE *)rb_cEncoding, "default_internal",
mr_enc_s_default_internal, 0);
- //rb_define_singleton_method(rb_cEncoding, "default_internal=", set_default_internal, 1);
+ rb_objc_define_method(*(VALUE *)rb_cEncoding, "default_internal=",
+ mr_enc_set_default_internal, 1);
//rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0);
// Create constants.

0 comments on commit 5051413

Please sign in to comment.