marshal_load(p1) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
static VALUE
d_lite_marshal_load(VALUE self, VALUE a)
{
    get_d1(self);

    if (TYPE(a) != T_ARRAY)
        rb_raise(rb_eTypeError, "expected an array");

    switch (RARRAY_LEN(a)) {
      case 3:
        {
            VALUE ajd, of, sg, nth, sf;
            int jd, df, rof;
            double rsg;

            ajd = RARRAY_PTR(a)[0];
            of = RARRAY_PTR(a)[1];
            sg = RARRAY_PTR(a)[2];

            old_to_new(ajd, of, sg,
                       &nth, &jd, &df, &sf, &rof, &rsg);

            if (!df && f_zero_p(sf) && !rof) {
                set_to_simple(&dat->s, nth, jd, rsg, 0, 0, 0, HAVE_JD);
            } else {
                if (!complex_dat_p(dat))
                    rb_raise(rb_eArgError,
                             "cannot load complex into simple");

                set_to_complex(&dat->c, nth, jd, df, sf, rof, rsg,
                               0, 0, 0, 0, 0, 0,
                               HAVE_JD | HAVE_DF | COMPLEX_DAT);
            }
        }
        break;
      case 6:
        {
            VALUE nth, sf;
            int jd, df, of;
            double sg;

            nth = RARRAY_PTR(a)[0];
            jd = NUM2INT(RARRAY_PTR(a)[1]);
            df = NUM2INT(RARRAY_PTR(a)[2]);
            sf = RARRAY_PTR(a)[3];
            of = NUM2INT(RARRAY_PTR(a)[4]);
            sg = NUM2DBL(RARRAY_PTR(a)[5]);
            if (!df && f_zero_p(sf) && !of) {
                set_to_simple(&dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD);
            } else {
                if (!complex_dat_p(dat))
                    rb_raise(rb_eArgError,
                             "cannot load complex into simple");

                set_to_complex(&dat->c, nth, jd, df, sf, of, sg,
                               0, 0, 0, 0, 0, 0,
                               HAVE_JD | HAVE_DF | COMPLEX_DAT);
            }
        }
        break;
      default:
        rb_raise(rb_eTypeError, "invalid size");
        break;
    }

    if (FL_TEST(a, FL_EXIVAR)) {
        rb_copy_generic_ivar(self, a);
        FL_SET(self, FL_EXIVAR);
    }

    return self;
}
Register or log in to add new notes.