aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c63
1 files changed, 8 insertions, 55 deletions
diff --git a/src/coding.c b/src/coding.c
index 4b3d22f956c..13f53ad5abc 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -920,65 +920,18 @@ record_conversion_result (struct coding_system *coding,
920 920
921 921
922/* Store multibyte form of the character C in P, and advance P to the 922/* Store multibyte form of the character C in P, and advance P to the
923 end of the multibyte form. This is like CHAR_STRING_ADVANCE but it 923 end of the multibyte form. This used to be like CHAR_STRING_ADVANCE
924 never calls MAYBE_UNIFY_CHAR. */ 924 without ever calling MAYBE_UNIFY_CHAR, but nowadays we don't call
925 925 MAYBE_UNIFY_CHAR in CHAR_STRING_ADVANCE. */
926#define CHAR_STRING_ADVANCE_NO_UNIFY(c, p) \
927 do { \
928 if ((c) <= MAX_1_BYTE_CHAR) \
929 *(p)++ = (c); \
930 else if ((c) <= MAX_2_BYTE_CHAR) \
931 *(p)++ = (0xC0 | ((c) >> 6)), \
932 *(p)++ = (0x80 | ((c) & 0x3F)); \
933 else if ((c) <= MAX_3_BYTE_CHAR) \
934 *(p)++ = (0xE0 | ((c) >> 12)), \
935 *(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \
936 *(p)++ = (0x80 | ((c) & 0x3F)); \
937 else if ((c) <= MAX_4_BYTE_CHAR) \
938 *(p)++ = (0xF0 | (c >> 18)), \
939 *(p)++ = (0x80 | ((c >> 12) & 0x3F)), \
940 *(p)++ = (0x80 | ((c >> 6) & 0x3F)), \
941 *(p)++ = (0x80 | (c & 0x3F)); \
942 else if ((c) <= MAX_5_BYTE_CHAR) \
943 *(p)++ = 0xF8, \
944 *(p)++ = (0x80 | ((c >> 18) & 0x0F)), \
945 *(p)++ = (0x80 | ((c >> 12) & 0x3F)), \
946 *(p)++ = (0x80 | ((c >> 6) & 0x3F)), \
947 *(p)++ = (0x80 | (c & 0x3F)); \
948 else \
949 (p) += BYTE8_STRING ((c) - 0x3FFF80, p); \
950 } while (0)
951 926
927#define CHAR_STRING_ADVANCE_NO_UNIFY(c, p) CHAR_STRING_ADVANCE(c, p)
952 928
953/* Return the character code of character whose multibyte form is at 929/* Return the character code of character whose multibyte form is at
954 P, and advance P to the end of the multibyte form. This is like 930 P, and advance P to the end of the multibyte form. This used to be
955 STRING_CHAR_ADVANCE, but it never calls MAYBE_UNIFY_CHAR. */ 931 like STRING_CHAR_ADVANCE without ever calling MAYBE_UNIFY_CHAR, but
956 932 nowadays STRING_CHAR_ADVANCE doesn't call MAYBE_UNIFY_CHAR. */
957#define STRING_CHAR_ADVANCE_NO_UNIFY(p) \
958 (!((p)[0] & 0x80) \
959 ? *(p)++ \
960 : ! ((p)[0] & 0x20) \
961 ? ((p) += 2, \
962 ((((p)[-2] & 0x1F) << 6) \
963 | ((p)[-1] & 0x3F) \
964 | ((unsigned char) ((p)[-2]) < 0xC2 ? 0x3FFF80 : 0))) \
965 : ! ((p)[0] & 0x10) \
966 ? ((p) += 3, \
967 ((((p)[-3] & 0x0F) << 12) \
968 | (((p)[-2] & 0x3F) << 6) \
969 | ((p)[-1] & 0x3F))) \
970 : ! ((p)[0] & 0x08) \
971 ? ((p) += 4, \
972 ((((p)[-4] & 0xF) << 18) \
973 | (((p)[-3] & 0x3F) << 12) \
974 | (((p)[-2] & 0x3F) << 6) \
975 | ((p)[-1] & 0x3F))) \
976 : ((p) += 5, \
977 ((((p)[-4] & 0x3F) << 18) \
978 | (((p)[-3] & 0x3F) << 12) \
979 | (((p)[-2] & 0x3F) << 6) \
980 | ((p)[-1] & 0x3F))))
981 933
934#define STRING_CHAR_ADVANCE_NO_UNIFY(p) STRING_CHAR_ADVANCE(p)
982 935
983/* Set coding->source from coding->src_object. */ 936/* Set coding->source from coding->src_object. */
984 937