• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rb_bug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: rb_tracearg_raised_exception

VALUE
rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg)
{
    if (trace_arg->event & (RUBY_EVENT_RAISE)) {
	/* 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:Chatto,项目名称:VGdesk,代码行数:14,代码来源:vm_trace.c


示例17: native_mutex_trylock

static inline int
native_mutex_trylock(pthread_mutex_t *lock)
{
    int r;
    if ((r = pthread_mutex_trylock(lock)) != 0) {
        if (r == EBUSY) {
            return EBUSY;
        }
        else {
            rb_bug("native_mutex_trylock return non-zero: %d", r);
        }
    }
    return 0;
}
开发者ID:takuma104,项目名称:iphone-macruby,代码行数:14,代码来源:thread_pthread.c


示例18: rb_register_sigaltstack

/* alternate stack for SIGSEGV */
void
rb_register_sigaltstack(rb_thread_t *th)
{
    stack_t newSS, oldSS;

    if (!th->altstack)
	rb_bug("rb_register_sigaltstack: th->altstack not initialized\n");

    newSS.ss_sp = th->altstack;
    newSS.ss_size = rb_sigaltstack_size();
    newSS.ss_flags = 0;

    sigaltstack(&newSS, &oldSS); /* ignore error. */
}
开发者ID:yugui,项目名称:ruby,代码行数:15,代码来源:signal.c


示例19: make_errno_exc

static VALUE
make_errno_exc(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;
    return rb_class_new_instance(1, &arg, get_syserr(n));
}
开发者ID:technohippy,项目名称:oruby,代码行数:14,代码来源:error.c


示例20: w32_error

static void
w32_error(const char *func)
{
#if defined(OS_WP8)
    LPVOID lpMsgBuf = malloc( 1001 );
    int nError = GetLastError();

	DWORD flFormat = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;

    FormatMessage(flFormat,
		  NULL,
		  nError,
		  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		  (LPTSTR) & lpMsgBuf, 1000, NULL);
    if ( lpMsgBuf )
        rb_bug("%s;Error code: %d; Func: %s", (char*)lpMsgBuf, nError, func);
    else
        rb_bug("Error code: %d; Func: %s", nError, func);

	free(lpMsgBuf);
#else
    LPVOID lpMsgBuf = 0;
    int nError = GetLastError();

	DWORD flFormat = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;

    FormatMessage(flFormat,
		  NULL,
		  nError,
		  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		  (LPTSTR) & lpMsgBuf, 0, NULL);
    if ( lpMsgBuf )
        rb_bug("%s;Error code: %d; Func: %s", (char*)lpMsgBuf, nError, func);
    else
        rb_bug("Error code: %d; Func: %s", nError, func);
#endif
}
开发者ID:ariejan,项目名称:rhodes,代码行数:37,代码来源:thread_win32.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rb_bug_errno函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_block_proc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap