proc.c
Go to the documentation of this file.
00001 #ifdef HAS_RUBY_SOURCE
00002 #include <vm_core.h>
00003 
00004 static VALUE env_references(VALUE rbenv)
00005 {
00006     rb_env_t* env;
00007 
00008     VALUE result = rb_ary_new();
00009     GetEnvPtr(rbenv, env);
00010     if (env->env)
00011     {
00012         int i;
00013         for (i = 0; i < env->env_size; ++i)
00014             rb_ary_push(result, rb_obj_id(env->env[i]));
00015     }
00016     return result;
00017 }
00018 
00019 static VALUE proc_references(VALUE rbproc)
00020 {
00021     rb_proc_t* proc;
00022     GetProcPtr(rbproc, proc);
00023 
00024     if (!NIL_P(proc->envval))
00025         return env_references(proc->envval);
00026     return rb_ary_new();
00027 }
00028 #elif RUBY_IS_18
00029 #warning "compiling on Ruby 1.8, Proc#references will not be available"
00030 #else
00031 #warning "Ruby core sources cannot be found, Proc#references will not be available. Install the debugger-ruby_core_source gem to enable"
00032 #endif
00033 
00034 void Init_proc()
00035 {
00036 #ifdef HAS_RUBY_SOURCE
00037     rb_define_method(rb_cProc, "references", RUBY_METHOD_FUNC(proc_references), 0);
00038 #endif
00039 }


utilrb
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 18:49:20