Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Functions
class.c File Reference
#include "internal.h"
#include "ruby/st.h"
#include "constant.h"
#include "vm_core.h"
#include "id_table.h"
#include <ctype.h>

Go to the source code of this file.

Data Structures

struct  clone_method_arg
 
struct  clone_const_arg
 
struct  method_entry_arg
 

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 SPECIAL_SINGLETON(x, c)
 
#define extract_kwarg(keyword, val)
 

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)
 
 NORETURN (static void rb_keyword_error(const char *error, VALUE keys))
 
 NORETURN (static void unknown_keyword_error(VALUE hash, const ID *table, int keywords))
 
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_class_has_methods (VALUE c)
 

Macro Definition Documentation

◆ extract_kwarg

#define extract_kwarg (   keyword,
  val 
)
Value:
(key = (st_data_t)(keyword), values ? \
st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val)) : \
st_lookup(rb_hash_tbl_raw(keyword_hash), key, (val)))
struct st_table * rb_hash_tbl_raw(VALUE hash)
Definition: hash.c:482
#define st_lookup
Definition: regint.h:185
RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
Definition: st.h:22
#define val

Referenced by rb_get_kwargs().