diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-01-19 17:15:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-01-19 17:15:00 +0000 |
commit | 81768d1da5a134c735955ec916b67b9851e0a93e (patch) | |
tree | 2edd320ff1bbdc1d479d0dfd8e2d991ab8d88412 | |
parent | e83f4151398feb42c59971103505206ee37c0dbf (diff) | |
download | ruby-81768d1da5a134c735955ec916b67b9851e0a93e.tar.gz |
use builtin methods
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/aix_mksym.rb | 39 |
1 files changed, 9 insertions, 30 deletions
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} |