Namespace
Methods
C
E
I
N
O
R
Class Public methods
create(*args, &block)
# 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)
# File win32/mkexports.rb, line 24
def self.extract(objs, *rest)
  create(objs).exports(*rest)
end
inherited(klass)
# File win32/mkexports.rb, line 11
def self.inherited(klass)
  @@subclass << [/#{klass.name.sub(/.*::/, '').downcase}/i, klass]
end
new(objs)
# 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)
# 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)
# 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)
# 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