From 81768d1da5a134c735955ec916b67b9851e0a93e Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 19 Jan 2003 17:15:00 +0000 Subject: use builtin methods git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/aix_mksym.rb | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'ext') diff --git a/ext/aix_mksym.rb b/ext/aix_mksym.rb index 7e1af283dc..34b0de727e 100644 --- a/ext/aix_mksym.rb +++ b/ext/aix_mksym.rb @@ -1,33 +1,12 @@ -def uniq(data) - last=nil - data.delete_if do |name| - if last == name - TRUE - else - last = name - FALSE - end +data = [] +IO.foreach("|/usr/ccs/bin/nm -p #{ARGV[0]}") do |line| + line = line.split + case line[1] + when "B", "D" + data << line[0] end end - -def extract(nm, out) - data = nm.readlines.collect{|line| - line = line.split - case line[1] - when "B", "D" - line[0] - else - next - end - }.compact!.sort! - uniq(data) - exp = open(out, "w") - exp.printf "#!\n" - for line in data - exp.printf "%s\n", line - end - exp.close - nm.close -end -extract(open("|/usr/ccs/bin/nm -p ../libruby.a"), "../ruby.imp") +data.uniq! +data.sort! +open(ARGV[1], "w") {|exp| exp.puts "#!", data} -- cgit v1.2.3