From 9f74ae4cf5ae8a53d0c00532f27d96e9c981f8ff Mon Sep 17 00:00:00 2001 From: duerst Date: Wed, 13 Jul 2016 08:21:29 +0000 Subject: [PATCH] * enc/windows_1252.c, test/ruby/enc/test_case_comprehensive.rb: Implement non-ASCII case conversion for Windows-1252, by Serina Tai. * test/ruby/enc/test_case_comprehensive.rb: Fix order of encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++ enc/windows_1252.c | 54 ++++++++++++++++++++++-- test/ruby/enc/test_case_comprehensive.rb | 2 +- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea4ca0b98c..aa1e670e4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jul 13 17:21:24 2016 Martin Duerst + + * enc/windows_1252.c, test/ruby/enc/test_case_comprehensive.rb: + Implement non-ASCII case conversion for Windows-1252, by Serina Tai. + + * test/ruby/enc/test_case_comprehensive.rb: Fix order of encodings. + Wed Jul 13 16:19:14 2016 Martin Duerst * enc/iso_8859_7.c, test/ruby/enc/test_case_comprehensive.rb: diff --git a/enc/windows_1252.c b/enc/windows_1252.c index e0aa84baef..2f9f33ea08 100644 --- a/enc/windows_1252.c +++ b/enc/windows_1252.c @@ -1,5 +1,5 @@ /********************************************************************** - windows_1252.c - Oniguruma (regular expression library) + cp1252.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2006-2007 Byte @@ -29,6 +29,7 @@ */ #include "regenc.h" +#include "iso_8859.h" #define ENC_CP1252_TO_LOWER_CASE(c) EncCP1252_ToLowerCaseTable[c] #define ENC_IS_CP1252_CTYPE(code,ctype) \ @@ -114,7 +115,6 @@ cp1252_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, (*pp)++; return 1; } - static int cp1252_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED) { @@ -180,6 +180,54 @@ cp1252_get_case_fold_codes_by_str(OnigCaseFoldType flag, sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } +#ifdef ONIG_CASE_MAPPING +static int +case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, + const OnigUChar* end, OnigUChar* to, OnigUChar* to_end, + const struct OnigEncodingTypeST* enc) +{ + OnigCodePoint code; + OnigUChar *to_start = to; + OnigCaseFoldType flags = *flagP; + + while (*pp