Revision
588
Author
lsansonetti@apple.com
Date
2008-09-08 20:26:36 -0700 (Mon, 08 Sep 2008)

Log Message

marshalize T_OBJECT's ivars

Modified Paths

Diff

Modified: MacRuby/trunk/marshal.c (587 => 588)


--- MacRuby/trunk/marshal.c	2008-09-09 01:55:33 UTC (rev 587)
+++ MacRuby/trunk/marshal.c	2008-09-09 03:26:36 UTC (rev 588)
@@ -536,7 +536,18 @@
 static void
 w_objivar(VALUE obj, struct dump_call_arg *arg)
 {
-#if !WITH_OBJC /* TODO */
+#if WITH_OBJC
+    VALUE ary = rb_obj_instance_variables(obj);
+    int i, len = RARRAY_LEN(ary);
+
+    w_encoding(obj, len, arg);
+
+    for (i = 0; i < len; i++) {
+	ID var_id = SYM2ID(RARRAY_AT(ary, i));
+	VALUE var_val = rb_ivar_get(obj, var_id);
+	w_obj_each(var_id, var_val, arg);
+    }
+#else
     VALUE *ptr;
     long i, len, num;
 
@@ -1243,8 +1254,6 @@
     int type = r_byte(arg);
     long id;
 
-printf("type %c %d\n",(char)type,type);
-
     switch (type) {
       case TYPE_LINK:
 	id = r_long(arg);
@@ -1616,7 +1625,6 @@
 	rb_raise(rb_eArgError, "dump format error(0x%x)", type);
 	break;
     }
-printf("r_object0 -> %p (%s)\n", (void*)v, RSTRING_PTR(rb_inspect(v)));
     return v;
 }