aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorStefan Monnier2010-07-23 17:23:09 +0200
committerStefan Monnier2010-07-23 17:23:09 +0200
commit0ee81a0ce066375eac701c06cdfbdebefe594fdc (patch)
treef0dccd24163316cfe688f927681a3032a9b1fe2f /src/coding.c
parent894e369ddf48e191638b8e66ce732f24ff9abe2a (diff)
parent94da839793affa2a270bc26cee9c4d95d4dc4708 (diff)
downloademacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.tar.gz
emacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.zip
Merge from trunk
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c614
1 files changed, 239 insertions, 375 deletions
diff --git a/src/coding.c b/src/coding.c
index 6435fa1ddb1..dcd31fe9f28 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM
154 154
155#if 0 155#if 0
156static int 156static int
157detect_coding_XXX (coding, detect_info) 157detect_coding_XXX (struct coding_system *coding,
158 struct coding_system *coding; 158 struct coding_detection_info *detect_info)
159 struct coding_detection_info *detect_info;
160{ 159{
161 const unsigned char *src = coding->source; 160 const unsigned char *src = coding->source;
162 const unsigned char *src_end = coding->source + coding->src_bytes; 161 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -203,8 +202,7 @@ detect_coding_XXX (coding, detect_info)
203 202
204#if 0 203#if 0
205static void 204static void
206decode_coding_XXXX (coding) 205decode_coding_XXXX (struct coding_system *coding)
207 struct coding_system *coding;
208{ 206{
209 const unsigned char *src = coding->source + coding->consumed; 207 const unsigned char *src = coding->source + coding->consumed;
210 const unsigned char *src_end = coding->source + coding->src_bytes; 208 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -261,8 +259,7 @@ decode_coding_XXXX (coding)
261 Below is a template of these functions. */ 259 Below is a template of these functions. */
262#if 0 260#if 0
263static void 261static void
264encode_coding_XXX (coding) 262encode_coding_XXX (struct coding_system *coding)
265 struct coding_system *coding;
266{ 263{
267 int multibytep = coding->dst_multibyte; 264 int multibytep = coding->dst_multibyte;
268 int *charbuf = coding->charbuf; 265 int *charbuf = coding->charbuf;
@@ -896,80 +893,80 @@ static struct coding_system coding_categories[coding_category_max];
896 893
897 894
898/* Prototypes for static functions. */ 895/* Prototypes for static functions. */
899static void record_conversion_result P_ ((struct coding_system *coding, 896static void record_conversion_result (struct coding_system *coding,
900 enum coding_result_code result)); 897 enum coding_result_code result);
901static int detect_coding_utf_8 P_ ((struct coding_system *, 898static int detect_coding_utf_8 (struct coding_system *,
902 struct coding_detection_info *info)); 899 struct coding_detection_info *info);
903static void decode_coding_utf_8 P_ ((struct coding_system *)); 900static void decode_coding_utf_8 (struct coding_system *);
904static int encode_coding_utf_8 P_ ((struct coding_system *)); 901static int encode_coding_utf_8 (struct coding_system *);
905 902
906static int detect_coding_utf_16 P_ ((struct coding_system *, 903static int detect_coding_utf_16 (struct coding_system *,
907 struct coding_detection_info *info)); 904 struct coding_detection_info *info);
908static void decode_coding_utf_16 P_ ((struct coding_system *)); 905static void decode_coding_utf_16 (struct coding_system *);
909static int encode_coding_utf_16 P_ ((struct coding_system *)); 906static int encode_coding_utf_16 (struct coding_system *);
910 907
911static int detect_coding_iso_2022 P_ ((struct coding_system *, 908static int detect_coding_iso_2022 (struct coding_system *,
912 struct coding_detection_info *info)); 909 struct coding_detection_info *info);
913static void decode_coding_iso_2022 P_ ((struct coding_system *)); 910static void decode_coding_iso_2022 (struct coding_system *);
914static int encode_coding_iso_2022 P_ ((struct coding_system *)); 911static int encode_coding_iso_2022 (struct coding_system *);
915 912
916static int detect_coding_emacs_mule P_ ((struct coding_system *, 913static int detect_coding_emacs_mule (struct coding_system *,
917 struct coding_detection_info *info)); 914 struct coding_detection_info *info);
918static void decode_coding_emacs_mule P_ ((struct coding_system *)); 915static void decode_coding_emacs_mule (struct coding_system *);
919static int encode_coding_emacs_mule P_ ((struct coding_system *)); 916static int encode_coding_emacs_mule (struct coding_system *);
920 917
921static int detect_coding_sjis P_ ((struct coding_system *, 918static int detect_coding_sjis (struct coding_system *,
922 struct coding_detection_info *info)); 919 struct coding_detection_info *info);
923static void decode_coding_sjis P_ ((struct coding_system *)); 920static void decode_coding_sjis (struct coding_system *);
924static int encode_coding_sjis P_ ((struct coding_system *)); 921static int encode_coding_sjis (struct coding_system *);
925 922
926static int detect_coding_big5 P_ ((struct coding_system *, 923static int detect_coding_big5 (struct coding_system *,
927 struct coding_detection_info *info)); 924 struct coding_detection_info *info);
928static void decode_coding_big5 P_ ((struct coding_system *)); 925static void decode_coding_big5 (struct coding_system *);
929static int encode_coding_big5 P_ ((struct coding_system *)); 926static int encode_coding_big5 (struct coding_system *);
930 927
931static int detect_coding_ccl P_ ((struct coding_system *, 928static int detect_coding_ccl (struct coding_system *,
932 struct coding_detection_info *info)); 929 struct coding_detection_info *info);
933static void decode_coding_ccl P_ ((struct coding_system *)); 930static void decode_coding_ccl (struct coding_system *);
934static int encode_coding_ccl P_ ((struct coding_system *)); 931static int encode_coding_ccl (struct coding_system *);
935 932
936static void decode_coding_raw_text P_ ((struct coding_system *)); 933static void decode_coding_raw_text (struct coding_system *);
937static int encode_coding_raw_text P_ ((struct coding_system *)); 934static int encode_coding_raw_text (struct coding_system *);
938 935
939static void coding_set_source P_ ((struct coding_system *)); 936static void coding_set_source (struct coding_system *);
940static void coding_set_destination P_ ((struct coding_system *)); 937static void coding_set_destination (struct coding_system *);
941static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); 938static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT);
942static void coding_alloc_by_making_gap P_ ((struct coding_system *, 939static void coding_alloc_by_making_gap (struct coding_system *,
943 EMACS_INT, EMACS_INT)); 940 EMACS_INT, EMACS_INT);
944static unsigned char *alloc_destination P_ ((struct coding_system *, 941static unsigned char *alloc_destination (struct coding_system *,
945 EMACS_INT, unsigned char *)); 942 EMACS_INT, unsigned char *);
946static void setup_iso_safe_charsets P_ ((Lisp_Object)); 943static void setup_iso_safe_charsets (Lisp_Object);
947static unsigned char *encode_designation_at_bol P_ ((struct coding_system *, 944static unsigned char *encode_designation_at_bol (struct coding_system *,
948 int *, int *, 945 int *, int *,
949 unsigned char *)); 946 unsigned char *);
950static int detect_eol P_ ((const unsigned char *, 947static int detect_eol (const unsigned char *,
951 EMACS_INT, enum coding_category)); 948 EMACS_INT, enum coding_category);
952static Lisp_Object adjust_coding_eol_type P_ ((struct coding_system *, int)); 949static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
953static void decode_eol P_ ((struct coding_system *)); 950static void decode_eol (struct coding_system *);
954static Lisp_Object get_translation_table P_ ((Lisp_Object, int, int *)); 951static Lisp_Object get_translation_table (Lisp_Object, int, int *);
955static Lisp_Object get_translation P_ ((Lisp_Object, int *, int *)); 952static Lisp_Object get_translation (Lisp_Object, int *, int *);
956static int produce_chars P_ ((struct coding_system *, Lisp_Object, int)); 953static int produce_chars (struct coding_system *, Lisp_Object, int);
957static INLINE void produce_charset P_ ((struct coding_system *, int *, 954static INLINE void produce_charset (struct coding_system *, int *,
958 EMACS_INT)); 955 EMACS_INT);
959static void produce_annotation P_ ((struct coding_system *, EMACS_INT)); 956static void produce_annotation (struct coding_system *, EMACS_INT);
960static int decode_coding P_ ((struct coding_system *)); 957static int decode_coding (struct coding_system *);
961static INLINE int *handle_composition_annotation P_ ((EMACS_INT, EMACS_INT, 958static INLINE int *handle_composition_annotation (EMACS_INT, EMACS_INT,
962 struct coding_system *, 959 struct coding_system *,
963 int *, EMACS_INT *)); 960 int *, EMACS_INT *);
964static INLINE int *handle_charset_annotation P_ ((EMACS_INT, EMACS_INT, 961static INLINE int *handle_charset_annotation (EMACS_INT, EMACS_INT,
965 struct coding_system *, 962 struct coding_system *,
966 int *, EMACS_INT *)); 963 int *, EMACS_INT *);
967static void consume_chars P_ ((struct coding_system *, Lisp_Object, int)); 964static void consume_chars (struct coding_system *, Lisp_Object, int);
968static int encode_coding P_ ((struct coding_system *)); 965static int encode_coding (struct coding_system *);
969static Lisp_Object make_conversion_work_buffer P_ ((int)); 966static Lisp_Object make_conversion_work_buffer (int);
970static Lisp_Object code_conversion_restore P_ ((Lisp_Object)); 967static Lisp_Object code_conversion_restore (Lisp_Object);
971static INLINE int char_encodable_p P_ ((int, Lisp_Object)); 968static INLINE int char_encodable_p (int, Lisp_Object);
972static Lisp_Object make_subsidiaries P_ ((Lisp_Object)); 969static Lisp_Object make_subsidiaries (Lisp_Object);
973 970
974static void 971static void
975record_conversion_result (struct coding_system *coding, 972record_conversion_result (struct coding_system *coding,
@@ -1106,8 +1103,7 @@ record_conversion_result (struct coding_system *coding,
1106 1103
1107 1104
1108static void 1105static void
1109coding_set_source (coding) 1106coding_set_source (struct coding_system *coding)
1110 struct coding_system *coding;
1111{ 1107{
1112 if (BUFFERP (coding->src_object)) 1108 if (BUFFERP (coding->src_object))
1113 { 1109 {
@@ -1129,8 +1125,7 @@ coding_set_source (coding)
1129} 1125}
1130 1126
1131static void 1127static void
1132coding_set_destination (coding) 1128coding_set_destination (struct coding_system *coding)
1133 struct coding_system *coding;
1134{ 1129{
1135 if (BUFFERP (coding->dst_object)) 1130 if (BUFFERP (coding->dst_object))
1136 { 1131 {
@@ -1159,9 +1154,7 @@ coding_set_destination (coding)
1159 1154
1160 1155
1161static void 1156static void
1162coding_alloc_by_realloc (coding, bytes) 1157coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
1163 struct coding_system *coding;
1164 EMACS_INT bytes;
1165{ 1158{
1166 coding->destination = (unsigned char *) xrealloc (coding->destination, 1159 coding->destination = (unsigned char *) xrealloc (coding->destination,
1167 coding->dst_bytes + bytes); 1160 coding->dst_bytes + bytes);
@@ -1169,9 +1162,8 @@ coding_alloc_by_realloc (coding, bytes)
1169} 1162}
1170 1163
1171static void 1164static void
1172coding_alloc_by_making_gap (coding, gap_head_used, bytes) 1165coding_alloc_by_making_gap (struct coding_system *coding,
1173 struct coding_system *coding; 1166 EMACS_INT gap_head_used, EMACS_INT bytes)
1174 EMACS_INT gap_head_used, bytes;
1175{ 1167{
1176 if (EQ (coding->src_object, coding->dst_object)) 1168 if (EQ (coding->src_object, coding->dst_object))
1177 { 1169 {
@@ -1200,10 +1192,8 @@ coding_alloc_by_making_gap (coding, gap_head_used, bytes)
1200 1192
1201 1193
1202static unsigned char * 1194static unsigned char *
1203alloc_destination (coding, nbytes, dst) 1195alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1204 struct coding_system *coding; 1196 unsigned char *dst)
1205 EMACS_INT nbytes;
1206 unsigned char *dst;
1207{ 1197{
1208 EMACS_INT offset = dst - coding->destination; 1198 EMACS_INT offset = dst - coding->destination;
1209 1199
@@ -1301,9 +1291,8 @@ alloc_destination (coding, nbytes, dst)
1301#define UTF_8_BOM_3 0xBF 1291#define UTF_8_BOM_3 0xBF
1302 1292
1303static int 1293static int
1304detect_coding_utf_8 (coding, detect_info) 1294detect_coding_utf_8 (struct coding_system *coding,
1305 struct coding_system *coding; 1295 struct coding_detection_info *detect_info)
1306 struct coding_detection_info *detect_info;
1307{ 1296{
1308 const unsigned char *src = coding->source, *src_base; 1297 const unsigned char *src = coding->source, *src_base;
1309 const unsigned char *src_end = coding->source + coding->src_bytes; 1298 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1386,8 +1375,7 @@ detect_coding_utf_8 (coding, detect_info)
1386 1375
1387 1376
1388static void 1377static void
1389decode_coding_utf_8 (coding) 1378decode_coding_utf_8 (struct coding_system *coding)
1390 struct coding_system *coding;
1391{ 1379{
1392 const unsigned char *src = coding->source + coding->consumed; 1380 const unsigned char *src = coding->source + coding->consumed;
1393 const unsigned char *src_end = coding->source + coding->src_bytes; 1381 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1435,8 +1423,6 @@ decode_coding_utf_8 (coding)
1435 } 1423 }
1436 CODING_UTF_8_BOM (coding) = utf_without_bom; 1424 CODING_UTF_8_BOM (coding) = utf_without_bom;
1437 1425
1438
1439
1440 while (1) 1426 while (1)
1441 { 1427 {
1442 int c, c1, c2, c3, c4, c5; 1428 int c, c1, c2, c3, c4, c5;
@@ -1459,7 +1445,7 @@ decode_coding_utf_8 (coding)
1459 { 1445 {
1460 c = - c1; 1446 c = - c1;
1461 } 1447 }
1462 else if (UTF_8_1_OCTET_P(c1)) 1448 else if (UTF_8_1_OCTET_P (c1))
1463 { 1449 {
1464 if (eol_crlf && c1 == '\r') 1450 if (eol_crlf && c1 == '\r')
1465 ONE_MORE_BYTE (byte_after_cr); 1451 ONE_MORE_BYTE (byte_after_cr);
@@ -1543,8 +1529,7 @@ decode_coding_utf_8 (coding)
1543 1529
1544 1530
1545static int 1531static int
1546encode_coding_utf_8 (coding) 1532encode_coding_utf_8 (struct coding_system *coding)
1547 struct coding_system *coding;
1548{ 1533{
1549 int multibytep = coding->dst_multibyte; 1534 int multibytep = coding->dst_multibyte;
1550 int *charbuf = coding->charbuf; 1535 int *charbuf = coding->charbuf;
@@ -1623,9 +1608,8 @@ encode_coding_utf_8 (coding)
1623 1608
1624 1609
1625static int 1610static int
1626detect_coding_utf_16 (coding, detect_info) 1611detect_coding_utf_16 (struct coding_system *coding,
1627 struct coding_system *coding; 1612 struct coding_detection_info *detect_info)
1628 struct coding_detection_info *detect_info;
1629{ 1613{
1630 const unsigned char *src = coding->source, *src_base = src; 1614 const unsigned char *src = coding->source, *src_base = src;
1631 const unsigned char *src_end = coding->source + coding->src_bytes; 1615 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1708,8 +1692,7 @@ detect_coding_utf_16 (coding, detect_info)
1708} 1692}
1709 1693
1710static void 1694static void
1711decode_coding_utf_16 (coding) 1695decode_coding_utf_16 (struct coding_system *coding)
1712 struct coding_system *coding;
1713{ 1696{
1714 const unsigned char *src = coding->source + coding->consumed; 1697 const unsigned char *src = coding->source + coding->consumed;
1715 const unsigned char *src_end = coding->source + coding->src_bytes; 1698 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -1837,8 +1820,7 @@ decode_coding_utf_16 (coding)
1837} 1820}
1838 1821
1839static int 1822static int
1840encode_coding_utf_16 (coding) 1823encode_coding_utf_16 (struct coding_system *coding)
1841 struct coding_system *coding;
1842{ 1824{
1843 int multibytep = coding->dst_multibyte; 1825 int multibytep = coding->dst_multibyte;
1844 int *charbuf = coding->charbuf; 1826 int *charbuf = coding->charbuf;
@@ -1979,9 +1961,8 @@ char emacs_mule_bytes[256];
1979 else return 0. */ 1961 else return 0. */
1980 1962
1981static int 1963static int
1982detect_coding_emacs_mule (coding, detect_info) 1964detect_coding_emacs_mule (struct coding_system *coding,
1983 struct coding_system *coding; 1965 struct coding_detection_info *detect_info)
1984 struct coding_detection_info *detect_info;
1985{ 1966{
1986 const unsigned char *src = coding->source, *src_base; 1967 const unsigned char *src = coding->source, *src_base;
1987 const unsigned char *src_end = coding->source + coding->src_bytes; 1968 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -2069,11 +2050,9 @@ detect_coding_emacs_mule (coding, detect_info)
2069 -1. If SRC is too short, return -2. */ 2050 -1. If SRC is too short, return -2. */
2070 2051
2071int 2052int
2072emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) 2053emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2073 struct coding_system *coding; 2054 int *nbytes, int *nchars, int *id,
2074 const unsigned char *src; 2055 struct composition_status *cmp_status)
2075 int *nbytes, *nchars, *id;
2076 struct composition_status *cmp_status;
2077{ 2056{
2078 const unsigned char *src_end = coding->source + coding->src_bytes; 2057 const unsigned char *src_end = coding->source + coding->src_bytes;
2079 const unsigned char *src_base = src; 2058 const unsigned char *src_base = src;
@@ -2210,7 +2189,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2210 (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ... 2189 (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ...
2211 2190
2212 and these old form: 2191 and these old form:
2213 2192
2214 (4) relative composition: 0x80 | MSEQ ... MSEQ 2193 (4) relative composition: 0x80 | MSEQ ... MSEQ
2215 (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ 2194 (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ
2216 2195
@@ -2391,9 +2370,8 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2391 2370
2392 2371
2393static int 2372static int
2394emacs_mule_finish_composition (charbuf, cmp_status) 2373emacs_mule_finish_composition (int *charbuf,
2395 int *charbuf; 2374 struct composition_status *cmp_status)
2396 struct composition_status *cmp_status;
2397{ 2375{
2398 int idx = - cmp_status->length; 2376 int idx = - cmp_status->length;
2399 int new_chars; 2377 int new_chars;
@@ -2448,8 +2426,7 @@ emacs_mule_finish_composition (charbuf, cmp_status)
2448 2426
2449 2427
2450static void 2428static void
2451decode_coding_emacs_mule (coding) 2429decode_coding_emacs_mule (struct coding_system *coding)
2452 struct coding_system *coding;
2453{ 2430{
2454 const unsigned char *src = coding->source + coding->consumed; 2431 const unsigned char *src = coding->source + coding->consumed;
2455 const unsigned char *src_end = coding->source + coding->src_bytes; 2432 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -2713,8 +2690,7 @@ decode_coding_emacs_mule (coding)
2713 2690
2714 2691
2715static int 2692static int
2716encode_coding_emacs_mule (coding) 2693encode_coding_emacs_mule (struct coding_system *coding)
2717 struct coding_system *coding;
2718{ 2694{
2719 int multibytep = coding->dst_multibyte; 2695 int multibytep = coding->dst_multibyte;
2720 int *charbuf = coding->charbuf; 2696 int *charbuf = coding->charbuf;
@@ -3007,8 +2983,7 @@ enum iso_code_class_type iso_code_class[256];
3007 (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) 2983 (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0)
3008 2984
3009static void 2985static void
3010setup_iso_safe_charsets (attrs) 2986setup_iso_safe_charsets (Lisp_Object attrs)
3011 Lisp_Object attrs;
3012{ 2987{
3013 Lisp_Object charset_list, safe_charsets; 2988 Lisp_Object charset_list, safe_charsets;
3014 Lisp_Object request; 2989 Lisp_Object request;
@@ -3076,9 +3051,8 @@ setup_iso_safe_charsets (attrs)
3076 If it is, return 1, else return 0. */ 3051 If it is, return 1, else return 0. */
3077 3052
3078static int 3053static int
3079detect_coding_iso_2022 (coding, detect_info) 3054detect_coding_iso_2022 (struct coding_system *coding,
3080 struct coding_system *coding; 3055 struct coding_detection_info *detect_info)
3081 struct coding_detection_info *detect_info;
3082{ 3056{
3083 const unsigned char *src = coding->source, *src_base = src; 3057 const unsigned char *src = coding->source, *src_base = src;
3084 const unsigned char *src_end = coding->source + coding->src_bytes; 3058 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -3442,12 +3416,10 @@ detect_coding_iso_2022 (coding, detect_info)
3442 3416
3443/* Finish the current composition as invalid. */ 3417/* Finish the current composition as invalid. */
3444 3418
3445static int finish_composition P_ ((int *, struct composition_status *)); 3419static int finish_composition (int *, struct composition_status *);
3446 3420
3447static int 3421static int
3448finish_composition (charbuf, cmp_status) 3422finish_composition (int *charbuf, struct composition_status *cmp_status)
3449 int *charbuf;
3450 struct composition_status *cmp_status;
3451{ 3423{
3452 int idx = - cmp_status->length; 3424 int idx = - cmp_status->length;
3453 int new_chars; 3425 int new_chars;
@@ -3584,8 +3556,7 @@ finish_composition (charbuf, cmp_status)
3584/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ 3556/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */
3585 3557
3586static void 3558static void
3587decode_coding_iso_2022 (coding) 3559decode_coding_iso_2022 (struct coding_system *coding)
3588 struct coding_system *coding;
3589{ 3560{
3590 const unsigned char *src = coding->source + coding->consumed; 3561 const unsigned char *src = coding->source + coding->consumed;
3591 const unsigned char *src_end = coding->source + coding->src_bytes; 3562 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4317,7 +4288,7 @@ decode_coding_iso_2022 (coding)
4317 4288
4318#define ENCODE_ISO_CHARACTER(charset, c) \ 4289#define ENCODE_ISO_CHARACTER(charset, c) \
4319 do { \ 4290 do { \
4320 int code = ENCODE_CHAR ((charset),(c)); \ 4291 int code = ENCODE_CHAR ((charset), (c)); \
4321 \ 4292 \
4322 if (CHARSET_DIMENSION (charset) == 1) \ 4293 if (CHARSET_DIMENSION (charset) == 1) \
4323 ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \ 4294 ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \
@@ -4331,11 +4302,9 @@ decode_coding_iso_2022 (coding)
4331 Return new DST. */ 4302 Return new DST. */
4332 4303
4333unsigned char * 4304unsigned char *
4334encode_invocation_designation (charset, coding, dst, p_nchars) 4305encode_invocation_designation (struct charset *charset,
4335 struct charset *charset; 4306 struct coding_system *coding,
4336 struct coding_system *coding; 4307 unsigned char *dst, int *p_nchars)
4337 unsigned char *dst;
4338 int *p_nchars;
4339{ 4308{
4340 int multibytep = coding->dst_multibyte; 4309 int multibytep = coding->dst_multibyte;
4341 int produced_chars = *p_nchars; 4310 int produced_chars = *p_nchars;
@@ -4447,10 +4416,8 @@ encode_invocation_designation (charset, coding, dst, p_nchars)
4447 find all the necessary designations. */ 4416 find all the necessary designations. */
4448 4417
4449static unsigned char * 4418static unsigned char *
4450encode_designation_at_bol (coding, charbuf, charbuf_end, dst) 4419encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4451 struct coding_system *coding; 4420 int *charbuf_end, unsigned char *dst)
4452 int *charbuf, *charbuf_end;
4453 unsigned char *dst;
4454{ 4421{
4455 struct charset *charset; 4422 struct charset *charset;
4456 /* Table of charsets to be designated to each graphic register. */ 4423 /* Table of charsets to be designated to each graphic register. */
@@ -4500,8 +4467,7 @@ encode_designation_at_bol (coding, charbuf, charbuf_end, dst)
4500/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ 4467/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */
4501 4468
4502static int 4469static int
4503encode_coding_iso_2022 (coding) 4470encode_coding_iso_2022 (struct coding_system *coding)
4504 struct coding_system *coding;
4505{ 4471{
4506 int multibytep = coding->dst_multibyte; 4472 int multibytep = coding->dst_multibyte;
4507 int *charbuf = coding->charbuf; 4473 int *charbuf = coding->charbuf;
@@ -4691,9 +4657,8 @@ encode_coding_iso_2022 (coding)
4691 CATEGORY_MASK_SJIS, else return 0. */ 4657 CATEGORY_MASK_SJIS, else return 0. */
4692 4658
4693static int 4659static int
4694detect_coding_sjis (coding, detect_info) 4660detect_coding_sjis (struct coding_system *coding,
4695 struct coding_system *coding; 4661 struct coding_detection_info *detect_info)
4696 struct coding_detection_info *detect_info;
4697{ 4662{
4698 const unsigned char *src = coding->source, *src_base; 4663 const unsigned char *src = coding->source, *src_base;
4699 const unsigned char *src_end = coding->source + coding->src_bytes; 4664 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4749,9 +4714,8 @@ detect_coding_sjis (coding, detect_info)
4749 CATEGORY_MASK_BIG5, else return 0. */ 4714 CATEGORY_MASK_BIG5, else return 0. */
4750 4715
4751static int 4716static int
4752detect_coding_big5 (coding, detect_info) 4717detect_coding_big5 (struct coding_system *coding,
4753 struct coding_system *coding; 4718 struct coding_detection_info *detect_info)
4754 struct coding_detection_info *detect_info;
4755{ 4719{
4756 const unsigned char *src = coding->source, *src_base; 4720 const unsigned char *src = coding->source, *src_base;
4757 const unsigned char *src_end = coding->source + coding->src_bytes; 4721 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4797,8 +4761,7 @@ detect_coding_big5 (coding, detect_info)
4797 If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */ 4761 If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */
4798 4762
4799static void 4763static void
4800decode_coding_sjis (coding) 4764decode_coding_sjis (struct coding_system *coding)
4801 struct coding_system *coding;
4802{ 4765{
4803 const unsigned char *src = coding->source + coding->consumed; 4766 const unsigned char *src = coding->source + coding->consumed;
4804 const unsigned char *src_end = coding->source + coding->src_bytes; 4767 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -4916,8 +4879,7 @@ decode_coding_sjis (coding)
4916} 4879}
4917 4880
4918static void 4881static void
4919decode_coding_big5 (coding) 4882decode_coding_big5 (struct coding_system *coding)
4920 struct coding_system *coding;
4921{ 4883{
4922 const unsigned char *src = coding->source + coding->consumed; 4884 const unsigned char *src = coding->source + coding->consumed;
4923 const unsigned char *src_end = coding->source + coding->src_bytes; 4885 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5021,8 +4983,7 @@ decode_coding_big5 (coding)
5021 SJIS text, else encode BIG5 text. */ 4983 SJIS text, else encode BIG5 text. */
5022 4984
5023static int 4985static int
5024encode_coding_sjis (coding) 4986encode_coding_sjis (struct coding_system *coding)
5025 struct coding_system *coding;
5026{ 4987{
5027 int multibytep = coding->dst_multibyte; 4988 int multibytep = coding->dst_multibyte;
5028 int *charbuf = coding->charbuf; 4989 int *charbuf = coding->charbuf;
@@ -5114,8 +5075,7 @@ encode_coding_sjis (coding)
5114} 5075}
5115 5076
5116static int 5077static int
5117encode_coding_big5 (coding) 5078encode_coding_big5 (struct coding_system *coding)
5118 struct coding_system *coding;
5119{ 5079{
5120 int multibytep = coding->dst_multibyte; 5080 int multibytep = coding->dst_multibyte;
5121 int *charbuf = coding->charbuf; 5081 int *charbuf = coding->charbuf;
@@ -5193,9 +5153,8 @@ encode_coding_big5 (coding)
5193 CATEGORY_MASK_CCL, else return 0. */ 5153 CATEGORY_MASK_CCL, else return 0. */
5194 5154
5195static int 5155static int
5196detect_coding_ccl (coding, detect_info) 5156detect_coding_ccl (struct coding_system *coding,
5197 struct coding_system *coding; 5157 struct coding_detection_info *detect_info)
5198 struct coding_detection_info *detect_info;
5199{ 5158{
5200 const unsigned char *src = coding->source, *src_base; 5159 const unsigned char *src = coding->source, *src_base;
5201 const unsigned char *src_end = coding->source + coding->src_bytes; 5160 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5234,8 +5193,7 @@ detect_coding_ccl (coding, detect_info)
5234} 5193}
5235 5194
5236static void 5195static void
5237decode_coding_ccl (coding) 5196decode_coding_ccl (struct coding_system *coding)
5238 struct coding_system *coding;
5239{ 5197{
5240 const unsigned char *src = coding->source + coding->consumed; 5198 const unsigned char *src = coding->source + coding->consumed;
5241 const unsigned char *src_end = coding->source + coding->src_bytes; 5199 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5304,8 +5262,7 @@ decode_coding_ccl (coding)
5304} 5262}
5305 5263
5306static int 5264static int
5307encode_coding_ccl (coding) 5265encode_coding_ccl (struct coding_system *coding)
5308 struct coding_system *coding;
5309{ 5266{
5310 struct ccl_program *ccl = &coding->spec.ccl->ccl; 5267 struct ccl_program *ccl = &coding->spec.ccl->ccl;
5311 int multibytep = coding->dst_multibyte; 5268 int multibytep = coding->dst_multibyte;
@@ -5374,8 +5331,7 @@ encode_coding_ccl (coding)
5374/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ 5331/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */
5375 5332
5376static void 5333static void
5377decode_coding_raw_text (coding) 5334decode_coding_raw_text (struct coding_system *coding)
5378 struct coding_system *coding;
5379{ 5335{
5380 int eol_crlf = 5336 int eol_crlf =
5381 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 5337 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -5394,8 +5350,7 @@ decode_coding_raw_text (coding)
5394} 5350}
5395 5351
5396static int 5352static int
5397encode_coding_raw_text (coding) 5353encode_coding_raw_text (struct coding_system *coding)
5398 struct coding_system *coding;
5399{ 5354{
5400 int multibytep = coding->dst_multibyte; 5355 int multibytep = coding->dst_multibyte;
5401 int *charbuf = coding->charbuf; 5356 int *charbuf = coding->charbuf;
@@ -5478,9 +5433,8 @@ encode_coding_raw_text (coding)
5478 is, return 1, else return 0. */ 5433 is, return 1, else return 0. */
5479 5434
5480static int 5435static int
5481detect_coding_charset (coding, detect_info) 5436detect_coding_charset (struct coding_system *coding,
5482 struct coding_system *coding; 5437 struct coding_detection_info *detect_info)
5483 struct coding_detection_info *detect_info;
5484{ 5438{
5485 const unsigned char *src = coding->source, *src_base; 5439 const unsigned char *src = coding->source, *src_base;
5486 const unsigned char *src_end = coding->source + coding->src_bytes; 5440 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5582,8 +5536,7 @@ detect_coding_charset (coding, detect_info)
5582} 5536}
5583 5537
5584static void 5538static void
5585decode_coding_charset (coding) 5539decode_coding_charset (struct coding_system *coding)
5586 struct coding_system *coding;
5587{ 5540{
5588 const unsigned char *src = coding->source + coding->consumed; 5541 const unsigned char *src = coding->source + coding->consumed;
5589 const unsigned char *src_end = coding->source + coding->src_bytes; 5542 const unsigned char *src_end = coding->source + coding->src_bytes;
@@ -5711,8 +5664,7 @@ decode_coding_charset (coding)
5711} 5664}
5712 5665
5713static int 5666static int
5714encode_coding_charset (coding) 5667encode_coding_charset (struct coding_system *coding)
5715 struct coding_system *coding;
5716{ 5668{
5717 int multibytep = coding->dst_multibyte; 5669 int multibytep = coding->dst_multibyte;
5718 int *charbuf = coding->charbuf; 5670 int *charbuf = coding->charbuf;
@@ -5782,9 +5734,7 @@ encode_coding_charset (coding)
5782 CODING_SYSTEM is invalid, signal an error. */ 5734 CODING_SYSTEM is invalid, signal an error. */
5783 5735
5784void 5736void
5785setup_coding_system (coding_system, coding) 5737setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
5786 Lisp_Object coding_system;
5787 struct coding_system *coding;
5788{ 5738{
5789 Lisp_Object attrs; 5739 Lisp_Object attrs;
5790 Lisp_Object eol_type; 5740 Lisp_Object eol_type;
@@ -5987,8 +5937,7 @@ setup_coding_system (coding_system, coding)
5987/* Return a list of charsets supported by CODING. */ 5937/* Return a list of charsets supported by CODING. */
5988 5938
5989Lisp_Object 5939Lisp_Object
5990coding_charset_list (coding) 5940coding_charset_list (struct coding_system *coding)
5991 struct coding_system *coding;
5992{ 5941{
5993 Lisp_Object attrs, charset_list; 5942 Lisp_Object attrs, charset_list;
5994 5943
@@ -6011,8 +5960,7 @@ coding_charset_list (coding)
6011/* Return a list of charsets supported by CODING-SYSTEM. */ 5960/* Return a list of charsets supported by CODING-SYSTEM. */
6012 5961
6013Lisp_Object 5962Lisp_Object
6014coding_system_charset_list (coding_system) 5963coding_system_charset_list (Lisp_Object coding_system)
6015 Lisp_Object coding_system;
6016{ 5964{
6017 int id; 5965 int id;
6018 Lisp_Object attrs, charset_list; 5966 Lisp_Object attrs, charset_list;
@@ -6045,8 +5993,7 @@ coding_system_charset_list (coding_system)
6045 eol_type as CODING-SYSTEM. */ 5993 eol_type as CODING-SYSTEM. */
6046 5994
6047Lisp_Object 5995Lisp_Object
6048raw_text_coding_system (coding_system) 5996raw_text_coding_system (Lisp_Object coding_system)
6049 Lisp_Object coding_system;
6050{ 5997{
6051 Lisp_Object spec, attrs; 5998 Lisp_Object spec, attrs;
6052 Lisp_Object eol_type, raw_text_eol_type; 5999 Lisp_Object eol_type, raw_text_eol_type;
@@ -6077,8 +6024,7 @@ raw_text_coding_system (coding_system)
6077 (system_eol_type). */ 6024 (system_eol_type). */
6078 6025
6079Lisp_Object 6026Lisp_Object
6080coding_inherit_eol_type (coding_system, parent) 6027coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
6081 Lisp_Object coding_system, parent;
6082{ 6028{
6083 Lisp_Object spec, eol_type; 6029 Lisp_Object spec, eol_type;
6084 6030
@@ -6233,10 +6179,8 @@ coding_inherit_eol_type (coding_system, parent)
6233#define MAX_EOL_CHECK_COUNT 3 6179#define MAX_EOL_CHECK_COUNT 3
6234 6180
6235static int 6181static int
6236detect_eol (source, src_bytes, category) 6182detect_eol (const unsigned char *source, EMACS_INT src_bytes,
6237 const unsigned char *source; 6183 enum coding_category category)
6238 EMACS_INT src_bytes;
6239 enum coding_category category;
6240{ 6184{
6241 const unsigned char *src = source, *src_end = src + src_bytes; 6185 const unsigned char *src = source, *src_end = src + src_bytes;
6242 unsigned char c; 6186 unsigned char c;
@@ -6334,9 +6278,7 @@ detect_eol (source, src_bytes, category)
6334 6278
6335 6279
6336static Lisp_Object 6280static Lisp_Object
6337adjust_coding_eol_type (coding, eol_seen) 6281adjust_coding_eol_type (struct coding_system *coding, int eol_seen)
6338 struct coding_system *coding;
6339 int eol_seen;
6340{ 6282{
6341 Lisp_Object eol_type; 6283 Lisp_Object eol_type;
6342 6284
@@ -6364,8 +6306,7 @@ adjust_coding_eol_type (coding, eol_seen)
6364 system. */ 6306 system. */
6365 6307
6366void 6308void
6367detect_coding (coding) 6309detect_coding (struct coding_system *coding)
6368 struct coding_system *coding;
6369{ 6310{
6370 const unsigned char *src, *src_end; 6311 const unsigned char *src, *src_end;
6371 int saved_mode = coding->mode; 6312 int saved_mode = coding->mode;
@@ -6544,8 +6485,7 @@ detect_coding (coding)
6544 6485
6545 6486
6546static void 6487static void
6547decode_eol (coding) 6488decode_eol (struct coding_system *coding)
6548 struct coding_system *coding;
6549{ 6489{
6550 Lisp_Object eol_type; 6490 Lisp_Object eol_type;
6551 unsigned char *p, *pbeg, *pend; 6491 unsigned char *p, *pbeg, *pend;
@@ -6610,7 +6550,7 @@ decode_eol (coding)
6610 for (p = pend - 2; p >= pbeg; p--) 6550 for (p = pend - 2; p >= pbeg; p--)
6611 if (*p == '\r') 6551 if (*p == '\r')
6612 { 6552 {
6613 safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1); 6553 memmove (p, p + 1, pend-- - p - 1);
6614 n++; 6554 n++;
6615 } 6555 }
6616 } 6556 }
@@ -6647,9 +6587,7 @@ decode_eol (coding)
6647 decoding (ENCODEP is zero). */ 6587 decoding (ENCODEP is zero). */
6648 6588
6649static Lisp_Object 6589static Lisp_Object
6650get_translation_table (attrs, encodep, max_lookup) 6590get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
6651 Lisp_Object attrs;
6652 int encodep, *max_lookup;
6653{ 6591{
6654 Lisp_Object standard, translation_table; 6592 Lisp_Object standard, translation_table;
6655 Lisp_Object val; 6593 Lisp_Object val;
@@ -6751,9 +6689,7 @@ get_translation_table (attrs, encodep, max_lookup)
6751 If BUF is too short to lookup characters in FROM, return Qt. */ 6689 If BUF is too short to lookup characters in FROM, return Qt. */
6752 6690
6753static Lisp_Object 6691static Lisp_Object
6754get_translation (trans, buf, buf_end) 6692get_translation (Lisp_Object trans, int *buf, int *buf_end)
6755 Lisp_Object trans;
6756 int *buf, *buf_end;
6757{ 6693{
6758 6694
6759 if (INTEGERP (trans)) 6695 if (INTEGERP (trans))
@@ -6780,10 +6716,8 @@ get_translation (trans, buf, buf_end)
6780 6716
6781 6717
6782static int 6718static int
6783produce_chars (coding, translation_table, last_block) 6719produce_chars (struct coding_system *coding, Lisp_Object translation_table,
6784 struct coding_system *coding; 6720 int last_block)
6785 Lisp_Object translation_table;
6786 int last_block;
6787{ 6721{
6788 unsigned char *dst = coding->destination + coding->produced; 6722 unsigned char *dst = coding->destination + coding->produced;
6789 unsigned char *dst_end = coding->destination + coding->dst_bytes; 6723 unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -6981,10 +6915,7 @@ produce_chars (coding, translation_table, last_block)
6981 */ 6915 */
6982 6916
6983static INLINE void 6917static INLINE void
6984produce_composition (coding, charbuf, pos) 6918produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos)
6985 struct coding_system *coding;
6986 int *charbuf;
6987 EMACS_INT pos;
6988{ 6919{
6989 int len; 6920 int len;
6990 EMACS_INT to; 6921 EMACS_INT to;
@@ -7028,10 +6959,7 @@ produce_composition (coding, charbuf, pos)
7028 */ 6959 */
7029 6960
7030static INLINE void 6961static INLINE void
7031produce_charset (coding, charbuf, pos) 6962produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos)
7032 struct coding_system *coding;
7033 int *charbuf;
7034 EMACS_INT pos;
7035{ 6963{
7036 EMACS_INT from = pos - charbuf[2]; 6964 EMACS_INT from = pos - charbuf[2];
7037 struct charset *charset = CHARSET_FROM_ID (charbuf[3]); 6965 struct charset *charset = CHARSET_FROM_ID (charbuf[3]);
@@ -7066,9 +6994,7 @@ produce_charset (coding, charbuf, pos)
7066 6994
7067 6995
7068static void 6996static void
7069produce_annotation (coding, pos) 6997produce_annotation (struct coding_system *coding, EMACS_INT pos)
7070 struct coding_system *coding;
7071 EMACS_INT pos;
7072{ 6998{
7073 int *charbuf = coding->charbuf; 6999 int *charbuf = coding->charbuf;
7074 int *charbuf_end = charbuf + coding->charbuf_used; 7000 int *charbuf_end = charbuf + coding->charbuf_used;
@@ -7123,8 +7049,7 @@ produce_annotation (coding, pos)
7123*/ 7049*/
7124 7050
7125static int 7051static int
7126decode_coding (coding) 7052decode_coding (struct coding_system *coding)
7127 struct coding_system *coding;
7128{ 7053{
7129 Lisp_Object attrs; 7054 Lisp_Object attrs;
7130 Lisp_Object undo_list; 7055 Lisp_Object undo_list;
@@ -7262,11 +7187,9 @@ decode_coding (coding)
7262 return BUF. */ 7187 return BUF. */
7263 7188
7264static INLINE int * 7189static INLINE int *
7265handle_composition_annotation (pos, limit, coding, buf, stop) 7190handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
7266 EMACS_INT pos, limit; 7191 struct coding_system *coding, int *buf,
7267 struct coding_system *coding; 7192 EMACS_INT *stop)
7268 int *buf;
7269 EMACS_INT *stop;
7270{ 7193{
7271 EMACS_INT start, end; 7194 EMACS_INT start, end;
7272 Lisp_Object prop; 7195 Lisp_Object prop;
@@ -7347,11 +7270,9 @@ handle_composition_annotation (pos, limit, coding, buf, stop)
7347 property value is non-nil (limiting by LIMIT), and return BUF. */ 7270 property value is non-nil (limiting by LIMIT), and return BUF. */
7348 7271
7349static INLINE int * 7272static INLINE int *
7350handle_charset_annotation (pos, limit, coding, buf, stop) 7273handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
7351 EMACS_INT pos, limit; 7274 struct coding_system *coding, int *buf,
7352 struct coding_system *coding; 7275 EMACS_INT *stop)
7353 int *buf;
7354 EMACS_INT *stop;
7355{ 7276{
7356 Lisp_Object val, next; 7277 Lisp_Object val, next;
7357 int id; 7278 int id;
@@ -7371,10 +7292,8 @@ handle_charset_annotation (pos, limit, coding, buf, stop)
7371 7292
7372 7293
7373static void 7294static void
7374consume_chars (coding, translation_table, max_lookup) 7295consume_chars (struct coding_system *coding, Lisp_Object translation_table,
7375 struct coding_system *coding; 7296 int max_lookup)
7376 Lisp_Object translation_table;
7377 int max_lookup;
7378{ 7297{
7379 int *buf = coding->charbuf; 7298 int *buf = coding->charbuf;
7380 int *buf_end = coding->charbuf + coding->charbuf_size; 7299 int *buf_end = coding->charbuf + coding->charbuf_size;
@@ -7530,8 +7449,7 @@ consume_chars (coding, translation_table, max_lookup)
7530 memory area specified by CODING->destination. */ 7449 memory area specified by CODING->destination. */
7531 7450
7532static int 7451static int
7533encode_coding (coding) 7452encode_coding (struct coding_system *coding)
7534 struct coding_system *coding;
7535{ 7453{
7536 Lisp_Object attrs; 7454 Lisp_Object attrs;
7537 Lisp_Object translation_table; 7455 Lisp_Object translation_table;
@@ -7595,8 +7513,7 @@ static int reused_workbuf_in_use;
7595 multibyteness of returning buffer. */ 7513 multibyteness of returning buffer. */
7596 7514
7597static Lisp_Object 7515static Lisp_Object
7598make_conversion_work_buffer (multibyte) 7516make_conversion_work_buffer (int multibyte)
7599 int multibyte;
7600{ 7517{
7601 Lisp_Object name, workbuf; 7518 Lisp_Object name, workbuf;
7602 struct buffer *current; 7519 struct buffer *current;
@@ -7628,8 +7545,7 @@ make_conversion_work_buffer (multibyte)
7628 7545
7629 7546
7630static Lisp_Object 7547static Lisp_Object
7631code_conversion_restore (arg) 7548code_conversion_restore (Lisp_Object arg)
7632 Lisp_Object arg;
7633{ 7549{
7634 Lisp_Object current, workbuf; 7550 Lisp_Object current, workbuf;
7635 struct gcpro gcpro1; 7551 struct gcpro gcpro1;
@@ -7650,8 +7566,7 @@ code_conversion_restore (arg)
7650} 7566}
7651 7567
7652Lisp_Object 7568Lisp_Object
7653code_conversion_save (with_work_buf, multibyte) 7569code_conversion_save (int with_work_buf, int multibyte)
7654 int with_work_buf, multibyte;
7655{ 7570{
7656 Lisp_Object workbuf = Qnil; 7571 Lisp_Object workbuf = Qnil;
7657 7572
@@ -7663,11 +7578,10 @@ code_conversion_save (with_work_buf, multibyte)
7663} 7578}
7664 7579
7665int 7580int
7666decode_coding_gap (coding, chars, bytes) 7581decode_coding_gap (struct coding_system *coding,
7667 struct coding_system *coding; 7582 EMACS_INT chars, EMACS_INT bytes)
7668 EMACS_INT chars, bytes;
7669{ 7583{
7670 int count = specpdl_ptr - specpdl; 7584 int count = SPECPDL_INDEX ();
7671 Lisp_Object attrs; 7585 Lisp_Object attrs;
7672 7586
7673 code_conversion_save (0, 0); 7587 code_conversion_save (0, 0);
@@ -7710,11 +7624,10 @@ decode_coding_gap (coding, chars, bytes)
7710} 7624}
7711 7625
7712int 7626int
7713encode_coding_gap (coding, chars, bytes) 7627encode_coding_gap (struct coding_system *coding,
7714 struct coding_system *coding; 7628 EMACS_INT chars, EMACS_INT bytes)
7715 EMACS_INT chars, bytes;
7716{ 7629{
7717 int count = specpdl_ptr - specpdl; 7630 int count = SPECPDL_INDEX ();
7718 7631
7719 code_conversion_save (0, 0); 7632 code_conversion_save (0, 0);
7720 7633
@@ -7765,14 +7678,13 @@ encode_coding_gap (coding, chars, bytes)
7765 */ 7678 */
7766 7679
7767void 7680void
7768decode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7681decode_coding_object (struct coding_system *coding,
7769 dst_object) 7682 Lisp_Object src_object,
7770 struct coding_system *coding; 7683 EMACS_INT from, EMACS_INT from_byte,
7771 Lisp_Object src_object; 7684 EMACS_INT to, EMACS_INT to_byte,
7772 EMACS_INT from, from_byte, to, to_byte; 7685 Lisp_Object dst_object)
7773 Lisp_Object dst_object;
7774{ 7686{
7775 int count = specpdl_ptr - specpdl; 7687 int count = SPECPDL_INDEX ();
7776 unsigned char *destination; 7688 unsigned char *destination;
7777 EMACS_INT dst_bytes; 7689 EMACS_INT dst_bytes;
7778 EMACS_INT chars = to - from; 7690 EMACS_INT chars = to - from;
@@ -7902,7 +7814,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
7902 } 7814 }
7903 if (BEGV < GPT && GPT < BEGV + coding->produced_char) 7815 if (BEGV < GPT && GPT < BEGV + coding->produced_char)
7904 move_gap_both (BEGV, BEGV_BYTE); 7816 move_gap_both (BEGV, BEGV_BYTE);
7905 bcopy (BEGV_ADDR, destination, coding->produced); 7817 memcpy (destination, BEGV_ADDR, coding->produced);
7906 coding->destination = destination; 7818 coding->destination = destination;
7907 } 7819 }
7908 } 7820 }
@@ -7956,14 +7868,13 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte,
7956 7868
7957 7869
7958void 7870void
7959encode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7871encode_coding_object (struct coding_system *coding,
7960 dst_object) 7872 Lisp_Object src_object,
7961 struct coding_system *coding; 7873 EMACS_INT from, EMACS_INT from_byte,
7962 Lisp_Object src_object; 7874 EMACS_INT to, EMACS_INT to_byte,
7963 EMACS_INT from, from_byte, to, to_byte; 7875 Lisp_Object dst_object)
7964 Lisp_Object dst_object;
7965{ 7876{
7966 int count = specpdl_ptr - specpdl; 7877 int count = SPECPDL_INDEX ();
7967 EMACS_INT chars = to - from; 7878 EMACS_INT chars = to - from;
7968 EMACS_INT bytes = to_byte - from_byte; 7879 EMACS_INT bytes = to_byte - from_byte;
7969 Lisp_Object attrs; 7880 Lisp_Object attrs;
@@ -8165,7 +8076,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
8165 8076
8166 8077
8167Lisp_Object 8078Lisp_Object
8168preferred_coding_system () 8079preferred_coding_system (void)
8169{ 8080{
8170 int id = coding_categories[coding_priorities[0]].id; 8081 int id = coding_categories[coding_priorities[0]].id;
8171 8082
@@ -8180,8 +8091,7 @@ DEFUN ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0,
8180 doc: /* Return t if OBJECT is nil or a coding-system. 8091 doc: /* Return t if OBJECT is nil or a coding-system.
8181See the documentation of `define-coding-system' for information 8092See the documentation of `define-coding-system' for information
8182about coding-system objects. */) 8093about coding-system objects. */)
8183 (object) 8094 (Lisp_Object object)
8184 Lisp_Object object;
8185{ 8095{
8186 if (NILP (object) 8096 if (NILP (object)
8187 || CODING_SYSTEM_ID (object) >= 0) 8097 || CODING_SYSTEM_ID (object) >= 0)
@@ -8195,8 +8105,7 @@ about coding-system objects. */)
8195DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, 8105DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system,
8196 Sread_non_nil_coding_system, 1, 1, 0, 8106 Sread_non_nil_coding_system, 1, 1, 0,
8197 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) 8107 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */)
8198 (prompt) 8108 (Lisp_Object prompt)
8199 Lisp_Object prompt;
8200{ 8109{
8201 Lisp_Object val; 8110 Lisp_Object val;
8202 do 8111 do
@@ -8213,8 +8122,7 @@ DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
8213If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. 8122If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
8214Ignores case when completing coding systems (all Emacs coding systems 8123Ignores case when completing coding systems (all Emacs coding systems
8215are lower-case). */) 8124are lower-case). */)
8216 (prompt, default_coding_system) 8125 (Lisp_Object prompt, Lisp_Object default_coding_system)
8217 Lisp_Object prompt, default_coding_system;
8218{ 8126{
8219 Lisp_Object val; 8127 Lisp_Object val;
8220 int count = SPECPDL_INDEX (); 8128 int count = SPECPDL_INDEX ();
@@ -8235,8 +8143,7 @@ DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system,
8235If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. 8143If valid, return CODING-SYSTEM, else signal a `coding-system-error' error.
8236It is valid if it is nil or a symbol defined as a coding system by the 8144It is valid if it is nil or a symbol defined as a coding system by the
8237function `define-coding-system'. */) 8145function `define-coding-system'. */)
8238 (coding_system) 8146 (Lisp_Object coding_system)
8239 Lisp_Object coding_system;
8240{ 8147{
8241 Lisp_Object define_form; 8148 Lisp_Object define_form;
8242 8149
@@ -8269,13 +8176,10 @@ function `define-coding-system'. */)
8269 detect only text-format. */ 8176 detect only text-format. */
8270 8177
8271Lisp_Object 8178Lisp_Object
8272detect_coding_system (src, src_chars, src_bytes, highest, multibytep, 8179detect_coding_system (const unsigned char *src,
8273 coding_system) 8180 EMACS_INT src_chars, EMACS_INT src_bytes,
8274 const unsigned char *src; 8181 int highest, int multibytep,
8275 EMACS_INT src_chars, src_bytes; 8182 Lisp_Object coding_system)
8276 int highest;
8277 int multibytep;
8278 Lisp_Object coding_system;
8279{ 8183{
8280 const unsigned char *src_end = src + src_bytes; 8184 const unsigned char *src_end = src + src_bytes;
8281 Lisp_Object attrs, eol_type; 8185 Lisp_Object attrs, eol_type;
@@ -8591,8 +8495,7 @@ format.
8591 8495
8592If optional argument HIGHEST is non-nil, return the coding system of 8496If optional argument HIGHEST is non-nil, return the coding system of
8593highest priority. */) 8497highest priority. */)
8594 (start, end, highest) 8498 (Lisp_Object start, Lisp_Object end, Lisp_Object highest)
8595 Lisp_Object start, end, highest;
8596{ 8499{
8597 int from, to; 8500 int from, to;
8598 int from_byte, to_byte; 8501 int from_byte, to_byte;
@@ -8630,8 +8533,7 @@ format.
8630 8533
8631If optional argument HIGHEST is non-nil, return the coding system of 8534If optional argument HIGHEST is non-nil, return the coding system of
8632highest priority. */) 8535highest priority. */)
8633 (string, highest) 8536 (Lisp_Object string, Lisp_Object highest)
8634 Lisp_Object string, highest;
8635{ 8537{
8636 CHECK_STRING (string); 8538 CHECK_STRING (string);
8637 8539
@@ -8643,9 +8545,7 @@ highest priority. */)
8643 8545
8644 8546
8645static INLINE int 8547static INLINE int
8646char_encodable_p (c, attrs) 8548char_encodable_p (int c, Lisp_Object attrs)
8647 int c;
8648 Lisp_Object attrs;
8649{ 8549{
8650 Lisp_Object tail; 8550 Lisp_Object tail;
8651 struct charset *charset; 8551 struct charset *charset;
@@ -8675,8 +8575,7 @@ DEFUN ("find-coding-systems-region-internal",
8675 Ffind_coding_systems_region_internal, 8575 Ffind_coding_systems_region_internal,
8676 Sfind_coding_systems_region_internal, 2, 3, 0, 8576 Sfind_coding_systems_region_internal, 2, 3, 0,
8677 doc: /* Internal use only. */) 8577 doc: /* Internal use only. */)
8678 (start, end, exclude) 8578 (Lisp_Object start, Lisp_Object end, Lisp_Object exclude)
8679 Lisp_Object start, end, exclude;
8680{ 8579{
8681 Lisp_Object coding_attrs_list, safe_codings; 8580 Lisp_Object coding_attrs_list, safe_codings;
8682 EMACS_INT start_byte, end_byte; 8581 EMACS_INT start_byte, end_byte;
@@ -8809,8 +8708,7 @@ list of positions.
8809If optional 5th argument STRING is non-nil, it is a string to search 8708If optional 5th argument STRING is non-nil, it is a string to search
8810for un-encodable characters. In that case, START and END are indexes 8709for un-encodable characters. In that case, START and END are indexes
8811to the string. */) 8710to the string. */)
8812 (start, end, coding_system, count, string) 8711 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string)
8813 Lisp_Object start, end, coding_system, count, string;
8814{ 8712{
8815 int n; 8713 int n;
8816 struct coding_system coding; 8714 struct coding_system coding;
@@ -8925,8 +8823,7 @@ buffer positions. END is ignored.
8925 8823
8926If the current buffer (or START if it is a string) is unibyte, the value 8824If the current buffer (or START if it is a string) is unibyte, the value
8927is nil. */) 8825is nil. */)
8928 (start, end, coding_system_list) 8826 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list)
8929 Lisp_Object start, end, coding_system_list;
8930{ 8827{
8931 Lisp_Object list; 8828 Lisp_Object list;
8932 EMACS_INT start_byte, end_byte; 8829 EMACS_INT start_byte, end_byte;
@@ -9031,9 +8928,9 @@ is nil. */)
9031 8928
9032 8929
9033Lisp_Object 8930Lisp_Object
9034code_convert_region (start, end, coding_system, dst_object, encodep, norecord) 8931code_convert_region (Lisp_Object start, Lisp_Object end,
9035 Lisp_Object start, end, coding_system, dst_object; 8932 Lisp_Object coding_system, Lisp_Object dst_object,
9036 int encodep, norecord; 8933 int encodep, int norecord)
9037{ 8934{
9038 struct coding_system coding; 8935 struct coding_system coding;
9039 EMACS_INT from, from_byte, to, to_byte; 8936 EMACS_INT from, from_byte, to, to_byte;
@@ -9092,8 +8989,7 @@ If DESTINATION is t, the decoded text is returned.
9092This function sets `last-coding-system-used' to the precise coding system 8989This function sets `last-coding-system-used' to the precise coding system
9093used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 8990used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
9094not fully specified.) */) 8991not fully specified.) */)
9095 (start, end, coding_system, destination) 8992 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination)
9096 Lisp_Object start, end, coding_system, destination;
9097{ 8993{
9098 return code_convert_region (start, end, coding_system, destination, 0, 0); 8994 return code_convert_region (start, end, coding_system, destination, 0, 0);
9099} 8995}
@@ -9115,17 +9011,14 @@ If DESTINATION is t, the encoded text is returned.
9115This function sets `last-coding-system-used' to the precise coding system 9011This function sets `last-coding-system-used' to the precise coding system
9116used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 9012used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
9117not fully specified.) */) 9013not fully specified.) */)
9118 (start, end, coding_system, destination) 9014 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination)
9119 Lisp_Object start, end, coding_system, destination;
9120{ 9015{
9121 return code_convert_region (start, end, coding_system, destination, 1, 0); 9016 return code_convert_region (start, end, coding_system, destination, 1, 0);
9122} 9017}
9123 9018
9124Lisp_Object 9019Lisp_Object
9125code_convert_string (string, coding_system, dst_object, 9020code_convert_string (Lisp_Object string, Lisp_Object coding_system,
9126 encodep, nocopy, norecord) 9021 Lisp_Object dst_object, int encodep, int nocopy, int norecord)
9127 Lisp_Object string, coding_system, dst_object;
9128 int encodep, nocopy, norecord;
9129{ 9022{
9130 struct coding_system coding; 9023 struct coding_system coding;
9131 EMACS_INT chars, bytes; 9024 EMACS_INT chars, bytes;
@@ -9172,9 +9065,8 @@ code_convert_string (string, coding_system, dst_object,
9172 ENCODE_FILE, thus we ignore character composition. */ 9065 ENCODE_FILE, thus we ignore character composition. */
9173 9066
9174Lisp_Object 9067Lisp_Object
9175code_convert_string_norecord (string, coding_system, encodep) 9068code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
9176 Lisp_Object string, coding_system; 9069 int encodep)
9177 int encodep;
9178{ 9070{
9179 return code_convert_string (string, coding_system, Qt, encodep, 0, 1); 9071 return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
9180} 9072}
@@ -9194,8 +9086,7 @@ case, the return value is the length of the decoded text.
9194This function sets `last-coding-system-used' to the precise coding system 9086This function sets `last-coding-system-used' to the precise coding system
9195used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 9087used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
9196not fully specified.) */) 9088not fully specified.) */)
9197 (string, coding_system, nocopy, buffer) 9089 (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer)
9198 Lisp_Object string, coding_system, nocopy, buffer;
9199{ 9090{
9200 return code_convert_string (string, coding_system, buffer, 9091 return code_convert_string (string, coding_system, buffer,
9201 0, ! NILP (nocopy), 0); 9092 0, ! NILP (nocopy), 0);
@@ -9215,8 +9106,7 @@ case, the return value is the length of the encoded text.
9215This function sets `last-coding-system-used' to the precise coding system 9106This function sets `last-coding-system-used' to the precise coding system
9216used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 9107used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
9217not fully specified.) */) 9108not fully specified.) */)
9218 (string, coding_system, nocopy, buffer) 9109 (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer)
9219 Lisp_Object string, coding_system, nocopy, buffer;
9220{ 9110{
9221 return code_convert_string (string, coding_system, buffer, 9111 return code_convert_string (string, coding_system, buffer,
9222 1, ! NILP (nocopy), 1); 9112 1, ! NILP (nocopy), 1);
@@ -9226,8 +9116,7 @@ not fully specified.) */)
9226DEFUN ("decode-sjis-char", Fdecode_sjis_char, Sdecode_sjis_char, 1, 1, 0, 9116DEFUN ("decode-sjis-char", Fdecode_sjis_char, Sdecode_sjis_char, 1, 1, 0,
9227 doc: /* Decode a Japanese character which has CODE in shift_jis encoding. 9117 doc: /* Decode a Japanese character which has CODE in shift_jis encoding.
9228Return the corresponding character. */) 9118Return the corresponding character. */)
9229 (code) 9119 (Lisp_Object code)
9230 Lisp_Object code;
9231{ 9120{
9232 Lisp_Object spec, attrs, val; 9121 Lisp_Object spec, attrs, val;
9233 struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; 9122 struct charset *charset_roman, *charset_kanji, *charset_kana, *charset;
@@ -9274,8 +9163,7 @@ Return the corresponding character. */)
9274DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0, 9163DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0,
9275 doc: /* Encode a Japanese character CH to shift_jis encoding. 9164 doc: /* Encode a Japanese character CH to shift_jis encoding.
9276Return the corresponding code in SJIS. */) 9165Return the corresponding code in SJIS. */)
9277 (ch) 9166 (Lisp_Object ch)
9278 Lisp_Object ch;
9279{ 9167{
9280 Lisp_Object spec, attrs, charset_list; 9168 Lisp_Object spec, attrs, charset_list;
9281 int c; 9169 int c;
@@ -9303,8 +9191,7 @@ Return the corresponding code in SJIS. */)
9303DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0, 9191DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0,
9304 doc: /* Decode a Big5 character which has CODE in BIG5 coding system. 9192 doc: /* Decode a Big5 character which has CODE in BIG5 coding system.
9305Return the corresponding character. */) 9193Return the corresponding character. */)
9306 (code) 9194 (Lisp_Object code)
9307 Lisp_Object code;
9308{ 9195{
9309 Lisp_Object spec, attrs, val; 9196 Lisp_Object spec, attrs, val;
9310 struct charset *charset_roman, *charset_big5, *charset; 9197 struct charset *charset_roman, *charset_big5, *charset;
@@ -9342,8 +9229,7 @@ Return the corresponding character. */)
9342DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0, 9229DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0,
9343 doc: /* Encode the Big5 character CH to BIG5 coding system. 9230 doc: /* Encode the Big5 character CH to BIG5 coding system.
9344Return the corresponding character code in Big5. */) 9231Return the corresponding character code in Big5. */)
9345 (ch) 9232 (Lisp_Object ch)
9346 Lisp_Object ch;
9347{ 9233{
9348 Lisp_Object spec, attrs, charset_list; 9234 Lisp_Object spec, attrs, charset_list;
9349 struct charset *charset; 9235 struct charset *charset;
@@ -9370,9 +9256,7 @@ Return the corresponding character code in Big5. */)
9370DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, 9256DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
9371 Sset_terminal_coding_system_internal, 1, 2, 0, 9257 Sset_terminal_coding_system_internal, 1, 2, 0,
9372 doc: /* Internal use only. */) 9258 doc: /* Internal use only. */)
9373 (coding_system, terminal) 9259 (Lisp_Object coding_system, Lisp_Object terminal)
9374 Lisp_Object coding_system;
9375 Lisp_Object terminal;
9376{ 9260{
9377 struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); 9261 struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
9378 CHECK_SYMBOL (coding_system); 9262 CHECK_SYMBOL (coding_system);
@@ -9390,8 +9274,7 @@ DEFUN ("set-safe-terminal-coding-system-internal",
9390 Fset_safe_terminal_coding_system_internal, 9274 Fset_safe_terminal_coding_system_internal,
9391 Sset_safe_terminal_coding_system_internal, 1, 1, 0, 9275 Sset_safe_terminal_coding_system_internal, 1, 1, 0,
9392 doc: /* Internal use only. */) 9276 doc: /* Internal use only. */)
9393 (coding_system) 9277 (Lisp_Object coding_system)
9394 Lisp_Object coding_system;
9395{ 9278{
9396 CHECK_SYMBOL (coding_system); 9279 CHECK_SYMBOL (coding_system);
9397 setup_coding_system (Fcheck_coding_system (coding_system), 9280 setup_coding_system (Fcheck_coding_system (coding_system),
@@ -9408,8 +9291,7 @@ DEFUN ("terminal-coding-system", Fterminal_coding_system,
9408 doc: /* Return coding system specified for terminal output on the given terminal. 9291 doc: /* Return coding system specified for terminal output on the given terminal.
9409TERMINAL may be a terminal object, a frame, or nil for the selected 9292TERMINAL may be a terminal object, a frame, or nil for the selected
9410frame's terminal device. */) 9293frame's terminal device. */)
9411 (terminal) 9294 (Lisp_Object terminal)
9412 Lisp_Object terminal;
9413{ 9295{
9414 struct coding_system *terminal_coding 9296 struct coding_system *terminal_coding
9415 = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); 9297 = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
@@ -9422,9 +9304,7 @@ frame's terminal device. */)
9422DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, 9304DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
9423 Sset_keyboard_coding_system_internal, 1, 2, 0, 9305 Sset_keyboard_coding_system_internal, 1, 2, 0,
9424 doc: /* Internal use only. */) 9306 doc: /* Internal use only. */)
9425 (coding_system, terminal) 9307 (Lisp_Object coding_system, Lisp_Object terminal)
9426 Lisp_Object coding_system;
9427 Lisp_Object terminal;
9428{ 9308{
9429 struct terminal *t = get_terminal (terminal, 1); 9309 struct terminal *t = get_terminal (terminal, 1);
9430 CHECK_SYMBOL (coding_system); 9310 CHECK_SYMBOL (coding_system);
@@ -9442,8 +9322,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern
9442DEFUN ("keyboard-coding-system", 9322DEFUN ("keyboard-coding-system",
9443 Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0, 9323 Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0,
9444 doc: /* Return coding system specified for decoding keyboard input. */) 9324 doc: /* Return coding system specified for decoding keyboard input. */)
9445 (terminal) 9325 (Lisp_Object terminal)
9446 Lisp_Object terminal;
9447{ 9326{
9448 return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING 9327 return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING
9449 (get_terminal (terminal, 1))->id); 9328 (get_terminal (terminal, 1))->id);
@@ -9491,9 +9370,7 @@ function to call for FILENAME, that function should examine the
9491contents of BUFFER instead of reading the file. 9370contents of BUFFER instead of reading the file.
9492 9371
9493usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) 9372usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
9494 (nargs, args) 9373 (int nargs, Lisp_Object *args)
9495 int nargs;
9496 Lisp_Object *args;
9497{ 9374{
9498 Lisp_Object operation, target_idx, target, val; 9375 Lisp_Object operation, target_idx, target, val;
9499 register Lisp_Object chain; 9376 register Lisp_Object chain;
@@ -9569,15 +9446,13 @@ If multiple coding systems belong to the same category,
9569all but the first one are ignored. 9446all but the first one are ignored.
9570 9447
9571usage: (set-coding-system-priority &rest coding-systems) */) 9448usage: (set-coding-system-priority &rest coding-systems) */)
9572 (nargs, args) 9449 (int nargs, Lisp_Object *args)
9573 int nargs;
9574 Lisp_Object *args;
9575{ 9450{
9576 int i, j; 9451 int i, j;
9577 int changed[coding_category_max]; 9452 int changed[coding_category_max];
9578 enum coding_category priorities[coding_category_max]; 9453 enum coding_category priorities[coding_category_max];
9579 9454
9580 bzero (changed, sizeof changed); 9455 memset (changed, 0, sizeof changed);
9581 9456
9582 for (i = j = 0; i < nargs; i++) 9457 for (i = j = 0; i < nargs; i++)
9583 { 9458 {
@@ -9612,7 +9487,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
9612 priorities[i] = coding_priorities[j]; 9487 priorities[i] = coding_priorities[j];
9613 } 9488 }
9614 9489
9615 bcopy (priorities, coding_priorities, sizeof priorities); 9490 memcpy (coding_priorities, priorities, sizeof priorities);
9616 9491
9617 /* Update `coding-category-list'. */ 9492 /* Update `coding-category-list'. */
9618 Vcoding_category_list = Qnil; 9493 Vcoding_category_list = Qnil;
@@ -9631,8 +9506,7 @@ The list contains a subset of coding systems; i.e. coding systems
9631assigned to each coding category (see `coding-category-list'). 9506assigned to each coding category (see `coding-category-list').
9632 9507
9633HIGHESTP non-nil means just return the highest priority one. */) 9508HIGHESTP non-nil means just return the highest priority one. */)
9634 (highestp) 9509 (Lisp_Object highestp)
9635 Lisp_Object highestp;
9636{ 9510{
9637 int i; 9511 int i;
9638 Lisp_Object val; 9512 Lisp_Object val;
@@ -9656,19 +9530,18 @@ HIGHESTP non-nil means just return the highest priority one. */)
9656static const char *const suffixes[] = { "-unix", "-dos", "-mac" }; 9530static const char *const suffixes[] = { "-unix", "-dos", "-mac" };
9657 9531
9658static Lisp_Object 9532static Lisp_Object
9659make_subsidiaries (base) 9533make_subsidiaries (Lisp_Object base)
9660 Lisp_Object base;
9661{ 9534{
9662 Lisp_Object subsidiaries; 9535 Lisp_Object subsidiaries;
9663 int base_name_len = SBYTES (SYMBOL_NAME (base)); 9536 int base_name_len = SBYTES (SYMBOL_NAME (base));
9664 char *buf = (char *) alloca (base_name_len + 6); 9537 char *buf = (char *) alloca (base_name_len + 6);
9665 int i; 9538 int i;
9666 9539
9667 bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); 9540 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
9668 subsidiaries = Fmake_vector (make_number (3), Qnil); 9541 subsidiaries = Fmake_vector (make_number (3), Qnil);
9669 for (i = 0; i < 3; i++) 9542 for (i = 0; i < 3; i++)
9670 { 9543 {
9671 bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); 9544 memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1);
9672 ASET (subsidiaries, i, intern (buf)); 9545 ASET (subsidiaries, i, intern (buf));
9673 } 9546 }
9674 return subsidiaries; 9547 return subsidiaries;
@@ -9679,9 +9552,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
9679 Sdefine_coding_system_internal, coding_arg_max, MANY, 0, 9552 Sdefine_coding_system_internal, coding_arg_max, MANY, 0,
9680 doc: /* For internal use only. 9553 doc: /* For internal use only.
9681usage: (define-coding-system-internal ...) */) 9554usage: (define-coding-system-internal ...) */)
9682 (nargs, args) 9555 (int nargs, Lisp_Object *args)
9683 int nargs;
9684 Lisp_Object *args;
9685{ 9556{
9686 Lisp_Object name; 9557 Lisp_Object name;
9687 Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ 9558 Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */
@@ -10210,8 +10081,7 @@ usage: (define-coding-system-internal ...) */)
10210DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, 10081DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
10211 3, 3, 0, 10082 3, 3, 0,
10212 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) 10083 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */)
10213 (coding_system, prop, val) 10084 (Lisp_Object coding_system, Lisp_Object prop, Lisp_Object val)
10214 Lisp_Object coding_system, prop, val;
10215{ 10085{
10216 Lisp_Object spec, attrs; 10086 Lisp_Object spec, attrs;
10217 10087
@@ -10267,8 +10137,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
10267DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, 10137DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias,
10268 Sdefine_coding_system_alias, 2, 2, 0, 10138 Sdefine_coding_system_alias, 2, 2, 0,
10269 doc: /* Define ALIAS as an alias for CODING-SYSTEM. */) 10139 doc: /* Define ALIAS as an alias for CODING-SYSTEM. */)
10270 (alias, coding_system) 10140 (Lisp_Object alias, Lisp_Object coding_system)
10271 Lisp_Object alias, coding_system;
10272{ 10141{
10273 Lisp_Object spec, aliases, eol_type, val; 10142 Lisp_Object spec, aliases, eol_type, val;
10274 10143
@@ -10308,8 +10177,7 @@ DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,
10308 1, 1, 0, 10177 1, 1, 0,
10309 doc: /* Return the base of CODING-SYSTEM. 10178 doc: /* Return the base of CODING-SYSTEM.
10310Any alias or subsidiary coding system is not a base coding system. */) 10179Any alias or subsidiary coding system is not a base coding system. */)
10311 (coding_system) 10180 (Lisp_Object coding_system)
10312 Lisp_Object coding_system;
10313{ 10181{
10314 Lisp_Object spec, attrs; 10182 Lisp_Object spec, attrs;
10315 10183
@@ -10323,8 +10191,7 @@ Any alias or subsidiary coding system is not a base coding system. */)
10323DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, 10191DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist,
10324 1, 1, 0, 10192 1, 1, 0,
10325 doc: "Return the property list of CODING-SYSTEM.") 10193 doc: "Return the property list of CODING-SYSTEM.")
10326 (coding_system) 10194 (Lisp_Object coding_system)
10327 Lisp_Object coding_system;
10328{ 10195{
10329 Lisp_Object spec, attrs; 10196 Lisp_Object spec, attrs;
10330 10197
@@ -10339,8 +10206,7 @@ DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist,
10339DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases, 10206DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases,
10340 1, 1, 0, 10207 1, 1, 0,
10341 doc: /* Return the list of aliases of CODING-SYSTEM. */) 10208 doc: /* Return the list of aliases of CODING-SYSTEM. */)
10342 (coding_system) 10209 (Lisp_Object coding_system)
10343 Lisp_Object coding_system;
10344{ 10210{
10345 Lisp_Object spec; 10211 Lisp_Object spec;
10346 10212
@@ -10361,8 +10227,7 @@ and CR respectively.
10361A vector value indicates that a format of end-of-line should be 10227A vector value indicates that a format of end-of-line should be
10362detected automatically. Nth element of the vector is the subsidiary 10228detected automatically. Nth element of the vector is the subsidiary
10363coding system whose eol-type is N. */) 10229coding system whose eol-type is N. */)
10364 (coding_system) 10230 (Lisp_Object coding_system)
10365 Lisp_Object coding_system;
10366{ 10231{
10367 Lisp_Object spec, eol_type; 10232 Lisp_Object spec, eol_type;
10368 int n; 10233 int n;
@@ -10385,7 +10250,7 @@ coding system whose eol-type is N. */)
10385/*** 9. Post-amble ***/ 10250/*** 9. Post-amble ***/
10386 10251
10387void 10252void
10388init_coding_once () 10253init_coding_once (void)
10389{ 10254{
10390 int i; 10255 int i;
10391 10256
@@ -10427,7 +10292,7 @@ init_coding_once ()
10427#ifdef emacs 10292#ifdef emacs
10428 10293
10429void 10294void
10430syms_of_coding () 10295syms_of_coding (void)
10431{ 10296{
10432 staticpro (&Vcoding_system_hash_table); 10297 staticpro (&Vcoding_system_hash_table);
10433 { 10298 {
@@ -10968,7 +10833,7 @@ character.");
10968 for (i = 0; i < coding_category_max; i++) 10833 for (i = 0; i < coding_category_max; i++)
10969 Fset (AREF (Vcoding_category_table, i), Qno_conversion); 10834 Fset (AREF (Vcoding_category_table, i), Qno_conversion);
10970 } 10835 }
10971#if defined (MSDOS) || defined (WINDOWSNT) 10836#if defined (DOS_NT)
10972 system_eol_type = Qdos; 10837 system_eol_type = Qdos;
10973#else 10838#else
10974 system_eol_type = Qunix; 10839 system_eol_type = Qunix;
@@ -10977,8 +10842,7 @@ character.");
10977} 10842}
10978 10843
10979char * 10844char *
10980emacs_strerror (error_number) 10845emacs_strerror (int error_number)
10981 int error_number;
10982{ 10846{
10983 char *str; 10847 char *str;
10984 10848