Commit 1efcd78f authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(VALID_LEADING_CODE_P): New macro.

(UNIBYTE_STR_AS_MULTIBYTE_P): Check more rigidly.
parent a2f3f87b
2003-05-31 Kenichi Handa <handa@m17n.org>
* charset.h (VALID_LEADING_CODE_P): New macro.
(UNIBYTE_STR_AS_MULTIBYTE_P): Check more rigidly.
2003-05-30 Kenichi Handa <handa@m17n.org>
* coding.c (ccl_coding_driver): Set ccl->eight_bit_control
......
......@@ -441,21 +441,29 @@ extern int width_by_char_head[256];
#endif /* not BYTE_COMBINING_DEBUG */
#define VALID_LEADING_CODE_P(code) \
(! NILP (CHARSET_TABLE_ENTRY (code)))
/* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes)
is valid as a multibyte form. If valid, by a side effect, BYTES is
set to the byte length of the multibyte form. */
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \
? ((bytes) = 1) \
: (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \
((bytes) > 1 && (bytes) <= (length) \
&& (str)[0] != LEADING_CODE_8_BIT_CONTROL \
&& !CHAR_HEAD_P ((str)[1]) \
&& ((bytes) == 2 \
|| (!CHAR_HEAD_P ((str)[2]) \
&& ((bytes) == 3 \
|| !CHAR_HEAD_P ((str)[3])))))))
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \
? ((bytes) = 1) \
: (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \
((bytes) <= (length) \
&& !CHAR_HEAD_P ((str)[1]) \
&& ((bytes) == 2 \
? (str)[0] != LEADING_CODE_8_BIT_CONTROL \
: (!CHAR_HEAD_P ((str)[2]) \
&& ((bytes) == 3 \
? (((str)[0] != LEADING_CODE_PRIVATE_11 \
&& (str)[0] != LEADING_CODE_PRIVATE_12) \
|| VALID_LEADING_CODE_P (str[1])) \
: (!CHAR_HEAD_P ((str)[3]) \
&& VALID_LEADING_CODE_P (str[1]))))))))
/* Return 1 iff the byte sequence at multibyte string STR is valid as
a unibyte form. By a side effect, BYTES is set to the byte length
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment