From 307d7cb05d38eefc57e3d89e2b343c8a710f576f Mon Sep 17 00:00:00 2001 From: duerst Date: Mon, 14 Mar 2016 09:39:54 +0000 Subject: * include/ruby/oniguruma.h, enc/unicode.c: Adjusting flag assignments and macros to work with unified CaseMappingSpecials array. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/oniguruma.h | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h index 2411e0f507..b087ef829f 100644 --- a/include/ruby/oniguruma.h +++ b/include/ruby/oniguruma.h @@ -121,39 +121,37 @@ typedef ptrdiff_t OnigPosition; * * Subfields (starting with 0 at LSB): * 0-2: Code point count in casefold.h - * 3-9: Index into TitleCase array in casefold.h - * 10-15, 18-20: Case mapping flags + * 3-12: Index into SpecialCaseMapping array in casefold.h + * 13-22: Case folding/mapping flags */ typedef unsigned int OnigCaseFoldType; /* case fold flag */ ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag; /* bits for actual code point count; 3 bits is more than enough, currently only 2 used */ -#define OnigCodePointMask (0x7) +#define OnigCodePointMaskWidth 3 +#define OnigCodePointMask ((1<>OnigTitlecaseShift) - -#define OnigTitlecaseIndex - -#define ONIGENC_CASE_TITLECASE (1<<10) /* has/needs titlecase mapping */ -#define ONIGENC_CASE_UPCASE (1<<11) /* has/needs uppercase mapping */ -#define ONIGENC_CASE_DOWNCASE (1<<12) /* has/needs lowercase mapping */ -#define ONIGENC_CASE_FOLD (1<<13) /* has/needs case folding */ -#define ONIGENC_CASE_SPECIAL (1<<14) /* has/needs special mapping from separate table */ -#define ONIGENC_CASE_MODIFIED (1<<15) /* data has been modified */ -#define ONIGENC_CASE_ASCII_ONLY (1<<18) /* only modify ASCII range */ -#define ONIGENC_CASE_FOLD_LITHUANIAN (1<<19) /* needs Lithuanian-specific mapping */ +/* 10 bits provide 1024 values */ +#define OnigSpecialIndexShift 3 +#define OnigSpecialIndexWidth 10 + +#define ONIGENC_CASE_UPCASE (1<<13) /* has/needs uppercase mapping */ +#define ONIGENC_CASE_DOWNCASE (1<<14) /* has/needs lowercase mapping */ +#define ONIGENC_CASE_TITLECASE (1<<15) /* has/needs (special) titlecase mapping */ +#define ONIGENC_CASE_SPECIAL_OFFSET 3 /* offset in bytes from ONIGENC_CASE to ONIGENC_CASE_SPECIAL */ +#define ONIGENC_CASE_UP_SPECIAL (1<<16) /* has special upcase mapping */ +#define ONIGENC_CASE_DOWN_SPECIAL (1<<17) /* has special downcase mapping */ +#define ONIGENC_CASE_MODIFIED (1<<18) /* data has been modified */ +#define ONIGENC_CASE_FOLD (1<<19) /* has/needs case folding */ #define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20) /* needs mapping specific to Turkic languages; better not change original value! */ +#define ONIGENC_CASE_FOLD_LITHUANIAN (1<<21) /* needs Lithuanian-specific mapping */ +#define ONIGENC_CASE_ASCII_ONLY (1<<22) /* only modify ASCII range */ #define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30) /* better not change original value! */ #define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR -- cgit v1.2.3