summaryrefslogtreecommitdiff
path: root/enc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-22 00:07:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-22 00:07:23 +0000
commit80e81d283d5bf1df5cc1a1df5bc7289525194ffc (patch)
tree7852702f16a23e04dca30c402d8a7331be9c268d /enc
parentb62df564a6eff10ed741804c9a2415f6acac807f (diff)
* enc/{depend,make_encdb.rb,trans/make_transdb.rb}: sort in alpha-numeric order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rw-r--r--enc/depend2
-rwxr-xr-xenc/make_encdb.rb4
-rw-r--r--enc/trans/make_transdb.rb4
3 files changed, 7 insertions, 3 deletions
diff --git a/enc/depend b/enc/depend
index d97c9056c3..d67ca3f7b5 100644
--- a/enc/depend
+++ b/enc/depend
@@ -1,7 +1,7 @@
% deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"])
% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
% encs.each {|e| e.chomp!(".c")}
-% alphanumeric_order = proc {|e| e.split(/(\d+)/).map {|n| Integer(n) rescue n}}
+% alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
% encs = encs.sort_by(&alphanumeric_order)
% trans = Dir.open($srcdir+"/trans") {|d| d.select {|e| e.chomp!('.c')}}
% trans = trans.sort_by(&alphanumeric_order)
diff --git a/enc/make_encdb.rb b/enc/make_encdb.rb
index 6eda76e5c4..013eabe1d7 100755
--- a/enc/make_encdb.rb
+++ b/enc/make_encdb.rb
@@ -24,7 +24,9 @@ encodings = []
defs = {}
encdir = ARGV[0]
outhdr = ARGV[1] || 'encdb.h'
-Dir.open(encdir) {|d| d.grep(/.+\.[ch]\z/)}.sort.each do |fn|
+Dir.open(encdir) {|d| d.grep(/.+\.[ch]\z/)}.sort_by {|e|
+ e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten
+}.each do |fn|
open(File.join(encdir,fn)) do |f|
orig = nil
name = nil
diff --git a/enc/trans/make_transdb.rb b/enc/trans/make_transdb.rb
index 48a05361bc..aae24fdbf4 100644
--- a/enc/trans/make_transdb.rb
+++ b/enc/trans/make_transdb.rb
@@ -10,7 +10,9 @@ count = 0
converters = {}
transdir = ARGV[0]
outhdr = ARGV[1] || 'transdb.h'
-Dir.open(transdir) {|d| d.grep(/.+\.[ch]\z/)}.sort.each do |fn|
+Dir.open(transdir) {|d| d.grep(/.+\.[ch]\z/)}.sort_by {|e|
+ e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten
+}.each do |fn|
open(File.join(transdir,fn)) do |f|
f.each_line do |line|
if (/^static const rb_transcoder/ =~ line)..(/"(.*?)"\s*,\s*"(.*?)"/ =~ line)