[macruby-changes] [230] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed May 28 00:51:42 PDT 2008


Revision: 230
          http://trac.macosforge.org/projects/ruby/changeset/230
Author:   lsansonetti at apple.com
Date:     2008-05-28 00:51:41 -0700 (Wed, 28 May 2008)

Log Message:
-----------
fixing marshaling bugs, ri is now working

Modified Paths:
--------------
    MacRuby/trunk/lib/rdoc/ri/driver.rb
    MacRuby/trunk/marshal.c

Modified: MacRuby/trunk/lib/rdoc/ri/driver.rb
===================================================================
--- MacRuby/trunk/lib/rdoc/ri/driver.rb	2008-05-27 23:44:51 UTC (rev 229)
+++ MacRuby/trunk/lib/rdoc/ri/driver.rb	2008-05-28 07:51:41 UTC (rev 230)
@@ -413,9 +413,12 @@
   end
 
   def write_cache(cache, path)
-    File.open path, "wb" do |cache_file|
-      Marshal.dump cache, cache_file
-    end
+    # FIXME the following code doesn't work in MR yet
+    #File.open path, "wb" do |cache_file|
+    #  Marshal.dump cache, cache_file
+    #end
+    data = Marshal.dump cache
+    File.open path, 'wb' { |io| io.write data }
 
     cache
   end

Modified: MacRuby/trunk/marshal.c
===================================================================
--- MacRuby/trunk/marshal.c	2008-05-27 23:44:51 UTC (rev 229)
+++ MacRuby/trunk/marshal.c	2008-05-28 07:51:41 UTC (rev 230)
@@ -598,24 +598,6 @@
     else {
 	if (OBJ_TAINTED(obj)) arg->taint = Qtrue;
 
-	st_add_direct(arg->data, obj, arg->data->num_entries);
-
-#if WITH_OBJC
-	if (!rb_objc_is_non_native(obj))
-#endif
-        {
-            st_data_t compat_data;
-            rb_alloc_func_t allocator = rb_get_alloc_func(RBASIC(obj)->klass);
-            if (st_lookup(compat_allocator_tbl,
-                          (st_data_t)allocator,
-                          &compat_data)) {
-                marshal_compat_t *compat = (marshal_compat_t*)compat_data;
-                VALUE real_obj = obj;
-                obj = compat->dumper(real_obj);
-                st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
-            }
-        }
-
 	if (rb_respond_to(obj, s_mdump)) {
 	    volatile VALUE v;
 
@@ -929,6 +911,8 @@
 	arg.str = port;
     }
 
+    RSTRING_PTR(arg.str); /* force bytestring creation */
+
     arg.symbols = st_init_numtable();
     arg.data    = st_init_numtable();
     arg.taint   = Qfalse;
@@ -1265,21 +1249,23 @@
       case TYPE_UCLASS:
 	{
 	    VALUE c = path2class(r_unique(arg));
+	    bool non_native;
 
 	    if (FL_TEST(c, FL_SINGLETON)) {
 		rb_raise(rb_eTypeError, "singleton can't be loaded");
 	    }
 	    v = r_object0(arg, 0, extmod);
-	    if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
-	      format_error:
-		rb_raise(rb_eArgError, "dump format error (user class)");
-	    }
 #if WITH_OBJC
 	    if (rb_objc_is_non_native(v)) {
 		*(Class *)v = RCLASS_OCID(c);	
 	    }
-	    else {
+	    else
 #endif
+	    {
+		if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
+format_error:
+		    rb_raise(rb_eArgError, "dump format error (user class)");
+		}
 		if (TYPE(v) == T_MODULE || !RTEST(rb_class_inherited_p(c, RBASIC(v)->klass))) {
 		    VALUE tmp = rb_obj_alloc(c);
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080528/b1bd786d/attachment.htm 


More information about the macruby-changes mailing list