[macruby-changes] [1992] MacRuby/branches/experimental/error.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Jul 5 16:16:13 PDT 2009


Revision: 1992
          http://trac.macosforge.org/projects/ruby/changeset/1992
Author:   lsansonetti at apple.com
Date:     2009-07-05 16:16:12 -0700 (Sun, 05 Jul 2009)
Log Message:
-----------
added rb_obj_type() for debugging

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

Modified: MacRuby/branches/experimental/error.c
===================================================================
--- MacRuby/branches/experimental/error.c	2009-07-05 22:51:50 UTC (rev 1991)
+++ MacRuby/branches/experimental/error.c	2009-07-05 23:16:12 UTC (rev 1992)
@@ -267,8 +267,22 @@
     {T_MATCH,	"MatchData"},	/* data of $~ */
     {T_NODE,	"Node"},	/* internal use: syntax tree node */
     {T_UNDEF,	"undef"},	/* internal use: #undef; should not happen */
+    {T_NATIVE,  "native"}
 };
 
+const char *
+rb_obj_type(VALUE x)
+{
+    int i;
+    const int t = TYPE(x);
+    for (i = 0; i < sizeof(builtin_types) / sizeof(builtin_types[0]); i++) {
+	if (t == builtin_types[i].type) {
+	    return builtin_types[i].name;
+	}
+    }
+    return "unknown";
+}
+
 void
 rb_check_type(VALUE x, int t)
 {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090705/10deac6b/attachment.html>


More information about the macruby-changes mailing list