LoginSignup
5
4

More than 5 years have passed since last update.

mruby C API

Posted at

このメモについて

mruby/include 以下のヘッダファイルに定義されている MRB_API 参照して整理したもの

重要な構造体や型

名称 概要

mruby.h

クラス定義

関数名 概要
mrb_define_class クラスを定義する
mrb_define_module モジュールを定義する
mrb_singleton_class モジュールを定義する
mrb_include_module モジュールを Mix-in する(include)
mrb_prepend_module モジュールを Mix-in する(prepend)
mrb_define_method (グローバル)メソッドを定義する
mrb_define_class_method クラスメソッドを定義する
mrb_define_singleton_method クラスメソッドを定義する
mrb_define_module_function モジュール関数の定義
mrb_define_const 定数を定義する
mrb_undef_method メソッドを未定義にする
mrb_undef_class_method クラスメソッドを未定義にする

オブジェクト生成

関数名 概要
mrb_obj_new オブジェクト初期化
mrb_class_new_instance オブジェクト初期化
mrb_instance_new インスタンス生成
mrb_class_new クラス生成
mrb_module_new モジュール生成
mrb_class_defined クラス定義 (上書き可)

クラスインスペクション

関数名 概要
mrb_class_defined
mrb_class_get
mrb_class_get_under 子クラスを返す
mrb_module_get モジュールを返す
mrb_module_get_under 外部で定義されてるモジュールを返す
mrb_notimplement_m 未実装のモジュールを返す
mrb_obj_dup オブジェクトの複製
mrb_check_to_integer
mrb_obj_respond_to respond_to

継承の定義

関数名 概要
mrb_define_class_under
mrb_define_module_under

仮想マシン操作系

関数名 概要
mrb_get_args 引数を取得する
mrb_funcall 関数を呼び出す
mrb_funcall_argv 引数ありの関数
mrb_funcall_with_block ブロックありの関数

関数名 概要
mrb_intern_cstr NULL終端文字列をシンボルに変換
mrb_intern 文字列をシンボルに変換
mrb_intern_static 引数ありの関数
mrb_funcall_with_block ブロックありの関数

mruby/irep.h

バイトコード操作系

関数名 概要
mrb_add_irep
mrb_load_irep バイトコードの読み込み
mrb_load_irep_cxt コンテキスト付バイトコードの読み込み
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4