Mercurial > emacs
comparison src/coding.c @ 18536:69c0e220b626
(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.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 02 Jul 1997 12:53:53 +0000 |
parents | 6b5af78c8b21 |
children | 614b916ff5bf |
comparison
equal
deleted
inserted
replaced
18535:7ca42974dad4 | 18536:69c0e220b626 |
---|---|
306 }; | 306 }; |
307 | 307 |
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; |
320 | 322 |
321 /* Default coding systems used for process I/O. */ | 323 /* Default coding systems used for process I/O. */ |
730 unsigned char *adjusted_dst_end = dst_end - 6; | 732 unsigned char *adjusted_dst_end = dst_end - 6; |
731 int charset; | 733 int charset; |
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 { |
742 /* SRC_BASE remembers the start position in source in each loop. | 745 /* SRC_BASE remembers the start position in source in each loop. |
743 The loop will be exited when there's not enough source text | 746 The loop will be exited when there's not enough source text |
1187 #define ENCODE_ISO_CHARACTER(charset, c1, c2) \ | 1190 #define ENCODE_ISO_CHARACTER(charset, c1, c2) \ |
1188 do { \ | 1191 do { \ |
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; \ |
1196 if (CHARSET_DIMENSION (charset_alt) == 1) \ | 1199 if (CHARSET_DIMENSION (charset_alt) == 1) \ |
1197 ENCODE_ISO_CHARACTER_DIMENSION1 (charset_alt, c1); \ | 1200 ENCODE_ISO_CHARACTER_DIMENSION1 (charset_alt, c1); \ |
1367 unsigned char *dst_end = destination + dst_bytes; | 1370 unsigned char *dst_end = destination + dst_bytes; |
1368 /* Since the maximum bytes produced by each loop is 20, we subtract 19 | 1371 /* Since the maximum bytes produced by each loop is 20, we subtract 19 |
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 { |
1379 /* SRC_BASE remembers the start position in source in each loop. | 1383 /* SRC_BASE remembers the start position in source in each loop. |
1380 The loop will be exited when there's not enough source text | 1384 The loop will be exited when there's not enough source text |
1606 b1 = temp / BIG5_SAME_ROW + 0xA1; \ | 1610 b1 = temp / BIG5_SAME_ROW + 0xA1; \ |
1607 b2 = temp % BIG5_SAME_ROW; \ | 1611 b2 = temp % BIG5_SAME_ROW; \ |
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. */ |
1614 | 1675 |
1615 int | 1676 int |
1677 unsigned char *dst_end = destination + dst_bytes; | 1738 unsigned char *dst_end = destination + dst_bytes; |
1678 /* Since the maximum bytes produced by each loop is 4, we subtract 3 | 1739 /* Since the maximum bytes produced by each loop is 4, we subtract 3 |
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 { |
1685 /* SRC_BASE remembers the start position in source in each loop. | 1751 /* SRC_BASE remembers the start position in source in each loop. |
1686 The loop will be exited when there's not enough source text | 1752 The loop will be exited when there's not enough source text |
1701 *dst++ = c1, src--; | 1767 *dst++ = c1, src--; |
1702 } | 1768 } |
1703 else | 1769 else |
1704 *dst++ = c1; | 1770 *dst++ = c1; |
1705 } | 1771 } |
1772 else if (c1 < 0x20) | |
1773 *dst++ = c1; | |
1706 else if (c1 < 0x80) | 1774 else if (c1 < 0x80) |
1707 *dst++ = c1; | 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) */ |
1711 if (sjis_p) | 1779 if (sjis_p) |
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 { |
1719 int charset; | 1787 int charset; |
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; |
1727 } | 1795 } |
1728 else | 1796 else |
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; |
1743 | 1811 |
1744 label_end_of_loop: | 1812 label_end_of_loop: |
1775 unsigned char *dst_end = destination + dst_bytes; | 1843 unsigned char *dst_end = destination + dst_bytes; |
1776 /* Since the maximum bytes produced by each loop is 2, we subtract 1 | 1844 /* Since the maximum bytes produced by each loop is 2, we subtract 1 |
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 { |
1783 /* SRC_BASE remembers the start position in source in each loop. | 1856 /* SRC_BASE remembers the start position in source in each loop. |
1784 The loop will be exited when there's not enough source text | 1857 The loop will be exited when there's not enough source text |
1802 } | 1875 } |
1803 | 1876 |
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; |
1810 | 1886 |
1811 case EMACS_carriage_return_code: | 1887 case EMACS_carriage_return_code: |
1826 *dst++ = '\r'; | 1902 *dst++ = '\r'; |
1827 break; | 1903 break; |
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: |
1864 coding->composing = 1; | 1921 coding->composing = 1; |
1865 break; | 1922 break; |
2104 coding->selective = 0; | 2161 coding->selective = 0; |
2105 coding->composing = 0; | 2162 coding->composing = 0; |
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)) |
2121 coding->post_read_conversion = Fget (coding_system, | 2179 coding->post_read_conversion = Fget (coding_system, |
2122 Qpost_read_conversion); | 2180 Qpost_read_conversion); |
2123 if (NILP (coding->pre_write_conversion)) | 2181 if (NILP (coding->pre_write_conversion)) |
2124 coding->pre_write_conversion = Fget (coding_system, | 2182 coding->pre_write_conversion = Fget (coding_system, |
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; |
2133 | 2219 |
2134 if (VECTORP (eol_type)) | 2220 if (VECTORP (eol_type)) |
3376 { | 3462 { |
3377 return keyboard_coding.symbol; | 3463 return keyboard_coding.symbol; |
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\ |
3387 for decoding (in case OPERATION does decoding).\n\ | 3473 for decoding (in case OPERATION does decoding).\n\ |
3388 \n\ | 3474 \n\ |
3586 Qcharacter_unification_table = intern ("character-unification-table"); | 3672 Qcharacter_unification_table = intern ("character-unification-table"); |
3587 staticpro (&Qcharacter_unification_table); | 3673 staticpro (&Qcharacter_unification_table); |
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); |
3594 defsubr (&Sread_non_nil_coding_system); | 3688 defsubr (&Sread_non_nil_coding_system); |
3595 defsubr (&Scheck_coding_system); | 3689 defsubr (&Scheck_coding_system); |
3604 defsubr (&Sencode_big5_char); | 3698 defsubr (&Sencode_big5_char); |
3605 defsubr (&Sset_terminal_coding_system_internal); | 3699 defsubr (&Sset_terminal_coding_system_internal); |
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."); |
3613 { | 3707 { |
3614 int i; | 3708 int i; |
3699 | 3793 |
3700 DEFVAR_LISP ("enable-character-unification", &Venable_character_unification, | 3794 DEFVAR_LISP ("enable-character-unification", &Venable_character_unification, |
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\ |
3716 While encoding, if a charset (car part of an element) is found,\n\ | 3810 While encoding, if a charset (car part of an element) is found,\n\ |
3717 designate it with the escape sequence identifing revision (cdr part of the element)."); | 3811 designate it with the escape sequence identifing revision (cdr part of the element)."); |