当前位置: 首页>>代码示例>>C++>>正文


C++ rb_bug函数代码示例

本文整理汇总了C++中rb_bug函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_bug函数的具体用法?C++ rb_bug怎么用?C++ rb_bug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_bug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rb_check_type

void
rb_check_type(VALUE x, int t)
{
    int xt;

    if (x == Qundef) {
	rb_bug("undef leaked to the Ruby space");
    }

    xt = TYPE(x);
    if (xt != t || (xt == T_DATA && RTYPEDDATA_P(x))) {
	const char *tname = rb_builtin_type_name(t);
	if (tname) {
	    rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
		     builtin_class_name(x), tname);
	}
	if (xt > T_MASK && xt <= 0x3f) {
	    rb_fatal("unknown type 0x%x (0x%x given, probably comes from extension library for ruby 1.8)", t, xt);
	}
	rb_bug("unknown type 0x%x (0x%x given)", t, xt);
    }
}
开发者ID:alansparrow,项目名称:learningruby,代码行数:22,代码来源:error.c

示例2: w32_error

static void
w32_error(void)
{
    LPVOID lpMsgBuf;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
		  FORMAT_MESSAGE_FROM_SYSTEM |
		  FORMAT_MESSAGE_IGNORE_INSERTS,
		  NULL,
		  GetLastError(),
		  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		  (LPTSTR) & lpMsgBuf, 0, NULL);
    rb_bug("%s", (char*)lpMsgBuf);
}
开发者ID:AdamDotCom,项目名称:my-rvm,代码行数:13,代码来源:thread_win32.c

示例3: make_errno_exc_str

static VALUE
make_errno_exc_str(VALUE mesg)
{
    int n = errno;

    errno = 0;
    if (!mesg) mesg = Qnil;
    if (n == 0) {
	const char *s = !NIL_P(mesg) ? RSTRING_PTR(mesg) : "";
	rb_bug("rb_sys_fail_str(%s) - errno == 0", s);
    }
    return rb_syserr_new_str(n, mesg);
}
开发者ID:alansparrow,项目名称:learningruby,代码行数:13,代码来源:error.c

示例4: rb_check_type

void
rb_check_type(VALUE x, int t)
{
    const struct types *type = builtin_types;
    const struct types *const typeend = builtin_types +
	sizeof(builtin_types) / sizeof(builtin_types[0]);

    if (x == Qundef) {
	rb_bug("undef leaked to the Ruby space");
    }

    if (TYPE(x) != t) {
	while (type < typeend) {
	    if (type->type == t) {
		const char *etype;

		if (NIL_P(x)) {
		    etype = "nil";
		}
		else if (FIXNUM_P(x)) {
		    etype = "Fixnum";
		}
		else if (SYMBOL_P(x)) {
		    etype = "Symbol";
		}
		else if (rb_special_const_p(x)) {
		    etype = RSTRING_PTR(rb_obj_as_string(x));
		}
		else {
		    etype = rb_obj_classname(x);
		}
		rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
			 etype, type->name);
	    }
	    type++;
	}
	rb_bug("unknown type 0x%x (0x%x given)", t, TYPE(x));
    }
}
开发者ID:JosephKu,项目名称:MacRuby,代码行数:39,代码来源:error.c

示例5: sigbus

static RETSIGTYPE
sigbus(int sig SIGINFO_ARG)
{
/*
 * Mac OS X makes KERN_PROTECTION_FAILURE when thread touch guard page.
 * and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
 * wrong IMHO. but anyway we have to care it. Sigh.
 */
#if defined __APPLE__
    CHECK_STACK_OVERFLOW();
#endif
    rb_bug("Bus Error");
}
开发者ID:richo,项目名称:unrubby,代码行数:13,代码来源:signal.c

示例6: rbgobj_define_class

VALUE
rbgobj_define_class(GType gtype, const gchar *name, VALUE module, void *mark, void *free, VALUE parent)
{
    RGObjClassInfo* cinfo;
    if (gtype == 0)
        rb_bug("rbgobj_define_class: Invalid gtype [%s]\n", name);

    cinfo = (RGObjClassInfo*)rbgobj_lookup_class_by_gtype(gtype, parent);
    cinfo->mark = mark;
    cinfo->free = free;
    rb_define_const(module, name, cinfo->klass);
    return cinfo->klass;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgobj_type.c

示例7: rb_add_method

rb_method_entry_t *
rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_flag_t noex)
{
    rb_thread_t *th;
    rb_control_frame_t *cfp;
    int line;
    rb_method_entry_t *me = rb_method_entry_make(klass, mid, type, 0, noex);
    rb_method_definition_t *def = ALLOC(rb_method_definition_t);
    me->def = def;
    def->type = type;
    def->original_id = mid;
    def->alias_count = 0;
    switch (type) {
      case VM_METHOD_TYPE_ISEQ:
	def->body.iseq = (rb_iseq_t *)opts;
	break;
      case VM_METHOD_TYPE_CFUNC:
	def->body.cfunc = *(rb_method_cfunc_t *)opts;
	break;
      case VM_METHOD_TYPE_ATTRSET:
      case VM_METHOD_TYPE_IVAR:
	def->body.attr.id = (ID)opts;
	def->body.attr.location = Qfalse;
	th = GET_THREAD();
	cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
	if (cfp && (line = rb_vm_get_sourceline(cfp))) {
	    VALUE location = rb_ary_new3(2, cfp->iseq->filename, INT2FIX(line));
	    def->body.attr.location = rb_ary_freeze(location);
	}
	break;
      case VM_METHOD_TYPE_BMETHOD:
	def->body.proc = (VALUE)opts;
	break;
      case VM_METHOD_TYPE_NOTIMPLEMENTED:
	def->body.cfunc.func = rb_f_notimplement;
	def->body.cfunc.argc = -1;
	break;
      case VM_METHOD_TYPE_OPTIMIZED:
	def->body.optimize_type = (enum method_optimized_type)opts;
	break;
      case VM_METHOD_TYPE_ZSUPER:
      case VM_METHOD_TYPE_UNDEF:
	break;
      default:
	rb_bug("rb_add_method: unsupported method type (%d)\n", type);
    }
    if (type != VM_METHOD_TYPE_UNDEF) {
	method_added(klass, mid);
    }
    return me;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:51,代码来源:vm_method.c

示例8: rb_tracearg_object

VALUE
rb_tracearg_object(rb_trace_arg_t *trace_arg)
{
    if (trace_arg->event & (RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_INTERNAL_EVENT_FREEOBJ)) {
        /* ok */
    }
    else {
        rb_raise(rb_eRuntimeError, "not supported by this event");
    }
    if (trace_arg->data == Qundef) {
        rb_bug("tp_attr_raised_exception_m: unreachable");
    }
    return trace_arg->data;
}
开发者ID:ksperling,项目名称:ruby,代码行数:14,代码来源:vm_trace.c

示例9: virtualmachine_vme_eax

VALUE virtualmachine_vme_eax(VALUE self)
{
	VALUE vctx = rb_iv_get(self, "@ctx");
	VALUE vvme = rb_iv_get(self, "@vmexit");
	struct vmctx *ctx;
	struct vm_exit *vme;
	Data_Get_Struct(vctx, struct vmctx, ctx);
	if (!ctx)
		rb_bug("ctx is null");
	Data_Get_Struct(vvme, struct vm_exit, vme);
	if (!vme)
		tb_bug("vme is null");
	return INT2FIX(vme->u.inout.eax);
}
开发者ID:syuu1228,项目名称:ruby-virtualmachine,代码行数:14,代码来源:virtualmachine.c

示例10: virtualmachine_vme_rip

VALUE virtualmachine_vme_rip(VALUE self)
{
	VALUE vctx = rb_iv_get(self, "@ctx");
	VALUE vvme = rb_iv_get(self, "@vmexit");
	struct vmctx *ctx;
	struct vm_exit *vme;
	Data_Get_Struct(vctx, struct vmctx, ctx);
	if (!ctx)
		rb_bug("ctx is null");
	Data_Get_Struct(vvme, struct vm_exit, vme);
	if (!vme)
		tb_bug("vme is null");
	return ULL2NUM(vme->rip);
}
开发者ID:syuu1228,项目名称:ruby-virtualmachine,代码行数:14,代码来源:virtualmachine.c

示例11: virtualmachine_load_binary

VALUE virtualmachine_load_binary(VALUE self, VALUE program)
{
	VALUE vctx = rb_iv_get(self, "@ctx");
	struct vmctx *ctx;
	unsigned char *entry;

	Data_Get_Struct(vctx, struct vmctx, ctx);
	if (!ctx)
		rb_bug("ctx is null");
	entry = _vm_map_gpa(ctx, ADDR_ENTRY, RSTRING_LEN(program));
	memcpy(entry, StringValuePtr(program), RSTRING_LEN(program));
	_vm_set_register(ctx, 0, VM_REG_GUEST_RIP, ADDR_ENTRY);
	return Qnil;
}
开发者ID:syuu1228,项目名称:ruby-virtualmachine,代码行数:14,代码来源:virtualmachine.c

示例12: native_cond_signal

static void
native_cond_signal(rb_thread_cond_t *cond)
{
    /* cond is guarded by mutex */
    struct cond_event_entry *e = cond->next;

    if (e) {
	cond->next = e->next;
	SetEvent(e->event);
    }
    else {
	rb_bug("native_cond_signal: no pending threads");
    }
}
开发者ID:MacBoyPro,项目名称:rhodes,代码行数:14,代码来源:thread_win32.c

示例13: sigsegv

static RETSIGTYPE
sigsegv(int sig)
{
    if (segv_received) {
	fprintf(stderr, "SEGV recieved in SEGV handler\n");
	exit(EXIT_FAILURE);
    }
    else {
	extern int ruby_disable_gc_stress;
	segv_received = 1;
	ruby_disable_gc_stress = 1;
	rb_bug("Segmentation fault");
    }
}
开发者ID:professor,项目名称:rhodes,代码行数:14,代码来源:signal.c

示例14: rb_sys_fail

void
rb_sys_fail(const char *mesg)
{
    int n = errno;
    VALUE arg;

    errno = 0;
    if (n == 0) {
	rb_bug("rb_sys_fail(%s) - errno == 0", mesg ? mesg : "");
    }

    arg = mesg ? rb_str_new2(mesg) : Qnil;
    rb_exc_raise(rb_class_new_instance(1, &arg, get_syserr(n)));
}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:14,代码来源:error.c

示例15: rb_tracearg_return_value

VALUE
rb_tracearg_return_value(rb_trace_arg_t *trace_arg)
{
    if (trace_arg->event & (RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN | RUBY_EVENT_B_RETURN)) {
	/* ok */
    }
    else {
	rb_raise(rb_eRuntimeError, "not supported by this event");
    }
    if (trace_arg->data == Qundef) {
	rb_bug("tp_attr_return_value_m: unreachable");
    }
    return trace_arg->data;
}
开发者ID:Chatto,项目名称:VGdesk,代码行数:14,代码来源:vm_trace.c


注:本文中的rb_bug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。