441 |
|
|
442 |
#endif /* not BYTE_COMBINING_DEBUG */ |
#endif /* not BYTE_COMBINING_DEBUG */ |
443 |
|
|
444 |
|
#define VALID_LEADING_CODE_P(code) \ |
445 |
|
(! NILP (CHARSET_TABLE_ENTRY (code))) |
446 |
|
|
447 |
/* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) |
/* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) |
448 |
is valid as a multibyte form. If valid, by a side effect, BYTES is |
is valid as a multibyte form. If valid, by a side effect, BYTES is |
449 |
set to the byte length of the multibyte form. */ |
set to the byte length of the multibyte form. */ |
450 |
|
|
451 |
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \ |
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \ |
452 |
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \ |
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \ |
453 |
? ((bytes) = 1) \ |
? ((bytes) = 1) \ |
454 |
: (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \ |
: (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \ |
455 |
((bytes) > 1 && (bytes) <= (length) \ |
((bytes) <= (length) \ |
456 |
&& (str)[0] != LEADING_CODE_8_BIT_CONTROL \ |
&& !CHAR_HEAD_P ((str)[1]) \ |
457 |
&& !CHAR_HEAD_P ((str)[1]) \ |
&& ((bytes) == 2 \ |
458 |
&& ((bytes) == 2 \ |
? (str)[0] != LEADING_CODE_8_BIT_CONTROL \ |
459 |
|| (!CHAR_HEAD_P ((str)[2]) \ |
: (!CHAR_HEAD_P ((str)[2]) \ |
460 |
&& ((bytes) == 3 \ |
&& ((bytes) == 3 \ |
461 |
|| !CHAR_HEAD_P ((str)[3]))))))) |
? (((str)[0] != LEADING_CODE_PRIVATE_11 \ |
462 |
|
&& (str)[0] != LEADING_CODE_PRIVATE_12) \ |
463 |
|
|| VALID_LEADING_CODE_P (str[1])) \ |
464 |
|
: (!CHAR_HEAD_P ((str)[3]) \ |
465 |
|
&& VALID_LEADING_CODE_P (str[1])))))))) |
466 |
|
|
467 |
|
|
468 |
/* Return 1 iff the byte sequence at multibyte string STR is valid as |
/* Return 1 iff the byte sequence at multibyte string STR is valid as |
469 |
a unibyte form. By a side effect, BYTES is set to the byte length |
a unibyte form. By a side effect, BYTES is set to the byte length |