This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.h: Add macro to test if UTF8 code point isn't Latin1
authorKarl Williamson <public@khwilliamson.com>
Sun, 16 Sep 2012 16:58:26 +0000 (10:58 -0600)
committerKarl Williamson <public@khwilliamson.com>
Mon, 17 Sep 2012 04:31:23 +0000 (22:31 -0600)
utf8.h
utfebcdic.h

diff --git a/utf8.h b/utf8.h
index bf8251a..30537a8 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -170,6 +170,7 @@ Perl's extended UTF-8 means we can have start bytes up to FF.
 
 /* Masking with 0xfe allows low bit to be 0 or 1; thus this matches 0xc[23] */
 #define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfe) == 0xc2)
 
 /* Masking with 0xfe allows low bit to be 0 or 1; thus this matches 0xc[23] */
 #define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfe) == 0xc2)
+#define UTF8_IS_ABOVE_LATIN1(c)        ((U8)(c) >= 0xc4)
 
 #define UTF_START_MARK(len) (((len) >  7) ? 0xFF : (0xFE << (7-(len))))
 
 
 #define UTF_START_MARK(len) (((len) >  7) ? 0xFF : (0xFE << (7-(len))))
 
index 3eba83d..1662103 100644 (file)
@@ -570,6 +570,7 @@ END_EXTERN_C
 #define UTF8_IS_CONTINUATION(c)                ((NATIVE_TO_UTF(c) & 0xE0) == 0xA0)
 #define UTF8_IS_CONTINUED(c)           (NATIVE_TO_UTF(c) >= 0xA0)
 #define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) <= 0xC7)
 #define UTF8_IS_CONTINUATION(c)                ((NATIVE_TO_UTF(c) & 0xE0) == 0xA0)
 #define UTF8_IS_CONTINUED(c)           (NATIVE_TO_UTF(c) >= 0xA0)
 #define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) <= 0xC7)
+#define UTF8_IS_ABOVE_LATIN1(c)        (NATIVE_TO_I8(c) >= 0xC8)
 
 #define UTF_START_MARK(len) (((len) >  7) ? 0xFF : ((U8)(0xFE << (7-(len)))))
 #define UTF_START_MASK(len) (((len) >= 6) ? 0x01 : (0x1F >> ((len)-2)))
 
 #define UTF_START_MARK(len) (((len) >  7) ? 0xFF : ((U8)(0xFE << (7-(len)))))
 #define UTF_START_MASK(len) (((len) >= 6) ? 0x01 : (0x1F >> ((len)-2)))