diff options
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/charset.h | 30 |
2 files changed, 24 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 34f81336e6d..1ceb2ec3134 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2003-05-31 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * charset.h (VALID_LEADING_CODE_P): New macro. | ||
| 4 | (UNIBYTE_STR_AS_MULTIBYTE_P): Check more rigidly. | ||
| 5 | |||
| 1 | 2003-05-30 Kenichi Handa <handa@m17n.org> | 6 | 2003-05-30 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * coding.c (ccl_coding_driver): Set ccl->eight_bit_control | 8 | * coding.c (ccl_coding_driver): Set ccl->eight_bit_control |
diff --git a/src/charset.h b/src/charset.h index 97b9801464e..fd8905e47d8 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -441,21 +441,29 @@ extern int width_by_char_head[256]; | |||
| 441 | 441 | ||
| 442 | #endif /* not BYTE_COMBINING_DEBUG */ | 442 | #endif /* not BYTE_COMBINING_DEBUG */ |
| 443 | 443 | ||
| 444 | #define VALID_LEADING_CODE_P(code) \ | ||
| 445 | (! NILP (CHARSET_TABLE_ENTRY (code))) | ||
| 446 | |||
| 444 | /* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) | 447 | /* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) |
| 445 | is valid as a multibyte form. If valid, by a side effect, BYTES is | 448 | is valid as a multibyte form. If valid, by a side effect, BYTES is |
| 446 | set to the byte length of the multibyte form. */ | 449 | set to the byte length of the multibyte form. */ |
| 447 | 450 | ||
| 448 | #define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \ | 451 | #define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \ |
| 449 | (((str)[0] < 0x80 || (str)[0] >= 0xA0) \ | 452 | (((str)[0] < 0x80 || (str)[0] >= 0xA0) \ |
| 450 | ? ((bytes) = 1) \ | 453 | ? ((bytes) = 1) \ |
| 451 | : (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \ | 454 | : (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \ |
| 452 | ((bytes) > 1 && (bytes) <= (length) \ | 455 | ((bytes) <= (length) \ |
| 453 | && (str)[0] != LEADING_CODE_8_BIT_CONTROL \ | 456 | && !CHAR_HEAD_P ((str)[1]) \ |
| 454 | && !CHAR_HEAD_P ((str)[1]) \ | 457 | && ((bytes) == 2 \ |
| 455 | && ((bytes) == 2 \ | 458 | ? (str)[0] != LEADING_CODE_8_BIT_CONTROL \ |
| 456 | || (!CHAR_HEAD_P ((str)[2]) \ | 459 | : (!CHAR_HEAD_P ((str)[2]) \ |
| 457 | && ((bytes) == 3 \ | 460 | && ((bytes) == 3 \ |
| 458 | || !CHAR_HEAD_P ((str)[3]))))))) | 461 | ? (((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 | |||
| 459 | 467 | ||
| 460 | /* Return 1 iff the byte sequence at multibyte string STR is valid as | 468 | /* Return 1 iff the byte sequence at multibyte string STR is valid as |
| 461 | a unibyte form. By a side effect, BYTES is set to the byte length | 469 | a unibyte form. By a side effect, BYTES is set to the byte length |