Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 19 lines (16 sloc) 0.537 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
MAX_READERS = 128

puts "// This file was generated by #{__FILE__}, do not modify it manually."

MAX_READERS.times do |i|
    puts <<EOS
static VALUE rb_vm_struct_reader_#{i} (VALUE self, SEL sel) {
VALUE *data;
Data_Get_Struct(self, VALUE, data);
return data[#{i}];
}
EOS
end

puts <<EOS
#define BS_STRUCT_MAX_FIELDS #{MAX_READERS}
typedef VALUE rb_vm_struct_reader_t(VALUE, SEL);
static rb_vm_struct_reader_t *struct_readers[] = { #{(0..(MAX_READERS-1)).to_a.map { |x| 'rb_vm_struct_reader_' + x.to_s }.join(', ') } };
EOS
Something went wrong with that request. Please try again.