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

C++ rb_const_get函数代码示例

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

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



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

示例1: Init_Detect_Implicit_Variables_c

void Init_Detect_Implicit_Variables_c(){ 
 cls_Detect_Implicit_Variables=rb_define_class("Detect_Implicit_Variables",rb_const_get(rb_cObject,rb_intern("Visitor"))); 
                    failobj=rb_eval_string("FAIL");
                    rb_define_method(cls_Detect_Implicit_Variables,"profile_report",profile_report_Detect_Implicit_Variables,0);
switchhash_Detect_Implicit_Variables_1=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Apply\nnext h[k]=1 if k<=Object\n}");rb_global_variable(&switchhash_Detect_Implicit_Variables_1);;
switchhash_Detect_Implicit_Variables_2=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=AmethystAST\nnext h[k]=1 if k<=Array\nnext h[k]=2 if k<=Object\n}");rb_global_variable(&switchhash_Detect_Implicit_Variables_2);;
switchhash_Detect_Implicit_Variables_3=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Apply\nnext h[k]=1 if k<=Object\n}");rb_global_variable(&switchhash_Detect_Implicit_Variables_3);;
switchhash_Detect_Implicit_Variables_4=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Apply\nnext h[k]=1 if k<=Object\n}");rb_global_variable(&switchhash_Detect_Implicit_Variables_4);;
switchhash_Detect_Implicit_Variables_5=rb_eval_string("Hash.new{|h,k|next h[k]=0 if k<=Apply\nnext h[k]=1 if k<=Object\n}");rb_global_variable(&switchhash_Detect_Implicit_Variables_5);;
sy_Detect_Implicit_Variables__at_vars_a187=rb_intern("Detect_Implicit_Variables__at_vars_a187");
sy_Detect_Implicit_Variables__at_vars_eq_Ha_dec8=rb_intern("Detect_Implicit_Variables__at_vars_eq_Ha_dec8");
sy_Detect_Implicit_Variables__at_vars_lb_bi_edce=rb_intern("Detect_Implicit_Variables__at_vars_lb_bi_edce");
sy_Detect_Implicit_Variables__lp_src_dot_ins_a413=rb_intern("Detect_Implicit_Variables__lp_src_dot_ins_a413");
                    rb_define_method(cls_Detect_Implicit_Variables,"root",Detect_Implicit_Variables_root,0);
rb_define_method(cls_Detect_Implicit_Variables,"traverse",Detect_Implicit_Variables_traverse,0);
rb_define_method(cls_Detect_Implicit_Variables,"traverse_item",Detect_Implicit_Variables_traverse_item,0);
rb_define_method(cls_Detect_Implicit_Variables,"visit",Detect_Implicit_Variables_visit,0);
                    }
开发者ID:neleai,项目名称:mthyst,代码行数:18,代码来源:Detect_Implicit_Variables_c.c


示例2: Init_rsruby_c

void Init_rsruby_c(){

  cRRuby = rb_define_class("RSRuby",rb_cObject);

  rb_define_method(cRRuby, "r_init", rr_init, 0);
  rb_define_method(cRRuby, "get_fun", get_fun, 1);
  rb_define_method(cRRuby, "shutdown", rs_shutdown, 0);

  rb_define_method(cRRuby, "crash", crash, 0);

  //Add the lcall method to RObj
  cRObj  = rb_const_get(rb_cObject,rb_intern("RObj"));
  rb_define_method(cRObj, "lcall", RObj_lcall, 1);
  rb_define_method(cRObj, "__init_lcall__", RObj_init_lcall, 1);  
  rb_define_method(cRObj, "to_ruby", RObj_to_ruby, -2);
  rb_define_method(cRObj, "to_R", ruby_to_R, 1);

}
开发者ID:orlinresearch,项目名称:rsruby,代码行数:18,代码来源:rsruby.c


示例3: rbffi_StructByReference_Init

void
rbffi_StructByReference_Init(VALUE moduleFFI)
{
    /*
     * Document-class: FFI::StructByReference
     * This class includes {FFI::DataConverter} module.
     */
    rbffi_StructByReferenceClass = rb_define_class_under(moduleFFI, "StructByReference", rb_cObject);
    rb_global_variable(&rbffi_StructByReferenceClass);
    rb_include_module(rbffi_StructByReferenceClass, rb_const_get(moduleFFI, rb_intern("DataConverter")));
    
    rb_define_alloc_func(rbffi_StructByReferenceClass, sbr_allocate);
    rb_define_method(rbffi_StructByReferenceClass, "initialize", sbr_initialize, 1);
    rb_define_method(rbffi_StructByReferenceClass, "struct_class", sbr_struct_class, 0);
    rb_define_method(rbffi_StructByReferenceClass, "native_type", sbr_native_type, 0);
    rb_define_method(rbffi_StructByReferenceClass, "to_native", sbr_to_native, 2);
    rb_define_method(rbffi_StructByReferenceClass, "from_native", sbr_from_native, 2);
}
开发者ID:AndreasDattilo,项目名称:sample_app,代码行数:18,代码来源:StructByReference.c


示例4: qml_init

/*
 * @api private
 */
static VALUE qml_init(VALUE module, VALUE args) {
    if (!NIL_P(rbqml_application)) {
        rb_raise(rb_eRuntimeError, "QML already initialized");
    }

    rbqml_application = rb_funcall(rbqml_cApplication, rb_intern("new"), 1, args);
    rbqml_engine = rb_funcall(rbqml_cEngine, rb_intern("new"), 0);

    rb_gc_register_address(&rbqml_application);
    rb_gc_register_address(&rbqml_engine);

    VALUE blocks = rb_const_get(module, rb_intern("INIT_BLOCKS"));
    for (int i = 0; i < RARRAY_LEN(blocks); ++i) {
        rb_proc_call(RARRAY_AREF(blocks, i), rb_ary_new());
    }

    return module;
}
开发者ID:polamjag,项目名称:ruby-qml,代码行数:21,代码来源:qml.c


示例5: timestamp_new

static VALUE
timestamp_new(ValueStruct *val)
{
    VALUE cTime
		, ret;

ENTER_FUNC;
    cTime = rb_const_get(rb_cObject, rb_intern("Time"));
    ret = rb_funcall(cTime, rb_intern("local"), 6,
					 INT2NUM((ValueDateTimeYear(val))),
					 INT2NUM((ValueDateTimeMon(val)+1)),
					 INT2NUM((ValueDateTimeMDay(val))),
					 INT2NUM((ValueDateTimeHour(val))),
					 INT2NUM((ValueDateTimeMin(val))),
					 INT2NUM((ValueDateTimeSec(val))));
LEAVE_FUNC;
	return	ret;
}
开发者ID:ogochan,项目名称:libmondai,代码行数:18,代码来源:ruby.c


示例6: check_kcode

static void check_kcode()
{
    VALUE rb_iconv_klass = rb_const_get(rb_cObject, rb_intern("Iconv"));
    VALUE kcode = rb_gv_get("$KCODE");
    if (RTEST(rb_iconv_klass) && TYPE(kcode) == T_STRING) {
        char* kcodep = StringValuePtr(kcode);
        char upper_kcode = toupper(*kcodep);
        if (Kcode != upper_kcode)
        {
            Kcode = upper_kcode;
            reinit();
        }
    }
    else
    {
        objIconvR2J = objIconvJ2R = Qnil;
    }
}
开发者ID:TheMadKhajit,项目名称:rjb,代码行数:18,代码来源:riconv.c


示例7: create_response

// Use the info in a Curl handle to create a new Response object.
static VALUE create_response(CURL* curl) {
  VALUE response = rb_class_new_instance(0, 0,
                      rb_const_get(mPatron, rb_intern("Response")));

  char* url = NULL;
  curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
  rb_iv_set(response, "@url", rb_str_new2(url));

  long code = 0;
  curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
  rb_iv_set(response, "@status", INT2NUM(code));

  long count = 0;
  curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &count);
  rb_iv_set(response, "@redirect_count", INT2NUM(count));

  return response;
}
开发者ID:luma,项目名称:patron,代码行数:19,代码来源:session_ext.c


示例8: ltns_parse_ruby

VALUE ltns_parse_ruby(VALUE module __attribute__ ((unused)), VALUE string)
{
	VALUE ret = Qnil;

	if (TYPE(string) != T_STRING)
	{
		VALUE rb_eArgumentError = rb_const_get(rb_cObject, rb_intern("ArgumentError"));
		rb_raise(rb_eArgumentError, "Invalid argument");
	}

	char* tnetstring = StringValueCStr(string);
	char* tnet_end = tnetstring + RSTRING_LEN(string);
	if (!ltns_parse(tnetstring, tnet_end, &ret))
	{
		rb_raise(eInvalidTNetString, "Invalid TNetstring");
	}
	return ret;
}
开发者ID:l4u,项目名称:lazy_tnetstring,代码行数:18,代码来源:parse.c


示例9: read_new_reference

VALUE read_new_reference(unsigned char **pData) {
  if(read_1(pData) != ERL_NEW_REF) {
    rb_raise(rb_eStandardError, "Invalid Type, not a new-style reference");
  }
  
  int size = read_2(pData);
  VALUE node = read_atom(pData);
  VALUE creation = INT2FIX(read_1(pData));
  
  VALUE id = rb_ary_new2(size);
  int i;
  for(i = 0; i < size; ++i) {
    rb_ary_store(id, i, INT2NUM(read_4(pData)));
  }
  
  VALUE newref_class = rb_const_get(mErlectricity, rb_intern("NewReference"));
  return rb_funcall(newref_class, rb_intern("new"), 3, node, creation, id);
}
开发者ID:KirinDave,项目名称:erlectricity,代码行数:18,代码来源:decoder.c


示例10: Init_native

/**
 * Initialize the bson c extension.
 *
 * @since 2.0.0
 */
void Init_native()
{
  // Get all the constants to be used in the extensions.
  VALUE bson = rb_const_get(rb_cObject, rb_intern("BSON"));
  VALUE integer = rb_const_get(bson, rb_intern("Integer"));
  VALUE time = rb_const_get(bson, rb_intern("Time"));
  VALUE int32 = rb_const_get(bson, rb_intern("Int32"));
  VALUE int32_class = rb_singleton_class(int32);
  VALUE int64 = rb_const_get(bson, rb_intern("Int64"));
  VALUE int64_class = rb_singleton_class(int64);
  VALUE object_id = rb_const_get(bson, rb_intern("ObjectId"));
  VALUE generator = rb_const_get(object_id, rb_intern("Generator"));
  VALUE string = rb_const_get(bson, rb_intern("String"));

  // Redefine the serialization methods on the Integer class.
  rb_undef_method(integer, "to_bson_int32");
  rb_define_method(integer, "to_bson_int32", rb_integer_to_bson_int32, 1);
  rb_undef_method(integer, "to_bson_int64");
  rb_define_method(integer, "to_bson_int64", rb_integer_to_bson_int64, 1);

  // Redefine deserialization methods on Int32 class.
  rb_undef_method(int32_class, "from_bson_int32");
  rb_define_private_method(int32_class, "from_bson_int32", rb_integer_from_bson_int32, 1);

  // Redefine deserialization methods on Int64 class.
  rb_undef_method(int64_class, "from_bson_int64");
  rb_define_private_method(int64_class, "from_bson_int64", rb_integer_from_bson_int64, 1);

  // Redefine the serialization methods on the time class.
  rb_undef_method(time, "to_bson_time");
  rb_define_method(time, "to_bson_time", rb_time_to_bson, 2);

  // Redefine the setint32 method on the String class.
  rb_undef_method(string, "setint32");
  rb_define_method(string, "setint32", rb_string_setint32, 2);

  // Setup the machine id for object id generation.
  /* memcpy(rb_bson_machine_id, RSTRING_PTR(machine_id), 16); */
  rb_undef_method(generator, "next");
  rb_define_method(generator, "next", rb_object_id_generator_next, -1);
}
开发者ID:gjmurakami-10gen,项目名称:mongo-meta-driver,代码行数:46,代码来源:native.c


示例11: syserr_eqq

static VALUE
syserr_eqq(VALUE self, VALUE exc)
{
    VALUE num, e;

    if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
	if (!rb_respond_to(exc, id_errno)) return Qfalse;
    }
    else if (self == rb_eSystemCallError) return Qtrue;

    num = rb_attr_get(exc, id_errno);
    if (NIL_P(num)) {
	num = rb_funcallv(exc, id_errno, 0, 0);
    }
    e = rb_const_get(self, id_Errno);
    if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
	return Qtrue;
    return Qfalse;
}
开发者ID:0x00evil,项目名称:ruby,代码行数:19,代码来源:error.c


示例12: rb_define_module

VALUE
rb_define_module(const char *name)
{
    VALUE module;
    ID id;

    id = rb_intern(name);
    if (rb_const_defined(rb_cObject, id)) {
	module = rb_const_get(rb_cObject, id);
	if (RB_TYPE_P(module, T_MODULE))
	    return module;
	rb_raise(rb_eTypeError, "%s is not a module", rb_obj_classname(module));
    }
    module = rb_define_module_id(id);
    rb_vm_add_root_module(id, module);
    rb_const_set(rb_cObject, id, module);

    return module;
}
开发者ID:Danylyuk,项目名称:first_app,代码行数:19,代码来源:class.c


示例13: g_rclosure_attach

void
g_rclosure_attach(GClosure *closure, VALUE object)
{
    static VALUE mGLibObject = (VALUE)NULL;
    GRClosure *rclosure = (GRClosure *)closure;

    G_RELATIVE2(object, Qnil, id_closures, rclosure->rb_holder);

    if (!mGLibObject) {
        mGLibObject = rb_const_get(mGLib, rb_intern("Object"));
    }
    if (rb_obj_is_kind_of(object, mGLibObject)) {
        GObject *gobject;
        gobject = RVAL2GOBJ(object);
        rclosure->count++;
        g_object_weak_ref(gobject, rclosure_weak_notify, rclosure);
        rclosure->objects = g_list_prepend(rclosure->objects, gobject);
    }
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:19,代码来源:rbgobj_closure.c


示例14: Init_objspace

void
Init_objspace(void)
{
    VALUE rb_mObjSpace = rb_const_get(rb_cObject, rb_intern("ObjectSpace"));

    rb_define_module_function(rb_mObjSpace, "memsize_of", memsize_of_m, 1);
    rb_define_module_function(rb_mObjSpace, "memsize_of_all", memsize_of_all_m, -1);

    rb_define_module_function(rb_mObjSpace, "count_objects_size", count_objects_size, -1);
    rb_define_module_function(rb_mObjSpace, "count_nodes", count_nodes, -1);
    rb_define_module_function(rb_mObjSpace, "count_tdata_objects", count_tdata_objects, -1);

    rb_define_module_function(rb_mObjSpace, "reachable_objects_from", reachable_objects_from, 1);

    rb_mInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
    rb_define_method(rb_mInternalObjectWrapper, "type", iow_type, 0);
    rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);
    rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
}
开发者ID:Chatto,项目名称:VGdesk,代码行数:19,代码来源:objspace.c


示例15: Init_bool_ext

void Init_bool_ext() {
    VALUE rb_mBool; 
    VALUE rb_eStandardError;
    VALUE rb_cBinary;
    VALUE rb_cUnary;

    rb_eStandardError = rb_const_get(rb_cObject, rb_intern("StandardError"));
    rb_mBool = rb_define_module("Bool");
    rb_eParseError = rb_define_class_under(rb_mBool, "ParseError", rb_eStandardError);

    rb_cBinary = rb_define_class_under(rb_mBool, "Binary", rb_cObject);
    rb_cUnary = rb_define_class_under(rb_mBool, "Unary", rb_cObject);
    rb_cVar = rb_define_class_under(rb_mBool, "Var", rb_cObject);
    rb_cAnd = rb_define_class_under(rb_mBool, "And", rb_cBinary);
    rb_cOr  = rb_define_class_under(rb_mBool, "Or", rb_cBinary);
    rb_cNot = rb_define_class_under(rb_mBool, "Not", rb_cUnary);

    rb_define_singleton_method(rb_mBool, "parse", Bool_parse, 1);
}
开发者ID:sebrose,项目名称:bool,代码行数:19,代码来源:ext.c


示例16: rbffi_num2longdouble

long double 
rbffi_num2longdouble(VALUE value)
{
    if (TYPE(value) == T_FLOAT) {
        return rb_num2dbl(value);
    }
    
    if (!RTEST(rb_cBigDecimal) && rb_const_defined(rb_cObject, rb_intern("BigDecimal"))) {
        rb_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
    }

    if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject && RTEST(rb_obj_is_kind_of(value, rb_cBigDecimal))) {
        VALUE s = rb_funcall(value, rb_intern("to_s"), 1, rb_str_new2("E"));
        return strtold(RSTRING_PTR(s), NULL);
    }

    /* Fall through to handling as a float */
    return rb_num2dbl(value);
}
开发者ID:stoune,项目名称:ffi,代码行数:19,代码来源:LongDouble.c


示例17: InitReader

void InitReader(VALUE mod) {
    klass_reader = rb_define_class_under(mod, "Reader", rb_cObject);
    rb_global_variable(&klass_reader);
    rb_define_alloc_func(klass_reader, reader_allocate);
    rb_define_method(klass_reader, "feed", reader_feed, 1);
    rb_define_method(klass_reader, "gets", reader_gets, 0);

    /* If the Encoding class is present, #default_external should be used to
     * determine the encoding for new strings. The "enc_default_external"
     * ID is non-zero when encoding should be set on new strings. */
    if (rb_const_defined(rb_cObject, rb_intern("Encoding"))) {
        enc_klass = rb_const_get(rb_cObject, rb_intern("Encoding"));
        enc_default_external = rb_intern("default_external");
        str_force_encoding = rb_intern("force_encoding");
        rb_global_variable(&enc_klass);
    } else {
        enc_default_external = 0;
    }
}
开发者ID:logaritmisk,项目名称:hiredis-rb,代码行数:19,代码来源:reader.c


示例18: load_script

static int
load_script(int argc, char **argv)
{
  VALUE r_argv, fname;
  int state, i;

  if (argc < 1) {
    return 0;
  }

  r_argv = rb_const_get(rb_mKernel, rb_intern("ARGV"));
  rb_ary_clear(r_argv);
  for (i = 1; i < argc; i++) {
    rb_ary_push(r_argv, rb_tainted_str_new2(argv[i]));
  }

  fname = rb_funcall(rb_cFile, ExpandPath, 1, rb_str_new2(argv[0]));
  rb_load_protect(fname, 1, &state);
  if (state) {
    VALUE errinfo, errstr, errat;
    int n, i;
    const char *cstr;

    errinfo = rb_errinfo();
    errstr = rb_obj_as_string(errinfo);
    cstr = StringValueCStr(errstr);
    if (strcmp(cstr, "exit")) {
      ngraph_err_puts(cstr);
      errat = rb_funcall(errinfo, rb_intern("backtrace"), 0);
      if (! NIL_P(errat)) {
	n = RARRAY_LEN(errat);
	for (i = 0; i < n; i ++) {
	  errstr = rb_str_new2("\tfrom ");
	  rb_str_append(errstr, rb_ary_entry(errat, i));
	  ngraph_err_puts(StringValueCStr(errstr));
	}
      }
    }
  }
  rb_gc_start();

  return 0;
}
开发者ID:htrb,项目名称:ngraph-gtk,代码行数:43,代码来源:ngraph.c


示例19: Init_melbourne20

void Init_melbourne20(void) {
  VALUE rb_cMelbourne;

  melbourne::init_symbols20();

#ifndef RUBINIUS
  VALUE rb_mRubinius = rb_const_get(rb_cObject, rb_intern("Rubinius"));
#endif

  rb_cMelbourne = rb_define_class_under(rb_mRubinius, "Melbourne", rb_cObject);
  rb_define_method(rb_cMelbourne, "string_to_ast_18",
      RUBY_METHOD_FUNC(melbourne18_string_to_ast), 3);
  rb_define_method(rb_cMelbourne, "file_to_ast_18",
      RUBY_METHOD_FUNC(melbourne18_file_to_ast), 2);
  rb_define_method(rb_cMelbourne, "string_to_ast_19",
      RUBY_METHOD_FUNC(melbourne19_string_to_ast), 3);
  rb_define_method(rb_cMelbourne, "file_to_ast_19",
      RUBY_METHOD_FUNC(melbourne19_file_to_ast), 2);
}
开发者ID:AndrewVos,项目名称:rubinius,代码行数:19,代码来源:melbourne.cpp


示例20: getButtonArg

static int getButtonArg(VALUE self, int argc, VALUE *argv)
{
	int num;

#ifdef RGSS3
	ID sym;
	rb_get_args(argc, argv, "n", &sym RB_ARG_END);

	if (rb_const_defined(self, sym))
		num = FIX2INT(rb_const_get(self, sym));
	else
		num = 0;
#else
	(void) self;
	rb_get_args(argc, argv, "i", &num RB_ARG_END);
#endif

	return num;
}
开发者ID:BlackLotus,项目名称:mkxp,代码行数:19,代码来源:input-binding.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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