Exemplo n.º 1
0
static VALUE
rg_get(int argc, VALUE *argv, VALUE self)
{
    VALUE key, type, unit_or_default, result;

    rb_scan_args(argc, argv, "12", &key, &type, &unit_or_default);

    if (NIL_P(type) || (RVAL2CBOOL(rb_equal(type, s_string)))) {
        result = ps_get(self, key);
    } else if (RVAL2CBOOL(rb_equal(type, s_bool))) {
        result = rg_get_bool(self, key);
    } else if (RVAL2CBOOL(rb_equal(type, s_double))) {
        VALUE double_argv[2];
        double_argv[0] = key;
        double_argv[1] = unit_or_default;
        result = rg_get_double(2, double_argv, self);
    } else if (RVAL2CBOOL(rb_equal(type, s_length))) {
        result = rg_get_length(self, key, unit_or_default);
    } else if (RVAL2CBOOL(rb_equal(type, s_int))) {
        VALUE int_argv[2];
        int_argv[0] = key;
        int_argv[1] = unit_or_default;
        result = rg_get_int(2, int_argv, self);
    } else {
        VALUE inspected_type;
        inspected_type = rb_inspect(type);
        rb_raise(rb_eArgError,
                 "%s must be nil, :string, :bool, :double, :length or :int",
                 RVAL2CSTR(inspected_type));
    }

    return result;
}
Exemplo n.º 2
0
static VALUE
exc_equal(VALUE exc, VALUE obj)
{
    VALUE mesg, backtrace;

    if (exc == obj) return Qtrue;

    if (rb_obj_class(exc) != rb_obj_class(obj)) {
	int status = 0;

	obj = rb_protect(try_convert_to_exception, obj, &status);
	if (status || obj == Qundef) {
	    rb_set_errinfo(Qnil);
	    return Qfalse;
	}
	if (rb_obj_class(exc) != rb_obj_class(obj)) return Qfalse;
	mesg = rb_check_funcall(obj, id_message, 0, 0);
	if (mesg == Qundef) return Qfalse;
	backtrace = rb_check_funcall(obj, id_backtrace, 0, 0);
	if (backtrace == Qundef) return Qfalse;
    }
    else {
	mesg = rb_attr_get(obj, id_mesg);
	backtrace = exc_backtrace(obj);
    }

    if (!rb_equal(rb_attr_get(exc, id_mesg), mesg))
	return Qfalse;
    if (!rb_equal(exc_backtrace(exc), backtrace))
	return Qfalse;
    return Qtrue;
}
Exemplo n.º 3
0
static VALUE
exc_equal(VALUE exc, SEL sel, VALUE obj)
{
    VALUE mesg, backtrace;
    if (exc == obj) {
	return Qtrue;
    }
    ID id_mesg = rb_intern("mesg");
    if (rb_obj_class(exc) != rb_obj_class(obj)) {
	SEL sel_message = sel_registerName("message");
	SEL sel_backtrace = sel_registerName("backtrace");

	mesg = rb_vm_check_call(obj, sel_message, 0, NULL);
	if (mesg == Qundef) {
	    return Qfalse;
	}
	backtrace = rb_vm_check_call(obj, sel_backtrace, 0, NULL);
	if (backtrace == Qundef) {
	    return Qfalse;
	}
    }
    else {
        mesg = rb_attr_get(obj, id_mesg);
        backtrace = exc_backtrace(obj, 0);
    }
    if (!rb_equal(rb_attr_get(exc, id_mesg), mesg)) {
        return Qfalse;
    }
    if (!rb_equal(exc_backtrace(exc, 0), backtrace)) {
        return Qfalse;
    }
    return Qtrue;
}
Exemplo n.º 4
0
static VALUE
exc_equal(VALUE exc, VALUE obj)
{
    VALUE mesg, backtrace;
    ID id_mesg;

    if (exc == obj) return Qtrue;
    CONST_ID(id_mesg, "mesg");

    if (rb_obj_class(exc) != rb_obj_class(obj)) {
	ID id_message, id_backtrace;
	CONST_ID(id_message, "message");
	CONST_ID(id_backtrace, "backtrace");

	if (rb_respond_to(obj, id_message) && rb_respond_to(obj, id_backtrace)) {
	    mesg = rb_funcall(obj, id_message, 0, 0);
	    backtrace = rb_funcall(obj, id_backtrace, 0, 0);
	}
	else {
	    return Qfalse;
	}
    }
    else {
	mesg = rb_attr_get(obj, id_mesg);
	backtrace = exc_backtrace(obj);
    }

    if (!rb_equal(rb_attr_get(exc, id_mesg), mesg))
	return Qfalse;
    if (!rb_equal(exc_backtrace(exc), backtrace))
	return Qfalse;
    return Qtrue;
}
Exemplo n.º 5
0
// Vertex#==(other)
VALUE rbVertex::Equal( VALUE aSelf, VALUE anOther )
{
    if( !rb_obj_is_kind_of( anOther, rbVertex::Class ) ) return Qfalse;
    if( !RTEST( rb_equal( rbVertex::GetPosition( aSelf ), rbVertex::GetPosition( anOther ) ) ) ) return Qfalse;
    if( !RTEST( rb_equal( rbVertex::GetColor( aSelf ), rbVertex::GetColor( anOther ) ) ) ) return Qfalse;
    if( !RTEST( rb_equal( rbVertex::GetTexCoords( aSelf ), rbVertex::GetTexCoords( anOther ) ) ) ) return Qfalse;
    return Qtrue;
}
Exemplo n.º 6
0
Arquivo: range.c Projeto: DashYang/sim
static VALUE
recursive_equal(VALUE range, VALUE obj, int recur)
{
    if (recur) return Qtrue; /* Subtle! */
    if (!rb_equal(RANGE_BEG(range), RANGE_BEG(obj)))
	return Qfalse;
    if (!rb_equal(RANGE_END(range), RANGE_END(obj)))
	return Qfalse;

    if (EXCL(range) != EXCL(obj))
	return Qfalse;
    return Qtrue;
}
Exemplo n.º 7
0
static VALUE
num_digits(VALUE self, VALUE n)
{
    if(TYPE(n) != T_FIXNUM)
    {
        rb_raise(rb_eArgError, "Invalid argument for type Fixnum");
        return Qnil;
    }

    if(RTEST(rb_funcall(n, id_lt, 1, ZERO)))
    {
        rb_raise(rb_eArgError, "n cannot be negative");
        return Qnil;
    }

    VALUE phi = ONE;
    VALUE num_digits = ZERO;
    VALUE log_sqrt_5 = ZERO;
    VALUE sqrt_5;

    if(rb_equal(n, ZERO))
    {
      return ZERO;
    }

    /*  work around since the value log(phi/sqrt(5)) + 1 = 0.8595026380819693
     *  converting to integer would be zero */
    if(rb_equal(n, ONE))
    {
      return ONE;
    }

    if(RTEST(rb_funcall(n, id_gte, 1, TWO)))
    {
      sqrt_5 = rb_funcall(rb_mMath, id_sqrt, 1, INT2NUM(5));
      log_sqrt_5 = rb_funcall(rb_mMath, id_log10, 1, sqrt_5);

      phi = rb_funcall(phi, id_plus, 1, sqrt_5);
      phi = rb_funcall(phi, id_fdiv, 1, TWO);

      num_digits = rb_funcall(rb_mMath, id_log10, 1, phi);
      num_digits = rb_funcall(num_digits, id_mul, 1, n);
      num_digits = rb_funcall(num_digits, id_minus, 1, log_sqrt_5);

      num_digits = rb_funcall(num_digits, id_floor, 0);
      num_digits = rb_funcall(num_digits, id_plus, 1, ONE);
      num_digits = rb_funcall(num_digits, id_to_i, 0);

      return num_digits;
    }
}
Exemplo n.º 8
0
static VALUE
exc_equal(VALUE exc, VALUE obj)
{
    ID id_mesg = rb_intern("mesg");

    if (exc == obj) return Qtrue;
    if (rb_obj_class(exc) != rb_obj_class(obj))
	return Qfalse;
    if (!rb_equal(rb_attr_get(exc, id_mesg), rb_attr_get(obj, id_mesg)))
	return Qfalse;
    if (!rb_equal(exc_backtrace(exc), exc_backtrace(obj)))
	return Qfalse;
    return Qtrue;
}
Exemplo n.º 9
0
/*
 * call-seq:
 *     RepeatedField.==(other) => boolean
 *
 * Compares this repeated field to another. Repeated fields are equal if their
 * element types are equal, their lengths are equal, and each element is equal.
 * Elements are compared as per normal Ruby semantics, by calling their :==
 * methods (or performing a more efficient comparison for primitive types).
 *
 * Repeated fields with dissimilar element types are never equal, even if value
 * comparison (for example, between integers and floats) would have otherwise
 * indicated that every element has equal value.
 */
VALUE RepeatedField_eq(VALUE _self, VALUE _other) {
  if (_self == _other) {
    return Qtrue;
  }
  RepeatedField* self = ruby_to_RepeatedField(_self);

  if (TYPE(_other) == T_ARRAY) {
    VALUE self_ary = RepeatedField_to_ary(_self);
    return rb_equal(self_ary, _other);
  }

  RepeatedField* other = ruby_to_RepeatedField(_other);
  if (self->field_type != other->field_type ||
      self->field_type_class != other->field_type_class ||
      self->size != other->size) {
    return Qfalse;
  }

  upb_fieldtype_t field_type = self->field_type;
  size_t elem_size = native_slot_size(field_type);
  size_t off = 0;
  for (int i = 0; i < self->size; i++, off += elem_size) {
    void* self_mem = ((uint8_t *)self->elements) + off;
    void* other_mem = ((uint8_t *)other->elements) + off;
    if (!native_slot_eq(field_type, self_mem, other_mem)) {
      return Qfalse;
    }
  }
  return Qtrue;
}
Exemplo n.º 10
0
static int
rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2)
{
    if (d1 == d2) return 1;
    if (!d1 || !d2) return 0;
    if (d1->type != d2->type) {
	return 0;
    }
    switch (d1->type) {
      case VM_METHOD_TYPE_ISEQ:
	return d1->body.iseq == d2->body.iseq;
      case VM_METHOD_TYPE_CFUNC:
	return
	  d1->body.cfunc.func == d2->body.cfunc.func &&
	  d1->body.cfunc.argc == d2->body.cfunc.argc;
      case VM_METHOD_TYPE_ATTRSET:
      case VM_METHOD_TYPE_IVAR:
	return d1->body.attr.id == d2->body.attr.id;
      case VM_METHOD_TYPE_BMETHOD:
	return RTEST(rb_equal(d1->body.proc, d2->body.proc));
      case VM_METHOD_TYPE_MISSING:
	return d1->original_id == d2->original_id;
      case VM_METHOD_TYPE_ZSUPER:
      case VM_METHOD_TYPE_NOTIMPLEMENTED:
      case VM_METHOD_TYPE_UNDEF:
	return 1;
      case VM_METHOD_TYPE_OPTIMIZED:
	return d1->body.optimize_type == d2->body.optimize_type;
      default:
	rb_bug("rb_method_entry_eq: unsupported method type (%d)\n", d1->type);
	return 0;
    }
}
Exemplo n.º 11
0
static VALUE
hash_equal(VALUE hash1, VALUE hash2, bool eql)
{
    if (hash1 == hash2) {
	return Qtrue;
    }
    if (TYPE(hash2) != T_HASH) {
	if (!rb_respond_to(hash2, rb_intern("to_hash"))) {
	    return Qfalse;
	}
	if (eql) {
	    return rb_eql(hash2, hash1);
	}
	else {
	    return rb_equal(hash2, hash1);
	}
    }
    if (RHASH_SIZE(hash1) != RHASH_SIZE(hash2)) {
	return Qfalse;
    }
    if (IS_RHASH(hash2)) {
	struct equal_data data;
	data.tbl = RHASH(hash2)->tbl;
	data.eql = eql;
	return rb_exec_recursive(recursive_eql, hash1, (VALUE)&data);
    }
    else {
	return CFEqual((CFTypeRef)hash1, (CFTypeRef)hash2) ? Qtrue : Qfalse;
    }
}
Exemplo n.º 12
0
static VALUE
bdb_sary_delete(VALUE obj, VALUE item)
{
    bdb_DB *dbst;
    long i1, i2;
    VALUE tmp, a;

    GetDB(obj, dbst);
    i2 = dbst->len;
    for (i1 = 0; i1 < dbst->len;) {
	tmp = INT2NUM(i1);
	a = bdb_get(1, &tmp, obj);
	if (rb_equal(a, item)) {
	    bdb_del(obj, INT2NUM(i1));
	    dbst->len--;
	}
	else {
	    i1++;
	}
    }
    if (dbst->len == i2) {
	if (rb_block_given_p()) {
	    return rb_yield(item);
	}
	return Qnil;
    }
    return item;
}
Exemplo n.º 13
0
static int
eql_i(VALUE key, VALUE val1, VALUE arg)
{
    struct equal_data *data = (struct equal_data *)arg;
    VALUE val2;

    if (key == Qundef) {
	return ST_CONTINUE;
    }
    if (!st_lookup(data->tbl, key, &val2)) {
        data->result = Qfalse;
        return ST_STOP;
    }
    if (data->eql) {
	if (!rb_eql(val1, val2)) {
	    data->result = Qfalse;
	    return ST_STOP;
	}
    }
    else {
	if (rb_equal(val1, val2) != Qtrue) {
	    data->result = Qfalse;
	    return ST_STOP;
	}
    }
    return ST_CONTINUE;
}
Exemplo n.º 14
0
enum MqErrorE NS(ProcInit) (
  struct MqS	      *mqctx,
  VALUE		      val, 
  MqServiceCallbackF  *procCall, 
  MQ_PTR	      *procData,
  MqDataCopyF	      *procCopy
) {
  SETUP_self
  VALUE dataVal;
  if (rb_obj_is_kind_of(val, rb_cProc) == Qtrue) {
      *procCall = ProcCall;
      *procCopy = ProcCopyProc;
      dataVal   = val;
  } else if (rb_obj_is_kind_of(val, rb_cMethod) == Qtrue) {
    if (rb_equal(self,rb_funcall(val,id_receiver,0,NULL)) == Qtrue) {
      // val belongs to calling object, NO argument is required
      *procCall = ProcCallMethod;
      *procCopy = ProcCopyMethod;
      dataVal   = val;
    } else {
      // val belongs NOT to calling object, argument is required
      *procCall = ProcCallMethodWithArg;
      *procCopy = ProcCopyMethodWithArg;
      dataVal   = rb_ary_new3(2,self,val);
    }
  } else {
    return MqErrorC(mqctx,__func__,1,"expect 'proc' or 'method' argument");
  }
  *procData = VAL2PTR(dataVal);
  INCR_REF(dataVal);
  return MQ_OK;
}
Exemplo n.º 15
0
/* Method: ==(plugin)
 * Returns: true if two Gst::Plugin objects are refered by the same file,
 * false otherwise.
 */
static VALUE
rg_operator_is_equal (VALUE self, VALUE other_plugin)
{
    return NIL_P (other_plugin)
                ? Qfalse
                : rb_equal (rg_filename (self),
                        rg_filename (other_plugin));
}
Exemplo n.º 16
0
/* Method: ==(plugin)
 * Returns: true if two Gst::Plugin objects are refered by the same file,
 * false otherwise.
 */
static VALUE
rb_gst_plugin_is_equal (VALUE self, VALUE other_plugin)
{
    return NIL_P (other_plugin)
           ? Qfalse
           : rb_equal (rb_gst_plugin_get_filename (self),
                       rb_gst_plugin_get_filename (other_plugin));
}
Exemplo n.º 17
0
static VALUE
range_eq(VALUE range, VALUE obj)
{
    if (range == obj)
	return Qtrue;
    if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
	return Qfalse;

    if (!rb_equal(RANGE_BEG(range), RANGE_BEG(obj)))
	return Qfalse;
    if (!rb_equal(RANGE_END(range), RANGE_END(obj)))
	return Qfalse;

    if (EXCL(range) != EXCL(obj))
	return Qfalse;

    return Qtrue;
}
Exemplo n.º 18
0
static int
key_i(VALUE key, VALUE value, VALUE *args)
{
    if (rb_equal(value, args[0])) {
	args[1] = key;
	return ST_STOP;
    }
    return ST_CONTINUE;
}
Exemplo n.º 19
0
Arquivo: ruby.c Projeto: Shoes3/shoes3
long rb_ary_index_of(VALUE ary, VALUE val) {
    long i;

    for (i=0; i<RARRAY_LEN(ary); i++) {
        if (rb_equal(RARRAY_PTR(ary)[i], val))
            return i;
    }

    return -1;
}
Exemplo n.º 20
0
VALUE
supplement_rindex_val( VALUE ary, VALUE val)
{
    long i;

    for (i = RARRAY_LEN( ary); i;)
        if (rb_equal( RARRAY_PTR( ary)[ --i], val))
            return LONG2NUM( i);
    return Qnil;
}
Exemplo n.º 21
0
static int
rassoc_i(VALUE key, VALUE val, VALUE *args)
{
    if (key != Qundef) {
	if (RTEST(rb_equal(args[0], val))) {
	    args[1] = rb_assoc_new(key, val);
	    return ST_STOP;
	}
    }
    return ST_CONTINUE;
}
Exemplo n.º 22
0
static VALUE
recursive_equal(VALUE s, VALUE s2, int recur)
{
    long i;

    if (recur) return Qtrue; /* Subtle! */
    for (i=0; i<RSTRUCT_LEN(s); i++) {
	if (!rb_equal(RSTRUCT_PTR(s)[i], RSTRUCT_PTR(s2)[i])) return Qfalse;
    }
    return Qtrue;
}
Exemplo n.º 23
0
static int
search_value(VALUE key, VALUE value, VALUE arg)
{
    VALUE *data = (VALUE *)arg;
    if (key != Qundef) {
	if (rb_equal(value, data[1])) {
	    data[0] = Qtrue;
	    return ST_STOP;
	}
    }
    return ST_CONTINUE;
}
Exemplo n.º 24
0
static VALUE
print(VALUE self, VALUE n)
{
    VALUE start = ZERO;
    VALUE fib_n_1 = ONE;
    VALUE fib_n_2 = ZERO;
    VALUE fib_n = ZERO;

    if(TYPE(n) != T_FIXNUM)
    {
        rb_raise(rb_eArgError, "Invalid argument for type Fixnum");
        return Qnil;
    }

    if(RTEST(rb_funcall(n, id_lt, 1, ZERO)))
    {
        rb_raise(rb_eArgError, "n cannot be negative");
        return Qnil;
    }

    for(start; RTEST(rb_funcall(start, id_lt, 1, n)); start = rb_funcall(start, id_plus, 1, ONE))
    {
        if(rb_equal(start, ZERO))
        {
            rb_print_num(ZERO);
        }
        else if(rb_equal(start, ONE))
        {
            rb_print_num(ONE);
        }
        else
        {
            fib_n = rb_funcall(fib_n_1, id_plus, 1, fib_n_2);
            fib_n_2 = fib_n_1;
            fib_n_1 = fib_n;
            rb_print_num(fib_n);
        }
    }
    return Qnil;
}
Exemplo n.º 25
0
static VALUE
rb_struct_equal_r(VALUE s, VALUE s2, int recur)
{
    if (recur) {
	return Qtrue;
    }
    for (int i = 0; i < RSTRUCT_LEN(s); i++) {
	if (!rb_equal(RSTRUCT_PTR(s)[i], RSTRUCT_PTR(s2)[i])) {
	    return Qfalse;
	}
    }
    return Qtrue;
}
Exemplo n.º 26
0
VALUE rho_ruby_get_time(VALUE rDate)
{
    VALUE res, cDate;
    if (TYPE(rDate) == T_STRING) {
        rDate = rb_funcall(rb_cTime, rb_intern("parse"), 1, rDate);
    }

    cDate = rb_class_of(rDate);
    if (!rb_equal(cDate, rb_cTime))
        rb_raise(rb_eArgError, "Wrong type of parameter: %s (Time expected)", rb_class2name(cDate));

    return rDate;
}
Exemplo n.º 27
0
static VALUE
rg_operator_treeiter_eql(VALUE self, VALUE other)
{
    gint i, num1, num2;
    GtkTreeIter* iter1 = _SELF(self);
    GtkTreeIter* iter2;
    GtkTreeModel* model1;
    GtkTreeModel* model2;
    GtkTreePath* path1;
    GtkTreePath* path2;

    if (!rb_obj_is_kind_of(other, GTYPE2CLASS(GTK_TYPE_TREE_ITER)))
        return Qfalse;

    iter2 = _SELF(other);

    model1 = (GtkTreeModel*)iter1->user_data3;
    model2 = (GtkTreeModel*)iter2->user_data3;
    if (model1 != model2) return Qfalse;

    num1 = gtk_tree_model_get_n_columns(model1);
    num2 = gtk_tree_model_get_n_columns(model2);
    if (num1 != num2) return Qfalse;

    path1 = gtk_tree_model_get_path(model1, iter1);
    path2 = gtk_tree_model_get_path(model2, iter2);
    if (gtk_tree_path_compare(path1, path2) != 0) {
        gtk_tree_path_free(path1);
        gtk_tree_path_free(path2);
        return Qfalse;
    } else {
        gtk_tree_path_free(path1);
        gtk_tree_path_free(path2);
    }

    for (i = 0; i < num1; i++){
        GValue gval1 = G_VALUE_INIT;
        GValue gval2 = G_VALUE_INIT;
        VALUE ret1, ret2;
        gtk_tree_model_get_value(model1, iter1, i, &gval1);
        gtk_tree_model_get_value(model2, iter2, i, &gval2);

        ret1 = GVAL2RVAL(&gval1);
        ret2 = GVAL2RVAL(&gval2);
        g_value_unset(&gval1);
        g_value_unset(&gval2);
        if (rb_equal(ret1, ret2) == Qfalse) 
            return Qfalse;
    }
    return Qtrue;
}
Exemplo n.º 28
0
static VALUE
range_eq(VALUE range, SEL sel, VALUE obj)
{
    if (range == obj) {
	return Qtrue;
    }
    if (!rb_obj_is_kind_of(obj, rb_cRange)) {
	return Qfalse;
    }

    if (!rb_equal(RANGE_BEG(range), RANGE_BEG(obj))) {
	return Qfalse;
    }
    if (!rb_equal(RANGE_END(range), RANGE_END(obj))) {
	return Qfalse;
    }

    if (EXCL(range) != EXCL(obj)) {
	return Qfalse;
    }

    return Qtrue;
}
Exemplo n.º 29
0
jobject date_cast<jobject, VALUE>(VALUE rDate)
{
    RHO_TRACE("dateFromRuby");

    if (NIL_P(rDate)) {
        RHO_TRACE("dateFromRuby - NIL object");
        return NULL;
    }

    RHO_TRACE("dateFromRuby - check for string type");
    if (TYPE(rDate) == T_STRING)
    {
        RHO_TRACE("dateFromRuby - converting from string");

        if (strlen(RSTRING_PTR(rDate)) == 0) {
            RHO_TRACE("dateFromRuby - empty string");
            return NULL;
        }

        rDate = rb_funcall(rb_cTime, rb_intern("parse"), 1, rDate);
        RHO_TRACE("dateFromRuby - converted to ruby date");
    }
    VALUE cDate = rb_class_of(rDate);
    if (!rb_equal(cDate, rb_cTime))
        rb_raise(rb_eArgError, "Wrong type of parameter: %s (Time expected)", rb_class2name(cDate));
    
    RHO_TRACE("dateFromRuby (2)");
    int year = NUM2INT(rb_funcall(rDate, rb_intern("year"), 0)) - 1900;
    RHO_TRACE("dateFromRuby (3)");
    int month = NUM2INT(rb_funcall(rDate, rb_intern("month"), 0)) - 1;
    RHO_TRACE("dateFromRuby (4)");
    int day = NUM2INT(rb_funcall(rDate, rb_intern("day"), 0));
    RHO_TRACE("dateFromRuby (5)");
    int hour = NUM2INT(rb_funcall(rDate, rb_intern("hour"), 0));
    RHO_TRACE("dateFromRuby (6)");
    int minute = NUM2INT(rb_funcall(rDate, rb_intern("min"), 0));
    RHO_TRACE("dateFromRuby (7)");
    int second = NUM2INT(rb_funcall(rDate, rb_intern("sec"), 0));
    RHO_TRACE("dateFromRuby (8)");

    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_DATE);
    if (!cls) return NULL;
    jmethodID mid = getJNIClassMethod(env, cls, "<init>", "(IIIIII)V");
    if (!mid) return NULL;

    RHO_TRACE("dateFromRuby (9)");
    jobject jDate = env->NewObject(cls, mid, year, month, day, hour, minute, second);
    return jDate;
}
Exemplo n.º 30
0
static VALUE
recursive_equal(VALUE s, VALUE s2, int recur)
{
    VALUE *ptr, *ptr2;
    long i, len;

    if (recur) return Qtrue; /* Subtle! */
    ptr = RSTRUCT_PTR(s);
    ptr2 = RSTRUCT_PTR(s2);
    len = RSTRUCT_LEN(s);
    for (i=0; i<len; i++) {
	if (!rb_equal(ptr[i], ptr2[i])) return Qfalse;
    }
    return Qtrue;
}