w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

class.c File Reference
#include <stdarg.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/hash.h>
#include <mruby/class.h>
#include <mruby/numeric.h>
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/variable.h>
#include <mruby/error.h>
#include <mruby/data.h>
#include <mruby/istruct.h>
#include <mruby/opcode.h>
#include <mruby/presym.h>
Include dependency graph for class.c:

Go to the source code of this file.

Classes

union  mt_ptr
 
struct  mt_elem
 
struct  mt_tbl
 

Macros

#define slot_empty_p(slot)   ((slot)->key == 0 && (slot)->func_p == 0)
 
#define make_metaclass(mrb, c)   prepare_singleton_class((mrb), (struct RBasic*)(c))
 
#define to_sym(mrb, ss)   mrb_obj_to_sym(mrb, ss)
 
#define ARGV   array_argv
 
#define ONSTACK_ALLOC_MAX   32
 

Typedefs

typedef struct mt_tbl mt_tbl
 

Functions

static mt_tblmt_new (mrb_state *mrb)
 
static struct mt_elemmt_put (mrb_state *mrb, mt_tbl *t, mrb_sym sym, size_t func_p, size_t noarg_p, union mt_ptr ptr)
 
static void mt_rehash (mrb_state *mrb, mt_tbl *t)
 
static struct mt_elemmt_get (mrb_state *mrb, mt_tbl *t, mrb_sym sym)
 
static mrb_bool mt_del (mrb_state *mrb, mt_tbl *t, mrb_sym sym)
 
static struct mt_tblmt_copy (mrb_state *mrb, mt_tbl *t)
 
static void mt_free (mrb_state *mrb, mt_tbl *t)
 
void mrb_mt_foreach (mrb_state *mrb, struct RClass *c, mrb_mt_foreach_func *fn, void *p)
 
void mrb_gc_mark_mt (mrb_state *mrb, struct RClass *c)
 
size_t mrb_gc_mark_mt_size (mrb_state *mrb, struct RClass *c)
 
void mrb_gc_free_mt (mrb_state *mrb, struct RClass *c)
 
void mrb_class_name_class (mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb_sym id)
 
mrb_bool mrb_const_name_p (mrb_state *mrb, const char *name, mrb_int len)
 
static void setup_class (mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb_sym id)
 
static void prepare_singleton_class (mrb_state *mrb, struct RBasic *o)
 
static mrb_value class_name_str (mrb_state *mrb, struct RClass *c)
 
static struct RClassclass_from_sym (mrb_state *mrb, struct RClass *klass, mrb_sym id)
 
static struct RClassmodule_from_sym (mrb_state *mrb, struct RClass *klass, mrb_sym id)
 
static mrb_bool class_ptr_p (mrb_value obj)
 
static void check_if_class_or_module (mrb_state *mrb, mrb_value obj)
 
static struct RClassdefine_module (mrb_state *mrb, mrb_sym name, struct RClass *outer)
 
struct RClassmrb_define_module_id (mrb_state *mrb, mrb_sym name)
 
struct RClassmrb_define_module (mrb_state *mrb, const char *name)
 
struct RClassmrb_vm_define_module (mrb_state *mrb, mrb_value outer, mrb_sym id)
 
struct RClassmrb_define_module_under_id (mrb_state *mrb, struct RClass *outer, mrb_sym name)
 
struct RClassmrb_define_module_under (mrb_state *mrb, struct RClass *outer, const char *name)
 
static struct RClassfind_origin (struct RClass *c)
 
static struct RClassdefine_class (mrb_state *mrb, mrb_sym name, struct RClass *super, struct RClass *outer)
 
struct RClassmrb_define_class_id (mrb_state *mrb, mrb_sym name, struct RClass *super)
 
struct RClassmrb_define_class (mrb_state *mrb, const char *name, struct RClass *super)
 
static mrb_value mrb_bob_init (mrb_state *mrb, mrb_value)
 
static void mc_clear (mrb_state *mrb)
 
static void mrb_class_inherited (mrb_state *mrb, struct RClass *super, struct RClass *klass)
 
struct RClassmrb_vm_define_class (mrb_state *mrb, mrb_value outer, mrb_value super, mrb_sym id)
 
mrb_bool mrb_class_defined (mrb_state *mrb, const char *name)
 
mrb_bool mrb_class_defined_id (mrb_state *mrb, mrb_sym name)
 
mrb_bool mrb_class_defined_under (mrb_state *mrb, struct RClass *outer, const char *name)
 
mrb_bool mrb_class_defined_under_id (mrb_state *mrb, struct RClass *outer, mrb_sym name)
 
struct RClassmrb_class_get_under (mrb_state *mrb, struct RClass *outer, const char *name)
 
struct RClassmrb_class_get_under_id (mrb_state *mrb, struct RClass *outer, mrb_sym name)
 
struct RClassmrb_class_get (mrb_state *mrb, const char *name)
 
struct RClassmrb_class_get_id (mrb_state *mrb, mrb_sym name)
 
struct RClassmrb_exc_get_id (mrb_state *mrb, mrb_sym name)
 
struct RClassmrb_module_get_under (mrb_state *mrb, struct RClass *outer, const char *name)
 
struct RClassmrb_module_get_under_id (mrb_state *mrb, struct RClass *outer, mrb_sym name)
 
struct RClassmrb_module_get (mrb_state *mrb, const char *name)
 
struct RClassmrb_module_get_id (mrb_state *mrb, mrb_sym name)
 
struct RClassmrb_define_class_under_id (mrb_state *mrb, struct RClass *outer, mrb_sym name, struct RClass *super)
 
struct RClassmrb_define_class_under (mrb_state *mrb, struct RClass *outer, const char *name, struct RClass *super)
 
void mrb_define_method_raw (mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_method_t m)
 
void mrb_define_method_id (mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_method (mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_notimplement (mrb_state *mrb)
 
mrb_value mrb_notimplement_m (mrb_state *mrb, mrb_value self)
 
static mrb_value to_ary (mrb_state *mrb, mrb_value val)
 
static mrb_value to_hash (mrb_state *mrb, mrb_value val)
 
mrb_int mrb_get_argc (mrb_state *mrb)
 
const mrb_valuemrb_get_argv (mrb_state *mrb)
 
mrb_value mrb_get_arg1 (mrb_state *mrb)
 
void mrb_hash_check_kdict (mrb_state *mrb, mrb_value self)
 
mrb_int mrb_get_args (mrb_state *mrb, const char *format,...)
 
static struct RClassboot_defclass (mrb_state *mrb, struct RClass *super)
 
static void boot_initmod (mrb_state *mrb, struct RClass *mod)
 
static struct RClassinclude_class_new (mrb_state *mrb, struct RClass *m, struct RClass *super)
 
static int include_module_at (mrb_state *mrb, struct RClass *c, struct RClass *ins_pos, struct RClass *m, int search_super)
 
static int fix_include_module (mrb_state *mrb, struct RBasic *obj, void *data)
 
void mrb_include_module (mrb_state *mrb, struct RClass *c, struct RClass *m)
 
static int fix_prepend_module (mrb_state *mrb, struct RBasic *obj, void *data)
 
void mrb_prepend_module (mrb_state *mrb, struct RClass *c, struct RClass *m)
 
static mrb_value mrb_mod_prepend_features (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_append_features (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_include_p (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_ancestors (mrb_state *mrb, mrb_value self)
 
static mrb_value mrb_mod_extend_object (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_initialize (mrb_state *mrb, mrb_value mod)
 
mrb_value mrb_mod_module_eval (mrb_state *, mrb_value)
 
static mrb_value mrb_mod_dummy_visibility (mrb_state *mrb, mrb_value mod)
 
struct RClassmrb_singleton_class_ptr (mrb_state *mrb, mrb_value v)
 
mrb_value mrb_singleton_class (mrb_state *mrb, mrb_value v)
 
void mrb_define_singleton_method (mrb_state *mrb, struct RObject *o, const char *name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_singleton_method_id (mrb_state *mrb, struct RObject *o, mrb_sym name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_class_method (mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_class_method_id (mrb_state *mrb, struct RClass *c, mrb_sym name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_module_function_id (mrb_state *mrb, struct RClass *c, mrb_sym name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_define_module_function (mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t func, mrb_aspec aspec)
 
void mrb_mc_clear_by_class (mrb_state *mrb, struct RClass *c)
 
mrb_method_t mrb_method_search_vm (mrb_state *mrb, struct RClass **cp, mrb_sym mid)
 
mrb_method_t mrb_method_search (mrb_state *mrb, struct RClass *c, mrb_sym mid)
 
static mrb_sym prepare_name_common (mrb_state *mrb, mrb_sym sym, const char *prefix, const char *suffix)
 
static mrb_value prepare_ivar_name (mrb_state *mrb, mrb_sym sym)
 
static mrb_sym prepare_writer_name (mrb_state *mrb, mrb_sym sym)
 
static mrb_value mod_attr_define (mrb_state *mrb, mrb_value mod, mrb_value(*accessor)(mrb_state *, mrb_value), mrb_sym(*access_name)(mrb_state *, mrb_sym))
 
static mrb_value attr_reader (mrb_state *mrb, mrb_value obj)
 
static mrb_value mrb_mod_attr_reader (mrb_state *mrb, mrb_value mod)
 
static mrb_value attr_writer (mrb_state *mrb, mrb_value obj)
 
static mrb_value mrb_mod_attr_writer (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_instance_alloc (mrb_state *mrb, mrb_value cv)
 
mrb_value mrb_instance_new (mrb_state *mrb, mrb_value cv)
 
mrb_value mrb_obj_new (mrb_state *mrb, struct RClass *c, mrb_int argc, const mrb_value *argv)
 
static mrb_value mrb_class_initialize (mrb_state *mrb, mrb_value c)
 
static mrb_value mrb_class_new_class (mrb_state *mrb, mrb_value cv)
 
static mrb_value mrb_class_superclass (mrb_state *mrb, mrb_value klass)
 
static mrb_value mrb_bob_not (mrb_state *mrb, mrb_value cv)
 
mrb_value mrb_obj_equal_m (mrb_state *mrb, mrb_value self)
 
mrb_bool mrb_obj_respond_to (mrb_state *mrb, struct RClass *c, mrb_sym mid)
 
mrb_bool mrb_respond_to (mrb_state *mrb, mrb_value obj, mrb_sym mid)
 
mrb_value mrb_class_path (mrb_state *mrb, struct RClass *c)
 
struct RClassmrb_class_real (struct RClass *cl)
 
const char * mrb_class_name (mrb_state *mrb, struct RClass *c)
 
const char * mrb_obj_classname (mrb_state *mrb, mrb_value obj)
 
static void mrb_check_inheritable (mrb_state *mrb, struct RClass *super)
 
struct RClassmrb_class_new (mrb_state *mrb, struct RClass *super)
 
struct RClassmrb_module_new (mrb_state *mrb)
 
struct RClassmrb_obj_class (mrb_state *mrb, mrb_value obj)
 
void mrb_alias_method (mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b)
 
void mrb_define_alias (mrb_state *mrb, struct RClass *klass, const char *name1, const char *name2)
 
void mrb_define_alias_id (mrb_state *mrb, struct RClass *klass, mrb_sym a, mrb_sym b)
 
mrb_value mrb_mod_to_s (mrb_state *mrb, mrb_value klass)
 
static mrb_value mrb_mod_alias (mrb_state *mrb, mrb_value mod)
 
static void undef_method (mrb_state *mrb, struct RClass *c, mrb_sym a)
 
void mrb_undef_method_id (mrb_state *mrb, struct RClass *c, mrb_sym a)
 
void mrb_undef_method (mrb_state *mrb, struct RClass *c, const char *name)
 
void mrb_undef_class_method_id (mrb_state *mrb, struct RClass *c, mrb_sym name)
 
void mrb_undef_class_method (mrb_state *mrb, struct RClass *c, const char *name)
 
void mrb_remove_method (mrb_state *mrb, struct RClass *c, mrb_sym mid)
 
static mrb_value mrb_mod_undef (mrb_state *mrb, mrb_value mod)
 
static void check_const_name_sym (mrb_state *mrb, mrb_sym id)
 
static mrb_value mrb_mod_const_defined (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_const_get_sym (mrb_state *mrb, mrb_value mod, mrb_sym id)
 
static mrb_value mrb_mod_const_get (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_const_set (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_remove_const (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_const_missing (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_method_defined (mrb_state *mrb, mrb_value mod)
 
mrb_value mrb_mod_define_method_m (mrb_state *mrb, struct RClass *c)
 
static mrb_value mod_define_method (mrb_state *mrb, mrb_value self)
 
static mrb_value top_define_method (mrb_state *mrb, mrb_value self)
 
static mrb_value mrb_mod_eqq (mrb_state *mrb, mrb_value mod)
 
static mrb_value mrb_mod_dup (mrb_state *mrb, mrb_value self)
 
static mrb_value mrb_mod_module_function (mrb_state *mrb, mrb_value mod)
 
static struct RClassmrb_singleton_class_clone (mrb_state *mrb, mrb_value obj)
 
static void copy_class (mrb_state *mrb, mrb_value dst, mrb_value src)
 
static mrb_value mrb_obj_init_copy (mrb_state *mrb, mrb_value self)
 
static void init_copy (mrb_state *mrb, mrb_value dest, mrb_value obj)
 
mrb_value mrb_obj_clone (mrb_state *mrb, mrb_value self)
 
mrb_value mrb_obj_dup (mrb_state *mrb, mrb_value obj)
 
mrb_value mrb_obj_id_m (mrb_state *mrb, mrb_value self)
 
mrb_value mrb_obj_instance_eval (mrb_state *, mrb_value)
 
static mrb_value inspect_main (mrb_state *mrb, mrb_value mod)
 
static void init_class_new (mrb_state *mrb, struct RClass *cls)
 
mrb_value mrb_f_send (mrb_state *mrb, mrb_value self)
 
void mrb_init_class (mrb_state *mrb)
 

Variables

static const mrb_code new_iseq []
 
static const mrb_sym new_syms [] = { MRB_SYM__allocate , MRB_SYM__initialize }
 
static const mrb_irep new_irep
 

Macro Definition Documentation

◆ ARGV

#define ARGV   array_argv

◆ make_metaclass

#define make_metaclass (   mrb,
  c 
)    prepare_singleton_class((mrb), (struct RBasic*)(c))

Definition at line 336 of file class.c.

◆ ONSTACK_ALLOC_MAX

#define ONSTACK_ALLOC_MAX   32

Definition at line 1789 of file class.c.

◆ slot_empty_p

#define slot_empty_p (   slot)    ((slot)->key == 0 && (slot)->func_p == 0)

Definition at line 82 of file class.c.

◆ to_sym

#define to_sym (   mrb,
  ss 
)    mrb_obj_to_sym(mrb, ss)

Definition at line 811 of file class.c.

Typedef Documentation

◆ mt_tbl

typedef struct mt_tbl mt_tbl

Function Documentation

◆ attr_reader()

static mrb_value attr_reader ( mrb_state mrb,
mrb_value  obj 
)
static

Definition at line 1864 of file class.c.

References mrb_iv_get(), mrb_proc_cfunc_env_get(), name, and to_sym.

Referenced by mrb_mod_attr_reader().

◆ attr_writer()

static mrb_value attr_writer ( mrb_state mrb,
mrb_value  obj 
)
static

Definition at line 1877 of file class.c.

References mrb_get_arg1(), mrb_iv_set(), mrb_proc_cfunc_env_get(), name, to_sym, and val.

Referenced by mrb_mod_attr_writer().

◆ boot_defclass()

static struct RClass* boot_defclass ( mrb_state mrb,
struct RClass super 
)
static

◆ boot_initmod()

static void boot_initmod ( mrb_state mrb,
struct RClass mod 
)
static

Definition at line 1354 of file class.c.

References mod(), and mt_new().

Referenced by mrb_mod_initialize(), and mrb_module_new().

◆ check_const_name_sym()

static void check_const_name_sym ( mrb_state mrb,
mrb_sym  id 
)
static

◆ check_if_class_or_module()

static void check_if_class_or_module ( mrb_state mrb,
mrb_value  obj 
)
static

Definition at line 420 of file class.c.

References class_ptr_p(), E_TYPE_ERROR, and mrb_raisef().

Referenced by mrb_vm_define_class(), and mrb_vm_define_module().

◆ class_from_sym()

static struct RClass* class_from_sym ( mrb_state mrb,
struct RClass klass,
mrb_sym  id 
)
static

◆ class_name_str()

static mrb_value class_name_str ( mrb_state mrb,
struct RClass c 
)
static

◆ class_ptr_p()

static mrb_bool class_ptr_p ( mrb_value  obj)
static

Definition at line 407 of file class.c.

References FALSE, MRB_TT_CLASS, MRB_TT_MODULE, MRB_TT_SCLASS, mrb_type(), and TRUE.

Referenced by check_if_class_or_module(), mrb_get_args(), and mrb_mod_to_s().

◆ copy_class()

◆ define_class()

static struct RClass* define_class ( mrb_state mrb,
mrb_sym  name,
struct RClass super,
struct RClass outer 
)
static

◆ define_module()

◆ find_origin()

static struct RClass* find_origin ( struct RClass c)
static

Definition at line 488 of file class.c.

References c, and MRB_CLASS_ORIGIN.

Referenced by include_module_at(), mrb_class_superclass(), and mrb_include_module().

◆ fix_include_module()

static int fix_include_module ( mrb_state mrb,
struct RBasic obj,
void data 
)
static

◆ fix_prepend_module()

static int fix_prepend_module ( mrb_state mrb,
struct RBasic obj,
void data 
)
static

Definition at line 1455 of file class.c.

References c, data, include_module_at(), m, MRB_EACH_OBJ_OK, MRB_TT_CLASS, MRB_TT_MODULE, p, and RClass::super.

Referenced by mrb_prepend_module().

◆ include_class_new()

static struct RClass* include_class_new ( mrb_state mrb,
struct RClass m,
struct RClass super 
)
static

◆ include_module_at()

static int include_module_at ( mrb_state mrb,
struct RClass c,
struct RClass ins_pos,
struct RClass m,
int  search_super 
)
static

◆ init_class_new()

static void init_class_new ( mrb_state mrb,
struct RClass cls 
)
static

◆ init_copy()

◆ inspect_main()

static mrb_value inspect_main ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2791 of file class.c.

References mrb_str_new_lit.

Referenced by mrb_init_class().

◆ mc_clear()

static void mc_clear ( mrb_state mrb)
static

◆ mod_attr_define()

◆ mod_define_method()

static mrb_value mod_define_method ( mrb_state mrb,
mrb_value  self 
)
static

Definition at line 2522 of file class.c.

References mrb_class_ptr, and mrb_mod_define_method_m().

Referenced by mrb_init_class().

◆ module_from_sym()

static struct RClass* module_from_sym ( mrb_state mrb,
struct RClass klass,
mrb_sym  id 
)
static

◆ mrb_alias_method()

◆ mrb_bob_init()

static mrb_value mrb_bob_init ( mrb_state mrb,
mrb_value  cv 
)
static

Definition at line 2004 of file class.c.

References mrb_nil_value().

Referenced by mrb_class_inherited(), mrb_init_class(), mrb_instance_new(), and mrb_obj_new().

◆ mrb_bob_not()

static mrb_value mrb_bob_not ( mrb_state mrb,
mrb_value  cv 
)
static

Definition at line 2010 of file class.c.

References cv, mrb_bool_value(), and mrb_test.

Referenced by mrb_init_class().

◆ mrb_check_inheritable()

static void mrb_check_inheritable ( mrb_state mrb,
struct RClass super 
)
static

Ensures a class can be derived from super.

Parameters
supera reference to an object.
Exceptions
TypeErrorif super is not a Class or super is a singleton class.

Definition at line 2124 of file class.c.

References mrb_state::class_class, E_TYPE_ERROR, mrb_raise(), mrb_raisef(), MRB_TT_CLASS, MRB_TT_SCLASS, and RClass::super.

Referenced by mrb_class_new().

◆ mrb_class_defined()

mrb_bool mrb_class_defined ( mrb_state mrb,
const char *  name 
)

Returns an mrb_bool. True if class was defined, and false if the class was not defined.

Example: void mrb_example_gem_init(mrb_state* mrb) { struct RClass *example_class; mrb_bool cd;

example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class); cd = mrb_class_defined(mrb, "ExampleClass");

// If mrb_class_defined returns 1 then puts "True" // If mrb_class_defined returns 0 then puts "False" if (cd == 1){ puts("True"); } else { puts("False"); } }

Parameters
mrbThe current mruby state.
nameA string representing the name of the class.
Returns
[mrb_bool] A boolean value.

Definition at line 593 of file class.c.

References FALSE, mrb_const_defined(), mrb_intern_check_cstr(), mrb_obj_value(), name, mrb_state::object_class, and sym.

Referenced by compare_break_method(), and mrb_sys_fail().

◆ mrb_class_defined_id()

mrb_bool mrb_class_defined_id ( mrb_state mrb,
mrb_sym  name 
)

Definition at line 601 of file class.c.

References mrb_const_defined(), mrb_obj_value(), name, and mrb_state::object_class.

Referenced by io_set_process_status().

◆ mrb_class_defined_under()

mrb_bool mrb_class_defined_under ( mrb_state mrb,
struct RClass outer,
const char *  name 
)

Returns an mrb_bool. True if inner class was defined, and false if the inner class was not defined.

Example: void mrb_example_gem_init(mrb_state* mrb) { struct RClass *example_outer, *example_inner; mrb_bool cd;

example_outer = mrb_define_module(mrb, "ExampleOuter");

example_inner = mrb_define_class_under(mrb, example_outer, "ExampleInner", mrb->object_class); cd = mrb_class_defined_under(mrb, example_outer, "ExampleInner");

// If mrb_class_defined_under returns 1 then puts "True" // If mrb_class_defined_under returns 0 then puts "False" if (cd == 1){ puts("True"); } else { puts("False"); } }

Parameters
mrbThe current mruby state.
outerThe name of the outer class.
nameA string representing the name of the inner class.
Returns
[mrb_bool] A boolean value.

Definition at line 607 of file class.c.

References FALSE, mrb_const_defined_at(), mrb_intern_check_cstr(), mrb_obj_value(), name, and sym.

◆ mrb_class_defined_under_id()

mrb_bool mrb_class_defined_under_id ( mrb_state mrb,
struct RClass outer,
mrb_sym  name 
)

Definition at line 615 of file class.c.

References mrb_const_defined_at(), mrb_obj_value(), and name.

◆ mrb_class_get()

struct RClass* mrb_class_get ( mrb_state mrb,
const char *  name 
)

Gets a class.

Parameters
mrbThe current mruby state.
nameThe name of the class.
Returns
[struct RClass *] A reference to the class.

Definition at line 633 of file class.c.

References mrb_class_get_under(), name, and mrb_state::object_class.

Referenced by compare_break_method(), method_unbind(), mrb_init_file(), mrb_kernel_method(), mrb_module_instance_method(), mrb_mruby_numeric_ext_gem_init(), mrb_mruby_range_ext_gem_init(), mrb_mruby_string_ext_gem_init(), mrb_stat0(), mrb_sys_fail(), obj_is_kind_of_checked(), and random_default().

◆ mrb_class_get_id()

◆ mrb_class_get_under()

struct RClass* mrb_class_get_under ( mrb_state mrb,
struct RClass outer,
const char *  name 
)

Gets a child class.

Parameters
mrbThe current mruby state.
outerThe name of the parent class.
nameThe name of the class.
Returns
[struct RClass *] A reference to the class.

Definition at line 621 of file class.c.

References class_from_sym(), mrb_intern_cstr, and name.

Referenced by mrb_class_get().

◆ mrb_class_get_under_id()

struct RClass* mrb_class_get_under_id ( mrb_state mrb,
struct RClass outer,
mrb_sym  name 
)

Definition at line 627 of file class.c.

References class_from_sym(), and name.

Referenced by domain_error(), io_set_process_status(), and mrb_class_get_id().

◆ mrb_class_inherited()

static void mrb_class_inherited ( mrb_state mrb,
struct RClass super,
struct RClass klass 
)
static

◆ mrb_class_initialize()

static mrb_value mrb_class_initialize ( mrb_state mrb,
mrb_value  c 
)
static

Definition at line 1954 of file class.c.

References a, b, c, mrb_class_ptr, mrb_get_args(), mrb_nil_p, and mrb_yield_with_class().

Referenced by mrb_class_new_class(), and mrb_init_class().

◆ mrb_class_name()

const char* mrb_class_name ( mrb_state mrb,
struct RClass c 
)

Definition at line 2102 of file class.c.

References c, class_name_str(), name, NULL, and RSTRING_PTR.

Referenced by compare_break_method(), method_to_s(), mrb_class_find_path(), and mrb_obj_classname().

◆ mrb_class_name_class()

◆ mrb_class_new()

struct RClass* mrb_class_new ( mrb_state mrb,
struct RClass super 
)

Creates a new class.

Parameters
supera class from which the new class derives.
Exceptions
TypeErrorsuper is not inheritable.
TypeErrorsuper is the Class class.

Definition at line 2144 of file class.c.

References boot_defclass(), c, make_metaclass, mrb_check_inheritable(), MRB_INSTANCE_TT, MRB_SET_INSTANCE_TT, and RClass::super.

Referenced by define_class(), make_struct(), and mrb_class_new_class().

◆ mrb_class_new_class()

◆ mrb_class_path()

mrb_value mrb_class_path ( mrb_state mrb,
struct RClass c 
)

◆ mrb_class_real()

struct RClass* mrb_class_real ( struct RClass cl)

◆ mrb_class_superclass()

static mrb_value mrb_class_superclass ( mrb_state mrb,
mrb_value  klass 
)
static

Definition at line 1990 of file class.c.

References c, find_origin(), mrb_class_ptr, mrb_nil_value(), mrb_obj_value(), MRB_TT_ICLASS, and RClass::super.

Referenced by mrb_init_class().

◆ mrb_const_get_sym()

static mrb_value mrb_const_get_sym ( mrb_state mrb,
mrb_value  mod,
mrb_sym  id 
)
static

Definition at line 2365 of file class.c.

References check_const_name_sym(), mod(), and mrb_const_get().

Referenced by mrb_mod_const_get().

◆ mrb_const_name_p()

mrb_bool mrb_const_name_p ( mrb_state mrb,
const char *  name,
mrb_int  len 
)

Definition at line 324 of file class.c.

References ISUPPER, len, mrb_ident_p(), and name.

Referenced by check_const_name_sym(), and make_struct().

◆ mrb_define_alias()

void mrb_define_alias ( mrb_state mrb,
struct RClass klass,
const char *  name1,
const char *  name2 
)

Defines an alias of a method.

Parameters
mrbthe mruby state
klassthe class which the original method belongs to
name1a new name for the method
name2the original name of the method

Definition at line 2226 of file class.c.

References mrb_alias_method(), and mrb_intern_cstr.

◆ mrb_define_alias_id()

void mrb_define_alias_id ( mrb_state mrb,
struct RClass klass,
mrb_sym  a,
mrb_sym  b 
)

Definition at line 2232 of file class.c.

References a, b, and mrb_alias_method().

◆ mrb_define_class()

struct RClass* mrb_define_class ( mrb_state mrb,
const char *  name,
struct RClass super 
)

Defines a new class.

If you're creating a gem it may look something like this:

 !!!c
 void mrb_example_gem_init(mrb_state* mrb) {
     struct RClass *example_class;
     example_class = mrb_define_class(mrb, "Example_Class", mrb->object_class);
 }

 void mrb_example_gem_final(mrb_state* mrb) {
     //free(TheAnimals);
 }
Parameters
mrbThe current mruby state.
nameThe name of the defined class.
superThe new class parent.
Returns
[struct RClass *] Reference to the newly defined class.
See also
mrb_define_class_under

Definition at line 525 of file class.c.

References mrb_define_class_id(), mrb_intern_cstr, name, and RClass::super.

Referenced by mrb_init_class().

◆ mrb_define_class_id()

struct RClass* mrb_define_class_id ( mrb_state mrb,
mrb_sym  name,
struct RClass super 
)

◆ mrb_define_class_method()

void mrb_define_class_method ( mrb_state mrb,
struct RClass cla,
const char *  name,
mrb_func_t  fun,
mrb_aspec  aspec 
)

Defines a class method.

Example:

# Ruby style
class Foo
  def Foo.bar
  end
end
// C style
mrb_value bar_method(mrb_state* mrb, mrb_value self){
  return mrb_nil_value();
}
void mrb_example_gem_init(mrb_state* mrb){
  struct RClass *foo;
  foo = mrb_define_class(mrb, "Foo", mrb->object_class);
  mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
}
Parameters
mrbThe MRuby state reference.
claThe class where the class method will be defined.
nameThe name of the class method being defined.
funThe function pointer to the class method definition.
aspecThe method parameters declaration.

Definition at line 1682 of file class.c.

References c, func, mrb_define_singleton_method(), and name.

Referenced by mrb_init_class().

◆ mrb_define_class_method_id()

void mrb_define_class_method_id ( mrb_state mrb,
struct RClass c,
mrb_sym  name,
mrb_func_t  func,
mrb_aspec  aspec 
)

Definition at line 1688 of file class.c.

References c, func, mrb_define_singleton_method_id(), and name.

Referenced by mrb_define_module_function_id().

◆ mrb_define_class_under()

struct RClass* mrb_define_class_under ( mrb_state mrb,
struct RClass outer,
const char *  name,
struct RClass super 
)

Defines a new class under a given module

Parameters
mrbThe current mruby state.
outerReference to the module under which the new class will be defined
nameThe name of the defined class
superThe new class parent
Returns
[struct RClass *] Reference to the newly defined class
See also
mrb_define_class

Definition at line 719 of file class.c.

References mrb_define_class_under_id(), mrb_intern_cstr, name, and RClass::super.

◆ mrb_define_class_under_id()

struct RClass* mrb_define_class_under_id ( mrb_state mrb,
struct RClass outer,
mrb_sym  name,
struct RClass super 
)

Defines a class under the namespace of outer.

Parameters
outera class which contains the new class.
namename of the new class
supera class from which the new class will derive. NULL means Object class.
Returns
the created class
Exceptions
TypeErrorif the constant name name is already taken but the constant is not a Class.
NameErrorif the class is already defined but the class can not be reopened because its superclass is not super.
Postcondition
top-level constant named name refers the returned class.
Note
if a class named name is already defined and its superclass is super, the function just returns the defined class.

Definition at line 704 of file class.c.

References c, define_class(), mrb_warn(), name, setup_class(), and RClass::super.

Referenced by mrb_define_class_under(), and mrb_mruby_math_gem_init().

◆ mrb_define_method()

void mrb_define_method ( mrb_state mrb,
struct RClass cla,
const char *  name,
mrb_func_t  func,
mrb_aspec  aspec 
)

Defines a global function in ruby.

If you're creating a gem it may look something like this

Example:

mrb_value example_method(mrb_state* mrb, mrb_value self)
{
     puts("Executing example command!");
     return self;
}

void mrb_example_gem_init(mrb_state* mrb)
{
      mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
}
Parameters
mrbThe MRuby state reference.
claThe class pointer where the method will be defined.
nameThe name of the method being defined.
funcThe function pointer to the method definition.
aspecThe method parameters declaration.

Definition at line 772 of file class.c.

References c, func, mrb_define_method_id(), mrb_intern_cstr, and name.

Referenced by mrb_init_class(), and mrb_mruby_class_ext_gem_init().

◆ mrb_define_method_id()

◆ mrb_define_method_raw()

◆ mrb_define_module()

struct RClass* mrb_define_module ( mrb_state mrb,
const char *  name 
)

Defines a new module.

Parameters
mrbThe current mruby state.
nameThe name of the module.
Returns
[struct RClass *] Reference to the newly defined module.

Definition at line 448 of file class.c.

References define_module(), mrb_intern_cstr, name, and mrb_state::object_class.

◆ mrb_define_module_function()

void mrb_define_module_function ( mrb_state mrb,
struct RClass cla,
const char *  name,
mrb_func_t  fun,
mrb_aspec  aspec 
)

Defines a module function.

Example:

   # Ruby style
   module Foo
     def Foo.bar
     end
   end
   // C style
   mrb_value bar_method(mrb_state* mrb, mrb_value self){
     return mrb_nil_value();
   }
   void mrb_example_gem_init(mrb_state* mrb){
     struct RClass *foo;
     foo = mrb_define_module(mrb, "Foo");
     mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
   }
Parameters
mrbThe MRuby state reference.
claThe module where the module function will be defined.
nameThe name of the module function being defined.
funThe function pointer to the module function definition.
aspecThe method parameters declaration.

Definition at line 1701 of file class.c.

References c, func, mrb_define_module_function_id(), mrb_intern_cstr, and name.

◆ mrb_define_module_function_id()

void mrb_define_module_function_id ( mrb_state mrb,
struct RClass c,
mrb_sym  name,
mrb_func_t  func,
mrb_aspec  aspec 
)

Definition at line 1694 of file class.c.

References c, func, mrb_define_class_method_id(), mrb_define_method_id(), and name.

Referenced by mrb_define_module_function().

◆ mrb_define_module_id()

struct RClass* mrb_define_module_id ( mrb_state mrb,
mrb_sym  name 
)

Definition at line 442 of file class.c.

References define_module(), name, and mrb_state::object_class.

◆ mrb_define_module_under()

struct RClass* mrb_define_module_under ( mrb_state mrb,
struct RClass outer,
const char *  name 
)

Definition at line 478 of file class.c.

References c, define_module(), mrb_intern_cstr, name, and setup_class().

◆ mrb_define_module_under_id()

struct RClass* mrb_define_module_under_id ( mrb_state mrb,
struct RClass outer,
mrb_sym  name 
)

Definition at line 469 of file class.c.

References c, define_module(), name, and setup_class().

Referenced by mrb_init_file().

◆ mrb_define_singleton_method()

void mrb_define_singleton_method ( mrb_state mrb,
struct RObject cla,
const char *  name,
mrb_func_t  fun,
mrb_aspec  aspec 
)

Defines a singleton method

See also
mrb_define_class_method

Definition at line 1668 of file class.c.

References RObject::c, func, mrb_define_method_id(), mrb_intern_cstr, name, and prepare_singleton_class().

Referenced by mrb_define_class_method(), and mrb_init_class().

◆ mrb_define_singleton_method_id()

void mrb_define_singleton_method_id ( mrb_state mrb,
struct RObject o,
mrb_sym  name,
mrb_func_t  func,
mrb_aspec  aspec 
)

Definition at line 1675 of file class.c.

References RObject::c, func, mrb_define_method_id(), name, and prepare_singleton_class().

Referenced by mrb_define_class_method_id().

◆ mrb_exc_get_id()

struct RClass* mrb_exc_get_id ( mrb_state mrb,
mrb_sym  name 
)

Gets a exception class.

Parameters
mrbThe current mruby state.
nameThe name of the class.
Returns
[struct RClass *] A reference to the class.

Definition at line 645 of file class.c.

References c, e, mrb_state::eException_class, mrb_class_p, mrb_class_ptr, mrb_const_get(), mrb_obj_value(), mrb_raise(), name, and mrb_state::object_class.

◆ mrb_f_send()

mrb_value mrb_f_send ( mrb_state mrb,
mrb_value  self 
)

Definition at line 533 of file vm.c.

Referenced by mrb_init_class().

◆ mrb_gc_free_mt()

void mrb_gc_free_mt ( mrb_state mrb,
struct RClass c 
)

Definition at line 288 of file class.c.

References c, and mt_free().

Referenced by obj_free().

◆ mrb_gc_mark_mt()

void mrb_gc_mark_mt ( mrb_state mrb,
struct RClass c 
)

Definition at line 258 of file class.c.

References c, i, mrb_gc_mark(), NULL, p, and slot.

Referenced by gc_mark_children().

◆ mrb_gc_mark_mt_size()

size_t mrb_gc_mark_mt_size ( mrb_state mrb,
struct RClass c 
)

Definition at line 279 of file class.c.

References c, and h.

Referenced by gc_gray_counts(), and os_memsize_of_object().

◆ mrb_get_arg1()

mrb_value mrb_get_arg1 ( mrb_state mrb)

Retrieve the first and only argument from mrb_state. Raises ArgumentError unless the number of arguments is exactly one.

Correctly handles *splat arguments.

Definition at line 840 of file class.c.

References a, mrb_callinfo::argc, argc, ARY_LEN, ARY_PTR, mrb_state::c, mrb_context::ci, mrb_argnum_error(), mrb_ary_ptr, and mrb_callinfo::stack.

Referenced by attr_writer(), complex_div(), exc_set_backtrace(), fiber_eq(), flo_and(), flo_divmod(), flo_eq(), flo_eql(), flo_minus(), flo_mod(), flo_mul(), flo_or(), flo_plus(), flo_pow(), flo_xor(), int_and(), int_divmod(), int_eql(), int_equal(), int_minus(), int_mod(), int_mul(), int_or(), int_plus(), int_pow(), int_xor(), method_eql(), mrb_ary_aget(), mrb_ary_assoc(), mrb_ary_cmp(), mrb_ary_eq(), mrb_ary_index_m(), mrb_ary_rassoc(), mrb_ary_rindex_m(), mrb_ary_slice_bang(), mrb_equal_m(), mrb_f_array(), mrb_f_float(), mrb_f_hash(), mrb_f_string(), mrb_file_truncate(), mrb_filetest_s_directory_p(), mrb_filetest_s_exist_p(), mrb_filetest_s_file_p(), mrb_filetest_s_pipe_p(), mrb_filetest_s_size(), mrb_filetest_s_size_p(), mrb_filetest_s_socket_p(), mrb_filetest_s_symlink_p(), mrb_filetest_s_zero_p(), mrb_hash_aget(), mrb_hash_delete(), mrb_hash_has_key(), mrb_hash_has_value(), mrb_hash_set_default(), mrb_hash_set_default_proc(), mrb_io_initialize_copy(), mrb_mod_const_get(), mrb_mod_eqq(), mrb_mod_extend_object(), mrb_obj_ceqq(), mrb_obj_equal_m(), mrb_obj_init_copy(), mrb_printstr(), mrb_proc_init_copy(), mrb_str_byteslice(), mrb_str_cmp_m(), mrb_str_concat_m(), mrb_str_eql(), mrb_str_equal_m(), mrb_struct_aref(), mrb_struct_eql(), mrb_struct_equal(), mrb_struct_init_copy(), mrb_struct_set_m(), mrb_time_cmp(), mrb_time_eq(), mrb_time_initialize_copy(), mrb_time_minus(), mrb_time_plus(), num_cmp(), num_ge(), num_gt(), num_le(), num_lt(), range_cover(), range_eq(), range_eql(), range_include(), range_initialize_copy(), sym_cmp(), and unbound_method_bind().

◆ mrb_get_argc()

mrb_int mrb_get_argc ( mrb_state mrb)

Retrieve number of arguments from mrb_state.

Correctly handles *splat arguments.

Definition at line 814 of file class.c.

References a, mrb_callinfo::argc, argc, ARY_LEN, mrb_state::c, mrb_context::ci, mrb_ary_ptr, and mrb_callinfo::stack.

Referenced by mrb_ary_aget(), mrb_ary_aset(), mrb_ary_first(), mrb_ary_push_m(), mrb_ary_slice_bang(), mrb_file__gethome(), and mrb_str_byteslice().

◆ mrb_get_args()

mrb_int mrb_get_args ( mrb_state mrb,
mrb_args_format  format,
  ... 
)

Retrieve arguments from mrb_state.

Parameters
mrbThe current MRuby state.
formatis a list of format specifiers
...The passing variadic arguments must be a pointer of retrieving type.
Returns
the number of arguments retrieved.
See also
mrb_args_format
mrb_kwargs

Definition at line 891 of file class.c.

References a, ap, mrb_callinfo::argc, argc, ARGV, argv, ARY_LEN, ARY_PTR, b, bp, mrb_state::c, c, mrb_context::ci, class_ptr_p(), const, E_ARGUMENT_ERROR, E_TYPE_ERROR, FALSE, fmt, format, i, j, k, kname(), mrb_argnum_error(), mrb_ary_new_from_values(), mrb_ary_ptr, mrb_class_ptr, mrb_data_get_ptr(), mrb_gc_protect(), mrb_hash_check_kdict(), mrb_hash_delete_key(), mrb_hash_dup(), mrb_hash_empty_p(), mrb_hash_key_p(), mrb_hash_keys(), mrb_hash_new(), mrb_hash_p, mrb_integer, mrb_istruct_p, mrb_istruct_ptr(), mrb_nil_p, mrb_nil_value(), mrb_raise(), mrb_raisef(), mrb_symbol_value(), mrb_test, mrb_to_flo(), mrb_to_int(), mrb_to_str(), mrb_undef_value(), NULL, mrb_kwargs::num, p, ps, RARRAY, RARRAY_PTR, icutools.databuilder.__main__::required, mrb_kwargs::required, rest, mrb_kwargs::rest, RSTRING_CSTR, RSTRING_LEN, RSTRING_PTR, mrb_callinfo::stack, strchr, mrb_kwargs::table, to_ary(), to_hash(), to_sym, TRUE, type, va_arg, va_end, va_start, gen-indic-table::values, and mrb_kwargs::values.

Referenced by aget_index(), coerce_step_counter(), complex_s_rect(), enum_update_hash(), exc_exception(), exc_initialize(), f_eval(), f_exit(), f_instance_eval(), false_or(), false_xor(), fiber_init(), fiber_resume(), fiber_transfer(), fiber_yield(), flo_div(), flo_idiv(), flo_lshift(), flo_round(), flo_rshift(), gc_generational_mode_set(), gc_interval_ratio_set(), gc_step_ratio_set(), get_opt(), hash_except(), hash_slice(), hash_values_at(), int_div(), int_lshift(), int_pow(), int_quo(), int_rshift(), int_to_s(), math_acos(), math_acosh(), math_asin(), math_asinh(), math_atan(), math_atan2(), math_atanh(), math_cbrt(), math_cos(), math_cosh(), math_erf(), math_erfc(), math_exp(), math_frexp(), math_hypot(), math_ldexp(), math_log(), math_log10(), math_log2(), math_sin(), math_sinh(), math_sqrt(), math_tan(), math_tanh(), method_bcall(), method_call(), mod_attr_define(), mrb_addrinfo_getaddrinfo(), mrb_addrinfo_getnameinfo(), mrb_ary_aget(), mrb_ary_aset(), mrb_ary_at(), mrb_ary_concat_m(), mrb_ary_delete_at(), mrb_ary_first(), mrb_ary_join_m(), mrb_ary_last(), mrb_ary_plus(), mrb_ary_replace_m(), mrb_ary_s_create(), mrb_ary_sample(), mrb_ary_shuffle_bang(), mrb_ary_slice_bang(), mrb_ary_times(), mrb_ary_unshift_m(), mrb_ary_values_at(), mrb_basicsocket_getsockopt(), mrb_basicsocket_recv(), mrb_basicsocket_recvfrom(), mrb_basicsocket_send(), mrb_basicsocket_set_is_socket(), mrb_basicsocket_setnonblock(), mrb_basicsocket_setsockopt(), mrb_basicsocket_shutdown(), mrb_class_initialize(), mrb_class_new_class(), mrb_f_caller(), mrb_f_integer(), mrb_f_raise(), mrb_f_send(), mrb_f_sleep(), mrb_f_sprintf(), mrb_f_usleep(), mrb_file__gethome(), mrb_file_basename(), mrb_file_dirname(), mrb_file_flock(), mrb_file_realpath(), mrb_file_s_chmod(), mrb_file_s_readlink(), mrb_file_s_rename(), mrb_file_s_symlink(), mrb_file_s_umask(), mrb_file_s_unlink(), mrb_hash_aset(), mrb_hash_default(), mrb_hash_init(), mrb_hash_init_copy(), mrb_instance_new(), mrb_int_allbits(), mrb_int_anybits(), mrb_int_chr(), mrb_int_nobits(), mrb_io_bufread(), mrb_io_initialize(), mrb_io_readchar(), mrb_io_s_popen_args(), mrb_io_s_select(), mrb_io_s_sysclose(), mrb_io_s_sysopen(), mrb_io_set_sync(), mrb_io_sysread(), mrb_io_sysseek(), mrb_io_syswrite(), mrb_ipsocket_ntop(), mrb_ipsocket_pton(), mrb_ipsocket_recvfrom(), mrb_kernel_method(), mrb_kernel_proc(), mrb_kpse_brace_expand(), mrb_kpse_find_file(), mrb_kpse_in_name_ok(), mrb_kpse_init_format(), mrb_kpse_init_prog(), mrb_kpse_make_tex(), mrb_kpse_maketex_option(), mrb_kpse_out_name_ok(), mrb_kpse_path_expand(), mrb_kpse_readable_file(), mrb_kpse_reset_program_name(), mrb_kpse_set_program_enabled(), mrb_kpse_set_program_name(), mrb_kpse_tex_hush(), mrb_kpse_var_expand(), mrb_kpse_var_value(), mrb_kpse_xputenv(), mrb_kpse_xputenv_int(), mrb_mod_alias(), mrb_mod_append_features(), mrb_mod_class_variables(), mrb_mod_const_defined(), mrb_mod_const_missing(), mrb_mod_const_set(), mrb_mod_constants(), mrb_mod_cvar_defined(), mrb_mod_cvar_get(), mrb_mod_cvar_set(), mrb_mod_define_method_m(), mrb_mod_include_p(), mrb_mod_initialize(), mrb_mod_instance_methods(), mrb_mod_method_defined(), mrb_mod_module_eval(), mrb_mod_module_exec(), mrb_mod_module_function(), mrb_mod_prepend_features(), mrb_mod_remove_const(), mrb_mod_remove_cvar(), mrb_mod_remove_method(), mrb_mod_undef(), mrb_module_instance_method(), mrb_obj_extend_m(), mrb_obj_instance_eval(), mrb_obj_instance_exec(), mrb_obj_is_kind_of_m(), mrb_obj_ivar_defined(), mrb_obj_ivar_get(), mrb_obj_ivar_set(), mrb_obj_methods_m(), mrb_obj_missing(), mrb_obj_private_methods(), mrb_obj_protected_methods(), mrb_obj_public_methods(), mrb_obj_remove_instance_variable(), mrb_obj_singleton_methods_m(), mrb_print(), mrb_proc_s_new(), mrb_ptexenc_enable_UPTEX(), mrb_ptexenc_fromDVI(), mrb_ptexenc_fromEUC(), mrb_ptexenc_fromJIS(), mrb_ptexenc_fromKUTEN(), mrb_ptexenc_fromSJIS(), mrb_ptexenc_fromUCS(), mrb_ptexenc_set_enc_string(), mrb_ptexenc_toDVI(), mrb_ptexenc_toJIS(), mrb_ptexenc_toUCS(), mrb_ptexenc_UCStoUTF8(), mrb_puts(), mrb_socket_accept(), mrb_socket_accept2(), mrb_socket_bind(), mrb_socket_connect(), mrb_socket_listen(), mrb_socket_sockaddr_family(), mrb_socket_sockaddr_un(), mrb_socket_socket(), mrb_socket_socketpair(), mrb_str_aref_m(), mrb_str_aset_m(), mrb_str_byteslice(), mrb_str_chomp_bang(), mrb_str_count(), mrb_str_del_prefix(), mrb_str_del_prefix_bang(), mrb_str_del_suffix(), mrb_str_del_suffix_bang(), mrb_str_delete(), mrb_str_delete_bang(), mrb_str_end_with(), mrb_str_getbyte(), mrb_str_include(), mrb_str_index_m(), mrb_str_init(), mrb_str_plus_m(), mrb_str_replace(), mrb_str_rindex(), mrb_str_setbyte(), mrb_str_split_m(), mrb_str_squeeze(), mrb_str_squeeze_bang(), mrb_str_start_with(), mrb_str_times(), mrb_str_to_i(), mrb_str_tr(), mrb_str_tr_bang(), mrb_str_tr_s(), mrb_str_tr_s_bang(), mrb_struct_aset(), mrb_struct_initialize(), mrb_struct_s_def(), mrb_struct_values_at(), mrb_time_at_m(), mrb_time_gm(), mrb_time_initialize(), mrb_time_local(), obj_is_instance_of(), obj_respond_to(), os_count_objects(), os_each_object(), os_memsize_of(), os_memsize_of_all(), prepare_tmpl(), proc_lambda(), range_initialize(), rational_m(), rational_s_new(), true_and(), and true_xor().

◆ mrb_get_argv()

const mrb_value* mrb_get_argv ( mrb_state mrb)

Retrieve an array of arguments from mrb_state.

Correctly handles *splat arguments.

Definition at line 827 of file class.c.

References a, mrb_callinfo::argc, argc, ARY_PTR, mrb_state::c, mrb_context::ci, mrb_ary_ptr, and mrb_callinfo::stack.

Referenced by mrb_ary_aset(), and mrb_ary_push_m().

◆ mrb_hash_check_kdict()

void mrb_hash_check_kdict ( mrb_state mrb,
mrb_value  self 
)

Definition at line 1156 of file hash.c.

References E_ARGUMENT_ERROR, entry, h_each, mrb_hash_ptr, mrb_raise(), and mrb_symbol_p.

Referenced by mrb_get_args().

◆ mrb_include_module()

void mrb_include_module ( mrb_state mrb,
struct RClass cla,
struct RClass included 
)

Include a module in another class or module. Equivalent to:

module B include A end

Parameters
mrbThe current mruby state.
claA reference to module or a class.
includedA reference to the module to be included.

Definition at line 1440 of file class.c.

References c, data, E_ARGUMENT_ERROR, find_origin(), fix_include_module(), include_module_at(), m, mrb_check_frozen(), MRB_FL_CLASS_IS_INHERITED, mrb_objspace_each_objects(), mrb_raise(), and MRB_TT_MODULE.

Referenced by mrb_init_io(), mrb_init_kernel(), mrb_mod_append_features(), mrb_mod_extend_object(), and mrb_mruby_time_gem_init().

◆ mrb_init_class()

◆ mrb_instance_alloc()

◆ mrb_instance_new()

mrb_value mrb_instance_new ( mrb_state mrb,
mrb_value  cv 
)

◆ mrb_mc_clear_by_class()

void mrb_mc_clear_by_class ( mrb_state mrb,
struct RClass c 
)

◆ mrb_method_search()

mrb_method_t mrb_method_search ( mrb_state mrb,
struct RClass c,
mrb_sym  mid 
)

Definition at line 1778 of file class.c.

References c, m, mrb_method_search_vm(), MRB_METHOD_UNDEF_P, and mrb_name_error().

Referenced by mrb_alias_method(), and mrb_mod_module_function().

◆ mrb_method_search_vm()

◆ mrb_mod_alias()

static mrb_value mrb_mod_alias ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2267 of file class.c.

References c, mod(), mrb_alias_method(), mrb_class_ptr, and mrb_get_args().

Referenced by mrb_init_class().

◆ mrb_mod_ancestors()

static mrb_value mrb_mod_ancestors ( mrb_state mrb,
mrb_value  self 
)
static

◆ mrb_mod_append_features()

static mrb_value mrb_mod_append_features ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1529 of file class.c.

References c, mod(), mrb_check_type(), mrb_class_ptr, mrb_get_args(), mrb_include_module(), and MRB_TT_MODULE.

Referenced by mrb_init_class().

◆ mrb_mod_attr_reader()

static mrb_value mrb_mod_attr_reader ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1871 of file class.c.

References attr_reader(), mod(), mod_attr_define(), and NULL.

Referenced by mrb_init_class().

◆ mrb_mod_attr_writer()

static mrb_value mrb_mod_attr_writer ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1887 of file class.c.

References attr_writer(), mod(), mod_attr_define(), and prepare_writer_name().

Referenced by mrb_init_class().

◆ mrb_mod_const_defined()

static mrb_value mrb_mod_const_defined ( mrb_state mrb,
mrb_value  mod 
)
static

◆ mrb_mod_const_get()

◆ mrb_mod_const_missing()

static mrb_value mrb_mod_const_missing ( mrb_state mrb,
mrb_value  mod 
)
static

◆ mrb_mod_const_set()

static mrb_value mrb_mod_const_set ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2410 of file class.c.

References check_const_name_sym(), id, mod(), mrb_const_set(), and mrb_get_args().

Referenced by mrb_init_class().

◆ mrb_mod_define_method_m()

◆ mrb_mod_dummy_visibility()

static mrb_value mrb_mod_dummy_visibility ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1622 of file class.c.

References mod().

Referenced by mrb_init_class().

◆ mrb_mod_dup()

static mrb_value mrb_mod_dup ( mrb_state mrb,
mrb_value  self 
)
static

Definition at line 2545 of file class.c.

References mod(), mrb_obj_clone(), mrb_obj_ptr, and MRB_UNSET_FROZEN_FLAG.

Referenced by mrb_init_class().

◆ mrb_mod_eqq()

static mrb_value mrb_mod_eqq ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2534 of file class.c.

References mod(), mrb_bool_value(), mrb_class_ptr, mrb_get_arg1(), and mrb_obj_is_kind_of().

Referenced by mrb_init_class().

◆ mrb_mod_extend_object()

static mrb_value mrb_mod_extend_object ( mrb_state mrb,
mrb_value  mod 
)
static

◆ mrb_mod_include_p()

static mrb_value mrb_mod_include_p ( mrb_state mrb,
mrb_value  mod 
)
static

◆ mrb_mod_initialize()

static mrb_value mrb_mod_initialize ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1606 of file class.c.

References b, boot_initmod(), m, mod(), mrb_class_ptr, mrb_get_args(), mrb_nil_p, and mrb_yield_with_class().

Referenced by mrb_init_class().

◆ mrb_mod_method_defined()

static mrb_value mrb_mod_method_defined ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2481 of file class.c.

References id, mod(), mrb_bool_value(), mrb_class_ptr, mrb_get_args(), and mrb_obj_respond_to().

Referenced by mrb_init_class().

◆ mrb_mod_module_eval()

mrb_value mrb_mod_module_eval ( mrb_state mrb,
mrb_value  mod 
)

Definition at line 627 of file vm.c.

References a, b, E_NOTIMP_ERROR, eval_under(), mod(), mrb_class_ptr, mrb_get_args(), and mrb_raise().

Referenced by mrb_init_class().

◆ mrb_mod_module_function()

◆ mrb_mod_prepend_features()

static mrb_value mrb_mod_prepend_features ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 1518 of file class.c.

References c, mod(), mrb_check_type(), mrb_class_ptr, mrb_get_args(), mrb_prepend_module(), and MRB_TT_MODULE.

Referenced by mrb_init_class().

◆ mrb_mod_remove_const()

static mrb_value mrb_mod_remove_const ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2422 of file class.c.

References check_const_name_sym(), id, mod(), mrb_get_args(), mrb_iv_remove(), mrb_name_error(), mrb_undef_p, and val.

Referenced by mrb_init_class().

◆ mrb_mod_to_s()

◆ mrb_mod_undef()

static mrb_value mrb_mod_undef ( mrb_state mrb,
mrb_value  mod 
)
static

Definition at line 2326 of file class.c.

References argc, argv, c, mod(), mrb_class_ptr, mrb_get_args(), mrb_nil_value(), mrb_undef_method_id(), and to_sym.

Referenced by mrb_init_class().

◆ mrb_module_get()

struct RClass* mrb_module_get ( mrb_state mrb,
const char *  name 
)

Gets a module.

Parameters
mrbThe current mruby state.
nameThe name of the module.
Returns
[struct RClass *] A reference to the module.

Definition at line 676 of file class.c.

References mrb_module_get_under(), name, and mrb_state::object_class.

Referenced by mrb_init_io(), mrb_mruby_os_memsize_gem_init(), and mrb_mruby_time_gem_init().

◆ mrb_module_get_id()

struct RClass* mrb_module_get_id ( mrb_state mrb,
mrb_sym  name 
)

Definition at line 682 of file class.c.

References mrb_module_get_under_id(), name, and mrb_state::object_class.

Referenced by domain_error(), and io_set_process_status().

◆ mrb_module_get_under()

struct RClass* mrb_module_get_under ( mrb_state mrb,
struct RClass outer,
const char *  name 
)

Gets a module defined under another module.

Parameters
mrbThe current mruby state.
outerThe name of the outer module.
nameThe name of the module.
Returns
[struct RClass *] A reference to the module.

Definition at line 664 of file class.c.

References module_from_sym(), mrb_intern_cstr, and name.

Referenced by mrb_module_get().

◆ mrb_module_get_under_id()

struct RClass* mrb_module_get_under_id ( mrb_state mrb,
struct RClass outer,
mrb_sym  name 
)

Definition at line 670 of file class.c.

References module_from_sym(), and name.

Referenced by mrb_module_get_id().

◆ mrb_module_new()

struct RClass* mrb_module_new ( mrb_state mrb)

Creates a new module.

Definition at line 2164 of file class.c.

References boot_initmod(), m, mrb_state::module_class, mrb_obj_alloc(), and MRB_TT_MODULE.

Referenced by define_module().

◆ mrb_mt_foreach()

void mrb_mt_foreach ( mrb_state mrb,
struct RClass c,
mrb_mt_foreach_func fn,
void p 
)

Definition at line 225 of file class.c.

References c, fc-lang::fn, i, m, MRB_METHOD_FROM_FUNC, MRB_METHOD_FROM_PROC, MRB_METHOD_NOARG_SET, NULL, p, and slot.

Referenced by method_entry_loop().

◆ mrb_notimplement()

void mrb_notimplement ( mrb_state mrb)

Definition at line 779 of file class.c.

References mrb_state::c, mrb_context::ci, E_NOTIMP_ERROR, mrb_callinfo::mid, and mrb_raisef().

Referenced by mrb_notimplement_m().

◆ mrb_notimplement_m()

mrb_value mrb_notimplement_m ( mrb_state mrb,
mrb_value  self 
)

Definition at line 790 of file class.c.

References mrb_nil_value(), and mrb_notimplement().

◆ mrb_obj_class()

◆ mrb_obj_classname()

const char* mrb_obj_classname ( mrb_state mrb,
mrb_value  obj 
)

◆ mrb_obj_clone()

◆ mrb_obj_dup()

mrb_value mrb_obj_dup ( mrb_state mrb,
mrb_value  obj 
)

Duplicate an object.

Equivalent to: Object::dup

Parameters
mrbThe current mruby state.
objObject to be duplicate.
Returns
[mrb_value] The newly duplicated object.

Definition at line 2767 of file class.c.

References dup(), E_TYPE_ERROR, init_copy(), mrb_immediate_p, mrb_obj_alloc(), mrb_obj_class(), mrb_obj_value(), mrb_raise(), mrb_sclass_p, mrb_type(), and p.

Referenced by copy_class(), and mrb_init_kernel().

◆ mrb_obj_equal_m()

mrb_value mrb_obj_equal_m ( mrb_state mrb,
mrb_value  self 
)

Definition at line 2047 of file class.c.

References mrb_bool_value(), mrb_get_arg1(), and mrb_obj_equal().

Referenced by mrb_init_class(), and mrb_init_kernel().

◆ mrb_obj_id_m()

mrb_value mrb_obj_id_m ( mrb_state mrb,
mrb_value  self 
)

Definition at line 98 of file kernel.c.

References mrb_int_value(), and mrb_obj_id().

Referenced by mrb_init_class(), and mrb_init_kernel().

◆ mrb_obj_init_copy()

static mrb_value mrb_obj_init_copy ( mrb_state mrb,
mrb_value  self 
)
static

Definition at line 2656 of file class.c.

References E_TYPE_ERROR, mrb_get_arg1(), mrb_obj_class(), mrb_obj_equal(), mrb_raise(), and mrb_type().

Referenced by init_copy().

◆ mrb_obj_instance_eval()

mrb_value mrb_obj_instance_eval ( mrb_state mrb,
mrb_value  self 
)

Definition at line 659 of file vm.c.

Referenced by mrb_init_class().

◆ mrb_obj_new()

mrb_value mrb_obj_new ( mrb_state mrb,
struct RClass c,
mrb_int  argc,
const mrb_value argv 
)

Initialize a new object instance of c class.

Example:

# Ruby style
class ExampleClass
end

p ExampleClass # => #<ExampleClass:0x9958588>
// C style
#include <stdio.h>
#include <mruby.h>

void
mrb_example_gem_init(mrb_state* mrb) {
  struct RClass *example_class;
  mrb_value obj;
  example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class); # => class ExampleClass; end
  obj = mrb_obj_new(mrb, example_class, 0, NULL); # => ExampleClass.new
  mrb_p(mrb, obj); // => Kernel#p
 }
Parameters
mrbThe current mruby state.
cReference to the class of the new object.
argcNumber of arguments in argv
argvArray of mrb_value to initialize the object
Returns
[mrb_value] The newly initialized object

Definition at line 1940 of file class.c.

References argc, argv, c, initialize(), mrb_bob_init(), mrb_func_basic_p(), mrb_funcall_argv(), mrb_instance_alloc(), mrb_obj_value(), and MRB_SYM.

Referenced by mrb_class_new_instance(), mrb_exc_new(), mrb_exc_new_str(), mrb_mruby_random_gem_init(), mrb_no_method_error(), and raise_va().

◆ mrb_obj_respond_to()

mrb_bool mrb_obj_respond_to ( mrb_state mrb,
struct RClass c,
mrb_sym  mid 
)

Returns true if obj responds to the given method. If the method was defined for that class it returns true, it returns false otherwise.

 Example:
 # Ruby style
 class ExampleClass
   def example_method
   end
 end

 ExampleClass.new.respond_to?(:example_method) # => true

 // C style
 void
 mrb_example_gem_init(mrb_state* mrb) {
   struct RClass *example_class;
   mrb_sym mid;
   mrb_bool obj_resp;

   example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
   mrb_define_method(mrb, example_class, "example_method", exampleMethod, MRB_ARGS_NONE());
   mid = mrb_intern_str(mrb, mrb_str_new_lit(mrb, "example_method" ));
   obj_resp = mrb_obj_respond_to(mrb, example_class, mid); // => 1(true in Ruby world)

   // If mrb_obj_respond_to returns 1 then puts "True"
   // If mrb_obj_respond_to returns 0 then puts "False"
   if (obj_resp == 1) {
     puts("True");
   }
   else if (obj_resp == 0) {
     puts("False");
   }
 }
Parameters
mrbThe current mruby state.
cA reference to a class.
midA symbol referencing a method id.
Returns
[mrb_bool] A boolean value.

Definition at line 2055 of file class.c.

References c, FALSE, m, mrb_method_search_vm(), MRB_METHOD_UNDEF_P, and TRUE.

Referenced by mrb_mod_method_defined(), mrb_respond_to(), and mrb_undef_method_id().

◆ mrb_prepend_module()

void mrb_prepend_module ( mrb_state mrb,
struct RClass cla,
struct RClass prepended 
)

Prepends a module in another class or module.

Equivalent to: module B prepend A end

Parameters
mrbThe current mruby state.
claA reference to module or a class.
prependedA reference to the module to be prepended.

Definition at line 1481 of file class.c.

References c, data, E_ARGUMENT_ERROR, fix_prepend_module(), include_module_at(), RClass::iv, m, mrb_check_frozen(), mrb_field_write_barrier(), MRB_FL_CLASS_IS_INHERITED, MRB_FL_CLASS_IS_ORIGIN, MRB_FL_CLASS_IS_PREPENDED, mrb_obj_alloc(), mrb_objspace_each_objects(), mrb_raise(), MRB_TT_ICLASS, MRB_TT_MODULE, RClass::mt, NULL, and RClass::super.

Referenced by mrb_mod_prepend_features().

◆ mrb_remove_method()

void mrb_remove_method ( mrb_state mrb,
struct RClass c,
mrb_sym  mid 
)

Definition at line 2314 of file class.c.

References c, h, MRB_CLASS_ORIGIN, mrb_name_error(), and mt_del().

Referenced by mrb_mod_remove_method().

◆ mrb_respond_to()

mrb_bool mrb_respond_to ( mrb_state mrb,
mrb_value  obj,
mrb_sym  mid 
)

◆ mrb_singleton_class()

◆ mrb_singleton_class_clone()

◆ mrb_singleton_class_ptr()

◆ mrb_undef_class_method()

void mrb_undef_class_method ( mrb_state mrb,
struct RClass cls,
const char *  name 
)

Undefine a class method. Example:

 # Ruby style
 class ExampleClass
   def self.example_method
     "example"
   end
 end

ExampleClass.example_method

// C style
#include <stdio.h>
#include <mruby.h>

mrb_value
mrb_example_method(mrb_state *mrb){
  return mrb_str_new_lit(mrb, "example");
}

void
mrb_example_gem_init(mrb_state* mrb){
  struct RClass *example_class;
  example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
  mrb_define_class_method(mrb, example_class, "example_method", mrb_example_method, MRB_ARGS_NONE());
  mrb_undef_class_method(mrb, example_class, "example_method");
 }

 void
 mrb_example_gem_final(mrb_state* mrb){
 }
Parameters
mrbThe mruby state reference.
clsA class the class method will be undefined from.
nameThe name of the class method to be undefined.

Definition at line 2308 of file class.c.

References c, mrb_class_ptr, mrb_obj_value(), mrb_singleton_class(), mrb_undef_method(), and name.

Referenced by mrb_init_numeric(), mrb_init_object(), mrb_init_symbol(), mrb_mruby_complex_gem_init(), mrb_mruby_method_gem_init(), and mrb_mruby_rational_gem_init().

◆ mrb_undef_class_method_id()

void mrb_undef_class_method_id ( mrb_state mrb,
struct RClass c,
mrb_sym  name 
)

Definition at line 2302 of file class.c.

References c, mrb_class_ptr, mrb_obj_value(), mrb_singleton_class(), mrb_undef_method_id(), and name.

◆ mrb_undef_method()

void mrb_undef_method ( mrb_state mrb,
struct RClass cla,
const char *  name 
)

Undefines a method.

Example:

# Ruby style

class ExampleClassA
  def example_method
    "example"
  end
end
ExampleClassA.new.example_method # => example

class ExampleClassB < ExampleClassA
  undef_method :example_method
end

ExampleClassB.new.example_method # => undefined method 'example_method' for ExampleClassB (NoMethodError)

// C style
#include <stdio.h>
#include <mruby.h>

mrb_value
mrb_example_method(mrb_state *mrb){
  return mrb_str_new_lit(mrb, "example");
}

void
mrb_example_gem_init(mrb_state* mrb){
  struct RClass *example_class_a;
  struct RClass *example_class_b;
  struct RClass *example_class_c;

  example_class_a = mrb_define_class(mrb, "ExampleClassA", mrb->object_class);
  mrb_define_method(mrb, example_class_a, "example_method", mrb_example_method, MRB_ARGS_NONE());
  example_class_b = mrb_define_class(mrb, "ExampleClassB", example_class_a);
  example_class_c = mrb_define_class(mrb, "ExampleClassC", example_class_b);
  mrb_undef_method(mrb, example_class_c, "example_method");
}

mrb_example_gem_final(mrb_state* mrb){
}
Parameters
mrbThe mruby state reference.
claThe class the method will be undefined from.
nameThe name of the method to be undefined.

Definition at line 2296 of file class.c.

References c, mrb_intern_cstr, name, and undef_method().

Referenced by mrb_init_class(), and mrb_undef_class_method().

◆ mrb_undef_method_id()

void mrb_undef_method_id ( mrb_state mrb,
struct RClass c,
mrb_sym  a 
)

Definition at line 2287 of file class.c.

References a, c, mrb_name_error(), mrb_obj_respond_to(), and undef_method().

Referenced by mrb_mod_undef(), mrb_undef_class_method_id(), and mrb_vm_exec().

◆ mrb_vm_define_class()

◆ mrb_vm_define_module()

struct RClass* mrb_vm_define_module ( mrb_state mrb,
mrb_value  outer,
mrb_sym  id 
)

◆ mt_copy()

static struct mt_tbl* mt_copy ( mrb_state mrb,
mt_tbl t 
)
static

Definition at line 196 of file class.c.

References i, mt_new(), mt_put(), NULL, slot, and t2.

Referenced by copy_class(), and mrb_singleton_class_clone().

◆ mt_del()

static mrb_bool mt_del ( mrb_state mrb,
mt_tbl t,
mrb_sym  sym 
)
static

Definition at line 165 of file class.c.

References FALSE, hash, kh_int_hash_func, NULL, pos, slot, slot_empty_p, start, sym, and TRUE.

Referenced by mrb_remove_method().

◆ mt_free()

static void mt_free ( mrb_state mrb,
mt_tbl t 
)
static

Definition at line 218 of file class.c.

References mrb_free().

Referenced by mrb_gc_free_mt().

◆ mt_get()

static struct mt_elem* mt_get ( mrb_state mrb,
mt_tbl t,
mrb_sym  sym 
)
static

Definition at line 137 of file class.c.

References hash, kh_int_hash_func, NULL, pos, slot, slot_empty_p, start, and sym.

Referenced by mrb_method_search_vm().

◆ mt_new()

◆ mt_put()

static struct mt_elem * mt_put ( mrb_state mrb,
mt_tbl t,
mrb_sym  sym,
size_t  func_p,
size_t  noarg_p,
union mt_ptr  ptr 
)
static

Definition at line 86 of file class.c.

References mt_elem::func_p, hash, kh_int_hash_func, mt_rehash(), mt_elem::noarg_p, NULL, pos, ptr, slot, start, and sym.

Referenced by mrb_define_method_raw(), mt_copy(), and mt_rehash().

◆ mt_rehash()

static void mt_rehash ( mrb_state mrb,
mt_tbl t 
)
static

Definition at line 58 of file class.c.

References i, khash_power2, mrb_calloc(), mrb_free(), mt_put(), and slot.

Referenced by mt_put().

◆ prepare_ivar_name()

static mrb_value prepare_ivar_name ( mrb_state mrb,
mrb_sym  sym 
)
static

Definition at line 1820 of file class.c.

References mrb_iv_name_sym_check(), mrb_symbol_value(), NULL, prepare_name_common(), and sym.

Referenced by mod_attr_define().

◆ prepare_name_common()

static mrb_sym prepare_name_common ( mrb_state mrb,
mrb_sym  sym,
const char *  prefix,
const char *  suffix 
)
static

◆ prepare_singleton_class()

◆ prepare_writer_name()

static mrb_sym prepare_writer_name ( mrb_state mrb,
mrb_sym  sym 
)
static

Definition at line 1828 of file class.c.

References NULL, prepare_name_common(), and sym.

Referenced by mrb_mod_attr_writer().

◆ setup_class()

static void setup_class ( mrb_state mrb,
struct RClass outer,
struct RClass c,
mrb_sym  id 
)
static

◆ to_ary()

static mrb_value to_ary ( mrb_state mrb,
mrb_value  val 
)
static

Definition at line 798 of file class.c.

References mrb_check_type(), MRB_TT_ARRAY, and val.

Referenced by mrb_get_args().

◆ to_hash()

static mrb_value to_hash ( mrb_state mrb,
mrb_value  val 
)
static

Definition at line 805 of file class.c.

References mrb_check_type(), MRB_TT_HASH, and val.

Referenced by mrb_get_args().

◆ top_define_method()

static mrb_value top_define_method ( mrb_state mrb,
mrb_value  self 
)
static

Definition at line 2528 of file class.c.

References mrb_mod_define_method_m(), and mrb_state::object_class.

Referenced by mrb_init_class().

◆ undef_method()

static void undef_method ( mrb_state mrb,
struct RClass c,
mrb_sym  a 
)
static

Definition at line 2278 of file class.c.

References a, c, m, mrb_define_method_raw(), MRB_METHOD_FROM_PROC, and NULL.

Referenced by mrb_undef_method(), and mrb_undef_method_id().

Variable Documentation

◆ new_irep

const mrb_irep new_irep
static
Initial value:
= {
3, 6, 0, ( 1 | 2 ) ,
sizeof(new_iseq), 0, 2, 0, 0,
}
#define NULL
Definition: ftobjs.h:61
static const mrb_sym new_syms[]
Definition: class.c:2807
static const mrb_code new_iseq[]
Definition: class.c:2796

Definition at line 2809 of file class.c.

Referenced by init_class_new().

◆ new_iseq

const mrb_code new_iseq[]
static
Initial value:
= {
OP_ENTER, 0x0, 0x10, 0x1,
OP_LOADSELF, 0x3,
OP_SEND, 0x3, 0x0, 0x0,
OP_MOVE, 0x0, 0x3,
OP_MOVE, 0x4, 0x1,
OP_MOVE, 0x5, 0x2,
OP_SENDVB, 0x3, 0x1,
OP_RETURN, 0x0
}
@ OP_RETURN
Definition: lopcodes.h:218
@ OP_MOVE
Definition: lopcodes.h:171

Definition at line 2796 of file class.c.

◆ new_syms

const mrb_sym new_syms[] = { MRB_SYM__allocate , MRB_SYM__initialize }
static

Definition at line 2807 of file class.c.

Referenced by init_class_new().