diff options
| author | Kenichi Handa | 1999-03-20 07:47:54 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-03-20 07:47:54 +0000 |
| commit | 6f5510294b0838b74ae6be126808b2b8618dc0c2 (patch) | |
| tree | 14b63aee02c526b2986570c388a042be8c0aa13a /src/coding.c | |
| parent | 00d6521642fbdf95fd9d1fc546e38af4ba504e95 (diff) | |
| download | emacs-6f5510294b0838b74ae6be126808b2b8618dc0c2.tar.gz emacs-6f5510294b0838b74ae6be126808b2b8618dc0c2.zip | |
(ENCODE_ISO_CHARACTER): Check validity of CHARSET. If
invalid, produce the buffer internal byte sequence without
encoding.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/src/coding.c b/src/coding.c index cf6bab223bb..4f91bbb1543 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1610,32 +1610,52 @@ decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | |||
| 1610 | dst = encode_invocation_designation (charset, coding, dst); \ | 1610 | dst = encode_invocation_designation (charset, coding, dst); \ |
| 1611 | } while (1) | 1611 | } while (1) |
| 1612 | 1612 | ||
| 1613 | #define ENCODE_ISO_CHARACTER(charset, c1, c2) \ | 1613 | #define ENCODE_ISO_CHARACTER(charset, c1, c2) \ |
| 1614 | do { \ | 1614 | do { \ |
| 1615 | int c_alt, charset_alt; \ | 1615 | int c_alt, charset_alt; \ |
| 1616 | if (!NILP (translation_table) \ | 1616 | if (!NILP (translation_table) \ |
| 1617 | && ((c_alt = translate_char (translation_table, -1, \ | 1617 | && ((c_alt = translate_char (translation_table, -1, \ |
| 1618 | charset, c1, c2)) \ | 1618 | charset, c1, c2)) \ |
| 1619 | >= 0)) \ | 1619 | >= 0)) \ |
| 1620 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ | 1620 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ |
| 1621 | else \ | 1621 | else \ |
| 1622 | charset_alt = charset; \ | 1622 | charset_alt = charset; \ |
| 1623 | if (CHARSET_DIMENSION (charset_alt) == 1) \ | 1623 | if (CHARSET_DEFINED_P (charset_alt)) \ |
| 1624 | { \ | 1624 | { \ |
| 1625 | if (charset == CHARSET_ASCII \ | 1625 | if (CHARSET_DIMENSION (charset_alt) == 1) \ |
| 1626 | && coding->flags & CODING_FLAG_ISO_USE_ROMAN) \ | 1626 | { \ |
| 1627 | charset_alt = charset_latin_jisx0201; \ | 1627 | if (charset == CHARSET_ASCII \ |
| 1628 | ENCODE_ISO_CHARACTER_DIMENSION1 (charset_alt, c1); \ | 1628 | && coding->flags & CODING_FLAG_ISO_USE_ROMAN) \ |
| 1629 | } \ | 1629 | charset_alt = charset_latin_jisx0201; \ |
| 1630 | else \ | 1630 | ENCODE_ISO_CHARACTER_DIMENSION1 (charset_alt, c1); \ |
| 1631 | { \ | 1631 | } \ |
| 1632 | if (charset == charset_jisx0208 \ | 1632 | else \ |
| 1633 | && coding->flags & CODING_FLAG_ISO_USE_OLDJIS) \ | 1633 | { \ |
| 1634 | charset_alt = charset_jisx0208_1978; \ | 1634 | if (charset == charset_jisx0208 \ |
| 1635 | ENCODE_ISO_CHARACTER_DIMENSION2 (charset_alt, c1, c2); \ | 1635 | && coding->flags & CODING_FLAG_ISO_USE_OLDJIS) \ |
| 1636 | } \ | 1636 | charset_alt = charset_jisx0208_1978; \ |
| 1637 | if (! COMPOSING_P (coding->composing)) \ | 1637 | ENCODE_ISO_CHARACTER_DIMENSION2 (charset_alt, c1, c2); \ |
| 1638 | coding->consumed_char++; \ | 1638 | } \ |
| 1639 | } \ | ||
| 1640 | else \ | ||
| 1641 | { \ | ||
| 1642 | if (coding->flags & CODING_FLAG_ISO_SEVEN_BITS) \ | ||
| 1643 | { \ | ||
| 1644 | *dst++ = charset & 0x7f; \ | ||
| 1645 | *dst++ = c1 & 0x7f; \ | ||
| 1646 | if (c2) \ | ||
| 1647 | *dst++ = c2 & 0x7f; \ | ||
| 1648 | } \ | ||
| 1649 | else \ | ||
| 1650 | { \ | ||
| 1651 | *dst++ = charset; \ | ||
| 1652 | *dst++ = c1; \ | ||
| 1653 | if (c2) \ | ||
| 1654 | *dst++ = c2; \ | ||
| 1655 | } \ | ||
| 1656 | } \ | ||
| 1657 | if (! COMPOSING_P (coding->composing)) \ | ||
| 1658 | coding->consumed_char++; \ | ||
| 1639 | } while (0) | 1659 | } while (0) |
| 1640 | 1660 | ||
| 1641 | /* Produce designation and invocation codes at a place pointed by DST | 1661 | /* Produce designation and invocation codes at a place pointed by DST |