Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 20 lines (16 sloc) 0.537 kb
3f90e95 statically generate the struct reader methods, 128 seems necessary at le...
Laurent Sansonetti authored
1 MAX_READERS = 128
2
3 puts "// This file was generated by #{__FILE__}, do not modify it manually."
4
5 MAX_READERS.times do |i|
6 puts <<EOS
7 static VALUE rb_vm_struct_reader_#{i} (VALUE self, SEL sel) {
8 VALUE *data;
9 Data_Get_Struct(self, VALUE, data);
10 return data[#{i}];
11 }
12 EOS
13 end
14
15 puts <<EOS
16 #define BS_STRUCT_MAX_FIELDS #{MAX_READERS}
17 typedef VALUE rb_vm_struct_reader_t(VALUE, SEL);
18 static rb_vm_struct_reader_t *struct_readers[] = { #{(0..(MAX_READERS-1)).to_a.map { |x| 'rb_vm_struct_reader_' + x.to_s }.join(', ') } };
19 EOS
Something went wrong with that request. Please try again.