Class related functions. More...
Go to the source code of this file.
Data Structures | |
| struct | RClass |
| Class object. More... | |
| struct | RBuiltinClass |
| Built-in class object. More... | |
| struct | RBuiltinNoMethodClass |
| Built-in No method class object. More... | |
| struct | RInstance |
| Instance object. More... | |
| struct | RMethod |
| Method management structure. More... | |
| struct | MRBC_DEFINE_METHOD_LIST |
| for mrbc_define_method_list function. More... | |
Macros | |
| #define | MRBC_TRAVERSE_NEST_LEVEL 3 |
| #define | MRBC_CLASS(cls) |
| #define | MRBC_INSTANCE_DATA_PTR(v, t) |
| #define | mrbc_class_object ((struct RClass*)(&mrbc_class_Object)) |
Typedefs | |
| typedef struct RClass | mrbc_class |
| Class object. | |
| typedef struct RClass | mrb_class |
| typedef struct RInstance | mrbc_instance |
| Instance object. | |
| typedef struct RInstance | mrb_instance |
| typedef struct RMethod | mrbc_method |
| Method management structure. | |
Functions | |
| static mrbc_class * | find_class_by_object (const mrbc_value *obj) |
| static void | mrbc_define_destructor (mrbc_class *cls, void(*destructor)(mrbc_value *)) |
| static mrbc_value * | mrbc_instance_getiv_p (mrbc_value *obj, mrbc_sym sym_id) |
| static void | mrbc_define_method_list (struct VM *vm, mrbc_class *cls, const struct MRBC_DEFINE_METHOD_LIST list[], int list_size) |
Variables | |
| struct RClass *const | mrbc_class_tbl [] |
Class related functions.
Copyright (C) 2015- Kyushu Institute of Technology. Copyright (C) 2015- Shimane IT Open-Innovation Center. This file is distributed under BSD 3-Clause License.
Definition in file class.h.
| #define MRBC_CLASS | ( | cls | ) |
Get a built-in class (pointer)
| cls | Class name. (e.g. Array) |
Example
| #define mrbc_class_object ((struct RClass*)(&mrbc_class_Object)) |
| #define MRBC_INSTANCE_DATA_PTR | ( | v, | |
| t ) |
Get a pointer to mrbc_instance->data converted to specified type.
| v | Pointer to mrbc_instance. |
| t | Type of return pointer. |
Example
| typedef struct RInstance mrb_instance |
| typedef struct RClass mrbc_class |
Class object.
| typedef struct RInstance mrbc_instance |
Instance object.
| typedef struct RMethod mrbc_method |
Method management structure.
|
inlinestatic |
find class by object
| obj | pointer to object |
Definition at line 235 of file class.h.
|
inlinestatic |
Define the destructor
| cls | class. |
| destructor | destructor. |
Define the destructor. This function can only be defined for destruction of mrbc_instance.
|
inlinestatic |
define method by method list.
| vm | dummy. |
| cls | target class. |
| list | method list. |
| list_size | size of method list. |
Code example
This function is used to define multiple methods at once. It is useful for defining many methods.
Definition at line 311 of file class.h.
|
inlinestatic |
|
extern |