本文整理汇总了C++中MRB_SET_INSTANCE_TT函数的典型用法代码示例。如果您正苦于以下问题:C++ MRB_SET_INSTANCE_TT函数的具体用法?C++ MRB_SET_INSTANCE_TT怎么用?C++ MRB_SET_INSTANCE_TT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MRB_SET_INSTANCE_TT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mrb_mruby_regexp_pcre_gem_init
void
mrb_mruby_regexp_pcre_gem_init(mrb_state *mrb)
{
struct RClass *re, *md;
re = mrb_define_class(mrb, "Regexp", mrb->object_class);
MRB_SET_INSTANCE_TT(re, MRB_TT_DATA);
mrb_define_method(mrb, re, "initialize", regexp_pcre_initialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
mrb_define_method(mrb, re, "match", regexp_pcre_match, MRB_ARGS_REQ(1));
mrb_define_method(mrb, re, "==", regexp_equal, MRB_ARGS_REQ(1));
mrb_define_const(mrb, re, "IGNORECASE", mrb_fixnum_value(MRUBY_REGEXP_IGNORECASE));
mrb_define_const(mrb, re, "EXTENDED", mrb_fixnum_value(MRUBY_REGEXP_EXTENDED));
mrb_define_const(mrb, re, "MULTILINE", mrb_fixnum_value(MRUBY_REGEXP_MULTILINE));
md = mrb_define_class(mrb, "MatchData", mrb->object_class);
MRB_SET_INSTANCE_TT(md, MRB_TT_DATA);
mrb_define_method(mrb, md, "initialize", mrb_matchdata_init, MRB_ARGS_REQ(1));
mrb_define_method(mrb, md, "initialize_copy", mrb_matchdata_init_copy, MRB_ARGS_REQ(1));
mrb_define_method(mrb, md, "begin", mrb_matchdata_begin, MRB_ARGS_REQ(1));
mrb_define_method(mrb, md, "end", mrb_matchdata_end, MRB_ARGS_REQ(1));
mrb_define_method(mrb, md, "length", mrb_matchdata_length, MRB_ARGS_NONE());
}
示例2: mruby_sdl2_mutex_init
void
mruby_sdl2_mutex_init(mrb_state *mrb)
{
class_Mutex = mrb_define_class_under(mrb, mod_SDL2, "Mutex", mrb->object_class);
class_Semaphore = mrb_define_class_under(mrb, mod_SDL2, "Semaphore", mrb->object_class);
class_Cond = mrb_define_class_under(mrb, mod_SDL2, "Cond", mrb->object_class);
MRB_SET_INSTANCE_TT(class_Mutex, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(class_Semaphore, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(class_Cond, MRB_TT_DATA);
mrb_define_method(mrb, class_Mutex, "initialize", mrb_sdl2_mutex_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Mutex, "destroy", mrb_sdl2_mutex_destroy, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Mutex, "lock", mrb_sdl2_mutex_lock, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Mutex, "try_lock", mrb_sdl2_mutex_try_lock, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Mutex, "unlock", mrb_sdl2_mutex_unlock, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Semaphore, "initialize", mrb_sdl2_semaphore_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Semaphore, "destroy", mrb_sdl2_semaphore_destroy, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Semaphore, "post", mrb_sdl2_semaphore_post, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Semaphore, "wait", mrb_sdl2_semaphore_wait, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Semaphore, "try_wait", mrb_sdl2_semaphore_try_wait, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Semaphore, "wait_timeout", mrb_sdl2_semaphore_wait_timeout, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Semaphore, "value", mrb_sdl2_semaphore_get_value, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Cond, "initialize", mrb_sdl2_cond_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Cond, "destroy", mrb_sdl2_cond_destroy, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Cond, "broadcast", mrb_sdl2_cond_broadcast, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Cond, "signal", mrb_sdl2_cond_signal, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Cond, "wait", mrb_sdl2_cond_wait, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Cond, "wait_timeout", mrb_sdl2_cond_wait_timeout, MRB_ARGS_REQ(2));
}
示例3: mrb_cp_contact_point_init
void
mrb_cp_contact_point_init(mrb_state *mrb, struct RClass *cp_module)
{
mrb_cp_contact_point_class = mrb_define_class_under(mrb, cp_module, "ContactPoint", mrb->object_class);
mrb_cp_contact_point_set_class = mrb_define_class_under(mrb, cp_module, "ContactPointSet", mrb->object_class);
/* */
MRB_SET_INSTANCE_TT(mrb_cp_contact_point_class, MRB_TT_OBJECT);
MRB_SET_INSTANCE_TT(mrb_cp_contact_point_set_class, MRB_TT_OBJECT);
/* */
mrb_define_method(mrb, mrb_cp_contact_point_class, "initialize", contact_point_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_class, "point_a", contact_point_get_point_a, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_class, "point_a=", contact_point_set_point_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_contact_point_class, "point_b", contact_point_get_point_b, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_class, "point_b=", contact_point_set_point_b, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_contact_point_class, "distance", contact_point_get_distance, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_class, "distance=", contact_point_set_distance, MRB_ARGS_REQ(1));
/* */
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "initialize", contact_point_set_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "count", contact_point_set_get_count, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "count=", contact_point_set_set_count, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "normal", contact_point_set_get_normal, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "normal=", contact_point_set_set_normal, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "points", contact_point_set_get_points, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_contact_point_set_class, "points=", contact_point_set_set_points, MRB_ARGS_REQ(1));
}
示例4: mruby_sdl2_misc_init
void
mruby_sdl2_misc_init(mrb_state *mrb)
{
class_Buffer = mrb_define_class_under(mrb, mod_SDL2, "Buffer", mrb->object_class);
class_FloatBuffer = mrb_define_class_under(mrb, mod_SDL2, "FloatBuffer", class_Buffer);
class_ByteBuffer = mrb_define_class_under(mrb, mod_SDL2, "ByteBuffer", class_Buffer);
MRB_SET_INSTANCE_TT(class_Buffer, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(class_FloatBuffer, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(class_ByteBuffer, MRB_TT_DATA);
mrb_define_method(mrb, class_Buffer, "initialize", mrb_sdl2_misc_buffer_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Buffer, "address", mrb_sdl2_misc_buffer_get_address, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Buffer, "size", mrb_sdl2_misc_buffer_get_size, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Buffer, "cptr", mrb_sdl2_misc_buffer_get_cptr, MRB_ARGS_NONE());
mrb_define_method(mrb, class_FloatBuffer, "initialize", mrb_sdl2_misc_floatbuffer_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_FloatBuffer, "size", mrb_sdl2_misc_floatbuffer_get_size, MRB_ARGS_NONE());
mrb_define_method(mrb, class_FloatBuffer, "[]", mrb_sdl2_misc_floatbuffer_get_at, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_FloatBuffer, "[]=", mrb_sdl2_misc_floatbuffer_set_at, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_ByteBuffer, "initialize", mrb_sdl2_misc_bytebuffer_initialize, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_ByteBuffer, "[]", mrb_sdl2_misc_bytebuffer_get_at, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_ByteBuffer, "[]=", mrb_sdl2_misc_bytebuffer_set_at, MRB_ARGS_REQ(2));
}
示例5: mrb_mruby_polarssl_gem_init
void mrb_mruby_polarssl_gem_init(mrb_state *mrb) {
struct RClass *p, *e, *c, *s, *pkey, *ecdsa, *cipher, *des, *des3;
p = mrb_define_module(mrb, "PolarSSL");
pkey = mrb_define_module_under(mrb, p, "PKey");
e = mrb_define_class_under(mrb, p, "Entropy", mrb->object_class);
MRB_SET_INSTANCE_TT(e, MRB_TT_DATA);
mrb_define_method(mrb, e, "initialize", mrb_entropy_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, e, "gather", mrb_entropy_gather, MRB_ARGS_NONE());
c = mrb_define_class_under(mrb, p, "CtrDrbg", mrb->object_class);
MRB_SET_INSTANCE_TT(c, MRB_TT_DATA);
mrb_define_method(mrb, c, "initialize", mrb_ctrdrbg_initialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
mrb_define_singleton_method(mrb, (struct RObject*)c, "self_test", mrb_ctrdrbg_self_test, MRB_ARGS_NONE());
s = mrb_define_class_under(mrb, p, "SSL", mrb->object_class);
MRB_SET_INSTANCE_TT(s, MRB_TT_DATA);
mrb_define_method(mrb, s, "initialize", mrb_ssl_initialize, MRB_ARGS_NONE());
// 0: Endpoint mode for acting as a client.
mrb_define_const(mrb, s, "SSL_IS_CLIENT", mrb_fixnum_value(SSL_IS_CLIENT));
// 0: Certificate verification mode for doing no verification.
mrb_define_const(mrb, s, "SSL_VERIFY_NONE", mrb_fixnum_value(SSL_VERIFY_NONE));
// 1: Certificate verification mode for optional verification.
mrb_define_const(mrb, s, "SSL_VERIFY_OPTIONAL", mrb_fixnum_value(SSL_VERIFY_OPTIONAL));
// 2: Certificate verification mode for having required verification.
mrb_define_const(mrb, s, "SSL_VERIFY_REQUIRED", mrb_fixnum_value(SSL_VERIFY_REQUIRED));
mrb_define_method(mrb, s, "set_endpoint", mrb_ssl_set_endpoint, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "set_authmode", mrb_ssl_set_authmode, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "set_rng", mrb_ssl_set_rng, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "set_socket", mrb_ssl_set_socket, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "handshake", mrb_ssl_handshake, MRB_ARGS_NONE());
mrb_define_method(mrb, s, "write", mrb_ssl_write, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "read", mrb_ssl_read, MRB_ARGS_REQ(1));
mrb_define_method(mrb, s, "bytes_available", mrb_ssl_bytes_available, MRB_ARGS_NONE());
mrb_define_method(mrb, s, "fileno", mrb_ssl_fileno, MRB_ARGS_NONE());
mrb_define_method(mrb, s, "close_notify", mrb_ssl_close_notify, MRB_ARGS_NONE());
mrb_define_method(mrb, s, "close", mrb_ssl_close, MRB_ARGS_NONE());
ecdsa = mrb_define_class_under(mrb, pkey, "EC", mrb->object_class);
MRB_SET_INSTANCE_TT(ecdsa, MRB_TT_DATA);
mrb_define_method(mrb, ecdsa, "alloc", mrb_ecdsa_alloc, MRB_ARGS_NONE());
mrb_define_method(mrb, ecdsa, "generate_key", mrb_ecdsa_generate_key, MRB_ARGS_NONE());
mrb_define_method(mrb, ecdsa, "load_pem", mrb_ecdsa_load_pem, MRB_ARGS_REQ(1));
mrb_define_method(mrb, ecdsa, "public_key", mrb_ecdsa_public_key, MRB_ARGS_NONE());
mrb_define_method(mrb, ecdsa, "private_key", mrb_ecdsa_private_key, MRB_ARGS_NONE());
mrb_define_method(mrb, ecdsa, "sign", mrb_ecdsa_sign, MRB_ARGS_REQ(1));
cipher = mrb_define_class_under(mrb, p, "Cipher", mrb->object_class);
des = mrb_define_class_under(mrb, cipher, "DES", cipher);
mrb_define_class_method(mrb, des, "encrypt", mrb_des_encrypt, MRB_ARGS_REQ(4));
mrb_define_class_method(mrb, des, "decrypt", mrb_des_decrypt, MRB_ARGS_REQ(4));
des3 = mrb_define_class_under(mrb, cipher, "DES3", cipher);
mrb_define_class_method(mrb, des3, "encrypt", mrb_des3_encrypt, MRB_ARGS_REQ(4));
mrb_define_class_method(mrb, des3, "decrypt", mrb_des3_decrypt, MRB_ARGS_REQ(4));
}
示例6: mrb_mruby_sha2_gem_init
void
mrb_mruby_sha2_gem_init(mrb_state* mrb)
{
digest_module = mrb_define_module(mrb, "Digest");
base_class = mrb_define_class_under(mrb, digest_module, "Base", mrb->object_class);
sha256_class = mrb_define_class_under(mrb, digest_module, "SHA256", base_class);
sha384_class = mrb_define_class_under(mrb, digest_module, "SHA384", base_class);
sha512_class = mrb_define_class_under(mrb, digest_module, "SHA512", base_class);
MRB_SET_INSTANCE_TT(sha256_class, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(sha384_class, MRB_TT_DATA);
MRB_SET_INSTANCE_TT(sha512_class, MRB_TT_DATA);
mrb_define_method(mrb, sha256_class, "initialize", sha256_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "update", sha256_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha256_class, "<<", sha256_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha256_class, "reset", sha256_reset, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "clone", sha256_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "dup", sha256_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "digest", sha256_digest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "hexdigest", sha256_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "to_s", sha256_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "digest_length", sha256_digest_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "block_length", sha256_block_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha256_class, "file", sha256_file, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha384_class, "initialize", sha384_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "update", sha384_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha384_class, "<<", sha384_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha384_class, "reset", sha384_reset, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "clone", sha384_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "dup", sha384_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "digest", sha384_digest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "hexdigest", sha384_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "to_s", sha384_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "digest_length", sha384_digest_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "block_length", sha384_block_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha384_class, "file", sha384_file, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha512_class, "initialize", sha512_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "update", sha512_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha512_class, "<<", sha512_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, sha512_class, "reset", sha512_reset, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "clone", sha512_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "dup", sha512_clone, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "digest", sha512_digest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "hexdigest", sha512_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "to_s", sha512_hexdigest, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "digest_length", sha512_digest_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "block_length", sha512_block_length, MRB_ARGS_NONE());
mrb_define_method(mrb, sha512_class, "file", sha512_file, MRB_ARGS_REQ(1));
}
示例7: mrb_mruby_digest_ffi_gem_init
void
mrb_mruby_digest_ffi_gem_init(mrb_state* mrb) {
struct RClass *digest;
struct RClass *base;
struct RClass *md5;
struct RClass *rmd160;
struct RClass *sha1;
struct RClass *sha256;
struct RClass *sha384;
struct RClass *sha512;
struct RClass *hmac;
digest = mrb_define_module(mrb, "Digest");
base = mrb_define_class_under(mrb, digest, "Base", mrb->object_class);
md5 = mrb_define_class_under(mrb, digest, "MD5", base);
rmd160 = mrb_define_class_under(mrb, digest, "RMD160", base);
sha1 = mrb_define_class_under(mrb, digest, "SHA1", base);
sha256 = mrb_define_class_under(mrb, digest, "SHA256", base);
sha384 = mrb_define_class_under(mrb, digest, "SHA384", base);
sha512 = mrb_define_class_under(mrb, digest, "SHA512", base);
MRB_SET_INSTANCE_TT(base, MRB_TT_DATA);
mrb_define_method(mrb, base, "initialize", mrb_base_init, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "block_length", mrb_digest_block_length, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "reset", mrb_digest_reset, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "update", mrb_digest_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, base, "digest", mrb_digest_digest, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "digest!", mrb_digest_digest_bang, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "digest_length", mrb_digest_digest_length, MRB_ARGS_NONE());
mrb_define_method(mrb, base, "hexdigest", mrb_digest_hexdigest, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(md5, MRB_TT_DATA);
mrb_define_method(mrb, md5, "initialize", mrb_md5_init, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(rmd160, MRB_TT_DATA);
mrb_define_method(mrb, rmd160, "initialize", mrb_rmd160_init, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(sha1, MRB_TT_DATA);
mrb_define_method(mrb, sha1, "initialize", mrb_sha1_init, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(sha256, MRB_TT_DATA);
mrb_define_method(mrb, sha256, "initialize", mrb_sha256_init, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(sha384, MRB_TT_DATA);
mrb_define_method(mrb, sha384, "initialize", mrb_sha384_init, MRB_ARGS_NONE());
MRB_SET_INSTANCE_TT(sha512, MRB_TT_DATA);
mrb_define_method(mrb, sha512, "initialize", mrb_sha512_init, MRB_ARGS_NONE());
hmac = mrb_define_class_under(mrb, digest, "HMAC", mrb->object_class);
MRB_SET_INSTANCE_TT(hmac, MRB_TT_DATA);
mrb_define_method(mrb, hmac, "initialize", mrb_hmac_init, MRB_ARGS_REQ(2));
mrb_define_method(mrb, hmac, "block_length", mrb_digest_hmac_block_length, MRB_ARGS_NONE());
mrb_define_method(mrb, hmac, "update", mrb_digest_hmac_update, MRB_ARGS_REQ(1));
mrb_define_method(mrb, hmac, "digest", mrb_digest_hmac_digest, MRB_ARGS_NONE());
mrb_define_method(mrb, hmac, "digest_length", mrb_digest_hmac_digest_length, MRB_ARGS_NONE());
mrb_define_method(mrb, hmac, "hexdigest", mrb_digest_hmac_hexdigest, MRB_ARGS_NONE());
}
示例8: ruby_register_cocos2dx_experimental_video_VideoPlayer
void ruby_register_cocos2dx_experimental_video_VideoPlayer(mrb_state* mrb, struct RClass* rmodule)
{
std::string typeName = typeid(cocos2d::experimental::ui::VideoPlayer).name();
g_rubyType[typeName] = "CCExp::VideoPlayer";
g_rubyDataType[typeName] = &ruby_cocos2dx_Ref_type;
struct RClass* p_rmodule = mrb->object_class;
p_rmodule = mrb_module_get_under(mrb, p_rmodule, "CCUI");
struct RClass* p_rclass = mrb_class_get_under(mrb, p_rmodule, "Widget");
struct RClass *rclass = mrb_define_class_under(mrb, rmodule, "VideoPlayer", p_rclass);
MRB_SET_INSTANCE_TT(rclass, MRB_TT_DATA);
mrb_define_method(mrb, rclass, "get_file_name", ruby_cocos2dx_experimental_video_VideoPlayer_getFileName, ARGS_NONE());
mrb_define_method(mrb, rclass, "get_url", ruby_cocos2dx_experimental_video_VideoPlayer_getURL, ARGS_NONE());
mrb_define_method(mrb, rclass, "play", ruby_cocos2dx_experimental_video_VideoPlayer_play, ARGS_NONE());
mrb_define_method(mrb, rclass, "pause", ruby_cocos2dx_experimental_video_VideoPlayer_pause, ARGS_NONE());
mrb_define_method(mrb, rclass, "set_keep_aspect_ratio_enabled", ruby_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled, ARGS_REQ(1));
mrb_define_method(mrb, rclass, "resume", ruby_cocos2dx_experimental_video_VideoPlayer_resume, ARGS_NONE());
mrb_define_method(mrb, rclass, "stop", ruby_cocos2dx_experimental_video_VideoPlayer_stop, ARGS_NONE());
mrb_define_method(mrb, rclass, "set_full_screen_enabled", ruby_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled, ARGS_REQ(1));
mrb_define_method(mrb, rclass, "set_file_name", ruby_cocos2dx_experimental_video_VideoPlayer_setFileName, ARGS_REQ(1));
mrb_define_method(mrb, rclass, "set_url", ruby_cocos2dx_experimental_video_VideoPlayer_setURL, ARGS_REQ(1));
mrb_define_method(mrb, rclass, "keep_aspect_ratio_enabled?", ruby_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled, ARGS_NONE());
mrb_define_method(mrb, rclass, "on_play_event", ruby_cocos2dx_experimental_video_VideoPlayer_onPlayEvent, ARGS_REQ(1));
mrb_define_method(mrb, rclass, "full_screen_enabled?", ruby_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled, ARGS_NONE());
mrb_define_method(mrb, rclass, "playing?", ruby_cocos2dx_experimental_video_VideoPlayer_isPlaying, ARGS_NONE());
mrb_define_method(mrb, rclass, "seek_to", ruby_cocos2dx_experimental_video_VideoPlayer_seekTo, ARGS_REQ(1));
mrb_define_class_method(mrb, rclass, "create", ruby_cocos2dx_experimental_video_VideoPlayer_create_static, ARGS_NONE());
struct RClass* renum_EventType = mrb_define_module_under(mrb, rclass, "EventType");
ruby_cocos2dx_experimental_video_VideoPlayer_EventType_enum_init(mrb, renum_EventType);
mrb_define_class_method(mrb, renum_EventType, "PLAYING", ruby_cocos2dx_experimental_video_constant_get, ARGS_NONE());
mrb_define_class_method(mrb, renum_EventType, "PAUSED", ruby_cocos2dx_experimental_video_constant_get, ARGS_NONE());
mrb_define_class_method(mrb, renum_EventType, "STOPPED", ruby_cocos2dx_experimental_video_constant_get, ARGS_NONE());
mrb_define_class_method(mrb, renum_EventType, "COMPLETED", ruby_cocos2dx_experimental_video_constant_get, ARGS_NONE());
}
示例9: mrb_mruby_cache_gem_init
/*
* Document-class: Cache
*
* <code>Cache</code> provides for a Hashtable of strings in shared
* memory (via a memory mapped file), which thus can be shared between
* processes on a computer. Here is an example of its usage:
*
* $lm = Cache.new :namespace => "viewcounters"
* $lm[:foo] = 1
* $lm[:foo] # -> "1"
* $lm.delete(:foo)
*
* <code>Cache</code> can also be used as a persistent key value
* database, just use the :filename instead of the :namespace parameter.
*
* $lm = Cache.new :filename => "my-database.lmc"
* $lm[:foo] = 1
* $lm[:foo] # -> "1"
* $lm.delete(:foo)
*
* == Default sizes of memory pools
*
* The default size for memory pools is 1024 (MB). It cannot be changed later,
* so choose a size that will provide enough space for all your data. You
* might consider setting this size to the maximum filesize of your
* filesystem. Also note that while these memory pools may look large on your
* disk, they really aren't, because with sparse files only those parts of the
* file which contain non-null data actually use disk space.
*
* == Automatic recovery from crashes
*
* In case a process is terminated while accessing a memory pool, other
* processes will wait for the lock up to 2 seconds, and will then try to
* resume the aborted operation. This can also be done explicitly by using
* Cache.check(options).
*
* == Clearing memory pools
*
* Removing memory pools can be done with Cache.drop(options).
*
* == Environment
*
* If you use the :namespace parameter, the .lmc file for your namespace will
* reside in /var/tmp/Cache. This can be overriden by setting the
* LMC_NAMESPACES_ROOT_PATH variable in the environment.
*
* == Storing Ruby Objects
*
* If you want to store Ruby objects instead of just strings, consider
* using Cache::SharedObjectStorage.
*
*/
void mrb_mruby_cache_gem_init(mrb_state *mrb)
{
struct RClass *Cache;
lmc_init();
Cache = mrb_define_class(mrb, "Cache", mrb->object_class);
MRB_SET_INSTANCE_TT(Cache, MRB_TT_DATA);
mrb_define_method(mrb, Cache, "initialize", Cache_init, MRB_ARGS_REQ(1));
mrb_define_singleton_method(mrb, (struct RObject *)Cache, "drop", Cache__drop, MRB_ARGS_REQ(1));
mrb_define_singleton_method(mrb, (struct RObject *)Cache, "disable_test_crash", Cache__disable_test_crash,
MRB_ARGS_NONE());
mrb_define_singleton_method(mrb, (struct RObject *)Cache, "enable_test_crash", Cache__enable_test_crash,
MRB_ARGS_NONE());
mrb_define_method(mrb, Cache, "get", Cache__get, MRB_ARGS_REQ(1));
mrb_define_method(mrb, Cache, "[]", Cache__get, MRB_ARGS_REQ(1));
mrb_define_method(mrb, Cache, "delete", Cache__delete, MRB_ARGS_REQ(1));
mrb_define_method(mrb, Cache, "set", Cache__set, MRB_ARGS_REQ(2));
mrb_define_method(mrb, Cache, "clear", Cache__clear, MRB_ARGS_NONE());
mrb_define_method(mrb, Cache, "[]=", Cache__set, MRB_ARGS_REQ(2));
mrb_define_method(mrb, Cache, "close", Cache__close, MRB_ARGS_NONE());
mrb_define_method(mrb, Cache, "size", Cache__size, MRB_ARGS_NONE());
mrb_define_method(mrb, Cache, "shm_status", Cache__shm_status, MRB_ARGS_NONE());
mrb_define_method(mrb, Cache, "check_consistency", Cache__check_consistency, MRB_ARGS_NONE());
// mrb_define_method(mrb, Cache, "keys", Cache__keys, MRB_ARGS_NONE());
DONE;
}
示例10: mruby_sdl2_video_surface_init
void
mruby_sdl2_video_surface_init(mrb_state *mrb, struct RClass *mod_Video)
{
class_Surface = mrb_define_class_under(mrb, mod_Video, "Surface", mrb->object_class);
MRB_SET_INSTANCE_TT(class_Surface, MRB_TT_DATA);
mrb_define_method(mrb, class_Surface, "initialize", mrb_sdl2_video_surface_initialize, MRB_ARGS_REQ(8));
mrb_define_method(mrb, class_Surface, "free", mrb_sdl2_video_surface_free, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "destroy", mrb_sdl2_video_surface_free, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "blit_scaled", mrb_sdl2_video_surface_blit_scaled, MRB_ARGS_REQ(2) | MRB_ARGS_OPT(1));
mrb_define_method(mrb, class_Surface, "blit_surface", mrb_sdl2_video_surface_blit_surface, MRB_ARGS_REQ(3));
mrb_define_method(mrb, class_Surface, "blit_from_string",mrb_sdl2_video_surface_blit_from_string,MRB_ARGS_REQ(5));
mrb_define_method(mrb, class_Surface, "convert_format", mrb_sdl2_video_surface_convert_format, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_Surface, "fill_rect", mrb_sdl2_video_surface_fill_rect, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
mrb_define_method(mrb, class_Surface, "fill_rects", mrb_sdl2_video_surface_fill_rects, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_Surface, "clip_rect", mrb_sdl2_video_surface_get_clip_rect, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "clip_rect=", mrb_sdl2_video_surface_set_clip_rect, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "color_key_get", mrb_sdl2_video_surface_get_color_key, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "color_key_set", mrb_sdl2_video_surface_get_solor_key, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_Surface, "alpha_mod", mrb_sdl2_video_surface_get_alpha_mod, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "alpha_mod=", mrb_sdl2_video_surface_set_alpha_mod, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "blend_mode", mrb_sdl2_video_surface_get_blend_mode, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "blend_mode=", mrb_sdl2_video_surface_set_blend_mode, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "color_mod", mrb_sdl2_video_surface_get_color_mod, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "color_mod=", mrb_sdl2_video_surface_set_color_mod, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "palette", mrb_sdl2_video_surface_set_palette, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "rle", mrb_sdl2_video_surface_set_rle, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_Surface, "lock", mrb_sdl2_video_surface_lock, MRB_ARGS_NONE());
mrb_define_method(mrb, class_Surface, "unlock", mrb_sdl2_video_surface_unlock, MRB_ARGS_NONE());
mrb_define_class_method(mrb, class_Surface, "load_bmp", mrb_sdl2_video_surface_load_bmp, MRB_ARGS_REQ(1));
mrb_define_class_method(mrb, class_Surface, "save_bmp", mrb_sdl2_video_surface_save_bmp, MRB_ARGS_REQ(2));
}
示例11: copy_class
static void
copy_class(mrb_state *mrb, mrb_value dst, mrb_value src)
{
struct RClass *dc = mrb_class_ptr(dst);
struct RClass *sc = mrb_class_ptr(src);
/* if the origin is not the same as the class, then the origin and
the current class need to be copied */
if (sc->flags & MRB_FL_CLASS_IS_PREPENDED) {
struct RClass *c0 = sc->super;
struct RClass *c1 = dc;
/* copy prepended iclasses */
while (!(c0->flags & MRB_FL_CLASS_IS_ORIGIN)) {
c1->super = mrb_class_ptr(mrb_obj_dup(mrb, mrb_obj_value(c0)));
c1 = c1->super;
c0 = c0->super;
}
c1->super = mrb_class_ptr(mrb_obj_dup(mrb, mrb_obj_value(c0)));
c1->super->flags |= MRB_FL_CLASS_IS_ORIGIN;
}
if (sc->mt) {
dc->mt = kh_copy(mt, mrb, sc->mt);
}
else {
dc->mt = kh_init(mt, mrb);
}
dc->super = sc->super;
MRB_SET_INSTANCE_TT(dc, MRB_INSTANCE_TT(sc));
}
示例12: make_struct
static mrb_value
make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * klass)
{
mrb_value nstr;
mrb_sym id;
struct RClass *c;
if (mrb_nil_p(name)) {
c = mrb_class_new(mrb, klass);
}
else {
/* old style: should we warn? */
name = mrb_str_to_str(mrb, name);
id = mrb_obj_to_sym(mrb, name);
if (!is_const_id(mrb, mrb_sym2name_len(mrb, id, NULL))) {
mrb_name_error(mrb, id, "identifier %S needs to be constant", name);
}
if (mrb_const_defined_at(mrb, mrb_obj_value(klass), id)) {
mrb_warn(mrb, "redefining constant Struct::%S", name);
/* ?rb_mod_remove_const(klass, mrb_sym2name(mrb, id)); */
}
c = mrb_define_class_under(mrb, klass, RSTRING_PTR(name), klass);
}
MRB_SET_INSTANCE_TT(c, MRB_TT_ARRAY);
nstr = mrb_obj_value(c);
mrb_iv_set(mrb, nstr, mrb_intern_lit(mrb, "__members__"), members);
mrb_define_class_method(mrb, c, "new", mrb_instance_new, MRB_ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_instance_new, MRB_ARGS_ANY());
mrb_define_class_method(mrb, c, "members", mrb_struct_s_members_m, MRB_ARGS_NONE());
/* RSTRUCT(nstr)->basic.c->super = c->c; */
make_struct_define_accessors(mrb, members, c);
return nstr;
}
示例13: mrb_init_io
void
mrb_init_io(mrb_state *mrb)
{
struct RClass *io;
io = mrb_define_class(mrb, "IO", mrb->object_class);
MRB_SET_INSTANCE_TT(io, MRB_TT_DATA);
mrb_include_module(mrb, io, mrb_module_get(mrb, "Enumerable")); /* 15.2.20.3 */
#ifndef _WIN32
mrb_define_class_method(mrb, io, "_popen", mrb_io_s_popen, MRB_ARGS_ANY());
mrb_define_class_method(mrb, io, "_sysclose", mrb_io_s_sysclose, MRB_ARGS_REQ(1));
#endif
mrb_define_class_method(mrb, io, "select", mrb_io_s_select, MRB_ARGS_ANY());
mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, MRB_ARGS_ANY());
mrb_define_method(mrb, io, "initialize", mrb_io_initialize, MRB_ARGS_ANY()); /* 15.2.20.5.21 (x)*/
mrb_define_method(mrb, io, "sync", mrb_io_sync, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "sync=", mrb_io_set_sync, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "sysread", mrb_io_sysread, MRB_ARGS_ANY());
mrb_define_method(mrb, io, "sysseek", mrb_io_sysseek, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "syswrite", mrb_io_syswrite, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "close", mrb_io_close, MRB_ARGS_NONE()); /* 15.2.20.5.1 */
mrb_define_method(mrb, io, "close_on_exec=", mrb_io_set_close_on_exec, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "close_on_exec?", mrb_io_close_on_exec_p, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "closed?", mrb_io_closed, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "pid", mrb_io_pid, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "fileno", mrb_io_fileno, MRB_ARGS_NONE());
mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$/"), mrb_str_new_cstr(mrb, "\n"));
}
示例14: mrb_SQLite_Sqlite3Context_init
void mrb_SQLite_Sqlite3Context_init(mrb_state* mrb) {
static int initialized = 0;
if (initialized) return;
else initialized = 1;
/* MRUBY_BINDING: pre_class_definition */
/* sha: user_defined */
/* MRUBY_BINDING_END */
/* MRUBY_BINDING: Sqlite3Context::class_definition */
/* sha: 928b5f23e2bf714e656d6a536c89099098e41c7f5dd167e3acee29e7eb920d7b */
struct RClass* Sqlite3Context_class = mrb_define_class_under(mrb, SQLite_module(mrb), "Sqlite3Context", mrb->object_class);
MRB_SET_INSTANCE_TT(Sqlite3Context_class, MRB_TT_DATA);
/* MRUBY_BINDING_END */
/* MRUBY_BINDING: Sqlite3Context::pre_class_method_definitions */
/* sha: user_defined */
/* MRUBY_BINDING_END */
/* MRUBY_BINDING: Sqlite3Context::class_method_definitions */
/* sha: 4f9b865727d5035d391d88ededfb875cdae800908485348884b36a262239cd77 */
#if BIND_Sqlite3Context_INITIALIZE
mrb_define_method(mrb, Sqlite3Context_class, "initialize", mrb_SQLite_Sqlite3Context_initialize, MRB_ARGS_NONE());
#endif
/* MRUBY_BINDING_END */
/* MRUBY_BINDING: Sqlite3Context::post_class_definition */
/* sha: user_defined */
/* MRUBY_BINDING_END */
}
示例15: mrb_cp_arbiter_init
MRB_CP_EXTERN void
mrb_cp_arbiter_init(mrb_state* mrb, struct RClass* cp_module)
{
struct RClass* mrb_cp_arbiter_class = mrb_define_class_under(mrb, cp_module, "Arbiter", mrb->object_class);
MRB_SET_INSTANCE_TT(mrb_cp_arbiter_class, MRB_TT_DATA);
mrb_define_method(mrb, mrb_cp_arbiter_class, "restitution", arbiter_get_restitution, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "restitution=", arbiter_set_restitution, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "friction", arbiter_get_friction, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "friction=", arbiter_set_friction, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "surface_velocity", arbiter_get_surface_velocity, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "surface_velocity=", arbiter_set_surface_velocity, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "total_impulse", arbiter_total_impulse, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "total_ke", arbiter_total_ke, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "ignore", arbiter_ignore, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "shapes", arbiter_shapes, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "bodies", arbiter_bodies, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "contact_point_set", arbiter_get_contact_point_set, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "contact_point_set=", arbiter_set_contact_point_set, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "first_contact?", arbiter_is_first_contact, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "removal?", arbiter_is_removal, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "normal", arbiter_get_normal, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb_cp_arbiter_class, "point_a", arbiter_get_point_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "point_b", arbiter_get_point_b, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "depth", arbiter_get_depth, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_begin_a", arbiter_call_wildcard_begin_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_begin_b", arbiter_call_wildcard_begin_b, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_pre_solve_a", arbiter_call_wildcard_pre_solve_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_pre_solve_b", arbiter_call_wildcard_pre_solve_b, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_post_solve_a", arbiter_call_wildcard_post_solve_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_post_solve_b", arbiter_call_wildcard_post_solve_b, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_separate_a", arbiter_call_wildcard_separate_a, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb_cp_arbiter_class, "call_wildcard_separate_b", arbiter_call_wildcard_separate_b, MRB_ARGS_REQ(1));
}