Data Structures | Defines | Functions | Variables

proc.c File Reference

#include "eval_intern.h"
#include "gc.h"
Include dependency graph for proc.c:

Go to the source code of this file.

Data Structures

struct  METHOD

Defines

#define IS_METHOD_PROC_NODE(node)   (nd_type(node) == NODE_IFUNC && (node)->nd_cfnc == bmcall)
#define check_argc(argc)   (argc)
#define get_proc_iseq   rb_proc_get_iseq

Functions

VALUE rb_iseq_parameters (const rb_iseq_t *iseq, int is_proc)
static VALUE bmcall (VALUE, VALUE)
static int method_arity (VALUE)
static int rb_obj_is_method (VALUE m)
rb_iseq_trb_method_get_iseq (VALUE method)
static void proc_free (void *ptr)
static void proc_mark (void *ptr)
static size_t proc_memsize (const void *ptr)
VALUE rb_proc_alloc (VALUE klass)
VALUE rb_obj_is_proc (VALUE proc)
static VALUE proc_dup (VALUE self)
static VALUE proc_clone (VALUE self)
VALUE rb_proc_lambda_p (VALUE procval)
static void binding_free (void *ptr)
static void binding_mark (void *ptr)
static size_t binding_memsize (const void *ptr)
static VALUE binding_alloc (VALUE klass)
static VALUE binding_dup (VALUE self)
static VALUE binding_clone (VALUE self)
VALUE rb_binding_new (void)
static VALUE rb_f_binding (VALUE self)
static VALUE bind_eval (int argc, VALUE *argv, VALUE bindval)
static VALUE proc_new (VALUE klass, int is_lambda)
static VALUE rb_proc_s_new (int argc, VALUE *argv, VALUE klass)
VALUE rb_block_proc (void)
VALUE rb_block_lambda (void)
VALUE rb_f_lambda (void)
static VALUE proc_lambda (void)
static VALUE proc_call (int argc, VALUE *argv, VALUE procval)
VALUE rb_proc_call (VALUE self, VALUE args)
VALUE rb_proc_call_with_block (VALUE self, int argc, VALUE *argv, VALUE pass_procval)
static VALUE proc_arity (VALUE self)
int rb_proc_arity (VALUE self)
rb_iseq_trb_proc_get_iseq (VALUE self, int *is_proc)
static VALUE iseq_location (rb_iseq_t *iseq)
VALUE rb_proc_location (VALUE self)
static VALUE unnamed_parameters (int arity)
static VALUE rb_proc_parameters (VALUE self)
static VALUE proc_eq (VALUE self, VALUE other)
static VALUE proc_hash (VALUE self)
static VALUE proc_to_s (VALUE self)
static VALUE proc_to_proc (VALUE self)
static void bm_mark (void *ptr)
static void bm_free (void *ptr)
static size_t bm_memsize (const void *ptr)
static VALUE mnew (VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
static VALUE method_eq (VALUE method, VALUE other)
static VALUE method_hash (VALUE method)
static VALUE method_unbind (VALUE obj)
static VALUE method_receiver (VALUE obj)
static VALUE method_name (VALUE obj)
static VALUE method_owner (VALUE obj)
VALUE rb_obj_method (VALUE obj, VALUE vid)
VALUE rb_obj_public_method (VALUE obj, VALUE vid)
static VALUE rb_mod_instance_method (VALUE mod, VALUE vid)
static VALUE rb_mod_public_instance_method (VALUE mod, VALUE vid)
static VALUE rb_mod_define_method (int argc, VALUE *argv, VALUE mod)
static VALUE rb_obj_define_method (int argc, VALUE *argv, VALUE obj)
static VALUE method_clone (VALUE self)
VALUE rb_method_call (int argc, VALUE *argv, VALUE method)
static VALUE umethod_bind (VALUE method, VALUE recv)
int rb_method_entry_arity (const rb_method_entry_t *me)
static VALUE method_arity_m (VALUE method)
int rb_mod_method_arity (VALUE mod, ID id)
int rb_obj_method_arity (VALUE obj, ID id)
static rb_method_definition_tmethod_get_def (VALUE method)
static rb_iseq_tmethod_get_iseq (rb_method_definition_t *def)
VALUE rb_method_location (VALUE method)
static VALUE rb_method_parameters (VALUE method)
static VALUE method_inspect (VALUE method)
static VALUE mproc (VALUE method)
static VALUE mlambda (VALUE method)
VALUE rb_proc_new (VALUE(*func)(ANYARGS), VALUE val)
static VALUE method_proc (VALUE method)
static VALUE localjump_xvalue (VALUE exc)
static VALUE localjump_reason (VALUE exc)
static VALUE proc_binding (VALUE self)
static VALUE curry (VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
static VALUE make_curry_proc (VALUE proc, VALUE passed, VALUE arity)
static VALUE proc_curry (int argc, VALUE *argv, VALUE self)
void Init_Proc (void)
void Init_Binding (void)

Variables

VALUE rb_cUnboundMethod
VALUE rb_cMethod
VALUE rb_cBinding
VALUE rb_cProc
static const rb_data_type_t proc_data_type
static const rb_data_type_t binding_data_type
static const rb_data_type_t method_data_type

Define Documentation

#define check_argc (   argc  )     (argc)

Definition at line 571 of file proc.c.

Referenced by bmcall(), curry(), rb_method_entry_arity(), and rb_proc_call().

#define get_proc_iseq   rb_proc_get_iseq

Definition at line 655 of file proc.c.

Referenced by method_get_iseq(), rb_proc_location(), and rb_proc_parameters().

#define IS_METHOD_PROC_NODE (   node  )     (nd_type(node) == NODE_IFUNC && (node)->nd_cfnc == bmcall)

Definition at line 36 of file proc.c.

Referenced by proc_binding(), rb_proc_arity(), and rb_proc_get_iseq().


Function Documentation

static VALUE bind_eval ( int  argc,
VALUE argv,
VALUE  bindval 
) [static]

Definition at line 366 of file proc.c.

References Qnil, rb_f_eval(), and rb_scan_args().

Referenced by Init_Binding().

static VALUE binding_alloc ( VALUE  klass  )  [static]

Definition at line 277 of file proc.c.

References TypedData_Make_Struct.

Referenced by binding_dup(), proc_binding(), and rb_binding_new().

static VALUE binding_clone ( VALUE  self  )  [static]

Definition at line 301 of file proc.c.

References binding_dup(), and CLONESETUP.

Referenced by Init_Binding().

static VALUE binding_dup ( VALUE  self  )  [static]
static void binding_free ( void *  ptr  )  [static]

Definition at line 239 of file proc.c.

References RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

static void binding_mark ( void *  ptr  )  [static]
static size_t binding_memsize ( const void *  ptr  )  [static]

Definition at line 264 of file proc.c.

static void bm_free ( void *  ptr  )  [static]
static void bm_mark ( void *  ptr  )  [static]

Definition at line 857 of file proc.c.

References METHOD::me, rb_gc_mark(), rb_mark_method_entry(), METHOD::rclass, and METHOD::recv.

static size_t bm_memsize ( const void *  ptr  )  [static]

Definition at line 878 of file proc.c.

static VALUE bmcall ( VALUE  args,
VALUE  method 
) [static]

Definition at line 1793 of file proc.c.

References check_argc, CLASS_OF, RARRAY_LEN, RARRAY_PTR, rb_ary_new3(), rb_cArray, RB_GC_GUARD, and rb_method_call().

Referenced by method_proc().

static VALUE curry ( VALUE  dummy,
VALUE  args,
int  argc,
VALUE argv,
VALUE  passed_proc 
) [static]
void Init_Binding ( void   ) 
void Init_Proc ( void   ) 
static VALUE iseq_location ( rb_iseq_t iseq  )  [static]
static VALUE localjump_reason ( VALUE  exc  )  [static]

Definition at line 1868 of file proc.c.

References rb_iv_get().

Referenced by Init_Proc().

static VALUE localjump_xvalue ( VALUE  exc  )  [static]

Definition at line 1854 of file proc.c.

References rb_iv_get().

Referenced by Init_Proc().

static VALUE make_curry_proc ( VALUE  proc,
VALUE  passed,
VALUE  arity 
) [static]

Definition at line 1919 of file proc.c.

References curry(), GetProcPtr, rb_proc_t::is_lambda, rb_ary_freeze(), rb_ary_new3(), and rb_proc_new().

Referenced by curry(), and proc_curry().

static int method_arity ( VALUE  method  )  [static]
static VALUE method_arity_m ( VALUE  method  )  [static]

Definition at line 1627 of file proc.c.

References INT2FIX, and method_arity().

Referenced by Init_Proc().

static VALUE method_clone ( VALUE  self  )  [static]
static VALUE method_eq ( VALUE  method,
VALUE  other 
) [static]

Definition at line 1014 of file proc.c.

References Check_TypedStruct, CLASS_OF, DATA_PTR, method_data_type, rb_method_entry_eq(), and rb_obj_is_method().

Referenced by Init_Proc().

static rb_method_definition_t* method_get_def ( VALUE  method  )  [inline, static]
static rb_iseq_t* method_get_iseq ( rb_method_definition_t def  )  [static]
static VALUE method_hash ( VALUE  method  )  [static]
static VALUE method_inspect ( VALUE  method  )  [static]
static VALUE method_name ( VALUE  obj  )  [static]

Definition at line 1111 of file proc.c.

References METHOD::id, ID2SYM, method_data_type, and TypedData_Get_Struct.

Referenced by Init_Proc().

static VALUE method_owner ( VALUE  obj  )  [static]

Definition at line 1127 of file proc.c.

References rb_method_entry_struct::klass, METHOD::me, method_data_type, and TypedData_Get_Struct.

Referenced by Init_Proc().

static VALUE method_proc ( VALUE  method  )  [static]

Definition at line 1828 of file proc.c.

References bmcall(), GetProcPtr, rb_proc_t::is_from_method, mlambda(), and rb_iterate().

Referenced by Init_Proc().

static VALUE method_receiver ( VALUE  obj  )  [static]

Definition at line 1095 of file proc.c.

References method_data_type, METHOD::recv, and TypedData_Get_Struct.

Referenced by Init_Proc().

static VALUE method_unbind ( VALUE  obj  )  [static]
static VALUE mlambda ( VALUE  method  )  [static]

Definition at line 1787 of file proc.c.

References Qnil, rb_funcall(), and rb_intern.

Referenced by method_proc().

static VALUE mnew ( VALUE  klass,
VALUE  obj,
ID  id,
VALUE  mclass,
int  scope 
) [static]
static VALUE mproc ( VALUE  method  )  [static]

Definition at line 1781 of file proc.c.

References Qnil, rb_funcall(), and rb_intern.

Referenced by rb_proc_new().

static VALUE proc_arity ( VALUE  self  )  [static]

Definition at line 622 of file proc.c.

References INT2FIX, and rb_proc_arity().

Referenced by Init_Proc().

static VALUE proc_binding ( VALUE  self  )  [static]
static VALUE proc_call ( int  argc,
VALUE argv,
VALUE  procval 
) [static]
static VALUE proc_clone ( VALUE  self  )  [static]

Definition at line 118 of file proc.c.

References CLONESETUP, and proc_dup().

Referenced by Init_Proc().

static VALUE proc_curry ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE proc_dup ( VALUE  self  )  [static]
static VALUE proc_eq ( VALUE  self,
VALUE  other 
) [static]
static void proc_free ( void *  ptr  )  [static]

Definition at line 39 of file proc.c.

References RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

static VALUE proc_hash ( VALUE  self  )  [static]
static VALUE proc_lambda ( void   )  [static]

Definition at line 488 of file proc.c.

References rb_block_lambda().

Referenced by Init_Proc().

static void proc_mark ( void *  ptr  )  [static]
static size_t proc_memsize ( const void *  ptr  )  [static]

Definition at line 67 of file proc.c.

static VALUE proc_new ( VALUE  klass,
int  is_lambda 
) [static]
static VALUE proc_to_proc ( VALUE  self  )  [static]

Definition at line 851 of file proc.c.

Referenced by Init_Proc().

static VALUE proc_to_s ( VALUE  self  )  [static]
VALUE rb_binding_new ( void   ) 
VALUE rb_block_lambda ( void   ) 

Definition at line 467 of file proc.c.

References proc_new(), rb_cProc, and TRUE.

Referenced by proc_lambda(), rb_f_lambda(), and rb_mod_define_method().

VALUE rb_block_proc ( void   ) 
static VALUE rb_f_binding ( VALUE  self  )  [static]

Definition at line 344 of file proc.c.

References rb_binding_new().

Referenced by Init_Binding().

VALUE rb_f_lambda ( void   ) 

Definition at line 473 of file proc.c.

References rb_block_lambda(), and rb_warn().

VALUE rb_iseq_parameters ( const rb_iseq_t iseq,
int  is_proc 
)
VALUE rb_method_call ( int  argc,
VALUE argv,
VALUE  method 
)
int rb_method_entry_arity ( const rb_method_entry_t me  ) 
rb_iseq_t * rb_method_get_iseq ( VALUE  method  ) 

Definition at line 1678 of file proc.c.

References method_get_def(), and method_get_iseq().

Referenced by iseq_s_disasm(), rb_method_parameters(), and rb_proc_get_iseq().

VALUE rb_method_location ( VALUE  method  ) 
static VALUE rb_method_parameters ( VALUE  method  )  [static]

Definition at line 1711 of file proc.c.

References method_arity(), rb_iseq_parameters(), rb_method_get_iseq(), and unnamed_parameters().

Referenced by Init_Proc().

static VALUE rb_mod_define_method ( int  argc,
VALUE argv,
VALUE  mod 
) [static]
static VALUE rb_mod_instance_method ( VALUE  mod,
VALUE  vid 
) [static]

Definition at line 1214 of file proc.c.

References FALSE, mnew(), Qundef, rb_cUnboundMethod, and rb_to_id().

Referenced by Init_Proc().

int rb_mod_method_arity ( VALUE  mod,
ID  id 
)

Definition at line 1643 of file proc.c.

References METHOD::me, rb_method_entry(), and rb_method_entry_arity().

Referenced by rb_obj_method_arity().

static VALUE rb_mod_public_instance_method ( VALUE  mod,
VALUE  vid 
) [static]

Definition at line 1227 of file proc.c.

References mnew(), Qundef, rb_cUnboundMethod, rb_to_id(), and TRUE.

Referenced by Init_Proc().

static VALUE rb_obj_define_method ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 1356 of file proc.c.

References rb_mod_define_method(), and rb_singleton_class().

Referenced by Init_Proc().

static int rb_obj_is_method ( VALUE  m  )  [inline, static]

Definition at line 891 of file proc.c.

References method_data_type, and rb_typeddata_is_kind_of().

Referenced by method_eq(), and rb_mod_define_method().

VALUE rb_obj_is_proc ( VALUE  proc  ) 
VALUE rb_obj_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1164 of file proc.c.

References CLASS_OF, FALSE, mnew(), rb_cMethod, and rb_to_id().

Referenced by Init_Proc().

int rb_obj_method_arity ( VALUE  obj,
ID  id 
)

Definition at line 1650 of file proc.c.

References CLASS_OF, and rb_mod_method_arity().

VALUE rb_obj_public_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1177 of file proc.c.

References CLASS_OF, mnew(), rb_cMethod, rb_to_id(), and TRUE.

Referenced by Init_Proc().

VALUE rb_proc_alloc ( VALUE  klass  ) 

Definition at line 80 of file proc.c.

References TypedData_Make_Struct.

Referenced by proc_dup(), and rb_vm_make_proc().

int rb_proc_arity ( VALUE  self  ) 
VALUE rb_proc_call ( VALUE  self,
VALUE  args 
)
VALUE rb_proc_call_with_block ( VALUE  self,
int  argc,
VALUE argv,
VALUE  pass_procval 
)

Definition at line 584 of file proc.c.

References rb_proc_t::block, GET_THREAD, GetProcPtr, NIL_P, rb_vm_invoke_proc(), and rb_block_struct::self.

Referenced by call_trace_proc(), and curry().

rb_iseq_t* rb_proc_get_iseq ( VALUE  self,
int *  is_proc 
)
VALUE rb_proc_lambda_p ( VALUE  procval  ) 

Definition at line 228 of file proc.c.

References GetProcPtr, rb_proc_t::is_lambda, and Qtrue.

Referenced by default_proc_arity_check(), Init_Proc(), and proc_curry().

VALUE rb_proc_location ( VALUE  self  ) 

Definition at line 703 of file proc.c.

References get_proc_iseq, and iseq_location().

Referenced by Init_Proc(), and thread_initialize().

VALUE rb_proc_new ( VALUE(*)(ANYARGS)  func,
VALUE  val 
)
static VALUE rb_proc_parameters ( VALUE  self  )  [static]

Definition at line 738 of file proc.c.

References get_proc_iseq, rb_iseq_parameters(), rb_proc_arity(), and unnamed_parameters().

Referenced by Init_Proc().

static VALUE rb_proc_s_new ( int  argc,
VALUE argv,
VALUE  klass 
) [static]

Definition at line 445 of file proc.c.

References FALSE, proc_new(), and rb_obj_call_init().

Referenced by Init_Proc().

static VALUE umethod_bind ( VALUE  method,
VALUE  recv 
) [static]
static VALUE unnamed_parameters ( int  arity  )  [static]

Variable Documentation

Initial value:
 {
    "binding",
    binding_mark,
    binding_free,
    binding_memsize,
}

Definition at line 269 of file proc.c.

Initial value:
 {
    "proc",
    proc_mark,
    proc_free,
    proc_memsize,
}

Definition at line 72 of file proc.c.

Definition at line 24 of file proc.c.

Definition at line 23 of file proc.c.

Definition at line 25 of file proc.c.

Definition at line 22 of file proc.c.