Sha256: b286b4ccff08c93ac54eb3e053203523081f36f9da9bfd507a92ba3fa6535cec

Contents?: true

Size: 913 Bytes

Versions: 7

Compression:

Stored size: 913 Bytes

Contents

#include "RubySourceSupport.h"

//	Taken from eval.c in Ruby source
//	No header, so easiest way to integrate was to copy the code and make my own header.
//	Previously declared static; otherwise unchanged

ID frame_func_id( rb_control_frame_t *cfp )
{
    rb_iseq_t *iseq = cfp->iseq;
    if (!iseq) {
		return cfp->method_id;
    }
    while (iseq) {
		
		if (RUBY_VM_IFUNC_P(iseq)) {
			return rb_intern("<ifunc>");
		}
		if (iseq->defined_method_id) {
			return iseq->defined_method_id;
		}
		if (iseq->local_iseq == iseq) {
			break;
		}
		iseq = iseq->parent_iseq;
    }
    return 0;
}

ID rb_frame_caller(void)
{
    rb_thread_t *th = GET_THREAD();
    rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
    /* check if prev_cfp can be accessible */
    if ((void *)(th->stack + th->stack_size) == (void *)(prev_cfp)) {
        return 0;
    }
    return frame_func_id(prev_cfp);
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sender-1.3 ext/sender/RubySourceSupport.c
sender-1.2 ext/sender/RubySourceSupport.c
sender-1.1.4 ext/sender/RubySourceSupport.c
sender-1.1.3 ext/sender/RubySourceSupport.c
sender-1.1.2 ext/sender/RubySourceSupport.c
sender-1.1.1 ext/sender/RubySourceSupport.c
sender-1.1.0 ext/sender/RubySourceSupport.c