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


C++ rb_const_get函数代码示例

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


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


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