当前位置: 首页>>代码示例>>C++>>正文


C++ ARGS_NONE函数代码示例

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


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

示例1: 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));
}
开发者ID:Kazu-zamasu,项目名称:mruby_on_efi_shell,代码行数:25,代码来源:uefi_pointer.c

示例2: mrb_init_object

void
mrb_init_object(mrb_state *mrb)
{
  struct RClass *n;
  struct RClass *t;
  struct RClass *f;

  n = mrb->nil_class   = mrb_define_class(mrb, "NilClass",   mrb->object_class);
  mrb_define_method(mrb, n, "&",    false_and,      ARGS_REQ(1));  /* 15.2.4.3.1  */
  mrb_define_method(mrb, n, "^",    false_xor,      ARGS_REQ(1));  /* 15.2.4.3.2  */
  mrb_define_method(mrb, n, "|",    false_or,       ARGS_REQ(1));  /* 15.2.4.3.3  */
  mrb_define_method(mrb, n, "nil?", mrb_true,       ARGS_NONE());  /* 15.2.4.3.4  */
  mrb_define_method(mrb, n, "to_s", nil_to_s,       ARGS_NONE());  /* 15.2.4.3.5  */

  t = mrb->true_class  = mrb_define_class(mrb, "TrueClass",  mrb->object_class);
  mrb_define_method(mrb, t, "&",    true_and,       ARGS_REQ(1));  /* 15.2.5.3.1  */
  mrb_define_method(mrb, t, "^",    true_xor,       ARGS_REQ(1));  /* 15.2.5.3.2  */
  mrb_define_method(mrb, t, "to_s", true_to_s,      ARGS_NONE());  /* 15.2.5.3.3  */
  mrb_define_method(mrb, t, "|",    true_or,        ARGS_REQ(1));  /* 15.2.5.3.4  */

  f = mrb->false_class = mrb_define_class(mrb, "FalseClass", mrb->object_class);
  mrb_define_method(mrb, f, "&",    false_and,      ARGS_REQ(1));  /* 15.2.6.3.1  */
  mrb_define_method(mrb, f, "^",    false_xor,      ARGS_REQ(1));  /* 15.2.6.3.2  */
  mrb_define_method(mrb, f, "to_s", false_to_s,     ARGS_NONE());  /* 15.2.6.3.3  */
  mrb_define_method(mrb, f, "|",    false_or,       ARGS_REQ(1));  /* 15.2.6.3.4  */
}
开发者ID:flexfrank,项目名称:mruby,代码行数:26,代码来源:object.c

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

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

示例5: mrb_init_proc

void
mrb_init_proc(mrb_state *mrb)
{
  struct RProc *m;
  mrb_irep *call_irep = (mrb_irep *)mrb_alloca(mrb, sizeof(mrb_irep));
  static const mrb_irep mrb_irep_zero = { 0 };

  if ( call_iseq == NULL || call_irep == NULL )
    return;

  *call_irep = mrb_irep_zero;
  call_irep->flags = MRB_ISEQ_NO_FREE;
  call_irep->idx = -1;
  call_irep->iseq = call_iseq;
  call_irep->ilen = 1;

  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, ARGS_NONE());
  mrb_define_method(mrb, mrb->proc_class, "initialize_copy", mrb_proc_init_copy, ARGS_REQ(1));

  m = mrb_proc_new(mrb, call_irep);
  mrb_define_method_raw(mrb, mrb->proc_class, mrb_intern(mrb, "call"), m);
  mrb_define_method_raw(mrb, mrb->proc_class, mrb_intern(mrb, "[]"), m);

  mrb_define_class_method(mrb, mrb->kernel_module, "lambda", proc_lambda, ARGS_NONE());    /* 15.3.1.2.6  */
  mrb_define_method(mrb, mrb->kernel_module,       "lambda", proc_lambda, ARGS_NONE());    /* 15.3.1.3.27 */
}
开发者ID:Hozum,项目名称:mruby,代码行数:29,代码来源:proc.c

示例6: mrb_mruby_fake_gem_gem_init

void
mrb_mruby_fake_gem_gem_init(mrb_state* mrb) {

  struct RClass *fakeClass = mrb_define_class(mrb, "Fake", mrb->object_class);
  mrb_define_method(mrb, fakeClass, "c_method1", fake_c_method1, ARGS_NONE());
  mrb_define_method(mrb, fakeClass, "c_method2", fake_c_method2, ARGS_NONE());
}
开发者ID:kyab,项目名称:mruby-fake-gem,代码行数:7,代码来源:mruby-fake-gem.c

示例7: init_cfunc_platform

void init_cfunc_platform(mrb_state *mrb, struct RClass* module)
{
    struct RClass *struct_class = mrb_define_class_under(mrb, module, "Platform", mrb->object_class);
    
    mrb_define_class_method(mrb, struct_class, "is_posix?", cfunc_platform_is_posix, ARGS_NONE());
    mrb_define_class_method(mrb, struct_class, "is_win32?", cfunc_platform_is_win32, ARGS_NONE());
    mrb_define_class_method(mrb, struct_class, "is_darwin?", cfunc_platform_is_darwin, ARGS_NONE());
}
开发者ID:asfluido,项目名称:mruby-cfunc,代码行数:8,代码来源:cfunc_platform.c

示例8: qgame_texture_asset_init

void
qgame_texture_asset_init(mrb_state* mrb, struct RClass* mrb_qgame_class) {
  struct RClass *texture_asset_class = mrb_define_class_under(mrb, mrb_qgame_class, 
    "TextureAsset", mrb->object_class);

  mrb_define_method(mrb, texture_asset_class, "load_from_file", qgame_texture_asset_load_from_file, ARGS_REQ(1));
  mrb_define_method(mrb, texture_asset_class, "bind", qgame_texture_asset_bind, ARGS_NONE());
  mrb_define_method(mrb, texture_asset_class, "unbind", qgame_texture_asset_unbind, ARGS_NONE());
}
开发者ID:Archytaus,项目名称:qgame,代码行数:9,代码来源:texture_asset.c

示例9: 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

示例10: 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

示例11: 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

示例12: 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);
}
开发者ID:ainoya,项目名称:mod_mruby,代码行数:12,代码来源:ap_mrb_env.c

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

示例14: 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

示例15: 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


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