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

source_changes at macosforge.org source_changes at macosforge.org
Wed May 27 13:34:35 PDT 2009


Revision: 1613
          http://trac.macosforge.org/projects/ruby/changeset/1613
Author:   pthomson at apple.com
Date:     2009-05-27 13:34:34 -0700 (Wed, 27 May 2009)
Log Message:
-----------
Implemented IO#sysopen.

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

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-05-27 20:30:55 UTC (rev 1612)
+++ MacRuby/branches/experimental/io.c	2009-05-27 20:34:34 UTC (rev 1613)
@@ -2029,23 +2029,6 @@
 
 /*
  *  call-seq:
- *     IO.sysopen(path, [mode, [perm]])  => fixnum
- *
- *  Opens the given path, returning the underlying file descriptor as a
- *  <code>Fixnum</code>.
- *
- *     IO.sysopen("testfile")   #=> 3
- *
- */
-
-static VALUE
-rb_io_s_sysopen(VALUE klass, SEL sel, int argc, VALUE *argv)
-{
-rb_notimplement();
-}
-
-/*
- *  call-seq:
  *     open(path [, mode_enc [, perm]] )                => io or nil
  *     open(path [, mode_enc [, perm]] ) {|io| block }  => obj
  *
@@ -2186,8 +2169,27 @@
 	return io;
 }
 
+
 /*
  *  call-seq:
+ *     IO.sysopen(path, [mode, [perm]])  => fixnum
+ *
+ *  Opens the given path, returning the underlying file descriptor as a
+ *  <code>Fixnum</code>.
+ *
+ *     IO.sysopen("testfile")   #=> 3
+ *
+ */
+
+static VALUE
+rb_io_s_sysopen(VALUE klass, SEL sel, int argc, VALUE *argv)
+{
+	VALUE f = rb_f_open(klass, sel, argc, argv);
+	return INT2FIX(ExtractIOStruct(f)->fd);
+}
+
+/*
+ *  call-seq:
  *     ios.reopen(other_IO)         => ios
  *     ios.reopen(path, mode_str)   => ios
  *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090527/0608b37d/attachment.html>


More information about the macruby-changes mailing list