diff options
| author | Joakim Verona | 2011-02-05 11:23:09 +0100 |
|---|---|---|
| committer | Joakim Verona | 2011-02-05 11:23:09 +0100 |
| commit | 4bd51ad5c3445b644dfb017d5b57b10a90aa325f (patch) | |
| tree | 894801e7308ce4ecc34933f959e28f4b9cff9533 /src/coding.c | |
| parent | 13cfe8df462ab8da9f0028e16cc84dcaceaca3d1 (diff) | |
| parent | 9bcaafce5351d270ac514e23cb69ff1a5fd35229 (diff) | |
| download | emacs-4bd51ad5c3445b644dfb017d5b57b10a90aa325f.tar.gz emacs-4bd51ad5c3445b644dfb017d5b57b10a90aa325f.zip | |
merge from upstream. currently seems to have bitroted and i get segfaults
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 242 |
1 files changed, 86 insertions, 156 deletions
diff --git a/src/coding.c b/src/coding.c index 7a3bc40b9c7..3a3ba11ee9d 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | /* Coding system handler (conversion, detection, etc). | 1 | /* Coding system handler (conversion, detection, etc). |
| 2 | Copyright (C) 2001, 2002, 2003, 2004, 2005, | 2 | Copyright (C) 2001-2011 Free Software Foundation, Inc. |
| 3 | 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 4 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 3 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 5 | 2005, 2006, 2007, 2008, 2009, 2010 | 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
| 6 | National Institute of Advanced Industrial Science and Technology (AIST) | 5 | National Institute of Advanced Industrial Science and Technology (AIST) |
| 7 | Registration Number H14PRO021 | 6 | Registration Number H14PRO021 |
| 8 | Copyright (C) 2003 | 7 | Copyright (C) 2003 |
| @@ -327,16 +326,6 @@ Lisp_Object Qinterrupted, Qinsufficient_memory; | |||
| 327 | symbol as a coding system. */ | 326 | symbol as a coding system. */ |
| 328 | static Lisp_Object Qcoding_system_define_form; | 327 | static Lisp_Object Qcoding_system_define_form; |
| 329 | 328 | ||
| 330 | int coding_system_require_warning; | ||
| 331 | |||
| 332 | Lisp_Object Vselect_safe_coding_system_function; | ||
| 333 | |||
| 334 | /* Mnemonic string for each format of end-of-line. */ | ||
| 335 | Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac; | ||
| 336 | /* Mnemonic string to indicate format of end-of-line is not yet | ||
| 337 | decided. */ | ||
| 338 | Lisp_Object eol_mnemonic_undecided; | ||
| 339 | |||
| 340 | /* Format of end-of-line decided by system. This is Qunix on | 329 | /* Format of end-of-line decided by system. This is Qunix on |
| 341 | Unix and Mac, Qdos on DOS/Windows. | 330 | Unix and Mac, Qdos on DOS/Windows. |
| 342 | This has an effect only for external encoding (i.e. for output to | 331 | This has an effect only for external encoding (i.e. for output to |
| @@ -345,8 +334,6 @@ static Lisp_Object system_eol_type; | |||
| 345 | 334 | ||
| 346 | #ifdef emacs | 335 | #ifdef emacs |
| 347 | 336 | ||
| 348 | Lisp_Object Vcoding_system_list, Vcoding_system_alist; | ||
| 349 | |||
| 350 | Lisp_Object Qcoding_system_p, Qcoding_system_error; | 337 | Lisp_Object Qcoding_system_p, Qcoding_system_error; |
| 351 | 338 | ||
| 352 | /* Coding system emacs-mule and raw-text are for converting only | 339 | /* Coding system emacs-mule and raw-text are for converting only |
| @@ -356,64 +343,17 @@ Lisp_Object Qutf_8_emacs; | |||
| 356 | 343 | ||
| 357 | /* Coding-systems are handed between Emacs Lisp programs and C internal | 344 | /* Coding-systems are handed between Emacs Lisp programs and C internal |
| 358 | routines by the following three variables. */ | 345 | routines by the following three variables. */ |
| 359 | /* Coding-system for reading files and receiving data from process. */ | ||
| 360 | Lisp_Object Vcoding_system_for_read; | ||
| 361 | /* Coding-system for writing files and sending data to process. */ | ||
| 362 | Lisp_Object Vcoding_system_for_write; | ||
| 363 | /* Coding-system actually used in the latest I/O. */ | ||
| 364 | Lisp_Object Vlast_coding_system_used; | ||
| 365 | /* Set to non-nil when an error is detected while code conversion. */ | ||
| 366 | Lisp_Object Vlast_code_conversion_error; | ||
| 367 | /* A vector of length 256 which contains information about special | ||
| 368 | Latin codes (especially for dealing with Microsoft codes). */ | ||
| 369 | Lisp_Object Vlatin_extra_code_table; | ||
| 370 | |||
| 371 | /* Flag to inhibit code conversion of end-of-line format. */ | ||
| 372 | int inhibit_eol_conversion; | ||
| 373 | |||
| 374 | /* Flag to inhibit ISO2022 escape sequence detection. */ | ||
| 375 | int inhibit_iso_escape_detection; | ||
| 376 | |||
| 377 | /* Flag to inhibit detection of binary files through null bytes. */ | ||
| 378 | int inhibit_null_byte_detection; | ||
| 379 | |||
| 380 | /* Flag to make buffer-file-coding-system inherit from process-coding. */ | ||
| 381 | int inherit_process_coding_system; | ||
| 382 | |||
| 383 | /* Coding system to be used to encode text for terminal display when | 346 | /* Coding system to be used to encode text for terminal display when |
| 384 | terminal coding system is nil. */ | 347 | terminal coding system is nil. */ |
| 385 | struct coding_system safe_terminal_coding; | 348 | struct coding_system safe_terminal_coding; |
| 386 | 349 | ||
| 387 | Lisp_Object Vfile_coding_system_alist; | ||
| 388 | Lisp_Object Vprocess_coding_system_alist; | ||
| 389 | Lisp_Object Vnetwork_coding_system_alist; | ||
| 390 | |||
| 391 | Lisp_Object Vlocale_coding_system; | ||
| 392 | |||
| 393 | #endif /* emacs */ | 350 | #endif /* emacs */ |
| 394 | 351 | ||
| 395 | /* Flag to tell if we look up translation table on character code | ||
| 396 | conversion. */ | ||
| 397 | Lisp_Object Venable_character_translation; | ||
| 398 | /* Standard translation table to look up on decoding (reading). */ | ||
| 399 | Lisp_Object Vstandard_translation_table_for_decode; | ||
| 400 | /* Standard translation table to look up on encoding (writing). */ | ||
| 401 | Lisp_Object Vstandard_translation_table_for_encode; | ||
| 402 | |||
| 403 | Lisp_Object Qtranslation_table; | 352 | Lisp_Object Qtranslation_table; |
| 404 | Lisp_Object Qtranslation_table_id; | 353 | Lisp_Object Qtranslation_table_id; |
| 405 | Lisp_Object Qtranslation_table_for_decode; | 354 | Lisp_Object Qtranslation_table_for_decode; |
| 406 | Lisp_Object Qtranslation_table_for_encode; | 355 | Lisp_Object Qtranslation_table_for_encode; |
| 407 | 356 | ||
| 408 | /* Alist of charsets vs revision number. */ | ||
| 409 | static Lisp_Object Vcharset_revision_table; | ||
| 410 | |||
| 411 | /* Default coding systems used for process I/O. */ | ||
| 412 | Lisp_Object Vdefault_process_coding_system; | ||
| 413 | |||
| 414 | /* Char table for translating Quail and self-inserting input. */ | ||
| 415 | Lisp_Object Vtranslation_table_for_input; | ||
| 416 | |||
| 417 | /* Two special coding systems. */ | 357 | /* Two special coding systems. */ |
| 418 | Lisp_Object Vsjis_coding_system; | 358 | Lisp_Object Vsjis_coding_system; |
| 419 | Lisp_Object Vbig5_coding_system; | 359 | Lisp_Object Vbig5_coding_system; |
| @@ -681,10 +621,6 @@ enum coding_category | |||
| 681 | | CATEGORY_MASK_UTF_8_NOSIG \ | 621 | | CATEGORY_MASK_UTF_8_NOSIG \ |
| 682 | | CATEGORY_MASK_UTF_8_SIG) | 622 | | CATEGORY_MASK_UTF_8_SIG) |
| 683 | 623 | ||
| 684 | /* List of symbols `coding-category-xxx' ordered by priority. This | ||
| 685 | variable is exposed to Emacs Lisp. */ | ||
| 686 | static Lisp_Object Vcoding_category_list; | ||
| 687 | |||
| 688 | /* Table of coding categories (Lisp symbols). This variable is for | 624 | /* Table of coding categories (Lisp symbols). This variable is for |
| 689 | internal use only. */ | 625 | internal use only. */ |
| 690 | static Lisp_Object Vcoding_category_table; | 626 | static Lisp_Object Vcoding_category_table; |
| @@ -1607,10 +1543,9 @@ static int | |||
| 1607 | detect_coding_utf_16 (struct coding_system *coding, | 1543 | detect_coding_utf_16 (struct coding_system *coding, |
| 1608 | struct coding_detection_info *detect_info) | 1544 | struct coding_detection_info *detect_info) |
| 1609 | { | 1545 | { |
| 1610 | const unsigned char *src = coding->source, *src_base = src; | 1546 | const unsigned char *src = coding->source; |
| 1611 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1547 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 1612 | int multibytep = coding->src_multibyte; | 1548 | int multibytep = coding->src_multibyte; |
| 1613 | int consumed_chars = 0; | ||
| 1614 | int c1, c2; | 1549 | int c1, c2; |
| 1615 | 1550 | ||
| 1616 | detect_info->checked |= CATEGORY_MASK_UTF_16; | 1551 | detect_info->checked |= CATEGORY_MASK_UTF_16; |
| @@ -2053,7 +1988,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2053 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1988 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 2054 | const unsigned char *src_base = src; | 1989 | const unsigned char *src_base = src; |
| 2055 | int multibytep = coding->src_multibyte; | 1990 | int multibytep = coding->src_multibyte; |
| 2056 | struct charset *charset; | 1991 | int charset_id; |
| 2057 | unsigned code; | 1992 | unsigned code; |
| 2058 | int c; | 1993 | int c; |
| 2059 | int consumed_chars = 0; | 1994 | int consumed_chars = 0; |
| @@ -2063,7 +1998,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2063 | if (c < 0) | 1998 | if (c < 0) |
| 2064 | { | 1999 | { |
| 2065 | c = -c; | 2000 | c = -c; |
| 2066 | charset = emacs_mule_charset[0]; | 2001 | charset_id = emacs_mule_charset[0]; |
| 2067 | } | 2002 | } |
| 2068 | else | 2003 | else |
| 2069 | { | 2004 | { |
| @@ -2099,7 +2034,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2099 | switch (emacs_mule_bytes[c]) | 2034 | switch (emacs_mule_bytes[c]) |
| 2100 | { | 2035 | { |
| 2101 | case 2: | 2036 | case 2: |
| 2102 | if (! (charset = emacs_mule_charset[c])) | 2037 | if ((charset_id = emacs_mule_charset[c]) < 0) |
| 2103 | goto invalid_code; | 2038 | goto invalid_code; |
| 2104 | ONE_MORE_BYTE (c); | 2039 | ONE_MORE_BYTE (c); |
| 2105 | if (c < 0xA0) | 2040 | if (c < 0xA0) |
| @@ -2112,7 +2047,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2112 | || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) | 2047 | || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) |
| 2113 | { | 2048 | { |
| 2114 | ONE_MORE_BYTE (c); | 2049 | ONE_MORE_BYTE (c); |
| 2115 | if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) | 2050 | if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) |
| 2116 | goto invalid_code; | 2051 | goto invalid_code; |
| 2117 | ONE_MORE_BYTE (c); | 2052 | ONE_MORE_BYTE (c); |
| 2118 | if (c < 0xA0) | 2053 | if (c < 0xA0) |
| @@ -2121,7 +2056,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2121 | } | 2056 | } |
| 2122 | else | 2057 | else |
| 2123 | { | 2058 | { |
| 2124 | if (! (charset = emacs_mule_charset[c])) | 2059 | if ((charset_id = emacs_mule_charset[c]) < 0) |
| 2125 | goto invalid_code; | 2060 | goto invalid_code; |
| 2126 | ONE_MORE_BYTE (c); | 2061 | ONE_MORE_BYTE (c); |
| 2127 | if (c < 0xA0) | 2062 | if (c < 0xA0) |
| @@ -2136,7 +2071,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2136 | 2071 | ||
| 2137 | case 4: | 2072 | case 4: |
| 2138 | ONE_MORE_BYTE (c); | 2073 | ONE_MORE_BYTE (c); |
| 2139 | if (c < 0 || ! (charset = emacs_mule_charset[c])) | 2074 | if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) |
| 2140 | goto invalid_code; | 2075 | goto invalid_code; |
| 2141 | ONE_MORE_BYTE (c); | 2076 | ONE_MORE_BYTE (c); |
| 2142 | if (c < 0xA0) | 2077 | if (c < 0xA0) |
| @@ -2150,21 +2085,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2150 | 2085 | ||
| 2151 | case 1: | 2086 | case 1: |
| 2152 | code = c; | 2087 | code = c; |
| 2153 | charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) | 2088 | charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; |
| 2154 | ? charset_ascii : charset_eight_bit); | ||
| 2155 | break; | 2089 | break; |
| 2156 | 2090 | ||
| 2157 | default: | 2091 | default: |
| 2158 | abort (); | 2092 | abort (); |
| 2159 | } | 2093 | } |
| 2160 | CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); | 2094 | CODING_DECODE_CHAR (coding, src, src_base, src_end, |
| 2095 | CHARSET_FROM_ID (charset_id), code, c); | ||
| 2161 | if (c < 0) | 2096 | if (c < 0) |
| 2162 | goto invalid_code; | 2097 | goto invalid_code; |
| 2163 | } | 2098 | } |
| 2164 | *nbytes = src - src_base; | 2099 | *nbytes = src - src_base; |
| 2165 | *nchars = consumed_chars; | 2100 | *nchars = consumed_chars; |
| 2166 | if (id) | 2101 | if (id) |
| 2167 | *id = charset->id; | 2102 | *id = charset_id; |
| 2168 | return (mseq_found ? -c : c); | 2103 | return (mseq_found ? -c : c); |
| 2169 | 2104 | ||
| 2170 | no_more_source: | 2105 | no_more_source: |
| @@ -2277,7 +2212,6 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2277 | #define DECODE_EMACS_MULE_21_COMPOSITION() \ | 2212 | #define DECODE_EMACS_MULE_21_COMPOSITION() \ |
| 2278 | do { \ | 2213 | do { \ |
| 2279 | enum composition_method method = c - 0xF2; \ | 2214 | enum composition_method method = c - 0xF2; \ |
| 2280 | int *charbuf_base = charbuf; \ | ||
| 2281 | int nbytes, nchars; \ | 2215 | int nbytes, nchars; \ |
| 2282 | \ | 2216 | \ |
| 2283 | ONE_MORE_BYTE (c); \ | 2217 | ONE_MORE_BYTE (c); \ |
| @@ -2633,11 +2567,6 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2633 | } | 2567 | } |
| 2634 | continue; | 2568 | continue; |
| 2635 | 2569 | ||
| 2636 | retry: | ||
| 2637 | src = src_base; | ||
| 2638 | consumed_chars = consumed_chars_base; | ||
| 2639 | continue; | ||
| 2640 | |||
| 2641 | invalid_code: | 2570 | invalid_code: |
| 2642 | EMACS_MULE_MAYBE_FINISH_COMPOSITION (); | 2571 | EMACS_MULE_MAYBE_FINISH_COMPOSITION (); |
| 2643 | src = src_base; | 2572 | src = src_base; |
| @@ -5450,9 +5379,9 @@ detect_coding_charset (struct coding_system *coding, | |||
| 5450 | attrs = CODING_ID_ATTRS (coding->id); | 5379 | attrs = CODING_ID_ATTRS (coding->id); |
| 5451 | valids = AREF (attrs, coding_attr_charset_valids); | 5380 | valids = AREF (attrs, coding_attr_charset_valids); |
| 5452 | name = CODING_ID_NAME (coding->id); | 5381 | name = CODING_ID_NAME (coding->id); |
| 5453 | if (strncmp ((char *) SDATA (SYMBOL_NAME (name)), | 5382 | if (strncmp (SSDATA (SYMBOL_NAME (name)), |
| 5454 | "iso-8859-", sizeof ("iso-8859-") - 1) == 0 | 5383 | "iso-8859-", sizeof ("iso-8859-") - 1) == 0 |
| 5455 | || strncmp ((char *) SDATA (SYMBOL_NAME (name)), | 5384 | || strncmp (SSDATA (SYMBOL_NAME (name)), |
| 5456 | "iso-latin-", sizeof ("iso-latin-") - 1) == 0) | 5385 | "iso-latin-", sizeof ("iso-latin-") - 1) == 0) |
| 5457 | check_latin_extra = 1; | 5386 | check_latin_extra = 1; |
| 5458 | 5387 | ||
| @@ -6260,8 +6189,9 @@ detect_eol (const unsigned char *source, EMACS_INT src_bytes, | |||
| 6260 | { | 6189 | { |
| 6261 | /* The found type is different from what found before. | 6190 | /* The found type is different from what found before. |
| 6262 | Allow for stray ^M characters in DOS EOL files. */ | 6191 | Allow for stray ^M characters in DOS EOL files. */ |
| 6263 | if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF | 6192 | if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF) |
| 6264 | || eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR) | 6193 | || (eol_seen == EOL_SEEN_CRLF |
| 6194 | && this_eol == EOL_SEEN_CR)) | ||
| 6265 | eol_seen = EOL_SEEN_CRLF; | 6195 | eol_seen = EOL_SEEN_CRLF; |
| 6266 | else | 6196 | else |
| 6267 | { | 6197 | { |
| @@ -6276,42 +6206,40 @@ detect_eol (const unsigned char *source, EMACS_INT src_bytes, | |||
| 6276 | } | 6206 | } |
| 6277 | } | 6207 | } |
| 6278 | else | 6208 | else |
| 6279 | { | 6209 | while (src < src_end) |
| 6280 | while (src < src_end) | 6210 | { |
| 6281 | { | 6211 | c = *src++; |
| 6282 | c = *src++; | 6212 | if (c == '\n' || c == '\r') |
| 6283 | if (c == '\n' || c == '\r') | 6213 | { |
| 6284 | { | 6214 | int this_eol; |
| 6285 | int this_eol; | ||
| 6286 | 6215 | ||
| 6287 | if (c == '\n') | 6216 | if (c == '\n') |
| 6288 | this_eol = EOL_SEEN_LF; | 6217 | this_eol = EOL_SEEN_LF; |
| 6289 | else if (src >= src_end || *src != '\n') | 6218 | else if (src >= src_end || *src != '\n') |
| 6290 | this_eol = EOL_SEEN_CR; | 6219 | this_eol = EOL_SEEN_CR; |
| 6291 | else | 6220 | else |
| 6292 | this_eol = EOL_SEEN_CRLF, src++; | 6221 | this_eol = EOL_SEEN_CRLF, src++; |
| 6293 | 6222 | ||
| 6294 | if (eol_seen == EOL_SEEN_NONE) | 6223 | if (eol_seen == EOL_SEEN_NONE) |
| 6295 | /* This is the first end-of-line. */ | 6224 | /* This is the first end-of-line. */ |
| 6296 | eol_seen = this_eol; | 6225 | eol_seen = this_eol; |
| 6297 | else if (eol_seen != this_eol) | 6226 | else if (eol_seen != this_eol) |
| 6298 | { | 6227 | { |
| 6299 | /* The found type is different from what found before. | 6228 | /* The found type is different from what found before. |
| 6300 | Allow for stray ^M characters in DOS EOL files. */ | 6229 | Allow for stray ^M characters in DOS EOL files. */ |
| 6301 | if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF | 6230 | if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF) |
| 6302 | || eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR) | 6231 | || (eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR)) |
| 6303 | eol_seen = EOL_SEEN_CRLF; | 6232 | eol_seen = EOL_SEEN_CRLF; |
| 6304 | else | 6233 | else |
| 6305 | { | 6234 | { |
| 6306 | eol_seen = EOL_SEEN_LF; | 6235 | eol_seen = EOL_SEEN_LF; |
| 6307 | break; | 6236 | break; |
| 6308 | } | 6237 | } |
| 6309 | } | 6238 | } |
| 6310 | if (++total == MAX_EOL_CHECK_COUNT) | 6239 | if (++total == MAX_EOL_CHECK_COUNT) |
| 6311 | break; | 6240 | break; |
| 6312 | } | 6241 | } |
| 6313 | } | 6242 | } |
| 6314 | } | ||
| 6315 | return eol_seen; | 6243 | return eol_seen; |
| 6316 | } | 6244 | } |
| 6317 | 6245 | ||
| @@ -9297,7 +9225,8 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern | |||
| 9297 | doc: /* Internal use only. */) | 9225 | doc: /* Internal use only. */) |
| 9298 | (Lisp_Object coding_system, Lisp_Object terminal) | 9226 | (Lisp_Object coding_system, Lisp_Object terminal) |
| 9299 | { | 9227 | { |
| 9300 | struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); | 9228 | struct terminal *term = get_terminal (terminal, 1); |
| 9229 | struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term); | ||
| 9301 | CHECK_SYMBOL (coding_system); | 9230 | CHECK_SYMBOL (coding_system); |
| 9302 | setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); | 9231 | setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); |
| 9303 | /* We had better not send unsafe characters to terminal. */ | 9232 | /* We had better not send unsafe characters to terminal. */ |
| @@ -9306,6 +9235,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern | |||
| 9306 | terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; | 9235 | terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; |
| 9307 | terminal_coding->src_multibyte = 1; | 9236 | terminal_coding->src_multibyte = 1; |
| 9308 | terminal_coding->dst_multibyte = 0; | 9237 | terminal_coding->dst_multibyte = 0; |
| 9238 | if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) | ||
| 9239 | term->charset_list = coding_charset_list (terminal_coding); | ||
| 9240 | else | ||
| 9241 | term->charset_list = Fcons (make_number (charset_ascii), Qnil); | ||
| 9309 | return Qnil; | 9242 | return Qnil; |
| 9310 | } | 9243 | } |
| 9311 | 9244 | ||
| @@ -10528,7 +10461,7 @@ syms_of_coding (void) | |||
| 10528 | defsubr (&Scoding_system_eol_type); | 10461 | defsubr (&Scoding_system_eol_type); |
| 10529 | defsubr (&Scoding_system_priority_list); | 10462 | defsubr (&Scoding_system_priority_list); |
| 10530 | 10463 | ||
| 10531 | DEFVAR_LISP ("coding-system-list", &Vcoding_system_list, | 10464 | DEFVAR_LISP ("coding-system-list", Vcoding_system_list, |
| 10532 | doc: /* List of coding systems. | 10465 | doc: /* List of coding systems. |
| 10533 | 10466 | ||
| 10534 | Do not alter the value of this variable manually. This variable should be | 10467 | Do not alter the value of this variable manually. This variable should be |
| @@ -10536,7 +10469,7 @@ updated by the functions `define-coding-system' and | |||
| 10536 | `define-coding-system-alias'. */); | 10469 | `define-coding-system-alias'. */); |
| 10537 | Vcoding_system_list = Qnil; | 10470 | Vcoding_system_list = Qnil; |
| 10538 | 10471 | ||
| 10539 | DEFVAR_LISP ("coding-system-alist", &Vcoding_system_alist, | 10472 | DEFVAR_LISP ("coding-system-alist", Vcoding_system_alist, |
| 10540 | doc: /* Alist of coding system names. | 10473 | doc: /* Alist of coding system names. |
| 10541 | Each element is one element list of coding system name. | 10474 | Each element is one element list of coding system name. |
| 10542 | This variable is given to `completing-read' as COLLECTION argument. | 10475 | This variable is given to `completing-read' as COLLECTION argument. |
| @@ -10546,7 +10479,7 @@ updated by the functions `make-coding-system' and | |||
| 10546 | `define-coding-system-alias'. */); | 10479 | `define-coding-system-alias'. */); |
| 10547 | Vcoding_system_alist = Qnil; | 10480 | Vcoding_system_alist = Qnil; |
| 10548 | 10481 | ||
| 10549 | DEFVAR_LISP ("coding-category-list", &Vcoding_category_list, | 10482 | DEFVAR_LISP ("coding-category-list", Vcoding_category_list, |
| 10550 | doc: /* List of coding-categories (symbols) ordered by priority. | 10483 | doc: /* List of coding-categories (symbols) ordered by priority. |
| 10551 | 10484 | ||
| 10552 | On detecting a coding system, Emacs tries code detection algorithms | 10485 | On detecting a coding system, Emacs tries code detection algorithms |
| @@ -10554,7 +10487,7 @@ associated with each coding-category one by one in this order. When | |||
| 10554 | one algorithm agrees with a byte sequence of source text, the coding | 10487 | one algorithm agrees with a byte sequence of source text, the coding |
| 10555 | system bound to the corresponding coding-category is selected. | 10488 | system bound to the corresponding coding-category is selected. |
| 10556 | 10489 | ||
| 10557 | Don't modify this variable directly, but use `set-coding-priority'. */); | 10490 | Don't modify this variable directly, but use `set-coding-system-priority'. */); |
| 10558 | { | 10491 | { |
| 10559 | int i; | 10492 | int i; |
| 10560 | 10493 | ||
| @@ -10565,7 +10498,7 @@ Don't modify this variable directly, but use `set-coding-priority'. */); | |||
| 10565 | Vcoding_category_list); | 10498 | Vcoding_category_list); |
| 10566 | } | 10499 | } |
| 10567 | 10500 | ||
| 10568 | DEFVAR_LISP ("coding-system-for-read", &Vcoding_system_for_read, | 10501 | DEFVAR_LISP ("coding-system-for-read", Vcoding_system_for_read, |
| 10569 | doc: /* Specify the coding system for read operations. | 10502 | doc: /* Specify the coding system for read operations. |
| 10570 | It is useful to bind this variable with `let', but do not set it globally. | 10503 | It is useful to bind this variable with `let', but do not set it globally. |
| 10571 | If the value is a coding system, it is used for decoding on read operation. | 10504 | If the value is a coding system, it is used for decoding on read operation. |
| @@ -10574,7 +10507,7 @@ There are three such tables: `file-coding-system-alist', | |||
| 10574 | `process-coding-system-alist', and `network-coding-system-alist'. */); | 10507 | `process-coding-system-alist', and `network-coding-system-alist'. */); |
| 10575 | Vcoding_system_for_read = Qnil; | 10508 | Vcoding_system_for_read = Qnil; |
| 10576 | 10509 | ||
| 10577 | DEFVAR_LISP ("coding-system-for-write", &Vcoding_system_for_write, | 10510 | DEFVAR_LISP ("coding-system-for-write", Vcoding_system_for_write, |
| 10578 | doc: /* Specify the coding system for write operations. | 10511 | doc: /* Specify the coding system for write operations. |
| 10579 | Programs bind this variable with `let', but you should not set it globally. | 10512 | Programs bind this variable with `let', but you should not set it globally. |
| 10580 | If the value is a coding system, it is used for encoding of output, | 10513 | If the value is a coding system, it is used for encoding of output, |
| @@ -10588,12 +10521,12 @@ For output to files, if the above procedure does not specify a coding system, | |||
| 10588 | the value of `buffer-file-coding-system' is used. */); | 10521 | the value of `buffer-file-coding-system' is used. */); |
| 10589 | Vcoding_system_for_write = Qnil; | 10522 | Vcoding_system_for_write = Qnil; |
| 10590 | 10523 | ||
| 10591 | DEFVAR_LISP ("last-coding-system-used", &Vlast_coding_system_used, | 10524 | DEFVAR_LISP ("last-coding-system-used", Vlast_coding_system_used, |
| 10592 | doc: /* | 10525 | doc: /* |
| 10593 | Coding system used in the latest file or process I/O. */); | 10526 | Coding system used in the latest file or process I/O. */); |
| 10594 | Vlast_coding_system_used = Qnil; | 10527 | Vlast_coding_system_used = Qnil; |
| 10595 | 10528 | ||
| 10596 | DEFVAR_LISP ("last-code-conversion-error", &Vlast_code_conversion_error, | 10529 | DEFVAR_LISP ("last-code-conversion-error", Vlast_code_conversion_error, |
| 10597 | doc: /* | 10530 | doc: /* |
| 10598 | Error status of the last code conversion. | 10531 | Error status of the last code conversion. |
| 10599 | 10532 | ||
| @@ -10610,21 +10543,21 @@ explicitly set this variable to nil before performing code | |||
| 10610 | conversion. */); | 10543 | conversion. */); |
| 10611 | Vlast_code_conversion_error = Qnil; | 10544 | Vlast_code_conversion_error = Qnil; |
| 10612 | 10545 | ||
| 10613 | DEFVAR_BOOL ("inhibit-eol-conversion", &inhibit_eol_conversion, | 10546 | DEFVAR_BOOL ("inhibit-eol-conversion", inhibit_eol_conversion, |
| 10614 | doc: /* | 10547 | doc: /* |
| 10615 | *Non-nil means always inhibit code conversion of end-of-line format. | 10548 | *Non-nil means always inhibit code conversion of end-of-line format. |
| 10616 | See info node `Coding Systems' and info node `Text and Binary' concerning | 10549 | See info node `Coding Systems' and info node `Text and Binary' concerning |
| 10617 | such conversion. */); | 10550 | such conversion. */); |
| 10618 | inhibit_eol_conversion = 0; | 10551 | inhibit_eol_conversion = 0; |
| 10619 | 10552 | ||
| 10620 | DEFVAR_BOOL ("inherit-process-coding-system", &inherit_process_coding_system, | 10553 | DEFVAR_BOOL ("inherit-process-coding-system", inherit_process_coding_system, |
| 10621 | doc: /* | 10554 | doc: /* |
| 10622 | Non-nil means process buffer inherits coding system of process output. | 10555 | Non-nil means process buffer inherits coding system of process output. |
| 10623 | Bind it to t if the process output is to be treated as if it were a file | 10556 | Bind it to t if the process output is to be treated as if it were a file |
| 10624 | read from some filesystem. */); | 10557 | read from some filesystem. */); |
| 10625 | inherit_process_coding_system = 0; | 10558 | inherit_process_coding_system = 0; |
| 10626 | 10559 | ||
| 10627 | DEFVAR_LISP ("file-coding-system-alist", &Vfile_coding_system_alist, | 10560 | DEFVAR_LISP ("file-coding-system-alist", Vfile_coding_system_alist, |
| 10628 | doc: /* | 10561 | doc: /* |
| 10629 | Alist to decide a coding system to use for a file I/O operation. | 10562 | Alist to decide a coding system to use for a file I/O operation. |
| 10630 | The format is ((PATTERN . VAL) ...), | 10563 | The format is ((PATTERN . VAL) ...), |
| @@ -10645,7 +10578,7 @@ See also the function `find-operation-coding-system' | |||
| 10645 | and the variable `auto-coding-alist'. */); | 10578 | and the variable `auto-coding-alist'. */); |
| 10646 | Vfile_coding_system_alist = Qnil; | 10579 | Vfile_coding_system_alist = Qnil; |
| 10647 | 10580 | ||
| 10648 | DEFVAR_LISP ("process-coding-system-alist", &Vprocess_coding_system_alist, | 10581 | DEFVAR_LISP ("process-coding-system-alist", Vprocess_coding_system_alist, |
| 10649 | doc: /* | 10582 | doc: /* |
| 10650 | Alist to decide a coding system to use for a process I/O operation. | 10583 | Alist to decide a coding system to use for a process I/O operation. |
| 10651 | The format is ((PATTERN . VAL) ...), | 10584 | The format is ((PATTERN . VAL) ...), |
| @@ -10661,7 +10594,7 @@ or a cons of coding systems which are used as above. | |||
| 10661 | See also the function `find-operation-coding-system'. */); | 10594 | See also the function `find-operation-coding-system'. */); |
| 10662 | Vprocess_coding_system_alist = Qnil; | 10595 | Vprocess_coding_system_alist = Qnil; |
| 10663 | 10596 | ||
| 10664 | DEFVAR_LISP ("network-coding-system-alist", &Vnetwork_coding_system_alist, | 10597 | DEFVAR_LISP ("network-coding-system-alist", Vnetwork_coding_system_alist, |
| 10665 | doc: /* | 10598 | doc: /* |
| 10666 | Alist to decide a coding system to use for a network I/O operation. | 10599 | Alist to decide a coding system to use for a network I/O operation. |
| 10667 | The format is ((PATTERN . VAL) ...), | 10600 | The format is ((PATTERN . VAL) ...), |
| @@ -10678,48 +10611,48 @@ or a cons of coding systems which are used as above. | |||
| 10678 | See also the function `find-operation-coding-system'. */); | 10611 | See also the function `find-operation-coding-system'. */); |
| 10679 | Vnetwork_coding_system_alist = Qnil; | 10612 | Vnetwork_coding_system_alist = Qnil; |
| 10680 | 10613 | ||
| 10681 | DEFVAR_LISP ("locale-coding-system", &Vlocale_coding_system, | 10614 | DEFVAR_LISP ("locale-coding-system", Vlocale_coding_system, |
| 10682 | doc: /* Coding system to use with system messages. | 10615 | doc: /* Coding system to use with system messages. |
| 10683 | Also used for decoding keyboard input on X Window system. */); | 10616 | Also used for decoding keyboard input on X Window system. */); |
| 10684 | Vlocale_coding_system = Qnil; | 10617 | Vlocale_coding_system = Qnil; |
| 10685 | 10618 | ||
| 10686 | /* The eol mnemonics are reset in startup.el system-dependently. */ | 10619 | /* The eol mnemonics are reset in startup.el system-dependently. */ |
| 10687 | DEFVAR_LISP ("eol-mnemonic-unix", &eol_mnemonic_unix, | 10620 | DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix, |
| 10688 | doc: /* | 10621 | doc: /* |
| 10689 | *String displayed in mode line for UNIX-like (LF) end-of-line format. */); | 10622 | *String displayed in mode line for UNIX-like (LF) end-of-line format. */); |
| 10690 | eol_mnemonic_unix = make_pure_c_string (":"); | 10623 | eol_mnemonic_unix = make_pure_c_string (":"); |
| 10691 | 10624 | ||
| 10692 | DEFVAR_LISP ("eol-mnemonic-dos", &eol_mnemonic_dos, | 10625 | DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos, |
| 10693 | doc: /* | 10626 | doc: /* |
| 10694 | *String displayed in mode line for DOS-like (CRLF) end-of-line format. */); | 10627 | *String displayed in mode line for DOS-like (CRLF) end-of-line format. */); |
| 10695 | eol_mnemonic_dos = make_pure_c_string ("\\"); | 10628 | eol_mnemonic_dos = make_pure_c_string ("\\"); |
| 10696 | 10629 | ||
| 10697 | DEFVAR_LISP ("eol-mnemonic-mac", &eol_mnemonic_mac, | 10630 | DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac, |
| 10698 | doc: /* | 10631 | doc: /* |
| 10699 | *String displayed in mode line for MAC-like (CR) end-of-line format. */); | 10632 | *String displayed in mode line for MAC-like (CR) end-of-line format. */); |
| 10700 | eol_mnemonic_mac = make_pure_c_string ("/"); | 10633 | eol_mnemonic_mac = make_pure_c_string ("/"); |
| 10701 | 10634 | ||
| 10702 | DEFVAR_LISP ("eol-mnemonic-undecided", &eol_mnemonic_undecided, | 10635 | DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided, |
| 10703 | doc: /* | 10636 | doc: /* |
| 10704 | *String displayed in mode line when end-of-line format is not yet determined. */); | 10637 | *String displayed in mode line when end-of-line format is not yet determined. */); |
| 10705 | eol_mnemonic_undecided = make_pure_c_string (":"); | 10638 | eol_mnemonic_undecided = make_pure_c_string (":"); |
| 10706 | 10639 | ||
| 10707 | DEFVAR_LISP ("enable-character-translation", &Venable_character_translation, | 10640 | DEFVAR_LISP ("enable-character-translation", Venable_character_translation, |
| 10708 | doc: /* | 10641 | doc: /* |
| 10709 | *Non-nil enables character translation while encoding and decoding. */); | 10642 | *Non-nil enables character translation while encoding and decoding. */); |
| 10710 | Venable_character_translation = Qt; | 10643 | Venable_character_translation = Qt; |
| 10711 | 10644 | ||
| 10712 | DEFVAR_LISP ("standard-translation-table-for-decode", | 10645 | DEFVAR_LISP ("standard-translation-table-for-decode", |
| 10713 | &Vstandard_translation_table_for_decode, | 10646 | Vstandard_translation_table_for_decode, |
| 10714 | doc: /* Table for translating characters while decoding. */); | 10647 | doc: /* Table for translating characters while decoding. */); |
| 10715 | Vstandard_translation_table_for_decode = Qnil; | 10648 | Vstandard_translation_table_for_decode = Qnil; |
| 10716 | 10649 | ||
| 10717 | DEFVAR_LISP ("standard-translation-table-for-encode", | 10650 | DEFVAR_LISP ("standard-translation-table-for-encode", |
| 10718 | &Vstandard_translation_table_for_encode, | 10651 | Vstandard_translation_table_for_encode, |
| 10719 | doc: /* Table for translating characters while encoding. */); | 10652 | doc: /* Table for translating characters while encoding. */); |
| 10720 | Vstandard_translation_table_for_encode = Qnil; | 10653 | Vstandard_translation_table_for_encode = Qnil; |
| 10721 | 10654 | ||
| 10722 | DEFVAR_LISP ("charset-revision-table", &Vcharset_revision_table, | 10655 | DEFVAR_LISP ("charset-revision-table", Vcharset_revision_table, |
| 10723 | doc: /* Alist of charsets vs revision numbers. | 10656 | doc: /* Alist of charsets vs revision numbers. |
| 10724 | While encoding, if a charset (car part of an element) is found, | 10657 | While encoding, if a charset (car part of an element) is found, |
| 10725 | designate it with the escape sequence identifying revision (cdr part | 10658 | designate it with the escape sequence identifying revision (cdr part |
| @@ -10727,13 +10660,13 @@ of the element). */); | |||
| 10727 | Vcharset_revision_table = Qnil; | 10660 | Vcharset_revision_table = Qnil; |
| 10728 | 10661 | ||
| 10729 | DEFVAR_LISP ("default-process-coding-system", | 10662 | DEFVAR_LISP ("default-process-coding-system", |
| 10730 | &Vdefault_process_coding_system, | 10663 | Vdefault_process_coding_system, |
| 10731 | doc: /* Cons of coding systems used for process I/O by default. | 10664 | doc: /* Cons of coding systems used for process I/O by default. |
| 10732 | The car part is used for decoding a process output, | 10665 | The car part is used for decoding a process output, |
| 10733 | the cdr part is used for encoding a text to be sent to a process. */); | 10666 | the cdr part is used for encoding a text to be sent to a process. */); |
| 10734 | Vdefault_process_coding_system = Qnil; | 10667 | Vdefault_process_coding_system = Qnil; |
| 10735 | 10668 | ||
| 10736 | DEFVAR_LISP ("latin-extra-code-table", &Vlatin_extra_code_table, | 10669 | DEFVAR_LISP ("latin-extra-code-table", Vlatin_extra_code_table, |
| 10737 | doc: /* | 10670 | doc: /* |
| 10738 | Table of extra Latin codes in the range 128..159 (inclusive). | 10671 | Table of extra Latin codes in the range 128..159 (inclusive). |
| 10739 | This is a vector of length 256. | 10672 | This is a vector of length 256. |
| @@ -10746,7 +10679,7 @@ Only 128th through 159th elements have a meaning. */); | |||
| 10746 | Vlatin_extra_code_table = Fmake_vector (make_number (256), Qnil); | 10679 | Vlatin_extra_code_table = Fmake_vector (make_number (256), Qnil); |
| 10747 | 10680 | ||
| 10748 | DEFVAR_LISP ("select-safe-coding-system-function", | 10681 | DEFVAR_LISP ("select-safe-coding-system-function", |
| 10749 | &Vselect_safe_coding_system_function, | 10682 | Vselect_safe_coding_system_function, |
| 10750 | doc: /* | 10683 | doc: /* |
| 10751 | Function to call to select safe coding system for encoding a text. | 10684 | Function to call to select safe coding system for encoding a text. |
| 10752 | 10685 | ||
| @@ -10760,7 +10693,7 @@ The default value is `select-safe-coding-system' (which see). */); | |||
| 10760 | Vselect_safe_coding_system_function = Qnil; | 10693 | Vselect_safe_coding_system_function = Qnil; |
| 10761 | 10694 | ||
| 10762 | DEFVAR_BOOL ("coding-system-require-warning", | 10695 | DEFVAR_BOOL ("coding-system-require-warning", |
| 10763 | &coding_system_require_warning, | 10696 | coding_system_require_warning, |
| 10764 | doc: /* Internal use only. | 10697 | doc: /* Internal use only. |
| 10765 | If non-nil, on writing a file, `select-safe-coding-system-function' is | 10698 | If non-nil, on writing a file, `select-safe-coding-system-function' is |
| 10766 | called even if `coding-system-for-write' is non-nil. The command | 10699 | called even if `coding-system-for-write' is non-nil. The command |
| @@ -10769,7 +10702,7 @@ called even if `coding-system-for-write' is non-nil. The command | |||
| 10769 | 10702 | ||
| 10770 | 10703 | ||
| 10771 | DEFVAR_BOOL ("inhibit-iso-escape-detection", | 10704 | DEFVAR_BOOL ("inhibit-iso-escape-detection", |
| 10772 | &inhibit_iso_escape_detection, | 10705 | inhibit_iso_escape_detection, |
| 10773 | doc: /* | 10706 | doc: /* |
| 10774 | If non-nil, Emacs ignores ISO-2022 escape sequences during code detection. | 10707 | If non-nil, Emacs ignores ISO-2022 escape sequences during code detection. |
| 10775 | 10708 | ||
| @@ -10797,7 +10730,7 @@ escape sequence (e.g `latin-1') on reading by \\[universal-coding-system-argumen | |||
| 10797 | inhibit_iso_escape_detection = 0; | 10730 | inhibit_iso_escape_detection = 0; |
| 10798 | 10731 | ||
| 10799 | DEFVAR_BOOL ("inhibit-null-byte-detection", | 10732 | DEFVAR_BOOL ("inhibit-null-byte-detection", |
| 10800 | &inhibit_null_byte_detection, | 10733 | inhibit_null_byte_detection, |
| 10801 | doc: /* If non-nil, Emacs ignores null bytes on code detection. | 10734 | doc: /* If non-nil, Emacs ignores null bytes on code detection. |
| 10802 | By default, Emacs treats it as binary data, and does not attempt to | 10735 | By default, Emacs treats it as binary data, and does not attempt to |
| 10803 | decode it. The effect is as if you specified `no-conversion' for | 10736 | decode it. The effect is as if you specified `no-conversion' for |
| @@ -10809,7 +10742,7 @@ from GNU Find and GNU Grep. Emacs will then ignore the null bytes and | |||
| 10809 | decode text as usual. */); | 10742 | decode text as usual. */); |
| 10810 | inhibit_null_byte_detection = 0; | 10743 | inhibit_null_byte_detection = 0; |
| 10811 | 10744 | ||
| 10812 | DEFVAR_LISP ("translation-table-for-input", &Vtranslation_table_for_input, | 10745 | DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, |
| 10813 | doc: /* Char table for translating self-inserting characters. | 10746 | doc: /* Char table for translating self-inserting characters. |
| 10814 | This is applied to the result of input methods, not their input. | 10747 | This is applied to the result of input methods, not their input. |
| 10815 | See also `keyboard-translate-table'. | 10748 | See also `keyboard-translate-table'. |
| @@ -10893,13 +10826,10 @@ emacs_strerror (int error_number) | |||
| 10893 | Lisp_Object dec = code_convert_string_norecord (build_string (str), | 10826 | Lisp_Object dec = code_convert_string_norecord (build_string (str), |
| 10894 | Vlocale_coding_system, | 10827 | Vlocale_coding_system, |
| 10895 | 0); | 10828 | 0); |
| 10896 | str = (char *) SDATA (dec); | 10829 | str = SSDATA (dec); |
| 10897 | } | 10830 | } |
| 10898 | 10831 | ||
| 10899 | return str; | 10832 | return str; |
| 10900 | } | 10833 | } |
| 10901 | 10834 | ||
| 10902 | #endif /* emacs */ | 10835 | #endif /* emacs */ |
| 10903 | |||
| 10904 | /* arch-tag: 3a3a2b01-5ff6-4071-9afe-f5b808d9229d | ||
| 10905 | (do not change this comment) */ | ||