本文整理汇总了C++中MRB_ARGS_NONE函数的典型用法代码示例。如果您正苦于以下问题:C++ MRB_ARGS_NONE函数的具体用法?C++ MRB_ARGS_NONE怎么用?C++ MRB_ARGS_NONE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MRB_ARGS_NONE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mrb_mruby_kernel_ext_gem_init
void
mrb_mruby_kernel_ext_gem_init(mrb_state *mrb)
{
struct RClass *krn = mrb->kernel_module;
mrb_define_module_function(mrb, krn, "fail", mrb_f_raise, MRB_ARGS_OPT(2));
mrb_define_method(mrb, krn, "__method__", mrb_f_method, MRB_ARGS_NONE());
mrb_define_module_function(mrb, krn, "String", mrb_f_string, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, krn, "Array", mrb_f_array, MRB_ARGS_REQ(1));
}
示例2: mrb_mruby_fiber_gem_init
void
mrb_mruby_fiber_gem_init(mrb_state* mrb)
{
struct RClass *c;
c = mrb_define_class(mrb, "Fiber", mrb->object_class);
MRB_SET_INSTANCE_TT(c, MRB_TT_FIBER);
mrb_define_method(mrb, c, "initialize", fiber_init, MRB_ARGS_NONE());
mrb_define_method(mrb, c, "resume", fiber_resume, MRB_ARGS_ANY());
mrb_define_method(mrb, c, "transfer", fiber_transfer, MRB_ARGS_ANY());
mrb_define_method(mrb, c, "alive?", fiber_alive_p, MRB_ARGS_NONE());
mrb_define_method(mrb, c, "==", fiber_eq, MRB_ARGS_REQ(1));
mrb_define_class_method(mrb, c, "yield", fiber_yield, MRB_ARGS_ANY());
mrb_define_class_method(mrb, c, "current", fiber_current, MRB_ARGS_NONE());
mrb_define_class(mrb, "FiberError", mrb->eStandardError_class);
}
示例3: mrb_UV_Sockaddr_init
void mrb_UV_Sockaddr_init(mrb_state* mrb) {
static int initialized = 0;
if (initialized) return;
else initialized = 1;
struct RClass* Sockaddr_class = mrb_define_class_under(mrb, UV_module(mrb), "Sockaddr", mrb->object_class);
MRB_SET_INSTANCE_TT(Sockaddr_class, MRB_TT_DATA);
mrb_define_method(mrb, Sockaddr_class, "initialize", mrb_UV_Sockaddr_initialize, MRB_ARGS_NONE());
}
示例4: mrb_mruby_numeric_ext_gem_init
void
mrb_mruby_numeric_ext_gem_init(mrb_state* mrb)
{
struct RClass *i = mrb_module_get(mrb, "Integral");
mrb_define_method(mrb, i, "chr", mrb_int_chr, MRB_ARGS_NONE());
mrb_define_method(mrb, i, "allbits?", mrb_int_allbits, MRB_ARGS_REQ(1));
mrb_define_method(mrb, i, "anybits?", mrb_int_anybits, MRB_ARGS_REQ(1));
mrb_define_method(mrb, i, "nobits?", mrb_int_nobits, MRB_ARGS_REQ(1));
}
示例5: mrb_UV_TCP_init
void mrb_UV_TCP_init(mrb_state* mrb) {
static int initialized = 0;
if (initialized) return;
else initialized = 1;
struct RClass* TCP_class = mrb_define_class_under(mrb, UV_module(mrb), "TCP", Stream_class(mrb));
MRB_SET_INSTANCE_TT(TCP_class, MRB_TT_DATA);
mrb_define_method(mrb, TCP_class, "initialize", mrb_UV_TCP_initialize, MRB_ARGS_NONE());
}
示例6: mrb_mruby_rtos_toppers_gem_init
void
mrb_mruby_rtos_toppers_gem_init(mrb_state *mrb)
{
struct RClass *rtos;
struct RClass *tsk;
mrb_value wmd;
mrb_value tmo;
/* RTOS module */
rtos = mrb_define_module(mrb, "RTOS");
/* RTOS api */
mrb_define_module_function(mrb, rtos, "delay", mrb_rtos_delay, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, rtos, "millis", mrb_rtos_millis, MRB_ARGS_NONE());
wmd = mrb_hash_new(mrb);
mrb_hash_set(mrb, wmd, mrb_symbol_value(mrb_intern_lit(mrb, "and")), mrb_fixnum_value(TWF_ANDW));
mrb_hash_set(mrb, wmd, mrb_symbol_value(mrb_intern_lit(mrb, "or")), mrb_fixnum_value(TWF_ORW));
mrb_mod_cv_set(mrb, rtos, mrb_intern_lit(mrb, "WAITMODE"), wmd);
tmo = mrb_hash_new(mrb);
mrb_hash_set(mrb, tmo, mrb_symbol_value(mrb_intern_lit(mrb, "polling")), mrb_fixnum_value(TMO_POL));
mrb_hash_set(mrb, tmo, mrb_symbol_value(mrb_intern_lit(mrb, "forever")), mrb_fixnum_value(TMO_FEVR));
mrb_mod_cv_set(mrb, rtos, mrb_intern_lit(mrb, "TIMEOUT"), tmo);
/* Task class */
tsk = mrb_define_class_under(mrb, rtos, "Task", mrb->object_class);
mrb_define_method(mrb, tsk, "initialize", mrb_task_init, MRB_ARGS_REQ(1));
mrb_define_method(mrb, tsk, "activate", mrb_task_activate, MRB_ARGS_NONE());
mrb_define_method(mrb, tsk, "suspend", mrb_task_suspend, MRB_ARGS_NONE());
mrb_define_method(mrb, tsk, "resume", mrb_task_resume, MRB_ARGS_NONE());
mrb_define_method(mrb, tsk, "terminate", mrb_task_terminate, MRB_ARGS_NONE());
/* EventFlag class */
mrb_rtos_flag_init(mrb, rtos);
/* MemoryPool, MemoryBuffer */
mrb_rtos_memory_init(mrb, rtos);
/* DataQueue */
mrb_rtos_dataqueue_init(mrb, rtos);
}
示例7: inputBindingInit
void inputBindingInit(mrb_state *mrb)
{
RClass *module = mrb_define_module(mrb, "Input");
mrb_define_module_function(mrb, module, "update", inputUpdate, MRB_ARGS_NONE());
mrb_define_module_function(mrb, module, "press?", inputPress, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, module, "trigger?", inputTrigger, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, module, "repeat?", inputRepeat, MRB_ARGS_REQ(1));
mrb_define_module_function(mrb, module, "dir4", inputDir4, MRB_ARGS_NONE());
mrb_define_module_function(mrb, module, "dir8", inputDir8, MRB_ARGS_NONE());
DEF_CONST_I("DOWN", Input::Down );
DEF_CONST_I("LEFT", Input::Left );
DEF_CONST_I("RIGHT", Input::Right);
DEF_CONST_I("UP", Input::Up );
DEF_CONST_I("A", Input::A );
DEF_CONST_I("B", Input::B );
DEF_CONST_I("C", Input::C );
DEF_CONST_I("X", Input::X );
DEF_CONST_I("Y", Input::Y );
DEF_CONST_I("Z", Input::Z );
DEF_CONST_I("L", Input::L );
DEF_CONST_I("R", Input::R );
DEF_CONST_I("SHIFT", Input::Shift);
DEF_CONST_I("CTRL", Input::Ctrl );
DEF_CONST_I("ALT", Input::Alt );
DEF_CONST_I("F5", Input::F5 );
DEF_CONST_I("F6", Input::F6 );
DEF_CONST_I("F7", Input::F7 );
DEF_CONST_I("F8", Input::F8 );
DEF_CONST_I("F9", Input::F9 );
mrb_define_module_function(mrb, module, "mouse_x", inputMouseX, MRB_ARGS_NONE());
mrb_define_module_function(mrb, module, "mouse_y", inputMouseY, MRB_ARGS_NONE());
DEF_CONST_I("MOUSELEFT", Input::MouseLeft );
DEF_CONST_I("MOUSEMIDDLE", Input::MouseMiddle);
DEF_CONST_I("MOUSERIGHT", Input::MouseRight );
}
示例8: mrb_mruby_mongo_gem_init
void mrb_mruby_mongo_gem_init(mrb_state* mrb) {
struct RClass *class_mongo = mrb_define_module(mrb, "Mongo");
struct RClass *class_mongo_bson = mrb_define_class_under(mrb, class_mongo, "Bson", mrb->object_class);
mrb_define_method(mrb, class_mongo_bson, "initialize", mrb_mongo_bson_init, MRB_ARGS_OPT(1));
mrb_define_method(mrb, class_mongo_bson, "to_json", mrb_mongo_to_json, MRB_ARGS_NONE());
struct RClass *class_mongo_client = mrb_define_class_under(mrb, class_mongo, "Client", mrb->object_class);
mrb_define_method(mrb, class_mongo_client, "initialize", mrb_mongo_client_init, MRB_ARGS_OPT(1));
mrb_define_method(mrb, class_mongo_client, "databases", mrb_mongo_client_databases, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_client, "[]", mrb_mongo_client_find_database, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_client, "address", mrb_mongo_client_get_address, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_client, "database_exists?", mrb_mongo_client_database_exists, MRB_ARGS_REQ(1));
struct RClass *class_mongo_database = mrb_define_class_under(mrb, class_mongo, "Database", mrb->object_class);
mrb_define_method(mrb, class_mongo_database, "initialize", mrb_mongo_database_init, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_mongo_database, "client", mrb_mongo_database_get_client, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_database, "collections", mrb_mongo_database_collections, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_database, "[]", mrb_mongo_database_find_collection, MRB_ARGS_REQ(1));
struct RClass *class_mongo_collection = mrb_define_class_under(mrb, class_mongo, "Collection", mrb->object_class);
mrb_define_method(mrb, class_mongo_collection, "initialize", mrb_mongo_collection_init, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_mongo_collection, "database", mrb_mongo_collection_get_database, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_collection, "count", mrb_mongo_collection_count, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_collection, "insert", mrb_mongo_collection_insert, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_collection, "drop", mrb_mongo_collection_drop, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_collection, "update", mrb_mongo_collection_update, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_mongo_collection, "where", mrb_mongo_collection_query, MRB_ARGS_OPT(1));
struct RClass *class_mongo_query = mrb_define_class_under(mrb, class_mongo, "Query", mrb->object_class);
mrb_define_method(mrb, class_mongo_query, "initialize", mrb_mongo_query_init, MRB_ARGS_REQ(2));
mrb_define_method(mrb, class_mongo_query, "sort", mrb_mongo_query_sort, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_query, "limit", mrb_mongo_query_limit, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_query, "skip", mrb_mongo_query_skip, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_query, "fields", mrb_mongo_query_fields, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_mongo_query, "count", mrb_mongo_query_count, MRB_ARGS_NONE());
mrb_define_method(mrb, class_mongo_query, "to_a", mrb_mongo_query_to_array, MRB_ARGS_NONE());
mongoc_init();
DONE;
}
示例9: mrb_init_proc
void
mrb_init_proc(mrb_state *mrb)
{
struct RProc *m;
mrb_irep *call_irep = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep));
static const mrb_irep mrb_irep_zero = { 0 };
mrbjit_code_info *cinfo;
int i;
if (call_irep == NULL)
return;
*call_irep = mrb_irep_zero;
call_irep->flags = MRB_ISEQ_NO_FREE;
call_irep->iseq = call_iseq;
call_irep->ilen = 2;
call_irep->jit_entry_tab = (mrbjit_codetab *)mrb_calloc(mrb, 2, sizeof(mrbjit_codetab));
for (i = 0; i < 2; i++) {
call_irep->jit_entry_tab[i].size = 16;
cinfo = (mrbjit_code_info *)mrb_calloc(mrb, 16, sizeof(mrbjit_code_info));
call_irep->jit_entry_tab[i].body = cinfo;
}
call_irep->prof_info = (int *)mrb_calloc(mrb, 2, sizeof(int));
call_irep->method_kind = NORMAL;
call_irep->jit_top_entry = NULL;
call_irep->simple_lambda = 1;
call_irep->proc_obj = NULL;
mrb->proc_class = mrb_define_class(mrb, "Proc", mrb->object_class);
MRB_SET_INSTANCE_TT(mrb->proc_class, MRB_TT_PROC);
mrb_define_method(mrb, mrb->proc_class, "initialize", mrb_proc_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, mrb->proc_class, "initialize_copy", mrb_proc_init_copy, MRB_ARGS_REQ(1));
mrb_define_method(mrb, mrb->proc_class, "arity", mrb_proc_arity, MRB_ARGS_NONE());
m = mrb_proc_new(mrb, call_irep);
mrb_define_method_raw(mrb, mrb->proc_class, mrb_intern_lit(mrb, "call"), m);
mrb_define_method_raw(mrb, mrb->proc_class, mrb_intern_lit(mrb, "[]"), m);
mrb_define_class_method(mrb, mrb->kernel_module, "lambda", proc_lambda, MRB_ARGS_NONE()); /* 15.3.1.2.6 */
mrb_define_method(mrb, mrb->kernel_module, "lambda", proc_lambda, MRB_ARGS_NONE()); /* 15.3.1.3.27 */
}
示例10: mrb_init_exception
void
mrb_init_exception(mrb_state *mrb)
{
struct RClass *e;
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, MRB_ARGS_ANY());
mrb_define_method(mrb, e, "exception", exc_exception, MRB_ARGS_ANY());
mrb_define_method(mrb, e, "initialize", exc_initialize, MRB_ARGS_ANY());
mrb_define_method(mrb, e, "==", exc_equal, MRB_ARGS_REQ(1));
mrb_define_method(mrb, e, "to_s", exc_to_s, MRB_ARGS_NONE());
mrb_define_method(mrb, e, "message", exc_message, MRB_ARGS_NONE());
mrb_define_method(mrb, e, "inspect", exc_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, e, "backtrace", mrb_get_backtrace, MRB_ARGS_NONE());
mrb->eStandardError_class = mrb_define_class(mrb, "StandardError", mrb->eException_class); /* 15.2.23 */
mrb_define_class(mrb, "RuntimeError", mrb->eStandardError_class); /* 15.2.28 */
e = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
mrb_define_class(mrb, "SyntaxError", e); /* 15.2.38 */
}
示例11: mrb_mruby_rs_serial_gem_init
void
mrb_mruby_rs_serial_gem_init(mrb_state* mrb) {
struct RClass *serial;
serial = mrb_define_class(mrb, "Serial", mrb->object_class);
/* methods */
mrb_define_method(mrb, serial, "initialize", mrb_rs_serial_initialize, MRB_ARGS_NONE());
mrb_define_method(mrb, serial, "write", mrb_rs_serial_write, MRB_ARGS_REQ(1));
mrb_define_method(mrb, serial, "puts", mrb_rs_serial_puts, MRB_ARGS_REQ(1));
}
示例12: mruby_allegro_config_init
void
mruby_allegro_config_init(mrb_state *mrb)
{
struct RClass *am = M_ALLEGRO;
struct RClass *cc = mrb_define_class_under(mrb, am, "Config", mrb->object_class);
MRB_SET_INSTANCE_TT(cc, MRB_TT_DATA);
mrb_define_class_method(mrb, cc, "create", config_create, MRB_ARGS_NONE());
mrb_define_alias(mrb, cc->c, "new", "create");
mrb_define_method(mrb, cc, "destroy", config_destroy, MRB_ARGS_NONE());
mrb_define_method(mrb, cc, "destroyed?", config_destroyed, MRB_ARGS_NONE());
mrb_define_class_method(mrb, cc, "load_file", config_load_file, MRB_ARGS_REQ(1));
mrb_define_method(mrb, cc, "save_file", config_save_file, MRB_ARGS_REQ(1));
mrb_define_method(mrb, cc, "add_section", config_add_section, MRB_ARGS_REQ(1));
mrb_define_method(mrb, cc, "add_comment", config_add_comment, MRB_ARGS_REQ(2));
mrb_define_method(mrb, cc, "get_value", config_get_value, MRB_ARGS_REQ(2));
mrb_define_method(mrb, cc, "set_value", config_set_value, MRB_ARGS_REQ(3));
mrb_define_method(mrb, cc, "merge", config_merge, MRB_ARGS_REQ(1));
mrb_define_method(mrb, cc, "merge_into", config_merge_into, MRB_ARGS_REQ(1));
mrb_define_alias(mrb, cc, "merge!", "merge_into");
}
示例13: mrb_mruby_error_gem_test
void
mrb_mruby_error_gem_test(mrb_state *mrb)
{
struct RClass *cls;
cls = mrb_define_class(mrb, "ExceptionTest", mrb->object_class);
mrb_define_module_function(mrb, cls, "mrb_protect", run_protect, MRB_ARGS_NONE() | MRB_ARGS_BLOCK());
mrb_define_module_function(mrb, cls, "mrb_ensure", run_ensure, MRB_ARGS_REQ(2));
mrb_define_module_function(mrb, cls, "mrb_rescue", run_rescue, MRB_ARGS_REQ(2));
mrb_define_module_function(mrb, cls, "mrb_rescue_exceptions", run_rescue_exceptions, MRB_ARGS_REQ(2));
}
示例14: mrb_mruby_uv_gem_init_dl
void
mrb_mruby_uv_gem_init_dl(mrb_state *mrb, struct RClass *UV)
{
struct RClass *class_uv_dl;
class_uv_dl = mrb_define_class_under(mrb, UV, "DL", mrb->object_class);
MRB_SET_INSTANCE_TT(class_uv_dl, MRB_TT_DATA);
mrb_define_method(mrb, class_uv_dl, "initialize", mrb_f_uv_dlopen, MRB_ARGS_REQ(1));
mrb_define_method(mrb, class_uv_dl, "close", mrb_f_uv_dlclose, MRB_ARGS_NONE());
mrb_define_method(mrb, class_uv_dl, "sym", mrb_f_uv_dlsym, MRB_ARGS_REQ(1));
}
示例15: grn_ctx_impl_mrb_init_bindings
static void
grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx)
{
mrb_state *mrb = ctx->impl->mrb.state;
mrb->ud = ctx;
ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga");
mrb_define_class_method(mrb, ctx->impl->mrb.module,
"init", mrb_groonga_init, MRB_ARGS_NONE());
mrb_funcall(mrb, mrb_obj_value(ctx->impl->mrb.module), "init", 0);
}