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

C++ ARGS_REQ函数代码示例

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

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



在下文中一共展示了ARGS_REQ函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mrb_init_print

void
mrb_init_print(mrb_state *mrb)
{
  struct RClass *krn;

  krn = mrb->kernel_module;

  mrb_define_method(mrb, krn, "__printstr__", mrb_printstr, ARGS_REQ(1));
}
开发者ID:AndreOF,项目名称:ArangoDB,代码行数:9,代码来源:print.c


示例2: mrb_init_js_obj

static void mrb_init_js_obj(mrb_state *mrb)
{
    struct RClass *obj;
    obj = MRB_UD_JS_OBJ_CLASS(mrb) = mrb_define_class(mrb, "JsObj", mrb->object_class);
    MRB_SET_INSTANCE_TT(obj, MRB_TT_DATA);

    mrb_define_class_method(mrb, obj, "get", mrb_js_obj_get, ARGS_REQ(1));
    mrb_define_method(mrb, obj, "method_missing", mrb_js_obj_method_missing, ARGS_ANY());
}
开发者ID:guofei,项目名称:JsMruby,代码行数:9,代码来源:mrb_js.cpp


示例3: mrb_mruby_thread_gem_init

void
mrb_mruby_thread_gem_init(mrb_state* mrb) {
  struct RClass *_class_thread, *_class_mutex;
  _class_thread = mrb_define_class(mrb, "Thread", mrb->object_class);
  mrb_define_method(mrb, _class_thread, "initialize", mrb_thread_init, ARGS_OPT(1));
  mrb_define_method(mrb, _class_thread, "join", mrb_thread_join, ARGS_NONE());
  mrb_define_method(mrb, _class_thread, "kill", mrb_thread_kill, ARGS_NONE());
  mrb_define_method(mrb, _class_thread, "terminate", mrb_thread_kill, ARGS_NONE());
  mrb_define_method(mrb, _class_thread, "alive?", mrb_thread_alive, ARGS_NONE());
  mrb_define_module_function(mrb, _class_thread, "sleep", mrb_thread_sleep, ARGS_REQ(1));
  _class_mutex = mrb_define_class(mrb, "Mutex", mrb->object_class);
  mrb_define_method(mrb, _class_mutex, "initialize", mrb_mutex_init, ARGS_NONE());
  mrb_define_method(mrb, _class_mutex, "lock", mrb_mutex_lock, ARGS_NONE());
  mrb_define_method(mrb, _class_mutex, "try_lock", mrb_mutex_try_lock, ARGS_NONE());
  mrb_define_method(mrb, _class_mutex, "locked?", mrb_mutex_locked, ARGS_NONE());
  mrb_define_method(mrb, _class_mutex, "sleep", mrb_mutex_sleep, ARGS_REQ(1));
  mrb_define_method(mrb, _class_mutex, "synchronize", mrb_mutex_synchronize, ARGS_REQ(1));
  mrb_define_method(mrb, _class_mutex, "unlock", mrb_mutex_unlock, ARGS_NONE());
}
开发者ID:postmodern,项目名称:mruby-thread,代码行数:19,代码来源:mrb_thread.c


示例4: mrb_init_struct

/*
 *  A <code>Struct</code> is a convenient way to bundle a number of
 *  attributes together, using accessor methods, without having to write
 *  an explicit class.
 *
 *  The <code>Struct</code> class is a generator of specific classes,
 *  each one of which is defined to hold a set of variables and their
 *  accessors. In these examples, we'll call the generated class
 *  ``<i>Customer</i>Class,'' and we'll show an example instance of that
 *  class as ``<i>Customer</i>Inst.''
 *
 *  In the descriptions that follow, the parameter <i>symbol</i> refers
 *  to a symbol, which is either a quoted string or a
 *  <code>Symbol</code> (such as <code>:name</code>).
 */
void
mrb_init_struct(mrb_state *mrb)
{
  struct RClass *st;
  st = mrb_define_class(mrb, "Struct",  mrb->object_class);

  mrb_define_class_method(mrb, st, "new",             mrb_struct_s_def,       ARGS_ANY());  /* 15.2.18.3.1  */

  mrb_define_method(mrb, st,       "==",              mrb_struct_equal,       ARGS_REQ(1)); /* 15.2.18.4.1  */
  mrb_define_method(mrb, st,       "[]",              mrb_struct_aref,        ARGS_REQ(1)); /* 15.2.18.4.2  */
  mrb_define_method(mrb, st,       "[]=",             mrb_struct_aset,        ARGS_REQ(2)); /* 15.2.18.4.3  */
  mrb_define_method(mrb, st,       "members",         mrb_struct_members_m,   ARGS_NONE()); /* 15.2.18.4.6  */
  mrb_define_method(mrb, st,       "initialize",      mrb_struct_initialize_m,ARGS_ANY());  /* 15.2.18.4.8  */
  mrb_define_method(mrb, st,       "initialize_copy", mrb_struct_init_copy,   ARGS_REQ(1)); /* 15.2.18.4.9  */
  mrb_define_method(mrb, st,       "inspect",         mrb_struct_inspect,     ARGS_NONE()); /* 15.2.18.4.10(x)  */
  mrb_define_alias(mrb, st,        "to_s", "inspect");                                      /* 15.2.18.4.11(x)  */
  mrb_define_method(mrb, st,       "eql?",            mrb_struct_eql,         ARGS_REQ(1)); /* 15.2.18.4.12(x)  */

}
开发者ID:charliesome,项目名称:mruby,代码行数:34,代码来源:struct.c


示例5: mrb_init_print

void
mrb_init_print(mrb_state *mrb)
{
  struct RClass *krn;

  krn = mrb->kernel_module;

  mrb_define_method(mrb, krn, "__printstr__", mrb_printstr, ARGS_REQ(1));
  mrb_define_method(mrb, krn, "p",  p_m, ARGS_ANY());    /* 15.3.1.3.34 */
}
开发者ID:Constellation,项目名称:mruby,代码行数:10,代码来源:print.c


示例6: eInitialize_initializeBridge

/* #[<ENTRY_FUNC>]# eInitialize_initializeBridge
 * name:         eInitialize_initializeBridge
 * global_name:  nMruby_tSCharPointer_eInitialize_initializeBridge
 * oneway:       false
 * #[</ENTRY_FUNC>]# */
void
eInitialize_initializeBridge(mrb_state* mrb, struct RClass * TECS)
{
	struct RClass *c;

	/* ここに処理本体を記述します #_TEFB_# */
	c=tecs_init_SCharPointer( mrb, TECS );
	mrb_define_method(mrb, c, "to_s", CharPointer_to_s, ARGS_NONE());
	mrb_define_method(mrb, c, "from_s", CharPointer_from_s, ARGS_REQ(1));
}
开发者ID:morioka,项目名称:toppers-asp3-for-linux,代码行数:15,代码来源:nMruby_tSCharPointer.c


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


示例8: mrb_mruby_vedis_gem_init

void mrb_mruby_vedis_gem_init(mrb_state *mrb)
{
    struct RClass *vedis;

    vedis = mrb_define_class(mrb, "Vedis", mrb->object_class);

    mrb_define_method(mrb, vedis, "initialize", mrb_vedis_open, ARGS_OPT(1));
    mrb_define_method(mrb, vedis, "set", mrb_vedis_set, ARGS_REQ(2));
    mrb_define_method(mrb, vedis, "get", mrb_vedis_get, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "[]=", mrb_vedis_set, ARGS_REQ(2));
    mrb_define_method(mrb, vedis, "[]", mrb_vedis_get, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "exec", mrb_vedis_exec, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "del", mrb_vedis_del, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "append", mrb_vedis_append, ARGS_REQ(2));
    mrb_define_method(mrb, vedis, "<<", mrb_vedis_append_hash, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "exists?", mrb_vedis_exists, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "strlen", mrb_vedis_strlen, ARGS_REQ(1));
    mrb_define_method(mrb, vedis, "close", mrb_vedis_close, ARGS_NONE());
    DONE;
}
开发者ID:zzak,项目名称:mruby-vedis,代码行数:20,代码来源:mrb_vedis.c


示例9: 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_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 = 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, 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;
}
开发者ID:akuroda,项目名称:mruby,代码行数:54,代码来源:struct.c


示例10: mrb_init_gc

void
mrb_init_gc(mrb_state *mrb)
{
  struct RClass *gc;
  gc = mrb_define_module(mrb, "GC");

  mrb_define_class_method(mrb, gc, "start", gc_start, ARGS_NONE());
  mrb_define_class_method(mrb, gc, "enable", gc_enable, ARGS_NONE());
  mrb_define_class_method(mrb, gc, "disable", gc_disable, ARGS_NONE());
  mrb_define_class_method(mrb, gc, "interval_ratio", gc_interval_ratio_get, ARGS_NONE());
  mrb_define_class_method(mrb, gc, "interval_ratio=", gc_interval_ratio_set, ARGS_REQ(1));
  mrb_define_class_method(mrb, gc, "step_ratio", gc_step_ratio_get, ARGS_NONE());
  mrb_define_class_method(mrb, gc, "step_ratio=", gc_step_ratio_set, ARGS_REQ(1));
  mrb_define_class_method(mrb, gc, "generational_mode=", gc_generational_mode_set, ARGS_REQ(1));
  mrb_define_class_method(mrb, gc, "generational_mode", gc_generational_mode_get, ARGS_NONE());
#ifdef GC_TEST
#ifdef GC_DEBUG
  mrb_define_class_method(mrb, gc, "test", gc_test, ARGS_NONE());
#endif
#endif
}
开发者ID:forkall,项目名称:groonga,代码行数:21,代码来源:gc.c


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


示例12: mrb_mruby_rx_gpio_gem_init

void
mrb_mruby_rx_gpio_gem_init(mrb_state* mrb) {


    struct RClass *gpio;
    gpio = mrb_define_class(mrb, "Rx_gpio", mrb->object_class);

    mrb_define_const(mrb,gpio, "LED0", mrb_fixnum_value(100));
    mrb_define_const(mrb,gpio, "LED1", mrb_fixnum_value(101));
    mrb_define_const(mrb,gpio, "LED2", mrb_fixnum_value(102));
    mrb_define_const(mrb,gpio, "LED3", mrb_fixnum_value(103));

    mrb_define_const(mrb,gpio, "IO2", mrb_fixnum_value(202));
    mrb_define_const(mrb,gpio, "IO3", mrb_fixnum_value(203));
    mrb_define_const(mrb,gpio, "IO4", mrb_fixnum_value(204));
    mrb_define_const(mrb,gpio, "IO5", mrb_fixnum_value(205));

    mrb_define_const(mrb,gpio, "IO44", mrb_fixnum_value(210));
    mrb_define_const(mrb,gpio, "IO45", mrb_fixnum_value(211));
    mrb_define_const(mrb,gpio, "IO46", mrb_fixnum_value(212));
    mrb_define_const(mrb,gpio, "IO47", mrb_fixnum_value(213));
    mrb_define_const(mrb,gpio, "IO48", mrb_fixnum_value(214));
    mrb_define_const(mrb,gpio, "IO49", mrb_fixnum_value(215));
    mrb_define_const(mrb,gpio, "IO50", mrb_fixnum_value(216));
    mrb_define_const(mrb,gpio, "IO51", mrb_fixnum_value(217));

    mrb_define_const(mrb,gpio, "IO11", mrb_fixnum_value(249));
    mrb_define_const(mrb,gpio, "IO12", mrb_fixnum_value(250));


    mrb_define_const(mrb,gpio, "IO2IN", mrb_fixnum_value(302));
    mrb_define_const(mrb,gpio, "IO3IN", mrb_fixnum_value(303));
    mrb_define_const(mrb,gpio, "IO4IN", mrb_fixnum_value(304));
    mrb_define_const(mrb,gpio, "IO5IN", mrb_fixnum_value(305));

    mrb_define_const(mrb,gpio, "IO44IN", mrb_fixnum_value(310));
    mrb_define_const(mrb,gpio, "IO45IN", mrb_fixnum_value(311));
    mrb_define_const(mrb,gpio, "IO46IN", mrb_fixnum_value(312));
    mrb_define_const(mrb,gpio, "IO47IN", mrb_fixnum_value(313));
    mrb_define_const(mrb,gpio, "IO48IN", mrb_fixnum_value(314));
    mrb_define_const(mrb,gpio, "IO49IN", mrb_fixnum_value(315));
    mrb_define_const(mrb,gpio, "IO50IN", mrb_fixnum_value(316));
    mrb_define_const(mrb,gpio, "IO51IN", mrb_fixnum_value(317));
    mrb_define_const(mrb,gpio, "IO12IN", mrb_fixnum_value(350));

    /* methods */
    mrb_define_method(mrb, gpio, "initialize", mrb_rx_gpio_initialize, ARGS_REQ(1));
    mrb_define_method(mrb, gpio, "on", mrb_rx_gpio_on, ARGS_NONE());
    mrb_define_method(mrb, gpio, "off", mrb_rx_gpio_off, ARGS_NONE());
    mrb_define_method(mrb, gpio, "in", mrb_rx_gpio_input, ARGS_NONE());

}
开发者ID:alvstakahashi,项目名称:GR-SAKURA-MRUBY-CAR,代码行数:52,代码来源:rx-gpio.c


示例13: mrb_mruby_ssp_thread_gem_init

void
mrb_mruby_ssp_thread_gem_init(mrb_state* mrb) {


	struct RClass *ssp;
	ssp = mrb_define_class(mrb, "Ssp_thread", mrb->object_class);

	/* methods */
	mrb_define_method(mrb, ssp, "initialize", mrb_ssp_thread_initialize, ARGS_REQ(2));
	mrb_define_method(mrb, ssp, "act" , mrb_ssp_thread_act, ARGS_NONE());
	mrb_define_method(mrb, ssp, "iact", mrb_ssp_thread_iact, ARGS_NONE());

}
开发者ID:alvstakahashi,项目名称:GR-SAKURA-MRUBY-CAR,代码行数:13,代码来源:ssp-thread.c


示例14: mrb_init_core

void
mrb_init_core(mrb_state *mrb)
{
  mrb_init_symtbl(mrb);

  mrb_init_class(mrb);
  mrb_init_object(mrb);
  mrb_init_kernel(mrb);
  mrb_init_comparable(mrb);
  mrb_init_enumerable(mrb);

  mrb_init_symbols(mrb);
  mrb_init_proc(mrb);
  mrb_init_string(mrb);
  Init_version(mrb); /* after init_string */
  mrb_init_array(mrb);
  mrb_init_hash(mrb);
  mrb_init_numeric(mrb);
  mrb_init_range(mrb);
  mrb_init_struct(mrb);
  mrb_init_gc(mrb);
#ifdef INCLUDE_REGEXP
  mrb_init_regexp(mrb);
  mrb_init_encoding(mrb);
#endif
  mrb_init_exception(mrb);
  mrb_init_print(mrb);
  mrb_init_time(mrb);

#ifdef MANDEL
  mrb_define_method(mrb, mrb->kernel_module, "pow", mpow, ARGS_REQ(2));
  mrb_define_method(mrb, mrb->kernel_module, "sqrt", msqrt, ARGS_REQ(1));
  mrb_define_method(mrb, mrb->kernel_module, "putc", mputc, ARGS_REQ(1));
#endif

  mrb_init_mrblib(mrb);

  mrb_gc_arena_restore(mrb, 0);
}
开发者ID:anandkumaragrawal,项目名称:mruby,代码行数:39,代码来源:init.c


示例15: 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));
}
开发者ID:gitpan,项目名称:mRuby,代码行数:54,代码来源:class.c


示例16: mrb_mruby_ssp_cyclic_gem_init

void
mrb_mruby_ssp_cyclic_gem_init(mrb_state* mrb) {


	struct RClass *cyc;
	cyc = mrb_define_class(mrb, "Ssp_cyclic", mrb->object_class);

	/* methods */
	mrb_define_method(mrb, cyc, "initialize", mrb_ssp_cyclic_initialize, ARGS_REQ(2));
	mrb_define_method(mrb, cyc, "start", mrb_ssp_cyclic_sta, ARGS_NONE());
	mrb_define_method(mrb, cyc, "stop" , mrb_ssp_cyclic_stp, ARGS_NONE());
	mrb_define_method(mrb, cyc, "istop" , mrb_ssp_cyclic_istp, ARGS_NONE());

}
开发者ID:alvstakahashi,项目名称:GR-SAKURA-MRUBY-CAR,代码行数:14,代码来源:ssp-cyclic.c


示例17: mrb_init_symbols

void
mrb_init_symbols(mrb_state *mrb)
{
  struct RClass *sym;

  sym = mrb->symbol_class = mrb_define_class(mrb, "Symbol", mrb->object_class);

  mrb_define_method(mrb, sym, "===",             sym_equal,               ARGS_REQ(1));              /* 15.2.11.3.1  */
  mrb_define_method(mrb, sym, "id2name",         mrb_sym_to_s,            ARGS_NONE());              /* 15.2.11.3.2  */
  mrb_define_method(mrb, sym, "to_s",            mrb_sym_to_s,            ARGS_NONE());              /* 15.2.11.3.3  */
  mrb_define_method(mrb, sym, "to_sym",          sym_to_sym,              ARGS_NONE());              /* 15.2.11.3.4  */

  mrb_define_method(mrb, sym, "inspect",         sym_inspect,             ARGS_NONE());              /* 15.2.11.3.5(x)  */
}
开发者ID:Kazu-zamasu,项目名称:mruby_efi_shell,代码行数:14,代码来源:symbol.c


示例18: mrb_init_enumerable

void
mrb_init_enumerable(mrb_state *mrb)
{
  struct RClass *cenum;
//#undef mrb_intern
//#define mrb_intern(str) mrb_intern_const(str)

  cenum = mrb_define_module(mrb, "Enumerable");

#if 0
  //mrb_define_class_method(mrb, cenum, "all?",            enum_all,               ARGS_NONE()); /* 15.3.2.2.1  */
  //mrb_define_class_method(mrb, cenum, "any?",            enum_any,               ARGS_NONE()); /* 15.3.2.2.2  */
  //mrb_define_class_method(mrb, cenum, "collect",         enum_collect,           ARGS_NONE()); /* 15.3.2.2.3  */
  //mrb_define_class_method(mrb, cenum, "detect",          enum_find_m,            ARGS_ANY());  /* 15.3.2.2.4  */
  //mrb_define_class_method(mrb, cenum, "each_with_index", enum_each_with_index_m, ARGS_ANY());  /* 15.3.2.2.5  */
  mrb_define_class_method(mrb, cenum, "entries",         enum_to_a_m,            ARGS_ANY());  /* 15.3.2.2.6  */
  //mrb_define_class_method(mrb, cenum, "find",            enum_find_m,            ARGS_ANY());  /* 15.3.2.2.7  */
  //mrb_define_class_method(mrb, cenum, "find_all",        enum_find_all,          ARGS_NONE()); /* 15.3.2.2.8  */
  //mrb_define_class_method(mrb, cenum, "grep",            enum_grep,              ARGS_REQ(1)); /* 15.3.2.2.9  */
  mrb_define_class_method(mrb, cenum, "include?",        enum_member,            ARGS_REQ(1)); /* 15.3.2.2.10 */
  //mrb_define_class_method(mrb, cenum, "inject",          enum_inject_m,          ARGS_ANY());  /* 15.3.2.2.11 */
  //mrb_define_class_method(mrb, cenum, "map",             enum_collect,           ARGS_NONE()); /* 15.3.2.2.12 */
  //mrb_define_class_method(mrb, cenum, "max",             enum_max,               ARGS_NONE()); /* 15.3.2.2.13 */
  //mrb_define_class_method(mrb, cenum, "min",             enum_min,               ARGS_NONE()); /* 15.3.2.2.14 */
  mrb_define_class_method(mrb, cenum, "member?",         enum_member,            ARGS_REQ(1)); /* 15.3.2.2.15 */
  //mrb_define_class_method(mrb, cenum, "partition",       enum_partition,         ARGS_NONE()); /* 15.3.2.2.16 */
  //mrb_define_class_method(mrb, cenum, "reject",          enum_reject,            ARGS_NONE()); /* 15.3.2.2.17 */
  //mrb_define_class_method(mrb, cenum, "select",          enum_find_all,          ARGS_NONE()); /* 15.3.2.2.18 */
  //mrb_define_class_method(mrb, cenum, "sort",            enum_sort,              ARGS_NONE()); /* 15.3.2.2.19 */
  mrb_define_class_method(mrb, cenum, "to_a",            enum_to_a_m,            ARGS_ANY());  /* 15.3.2.2.20 */
  id_eqq  = mrb_intern(mrb, "===");
  id_each = mrb_intern(mrb, "each");
  id_cmp  = mrb_intern(mrb, "<=>");
  id_next = mrb_intern(mrb, "next");
  id_size = mrb_intern(mrb, "size");
#endif
}
开发者ID:Constellation,项目名称:mruby,代码行数:37,代码来源:enum.c


示例19: mrb_init_uefi_handle

void
mrb_init_uefi_handle(mrb_state *mrb, struct RClass *mrb_uefi)
{
    struct RClass *h_cls;

    h_cls = mrb_define_class_under(mrb, mrb_uefi, "Handle", mrb->object_class);
    MRB_SET_INSTANCE_TT(h_cls, MRB_TT_DATA);

    mrb_define_method(mrb, h_cls, "==", mrb_uefi_handle_eq, ARGS_REQ(1));
    mrb_define_method(mrb, h_cls, "to_s", mrb_uefi_handle_to_s, ARGS_NONE());
    mrb_define_method(mrb, h_cls, "inspect", mrb_uefi_handle_inspect, ARGS_NONE());
    mrb_define_method(mrb, h_cls, "value", mrb_uefi_handle_value, ARGS_NONE());

    mrb_const_set(mrb, mrb_obj_value(h_cls), mrb_intern(mrb, "NULL"),
                  mrb_uefi_handle_make_helper(mrb, h_cls, NULL));
}
开发者ID:Kazu-zamasu,项目名称:mruby_on_efi_shell,代码行数:16,代码来源:uefi_handle.c


示例20: init_mruby

bool init_mruby()
{
    Serial2.println("init_mruby enter");
    g_mrb = mrb_open_allocf(myallocfCCM, NULL);
    // g_mrb = mrb_open_allocf(myallocf, NULL);
    Serial2.print("mrb_open done. total allocated : ");
    Serial2.println(total_size, DEC);

    mrb_load_irep(g_mrb, blinker);

    RClass *freeRTOSModule = mrb_define_module(g_mrb, "FreeRTOS");
    mrb_define_module_function(g_mrb, freeRTOSModule, "sleep", mrb_freertos_sleep, ARGS_REQ(1));

    Serial2.println("mruby initialized");

    return true;
}
开发者ID:kyab,项目名称:mruby-thread-freertos,代码行数:17,代码来源:main.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ARGUMENTS函数代码示例发布时间:2022-05-30
下一篇:
C++ ARGS_NONE函数代码示例发布时间: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