Namespace
- CLASS Exports::Cygwin
- CLASS Exports::Mingw
- CLASS Exports::Mswin
Methods
Class Public methods
create(*args, &block)
Link
Source: show
# File win32/mkexports.rb, line 15 def self.create(*args, &block) platform = RUBY_PLATFORM pat, klass = @@subclass.find {|p, k| p =~ platform} unless klass raise ArgumentError, "unsupported platform: #{platform}" end klass.new(*args, &block) end
extract(objs, *rest)
Link
Source: show
# File win32/mkexports.rb, line 24 def self.extract(objs, *rest) create(objs).exports(*rest) end
inherited(klass)
Link
Source: show
# File win32/mkexports.rb, line 11 def self.inherited(klass) @@subclass << [/#{klass.name.sub(/.*::/, '').downcase}/i, klass] end
new(objs)
Link
Source: show
# File win32/mkexports.rb, line 36 def initialize(objs) syms = {} winapis = {} syms["ruby_sysinit_real"] = "ruby_sysinit" each_export(objs) do |internal, export| syms[internal] = export winapis[$1] = internal if /^_?(rb_w32_\w+)(?:@\d+)?$/ =~ internal end incdir = File.join(File.dirname(File.dirname(__FILE__)), "include/ruby") read_substitution(incdir+"/win32.h", syms, winapis) read_substitution(incdir+"/subst.h", syms, winapis) syms["rb_w32_vsnprintf"] ||= "ruby_vsnprintf" syms["rb_w32_snprintf"] ||= "ruby_snprintf" @syms = syms end
output(output = $output, &block)
Link
Source: show
# File win32/mkexports.rb, line 28 def self.output(output = $output, &block) if output open(output, 'wb', &block) else yield STDOUT end end
Instance Public methods
exports(name = $name, library = $library, description = $description)
Link
Source: show
# File win32/mkexports.rb, line 64 def exports(name = $name, library = $library, description = $description) exports = [] if name exports << "Name " + name elsif library exports << "Library " + library end exports << "Description " + description.dump if description exports << "VERSION #{RbConfig::CONFIG['MAJOR']}.#{RbConfig::CONFIG['MINOR']}" exports << "EXPORTS" << symbols() exports end
read_substitution(header, syms, winapis)
Link
Source: show
# File win32/mkexports.rb, line 52 def read_substitution(header, syms, winapis) IO.foreach(header) do |line| if /^#define (\w+)\((.*?)\)\s+(?:\(void\))?(rb_w32_\w+)\((.*?)\)\s*$/ =~ line and $2.delete(" ") == $4.delete(" ") export, internal = $1, $3 if syms[internal] or internal = winapis[internal] syms[forwarding(internal, export)] = internal end end end end