1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/bcc32/mkexports.rb

27 lines
546 B
Ruby
Raw Normal View History

#!./miniruby -s
SYM = {}
objs = ARGV.collect {|s| s.tr('/', '\\')}
system("tdump -oiPUBDEF -oiPUBD32 #{objs.join(' ')} > pub.def")
sleep(1)
IO.foreach('pub.def'){|l|
next unless /(PUBDEF|PUBD32)/ =~ l
/'(.*?)'/ =~ l
SYM[$1] = true
}
exports = []
if $name
exports << "Name " + $name
elsif $library
exports << "Library " + $library
end
exports << "Description " + $description.dump if $description
exports << "EXPORTS" << SYM.keys.sort
if $output
open($output, 'w') {|f| f.puts exports.join("\n")}
else
puts exports.join("\n")
end