summaryrefslogtreecommitdiff
path: root/src/character.h
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2008-12-30 23:42:40 +0000
committerKenichi Handa <handa@m17n.org>2008-12-30 23:42:40 +0000
commitc19cab20a1a9fe9b00f21fef3a3fc3c559ce0710 (patch)
tree322c2d56af48e6b3fce560295e422f96f5b9b264 /src/character.h
parent78a2f9cd5362633833419cbcbc3cefa2e65d10a3 (diff)
downloademacs-c19cab20a1a9fe9b00f21fef3a3fc3c559ce0710.tar.gz
(CHAR_VARIATION_SELECTOR_P): New macro.
(CHAR_SURROGATE_PAIR_P): New macro.
Diffstat (limited to 'src/character.h')
-rw-r--r--src/character.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/character.h b/src/character.h
index 34e696e5083..a766b767eb3 100644
--- a/src/character.h
+++ b/src/character.h
@@ -610,6 +610,26 @@ extern char unibyte_has_multibyte_table[256];
? ASCII_CHAR_WIDTH (c) \
: XINT (CHAR_TABLE_REF (Vchar_width_table, c)))
+/* If C is a variation selector, return the index numnber of the
+ variation selector (1..256). Otherwise, return 0. */
+
+#define CHAR_VARIATION_SELECTOR_P(c) \
+ ((c) < 0xFE00 ? 0 \
+ : (c) <= 0xFE0F ? (c) - 0xFE00 + 1 \
+ : (c) < 0xE0100 ? 0 \
+ : (c) <= 0xE01EF ? (c) - 0xE0100 + 17 \
+ : 0)
+
+/* If C is a high surrogate, return 1. If C is a low surrogate,
+ return 0. Otherwise, return 0. */
+
+#define CHAR_SURROGATE_PAIR_P(c) \
+ ((c) < 0xD800 ? 0 \
+ : (c) <= 0xDBFF ? 1 \
+ : (c) <= 0xDFFF ? 2 \
+ : 0)
+
+
extern int char_resolve_modifier_mask P_ ((int));
extern int char_string P_ ((unsigned, unsigned char *));
extern int string_char P_ ((const unsigned char *,