[macruby-changes] [3371] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 29 17:26:55 PST 2010


Revision: 3371
          http://trac.macosforge.org/projects/ruby/changeset/3371
Author:   lsansonetti at apple.com
Date:     2010-01-29 17:26:55 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
register not implemented methods with rb_f_notimplement()

Modified Paths:
--------------
    MacRuby/trunk/dir.c
    MacRuby/trunk/file.c
    MacRuby/trunk/gc.c
    MacRuby/trunk/io.c
    MacRuby/trunk/process.c

Modified: MacRuby/trunk/dir.c
===================================================================
--- MacRuby/trunk/dir.c	2010-01-30 01:25:56 UTC (rev 3370)
+++ MacRuby/trunk/dir.c	2010-01-30 01:26:55 UTC (rev 3371)
@@ -528,20 +528,20 @@
  *     d.read   #=> "."
  *     d.tell   #=> 12
  */
+#ifdef HAVE_TELLDIR
 static VALUE
 dir_tell(VALUE dir, SEL sel)
 {
-#ifdef HAVE_TELLDIR
     struct dir_data *dirp;
     long pos;
 
     GetDIR(dir, dirp);
     pos = telldir(dirp->dir);
     return rb_int2inum(pos);
+}
 #else
-    rb_notimplement();
+# define dir_tell rb_f_notimplement
 #endif
-}
 
 /*
  *  call-seq:
@@ -557,6 +557,7 @@
  *     d.seek(i)                #=> #<Dir:0x401b3c40>
  *     d.read                   #=> ".."
  */
+#ifdef HAVE_SEEKDIR
 static VALUE
 dir_seek(VALUE dir, SEL sel, VALUE pos)
 {
@@ -564,13 +565,12 @@
     off_t p = NUM2OFFT(pos);
 
     GetDIR(dir, dirp);
-#ifdef HAVE_SEEKDIR
     seekdir(dirp->dir, p);
     return dir;
+}
 #else
-    rb_notimplement();
+# define dir_seek rb_f_notimplement
 #endif
-}
 
 /*
  *  call-seq:
@@ -797,10 +797,10 @@
  *  platforms. On Unix systems, see <code>chroot(2)</code> for more
  *  information.
  */
+#if defined(HAVE_CHROOT) && !defined(__CHECKER__)
 static VALUE
 dir_s_chroot(VALUE dir, SEL sel, VALUE path)
 {
-#if defined(HAVE_CHROOT) && !defined(__CHECKER__)
     const char *path_cstr = RSTRING_PTR(path);
 
     check_dirname(&path);
@@ -809,11 +809,10 @@
 	rb_sys_fail(path_cstr);
 
     return INT2FIX(0);
+}
 #else
-    rb_notimplement();
-    return Qnil;		/* not reached */
+# define dir_s_chroot rb_f_notimplement
 #endif
-}
 
 /*
  *  call-seq:

Modified: MacRuby/trunk/file.c
===================================================================
--- MacRuby/trunk/file.c	2010-01-30 01:25:56 UTC (rev 3370)
+++ MacRuby/trunk/file.c	2010-01-30 01:26:55 UTC (rev 3371)
@@ -831,25 +831,26 @@
  *     f.stat.size                             #=> 66
  */
 
+#if HAVE_LSTAT
 static VALUE
 rb_file_lstat(VALUE obj, SEL sel)
 {
-// #ifdef HAVE_LSTAT
-//     rb_io_t *fptr;
-//     struct stat st;
-// 
-//     rb_secure(2);
-//     GetOpenFile(obj, fptr);
-//     if (!fptr->path) return Qnil;
-//     if (lstat(fptr->path, &st) == -1) {
-//  rb_sys_fail(fptr->path);
-//     }
-//     return stat_new(&st);
-// #else
-//     return rb_io_stat(obj, 0);
-// #endif
-    rb_notimplement();
+    rb_io_t *fptr;
+    struct stat st;
+
+    rb_secure(2);
+    GetOpenFile(obj, fptr);
+    if (fptr->path == NULL) {
+	return Qnil;
+    }
+    if (lstat(RSTRING_PTR(fptr->path), &st) == -1) {
+	rb_sys_fail(RSTRING_PTR(fptr->path));
+    }
+    return stat_new(&st);
 }
+#else
+# define rb_file_lstat rb_f_notimplement
+#endif
 
 #ifndef HAVE_GROUP_MEMBER
 static int
@@ -1843,12 +1844,7 @@
     return LONG2FIX(n);
 }
 #else
-static VALUE
-rb_file_s_lchmod(int argc, VALUE *argv)
-{
-    rb_notimplement();
-    return Qnil;		/* not reached */
-}
+# define rb_file_s_lchmod rb_f_notimplement
 #endif
 
 struct chown_args {
@@ -1983,11 +1979,7 @@
     return LONG2FIX(n);
 }
 #else
-static VALUE
-rb_file_s_lchown(int argc, VALUE *argv)
-{
-    rb_notimplement();
-}
+# define rb_file_s_lchown rb_f_notimplement
 #endif
 
 struct timespec rb_time_timespec(VALUE time);
@@ -2128,10 +2120,10 @@
  *     IO.readlines(".testfile")[0]         #=> "This is line one\n"
  */
 
+#ifdef HAVE_LINK
 static VALUE
 rb_file_s_link(VALUE klass, SEL sel, VALUE from, VALUE to)
 {
-#ifdef HAVE_LINK
     rb_secure(2);
     FilePathValue(from);
     FilePathValue(to);
@@ -2140,11 +2132,10 @@
 	sys_fail2(from, to);
     }
     return INT2FIX(0);
+}
 #else
-    rb_notimplement();
-    return Qnil;		/* not reached */
+# define rb_file_s_link rb_f_notimplement
 #endif
-}
 
 /*
  *  call-seq:
@@ -2158,10 +2149,10 @@
  *     
  */
 
+#ifdef HAVE_SYMLINK
 static VALUE
 rb_file_s_symlink(VALUE klass, SEL sel, VALUE from, VALUE to)
 {
-#ifdef HAVE_SYMLINK
     rb_secure(2);
     FilePathValue(from);
     FilePathValue(to);
@@ -2170,11 +2161,10 @@
 	sys_fail2(from, to);
     }
     return INT2FIX(0);
+}
 #else
-    rb_notimplement();
-    return Qnil;		/* not reached */
+# define rb_file_s_symlink rb_f_notimplement
 #endif
-}
 
 /*
  *  call-seq:
@@ -2187,10 +2177,10 @@
  *     File.readlink("link2test")              #=> "testfile"
  */
 
+#ifdef HAVE_READLINK
 static VALUE
 rb_file_s_readlink(VALUE klass, SEL sel, VALUE path)
 {
-#ifdef HAVE_READLINK
     char *buf;
     int size = 100;
     int rv;
@@ -2215,11 +2205,10 @@
     xfree(buf);
 
     return v;
+}
 #else
-    rb_notimplement();
-    return Qnil;		/* not reached */
+# define rb_file_s_readlink rb_f_notimplement 
 #endif
-}
 
 static void
 unlink_internal(const char *path, void *arg)

Modified: MacRuby/trunk/gc.c
===================================================================
--- MacRuby/trunk/gc.c	2010-01-30 01:25:56 UTC (rev 3370)
+++ MacRuby/trunk/gc.c	2010-01-30 01:26:55 UTC (rev 3371)
@@ -66,12 +66,15 @@
  *  returns current status of GC stress mode.
  */
 
+#if 0
 static VALUE
 gc_stress_get(VALUE self, SEL sel)
 {
-    rb_notimplement();
     return Qnil;
 }
+#else
+# define gc_stress_get rb_f_notimplement
+#endif
 
 /*
  *  call-seq:
@@ -85,12 +88,15 @@
  *  Since it makes Ruby very slow, it is only for debugging.
  */
 
+#if 0
 static VALUE
 gc_stress_set(VALUE self, SEL sel, VALUE flag)
 {
-    rb_notimplement();
     return Qnil;
 }
+#else
+# define gc_stress_set rb_f_notimplement
+#endif
 
 static int garbage_collect(void);
 

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2010-01-30 01:25:56 UTC (rev 3370)
+++ MacRuby/trunk/io.c	2010-01-30 01:26:55 UTC (rev 3371)
@@ -1037,11 +1037,15 @@
  *
  */
 
+#if 0
 static VALUE
 io_read_nonblock(VALUE io, SEL sel, int argc, VALUE *argv)
 {
-    rb_notimplement();
+    return Qnil;
 }
+#else
+# define io_read_nonblock rb_f_notimplement
+#endif
 
 /*
  *  call-seq:
@@ -1060,11 +1064,15 @@
  *
  */
 
+#if 0
 static VALUE
 rb_io_write_nonblock(VALUE io, SEL sel, VALUE str)
 {
-    rb_notimplement();
+    return Qnil;
 }
+#else
+# define rb_io_write_nonblock rb_f_notimplement
+#endif
 
 /*
  *  call-seq:
@@ -1983,7 +1991,7 @@
     prepare_getline_args(argc, argv, &rs, &limit, io);
     return rb_io_getline_1(rs, limit, io);
 #endif
-	rb_notimplement();
+    rb_notimplement();
 }
 
 VALUE

Modified: MacRuby/trunk/process.c
===================================================================
--- MacRuby/trunk/process.c	2010-01-30 01:25:56 UTC (rev 3370)
+++ MacRuby/trunk/process.c	2010-01-30 01:26:55 UTC (rev 3371)
@@ -2378,6 +2378,7 @@
  *  fork doesn't copy other threads.
  */
 
+#if 0
 static VALUE
 rb_f_fork(VALUE obj, SEL sel)
 {
@@ -2385,8 +2386,6 @@
 
     rb_secure(2);
 
-    rb_raise(rb_eRuntimeError, "fork is not supported yet");
-
     switch (pid = rb_fork(0, 0, 0, Qnil)) {
       case 0:
 	//rb_thread_atfork();
@@ -2406,6 +2405,9 @@
 	return PIDT2NUM(pid);
     }
 }
+#else
+# define rb_f_fork rb_f_notimplement
+#endif
 
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100129/c36f9dea/attachment-0001.html>


More information about the macruby-changes mailing list