Ruby  1.9.3p551(2014-11-13revision48407)
Data Structures | Macros | Functions | Variables
class.c File Reference
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "method.h"
#include "constant.h"
#include "vm_core.h"
#include "internal.h"
#include <ctype.h>
#include <stdarg.h>

Go to the source code of this file.

Data Structures

struct  clone_method_data
 

Macros

#define METACLASS_OF(k)   RBASIC(k)->klass
 
#define META_CLASS_OF_CLASS_CLASS_P(k)   (METACLASS_OF(k) == (k))
 whether k is a meta^(n)-class of Class class More...
 
#define ENSURE_EIGENCLASS(klass)   (rb_ivar_get(METACLASS_OF(klass), id_attached) == (klass) ? METACLASS_OF(klass) : make_metaclass(klass))
 ensures klass belongs to its own eigenclass. More...
 
#define VISI(x)   ((x)&NOEX_MASK)
 
#define VISI_CHECK(x, f)   (VISI(x) == (f))
 
#define SPECIAL_SINGLETON(x, c)
 

Functions

static VALUE class_alloc (VALUE flags, VALUE klass)
 Allocates a struct RClass for a new class. More...
 
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_iseq_clone (VALUE iseqval, VALUE newcbase)
 
static int clone_method (ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
 
static int clone_const (ID key, const rb_const_entry_t *ce, st_table *tbl)
 
static int clone_const_i (st_data_t key, st_data_t value, st_data_t data)
 
static void class_init_copy_check (VALUE clone, VALUE orig)
 
VALUE rb_mod_init_copy (VALUE clone, VALUE orig)
 
VALUE rb_singleton_class_clone (VALUE obj)
 
void rb_singleton_class_attached (VALUE klass, VALUE obj)
 Attach a object to a singleton class. More...
 
static VALUE make_metaclass (VALUE klass)
 Creates a metaclass of klass. More...
 
static VALUE make_singleton_class (VALUE obj)
 Creates a singleton class for obj. More...
 
static VALUE boot_defclass (const char *name, VALUE super)
 
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)
 
static VALUE include_class_new (VALUE module, VALUE super)
 
void rb_include_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)
 
static int ins_methods_push (ID name, long type, VALUE ary, long visi)
 
static int ins_methods_i (st_data_t name, st_data_t type, st_data_t ary)
 
static int ins_methods_prot_i (st_data_t name, st_data_t type, st_data_t ary)
 
static int ins_methods_priv_i (st_data_t name, st_data_t type, st_data_t ary)
 
static int ins_methods_pub_i (st_data_t name, st_data_t type, st_data_t ary)
 
static int method_entry_i (st_data_t key, st_data_t value, st_data_t data)
 
static VALUE class_instance_method_list (int argc, VALUE *argv, VALUE mod, int obj, int(*func)(st_data_t, st_data_t, st_data_t))
 
VALUE rb_class_instance_methods (int argc, VALUE *argv, VALUE mod)
 
VALUE rb_class_protected_instance_methods (int argc, VALUE *argv, VALUE mod)
 
VALUE rb_class_private_instance_methods (int argc, VALUE *argv, VALUE mod)
 
VALUE rb_class_public_instance_methods (int argc, VALUE *argv, VALUE mod)
 
VALUE rb_obj_methods (int argc, VALUE *argv, VALUE obj)
 
VALUE rb_obj_protected_methods (int argc, VALUE *argv, VALUE obj)
 
VALUE rb_obj_private_methods (int argc, VALUE *argv, VALUE obj)
 
VALUE rb_obj_public_methods (int argc, VALUE *argv, VALUE obj)
 
VALUE rb_obj_singleton_methods (int argc, 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)
 
static VALUE singleton_class_of (VALUE obj)
 
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...
 
int rb_obj_basic_to_s_p (VALUE obj)
 
int rb_scan_args (int argc, const VALUE *argv, const char *fmt,...)
 

Variables

st_tablerb_class_tbl
 
static ID id_attached