mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/mkconstants.rb: check all alias possibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
48649d21c9
commit
85d13f6165
2 changed files with 8 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Jan 1 21:08:34 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/mkconstants.rb: check all alias possibility.
|
||||
|
||||
Thu Jan 1 20:59:55 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/mkconstants.rb: more possible aliases.
|
||||
|
|
|
@ -93,28 +93,12 @@ ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int(str_var, len_var,
|
|||
}
|
||||
EOS
|
||||
|
||||
MAYBE_ALIAS = [
|
||||
["AF_UNIX", "AF_LOCAL"],
|
||||
["AF_ISO", "AF_OSI"],
|
||||
["AF_E164", "AF_ISDN"],
|
||||
["AF_NS", "AF_IPX"],
|
||||
]
|
||||
|
||||
def each_alias(pat)
|
||||
h = {}
|
||||
each_name(pat) {|name|
|
||||
h[name] = [name]
|
||||
}
|
||||
MAYBE_ALIAS.each {|names|
|
||||
a = []
|
||||
names.each {|n|
|
||||
a << n if h.delete n
|
||||
}
|
||||
h[a.first] = a
|
||||
}
|
||||
h.each_value {|names|
|
||||
yield names
|
||||
names = []
|
||||
each_name(pat) {|n|
|
||||
names << n
|
||||
}
|
||||
yield names
|
||||
end
|
||||
|
||||
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name(int_var, pat)")
|
||||
|
|
Loading…
Reference in a new issue