diff options
| author | Bill Wohler | 2013-02-18 10:11:43 -0800 |
|---|---|---|
| committer | Bill Wohler | 2013-02-18 10:11:43 -0800 |
| commit | 21733e4f154f8830fa568a347a0d6dbd59793c2b (patch) | |
| tree | 3170dbbcdfafeb42f6c381d6b80b251e9f31b788 /src/coding.c | |
| parent | 6d14beddb06b5ae86f9dd770a1661ebd24846f28 (diff) | |
| parent | 587feed443522f738b65b57b22a31cc8a25525c5 (diff) | |
| download | emacs-21733e4f154f8830fa568a347a0d6dbd59793c2b.tar.gz emacs-21733e4f154f8830fa568a347a0d6dbd59793c2b.zip | |
Merge from trunk; up to 2013-02-18T01:30:27Z!monnier@iro.umontreal.ca.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/src/coding.c b/src/coding.c index 56202e4861d..868fb7df0ea 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Coding system handler (conversion, detection, etc). | 1 | /* Coding system handler (conversion, detection, etc). |
| 2 | Copyright (C) 2001-2012 Free Software Foundation, Inc. | 2 | Copyright (C) 2001-2013 Free Software Foundation, Inc. |
| 3 | 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, |
| 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
| 5 | National Institute of Advanced Industrial Science and Technology (AIST) | 5 | National Institute of Advanced Industrial Science and Technology (AIST) |
| @@ -302,6 +302,7 @@ Lisp_Object Vcoding_system_hash_table; | |||
| 302 | static Lisp_Object Qcoding_system, Qeol_type; | 302 | static Lisp_Object Qcoding_system, Qeol_type; |
| 303 | static Lisp_Object Qcoding_aliases; | 303 | static Lisp_Object Qcoding_aliases; |
| 304 | Lisp_Object Qunix, Qdos; | 304 | Lisp_Object Qunix, Qdos; |
| 305 | static Lisp_Object Qmac; | ||
| 305 | Lisp_Object Qbuffer_file_coding_system; | 306 | Lisp_Object Qbuffer_file_coding_system; |
| 306 | static Lisp_Object Qpost_read_conversion, Qpre_write_conversion; | 307 | static Lisp_Object Qpost_read_conversion, Qpre_write_conversion; |
| 307 | static Lisp_Object Qdefault_char; | 308 | static Lisp_Object Qdefault_char; |
| @@ -1048,14 +1049,7 @@ coding_alloc_by_making_gap (struct coding_system *coding, | |||
| 1048 | GPT -= gap_head_used, GPT_BYTE -= gap_head_used; | 1049 | GPT -= gap_head_used, GPT_BYTE -= gap_head_used; |
| 1049 | } | 1050 | } |
| 1050 | else | 1051 | else |
| 1051 | { | 1052 | make_gap_1 (XBUFFER (coding->dst_object), bytes); |
| 1052 | Lisp_Object this_buffer; | ||
| 1053 | |||
| 1054 | this_buffer = Fcurrent_buffer (); | ||
| 1055 | set_buffer_internal (XBUFFER (coding->dst_object)); | ||
| 1056 | make_gap (bytes); | ||
| 1057 | set_buffer_internal (XBUFFER (this_buffer)); | ||
| 1058 | } | ||
| 1059 | } | 1053 | } |
| 1060 | 1054 | ||
| 1061 | 1055 | ||
| @@ -3063,20 +3057,7 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3063 | } | 3057 | } |
| 3064 | if (single_shifting) | 3058 | if (single_shifting) |
| 3065 | break; | 3059 | break; |
| 3066 | check_extra_latin: | 3060 | goto check_extra_latin; |
| 3067 | if (! VECTORP (Vlatin_extra_code_table) | ||
| 3068 | || NILP (AREF (Vlatin_extra_code_table, c))) | ||
| 3069 | { | ||
| 3070 | rejected = CATEGORY_MASK_ISO; | ||
| 3071 | break; | ||
| 3072 | } | ||
| 3073 | if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) | ||
| 3074 | & CODING_ISO_FLAG_LATIN_EXTRA) | ||
| 3075 | found |= CATEGORY_MASK_ISO_8_1; | ||
| 3076 | else | ||
| 3077 | rejected |= CATEGORY_MASK_ISO_8_1; | ||
| 3078 | rejected |= CATEGORY_MASK_ISO_8_2; | ||
| 3079 | break; | ||
| 3080 | 3061 | ||
| 3081 | default: | 3062 | default: |
| 3082 | if (c < 0) | 3063 | if (c < 0) |
| @@ -3127,6 +3108,20 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3127 | } | 3108 | } |
| 3128 | break; | 3109 | break; |
| 3129 | } | 3110 | } |
| 3111 | check_extra_latin: | ||
| 3112 | if (! VECTORP (Vlatin_extra_code_table) | ||
| 3113 | || NILP (AREF (Vlatin_extra_code_table, c))) | ||
| 3114 | { | ||
| 3115 | rejected = CATEGORY_MASK_ISO; | ||
| 3116 | break; | ||
| 3117 | } | ||
| 3118 | if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) | ||
| 3119 | & CODING_ISO_FLAG_LATIN_EXTRA) | ||
| 3120 | found |= CATEGORY_MASK_ISO_8_1; | ||
| 3121 | else | ||
| 3122 | rejected |= CATEGORY_MASK_ISO_8_1; | ||
| 3123 | rejected |= CATEGORY_MASK_ISO_8_2; | ||
| 3124 | break; | ||
| 3130 | } | 3125 | } |
| 3131 | } | 3126 | } |
| 3132 | detect_info->rejected |= CATEGORY_MASK_ISO; | 3127 | detect_info->rejected |= CATEGORY_MASK_ISO; |
| @@ -8426,9 +8421,6 @@ highest priority. */) | |||
| 8426 | ptrdiff_t from, to; | 8421 | ptrdiff_t from, to; |
| 8427 | ptrdiff_t from_byte, to_byte; | 8422 | ptrdiff_t from_byte, to_byte; |
| 8428 | 8423 | ||
| 8429 | CHECK_NUMBER_COERCE_MARKER (start); | ||
| 8430 | CHECK_NUMBER_COERCE_MARKER (end); | ||
| 8431 | |||
| 8432 | validate_region (&start, &end); | 8424 | validate_region (&start, &end); |
| 8433 | from = XINT (start), to = XINT (end); | 8425 | from = XINT (start), to = XINT (end); |
| 8434 | from_byte = CHAR_TO_BYTE (from); | 8426 | from_byte = CHAR_TO_BYTE (from); |
| @@ -8872,8 +8864,6 @@ code_convert_region (Lisp_Object start, Lisp_Object end, | |||
| 8872 | ptrdiff_t from, from_byte, to, to_byte; | 8864 | ptrdiff_t from, from_byte, to, to_byte; |
| 8873 | Lisp_Object src_object; | 8865 | Lisp_Object src_object; |
| 8874 | 8866 | ||
| 8875 | CHECK_NUMBER_COERCE_MARKER (start); | ||
| 8876 | CHECK_NUMBER_COERCE_MARKER (end); | ||
| 8877 | if (NILP (coding_system)) | 8867 | if (NILP (coding_system)) |
| 8878 | coding_system = Qno_conversion; | 8868 | coding_system = Qno_conversion; |
| 8879 | else | 8869 | else |
| @@ -9493,7 +9483,7 @@ make_subsidiaries (Lisp_Object base) | |||
| 9493 | int i; | 9483 | int i; |
| 9494 | 9484 | ||
| 9495 | memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); | 9485 | memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); |
| 9496 | subsidiaries = Fmake_vector (make_number (3), Qnil); | 9486 | subsidiaries = make_uninit_vector (3); |
| 9497 | for (i = 0; i < 3; i++) | 9487 | for (i = 0; i < 3; i++) |
| 9498 | { | 9488 | { |
| 9499 | strcpy (buf + base_name_len, suffixes[i]); | 9489 | strcpy (buf + base_name_len, suffixes[i]); |
| @@ -9793,7 +9783,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 9793 | CHECK_VECTOR (initial); | 9783 | CHECK_VECTOR (initial); |
| 9794 | for (i = 0; i < 4; i++) | 9784 | for (i = 0; i < 4; i++) |
| 9795 | { | 9785 | { |
| 9796 | val = Faref (initial, make_number (i)); | 9786 | val = AREF (initial, i); |
| 9797 | if (! NILP (val)) | 9787 | if (! NILP (val)) |
| 9798 | { | 9788 | { |
| 9799 | struct charset *charset; | 9789 | struct charset *charset; |
| @@ -9998,7 +9988,8 @@ usage: (define-coding-system-internal ...) */) | |||
| 9998 | this_name = AREF (eol_type, i); | 9988 | this_name = AREF (eol_type, i); |
| 9999 | this_aliases = Fcons (this_name, Qnil); | 9989 | this_aliases = Fcons (this_name, Qnil); |
| 10000 | this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac); | 9990 | this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac); |
| 10001 | this_spec = Fmake_vector (make_number (3), attrs); | 9991 | this_spec = make_uninit_vector (3); |
| 9992 | ASET (this_spec, 0, attrs); | ||
| 10002 | ASET (this_spec, 1, this_aliases); | 9993 | ASET (this_spec, 1, this_aliases); |
| 10003 | ASET (this_spec, 2, this_eol_type); | 9994 | ASET (this_spec, 2, this_eol_type); |
| 10004 | Fputhash (this_name, this_spec, Vcoding_system_hash_table); | 9995 | Fputhash (this_name, this_spec, Vcoding_system_hash_table); |
| @@ -10011,7 +10002,8 @@ usage: (define-coding-system-internal ...) */) | |||
| 10011 | } | 10002 | } |
| 10012 | } | 10003 | } |
| 10013 | 10004 | ||
| 10014 | spec_vec = Fmake_vector (make_number (3), attrs); | 10005 | spec_vec = make_uninit_vector (3); |
| 10006 | ASET (spec_vec, 0, attrs); | ||
| 10015 | ASET (spec_vec, 1, aliases); | 10007 | ASET (spec_vec, 1, aliases); |
| 10016 | ASET (spec_vec, 2, eol_type); | 10008 | ASET (spec_vec, 2, eol_type); |
| 10017 | 10009 | ||
| @@ -10308,6 +10300,7 @@ syms_of_coding (void) | |||
| 10308 | DEFSYM (Qeol_type, "eol-type"); | 10300 | DEFSYM (Qeol_type, "eol-type"); |
| 10309 | DEFSYM (Qunix, "unix"); | 10301 | DEFSYM (Qunix, "unix"); |
| 10310 | DEFSYM (Qdos, "dos"); | 10302 | DEFSYM (Qdos, "dos"); |
| 10303 | DEFSYM (Qmac, "mac"); | ||
| 10311 | 10304 | ||
| 10312 | DEFSYM (Qbuffer_file_coding_system, "buffer-file-coding-system"); | 10305 | DEFSYM (Qbuffer_file_coding_system, "buffer-file-coding-system"); |
| 10313 | DEFSYM (Qpost_read_conversion, "post-read-conversion"); | 10306 | DEFSYM (Qpost_read_conversion, "post-read-conversion"); |
| @@ -10719,7 +10712,7 @@ reading if you suppress escape sequence detection. | |||
| 10719 | 10712 | ||
| 10720 | The other way to read escape sequences in a file without decoding is | 10713 | The other way to read escape sequences in a file without decoding is |
| 10721 | to explicitly specify some coding system that doesn't use ISO-2022 | 10714 | to explicitly specify some coding system that doesn't use ISO-2022 |
| 10722 | escape sequence (e.g `latin-1') on reading by \\[universal-coding-system-argument]. */); | 10715 | escape sequence (e.g., `latin-1') on reading by \\[universal-coding-system-argument]. */); |
| 10723 | inhibit_iso_escape_detection = 0; | 10716 | inhibit_iso_escape_detection = 0; |
| 10724 | 10717 | ||
| 10725 | DEFVAR_BOOL ("inhibit-null-byte-detection", | 10718 | DEFVAR_BOOL ("inhibit-null-byte-detection", |