Ruby: class.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Functions
class.c File Reference
`#include "ruby/internal/config.h"`
`#include <ctype.h>`
`#include "gc.h"`
`#include "constant.h"`
`#include "id_table.h"`
`#include "internal.h"`
`#include "internal/class.h"`
`#include "internal/eval.h"`
`#include "internal/hash.h"`
`#include "internal/object.h"`
`#include "internal/string.h"`
`#include "internal/variable.h"`
`#include "ruby/st.h"`
`#include "vm_core.h"`

Go to the source code of this file.

## Data Structures
struct | clone_method_arg
struct | clone_const_arg
struct | method_entry_arg
struct | rb_scan_args_t

## Macros
#define | id_attached id__attached__
#define | METACLASS_OF(k) RBASIC(k)->klass
#define | SET_METACLASS_OF(k, cls) RBASIC_SET_CLASS(k, cls)
#define | META_CLASS_OF_CLASS_CLASS_P(k) (METACLASS_OF(k) == (k))
| whether k is a meta^(n)-class of Class class More...
#define | HAVE_METACLASS_P(k)
| whether k has a metaclass More...
#define | ENSURE_EIGENCLASS(klass) (HAVE_METACLASS_P(klass) ? METACLASS_OF(klass) : make_metaclass(klass))
| ensures klass belongs to its own eigenclass. More...
#define | extract_kwarg(keyword, val)
#define | rb_scan_args_next_param() va_arg(vargs, VALUE *)

## Functions
void | rb_class_subclass_add (VALUE super, VALUE klass)
void | rb_class_remove_from_super_subclasses (VALUE klass)
void | rb_class_remove_from_module_subclasses (VALUE klass)
void | rb_class_foreach_subclass (VALUE klass, void(*f)(VALUE, VALUE), VALUE arg)
void | rb_class_detach_subclasses (VALUE klass)
void | rb_class_detach_module_subclasses (VALUE klass)
VALUE | rb_class_boot (VALUE super)
| A utility function that wraps class_alloc. More...
void | rb_check_inheritable (VALUE super)
| Ensures a class can be derived from super. More...
VALUE | rb_class_new (VALUE super)
| Creates a new class. More...
VALUE | rb_mod_init_copy (VALUE clone, VALUE orig)
VALUE | rb_singleton_class_clone (VALUE obj)
VALUE | rb_singleton_class_clone_and_attach (VALUE obj, VALUE attach)
void | rb_singleton_class_attached (VALUE klass, VALUE obj)
| Attach a object to a singleton class. More...
int | rb_singleton_class_internal_p (VALUE sklass)
void | Init_class_hierarchy (void)
VALUE | rb_make_metaclass (VALUE obj, VALUE unused)
VALUE | rb_define_class_id (ID id, VALUE super)
| Defines a new class. More...
VALUE | rb_class_inherited (VALUE super, VALUE klass)
| Calls Class::inherited. More...
VALUE | rb_define_class (const char *name, VALUE super)
| Defines a top-level class. More...
VALUE | rb_define_class_under (VALUE outer, const char *name, VALUE super)
| Defines a class under the namespace of outer. More...
VALUE | rb_define_class_id_under (VALUE outer, ID id, VALUE super)
| Defines a class under the namespace of outer. More...
VALUE | rb_module_new (void)
VALUE | rb_define_module_id (ID id)
VALUE | rb_define_module (const char *name)
VALUE | rb_define_module_under (VALUE outer, const char *name)
VALUE | rb_define_module_id_under (VALUE outer, ID id)
VALUE | rb_include_class_new (VALUE module, VALUE super)
void | rb_include_module (VALUE klass, VALUE module)
void | rb_prepend_module (VALUE klass, VALUE module)
VALUE | rb_mod_included_modules (VALUE mod)
VALUE | rb_mod_include_p (VALUE mod, VALUE mod2)
VALUE | rb_mod_ancestors (VALUE mod)
VALUE | rb_class_instance_methods (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_class_protected_instance_methods (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_class_private_instance_methods (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_class_public_instance_methods (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_obj_methods (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_obj_protected_methods (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_obj_private_methods (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_obj_public_methods (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_obj_singleton_methods (int argc, const VALUE *argv, VALUE obj)
void | rb_define_method_id (VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc)
void | rb_define_method (VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void | rb_define_protected_method (VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void | rb_define_private_method (VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void | rb_undef_method (VALUE klass, const char *name)
void | rb_undef_methods_from (VALUE klass, VALUE super)
VALUE | rb_special_singleton_class (VALUE obj)
void | rb_freeze_singleton_class (VALUE x)
VALUE | rb_singleton_class_get (VALUE obj)
| Returns the singleton class of obj, or nil if obj is not a singleton object. More...
VALUE | rb_singleton_class (VALUE obj)
| Returns the singleton class of obj. More...
void | rb_define_singleton_method (VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
| Defines a singleton method for obj. More...
void | rb_define_module_function (VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
| Defines a module function for module. More...
void | rb_define_global_function (const char *name, VALUE(*func)(ANYARGS), int argc)
| Defines a global function. More...
void | rb_define_alias (VALUE klass, const char *name1, const char *name2)
| Defines an alias of a method. More...
void | rb_define_attr (VALUE klass, const char *name, int read, int write)
| Defines (a) public accessor method(s) for an attribute. More...
VALUE | rb_keyword_error_new (const char *error, VALUE keys)
VALUE | rb_extract_keywords (VALUE *orighash)
int | rb_get_kwargs (VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
int | rb_scan_args (int argc, const VALUE *argv, const char *fmt,...)
int | rb_scan_args_kw (int kw_flag, int argc, const VALUE *argv, const char *fmt,...)
int | rb_class_has_methods (VALUE c)

## Macro Definition Documentation

## ◆ extract_kwarg

#define extract_kwarg | ( |  | keyword,
|  |  | val
| ) |  |

Value:
(key = (st_data_t)(keyword), values ? \
(rb_hash_stlike_delete(keyword_hash, &key, &(val)) || ((val) = Qundef, 0)) : \
rb_hash_stlike_lookup(keyword_hash, key, NULL))
rb_hash_stlike_delete
int rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval)
Definition: hash.c:2293
rb_hash_stlike_lookup
int rb_hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval)
Definition: hash.c:2026
key
key
Definition: openssl_missing.h:185
NULL
#define NULL
Definition: regenc.h:69
Qundef
#define Qundef
Definition: special_consts.h:53
st_data_t
unsigned long st_data_t
Definition: st.h:22

## ◆ rb_scan_args_next_param

#define rb_scan_args_next_param | ( |  | ) | va_arg(vargs, VALUE *)