[macruby-changes] [1891] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 19 16:04:41 PDT 2009


Revision: 1891
          http://trac.macosforge.org/projects/ruby/changeset/1891
Author:   lsansonetti at apple.com
Date:     2009-06-19 16:04:40 -0700 (Fri, 19 Jun 2009)
Log Message:
-----------
make sure IO can still run irb

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

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-06-19 22:43:08 UTC (rev 1890)
+++ MacRuby/branches/experimental/io.c	2009-06-19 23:04:40 UTC (rev 1891)
@@ -62,6 +62,22 @@
 #define argf_of(obj) (*(struct argf *)DATA_PTR(obj))
 #define ARGF argf_of(argf)
 
+static VALUE
+pop_last_hash(int *argc_p, VALUE *argv)
+{
+    VALUE last, tmp;
+    if (*argc_p == 0) {
+	return Qnil;
+    }
+    last = argv[*argc_p-1];
+    tmp = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
+    if (NIL_P(tmp)) {
+	return Qnil;
+    }
+    (*argc_p)--;
+    return tmp;
+}
+
 static int
 convert_mode_string_to_fmode(VALUE rstr)
 {
@@ -2716,6 +2732,10 @@
     VALUE file_descriptor, mode;
     int mode_flags, fd;
     struct stat st;
+
+    // TODO handle optional hash
+    /*VALUE opt =*/ pop_last_hash(&argc, argv);
+
     rb_scan_args(argc, argv, "11", &file_descriptor, &mode);
 
     rb_io_t *io_struct = ExtractIOStruct(io);
@@ -3633,7 +3653,8 @@
 static VALUE
 rb_io_external_encoding(VALUE io, SEL sel)
 {
-    rb_notimplement();
+    // TODO
+    return Qnil;
 }
 
 /*
@@ -3668,7 +3689,8 @@
 static VALUE
 rb_io_set_encoding(VALUE id, SEL sel, int argc, VALUE *argv)
 {
-    rb_notimplement();
+    // TODO
+    return Qnil;
 }
 
 static VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090619/6b7be8f7/attachment.html>


More information about the macruby-changes mailing list