enc/unicode: check Unicode versions

* enc/unicode/case-folding.rb, tool/enc-unicode.rb: check if
  Unicode versions are consistent with each other.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-07-15 00:53:50 +00:00
parent ed5401a696
commit e827c334c3
5 changed files with 61 additions and 28 deletions

View file

@ -155,8 +155,16 @@ class CaseFolding
dest.print("/* DO NOT EDIT THIS FILE. */\n")
dest.print("/* Generated by enc/unicode/case-folding.rb */\n\n")
versions = version.scan(/\d+/)
dest.print("#if defined ONIG_UNICODE_VERSION_STRING && !( \\\n")
%w[MAJOR MINOR TEENY].zip(versions) do |n, v|
dest.print(" ONIG_UNICODE_VERSION_#{n} == #{v} && \\\n")
end
dest.print(" 1)\n")
dest.print("# error ONIG_UNICODE_VERSION_STRING mismatch\n")
dest.print("#endif\n")
dest.print("#define ONIG_UNICODE_VERSION_STRING #{version.dump}\n")
%w[MAJOR MINOR TEENY].zip(version.scan(/\d+/)) do |n, v|
%w[MAJOR MINOR TEENY].zip(versions) do |n, v|
dest.print("#define ONIG_UNICODE_VERSION_#{n} #{v}\n")
end
dest.print("\n")