File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,14 @@ def write_config(io)
159
159
@fields . each { |field | io . puts field . to_config ( @name ) }
160
160
end
161
161
162
+ def write_class ( io )
163
+ layout = generate_layout . gsub ( /\n / , '' ) . squeeze ( ' ' )
164
+ struct_name = @struct_name . split ( ' ' ) . last . capitalize + "_t"
165
+ struct_class = "class #{ struct_name } < FFI::Struct; #{ layout } ; end"
166
+
167
+ io . puts "rbx.platform.#{ @name } .class = #{ struct_class } "
168
+ end
169
+
162
170
def generate_layout
163
171
buf = ""
164
172
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ file 'runtime/platform.conf' => deps do |task|
62
62
s . name 'struct timeval'
63
63
s . field :tv_sec , :time_t
64
64
s . field :tv_usec , :suseconds_t
65
- end . write_config ( f )
65
+ end . tap { | struct | struct . write_config ( f ) ; struct . write_class ( f ) }
66
66
67
67
Rubinius ::FFI ::Generators ::Structures . new 'sockaddr_in' do |s |
68
68
if BUILD_CONFIG [ :windows ]
You can’t perform that action at this time.
0 commit comments