From bdc55aa0c690e343be3b31a62c5f44a41f22e330 Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 3 Jun 2012 05:05:29 +0000 Subject: * 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 --- complex.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'complex.c') diff --git a/complex.c b/complex.c index 1aae3b6ca8..3b644b2319 100644 --- a/complex.c +++ b/complex.c @@ -1254,6 +1254,19 @@ nucomp_marshal_dump(VALUE self) return a; } +#ifdef MARSHAL_OLD_STYLE +VALUE marshal_dump(int, VALUE *); + +/* :nodoc: */ +static VALUE +nucomp_marshal__dump(VALUE self, VALUE limit) +{ + VALUE argv[1]; + argv[0] = nucomp_marshal_dump(self); + return marshal_dump(1, argv); +} +#endif + /* :nodoc: */ static VALUE nucomp_marshal_load(VALUE self, VALUE a) @@ -1272,6 +1285,17 @@ nucomp_marshal_load(VALUE self, VALUE a) return self; } +#ifdef MARSHAL_OLD_STYLE +VALUE marshal_load(int, VALUE *); + +/* :nodoc: */ +static VALUE +nucomp_marshal__load(VALUE klass, VALUE s) +{ + return nucomp_marshal_load(nucomp_s_alloc(klass), marshal_load(1, &s)); +} +#endif + /* --- */ VALUE @@ -1950,8 +1974,13 @@ Init_Complex(void) rb_define_method(rb_cComplex, "to_s", nucomp_to_s, 0); rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0); +#ifndef MARSHAL_OLD_STYLE rb_define_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0); rb_define_method(rb_cComplex, "marshal_load", nucomp_marshal_load, 1); +#else + rb_define_method(rb_cComplex, "_dump", nucomp_marshal__dump, 1); + rb_define_singleton_method(rb_cComplex, "_load", nucomp_marshal__load, 1); +#endif /* --- */ -- cgit v1.2.3