static mrb_value logger_need_log_p(mrb_state *mrb, mrb_value self) { grn_ctx *ctx = (grn_ctx *)mrb->ud; mrb_int level; mrb_get_args(mrb, "i", &level); return mrb_bool_value(grn_logger_pass(ctx, level)); }
static mrb_value hdb_set_xmsize(mrb_state *mrb, mrb_value self) { hdb_context *context = DATA_PTR(self); mrb_int xmsize; mrb_get_args(mrb, "i", &xmsize); return mrb_bool_value(tchdbsetxmsiz(context->hdb, xmsize)); }
mrb_value mrb_tls_openssl_test_match_dns_id(mrb_state *mrb, mrb_value klass) { mrb_value refid, prid; int result; mrb_get_args(mrb, "SS", &refid, &prid); result = mrb_openssl_match_dns_id(mrb_str_to_cstr(mrb, refid), mrb_str_to_cstr(mrb, prid)); return mrb_bool_value(result); }
static mrb_value hdb_copy(mrb_state *mrb, mrb_value self) { hdb_context *context = DATA_PTR(self); char *path; mrb_get_args(mrb, "z", &path); return mrb_bool_value(tchdbcopy(context->hdb, path)); }
static mrb_value hdb_set_cache(mrb_state *mrb, mrb_value self) { hdb_context *context = DATA_PTR(self); mrb_int rcnum; mrb_get_args(mrb, "i", &rcnum); return mrb_bool_value(tchdbsetcache(context->hdb, rcnum)); }
static mrb_value query_logger_need_log_p(mrb_state *mrb, mrb_value self) { grn_ctx *ctx = (grn_ctx *)mrb->ud; mrb_int flag; mrb_get_args(mrb, "i", &flag); return mrb_bool_value(grn_query_logger_pass(ctx, flag)); }
static mrb_value flo_finite_p(mrb_state *mrb, mrb_value num) { mrb_float value = mrb_float(num); mrb_bool finite_p; finite_p = !(isinf(value) || isnan(value)); return mrb_bool_value(finite_p); }
static mrb_value mrb_curses_wbkgd(mrb_state *mrb, mrb_value self) { mrb_value v1; mrb_get_args(mrb, "i", &v1); int no = mrb_fixnum(v1); wbkgd(stdscr, COLOR_PAIR(no)); return mrb_bool_value(true); }
static mrb_value mrb_curses_refresh(mrb_state *mrb, mrb_value self) { refresh(); if (echo_win != NULL) { wrefresh(echo_win); } return mrb_bool_value(true); }
static mrb_value mrb_curses_addstr(mrb_state *mrb, mrb_value self) { mrb_value obj; mrb_get_args(mrb, "S", &obj); const char *body = mrb_string_value_ptr(mrb, obj); addstr(body); return mrb_bool_value(true); }
static mrb_value mrb_curses_coloroff(mrb_state *mrb, mrb_value self) { mrb_value v1; mrb_get_args(mrb, "i", &v1); int no = mrb_fixnum(v1); attroff(COLOR_PAIR(no)); return mrb_bool_value(true); }
/* * Chipmunk2d::Constraint#collide_bodies * @return [Boolean] */ static mrb_value constraint_get_collide_bodies(mrb_state *mrb, mrb_value self) { cpConstraint *constraint; cpBool collide_bodies; constraint = mrb_data_get_ptr(mrb, self, &mrb_cp_constraint_type); collide_bodies = cpConstraintGetCollideBodies(constraint); return mrb_bool_value(collide_bodies); }
static mrb_value mrb_mod_method_defined(mrb_state *mrb, mrb_value mod) { mrb_sym id; mrb_bool method_defined_p; mrb_get_args(mrb, "n", &id); method_defined_p = mrb_obj_respond_to(mrb_class_ptr(mod), id); return mrb_bool_value(method_defined_p); }
static mrb_value flo_eq(mrb_state *mrb, mrb_value x) { mrb_value y; mrb_get_args(mrb, "o", &y); switch (mrb_type(y)) { #ifdef MRB_COMPLEX case MRB_TT_COMPLEX: return mrb_bool_value(mrb_imag(y) == 0 && mrb_real(y) == mrb_float(x)); #endif case MRB_TT_FIXNUM: return mrb_bool_value(mrb_float(x) == (mrb_float)mrb_fixnum(y)); case MRB_TT_FLOAT: return mrb_bool_value(mrb_float(x) == mrb_float(y)); default: return mrb_false_value(); } }
static mrb_value mrb_grn_table_is_empty(mrb_state *mrb, mrb_value self) { grn_ctx *ctx = (grn_ctx *)mrb->ud; unsigned int size; size = grn_table_size(ctx, DATA_PTR(self)); grn_mrb_ctx_check(mrb); return mrb_bool_value(size == 0); }
mrb_value num_eq_1(int val, mrb_value a, mrb_value b) { if (mrb_type(a) != MRB_TT_FIXNUM && mrb_type(a) != MRB_TT_FLOAT) { return mrb_bool_value(mrb_obj_eq(mrb, a, b)); } else { OP_CMP(==); } }
static mrb_value mrb_mod_eqq(mrb_state *mrb, mrb_value mod) { mrb_value obj; mrb_bool eqq; mrb_get_args(mrb, "o", &obj); eqq = mrb_obj_is_kind_of(mrb, obj, mrb_class_ptr(mod)); return mrb_bool_value(eqq); }
static mrb_value sym_equal(mrb_state *mrb, mrb_value sym1) { mrb_value sym2; mrb_bool equal_p; mrb_get_args(mrb, "o", &sym2); equal_p = mrb_obj_equal(mrb, sym1, sym2); return mrb_bool_value(equal_p); }
static mrb_value mrb_mod_cvar_defined(mrb_state *mrb, mrb_value mod) { mrb_sym id; mrb_bool defined_p; mrb_get_args(mrb, "n", &id); check_cv_name(mrb, id); defined_p = mrb_cv_defined(mrb, mod, id); return mrb_bool_value(defined_p); }
mrb_value mrb_io_sync(mrb_state *mrb, mrb_value self) { struct mrb_io *fptr; fptr = (struct mrb_io *)mrb_get_datatype(mrb, self, &mrb_io_type); if (fptr->fd < 0) { mrb_raise(mrb, E_IO_ERROR, "closed stream."); } return mrb_bool_value(fptr->sync); }
static mrb_value mrb_curses_init_pair(mrb_state *mrb, mrb_value self) { mrb_value v1, v2, v3; mrb_get_args(mrb, "iii", &v1, &v2, &v3); int no = mrb_fixnum(v1); int stcolor = mrb_fixnum(v2); int bgcolor = mrb_fixnum(v3); init_pair(no, stcolor, bgcolor); return mrb_bool_value(true); }
static mrb_value mrb_grn_table_is_locked(mrb_state *mrb, mrb_value self) { grn_ctx *ctx = (grn_ctx *)mrb->ud; unsigned int is_locked; is_locked = grn_obj_is_locked(ctx, DATA_PTR(self)); grn_mrb_ctx_check(mrb); return mrb_bool_value(is_locked != 0); }
/* * call-seq: * obj.is_a?(class) -> true or false * obj.kind_of?(class) -> true or false * * Returns <code>true</code> if <i>class</i> is the class of * <i>obj</i>, or if <i>class</i> is one of the superclasses of * <i>obj</i> or modules included in <i>obj</i>. * * module M; end * class A * include M * end * class B < A; end * class C < B; end * b = B.new * b.instance_of? A #=> false * b.instance_of? B #=> true * b.instance_of? C #=> false * b.instance_of? M #=> false * b.kind_of? A #=> true * b.kind_of? B #=> true * b.kind_of? C #=> false * b.kind_of? M #=> true */ mrb_value mrb_obj_is_kind_of_m(mrb_state *mrb, mrb_value self) { mrb_value arg; mrb_bool kind_of_p; mrb_get_args(mrb, "C", &arg); kind_of_p = mrb_obj_is_kind_of(mrb, self, mrb_class_ptr(arg)); return mrb_bool_value(kind_of_p); }
static mrb_value fiber_eq(mrb_state *mrb, mrb_value self) { mrb_value other; mrb_get_args(mrb, "o", &other); if (mrb_type(other) != MRB_TT_FIBER) { return mrb_false_value(); } return mrb_bool_value(fiber_ptr(self) == fiber_ptr(other)); }
/* * call-seq: * obj.instance_of?(class) -> true or false * * Returns <code>true</code> if <i>obj</i> is an instance of the given * class. See also <code>Object#kind_of?</code>. */ static mrb_value obj_is_instance_of(mrb_state *mrb, mrb_value self) { mrb_value arg; mrb_bool instance_of_p; mrb_get_args(mrb, "C", &arg); instance_of_p = mrb_obj_is_instance_of(mrb, self, mrb_class_ptr(arg)); return mrb_bool_value(instance_of_p); }
mrb_value mrb_io_set_sync(mrb_state *mrb, mrb_value self) { struct mrb_io *fptr; mrb_bool b; fptr = io_get_open_fptr(mrb, self); mrb_get_args(mrb, "b", &b); fptr->sync = b; return mrb_bool_value(b); }
/* * call-seq: * obj == other -> true or false * obj.equal?(other) -> true or false * obj.eql?(other) -> true or false * * Equality---At the <code>Object</code> level, <code>==</code> returns * <code>true</code> only if <i>obj</i> and <i>other</i> are the * same object. Typically, this method is overridden in descendant * classes to provide class-specific meaning. * * Unlike <code>==</code>, the <code>equal?</code> method should never be * overridden by subclasses: it is used to determine object identity * (that is, <code>a.equal?(b)</code> iff <code>a</code> is the same * object as <code>b</code>). * * The <code>eql?</code> method returns <code>true</code> if * <i>obj</i> and <i>anObject</i> have the same value. Used by * <code>Hash</code> to test members for equality. For objects of * class <code>Object</code>, <code>eql?</code> is synonymous with * <code>==</code>. Subclasses normally continue this tradition, but * there are exceptions. <code>Numeric</code> types, for example, * perform type conversion across <code>==</code>, but not across * <code>eql?</code>, so: * * 1 == 1.0 #=> true * 1.eql? 1.0 #=> false */ static mrb_value mrb_obj_equal_m(mrb_state *mrb, mrb_value self) { mrb_value arg; mrb_bool eql_p; mrb_get_args(mrb, "o", &arg); eql_p = mrb_obj_equal(mrb, self, arg); return mrb_bool_value(eql_p); }
/* * call-seq: * obj.respond_to?(symbol, include_private=false) -> true or false * * Returns +true+ if _obj_ responds to the given * method. Private methods are included in the search only if the * optional second parameter evaluates to +true+. * * If the method is not implemented, * as Process.fork on Windows, File.lchmod on GNU/Linux, etc., * false is returned. * * If the method is not defined, <code>respond_to_missing?</code> * method is called and the result is returned. */ static mrb_value obj_respond_to(mrb_state *mrb, mrb_value self) { mrb_sym id, rtm_id; mrb_bool priv = FALSE, respond_to_p; mrb_get_args(mrb, "n|b", &id, &priv); respond_to_p = basic_obj_respond_to(mrb, self, id, !priv); if (!respond_to_p) { rtm_id = mrb_intern_lit(mrb, "respond_to_missing?"); if (basic_obj_respond_to(mrb, self, rtm_id, !priv)) { mrb_value args[2], v; args[0] = mrb_symbol_value(id); args[1] = mrb_bool_value(priv); v = mrb_funcall_argv(mrb, self, rtm_id, 2, args); return mrb_bool_value(mrb_bool(v)); } } return mrb_bool_value(respond_to_p); }
static mrb_value gc_generational_mode_set(mrb_state *mrb, mrb_value self) { mrb_bool enable; mrb_get_args(mrb, "b", &enable); if (mrb->is_generational_gc_mode != enable) change_gen_gc_mode(mrb, enable); return mrb_bool_value(enable); }
static mrb_value run_protect(mrb_state *mrb, mrb_value self) { mrb_value b; mrb_value ret[2]; mrb_bool state; mrb_get_args(mrb, "&", &b); ret[0] = mrb_protect(mrb, protect_cb, b, &state); ret[1] = mrb_bool_value(state); return mrb_ary_new_from_values(mrb, 2, ret); }