diff options
| author | Kenichi Handa | 1997-07-02 12:53:53 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-07-02 12:53:53 +0000 |
| commit | a5d301dfecb69988da16a8405ea642aac35230a3 (patch) | |
| tree | ceb6529a30d7281e90611695270df8b4aa469be0 /src/coding.c | |
| parent | e8cafdc133e5fa9d6098f6b66005d625fd0fa883 (diff) | |
| download | emacs-a5d301dfecb69988da16a8405ea642aac35230a3.tar.gz emacs-a5d301dfecb69988da16a8405ea642aac35230a3.zip | |
(Vstandard_character_unification_table_for_decode):
Name changed from Vstandard_character_unification_table_for_read.
(Vstandard_character_unification_table_for_encode): Name changed
from Vstandard_character_unification_table_for_write.
(Qcharacter_unification_table_for_decode): New variable.
(Qcharacter_unification_table_for_encode): New variable.
(decode_coding_iso2022): Adjusted for the above name change.
(encode_coding_iso2022): Likewise.
(ENCODE_ISO_CHARACTER): Bug of handling return value of unify_char
fixed.
(DECODE_SJIS_BIG5_CHARACTER): New macro.
(decode_coding_sjis_big5): Handle character unificatoin table.
Use macro DECODE_SJIS_BIG5_CHARACTER.
(encode_coding_sjis_big5): Handle character unificatoin table.
Use macro ENCODE_SJIS_BIG5_CHARACTER.
(setup_coding_system): Handle members
character_unification_table_for_decode and
character_unification_table_for_encode of the variable coding.
(Ffind_operation_coding_system): Renamed from Ffind_coding_system.
(syms_of_coding): Initialize and staticpro
Qcharacter_unification_table_for_decode and
Qcharacter_unification_table_for_decode. Declare
Ffind_operation_coding_system as Lisp functions. Declare
Vstandard_character_unification_table_for_decode and
Vstandard_character_unification_table_for_encode as Lisp
variables.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 194 |
1 files changed, 144 insertions, 50 deletions
diff --git a/src/coding.c b/src/coding.c index 26283bdaad9..b04912ceba6 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -308,12 +308,14 @@ char *coding_category_name[CODING_CATEGORY_IDX_MAX] = { | |||
| 308 | /* Flag to tell if we look up unification table on character code | 308 | /* Flag to tell if we look up unification table on character code |
| 309 | conversion. */ | 309 | conversion. */ |
| 310 | Lisp_Object Venable_character_unification; | 310 | Lisp_Object Venable_character_unification; |
| 311 | /* Standard unification table to look up on reading (decoding). */ | 311 | /* Standard unification table to look up on decoding (reading). */ |
| 312 | Lisp_Object Vstandard_character_unification_table_for_read; | 312 | Lisp_Object Vstandard_character_unification_table_for_decode; |
| 313 | /* Standard unification table to look up on writing (encoding). */ | 313 | /* Standard unification table to look up on encoding (writing). */ |
| 314 | Lisp_Object Vstandard_character_unification_table_for_write; | 314 | Lisp_Object Vstandard_character_unification_table_for_encode; |
| 315 | 315 | ||
| 316 | Lisp_Object Qcharacter_unification_table; | 316 | Lisp_Object Qcharacter_unification_table; |
| 317 | Lisp_Object Qcharacter_unification_table_for_decode; | ||
| 318 | Lisp_Object Qcharacter_unification_table_for_encode; | ||
| 317 | 319 | ||
| 318 | /* Alist of charsets vs revision number. */ | 320 | /* Alist of charsets vs revision number. */ |
| 319 | Lisp_Object Vcharset_revision_alist; | 321 | Lisp_Object Vcharset_revision_alist; |
| @@ -732,10 +734,11 @@ decode_coding_iso2022 (coding, source, destination, | |||
| 732 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ | 734 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ |
| 733 | int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); | 735 | int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); |
| 734 | int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); | 736 | int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); |
| 735 | Lisp_Object unification_table = coding->character_unification_table; | 737 | Lisp_Object unification_table |
| 738 | = coding->character_unification_table_for_decode; | ||
| 736 | 739 | ||
| 737 | if (!NILP (Venable_character_unification) && NILP (unification_table)) | 740 | if (!NILP (Venable_character_unification) && NILP (unification_table)) |
| 738 | unification_table = Vstandard_character_unification_table_for_read; | 741 | unification_table = Vstandard_character_unification_table_for_decode; |
| 739 | 742 | ||
| 740 | while (src < src_end && dst < adjusted_dst_end) | 743 | while (src < src_end && dst < adjusted_dst_end) |
| 741 | { | 744 | { |
| @@ -1189,7 +1192,7 @@ decode_coding_iso2022 (coding, source, destination, | |||
| 1189 | int c_alt, charset_alt; \ | 1192 | int c_alt, charset_alt; \ |
| 1190 | if (!NILP (unification_table) \ | 1193 | if (!NILP (unification_table) \ |
| 1191 | && ((c_alt = unify_char (unification_table, -1, charset, c1, c2)) \ | 1194 | && ((c_alt = unify_char (unification_table, -1, charset, c1, c2)) \ |
| 1192 | < 0)) \ | 1195 | >= 0)) \ |
| 1193 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ | 1196 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ |
| 1194 | else \ | 1197 | else \ |
| 1195 | charset_alt = charset; \ | 1198 | charset_alt = charset; \ |
| @@ -1369,10 +1372,11 @@ encode_coding_iso2022 (coding, source, destination, | |||
| 1369 | from DST_END to assure overflow checking is necessary only at the | 1372 | from DST_END to assure overflow checking is necessary only at the |
| 1370 | head of loop. */ | 1373 | head of loop. */ |
| 1371 | unsigned char *adjusted_dst_end = dst_end - 19; | 1374 | unsigned char *adjusted_dst_end = dst_end - 19; |
| 1372 | Lisp_Object unification_table = coding->character_unification_table; | 1375 | Lisp_Object unification_table |
| 1376 | = coding->character_unification_table_for_encode; | ||
| 1373 | 1377 | ||
| 1374 | if (!NILP (Venable_character_unification) && NILP (unification_table)) | 1378 | if (!NILP (Venable_character_unification) && NILP (unification_table)) |
| 1375 | unification_table = Vstandard_character_unification_table_for_write; | 1379 | unification_table = Vstandard_character_unification_table_for_encode; |
| 1376 | 1380 | ||
| 1377 | while (src < src_end && dst < adjusted_dst_end) | 1381 | while (src < src_end && dst < adjusted_dst_end) |
| 1378 | { | 1382 | { |
| @@ -1608,6 +1612,63 @@ encode_coding_iso2022 (coding, source, destination, | |||
| 1608 | b2 += b2 < 0x3F ? 0x40 : 0x62; \ | 1612 | b2 += b2 < 0x3F ? 0x40 : 0x62; \ |
| 1609 | } while (0) | 1613 | } while (0) |
| 1610 | 1614 | ||
| 1615 | #define DECODE_SJIS_BIG5_CHARACTER(charset, c1, c2) \ | ||
| 1616 | do { \ | ||
| 1617 | int c_alt, charset_alt = (charset); \ | ||
| 1618 | if (!NILP (unification_table) \ | ||
| 1619 | && ((c_alt = unify_char (unification_table, \ | ||
| 1620 | -1, (charset), c1, c2)) >= 0)) \ | ||
| 1621 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ | ||
| 1622 | if (charset_alt == CHARSET_ASCII || charset_alt < 0) \ | ||
| 1623 | DECODE_CHARACTER_ASCII (c1); \ | ||
| 1624 | else if (CHARSET_DIMENSION (charset_alt) == 1) \ | ||
| 1625 | DECODE_CHARACTER_DIMENSION1 (charset_alt, c1); \ | ||
| 1626 | else \ | ||
| 1627 | DECODE_CHARACTER_DIMENSION2 (charset_alt, c1, c2); \ | ||
| 1628 | } while (0) | ||
| 1629 | |||
| 1630 | #define ENCODE_SJIS_BIG5_CHARACTER(charset, c1, c2) \ | ||
| 1631 | do { \ | ||
| 1632 | int c_alt, charset_alt; \ | ||
| 1633 | if (!NILP (unification_table) \ | ||
| 1634 | && ((c_alt = unify_char (unification_table, -1, charset, c1, c2)) \ | ||
| 1635 | >= 0)) \ | ||
| 1636 | SPLIT_CHAR (c_alt, charset_alt, c1, c2); \ | ||
| 1637 | else \ | ||
| 1638 | charset_alt = charset; \ | ||
| 1639 | if (charset_alt == charset_ascii) \ | ||
| 1640 | *dst++ = c1; \ | ||
| 1641 | else if (CHARSET_DIMENSION (charset_alt) == 1) \ | ||
| 1642 | { \ | ||
| 1643 | if (sjis_p && charset_alt == charset_katakana_jisx0201) \ | ||
| 1644 | *dst++ = c1; \ | ||
| 1645 | else \ | ||
| 1646 | *dst++ = charset_alt, *dst++ = c1; \ | ||
| 1647 | } \ | ||
| 1648 | else \ | ||
| 1649 | { \ | ||
| 1650 | c1 &= 0x7F, c2 &= 0x7F; \ | ||
| 1651 | if (sjis_p && charset_alt == charset_jisx0208) \ | ||
| 1652 | { \ | ||
| 1653 | unsigned char s1, s2; \ | ||
| 1654 | \ | ||
| 1655 | ENCODE_SJIS (c1, c2, s1, s2); \ | ||
| 1656 | *dst++ = s1, *dst++ = s2; \ | ||
| 1657 | } \ | ||
| 1658 | else if (!sjis_p \ | ||
| 1659 | && (charset_alt == charset_big5_1 \ | ||
| 1660 | || charset_alt == charset_big5_2)) \ | ||
| 1661 | { \ | ||
| 1662 | unsigned char b1, b2; \ | ||
| 1663 | \ | ||
| 1664 | ENCODE_BIG5 (c1, c2, c3, b1, b2); \ | ||
| 1665 | *dst++ = b1, *dst++ = b2; \ | ||
| 1666 | } \ | ||
| 1667 | else \ | ||
| 1668 | *dst++ = charset_alt, *dst++ = c1, *dst++ = c2; \ | ||
| 1669 | } \ | ||
| 1670 | } while (0); | ||
| 1671 | |||
| 1611 | /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". | 1672 | /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". |
| 1612 | Check if a text is encoded in SJIS. If it is, return | 1673 | Check if a text is encoded in SJIS. If it is, return |
| 1613 | CODING_CATEGORY_MASK_SJIS, else return 0. */ | 1674 | CODING_CATEGORY_MASK_SJIS, else return 0. */ |
| @@ -1679,6 +1740,11 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 1679 | from DST_END to assure overflow checking is necessary only at the | 1740 | from DST_END to assure overflow checking is necessary only at the |
| 1680 | head of loop. */ | 1741 | head of loop. */ |
| 1681 | unsigned char *adjusted_dst_end = dst_end - 3; | 1742 | unsigned char *adjusted_dst_end = dst_end - 3; |
| 1743 | Lisp_Object unification_table | ||
| 1744 | = coding->character_unification_table_for_decode; | ||
| 1745 | |||
| 1746 | if (!NILP (Venable_character_unification) && NILP (unification_table)) | ||
| 1747 | unification_table = Vstandard_character_unification_table_for_decode; | ||
| 1682 | 1748 | ||
| 1683 | while (src < src_end && dst < adjusted_dst_end) | 1749 | while (src < src_end && dst < adjusted_dst_end) |
| 1684 | { | 1750 | { |
| @@ -1703,8 +1769,10 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 1703 | else | 1769 | else |
| 1704 | *dst++ = c1; | 1770 | *dst++ = c1; |
| 1705 | } | 1771 | } |
| 1706 | else if (c1 < 0x80) | 1772 | else if (c1 < 0x20) |
| 1707 | *dst++ = c1; | 1773 | *dst++ = c1; |
| 1774 | else if (c1 < 0x80) | ||
| 1775 | DECODE_SJIS_BIG5_CHARACTER (charset_ascii, c1, /* dummy */ c2); | ||
| 1708 | else if (c1 < 0xA0 || c1 >= 0xE0) | 1776 | else if (c1 < 0xA0 || c1 >= 0xE0) |
| 1709 | { | 1777 | { |
| 1710 | /* SJIS -> JISX0208, BIG5 -> Big5 (only if 0xE0 <= c1 < 0xFF) */ | 1778 | /* SJIS -> JISX0208, BIG5 -> Big5 (only if 0xE0 <= c1 < 0xFF) */ |
| @@ -1712,7 +1780,7 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 1712 | { | 1780 | { |
| 1713 | ONE_MORE_BYTE (c2); | 1781 | ONE_MORE_BYTE (c2); |
| 1714 | DECODE_SJIS (c1, c2, c3, c4); | 1782 | DECODE_SJIS (c1, c2, c3, c4); |
| 1715 | DECODE_CHARACTER_DIMENSION2 (charset_jisx0208, c3, c4); | 1783 | DECODE_SJIS_BIG5_CHARACTER (charset_jisx0208, c3, c4); |
| 1716 | } | 1784 | } |
| 1717 | else if (c1 >= 0xE0 && c1 < 0xFF) | 1785 | else if (c1 >= 0xE0 && c1 < 0xFF) |
| 1718 | { | 1786 | { |
| @@ -1720,7 +1788,7 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 1720 | 1788 | ||
| 1721 | ONE_MORE_BYTE (c2); | 1789 | ONE_MORE_BYTE (c2); |
| 1722 | DECODE_BIG5 (c1, c2, charset, c3, c4); | 1790 | DECODE_BIG5 (c1, c2, charset, c3, c4); |
| 1723 | DECODE_CHARACTER_DIMENSION2 (charset, c3, c4); | 1791 | DECODE_SJIS_BIG5_CHARACTER (charset, c3, c4); |
| 1724 | } | 1792 | } |
| 1725 | else /* Invalid code */ | 1793 | else /* Invalid code */ |
| 1726 | *dst++ = c1; | 1794 | *dst++ = c1; |
| @@ -1729,14 +1797,14 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 1729 | { | 1797 | { |
| 1730 | /* SJIS -> JISX0201-Kana, BIG5 -> Big5 */ | 1798 | /* SJIS -> JISX0201-Kana, BIG5 -> Big5 */ |
| 1731 | if (sjis_p) | 1799 | if (sjis_p) |
| 1732 | DECODE_CHARACTER_DIMENSION1 (charset_katakana_jisx0201, c1); | 1800 | DECODE_SJIS_BIG5_CHARACTER (charset_katakana_jisx0201, c1, /* dummy */ c2); |
| 1733 | else | 1801 | else |
| 1734 | { | 1802 | { |
| 1735 | int charset; | 1803 | int charset; |
| 1736 | 1804 | ||
| 1737 | ONE_MORE_BYTE (c2); | 1805 | ONE_MORE_BYTE (c2); |
| 1738 | DECODE_BIG5 (c1, c2, charset, c3, c4); | 1806 | DECODE_BIG5 (c1, c2, charset, c3, c4); |
| 1739 | DECODE_CHARACTER_DIMENSION2 (charset, c3, c4); | 1807 | DECODE_SJIS_BIG5_CHARACTER (charset, c3, c4); |
| 1740 | } | 1808 | } |
| 1741 | } | 1809 | } |
| 1742 | continue; | 1810 | continue; |
| @@ -1777,6 +1845,11 @@ encode_coding_sjis_big5 (coding, source, destination, | |||
| 1777 | from DST_END to assure overflow checking is necessary only at the | 1845 | from DST_END to assure overflow checking is necessary only at the |
| 1778 | head of loop. */ | 1846 | head of loop. */ |
| 1779 | unsigned char *adjusted_dst_end = dst_end - 1; | 1847 | unsigned char *adjusted_dst_end = dst_end - 1; |
| 1848 | Lisp_Object unification_table | ||
| 1849 | = coding->character_unification_table_for_encode; | ||
| 1850 | |||
| 1851 | if (!NILP (Venable_character_unification) && NILP (unification_table)) | ||
| 1852 | unification_table = Vstandard_character_unification_table_for_encode; | ||
| 1780 | 1853 | ||
| 1781 | while (src < src_end && dst < adjusted_dst_end) | 1854 | while (src < src_end && dst < adjusted_dst_end) |
| 1782 | { | 1855 | { |
| @@ -1804,6 +1877,9 @@ encode_coding_sjis_big5 (coding, source, destination, | |||
| 1804 | switch (emacs_code_class[c1]) | 1877 | switch (emacs_code_class[c1]) |
| 1805 | { | 1878 | { |
| 1806 | case EMACS_ascii_code: | 1879 | case EMACS_ascii_code: |
| 1880 | ENCODE_SJIS_BIG5_CHARACTER (charset_ascii, c1, /* dummy */ c2); | ||
| 1881 | break; | ||
| 1882 | |||
| 1807 | case EMACS_control_code: | 1883 | case EMACS_control_code: |
| 1808 | *dst++ = c1; | 1884 | *dst++ = c1; |
| 1809 | break; | 1885 | break; |
| @@ -1828,36 +1904,17 @@ encode_coding_sjis_big5 (coding, source, destination, | |||
| 1828 | 1904 | ||
| 1829 | case EMACS_leading_code_2: | 1905 | case EMACS_leading_code_2: |
| 1830 | ONE_MORE_BYTE (c2); | 1906 | ONE_MORE_BYTE (c2); |
| 1831 | if (sjis_p && c1 == charset_katakana_jisx0201) | 1907 | ENCODE_SJIS_BIG5_CHARACTER (c1, c2, /* dummy */ c3); |
| 1832 | *dst++ = c2; | ||
| 1833 | else | ||
| 1834 | *dst++ = c1, *dst++ = c2; | ||
| 1835 | break; | 1908 | break; |
| 1836 | 1909 | ||
| 1837 | case EMACS_leading_code_3: | 1910 | case EMACS_leading_code_3: |
| 1838 | TWO_MORE_BYTES (c2, c3); | 1911 | TWO_MORE_BYTES (c2, c3); |
| 1839 | c2 &= 0x7F, c3 &= 0x7F; | 1912 | ENCODE_SJIS_BIG5_CHARACTER (c1, c2, c3); |
| 1840 | if (sjis_p && c1 == charset_jisx0208) | ||
| 1841 | { | ||
| 1842 | unsigned char s1, s2; | ||
| 1843 | |||
| 1844 | ENCODE_SJIS (c2, c3, s1, s2); | ||
| 1845 | *dst++ = s1, *dst++ = s2; | ||
| 1846 | } | ||
| 1847 | else if (!sjis_p && (c1 == charset_big5_1 || c1 == charset_big5_2)) | ||
| 1848 | { | ||
| 1849 | unsigned char b1, b2; | ||
| 1850 | |||
| 1851 | ENCODE_BIG5 (c1, c2, c3, b1, b2); | ||
| 1852 | *dst++ = b1, *dst++ = b2; | ||
| 1853 | } | ||
| 1854 | else | ||
| 1855 | *dst++ = c1, *dst++ = c2, *dst++ = c3; | ||
| 1856 | break; | 1913 | break; |
| 1857 | 1914 | ||
| 1858 | case EMACS_leading_code_4: | 1915 | case EMACS_leading_code_4: |
| 1859 | THREE_MORE_BYTES (c2, c3, c4); | 1916 | THREE_MORE_BYTES (c2, c3, c4); |
| 1860 | *dst++ = c1, *dst++ = c2, *dst++ = c3, *dst++ = c4; | 1917 | ENCODE_SJIS_BIG5_CHARACTER (c2, c3, c4); |
| 1861 | break; | 1918 | break; |
| 1862 | 1919 | ||
| 1863 | case EMACS_leading_code_composition: | 1920 | case EMACS_leading_code_composition: |
| @@ -2106,15 +2163,16 @@ setup_coding_system (coding_system, coding) | |||
| 2106 | coding->direction = 0; | 2163 | coding->direction = 0; |
| 2107 | coding->carryover_size = 0; | 2164 | coding->carryover_size = 0; |
| 2108 | coding->post_read_conversion = coding->pre_write_conversion = Qnil; | 2165 | coding->post_read_conversion = coding->pre_write_conversion = Qnil; |
| 2109 | /* We have not yet implemented a way to specify unification table in | 2166 | coding->character_unification_table_for_decode = Qnil; |
| 2110 | a coding system. */ | 2167 | coding->character_unification_table_for_encode = Qnil; |
| 2111 | coding->character_unification_table = Qnil; | ||
| 2112 | 2168 | ||
| 2113 | Vlast_coding_system_used = coding->symbol = coding_system; | 2169 | Vlast_coding_system_used = coding->symbol = coding_system; |
| 2114 | eol_type = Qnil; | 2170 | eol_type = Qnil; |
| 2115 | /* Get value of property `coding-system' until we get a vector. | 2171 | /* Get value of property `coding-system' until we get a vector. |
| 2116 | While doing that, also get values of properties | 2172 | While doing that, also get values of properties |
| 2117 | `post-read-conversion', `pre-write-conversion', and `eol-type'. */ | 2173 | `post-read-conversion', `pre-write-conversion', |
| 2174 | `character-unification-table-for-decode', | ||
| 2175 | `character-unification-table-for-encode' and `eol-type'. */ | ||
| 2118 | while (!NILP (coding_system) && SYMBOLP (coding_system)) | 2176 | while (!NILP (coding_system) && SYMBOLP (coding_system)) |
| 2119 | { | 2177 | { |
| 2120 | if (NILP (coding->post_read_conversion)) | 2178 | if (NILP (coding->post_read_conversion)) |
| @@ -2125,8 +2183,36 @@ setup_coding_system (coding_system, coding) | |||
| 2125 | Qpre_write_conversion); | 2183 | Qpre_write_conversion); |
| 2126 | if (NILP (eol_type)) | 2184 | if (NILP (eol_type)) |
| 2127 | eol_type = Fget (coding_system, Qeol_type); | 2185 | eol_type = Fget (coding_system, Qeol_type); |
| 2186 | |||
| 2187 | if (NILP (coding->character_unification_table_for_decode)) | ||
| 2188 | coding->character_unification_table_for_decode | ||
| 2189 | = Fget (coding_system, Qcharacter_unification_table_for_decode); | ||
| 2190 | |||
| 2191 | if (NILP (coding->character_unification_table_for_encode)) | ||
| 2192 | coding->character_unification_table_for_encode | ||
| 2193 | = Fget (coding_system, Qcharacter_unification_table_for_encode); | ||
| 2194 | |||
| 2128 | coding_system = Fget (coding_system, Qcoding_system); | 2195 | coding_system = Fget (coding_system, Qcoding_system); |
| 2129 | } | 2196 | } |
| 2197 | |||
| 2198 | while (!NILP (coding->character_unification_table_for_decode) | ||
| 2199 | && SYMBOLP (coding->character_unification_table_for_decode)) | ||
| 2200 | coding->character_unification_table_for_decode | ||
| 2201 | = Fget (coding->character_unification_table_for_decode, | ||
| 2202 | Qcharacter_unification_table_for_decode); | ||
| 2203 | if (!NILP (coding->character_unification_table_for_decode) | ||
| 2204 | && !CHAR_TABLE_P (coding->character_unification_table_for_decode)) | ||
| 2205 | coding->character_unification_table_for_decode = Qnil; | ||
| 2206 | |||
| 2207 | while (!NILP (coding->character_unification_table_for_encode) | ||
| 2208 | && SYMBOLP (coding->character_unification_table_for_encode)) | ||
| 2209 | coding->character_unification_table_for_encode | ||
| 2210 | = Fget (coding->character_unification_table_for_encode, | ||
| 2211 | Qcharacter_unification_table_for_encode); | ||
| 2212 | if (!NILP (coding->character_unification_table_for_encode) | ||
| 2213 | && !CHAR_TABLE_P (coding->character_unification_table_for_encode)) | ||
| 2214 | coding->character_unification_table_for_encode = Qnil; | ||
| 2215 | |||
| 2130 | if (!VECTORP (coding_system) | 2216 | if (!VECTORP (coding_system) |
| 2131 | || XVECTOR (coding_system)->size != 5) | 2217 | || XVECTOR (coding_system)->size != 5) |
| 2132 | goto label_invalid_coding_system; | 2218 | goto label_invalid_coding_system; |
| @@ -3378,9 +3464,9 @@ DEFUN ("keyboard-coding-system", | |||
| 3378 | } | 3464 | } |
| 3379 | 3465 | ||
| 3380 | 3466 | ||
| 3381 | DEFUN ("find-coding-system", Ffind_coding_system, Sfind_coding_system, | 3467 | DEFUN ("find-operation-coding-system", Ffind_operation_coding_system, |
| 3382 | 1, MANY, 0, | 3468 | Sfind_operation_coding_system, 1, MANY, 0, |
| 3383 | "Choose a coding system for a file operation based on file name.\n\ | 3469 | "Choose a coding system for an operation based on the target name.\n\ |
| 3384 | The value names a pair of coding systems: (ENCODING-SYSTEM DECODING-SYSTEM).\n\ | 3470 | The value names a pair of coding systems: (ENCODING-SYSTEM DECODING-SYSTEM).\n\ |
| 3385 | ENCODING-SYSTEM is the coding system to use for encoding\n\ | 3471 | ENCODING-SYSTEM is the coding system to use for encoding\n\ |
| 3386 | \(in case OPERATION does encoding), and DECODING-SYSTEM is the coding system\n\ | 3472 | \(in case OPERATION does encoding), and DECODING-SYSTEM is the coding system\n\ |
| @@ -3588,6 +3674,14 @@ syms_of_coding () | |||
| 3588 | Fput (Qcharacter_unification_table, Qchar_table_extra_slots, | 3674 | Fput (Qcharacter_unification_table, Qchar_table_extra_slots, |
| 3589 | make_number (0)); | 3675 | make_number (0)); |
| 3590 | 3676 | ||
| 3677 | Qcharacter_unification_table_for_decode | ||
| 3678 | = intern ("character-unification-table-for-decode"); | ||
| 3679 | staticpro (&Qcharacter_unification_table_for_decode); | ||
| 3680 | |||
| 3681 | Qcharacter_unification_table_for_encode | ||
| 3682 | = intern ("character-unification-table-for-encode"); | ||
| 3683 | staticpro (&Qcharacter_unification_table_for_encode); | ||
| 3684 | |||
| 3591 | defsubr (&Scoding_system_spec); | 3685 | defsubr (&Scoding_system_spec); |
| 3592 | defsubr (&Scoding_system_p); | 3686 | defsubr (&Scoding_system_p); |
| 3593 | defsubr (&Sread_coding_system); | 3687 | defsubr (&Sread_coding_system); |
| @@ -3606,7 +3700,7 @@ syms_of_coding () | |||
| 3606 | defsubr (&Sterminal_coding_system); | 3700 | defsubr (&Sterminal_coding_system); |
| 3607 | defsubr (&Sset_keyboard_coding_system_internal); | 3701 | defsubr (&Sset_keyboard_coding_system_internal); |
| 3608 | defsubr (&Skeyboard_coding_system); | 3702 | defsubr (&Skeyboard_coding_system); |
| 3609 | defsubr (&Sfind_coding_system); | 3703 | defsubr (&Sfind_operation_coding_system); |
| 3610 | 3704 | ||
| 3611 | DEFVAR_LISP ("coding-category-list", &Vcoding_category_list, | 3705 | DEFVAR_LISP ("coding-category-list", &Vcoding_category_list, |
| 3612 | "List of coding-categories (symbols) ordered by priority."); | 3706 | "List of coding-categories (symbols) ordered by priority."); |
| @@ -3701,15 +3795,15 @@ See also the function `find-coding-system'."); | |||
| 3701 | "Non-nil means ISO 2022 encoder/decoder do character unification."); | 3795 | "Non-nil means ISO 2022 encoder/decoder do character unification."); |
| 3702 | Venable_character_unification = Qt; | 3796 | Venable_character_unification = Qt; |
| 3703 | 3797 | ||
| 3704 | DEFVAR_LISP ("standard-character-unification-table-for-read", | 3798 | DEFVAR_LISP ("standard-character-unification-table-for-decode", |
| 3705 | &Vstandard_character_unification_table_for_read, | 3799 | &Vstandard_character_unification_table_for_decode, |
| 3706 | "Table for unifying characters when reading."); | 3800 | "Table for unifying characters when reading."); |
| 3707 | Vstandard_character_unification_table_for_read = Qnil; | 3801 | Vstandard_character_unification_table_for_decode = Qnil; |
| 3708 | 3802 | ||
| 3709 | DEFVAR_LISP ("standard-character-unification-table-for-write", | 3803 | DEFVAR_LISP ("standard-character-unification-table-for-encode", |
| 3710 | &Vstandard_character_unification_table_for_write, | 3804 | &Vstandard_character_unification_table_for_encode, |
| 3711 | "Table for unifying characters when writing."); | 3805 | "Table for unifying characters when writing."); |
| 3712 | Vstandard_character_unification_table_for_write = Qnil; | 3806 | Vstandard_character_unification_table_for_encode = Qnil; |
| 3713 | 3807 | ||
| 3714 | DEFVAR_LISP ("charset-revision-table", &Vcharset_revision_alist, | 3808 | DEFVAR_LISP ("charset-revision-table", &Vcharset_revision_alist, |
| 3715 | "Alist of charsets vs revision numbers.\n\ | 3809 | "Alist of charsets vs revision numbers.\n\ |