Ruby  1.9.3p551(2014-11-13revision48407)
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 */
106