Sha256: 066fd8d74d3219a573d8835b8f5e39573c050e480f8e9bc416ef06cfdc6ef4ce

Contents?: true

Size: 1.89 KB

Versions: 6

Compression:

Stored size: 1.89 KB

Contents

#ifndef ruby_internal_iseq_load__inc_
#define ruby_internal_iseq_load__inc_

#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA

  static rb_data_type_t const * p_iseq_data_type;

  static void init_iseq_data_type()
  {
    rb_proc_t * p;
    VALUE body;

    VALUE binding = rb_binding_new();
    VALUE new_proc = rb_funcall(
        rb_cObject, rb_intern("eval"), 2, rb_str_new2("proc { }"), binding);
    GetProcPtr(new_proc, p);
    body = p->block.iseq->self;

    p_iseq_data_type = RTYPEDDATA_TYPE(body);
  }

#else

#endif
#
#ruby <<END
  ruby_version_code = RUBY_VERSION.gsub(/\./, '').to_i

  if ruby_version_code >= 191 then

    $: << '../../..'
    require 'ruby_source_dir'
    iseq_c_location = "#{RUBY_SOURCE_DIR}/iseq.c"

    write = false
    stopwrite = false
    prev_line = nil
    File.open(iseq_c_location) do |input|
      input.each_line do |line|
        case line
        when /^(iseq_load|iseq_alloc|iseq_mark|iseq_free|compile_data_free|make_compile_option|make_compile_option_value|prepare_iseq_build|cleanup_iseq_build|set_relation|iseq_memsize)/
          write = true
          puts prev_line
        when /^static.*COMPILE_OPTION_DEFAULT.*=/
          write = true
        when /^static.*COMPILE_OPTION_FALSE.*=/
          write = true
          stopwrite = true
        when /TypedData_Make_Struct.*\&iseq_data_type/
          line.gsub!(/\&iseq_data_type/, 'p_iseq_data_type')
        when /^#define CHECK_/,
             /^static inline VALUE CHECK_/
          write = true
          stopwrite = true
        when /^\}/
          stopwrite = true
        end
        puts line if write
        if stopwrite then
          write = false
          stopwrite = false
        end
        prev_line = line
      end
    end

  elsif ruby_version_code >= 190 then

    puts <<-END

/* Defined but not declared by ruby */
VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);

    END

  end

  nil
END

#endif

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-internal-0.8.5 ext/internal/vm/iseq/iseq_load.inc.rpp
ruby-internal-0.8.4 ext/internal/vm/iseq/iseq_load.inc.rpp
ruby-internal-0.8.3 ext/internal/vm/iseq/iseq_load.inc.rpp
ruby-internal-0.8.2 ext/internal/vm/iseq/iseq_load.inc.rpp
ruby-internal-0.8.1 ext/internal/vm/iseq/iseq_load.inc.rpp
ruby-internal-0.8.0 ext/internal/vm/iseq/iseq_load.inc.rpp