コード例 #1
0
ファイル: complex.c プロジェクト: gogotanaka/ruby_svn
/* :nodoc: */
static VALUE
nucomp_marshal_dump(VALUE self)
{
    VALUE a;
    get_dat1(self);

    a = rb_assoc_new(dat->real, dat->imag);
    rb_copy_generic_ivar(a, self);
    return a;
}
コード例 #2
0
ファイル: complex.c プロジェクト: nikuuchi/oreore_ruby
/* :nodoc: */
static VALUE
nucomp_marshal_load(VALUE self, VALUE a)
{
    get_dat1(self);
    Check_Type(a, T_ARRAY);
    dat->real = RARRAY_PTR(a)[0];
    dat->imag = RARRAY_PTR(a)[1];
    rb_copy_generic_ivar(self, a);
    return self;
}
コード例 #3
0
ファイル: rational.c プロジェクト: alloy/mr-experimental
/* :nodoc: */
static VALUE
nurat_marshal_dump(VALUE self, SEL sel)
{
    VALUE a;
    get_dat1(self);

    a = rb_assoc_new(dat->num, dat->den);
    rb_copy_generic_ivar(a, self);
    return a;
}
コード例 #4
0
ファイル: rational.c プロジェクト: alloy/mr-experimental
/* :nodoc: */
static VALUE
nurat_marshal_load(VALUE self, SEL sel, VALUE a)
{
    get_dat1(self);
    dat->num = RARRAY_PTR(a)[0];
    dat->den = RARRAY_PTR(a)[1];
    rb_copy_generic_ivar(self, a);

    if (f_zero_p(dat->den))
	rb_raise_zerodiv();

    return self;
}