summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-03 05:05:29 (GMT)
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-03 05:05:29 (GMT)
commitbdc55aa0c690e343be3b31a62c5f44a41f22e330 (patch)
tree168b1f7f88f755f92180e348117af34a11e5cf52 /rational.c
parent89ae71d72157aa8800443741ff328199d7ba59e5 (diff)
* complex.c: wrote Complex#_dump and Complex::load. But now
disabled (due to compatibility) [experimental]. * rational.c: wrote Rational#_dump and Rational::load. ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/rational.c b/rational.c
index c4469c8..258f901 100644
--- a/rational.c
+++ b/rational.c
@@ -1600,6 +1600,19 @@ nurat_marshal_dump(VALUE self)
return a;
}
+#ifdef MARSHAL_OLD_STYLE
+VALUE marshal_dump(int, VALUE *);
+
+/* :nodoc: */
+static VALUE
+nurat_marshal__dump(VALUE self, VALUE limit)
+{
+ VALUE argv[1];
+ argv[0] = nurat_marshal_dump(self);
+ return marshal_dump(1, argv);
+}
+#endif
+
/* :nodoc: */
static VALUE
nurat_marshal_load(VALUE self, VALUE a)
@@ -1622,6 +1635,17 @@ nurat_marshal_load(VALUE self, VALUE a)
return self;
}
+#ifdef MARSHAL_OLD_STYLE
+VALUE marshal_load(int, VALUE *);
+
+/* :nodoc: */
+static VALUE
+nurat_marshal__load(VALUE klass, VALUE s)
+{
+ return nurat_marshal_load(nurat_s_alloc(klass), marshal_load(1, &s));
+}
+#endif
+
/* --- */
VALUE
@@ -2374,8 +2398,13 @@ Init_Rational(void)
rb_define_method(rb_cRational, "to_s", nurat_to_s, 0);
rb_define_method(rb_cRational, "inspect", nurat_inspect, 0);
+#ifndef MARSHAL_OLD_STYLE
rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
rb_define_method(rb_cRational, "marshal_load", nurat_marshal_load, 1);
+#else
+ rb_define_method(rb_cRational, "_dump", nurat_marshal__dump, 1);
+ rb_define_singleton_method(rb_cRational, "_load", nurat_marshal__load, 1);
+#endif
/* --- */