[macruby-changes] [5229] MacRuby/trunk/error.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 10 14:39:35 PST 2011


Revision: 5229
          http://trac.macosforge.org/projects/ruby/changeset/5229
Author:   lsansonetti at apple.com
Date:     2011-02-10 14:39:34 -0800 (Thu, 10 Feb 2011)
Log Message:
-----------
add the Errno.code method to return the current errno value

Modified Paths:
--------------
    MacRuby/trunk/error.c

Modified: MacRuby/trunk/error.c
===================================================================
--- MacRuby/trunk/error.c	2011-02-10 01:54:34 UTC (rev 5228)
+++ MacRuby/trunk/error.c	2011-02-10 22:39:34 UTC (rev 5229)
@@ -1053,6 +1053,18 @@
 }
 
 /*
+ * call-seq:
+ *   Errno.code   => Fixnum
+ *
+ * Returns the current errno value.
+ */
+static VALUE
+errno_code(VALUE self, SEL sel)
+{
+    return INT2FIX(errno);
+}
+
+/*
  *  Descendants of class <code>Exception</code> are used to communicate
  *  between <code>raise</code> methods and <code>rescue</code>
  *  statements in <code>begin/end</code> blocks. <code>Exception</code>
@@ -1129,6 +1141,7 @@
 
     rb_mErrno = rb_define_module("Errno");
     rb_objc_define_method(*(VALUE *)rb_mErrno, "const_missing", errno_missing, 1);
+    rb_objc_define_method(*(VALUE *)rb_mErrno, "code", errno_code, 0);
 
     rb_objc_define_module_function(rb_mKernel, "warn", rb_warn_m, 1);
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110210/f45b79fe/attachment.html>


More information about the macruby-changes mailing list