Mercurial > emacs
comparison src/coding.c @ 22186:fc4aaf1b1772
Change term "character translation table" to "translation table".
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Fri, 22 May 1998 09:45:34 +0000 |
| parents | 917e237b5e65 |
| children | 557fac086b1b |
comparison
equal
deleted
inserted
replaced
| 22185:80a2aa51a6e1 | 22186:fc4aaf1b1772 |
|---|---|
| 365 | 365 |
| 366 /* Table pointers to coding systems corresponding to each coding | 366 /* Table pointers to coding systems corresponding to each coding |
| 367 categories. */ | 367 categories. */ |
| 368 struct coding_system *coding_system_table[CODING_CATEGORY_IDX_MAX]; | 368 struct coding_system *coding_system_table[CODING_CATEGORY_IDX_MAX]; |
| 369 | 369 |
| 370 /* Flag to tell if we look up character translation table on character | 370 /* Flag to tell if we look up translation table on character code |
| 371 code conversion. */ | 371 conversion. */ |
| 372 Lisp_Object Venable_character_translation; | 372 Lisp_Object Venable_character_translation; |
| 373 /* Standard character translation table to look up on decoding (reading). */ | 373 /* Standard translation table to look up on decoding (reading). */ |
| 374 Lisp_Object Vstandard_character_translation_table_for_decode; | 374 Lisp_Object Vstandard_translation_table_for_decode; |
| 375 /* Standard character translation table to look up on encoding (writing). */ | 375 /* Standard translation table to look up on encoding (writing). */ |
| 376 Lisp_Object Vstandard_character_translation_table_for_encode; | 376 Lisp_Object Vstandard_translation_table_for_encode; |
| 377 | 377 |
| 378 Lisp_Object Qcharacter_translation_table; | 378 Lisp_Object Qtranslation_table; |
| 379 Lisp_Object Qcharacter_translation_table_id; | 379 Lisp_Object Qtranslation_table_id; |
| 380 Lisp_Object Qcharacter_translation_table_for_decode; | 380 Lisp_Object Qtranslation_table_for_decode; |
| 381 Lisp_Object Qcharacter_translation_table_for_encode; | 381 Lisp_Object Qtranslation_table_for_encode; |
| 382 | 382 |
| 383 /* Alist of charsets vs revision number. */ | 383 /* Alist of charsets vs revision number. */ |
| 384 Lisp_Object Vcharset_revision_alist; | 384 Lisp_Object Vcharset_revision_alist; |
| 385 | 385 |
| 386 /* Default coding systems used for process I/O. */ | 386 /* Default coding systems used for process I/O. */ |
| 1008 int charset; | 1008 int charset; |
| 1009 /* Charsets invoked to graphic plane 0 and 1 respectively. */ | 1009 /* Charsets invoked to graphic plane 0 and 1 respectively. */ |
| 1010 int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); | 1010 int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); |
| 1011 int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); | 1011 int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); |
| 1012 Lisp_Object translation_table | 1012 Lisp_Object translation_table |
| 1013 = coding->character_translation_table_for_decode; | 1013 = coding->translation_table_for_decode; |
| 1014 int result = CODING_FINISH_NORMAL; | 1014 int result = CODING_FINISH_NORMAL; |
| 1015 | 1015 |
| 1016 if (!NILP (Venable_character_translation) && NILP (translation_table)) | 1016 if (!NILP (Venable_character_translation) && NILP (translation_table)) |
| 1017 translation_table = Vstandard_character_translation_table_for_decode; | 1017 translation_table = Vstandard_translation_table_for_decode; |
| 1018 | 1018 |
| 1019 coding->produced_char = 0; | 1019 coding->produced_char = 0; |
| 1020 coding->fake_multibyte = 0; | 1020 coding->fake_multibyte = 0; |
| 1021 while (src < src_end && (dst_bytes | 1021 while (src < src_end && (dst_bytes |
| 1022 ? (dst < adjusted_dst_end) | 1022 ? (dst < adjusted_dst_end) |
| 1756 /* Since the maximum bytes produced by each loop is 20, we subtract 19 | 1756 /* Since the maximum bytes produced by each loop is 20, we subtract 19 |
| 1757 from DST_END to assure overflow checking is necessary only at the | 1757 from DST_END to assure overflow checking is necessary only at the |
| 1758 head of loop. */ | 1758 head of loop. */ |
| 1759 unsigned char *adjusted_dst_end = dst_end - 19; | 1759 unsigned char *adjusted_dst_end = dst_end - 19; |
| 1760 Lisp_Object translation_table | 1760 Lisp_Object translation_table |
| 1761 = coding->character_translation_table_for_encode; | 1761 = coding->translation_table_for_encode; |
| 1762 int result = CODING_FINISH_NORMAL; | 1762 int result = CODING_FINISH_NORMAL; |
| 1763 | 1763 |
| 1764 if (!NILP (Venable_character_translation) && NILP (translation_table)) | 1764 if (!NILP (Venable_character_translation) && NILP (translation_table)) |
| 1765 translation_table = Vstandard_character_translation_table_for_encode; | 1765 translation_table = Vstandard_translation_table_for_encode; |
| 1766 | 1766 |
| 1767 coding->consumed_char = 0; | 1767 coding->consumed_char = 0; |
| 1768 coding->fake_multibyte = 0; | 1768 coding->fake_multibyte = 0; |
| 1769 while (src < src_end && (dst_bytes | 1769 while (src < src_end && (dst_bytes |
| 1770 ? (dst < adjusted_dst_end) | 1770 ? (dst < adjusted_dst_end) |
| 2173 /* Since the maximum bytes produced by each loop is 4, we subtract 3 | 2173 /* Since the maximum bytes produced by each loop is 4, we subtract 3 |
| 2174 from DST_END to assure overflow checking is necessary only at the | 2174 from DST_END to assure overflow checking is necessary only at the |
| 2175 head of loop. */ | 2175 head of loop. */ |
| 2176 unsigned char *adjusted_dst_end = dst_end - 3; | 2176 unsigned char *adjusted_dst_end = dst_end - 3; |
| 2177 Lisp_Object translation_table | 2177 Lisp_Object translation_table |
| 2178 = coding->character_translation_table_for_decode; | 2178 = coding->translation_table_for_decode; |
| 2179 int result = CODING_FINISH_NORMAL; | 2179 int result = CODING_FINISH_NORMAL; |
| 2180 | 2180 |
| 2181 if (!NILP (Venable_character_translation) && NILP (translation_table)) | 2181 if (!NILP (Venable_character_translation) && NILP (translation_table)) |
| 2182 translation_table = Vstandard_character_translation_table_for_decode; | 2182 translation_table = Vstandard_translation_table_for_decode; |
| 2183 | 2183 |
| 2184 coding->produced_char = 0; | 2184 coding->produced_char = 0; |
| 2185 coding->fake_multibyte = 0; | 2185 coding->fake_multibyte = 0; |
| 2186 while (src < src_end && (dst_bytes | 2186 while (src < src_end && (dst_bytes |
| 2187 ? (dst < adjusted_dst_end) | 2187 ? (dst < adjusted_dst_end) |
| 2362 /* Since the maximum bytes produced by each loop is 2, we subtract 1 | 2362 /* Since the maximum bytes produced by each loop is 2, we subtract 1 |
| 2363 from DST_END to assure overflow checking is necessary only at the | 2363 from DST_END to assure overflow checking is necessary only at the |
| 2364 head of loop. */ | 2364 head of loop. */ |
| 2365 unsigned char *adjusted_dst_end = dst_end - 1; | 2365 unsigned char *adjusted_dst_end = dst_end - 1; |
| 2366 Lisp_Object translation_table | 2366 Lisp_Object translation_table |
| 2367 = coding->character_translation_table_for_encode; | 2367 = coding->translation_table_for_encode; |
| 2368 int result = CODING_FINISH_NORMAL; | 2368 int result = CODING_FINISH_NORMAL; |
| 2369 | 2369 |
| 2370 if (!NILP (Venable_character_translation) && NILP (translation_table)) | 2370 if (!NILP (Venable_character_translation) && NILP (translation_table)) |
| 2371 translation_table = Vstandard_character_translation_table_for_encode; | 2371 translation_table = Vstandard_translation_table_for_encode; |
| 2372 | 2372 |
| 2373 coding->consumed_char = 0; | 2373 coding->consumed_char = 0; |
| 2374 coding->fake_multibyte = 0; | 2374 coding->fake_multibyte = 0; |
| 2375 while (src < src_end && (dst_bytes | 2375 while (src < src_end && (dst_bytes |
| 2376 ? (dst < adjusted_dst_end) | 2376 ? (dst < adjusted_dst_end) |
| 2814 return 0; | 2814 return 0; |
| 2815 } | 2815 } |
| 2816 | 2816 |
| 2817 /* Initialize remaining fields. */ | 2817 /* Initialize remaining fields. */ |
| 2818 coding->composing = 0; | 2818 coding->composing = 0; |
| 2819 coding->character_translation_table_for_decode = Qnil; | 2819 coding->translation_table_for_decode = Qnil; |
| 2820 coding->character_translation_table_for_encode = Qnil; | 2820 coding->translation_table_for_encode = Qnil; |
| 2821 | 2821 |
| 2822 /* Get values of coding system properties: | 2822 /* Get values of coding system properties: |
| 2823 `post-read-conversion', `pre-write-conversion', | 2823 `post-read-conversion', `pre-write-conversion', |
| 2824 `character-translation-table-for-decode', | 2824 `translation-table-for-decode', `translation-table-for-encode'. */ |
| 2825 `character-translation-table-for-encode'. */ | |
| 2826 plist = XVECTOR (coding_spec)->contents[3]; | 2825 plist = XVECTOR (coding_spec)->contents[3]; |
| 2827 coding->post_read_conversion = Fplist_get (plist, Qpost_read_conversion); | 2826 coding->post_read_conversion = Fplist_get (plist, Qpost_read_conversion); |
| 2828 coding->pre_write_conversion = Fplist_get (plist, Qpre_write_conversion); | 2827 coding->pre_write_conversion = Fplist_get (plist, Qpre_write_conversion); |
| 2829 val = Fplist_get (plist, Qcharacter_translation_table_for_decode); | 2828 val = Fplist_get (plist, Qtranslation_table_for_decode); |
| 2830 if (SYMBOLP (val)) | 2829 if (SYMBOLP (val)) |
| 2831 val = Fget (val, Qcharacter_translation_table_for_decode); | 2830 val = Fget (val, Qtranslation_table_for_decode); |
| 2832 coding->character_translation_table_for_decode | 2831 coding->translation_table_for_decode = CHAR_TABLE_P (val) ? val : Qnil; |
| 2833 = CHAR_TABLE_P (val) ? val : Qnil; | 2832 val = Fplist_get (plist, Qtranslation_table_for_encode); |
| 2834 val = Fplist_get (plist, Qcharacter_translation_table_for_encode); | |
| 2835 if (SYMBOLP (val)) | 2833 if (SYMBOLP (val)) |
| 2836 val = Fget (val, Qcharacter_translation_table_for_encode); | 2834 val = Fget (val, Qtranslation_table_for_encode); |
| 2837 coding->character_translation_table_for_encode | 2835 coding->translation_table_for_encode = CHAR_TABLE_P (val) ? val : Qnil; |
| 2838 = CHAR_TABLE_P (val) ? val : Qnil; | |
| 2839 val = Fplist_get (plist, Qcoding_category); | 2836 val = Fplist_get (plist, Qcoding_category); |
| 2840 if (!NILP (val)) | 2837 if (!NILP (val)) |
| 2841 { | 2838 { |
| 2842 val = Fget (val, Qcoding_category_index); | 2839 val = Fget (val, Qcoding_category_index); |
| 2843 if (INTEGERP (val)) | 2840 if (INTEGERP (val)) |
| 5138 Fput (XVECTOR (Vcoding_category_table)->contents[i], | 5135 Fput (XVECTOR (Vcoding_category_table)->contents[i], |
| 5139 Qcoding_category_index, make_number (i)); | 5136 Qcoding_category_index, make_number (i)); |
| 5140 } | 5137 } |
| 5141 } | 5138 } |
| 5142 | 5139 |
| 5143 Qcharacter_translation_table = intern ("character-translation-table"); | 5140 Qtranslation_table = intern ("translation-table"); |
| 5144 staticpro (&Qcharacter_translation_table); | 5141 staticpro (&Qtranslation_table); |
| 5145 Fput (Qcharacter_translation_table, Qchar_table_extra_slots, | 5142 Fput (Qtranslation_table, Qchar_table_extra_slots, make_number (0)); |
| 5146 make_number (0)); | 5143 |
| 5147 | 5144 Qtranslation_table_id = intern ("translation-table-id"); |
| 5148 Qcharacter_translation_table_id = intern ("character-translation-table-id"); | 5145 staticpro (&Qtranslation_table_id); |
| 5149 staticpro (&Qcharacter_translation_table_id); | 5146 |
| 5150 | 5147 Qtranslation_table_for_decode = intern ("translation-table-for-decode"); |
| 5151 Qcharacter_translation_table_for_decode | 5148 staticpro (&Qtranslation_table_for_decode); |
| 5152 = intern ("character-translation-table-for-decode"); | 5149 |
| 5153 staticpro (&Qcharacter_translation_table_for_decode); | 5150 Qtranslation_table_for_encode = intern ("translation-table-for-encode"); |
| 5154 | 5151 staticpro (&Qtranslation_table_for_encode); |
| 5155 Qcharacter_translation_table_for_encode | |
| 5156 = intern ("character-translation-table-for-encode"); | |
| 5157 staticpro (&Qcharacter_translation_table_for_encode); | |
| 5158 | 5152 |
| 5159 Qsafe_charsets = intern ("safe-charsets"); | 5153 Qsafe_charsets = intern ("safe-charsets"); |
| 5160 staticpro (&Qsafe_charsets); | 5154 staticpro (&Qsafe_charsets); |
| 5161 | 5155 |
| 5162 Qemacs_mule = intern ("emacs-mule"); | 5156 Qemacs_mule = intern ("emacs-mule"); |
| 5310 DEFVAR_INT ("eol-mnemonic-undecided", &eol_mnemonic_undecided, | 5304 DEFVAR_INT ("eol-mnemonic-undecided", &eol_mnemonic_undecided, |
| 5311 "Mnemonic character indicating end-of-line format is not yet decided."); | 5305 "Mnemonic character indicating end-of-line format is not yet decided."); |
| 5312 eol_mnemonic_undecided = ':'; | 5306 eol_mnemonic_undecided = ':'; |
| 5313 | 5307 |
| 5314 DEFVAR_LISP ("enable-character-translation", &Venable_character_translation, | 5308 DEFVAR_LISP ("enable-character-translation", &Venable_character_translation, |
| 5315 "Non-nil means ISO 2022 encoder/decoder do character translation."); | 5309 "*Non-nil enables character translation while encoding and decoding."); |
| 5316 Venable_character_translation = Qt; | 5310 Venable_character_translation = Qt; |
| 5317 | 5311 |
| 5318 DEFVAR_LISP ("standard-character-translation-table-for-decode", | 5312 DEFVAR_LISP ("standard-translation-table-for-decode", |
| 5319 &Vstandard_character_translation_table_for_decode, | 5313 &Vstandard_translation_table_for_decode, |
| 5320 "Table for translating characters while decoding."); | 5314 "Table for translating characters while decoding."); |
| 5321 Vstandard_character_translation_table_for_decode = Qnil; | 5315 Vstandard_translation_table_for_decode = Qnil; |
| 5322 | 5316 |
| 5323 DEFVAR_LISP ("standard-character-translation-table-for-encode", | 5317 DEFVAR_LISP ("standard-translation-table-for-encode", |
| 5324 &Vstandard_character_translation_table_for_encode, | 5318 &Vstandard_translation_table_for_encode, |
| 5325 "Table for translationg characters while encoding."); | 5319 "Table for translationg characters while encoding."); |
| 5326 Vstandard_character_translation_table_for_encode = Qnil; | 5320 Vstandard_translation_table_for_encode = Qnil; |
| 5327 | 5321 |
| 5328 DEFVAR_LISP ("charset-revision-table", &Vcharset_revision_alist, | 5322 DEFVAR_LISP ("charset-revision-table", &Vcharset_revision_alist, |
| 5329 "Alist of charsets vs revision numbers.\n\ | 5323 "Alist of charsets vs revision numbers.\n\ |
| 5330 While encoding, if a charset (car part of an element) is found,\n\ | 5324 While encoding, if a charset (car part of an element) is found,\n\ |
| 5331 designate it with the escape sequence identifing revision (cdr part of the element)."); | 5325 designate it with the escape sequence identifing revision (cdr part of the element)."); |
