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

C++ rb_errinfo函数代码示例

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

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



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

示例1: iroffer_ruby_errro

static void iroffer_ruby_errro(int error)
{
  VALUE lasterr;
  VALUE inclass;
  VALUE message;
  VALUE ary;
  long c;

  if (error == 0)
    return;

  lasterr = rb_gv_get("$!"); /* NOTRANSLATE */
  inclass = rb_class_path(CLASS_OF(lasterr));
  message = rb_obj_as_string(lasterr);
  outerror(OUTERROR_TYPE_WARN_LOUD,
           "error ruby_script: class=%s, message=%s",
           RSTRING_PTR(inclass), RSTRING_PTR(message));

  if (!NIL_P(rb_errinfo())) {
    ary = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
    for (c=0; c<RARRAY_LEN(ary); ++c) {
      outerror(OUTERROR_TYPE_WARN_LOUD,
               "backtrace from %s",
               RSTRING_PTR(RARRAY_PTR(ary)[c]));
    }
  }
}
开发者ID:KayDat,项目名称:iroffer-dinoex,代码行数:27,代码来源:dinoex_ruby.c


示例2: uwsgi_ruby_exception

void uwsgi_ruby_exception(void) {

        VALUE lasterr = rb_gv_get("$!");
        VALUE message = rb_obj_as_string(lasterr);

        uwsgi_log("%s\n", RSTRING_PTR(message));
        if(!NIL_P(rb_errinfo())) {
                VALUE ary = rb_funcall(rb_errinfo(), rb_intern("backtrace"), 0);
                int i;
                for (i=0; i<RARRAY_LEN(ary); i++) {
                        uwsgi_log("%s\n", RSTRING_PTR(RARRAY_PTR(ary)[i]));
                }
        }
}
开发者ID:dbhattar,项目名称:uwsgi,代码行数:14,代码来源:rack_plugin.c


示例3: ana_set_extra_attrs_rescue

static G_GNUC_NORETURN VALUE
ana_set_extra_attrs_rescue(VALUE value)
{
    g_slist_free(((struct ana_set_extra_attrs_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:7,代码来源:rbpangoanalysis.c


示例4: protect_proccall

static gboolean
protect_proccall(VALUE receiver, int argc, const VALUE *argv)
{
    funcall_arguments call_args;
    VALUE result;
    int state = 0;

    call_args.receiver = receiver;
    call_args.name = rb_intern("call");
    call_args.argc = argc;
    call_args.argv = argv;
    result = rb_protect(invoke_rb_funcall2, (VALUE)&call_args, &state);
    if (state) {
	VALUE errinfo = rb_errinfo();
	VALUE logger = rb_protect(default_logger, Qfalse, &state);
	if (state == 0 && !NIL_P(logger)) {
	    call_args.receiver = logger;
	    call_args.name = rb_intern("error");
	    call_args.argc = 1;
	    call_args.argv = &errinfo;
	    rb_protect(invoke_rb_funcall2, (VALUE)&call_args, &state);
	}
	return FALSE;
    }
    return RVAL2CBOOL(result);
}
开发者ID:suzuki,项目名称:milter-manager,代码行数:26,代码来源:rb-milter-event-loop.c


示例5: rval2atkstatetype_rescue

static G_GNUC_NORETURN VALUE
rval2atkstatetype_rescue(VALUE value)
{
    g_free(((struct rval2atkstatetype_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbatkstateset.c


示例6: load_encoding

static int
load_encoding(const char *name)
{
    VALUE enclib = rb_sprintf("enc/%s.so", name);
    VALUE verbose = ruby_verbose;
    VALUE debug = ruby_debug;
    VALUE errinfo;
    char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3;
    int loaded;
    int idx;

    while (s < e) {
	if (!ISALNUM(*s)) *s = '_';
	else if (ISUPPER(*s)) *s = (char)TOLOWER(*s);
	++s;
    }
    FL_UNSET(enclib, FL_TAINT);
    enclib = rb_fstring(enclib);
    ruby_verbose = Qfalse;
    ruby_debug = Qfalse;
    errinfo = rb_errinfo();
    loaded = rb_require_internal(enclib, rb_safe_level());
    ruby_verbose = verbose;
    ruby_debug = debug;
    rb_set_errinfo(errinfo);
    if (loaded < 0 || 1 < loaded) return -1;
    if ((idx = rb_enc_registered(name)) < 0) return -1;
    if (enc_autoload_p(enc_table.list[idx].enc)) return -1;
    return idx;
}
开发者ID:tenderlove,项目名称:ruby,代码行数:30,代码来源:encoding.c


示例7: layout_line_set_runs_rescue

static G_GNUC_NORETURN VALUE
layout_line_set_runs_rescue(VALUE value)
{
    g_slist_free(((struct layout_line_set_runs_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:Vasfed,项目名称:pango,代码行数:7,代码来源:rbpangolayoutline.c


示例8: rbgdk_rval2gdkpixbufglist_rescue

static VALUE
rbgdk_rval2gdkpixbufglist_rescue(VALUE value)
{
    g_list_free(((struct rval2gdkpixbufglist_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdk.c


示例9: rbgtk_rval2gtkradiotoolbuttongslist_rescue

static VALUE
rbgtk_rval2gtkradiotoolbuttongslist_rescue(VALUE value)
{
    g_slist_free(((struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkradiotoolbutton.c


示例10: rbgdk_rval2gdkatoms_rescue

static VALUE
rbgdk_rval2gdkatoms_rescue(VALUE value)
{
    g_free(((struct rbgdk_rval2gdkatoms_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdk.c


示例11: rbgdk_rval2gdkspans_rescue

static G_GNUC_NORETURN VALUE
rbgdk_rval2gdkspans_rescue(VALUE value)
{
    g_free(((struct rbgdk_rval2gdkspans_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdkregion.c


示例12: rbg_rval2gtkradioactionentries_rescue

static G_GNUC_NORETURN VALUE
rbg_rval2gtkradioactionentries_rescue(VALUE value)
{
    g_free(((struct rbg_rval2gtkradioactionentries_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkactiongroup.c


示例13: err_append

static void
err_append(const char *s)
{

    if (rb_vm_parse_in_eval()) {
	VALUE err = rb_errinfo();
	if (err == Qnil) {
	    err = rb_exc_new2(rb_eSyntaxError, s);
	    rb_set_errinfo(err);
	}
	else {
	    VALUE str = rb_obj_as_string(err);

	    rb_str_cat2(str, "\n");
	    rb_str_cat2(str, s);
	    rb_set_errinfo(rb_exc_new3(rb_eSyntaxError, str));
	}
    }
    else {
	VALUE err = rb_vm_current_exception();
	if (err == Qnil) {
	    err = rb_exc_new2(rb_eSyntaxError, "compile error");
	    rb_vm_set_current_exception(err);
	}
	rb_write_error(s);
	rb_write_error("\n");
    }
}
开发者ID:1nueve,项目名称:MacRuby,代码行数:28,代码来源:error.c


示例14: Debug_load

/*
 *  call-seq:
 *    Byebug.debug_load(file, stop = false) -> nil
 *
 *  Same as Kernel#load but resets current context's frames.
 *  +stop+ parameter forces byebug to stop at the first line of code in +file+
 */
static VALUE
Debug_load(int argc, VALUE * argv, VALUE self)
{
  VALUE file, stop, context;
  debug_context_t *dc;
  VALUE status = Qnil;
  int state = 0;

  UNUSED(self);

  if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
    stop = Qfalse;

  Start(self);

  context = Current_context(self);
  Data_Get_Struct(context, debug_context_t, dc);

  dc->calced_stack_size = 1;

  if (RTEST(stop))
    dc->steps = 1;

  rb_load_protect(file, 0, &state);
  if (0 != state)
  {
    status = rb_errinfo();
    reset_stepping_stop_points(dc);
  }

  return status;
}
开发者ID:Alex-Aralis,项目名称:davey-rails-app,代码行数:39,代码来源:byebug.c


示例15: value_array_from_ruby_rescue

static G_GNUC_NORETURN VALUE
value_array_from_ruby_rescue(VALUE value)
{
    g_value_array_free(((struct value_array_from_ruby_args *)value)->result);

    rb_exc_raise(rb_errinfo());
}
开发者ID:ruby-gnome2,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgobj_valuearray.c


示例16: load_encoding

static int
load_encoding(const char *name)
{
    VALUE enclib = rb_sprintf("enc/%s.so", name);
    VALUE verbose = ruby_verbose;
    VALUE debug = ruby_debug;
    VALUE errinfo;
    VALUE loaded;
    char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3;
    int idx;

    while (s < e) {
	if (!ISALNUM(*s)) *s = '_';
	else if (ISUPPER(*s)) *s = (char)TOLOWER(*s);
	++s;
    }
    FL_UNSET(enclib, FL_TAINT|FL_UNTRUSTED);
    OBJ_FREEZE(enclib);
    ruby_verbose = Qfalse;
    ruby_debug = Qfalse;
    errinfo = rb_errinfo();
    loaded = rb_protect(require_enc, enclib, 0);
    ruby_verbose = verbose;
    ruby_debug = debug;
    rb_set_errinfo(errinfo);
    if (NIL_P(loaded)) return -1;
    if ((idx = rb_enc_registered(name)) < 0) return -1;
    if (enc_autoload_p(enc_table.list[idx].enc)) return -1;
    return idx;
}
开发者ID:SongJungHwan,项目名称:hwan,代码行数:30,代码来源:encoding.c


示例17: rb_eval_string

// 尝试执行脚本
VALUE ThisApp::TryEval(const char* str){
	static char buffer[1024];
	VALUE rc = Qnil;
	VALUE err;
	__try{
		rc = rb_eval_string(str);
	}
	__except (EXCEPTION_EXECUTE_HANDLER){}
	if (!NIL_P(err = rb_errinfo())){
		// class
		VALUE kclass = rb_class_path(CLASS_OF(err));
		// message
		VALUE message = rb_obj_as_string(err);
		// backtrace
		VALUE ary = rb_funcall(err, rb_intern("backtrace"), 0);
		VALUE brstr = rb_funcall(ary, rb_intern("to_s"), 0);
		// sprintf
		sprintf_s(buffer, "Error:  %s\n%s\nbacktrace:  %s\n", StringValuePtr(kclass),
			StringValuePtr(message),
			StringValuePtr(brstr));
		MessageBoxA(nullptr, buffer, "Error", MB_OK);
		rb_set_errinfo(Qnil);
	}
	return rc;
}
开发者ID:profile1p,项目名称:RubyGM,代码行数:26,代码来源:ThisApp.cpp


示例18: mriBindingExecute

static void mriBindingExecute()
{
	/* Normally only a ruby executable would do a sysinit,
	 * but not doing it will lead to crashes due to closed
	 * stdio streams on some platforms (eg. Windows) */
	int argc = 0;
	char **argv = 0;
	ruby_sysinit(&argc, &argv);

	ruby_setup();
	rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));

	Config &conf = shState->rtData().config;

	if (!conf.rubyLoadpaths.empty())
	{
		/* Setup custom load paths */
		VALUE lpaths = rb_gv_get(":");

		for (size_t i = 0; i < conf.rubyLoadpaths.size(); ++i)
		{
			std::string &path = conf.rubyLoadpaths[i];

			VALUE pathv = rb_str_new(path.c_str(), path.size());
			rb_ary_push(lpaths, pathv);
		}
	}

	RbData rbData;
	shState->setBindingData(&rbData);
	BacktraceData btData;

	mriBindingInit();


	STEAMSHIM_init();
	_rb_define_module_function(rb_mKernel, "_steam_achievement_unlock",
	                           _steamAchievementUnlock);


	std::string &customScript = conf.customScript;
	if (!customScript.empty())
		runCustomScript(customScript);
	else
		runRMXPScripts(btData);

	VALUE exc = rb_errinfo();
	if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
		showExc(exc, btData);

	ruby_cleanup(0);


	STEAMSHIM_deinit();


	shState->rtData().rqTermAck.set();
}
开发者ID:Ancurio,项目名称:mkxp-abs,代码行数:58,代码来源:binding-mri.cpp


示例19: initrb_interpreter_protect

static VALUE initrb_interpreter_protect(initrb_ruby_fn_t fn, VALUE args) {
    int exc = 0;
    VALUE ret = rb_protect(fn, args, &exc);
    if (exc != 0) {
        initrb_interpreter_print_exception(rb_errinfo());
        return Qundef;
    }
    return ret;
}
开发者ID:numinit,项目名称:initrb,代码行数:9,代码来源:initrb.c


示例20: get_errinfo

static VALUE
get_errinfo(void)
{
    VALUE exc = rb_vm_current_exception();
    if (NIL_P(exc)) {
	exc = rb_errinfo();
    }
    return exc;
}
开发者ID:JosephKu,项目名称:MacRuby,代码行数:9,代码来源:eval.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rb_exc_new3函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_erase函数代码示例发布时间: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