[macruby-changes] [1839] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 11 13:44:53 PDT 2009


Revision: 1839
          http://trac.macosforge.org/projects/ruby/changeset/1839
Author:   pthomson at apple.com
Date:     2009-06-11 13:44:52 -0700 (Thu, 11 Jun 2009)
Log Message:
-----------
Added some future scaffolding for encodings and fixed two specs that shouldn't have been breaking.

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Removed Paths:
-------------
    MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/isatty_tags.txt

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-06-11 19:11:27 UTC (rev 1838)
+++ MacRuby/branches/experimental/io.c	2009-06-11 20:44:52 UTC (rev 1839)
@@ -433,7 +433,7 @@
     rb_secure(4);
     
     io_struct = ExtractIOStruct(io);
-
+	rb_io_assert_writable(io_struct);
     to_write = rb_obj_as_string(to_write);
 
     if (CLASS_OF(to_write) == rb_cByteString) {
@@ -1731,6 +1731,7 @@
 rb_io_isatty(VALUE io, SEL sel)
 {
     rb_io_t *io_s = ExtractIOStruct(io);
+	rb_io_assert_open(io_s);
     return CONDITION_TO_BOOLEAN(isatty(io_s->fd));
 }
 
@@ -3662,19 +3663,25 @@
 static VALUE
 argf_external_encoding(VALUE argf, SEL sel)
 {
-    rb_notimplement();
+    next_argv();
+    ARGF_FORWARD(0, 0);
+	return rb_io_external_encoding(ARGF.current_file, sel);
 }
 
 static VALUE
 argf_internal_encoding(VALUE argf, SEL sel)
 {
-    rb_notimplement();
+    next_argv();
+    ARGF_FORWARD(0, 0);
+	return rb_io_internal_encoding(ARGF.current_file, sel);
 }
 
 static VALUE
 argf_set_encoding(VALUE id, SEL sel, int argc, VALUE *argv)
 {
-    rb_notimplement();
+    next_argv();
+    ARGF_FORWARD(0, 0);
+	return rb_io_set_encoding(ARGF.current_file, sel, argc, argv);
 }
 
 static VALUE
@@ -3949,13 +3956,15 @@
 const char *
 ruby_get_inplace_mode(void)
 {
-    rb_notimplement();
+	return ARGF.inplace;
 }
 
 void
 ruby_set_inplace_mode(const char *suffix)
 {
-    rb_notimplement();
+    if (ARGF.inplace) free(ARGF.inplace);
+    ARGF.inplace = 0;
+    if (suffix) ARGF.inplace = strdup(suffix);
 }
 
 static VALUE

Deleted: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/isatty_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/isatty_tags.txt	2009-06-11 19:11:27 UTC (rev 1838)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/isatty_tags.txt	2009-06-11 20:44:52 UTC (rev 1839)
@@ -1 +0,0 @@
-fails:IO#isatty raises IOError on closed stream
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090611/089afd6a/attachment.html>


More information about the macruby-changes mailing list