From 59766643db17f8dbfe518cafa20f6ba36a9b8d9b Mon Sep 17 00:00:00 2001 From: duerst Date: Fri, 11 Mar 2016 07:11:27 +0000 Subject: * enc/unicode/case-folding.rb, casefold.h: Streamlining approach to case mapping data not available from case folding by unifying all three cases (special title, special upper, special lower). * enc/unicode.c: Adjust macro names for above (macros are currently inactive). (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enc/unicode.c | 12 +- enc/unicode/case-folding.rb | 41 ++-- enc/unicode/casefold.h | 445 ++++++++++++++++++++++++++------------------ 3 files changed, 299 insertions(+), 199 deletions(-) (limited to 'enc') diff --git a/enc/unicode.c b/enc/unicode.c index e9c2803cab..f5a7d9b984 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -140,14 +140,22 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y) #define U ONIGENC_CASE_UPCASE #define D ONIGENC_CASE_DOWNCASE #define F ONIGENC_CASE_FOLD -#define T(n) (ONIGENC_CASE_TITLECASE|OnigTitlecaseEncode(n)) +#define ST 0 +#define SU 0 +#define SL 0 +#define I(n) 0 +#define L(n) 0 #include "enc/unicode/casefold.h" #undef U #undef D #undef F -#undef T +#undef ST +#undef SU +#undef SL +#undef I +#undef L #include "enc/unicode/name2ctype.h" diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb index cd14b6e6f1..d309dd6d15 100755 --- a/enc/unicode/case-folding.rb +++ b/enc/unicode/case-folding.rb @@ -177,7 +177,7 @@ class CaseFolding dest.print lookup_hash(name, "CodePointList2", data) # TitleCase - dest.print mapping_data.titlecase_output + dest.print mapping_data.specials_output end def debug! @@ -203,7 +203,8 @@ end class CaseMapping def initialize (mapping_directory) @mappings = {} - @titlecase = [] + @specials = [] + @specials_length = 0 IO.readlines(File.expand_path('UnicodeData.txt', mapping_directory), encoding: Encoding::ASCII_8BIT).each do |line| next if line =~ /^