Ruby  1.9.3p448(2013-06-27revision41675)
method.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  method.h -
4 
5  $Author: yugui $
6  created at: Wed Jul 15 20:02:33 2009
7 
8  Copyright (C) 2009 Koichi Sasada
9 
10 **********************************************************************/
11 #ifndef METHOD_H
12 #define METHOD_H
13 
14 typedef enum {
15  NOEX_PUBLIC = 0x00,
16  NOEX_NOSUPER = 0x01,
17  NOEX_PRIVATE = 0x02,
19  NOEX_MASK = 0x06,
20  NOEX_BASIC = 0x08,
22  NOEX_MODFUNC = 0x12,
23  NOEX_SUPER = 0x20,
24  NOEX_VCALL = 0x40,
27 
28 #define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
29 #define NOEX_WITH(n, s) (((s) << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
30 #define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level())
31 
32 /* method data type */
33 
34 typedef enum {
43  VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
44  VM_METHOD_TYPE_MISSING /* wrapper for method_missing(id) */
46 
47 typedef struct rb_method_cfunc_struct {
49  int argc;
51 
52 typedef struct rb_method_attr_struct {
53  ID id;
56 
57 typedef struct rb_iseq_struct rb_iseq_t;
58 
60  rb_method_type_t type; /* method type */
62  union {
63  rb_iseq_t *iseq; /* should be mark */
66  VALUE proc; /* should be mark */
67  enum method_optimized_type {
70  } optimize_type;
71  } body;
74 
75 typedef struct rb_method_entry_struct {
77  char mark;
80  VALUE klass; /* should be mark */
82 
86 };
87 
88 #define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
89 
90 void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
93 
96 
99 
102 void rb_sweep_method_entry(void *vm);
103 void rb_free_m_table(st_table *tbl);
104 
105 #endif /* METHOD_H */
struct unlinked_method_entry_list_entry * next
Definition: method.h:84
char mark
Definition: method.h:77
rb_method_type_t type
Definition: method.h:60
rb_method_attr_t attr
Definition: method.h:65
Definition: st.h:77
rb_method_flag_t flag
Definition: method.h:76
union rb_method_definition_struct::@42 body
rb_method_entry_t * rb_method_entry_get_without_cache(VALUE klass, ID id)
Definition: vm_method.c:391
struct rb_method_attr_struct rb_method_attr_t
rb_method_flag_t
Definition: method.h:14
void rb_mark_method_entry(const rb_method_entry_t *me)
Definition: gc.c:1663
ID called_id
Definition: method.h:79
void rb_sweep_method_entry(void *vm)
Definition: vm_method.c:113
struct rb_method_entry_struct rb_method_entry_t
struct rb_method_definition_struct rb_method_definition_t
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2)
Definition: vm_method.c:848
rb_method_cfunc_t cfunc
Definition: method.h:64
void rb_free_method_entry(rb_method_entry_t *me)
Definition: vm_method.c:142
int rb_method_entry_arity(const rb_method_entry_t *me)
Definition: proc.c:1576
int argc
Definition: ruby.c:120
Definition: method.h:75
VALUE(* func)(ANYARGS)
Definition: method.h:48
VALUE klass
Definition: method.h:80
rb_method_type_t
Definition: method.h:34
SSL_METHOD *(* func)(void)
Definition: ossl_ssl.c:104
rb_method_entry_t * rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex)
Definition: vm_method.c:276
unsigned long ID
Definition: ruby.h:89
int type
Definition: tcltklib.c:107
unsigned long VALUE
Definition: ruby.h:88
rb_method_entry_t * rb_method_entry(VALUE klass, ID id)
Definition: vm_method.c:416
struct rb_method_cfunc_struct rb_method_cfunc_t
void rb_free_m_table(st_table *tbl)
Definition: gc.c:1695
rb_method_definition_t * def
Definition: method.h:78
#define ANYARGS
Definition: defines.h:57
enum rb_method_definition_struct::@42::method_optimized_type optimize_type
rb_method_entry_t * me
Definition: method.h:85
rb_method_entry_t * rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex)
Definition: vm_method.c:328
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc, rb_method_flag_t noex)
Definition: vm_method.c:76
Definition: method.h:83