• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MRB_ARGS_NONE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了MRB_ARGS_NONE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:sadasant,项目名称:mruby,代码行数:10,代码来源:kernel.c


示例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);
}
开发者ID:Hiroyuki-Matsuzaki,项目名称:mruby,代码行数:19,代码来源:fiber.c


示例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());
}
开发者ID:jbreeden,项目名称:mruby-libuv,代码行数:10,代码来源:mruby_sockaddr.c


示例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));
}
开发者ID:IceDragon200,项目名称:mruby,代码行数:10,代码来源:numeric_ext.c


示例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());
}
开发者ID:jbreeden,项目名称:mruby-libuv,代码行数:10,代码来源:mruby_uv_tcp_t.c


示例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);
}
开发者ID:mimaki,项目名称:mruby-rtos-toppers,代码行数:43,代码来源:rtos.c


示例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 );
}
开发者ID:cjv123,项目名称:RPG,代码行数:42,代码来源:input-binding.cpp


示例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;
}
开发者ID:gitter-badger,项目名称:mruby-mongo,代码行数:42,代码来源:mrb_mongo.c


示例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 */
}
开发者ID:herumi,项目名称:mruby,代码行数:42,代码来源:proc.c


示例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 */
}
开发者ID:Bovi-Li,项目名称:mruby,代码行数:20,代码来源:error.c


示例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));

}
开发者ID:yamanekko,项目名称:mruby-rs-robot,代码行数:11,代码来源:rs_serial.c


示例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");
}
开发者ID:cremno,项目名称:mruby-allegro,代码行数:20,代码来源:config.c


示例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));
}
开发者ID:ASnow,项目名称:mruby,代码行数:11,代码来源:exception.c


示例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));
}
开发者ID:mattn,项目名称:mruby-uv,代码行数:11,代码来源:dl.c


示例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);
}
开发者ID:tSU-RooT,项目名称:groonga,代码行数:11,代码来源:ctx_impl_mrb.c


示例16: mrb_init_exception

void mrb_init_exception(mrb_state *mrb)
{
    RClass *e;

    e = mrb->eException_class = &mrb->define_class("Exception", mrb->object_class);        /* 15.2.22 */
    e->define_class_method("exception", mrb_instance_new, MRB_ARGS_ANY())
            .define_method("exception", exc_exception, MRB_ARGS_ANY())
            .define_method("initialize", exc_initialize, MRB_ARGS_ANY())
            .define_method("==", exc_equal, MRB_ARGS_REQ(1))
            .define_method("to_s", exc_to_s, MRB_ARGS_NONE())
            .define_method("message", exc_message, MRB_ARGS_NONE())
            .define_method("inspect", exc_inspect, MRB_ARGS_NONE())
            .define_method("backtrace", mrb_exc_backtrace, MRB_ARGS_NONE())
            .fin();

    mrb->eStandardError_class = &mrb->define_class("StandardError",       mrb->eException_class);       /* 15.2.23 */
    mrb->define_class("RuntimeError", mrb->eStandardError_class);                                       /* 15.2.28 */
    e = &mrb->define_class("ScriptError",  mrb->eException_class);                                    /* 15.2.37 */
    mrb->define_class("SyntaxError",  e);                                                           /* 15.2.38 */
}
开发者ID:Prashant-Jonny,项目名称:red_tint,代码行数:20,代码来源:error.cpp


示例17: mrb_magnetic_init

void
mrb_magnetic_init(mrb_state* mrb)
{
  struct RClass *platform;
  struct RClass *magnetic;

  platform = mrb_class_get(mrb, "Platform");
  magnetic = mrb_define_class_under(mrb, platform, "Magnetic", mrb->object_class);

  mrb_define_class_method(mrb , magnetic , "_read" , mrb_magnetic_s__read , MRB_ARGS_NONE());
}
开发者ID:FernandoCleberSouza,项目名称:mruby-cloudwalk-platform,代码行数:11,代码来源:magnetic.c


示例18: mrb_mruby_errno_gem_init

void
mrb_mruby_errno_gem_init(mrb_state *mrb)
{
  struct RClass *e, *eno, *sce, *ste;
  mrb_value h, noerror;

  ste = mrb_class_get(mrb, "StandardError");

  sce = mrb_define_class(mrb, "SystemCallError", ste);
  mrb_define_class_method(mrb, sce, "_sys_fail", mrb_sce_sys_fail, MRB_ARGS_REQ(1));
  mrb_define_method(mrb, sce, "errno", mrb_sce_errno, MRB_ARGS_NONE());
  mrb_define_method(mrb, sce, "to_s", mrb_sce_to_s, MRB_ARGS_NONE());
  mrb_define_method(mrb, sce, "initialize", mrb_sce_init, MRB_ARGS_ARG(1, 1));

  eno = mrb_define_module(mrb, "Errno");
  h = mrb_hash_new(mrb);
  mrb_define_const(mrb, eno, "Errno2class", h);

  e = mrb_define_class_under(mrb, eno, "NOERROR", sce);
  mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(0));
  mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1));
  //mrb_define_method(mrb, e, "===", mrb_exxx_cmp, MRB_ARGS_REQ(1));
  noerror = mrb_obj_value(e);

#define itsdefined(SYM) \
  do {									\
    int ai = mrb_gc_arena_save(mrb);					\
    e = mrb_define_class_under(mrb, eno, #SYM, sce);			\
    mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(SYM));		\
    mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1)); \
    mrb_hash_set(mrb, h, mrb_fixnum_value(SYM), mrb_obj_value(e));	\
    mrb_gc_arena_restore(mrb, ai);					\
  } while (0)

#define itsnotdefined(SYM) \
  do {									\
    mrb_define_const(mrb, eno, #SYM, noerror);				\
  } while (0)

#include "known_errors_def.cstub"
}
开发者ID:Birdflying1005,项目名称:h2o,代码行数:41,代码来源:errno.c


示例19: mrb_SDL_NSWindow_init

void mrb_SDL_NSWindow_init(mrb_state* mrb) {
  RClass* NSWindow_class = mrb_define_class_under(mrb, SDL_module(mrb), "NSWindow", mrb->object_class);
  MRB_SET_INSTANCE_TT(NSWindow_class, MRB_TT_DATA);

#if BIND_NSWindow_INITIALIZE
  mrb_define_method(mrb, NSWindow_class, "initialize", mrb_SDL_NSWindow_initialize, MRB_ARGS_NONE());
#endif
  mrb_define_class_method(mrb, NSWindow_class, "disown", mrb_SDL_NSWindow_disown, MRB_ARGS_ARG(1, 0));
  mrb_define_class_method(mrb, NSWindow_class, "belongs_to_ruby?", mrb_SDL_NSWindow_belongs_to_ruby, MRB_ARGS_ARG(1, 0));


}
开发者ID:jbreeden,项目名称:mruby-sdl2,代码行数:12,代码来源:mruby__NSWindow.cpp


示例20: grn_mrb_bulk_init

void
grn_mrb_bulk_init(grn_ctx *ctx)
{
  grn_mrb_data *data = &(ctx->impl->mrb);
  mrb_state *mrb = data->state;
  struct RClass *module = data->module;
  struct RClass *klass;

  klass = mrb_define_class_under(mrb, module, "Bulk", mrb->object_class);
  MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
  mrb_define_method(mrb, klass, "initialize",
                    mrb_grn_bulk_initialize, MRB_ARGS_REQ(1));
  mrb_define_method(mrb, klass, "domain",
                    mrb_grn_bulk_get_domain, MRB_ARGS_NONE());
  mrb_define_method(mrb, klass, "value",
                    mrb_grn_bulk_get_value, MRB_ARGS_NONE());
  mrb_define_method(mrb, klass, "==",
                    mrb_grn_bulk_equal, MRB_ARGS_REQ(1));
  mrb_define_method(mrb, klass, "inspect",
                    grn_mrb_object_inspect, MRB_ARGS_NONE());
}
开发者ID:fenicks,项目名称:groonga,代码行数:21,代码来源:mrb_bulk.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MRB_SET_INSTANCE_TT函数代码示例发布时间:2022-05-30
下一篇:
C++ MRB_ARGS_ANY函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap