本文整理汇总了C++中ARGS_ANY函数的典型用法代码示例。如果您正苦于以下问题:C++ ARGS_ANY函数的具体用法?C++ ARGS_ANY怎么用?C++ ARGS_ANY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARGS_ANY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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_class_get(mrb, "Enumerable")); /* 15.2.20.3 */
mrb_define_class_method(mrb, io, "_popen", mrb_io_s_popen, ARGS_ANY());
mrb_define_class_method(mrb, io, "for_fd", mrb_io_s_for_fd, ARGS_REQ(1)|ARGS_OPT(2));
mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, ARGS_ANY());
mrb_define_method(mrb, io, "_bless", mrb_io_bless, ARGS_NONE());
mrb_define_method(mrb, io, "initialize", mrb_io_initialize, ARGS_ANY()); /* 15.2.20.5.21 (x)*/
mrb_define_method(mrb, io, "sysread", mrb_io_sysread, ARGS_ANY());
mrb_define_method(mrb, io, "sysseek", mrb_io_sysseek, ARGS_REQ(1));
mrb_define_method(mrb, io, "syswrite", mrb_io_syswrite, ARGS_REQ(1));
mrb_define_method(mrb, io, "close", mrb_io_close, ARGS_NONE()); /* 15.2.20.5.1 */
mrb_define_method(mrb, io, "closed?", mrb_io_closed, ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "pid", mrb_io_pid, ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "fileno", mrb_io_fileno, ARGS_NONE());
mrb_gv_set(mrb, mrb_intern(mrb, "$/"), mrb_str_new_cstr(mrb, "\n"));
}
示例2: mrb_mruby_random_gem_init
void mrb_mruby_random_gem_init(mrb_state *mrb)
{
struct RClass *random;
random = mrb_define_module(mrb, "Random");
mrb_define_class_method(mrb, random, "rand", mrb_random_rand, ARGS_ANY());
mrb_define_class_method(mrb, random, "srand", mrb_random_srand, ARGS_ANY());
}
示例3: mrb_init_exception
void
mrb_init_exception(mrb_state *mrb)
{
struct RClass *e;
struct RClass *eTypeError_class;
struct RClass *eArgumentError_class;
struct RClass *eIndexError_class;
struct RClass *eRangeError_class;
struct RClass *eNameError_class;
struct RClass *eNoMethodError_class;
struct RClass *eScriptError_class;
struct RClass *eSyntaxError_class;
struct RClass *eLoadError_class;
struct RClass *eSystemCallError_class;
struct RClass *eLocalJumpError_class;
struct RClass *eRegexpError_class;
struct RClass *eZeroDivisionError_class;
struct RClass *eEncodingError_class;
struct RClass *eNotImpError_class;
struct RClass *eFloatDomainError_class;
struct RClass *eKeyError_class;
mrb->eException_class = e = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
mrb_define_class_method(mrb, e, "exception", mrb_instance_new, ARGS_ANY());
mrb_define_method(mrb, e, "exception", exc_exception, ARGS_ANY());
mrb_define_method(mrb, e, "initialize", exc_initialize, ARGS_ANY());
mrb_define_method(mrb, e, "==", exc_equal, ARGS_REQ(1));
mrb_define_method(mrb, e, "to_s", exc_to_s, ARGS_NONE());
mrb_define_method(mrb, e, "message", exc_message, ARGS_NONE());
mrb_define_method(mrb, e, "inspect", exc_inspect, ARGS_NONE());
mrb->eStandardError_class = mrb_define_class(mrb, "StandardError", mrb->eException_class); /* 15.2.23 */
mrb->eRuntimeError_class = mrb_define_class(mrb, "RuntimeError", mrb->eStandardError_class); /* 15.2.28 */
eTypeError_class = mrb_define_class(mrb, "TypeError", mrb->eStandardError_class); /* 15.2.29 */
eArgumentError_class = mrb_define_class(mrb, "ArgumentError", mrb->eStandardError_class); /* 15.2.24 */
eIndexError_class = mrb_define_class(mrb, "IndexError", mrb->eStandardError_class); /* 15.2.33 */
eRangeError_class = mrb_define_class(mrb, "RangeError", mrb->eStandardError_class); /* 15.2.26 */
eNameError_class = mrb_define_class(mrb, "NameError", mrb->eStandardError_class); /* 15.2.31 */
eNoMethodError_class = mrb_define_class(mrb, "NoMethodError", eNameError_class); /* 15.2.32 */
eScriptError_class = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
eSyntaxError_class = mrb_define_class(mrb, "SyntaxError", eScriptError_class); /* 15.2.38 */
eLoadError_class = mrb_define_class(mrb, "LoadError", eScriptError_class); /* 15.2.39 */
eSystemCallError_class = mrb_define_class(mrb, "SystemCallError", mrb->eStandardError_class); /* 15.2.36 */
eLocalJumpError_class = mrb_define_class(mrb, "LocalJumpError", mrb->eStandardError_class); /* 15.2.25 */
eRegexpError_class = mrb_define_class(mrb, "RegexpError", mrb->eStandardError_class); /* 15.2.27 */
eZeroDivisionError_class = mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
eEncodingError_class = mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
eNotImpError_class = mrb_define_class(mrb, "NotImplementedError", eScriptError_class);
eFloatDomainError_class = mrb_define_class(mrb, "FloatDomainError", eRangeError_class);
eKeyError_class = mrb_define_class(mrb, "KeyError", eIndexError_class);
}
示例4: make_struct
static mrb_value
make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * klass)
{
mrb_value nstr, *ptr_members;
mrb_sym id;
long i, len;
struct RClass *c;
//OBJ_FREEZE(members);
if (mrb_nil_p(name)) {
c = mrb_class_new(mrb, klass);
//mrb_make_metaclass(nstr, RBASIC(klass)->c);
//mrb_class_inherited(klass, nstr);
}
else {
/* old style: should we warn? */
name = mrb_str_to_str(mrb, name);
id = mrb_to_id(mrb, name);
if (!mrb_is_const_id(id)) {
//mrb_name_error(id, "identifier %s needs to be constant", StringValuePtr(name));
mrb_name_error(mrb, id, "identifier %s needs to be constant", mrb_string_value_ptr(mrb, name));
}
if (mrb_const_defined_at(mrb, klass, id)) {
//mrb_warn("redefining constant Struct::%s", StringValuePtr(name));
mrb_warn("redefining constant Struct::%s", mrb_string_value_ptr(mrb, 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_STRUCT);
nstr = mrb_obj_value(c);
mrb_iv_set(mrb, nstr, mrb_intern(mrb, "__members__"), members);
mrb_define_class_method(mrb, c, "new", mrb_class_new_instance_m, ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_class_new_instance_m, ARGS_ANY());
mrb_define_class_method(mrb, c, "members", mrb_struct_s_members_m, ARGS_NONE());
//RSTRUCT(nstr)->basic.c->super = c->c;
ptr_members = RARRAY_PTR(members);
len = RARRAY_LEN(members);
for (i=0; i< len; i++) {
mrb_sym id = SYM2ID(ptr_members[i]);
if (mrb_is_local_id(id) || mrb_is_const_id(id)) {
if (i < N_REF_FUNC) {
mrb_define_method_id(mrb, c, id, (mrb_func_t)ref_func[i], 0);
}
else {
mrb_define_method_id(mrb, c, id, mrb_struct_ref, 0);
}
mrb_define_method_id(mrb, c, mrb_id_attrset(id), (mrb_func_t)mrb_struct_set, 1);
}
}
return nstr;
}
示例5: mrb_init_class
void
mrb_init_class(mrb_state *mrb)
{
struct RClass *bob; /* BasicObject */
struct RClass *obj; /* Object */
struct RClass *mod; /* Module */
struct RClass *cls; /* Class */
//struct RClass *krn; /* Kernel */
/* boot class hierarchy */
bob = boot_defclass(mrb, 0);
obj = boot_defclass(mrb, bob); mrb->object_class = obj;
mod = boot_defclass(mrb, obj); mrb->module_class = mod;/* obj -> mod */
cls = boot_defclass(mrb, mod); mrb->class_class = cls; /* obj -> cls */
/* fix-up loose ends */
bob->c = obj->c = mod->c = cls->c = cls;
make_metaclass(mrb, bob);
make_metaclass(mrb, obj);
make_metaclass(mrb, mod);
make_metaclass(mrb, cls);
/* name basic classes */
mrb_define_const(mrb, obj, "BasicObject", mrb_obj_value(bob));
mrb_define_const(mrb, obj, "Object", mrb_obj_value(obj));
mrb_define_const(mrb, obj, "Module", mrb_obj_value(mod));
mrb_define_const(mrb, obj, "Class", mrb_obj_value(cls));
/* name each classes */
mrb_name_class(mrb, bob, mrb_intern(mrb, "BasicObject"));
mrb_name_class(mrb, obj, mrb_intern(mrb, "Object"));
mrb_name_class(mrb, mod, mrb_intern(mrb, "Module"));
mrb_name_class(mrb, cls, mrb_intern(mrb, "Class"));
mrb_undef_method(mrb, mod, "new");
MRB_SET_INSTANCE_TT(cls, MRB_TT_CLASS);
mrb_define_method(mrb, bob, "initialize", mrb_bob_init, ARGS_NONE());
mrb_define_method(mrb, bob, "!", mrb_bob_not, ARGS_NONE());
mrb_define_method(mrb, bob, "method_missing", mrb_bob_missing, ARGS_ANY()); /* 15.3.1.3.30 */
mrb_define_class_method(mrb, cls, "new", mrb_class_new_class, ARGS_ANY());
mrb_define_method(mrb, cls, "superclass", mrb_class_superclass, ARGS_NONE()); /* 15.2.3.3.4 */
mrb_define_method(mrb, cls, "new", mrb_instance_new, ARGS_ANY()); /* 15.2.3.3.3 */
mrb_define_method(mrb, cls, "inherited", mrb_bob_init, ARGS_REQ(1));
mrb_define_method(mrb, mod, "include", mrb_mod_include, ARGS_REQ(1)); /* 15.2.2.4.27 */
mrb_define_method(mrb, mod, "to_s", mrb_mod_to_s, ARGS_NONE());
mrb_define_method(mrb, mod, "alias_method", mrb_mod_alias, ARGS_ANY()); /* 15.2.2.4.8 */
mrb_define_method(mrb, mod, "undef_method", mrb_mod_undef, ARGS_ANY()); /* 15.2.2.4.41 */
mrb_define_method(mrb, mod, "const_defined?", mrb_mod_const_defined, ARGS_REQ(1)); /* 15.2.2.4.20 */
mrb_define_method(mrb, mod, "const_get", mrb_mod_const_get, ARGS_REQ(1)); /* 15.2.2.4.21 */
mrb_define_method(mrb, mod, "const_set", mrb_mod_const_set, ARGS_REQ(2)); /* 15.2.2.4.23 */
mrb_define_method(mrb, mod, "define_method", mod_define_method, ARGS_REQ(1));
mrb_define_method(mrb, mod, "===", mrb_mod_eqq, ARGS_REQ(1));
}
示例6: ap_mruby_env_init
void ap_mruby_env_init(mrb_state *mrb, struct RClass *class_core)
{
struct RClass *class_env;
int ai = mrb_gc_arena_save(mrb);
class_env = mrb_define_class_under(mrb, class_core, "Env", mrb->object_class);
mrb_define_method(mrb, class_env, "initialize", ap_mrb_init_env, ARGS_NONE());
mrb_define_method(mrb, class_env, "[]=", ap_mrb_set_env, ARGS_ANY());
mrb_define_method(mrb, class_env, "[]", ap_mrb_get_env, ARGS_ANY());
mrb_define_method(mrb, class_env, "all", ap_mrb_get_env_hash, ARGS_NONE());
mrb_gc_arena_restore(mrb, ai);
}
示例7: ap_mruby_class_init
static int ap_mruby_class_init(mrb_state *mrb)
{
struct RClass *class;
struct RClass *class_manager;
class = mrb_define_module(mrb, "Resource");
class_manager = mrb_define_class_under(mrb, class, "Manager", mrb->object_class);
mrb_define_method(mrb, class_manager, "cpurate=", ap_mrb_set_cpurate, ARGS_ANY());
mrb_define_method(mrb, class_manager, "cpurate", ap_mrb_get_cpurate, ARGS_NONE());
mrb_define_method(mrb, class_manager, "filename=", ap_mrb_set_request_filename, ARGS_ANY());
mrb_define_method(mrb, class_manager, "filename", ap_mrb_get_request_filename, ARGS_NONE());
return OK;
}
示例8: make_struct
static mrb_value
make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * klass)
{
mrb_value nstr, *ptr_members;
mrb_sym id;
mrb_int i, len;
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_to_id(mrb, name);
if (!mrb_is_const_id(id)) {
mrb_raisef(mrb, E_NAME_ERROR, "identifier %s needs to be constant", mrb_string_value_ptr(mrb, name));
}
if (mrb_const_defined_at(mrb, klass, id)) {
mrb_warn("redefining constant Struct::%s", mrb_string_value_ptr(mrb, 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_intern2(mrb, "__members__", 11), members);
mrb_define_class_method(mrb, c, "new", mrb_instance_new, ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_instance_new, ARGS_ANY());
mrb_define_class_method(mrb, c, "members", mrb_struct_s_members_m, ARGS_NONE());
//RSTRUCT(nstr)->basic.c->super = c->c;
ptr_members = RARRAY_PTR(members);
len = RARRAY_LEN(members);
for (i=0; i< len; i++) {
mrb_sym id = mrb_symbol(ptr_members[i]);
if (mrb_is_local_id(id) || mrb_is_const_id(id)) {
if (i < N_REF_FUNC) {
mrb_define_method_id(mrb, c, id, ref_func[i], ARGS_NONE());
}
else {
mrb_define_method_id(mrb, c, id, mrb_struct_ref, ARGS_NONE());
}
mrb_define_method_id(mrb, c, mrb_id_attrset(mrb, id), mrb_struct_set_m, ARGS_REQ(1));
}
}
return nstr;
}
示例9: mrb_init_range
void
mrb_init_range(mrb_state *mrb)
{
struct RClass *r;
r = mrb_define_class(mrb, "Range", mrb->object_class);
MRB_SET_INSTANCE_TT(r, MRB_TT_RANGE);
mrb_include_module(mrb, r, mrb_class_get(mrb, "Enumerable"));
mrb_define_method(mrb, r, "begin", mrb_range_beg, ARGS_NONE()); /* 15.2.14.4.3 */
mrb_define_method(mrb, r, "end", mrb_range_end, ARGS_NONE()); /* 15.2.14.4.5 */
mrb_define_method(mrb, r, "==", mrb_range_eq, ARGS_REQ(1)); /* 15.2.14.4.1 */
mrb_define_method(mrb, r, "===", mrb_range_include, ARGS_REQ(1)); /* 15.2.14.4.2 */
mrb_define_method(mrb, r, "each", mrb_range_each, ARGS_NONE()); /* 15.2.14.4.4 */
mrb_define_method(mrb, r, "exclude_end?", mrb_range_excl, ARGS_NONE()); /* 15.2.14.4.6 */
mrb_define_method(mrb, r, "first", mrb_range_beg, ARGS_NONE()); /* 15.2.14.4.7 */
mrb_define_method(mrb, r, "include?", mrb_range_include, ARGS_REQ(1)); /* 15.2.14.4.8 */
mrb_define_method(mrb, r, "initialize", mrb_range_initialize, ARGS_ANY()); /* 15.2.14.4.9 */
mrb_define_method(mrb, r, "last", mrb_range_end, ARGS_NONE()); /* 15.2.14.4.10 */
mrb_define_method(mrb, r, "member?", mrb_range_include, ARGS_REQ(1)); /* 15.2.14.4.11 */
mrb_define_method(mrb, r, "to_s", range_to_s, ARGS_NONE()); /* 15.2.14.4.12(x) */
mrb_define_method(mrb, r, "inspect", range_inspect, ARGS_NONE()); /* 15.2.14.4.13(x) */
mrb_define_method(mrb, r, "eql?", range_eql, ARGS_REQ(1)); /* 15.2.14.4.14(x) */
mrb_define_method(mrb, r, "initialize_copy", range_initialize_copy, ARGS_REQ(1)); /* 15.2.14.4.15(x) */
}
示例10: ap_mruby_server_init
void ap_mruby_server_init(mrb_state *mrb, struct RClass *class_core)
{
struct RClass *class_server;
class_server = mrb_define_class_under(mrb, class_core, "Server", mrb->object_class);
mrb_define_method(mrb, class_server, "error_fname=", ap_mrb_set_server_error_fname, ARGS_ANY());
mrb_define_method(mrb, class_server, "error_fname", ap_mrb_get_server_error_fname, ARGS_NONE());
mrb_define_method(mrb, class_server, "document_root", ap_mrb_get_server_document_root, ARGS_NONE());
mrb_define_method(mrb, class_server, "loglevel=", ap_mrb_set_server_loglevel, ARGS_ANY());
mrb_define_method(mrb, class_server, "loglevel", ap_mrb_get_server_loglevel, ARGS_NONE());
mrb_define_method(mrb, class_server, "hostname", ap_mrb_get_server_hostname, ARGS_NONE());
mrb_define_method(mrb, class_server, "path", ap_mrb_get_server_path, ARGS_NONE());
mrb_define_method(mrb, class_server, "admin", ap_mrb_get_server_admin, ARGS_NONE());
mrb_define_method(mrb, class_server, "scheme", ap_mrb_get_server_scheme, ARGS_NONE());
mrb_define_method(mrb, class_server, "defn_name", ap_mrb_get_server_defn_name, ARGS_NONE());
mrb_define_method(mrb, class_server, "is_virtual", ap_mrb_get_server_is_virtual, ARGS_NONE());
mrb_define_method(mrb, class_server, "keep_alive_max", ap_mrb_get_server_keep_alive_max, ARGS_NONE());
mrb_define_method(mrb, class_server, "keep_alive", ap_mrb_get_server_keep_alive, ARGS_NONE());
mrb_define_method(mrb, class_server, "pathlen", ap_mrb_get_server_pathlen, ARGS_NONE());
mrb_define_method(mrb, class_server, "limit_req_line", ap_mrb_get_server_limit_req_line, ARGS_NONE());
mrb_define_method(mrb, class_server, "limit_req_fieldsize", ap_mrb_get_server_limit_req_fieldsize, ARGS_NONE());
mrb_define_method(mrb, class_server, "limit_req_fields", ap_mrb_get_server_limit_req_fields, ARGS_NONE());
mrb_define_method(mrb, class_server, "timeout", ap_mrb_get_server_timeout, ARGS_NONE());
mrb_define_method(mrb, class_server, "keep_alive_timeout", ap_mrb_get_server_keep_alive_timeout, ARGS_NONE());
mrb_define_method(mrb, class_server, "port", ap_mrb_get_server_port, ARGS_NONE());
mrb_define_method(mrb, class_server, "defn_line_number", ap_mrb_get_server_defn_line_number, ARGS_NONE());
}
示例11: mrb_init_uefi_pointer
void
mrb_init_uefi_pointer(mrb_state *mrb, struct RClass *mrb_uefi)
{
struct RClass *p_cls;
p_cls = mrb_define_class_under(mrb, mrb_uefi, "Pointer", mrb->object_class);
MRB_SET_INSTANCE_TT(p_cls, MRB_TT_DATA);
mrb_include_module(mrb, p_cls, mrb_class_get(mrb, "Comparable"));
mrb_define_method(mrb, p_cls, "initialize", mrb_uefi_pointer_initialize, ARGS_ANY());
mrb_define_method(mrb, p_cls, "initialize_copy", mrb_uefi_pointer_initialize_copy, ARGS_REQ(1));
mrb_define_method(mrb, p_cls, "<=>", mrb_uefi_pointer_cmp, ARGS_REQ(1));
mrb_define_method(mrb, p_cls, "to_s", mrb_uefi_pointer_to_s, ARGS_NONE());
mrb_define_method(mrb, p_cls, "inspect", mrb_uefi_pointer_inspect, ARGS_NONE());
mrb_define_method(mrb, p_cls, "value", mrb_uefi_pointer_value, ARGS_NONE());
mrb_define_method(mrb, p_cls, "to_i", mrb_uefi_pointer_to_i, ARGS_NONE());
mrb_define_method(mrb, p_cls, "+", mrb_uefi_pointer_plus, ARGS_REQ(1));
mrb_define_method(mrb, p_cls, "-", mrb_uefi_pointer_minus, ARGS_REQ(1));
mrb_define_method(mrb, p_cls, "read", mrb_uefi_pointer_read, ARGS_REQ(1));
mrb_define_method(mrb, p_cls, "write", mrb_uefi_pointer_write, ARGS_REQ(1));
mrb_const_set(mrb, mrb_obj_value(p_cls), mrb_intern(mrb, "NULL"),
mrb_uefi_pointer_make_helper(mrb, p_cls, NULL));
}
示例12: mrb_mruby_pcap_gem_init
void
mrb_mruby_pcap_gem_init(mrb_state *mrb)
{
struct RClass *pcap, *capt;
pcap = mrb_define_module(mrb, "Pcap");
mrb_define_module_function(mrb, pcap, "lookupdev", mrb_pcap_s_lookupdev, ARGS_NONE());
mrb_define_module_function(mrb, pcap, "lookupnet", pcap_s_lookupnet,
ARGS_REQ(1));
mrb_define_const(mrb, pcap, "DLT_NULL", mrb_fixnum_value(DLT_NULL));
mrb_define_const(mrb, pcap, "DLT_EN10MB", mrb_fixnum_value(DLT_EN10MB));
mrb_define_const(mrb, pcap, "DLT_PPP", mrb_fixnum_value(DLT_PPP));
#ifdef DLT_RAW
mrb_define_const(mrb, pcap, "DLT_RAW", mrb_fixnum_value(DLT_RAW));
#endif
capt = mrb_define_class_under(mrb, pcap, "Capture", mrb->object_class);
mrb_define_singleton_method(mrb, (struct RObject*)capt, "open_live", mrb_capture_open_live, MRB_ARGS_ARG(1, 3));
mrb_define_method(mrb, capt, "capture", capture, ARGS_NONE());
mrb_define_method(mrb, capt, "close", capture_close, ARGS_NONE());
mrb_define_method(mrb, capt, "datalink", capture_datalink, ARGS_NONE());
mrb_define_method(mrb, capt, "inject", mrb_capture_inject, MRB_ARGS_REQ(1));
mrb_define_method(mrb, capt, "setfilter", capture_setfilter, ARGS_ANY());
}
示例13: mrb_mruby_sleep_gem_init
void mrb_mruby_sleep_gem_init(mrb_state *mrb)
{
struct RClass *sleep;
sleep = mrb_define_module(mrb, "Sleep");
mrb_define_class_method(mrb, sleep, "sleep", mrb_f_sleep, ARGS_ANY());
}
示例14: mrb_mruby_opencv_highgui_init
void
mrb_mruby_opencv_highgui_init(mrb_state* mrb, struct RClass *class_cv) {
mrb_define_class_method(mrb, class_cv, "imshow", mrb_mruby_opencv_imshow, ARGS_OPT(2));
mrb_define_class_method(mrb, class_cv, "namedWindow", mrb_mruby_opencv_namedWindow, ARGS_ANY());
mrb_define_class_method(mrb, class_cv, "waitKey", mrb_mruby_opencv_waitKey, ARGS_ANY());
mrb_define_class_method(mrb, class_cv, "imread", mrb_mruby_opencv_imread, ARGS_OPT(1));
}
示例15: init_cfunc_pointer
void
init_cfunc_pointer(mrb_state *mrb, struct RClass* module)
{
struct RClass *pointer_class = mrb_define_class_under(mrb, module, "Pointer", mrb_ud(mrb)->cfunc_type_class);
mrb_value ffi_type = mrb_obj_value(Data_Wrap_Struct(mrb, mrb->object_class, &cfunc_pointer_ffi_data_type, &pointer_mrb_ffi_type));
mrb_obj_iv_set(mrb, (struct RObject*)pointer_class, mrb_intern(mrb, "ffi_type"), ffi_type);
mrb_ud(mrb)->cfunc_pointer_class = pointer_class;
mrb_define_class_method(mrb, pointer_class, "refer", cfunc_pointer_refer, ARGS_REQ(1));
mrb_define_class_method(mrb, pointer_class, "malloc", cfunc_pointer_class_malloc, ARGS_REQ(1));
mrb_define_method(mrb, pointer_class, "initialize", cfunc_pointer_initialize, ARGS_ANY());
mrb_define_method(mrb, pointer_class, "realloc", cfunc_pointer_realloc, ARGS_REQ(1));
mrb_define_method(mrb, pointer_class, "free", cfunc_pointer_free, ARGS_NONE());
mrb_define_method(mrb, pointer_class, "inspect", cfunc_pointer_inspect, ARGS_NONE());
mrb_define_method(mrb, pointer_class, "is_null?", cfunc_pointer_is_null, ARGS_NONE());
mrb_define_method(mrb, pointer_class, "autofree", cfunc_pointer_autofree, ARGS_NONE());
mrb_define_method(mrb, pointer_class, "offset", cfunc_pointer_offset, ARGS_REQ(1));
mrb_define_method(mrb, pointer_class, "to_s", cfunc_pointer_to_s, ARGS_NONE());
// add method to system classes
mrb_define_method(mrb, mrb->string_class, "to_pointer", cfunc_string_to_pointer, ARGS_NONE());
mrb_obj_iv_set(mrb, (struct RObject *)mrb->string_class, mrb_intern(mrb, "ffi_type"), ffi_type);
}