aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2012-07-17 07:25:00 +0900
committerKenichi Handa2012-07-17 07:25:00 +0900
commit69c41c4070c86baac11a627e9c3d366420aeb7cc (patch)
treee07fda92570b5e4f264c9a7869b57960940008f0 /src/coding.c
parent8c536f15bf95916d56bb50495d22b7da7e09fff9 (diff)
parent758e556a7ab8f61c007e34310ba399a9aaf15362 (diff)
downloademacs-69c41c4070c86baac11a627e9c3d366420aeb7cc.tar.gz
emacs-69c41c4070c86baac11a627e9c3d366420aeb7cc.zip
merge trunk
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/coding.c b/src/coding.c
index 17e342298b9..d9fcc634b77 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -288,8 +288,8 @@ encode_coding_XXX (struct coding_system *coding)
288#include <setjmp.h> 288#include <setjmp.h>
289 289
290#include "lisp.h" 290#include "lisp.h"
291#include "buffer.h"
292#include "character.h" 291#include "character.h"
292#include "buffer.h"
293#include "charset.h" 293#include "charset.h"
294#include "ccl.h" 294#include "ccl.h"
295#include "composite.h" 295#include "composite.h"
@@ -1145,8 +1145,8 @@ coding_alloc_by_realloc (struct coding_system *coding, ptrdiff_t bytes)
1145{ 1145{
1146 if (STRING_BYTES_BOUND - coding->dst_bytes < bytes) 1146 if (STRING_BYTES_BOUND - coding->dst_bytes < bytes)
1147 string_overflow (); 1147 string_overflow ();
1148 coding->destination = (unsigned char *) xrealloc (coding->destination, 1148 coding->destination = xrealloc (coding->destination,
1149 coding->dst_bytes + bytes); 1149 coding->dst_bytes + bytes);
1150 coding->dst_bytes += bytes; 1150 coding->dst_bytes += bytes;
1151} 1151}
1152 1152
@@ -3189,7 +3189,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
3189 break; 3189 break;
3190 check_extra_latin: 3190 check_extra_latin:
3191 if (! VECTORP (Vlatin_extra_code_table) 3191 if (! VECTORP (Vlatin_extra_code_table)
3192 || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) 3192 || NILP (AREF (Vlatin_extra_code_table, c)))
3193 { 3193 {
3194 rejected = CATEGORY_MASK_ISO; 3194 rejected = CATEGORY_MASK_ISO;
3195 break; 3195 break;
@@ -5464,7 +5464,7 @@ detect_coding_charset (struct coding_system *coding,
5464 if (c < 0xA0 5464 if (c < 0xA0
5465 && check_latin_extra 5465 && check_latin_extra
5466 && (!VECTORP (Vlatin_extra_code_table) 5466 && (!VECTORP (Vlatin_extra_code_table)
5467 || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))) 5467 || NILP (AREF (Vlatin_extra_code_table, c))))
5468 break; 5468 break;
5469 found = CATEGORY_MASK_CHARSET; 5469 found = CATEGORY_MASK_CHARSET;
5470 } 5470 }
@@ -6765,7 +6765,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
6765 6765
6766 while (buf < buf_end) 6766 while (buf < buf_end)
6767 { 6767 {
6768 int c = *buf, i; 6768 int c = *buf;
6769 ptrdiff_t i;
6769 6770
6770 if (c >= 0) 6771 if (c >= 0)
6771 { 6772 {
@@ -7009,7 +7010,7 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
7009 coding->charbuf = NULL; \ 7010 coding->charbuf = NULL; \
7010 while (size > 1024) \ 7011 while (size > 1024) \
7011 { \ 7012 { \
7012 coding->charbuf = (int *) alloca (sizeof (int) * size); \ 7013 coding->charbuf = alloca (sizeof (int) * size); \
7013 if (coding->charbuf) \ 7014 if (coding->charbuf) \
7014 break; \ 7015 break; \
7015 size >>= 1; \ 7016 size >>= 1; \
@@ -8005,7 +8006,7 @@ encode_coding_object (struct coding_system *coding,
8005 { 8006 {
8006 ptrdiff_t dst_bytes = max (1, coding->src_chars); 8007 ptrdiff_t dst_bytes = max (1, coding->src_chars);
8007 coding->dst_object = Qnil; 8008 coding->dst_object = Qnil;
8008 coding->destination = (unsigned char *) xmalloc (dst_bytes); 8009 coding->destination = xmalloc (dst_bytes);
8009 coding->dst_bytes = dst_bytes; 8010 coding->dst_bytes = dst_bytes;
8010 coding->dst_multibyte = 0; 8011 coding->dst_multibyte = 0;
8011 } 8012 }
@@ -9567,7 +9568,7 @@ make_subsidiaries (Lisp_Object base)
9567{ 9568{
9568 Lisp_Object subsidiaries; 9569 Lisp_Object subsidiaries;
9569 ptrdiff_t base_name_len = SBYTES (SYMBOL_NAME (base)); 9570 ptrdiff_t base_name_len = SBYTES (SYMBOL_NAME (base));
9570 char *buf = (char *) alloca (base_name_len + 6); 9571 char *buf = alloca (base_name_len + 6);
9571 int i; 9572 int i;
9572 9573
9573 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); 9574 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
@@ -9790,11 +9791,11 @@ usage: (define-coding-system-internal ...) */)
9790 9791
9791 val = args[coding_arg_ccl_valids]; 9792 val = args[coding_arg_ccl_valids];
9792 valids = Fmake_string (make_number (256), make_number (0)); 9793 valids = Fmake_string (make_number (256), make_number (0));
9793 for (tail = val; !NILP (tail); tail = Fcdr (tail)) 9794 for (tail = val; CONSP (tail); tail = XCDR (tail))
9794 { 9795 {
9795 int from, to; 9796 int from, to;
9796 9797
9797 val = Fcar (tail); 9798 val = XCAR (tail);
9798 if (INTEGERP (val)) 9799 if (INTEGERP (val))
9799 { 9800 {
9800 if (! (0 <= XINT (val) && XINT (val) <= 255)) 9801 if (! (0 <= XINT (val) && XINT (val) <= 255))
@@ -9891,12 +9892,12 @@ usage: (define-coding-system-internal ...) */)
9891 CHECK_NUMBER_CDR (reg_usage); 9892 CHECK_NUMBER_CDR (reg_usage);
9892 9893
9893 request = Fcopy_sequence (args[coding_arg_iso2022_request]); 9894 request = Fcopy_sequence (args[coding_arg_iso2022_request]);
9894 for (tail = request; ! NILP (tail); tail = Fcdr (tail)) 9895 for (tail = request; CONSP (tail); tail = XCDR (tail))
9895 { 9896 {
9896 int id; 9897 int id;
9897 Lisp_Object tmp1; 9898 Lisp_Object tmp1;
9898 9899
9899 val = Fcar (tail); 9900 val = XCAR (tail);
9900 CHECK_CONS (val); 9901 CHECK_CONS (val);
9901 tmp1 = XCAR (val); 9902 tmp1 = XCAR (val);
9902 CHECK_CHARSET_GET_ID (tmp1, id); 9903 CHECK_CHARSET_GET_ID (tmp1, id);
@@ -10349,7 +10350,7 @@ syms_of_coding (void)
10349 Vcode_conversion_reused_workbuf = Qnil; 10350 Vcode_conversion_reused_workbuf = Qnil;
10350 10351
10351 staticpro (&Vcode_conversion_workbuf_name); 10352 staticpro (&Vcode_conversion_workbuf_name);
10352 Vcode_conversion_workbuf_name = make_pure_c_string (" *code-conversion-work*"); 10353 Vcode_conversion_workbuf_name = build_pure_c_string (" *code-conversion-work*");
10353 10354
10354 reused_workbuf_in_use = 0; 10355 reused_workbuf_in_use = 0;
10355 10356
@@ -10412,7 +10413,7 @@ syms_of_coding (void)
10412 Fput (Qcoding_system_error, Qerror_conditions, 10413 Fput (Qcoding_system_error, Qerror_conditions,
10413 pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil))); 10414 pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil)));
10414 Fput (Qcoding_system_error, Qerror_message, 10415 Fput (Qcoding_system_error, Qerror_message,
10415 make_pure_c_string ("Invalid coding system")); 10416 build_pure_c_string ("Invalid coding system"));
10416 10417
10417 /* Intern this now in case it isn't already done. 10418 /* Intern this now in case it isn't already done.
10418 Setting this variable twice is harmless. 10419 Setting this variable twice is harmless.
@@ -10559,7 +10560,7 @@ Don't modify this variable directly, but use `set-coding-system-priority'. */);
10559 Vcoding_category_list = Qnil; 10560 Vcoding_category_list = Qnil;
10560 for (i = coding_category_max - 1; i >= 0; i--) 10561 for (i = coding_category_max - 1; i >= 0; i--)
10561 Vcoding_category_list 10562 Vcoding_category_list
10562 = Fcons (XVECTOR (Vcoding_category_table)->contents[i], 10563 = Fcons (AREF (Vcoding_category_table, i),
10563 Vcoding_category_list); 10564 Vcoding_category_list);
10564 } 10565 }
10565 10566
@@ -10685,22 +10686,22 @@ Also used for decoding keyboard input on X Window system. */);
10685 DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix, 10686 DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix,
10686 doc: /* 10687 doc: /*
10687*String displayed in mode line for UNIX-like (LF) end-of-line format. */); 10688*String displayed in mode line for UNIX-like (LF) end-of-line format. */);
10688 eol_mnemonic_unix = make_pure_c_string (":"); 10689 eol_mnemonic_unix = build_pure_c_string (":");
10689 10690
10690 DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos, 10691 DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos,
10691 doc: /* 10692 doc: /*
10692*String displayed in mode line for DOS-like (CRLF) end-of-line format. */); 10693*String displayed in mode line for DOS-like (CRLF) end-of-line format. */);
10693 eol_mnemonic_dos = make_pure_c_string ("\\"); 10694 eol_mnemonic_dos = build_pure_c_string ("\\");
10694 10695
10695 DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac, 10696 DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac,
10696 doc: /* 10697 doc: /*
10697*String displayed in mode line for MAC-like (CR) end-of-line format. */); 10698*String displayed in mode line for MAC-like (CR) end-of-line format. */);
10698 eol_mnemonic_mac = make_pure_c_string ("/"); 10699 eol_mnemonic_mac = build_pure_c_string ("/");
10699 10700
10700 DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided, 10701 DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided,
10701 doc: /* 10702 doc: /*
10702*String displayed in mode line when end-of-line format is not yet determined. */); 10703*String displayed in mode line when end-of-line format is not yet determined. */);
10703 eol_mnemonic_undecided = make_pure_c_string (":"); 10704 eol_mnemonic_undecided = build_pure_c_string (":");
10704 10705
10705 DEFVAR_LISP ("enable-character-translation", Venable_character_translation, 10706 DEFVAR_LISP ("enable-character-translation", Venable_character_translation,
10706 doc: /* 10707 doc: /*
@@ -10838,7 +10839,7 @@ internal character representation. */);
10838 plist[10] = intern_c_string (":for-unibyte"); 10839 plist[10] = intern_c_string (":for-unibyte");
10839 plist[11] = args[coding_arg_for_unibyte] = Qt; 10840 plist[11] = args[coding_arg_for_unibyte] = Qt;
10840 plist[12] = intern_c_string (":docstring"); 10841 plist[12] = intern_c_string (":docstring");
10841 plist[13] = make_pure_c_string ("Do no conversion.\n\ 10842 plist[13] = build_pure_c_string ("Do no conversion.\n\
10842\n\ 10843\n\
10843When you visit a file with this coding, the file is read into a\n\ 10844When you visit a file with this coding, the file is read into a\n\
10844unibyte buffer as is, thus each byte of a file is treated as a\n\ 10845unibyte buffer as is, thus each byte of a file is treated as a\n\
@@ -10856,7 +10857,7 @@ character.");
10856 plist[8] = intern_c_string (":charset-list"); 10857 plist[8] = intern_c_string (":charset-list");
10857 plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil); 10858 plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil);
10858 plist[11] = args[coding_arg_for_unibyte] = Qnil; 10859 plist[11] = args[coding_arg_for_unibyte] = Qnil;
10859 plist[13] = make_pure_c_string ("No conversion on encoding, automatic conversion on decoding."); 10860 plist[13] = build_pure_c_string ("No conversion on encoding, automatic conversion on decoding.");
10860 plist[15] = args[coding_arg_eol_type] = Qnil; 10861 plist[15] = args[coding_arg_eol_type] = Qnil;
10861 args[coding_arg_plist] = Flist (16, plist); 10862 args[coding_arg_plist] = Flist (16, plist);
10862 Fdefine_coding_system_internal (coding_arg_max, args); 10863 Fdefine_coding_system_internal (coding_arg_max, args);