Mercurial > emacs
comparison src/coding.c @ 24506:219c99669e4b
(ENCODE_ISO_CHARACTER): Check validity of CHARSET. If
invalid, produce the buffer internal byte sequence without
encoding.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Sat, 20 Mar 1999 07:47:54 +0000 |
| parents | be35d27a4bfb |
| children | 3aeaac397061 |
comparison
equal
deleted
inserted
replaced
| 24505:d6fcaeb4c03c | 24506:219c99669e4b |
|---|---|
| 1608 register. Then repeat the loop to actually produce the \ | 1608 register. Then repeat the loop to actually produce the \ |
| 1609 character. */ \ | 1609 character. */ \ |
| 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 |
| 1642 to use CHARSET. The element `spec.iso2022' of *CODING is updated. | 1662 to use CHARSET. The element `spec.iso2022' of *CODING is updated. |
| 1643 Return new DST. */ | 1663 Return new DST. */ |
