Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Defines | Typedefs | Enumerations | Functions

# method.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | rb_method_cfunc_struct
struct | rb_method_attr_struct
struct | rb_method_definition_struct
struct | rb_method_entry_struct
struct | unlinked_method_entry_list_entry
## Defines
#define | NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
#define | NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
#define | NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
#define | UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
## Typedefs
typedef struct rb_method_cfunc_struct | rb_method_cfunc_t
typedef struct rb_method_attr_struct | rb_method_attr_t
typedef struct rb_iseq_struct | rb_iseq_t
typedef struct rb_method_definition_struct | rb_method_definition_t
typedef struct rb_method_entry_struct | rb_method_entry_t
## Enumerations
enum | rb_method_flag_t { NOEX_PUBLIC = 0x00, NOEX_NOSUPER = 0x01, NOEX_PRIVATE = 0x02, NOEX_PROTECTED = 0x04, NOEX_MASK = 0x06, NOEX_BASIC = 0x08, NOEX_UNDEF = NOEX_NOSUPER, NOEX_MODFUNC = 0x12, NOEX_SUPER = 0x20, NOEX_VCALL = 0x40, NOEX_RESPONDS = 0x80 }
enum | rb_method_type_t { VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_ZSUPER, VM_METHOD_TYPE_UNDEF, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_MISSING }
## Functions
void | rb_add_method_cfunc (VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc, rb_method_flag_t noex)
rb_method_entry_t * | rb_add_method (VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex)
rb_method_entry_t * | rb_method_entry (VALUE klass, ID id)
rb_method_entry_t * | rb_method_entry_get_without_cache (VALUE klass, ID id)
rb_method_entry_t * | rb_method_entry_set (VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex)
int | rb_method_entry_arity (const rb_method_entry_t *me)
void | rb_mark_method_entry (const rb_method_entry_t *me)
void | rb_free_method_entry (rb_method_entry_t *me)
void | rb_sweep_method_entry (void *vm)

## Define Documentation

#define NOEX_SAFE | ( |  | n | ) | ((int)((n) >> 8) & 0x0F)

Definition at line 28 of file method.h.

Referenced by rb_method_call_status(), and vm_call_method().

#define NOEX_WITH | ( |  | n,
|  |  | s
| ) |  | ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))

Definition at line 29 of file method.h.

#define NOEX_WITH_SAFE | ( |  | n | ) | NOEX_WITH(n, rb_safe_level())

Definition at line 30 of file method.h.

Referenced by rb_method_entry_make().

#define UNDEFINED_METHOD_ENTRY_P | ( |  | me | ) | (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)

Definition at line 88 of file method.h.

Referenced by method_entry(), mnew(), rb_alias(), rb_export_method(), rb_method_call_status(), rb_method_entry_get_without_cache(), rb_mod_modfunc(), and rb_undef().

## Typedef Documentation

typedef struct rb_iseq_struct rb_iseq_t

Definition at line 57 of file method.h.

typedef struct rb_method_attr_struct rb_method_attr_t

typedef struct rb_method_cfunc_struct rb_method_cfunc_t

typedef struct rb_method_definition_struct rb_method_definition_t

typedef struct rb_method_entry_struct rb_method_entry_t

## Enumeration Type Documentation

enum rb_method_flag_t

Enumerator:

  NOEX_PUBLIC |
  NOEX_NOSUPER |
  NOEX_PRIVATE |
  NOEX_PROTECTED |
  NOEX_MASK |
  NOEX_BASIC |
  NOEX_UNDEF |
  NOEX_MODFUNC |
  NOEX_SUPER |
  NOEX_VCALL |
  NOEX_RESPONDS |

Definition at line 14 of file method.h.

enum rb_method_type_t

Enumerator:

  VM_METHOD_TYPE_ISEQ |
  VM_METHOD_TYPE_CFUNC |
  VM_METHOD_TYPE_ATTRSET |
  VM_METHOD_TYPE_IVAR |
  VM_METHOD_TYPE_BMETHOD |
  VM_METHOD_TYPE_ZSUPER |
  VM_METHOD_TYPE_UNDEF |
  VM_METHOD_TYPE_NOTIMPLEMENTED |
  VM_METHOD_TYPE_OPTIMIZED |
  VM_METHOD_TYPE_MISSING |

Definition at line 34 of file method.h.

## Function Documentation

rb_method_entry_t* rb_add_method | ( | VALUE | klass,
|  | ID | mid,
|  | rb_method_type_t | type,
|  | void * | option,
|  | rb_method_flag_t | noex
| ) |  |

Definition at line 305 of file vm_method.c.

References rb_method_definition_struct::alias_count, ALLOC, rb_method_cfunc_struct::argc, rb_method_definition_struct::attr, rb_method_definition_struct::body, rb_thread_struct::cfp, rb_method_definition_struct::cfunc, rb_method_entry_struct::def, rb_iseq_struct::filename, rb_method_cfunc_struct::func, GET_THREAD, rb_method_attr_struct::id, INT2FIX, rb_control_frame_t::iseq, rb_method_definition_struct::iseq, rb_method_attr_struct::location, unlinked_method_entry_list_entry::me, method_added(), rb_method_definition_struct::optimize_type, rb_method_definition_struct::original_id, rb_method_definition_struct::proc, Qfalse, rb_ary_freeze(), rb_ary_new3(), rb_bug(), rb_f_notimplement(), rb_method_entry_make(), rb_vm_get_ruby_level_next_cfp(), rb_vm_get_sourceline(), type, rb_method_definition_struct::type, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.

Referenced by clone_method(), Init_Proc(), Init_vm_eval(), rb_add_method_cfunc(), rb_attr(), rb_define_notimplement_method_id(), rb_export_method(), rb_mod_define_method(), rb_undef(), rb_undef_alloc_func(), rb_undef_method(), and vm_define_method().

void rb_add_method_cfunc | ( | VALUE | klass,
|  | ID | mid,
|  | VALUE(*)(ANYARGS) | func,
|  | int | argc,
|  | rb_method_flag_t | noex
| ) |  |

Definition at line 116 of file vm_method.c.

References argc, rb_method_cfunc_struct::argc, rb_method_cfunc_struct::func, func, rb_add_method(), rb_define_notimplement_method_id(), rb_f_notimplement(), and VM_METHOD_TYPE_CFUNC.

Referenced by rb_define_alloc_func(), rb_define_method(), rb_define_method_id(), rb_define_private_method(), and rb_define_protected_method().

void rb_free_method_entry | ( | rb_method_entry_t * | me | ) |

Definition at line 168 of file vm_method.c.

References rb_method_definition_struct::alias_count, rb_method_entry_struct::def, and xfree().

Referenced by free_method_entry_i(), and rb_sweep_method_entry().

void rb_mark_method_entry | ( | const rb_method_entry_t * | me | ) |

Definition at line 1438 of file gc.c.

References mark_method_entry().

Referenced by bm_mark().

rb_method_entry_t* rb_method_entry | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 442 of file vm_method.c.

References cache, EXPR1, cache_entry::klass, cache_entry::me, cache_entry::mid, and rb_method_entry_get_without_cache().

Referenced by check_definition(), mnew(), rb_get_alloc_func(), rb_method_basic_definition_p(), rb_method_boundp(), rb_mod_method_arity(), rb_obj_basic_to_s_p(), rb_search_method_entry(), vm_call0(), vm_call_method(), vm_call_super(), and vm_method_search().

int rb_method_entry_arity | ( | const rb_method_entry_t * | me | ) |

Definition at line 1550 of file proc.c.

References rb_iseq_struct::arg_opts, rb_iseq_struct::arg_post_len, rb_iseq_struct::arg_rest, rb_iseq_struct::argc, rb_method_cfunc_struct::argc, rb_method_definition_struct::body, rb_method_definition_struct::cfunc, check_argc, rb_method_entry_struct::def, rb_method_definition_struct::iseq, rb_method_definition_struct::optimize_type, rb_method_definition_struct::proc, rb_bug(), rb_proc_arity(), rb_method_definition_struct::type, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_MISSING, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.

Referenced by method_arity(), and rb_mod_method_arity().

rb_method_entry_t* rb_method_entry_get_without_cache | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 418 of file vm_method.c.

References cache, EXPR1, id, cache_entry::klass, cache_entry::me, unlinked_method_entry_list_entry::me, cache_entry::mid, ruby_running, search_method(), and UNDEFINED_METHOD_ENTRY_P.

Referenced by rb_method_entry().

rb_method_entry_t* rb_method_entry_set | ( | VALUE | klass,
|  | ID | mid,
|  | const rb_method_entry_t * | ,
|  | rb_method_flag_t | noex
| ) |  |

Definition at line 355 of file vm_method.c.

References rb_method_entry_struct::def, method_added(), rb_method_entry_make(), rb_method_definition_struct::type, type, and VM_METHOD_TYPE_UNDEF.

Referenced by clone_method(), rb_alias(), rb_mod_define_method(), and rb_mod_modfunc().

void rb_sweep_method_entry | ( | void * | vm | ) |

Definition at line 139 of file vm_method.c.

References rb_method_entry_struct::mark, unlinked_method_entry_list_entry::me, unlinked_method_entry_list_entry::next, rb_free_method_entry(), rb_vm_struct::unlinked_method_entry_list, and xfree().

Referenced by garbage_collect().