From 671c929f0ae3cee6a899792949aad83ad895ad42 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 1 Dec 2016 00:34:42 +0000 Subject: Use offsetof macro and shrink table size git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/enc-unicode.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tool') diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb index 0e3ba474f7..feb94c3e61 100755 --- a/tool/enc-unicode.rb +++ b/tool/enc-unicode.rb @@ -381,7 +381,6 @@ output = Unifdef.new($stdout) output.kwdonly = !header puts '%{' -puts '#define long size_t' props, data = parse_unicode_data(get_file('UnicodeData.txt')) categories = {} props.concat parse_scripts(data, categories) @@ -423,7 +422,8 @@ output.endif :USE_UNICODE_PROPERTIES puts(<<'__HEREDOC') }; struct uniname2ctype_struct { - int name, ctype; + short name; + unsigned short ctype; }; static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int); @@ -512,6 +512,12 @@ if header end while syms.pop fds.each(&:close) IO.popen(%W[diff -DUSE_UNICODE_AGE_PROPERTIES #{fds[1].path} #{fds[0].path}], "r") {|age| - system(* %W[diff -DUSE_UNICODE_PROPERTIES #{fds[2].path} -], in: age) + IO.popen(%W[diff -DUSE_UNICODE_PROPERTIES #{fds[2].path} -], "r", in: age) {|f| + f.each {|line| + line.gsub!(/\(int\)\(long\)&\(\((struct uniname2ctype_pool_t) \*\)0\)->(uniname2ctype_pool_str\d+),\s+/, + 'offsetof(\1, \2), ') + puts line + } + } } end -- cgit v1.2.3