aboutsummaryrefslogtreecommitdiffstats
path: root/enc/unicode.c
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-08 04:00:31 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-08 04:00:31 +0000
commit8f10a72d909bea83bca029375516dbcb02286518 (patch)
tree7a8754c3452b16eae67e089f7abfe98260d97e0f /enc/unicode.c
parent1bea5a61273e2f6402a26fd885ce5f6cd3db301d (diff)
downloadruby-8f10a72d909bea83bca029375516dbcb02286518.tar.gz
* enc/unicode.c: Shortened macros for enc/unicode/casefold.h to
single-letter; use flags in casefold.h for logic. * enc/unicode/case-folding.rb: Added flag for case folding. Changed parameter passing. * enc/unicode/casefold.h: New flags added. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode.c')
-rw-r--r--enc/unicode.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/enc/unicode.c b/enc/unicode.c
index b0ecc1bc50..1c1cd0064a 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -73,6 +73,7 @@ static const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256] = {
/* use bottom bytes for actual code point count; 3 bits is more than enough */
#define OnigCodePointCount(n) ((n)&0x7)
+#define OnigCaseFoldFlags(n) ((n)&~0x7)
typedef struct {
int n;
@@ -140,17 +141,17 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
return 1;
}
-#define UP ONIGENC_CASE_UPCASE
-#define DOWN ONIGENC_CASE_DOWNCASE
-#define TITLE ONIGENC_CASE_TITLECASE
-#define FOLD ONIGENC_CASE_FOLD
+#define U ONIGENC_CASE_UPCASE
+#define D ONIGENC_CASE_DOWNCASE
+#define T ONIGENC_CASE_TITLECASE
+#define F ONIGENC_CASE_FOLD
#include "enc/unicode/casefold.h"
-#undef UP
-#undef DOWN
-#undef TITLE
-#undef FOLD
+#undef U
+#undef D
+#undef T
+#undef F
#include "enc/unicode/name2ctype.h"
@@ -676,9 +677,9 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
code = 0x0049; MODIFIED;
}
else if ((folded = onigenc_unicode_fold_lookup(code)) != 0) {
- if (flags&ONIGENC_CASE_FOLD) {
- const OnigCodePoint *next = folded->code;
+ if (flags&OnigCaseFoldFlags(folded->n)) {
int count = OnigCodePointCount(folded->n);
+ const OnigCodePoint *next = folded->code;
MODIFIED;
if (count==1)
code = *next;