本文整理汇总了C++中NativeMethodEnvironment::state方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeMethodEnvironment::state方法的具体用法?C++ NativeMethodEnvironment::state怎么用?C++ NativeMethodEnvironment::state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeMethodEnvironment
的用法示例。
在下文中一共展示了NativeMethodEnvironment::state方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rb_intern
ID rb_intern(const char* string) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
return reinterpret_cast<ID>(env->state()->symbol(string));
}
示例2: rb_thread_current
VALUE rb_thread_current(void) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Thread* thread = env->state()->vm()->thread.get();
return env->get_handle(thread);
}
示例3: rb_reg_new
VALUE rb_reg_new(const char *source, long len, int options) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
String *pat = String::create(env->state(), source, len);
return rb_funcall(rb_cRegexp, rb_intern("new"), 2, env->get_handle(pat), Fixnum::from(options));
}
示例4: rb_register_transcoder
void rb_register_transcoder(const rb_transcoder* trans) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Transcoding::define(env->state(), (OnigTranscodingType*)trans);
}
示例5: rb_set_kcode
void rb_set_kcode(const char *code) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
System::vm_set_kcode(env->state(), String::create(env->state(), code));
}
示例6: rb_obj_encoding
VALUE rb_obj_encoding(VALUE obj) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Object* val = env->get_object(obj);
Encoding* enc = Encoding::get_object_encoding(env->state(), val);
return env->get_handle(enc);
}
示例7: rb_enc_from_encoding
VALUE rb_enc_from_encoding(rb_encoding *enc) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
return env->get_handle(Encoding::find(env->state(), enc->name));
}
示例8: rb_str_length
VALUE rb_str_length(VALUE self) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
String* string = capi_get_string(env, self);
return LONG2FIX(string->char_size(env->state()));
}
示例9: rb_singleton_class
/** @todo Should this be a global handle? Surely not.. --rue */
VALUE rb_singleton_class(VALUE object_handle) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Class* sc = env->get_object(object_handle)->singleton_class(env->state());
return env->get_handle(sc);
}
示例10: rb_str_dup
VALUE rb_str_dup(VALUE self) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
String* string = capi_get_string(env, self);
return env->get_handle(string->string_dup(env->state()));
}
示例11: rb_str_new
VALUE rb_str_new(const char* string, long length) {
if(length < 0) rb_raise(rb_eArgError, "invalid string size");
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
return env->get_handle(String::create(env->state(), string, length));
}
示例12: rb_str_modify
void rb_str_modify(VALUE self) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
String* string = capi_get_string(env, self);
string->unshare(env->state());
}
示例13:
char* rb_class2name(VALUE class_handle) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Class* class_object = c_as<Class>(env->get_object(class_handle));
return ::strdup(class_object->name()->c_str(env->state()));
}
示例14: rb_class_name
VALUE rb_class_name(VALUE class_handle) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Class* class_object = c_as<Class>(env->get_object(class_handle));
return env->get_handle(class_object->name()->to_str(env->state()));
}
示例15: rb_obj_freeze
VALUE rb_obj_freeze(VALUE hndl) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->get_object(hndl)->freeze(env->state());
return hndl;
}