diff options
| author | Joakim Verona | 2010-08-17 23:19:11 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-08-17 23:19:11 +0200 |
| commit | a8101f663e6cbff953b67b8bef33bc0171818477 (patch) | |
| tree | 8f71a16188f75e91670e05379fb4de2d0136cbf4 /src/coding.c | |
| parent | fe72c5b4651334677326104ec138e7cdd50f2ffe (diff) | |
| parent | 489cd5bd5a0128d6c3bee49fa2c451f2927ddea9 (diff) | |
| download | emacs-a8101f663e6cbff953b67b8bef33bc0171818477.tar.gz emacs-a8101f663e6cbff953b67b8bef33bc0171818477.zip | |
merge from trunk
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 624 |
1 files changed, 242 insertions, 382 deletions
diff --git a/src/coding.c b/src/coding.c index 6435fa1ddb1..6012978b60a 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -154,9 +154,8 @@ STRUCT CODING_SYSTEM | |||
| 154 | 154 | ||
| 155 | #if 0 | 155 | #if 0 |
| 156 | static int | 156 | static int |
| 157 | detect_coding_XXX (coding, detect_info) | 157 | detect_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 |
| 205 | static void | 204 | static void |
| 206 | decode_coding_XXXX (coding) | 205 | decode_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 |
| 263 | static void | 261 | static void |
| 264 | encode_coding_XXX (coding) | 262 | encode_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; |
| @@ -306,7 +303,6 @@ Lisp_Object Vcoding_system_hash_table; | |||
| 306 | 303 | ||
| 307 | Lisp_Object Qcoding_system, Qcoding_aliases, Qeol_type; | 304 | Lisp_Object Qcoding_system, Qcoding_aliases, Qeol_type; |
| 308 | Lisp_Object Qunix, Qdos; | 305 | Lisp_Object Qunix, Qdos; |
| 309 | extern Lisp_Object Qmac; /* frame.c */ | ||
| 310 | Lisp_Object Qbuffer_file_coding_system; | 306 | Lisp_Object Qbuffer_file_coding_system; |
| 311 | Lisp_Object Qpost_read_conversion, Qpre_write_conversion; | 307 | Lisp_Object Qpost_read_conversion, Qpre_write_conversion; |
| 312 | Lisp_Object Qdefault_char; | 308 | Lisp_Object Qdefault_char; |
| @@ -320,7 +316,6 @@ Lisp_Object QCdecode_translation_table, QCencode_translation_table; | |||
| 320 | Lisp_Object QCpost_read_conversion, QCpre_write_conversion; | 316 | Lisp_Object QCpost_read_conversion, QCpre_write_conversion; |
| 321 | Lisp_Object QCascii_compatible_p; | 317 | Lisp_Object QCascii_compatible_p; |
| 322 | 318 | ||
| 323 | extern Lisp_Object Qinsert_file_contents, Qwrite_region; | ||
| 324 | Lisp_Object Qcall_process, Qcall_process_region; | 319 | Lisp_Object Qcall_process, Qcall_process_region; |
| 325 | Lisp_Object Qstart_process, Qopen_network_stream; | 320 | Lisp_Object Qstart_process, Qopen_network_stream; |
| 326 | Lisp_Object Qtarget_idx; | 321 | Lisp_Object Qtarget_idx; |
| @@ -328,8 +323,6 @@ Lisp_Object Qtarget_idx; | |||
| 328 | Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source; | 323 | Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source; |
| 329 | Lisp_Object Qinterrupted, Qinsufficient_memory; | 324 | Lisp_Object Qinterrupted, Qinsufficient_memory; |
| 330 | 325 | ||
| 331 | extern Lisp_Object Qcompletion_ignore_case; | ||
| 332 | |||
| 333 | /* If a symbol has this property, evaluate the value to define the | 326 | /* If a symbol has this property, evaluate the value to define the |
| 334 | symbol as a coding system. */ | 327 | symbol as a coding system. */ |
| 335 | static Lisp_Object Qcoding_system_define_form; | 328 | static Lisp_Object Qcoding_system_define_form; |
| @@ -896,80 +889,80 @@ static struct coding_system coding_categories[coding_category_max]; | |||
| 896 | 889 | ||
| 897 | 890 | ||
| 898 | /* Prototypes for static functions. */ | 891 | /* Prototypes for static functions. */ |
| 899 | static void record_conversion_result P_ ((struct coding_system *coding, | 892 | static void record_conversion_result (struct coding_system *coding, |
| 900 | enum coding_result_code result)); | 893 | enum coding_result_code result); |
| 901 | static int detect_coding_utf_8 P_ ((struct coding_system *, | 894 | static int detect_coding_utf_8 (struct coding_system *, |
| 902 | struct coding_detection_info *info)); | 895 | struct coding_detection_info *info); |
| 903 | static void decode_coding_utf_8 P_ ((struct coding_system *)); | 896 | static void decode_coding_utf_8 (struct coding_system *); |
| 904 | static int encode_coding_utf_8 P_ ((struct coding_system *)); | 897 | static int encode_coding_utf_8 (struct coding_system *); |
| 905 | 898 | ||
| 906 | static int detect_coding_utf_16 P_ ((struct coding_system *, | 899 | static int detect_coding_utf_16 (struct coding_system *, |
| 907 | struct coding_detection_info *info)); | 900 | struct coding_detection_info *info); |
| 908 | static void decode_coding_utf_16 P_ ((struct coding_system *)); | 901 | static void decode_coding_utf_16 (struct coding_system *); |
| 909 | static int encode_coding_utf_16 P_ ((struct coding_system *)); | 902 | static int encode_coding_utf_16 (struct coding_system *); |
| 910 | 903 | ||
| 911 | static int detect_coding_iso_2022 P_ ((struct coding_system *, | 904 | static int detect_coding_iso_2022 (struct coding_system *, |
| 912 | struct coding_detection_info *info)); | 905 | struct coding_detection_info *info); |
| 913 | static void decode_coding_iso_2022 P_ ((struct coding_system *)); | 906 | static void decode_coding_iso_2022 (struct coding_system *); |
| 914 | static int encode_coding_iso_2022 P_ ((struct coding_system *)); | 907 | static int encode_coding_iso_2022 (struct coding_system *); |
| 915 | 908 | ||
| 916 | static int detect_coding_emacs_mule P_ ((struct coding_system *, | 909 | static int detect_coding_emacs_mule (struct coding_system *, |
| 917 | struct coding_detection_info *info)); | 910 | struct coding_detection_info *info); |
| 918 | static void decode_coding_emacs_mule P_ ((struct coding_system *)); | 911 | static void decode_coding_emacs_mule (struct coding_system *); |
| 919 | static int encode_coding_emacs_mule P_ ((struct coding_system *)); | 912 | static int encode_coding_emacs_mule (struct coding_system *); |
| 920 | 913 | ||
| 921 | static int detect_coding_sjis P_ ((struct coding_system *, | 914 | static int detect_coding_sjis (struct coding_system *, |
| 922 | struct coding_detection_info *info)); | 915 | struct coding_detection_info *info); |
| 923 | static void decode_coding_sjis P_ ((struct coding_system *)); | 916 | static void decode_coding_sjis (struct coding_system *); |
| 924 | static int encode_coding_sjis P_ ((struct coding_system *)); | 917 | static int encode_coding_sjis (struct coding_system *); |
| 925 | 918 | ||
| 926 | static int detect_coding_big5 P_ ((struct coding_system *, | 919 | static int detect_coding_big5 (struct coding_system *, |
| 927 | struct coding_detection_info *info)); | 920 | struct coding_detection_info *info); |
| 928 | static void decode_coding_big5 P_ ((struct coding_system *)); | 921 | static void decode_coding_big5 (struct coding_system *); |
| 929 | static int encode_coding_big5 P_ ((struct coding_system *)); | 922 | static int encode_coding_big5 (struct coding_system *); |
| 930 | 923 | ||
| 931 | static int detect_coding_ccl P_ ((struct coding_system *, | 924 | static int detect_coding_ccl (struct coding_system *, |
| 932 | struct coding_detection_info *info)); | 925 | struct coding_detection_info *info); |
| 933 | static void decode_coding_ccl P_ ((struct coding_system *)); | 926 | static void decode_coding_ccl (struct coding_system *); |
| 934 | static int encode_coding_ccl P_ ((struct coding_system *)); | 927 | static int encode_coding_ccl (struct coding_system *); |
| 935 | 928 | ||
| 936 | static void decode_coding_raw_text P_ ((struct coding_system *)); | 929 | static void decode_coding_raw_text (struct coding_system *); |
| 937 | static int encode_coding_raw_text P_ ((struct coding_system *)); | 930 | static int encode_coding_raw_text (struct coding_system *); |
| 938 | 931 | ||
| 939 | static void coding_set_source P_ ((struct coding_system *)); | 932 | static void coding_set_source (struct coding_system *); |
| 940 | static void coding_set_destination P_ ((struct coding_system *)); | 933 | static void coding_set_destination (struct coding_system *); |
| 941 | static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); | 934 | static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT); |
| 942 | static void coding_alloc_by_making_gap P_ ((struct coding_system *, | 935 | static void coding_alloc_by_making_gap (struct coding_system *, |
| 943 | EMACS_INT, EMACS_INT)); | 936 | EMACS_INT, EMACS_INT); |
| 944 | static unsigned char *alloc_destination P_ ((struct coding_system *, | 937 | static unsigned char *alloc_destination (struct coding_system *, |
| 945 | EMACS_INT, unsigned char *)); | 938 | EMACS_INT, unsigned char *); |
| 946 | static void setup_iso_safe_charsets P_ ((Lisp_Object)); | 939 | static void setup_iso_safe_charsets (Lisp_Object); |
| 947 | static unsigned char *encode_designation_at_bol P_ ((struct coding_system *, | 940 | static unsigned char *encode_designation_at_bol (struct coding_system *, |
| 948 | int *, int *, | 941 | int *, int *, |
| 949 | unsigned char *)); | 942 | unsigned char *); |
| 950 | static int detect_eol P_ ((const unsigned char *, | 943 | static int detect_eol (const unsigned char *, |
| 951 | EMACS_INT, enum coding_category)); | 944 | EMACS_INT, enum coding_category); |
| 952 | static Lisp_Object adjust_coding_eol_type P_ ((struct coding_system *, int)); | 945 | static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); |
| 953 | static void decode_eol P_ ((struct coding_system *)); | 946 | static void decode_eol (struct coding_system *); |
| 954 | static Lisp_Object get_translation_table P_ ((Lisp_Object, int, int *)); | 947 | static Lisp_Object get_translation_table (Lisp_Object, int, int *); |
| 955 | static Lisp_Object get_translation P_ ((Lisp_Object, int *, int *)); | 948 | static Lisp_Object get_translation (Lisp_Object, int *, int *); |
| 956 | static int produce_chars P_ ((struct coding_system *, Lisp_Object, int)); | 949 | static int produce_chars (struct coding_system *, Lisp_Object, int); |
| 957 | static INLINE void produce_charset P_ ((struct coding_system *, int *, | 950 | static INLINE void produce_charset (struct coding_system *, int *, |
| 958 | EMACS_INT)); | 951 | EMACS_INT); |
| 959 | static void produce_annotation P_ ((struct coding_system *, EMACS_INT)); | 952 | static void produce_annotation (struct coding_system *, EMACS_INT); |
| 960 | static int decode_coding P_ ((struct coding_system *)); | 953 | static int decode_coding (struct coding_system *); |
| 961 | static INLINE int *handle_composition_annotation P_ ((EMACS_INT, EMACS_INT, | 954 | static INLINE int *handle_composition_annotation (EMACS_INT, EMACS_INT, |
| 962 | struct coding_system *, | 955 | struct coding_system *, |
| 963 | int *, EMACS_INT *)); | 956 | int *, EMACS_INT *); |
| 964 | static INLINE int *handle_charset_annotation P_ ((EMACS_INT, EMACS_INT, | 957 | static INLINE int *handle_charset_annotation (EMACS_INT, EMACS_INT, |
| 965 | struct coding_system *, | 958 | struct coding_system *, |
| 966 | int *, EMACS_INT *)); | 959 | int *, EMACS_INT *); |
| 967 | static void consume_chars P_ ((struct coding_system *, Lisp_Object, int)); | 960 | static void consume_chars (struct coding_system *, Lisp_Object, int); |
| 968 | static int encode_coding P_ ((struct coding_system *)); | 961 | static int encode_coding (struct coding_system *); |
| 969 | static Lisp_Object make_conversion_work_buffer P_ ((int)); | 962 | static Lisp_Object make_conversion_work_buffer (int); |
| 970 | static Lisp_Object code_conversion_restore P_ ((Lisp_Object)); | 963 | static Lisp_Object code_conversion_restore (Lisp_Object); |
| 971 | static INLINE int char_encodable_p P_ ((int, Lisp_Object)); | 964 | static INLINE int char_encodable_p (int, Lisp_Object); |
| 972 | static Lisp_Object make_subsidiaries P_ ((Lisp_Object)); | 965 | static Lisp_Object make_subsidiaries (Lisp_Object); |
| 973 | 966 | ||
| 974 | static void | 967 | static void |
| 975 | record_conversion_result (struct coding_system *coding, | 968 | record_conversion_result (struct coding_system *coding, |
| @@ -1106,8 +1099,7 @@ record_conversion_result (struct coding_system *coding, | |||
| 1106 | 1099 | ||
| 1107 | 1100 | ||
| 1108 | static void | 1101 | static void |
| 1109 | coding_set_source (coding) | 1102 | coding_set_source (struct coding_system *coding) |
| 1110 | struct coding_system *coding; | ||
| 1111 | { | 1103 | { |
| 1112 | if (BUFFERP (coding->src_object)) | 1104 | if (BUFFERP (coding->src_object)) |
| 1113 | { | 1105 | { |
| @@ -1129,8 +1121,7 @@ coding_set_source (coding) | |||
| 1129 | } | 1121 | } |
| 1130 | 1122 | ||
| 1131 | static void | 1123 | static void |
| 1132 | coding_set_destination (coding) | 1124 | coding_set_destination (struct coding_system *coding) |
| 1133 | struct coding_system *coding; | ||
| 1134 | { | 1125 | { |
| 1135 | if (BUFFERP (coding->dst_object)) | 1126 | if (BUFFERP (coding->dst_object)) |
| 1136 | { | 1127 | { |
| @@ -1159,9 +1150,7 @@ coding_set_destination (coding) | |||
| 1159 | 1150 | ||
| 1160 | 1151 | ||
| 1161 | static void | 1152 | static void |
| 1162 | coding_alloc_by_realloc (coding, bytes) | 1153 | coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes) |
| 1163 | struct coding_system *coding; | ||
| 1164 | EMACS_INT bytes; | ||
| 1165 | { | 1154 | { |
| 1166 | coding->destination = (unsigned char *) xrealloc (coding->destination, | 1155 | coding->destination = (unsigned char *) xrealloc (coding->destination, |
| 1167 | coding->dst_bytes + bytes); | 1156 | coding->dst_bytes + bytes); |
| @@ -1169,9 +1158,8 @@ coding_alloc_by_realloc (coding, bytes) | |||
| 1169 | } | 1158 | } |
| 1170 | 1159 | ||
| 1171 | static void | 1160 | static void |
| 1172 | coding_alloc_by_making_gap (coding, gap_head_used, bytes) | 1161 | coding_alloc_by_making_gap (struct coding_system *coding, |
| 1173 | struct coding_system *coding; | 1162 | EMACS_INT gap_head_used, EMACS_INT bytes) |
| 1174 | EMACS_INT gap_head_used, bytes; | ||
| 1175 | { | 1163 | { |
| 1176 | if (EQ (coding->src_object, coding->dst_object)) | 1164 | if (EQ (coding->src_object, coding->dst_object)) |
| 1177 | { | 1165 | { |
| @@ -1200,10 +1188,8 @@ coding_alloc_by_making_gap (coding, gap_head_used, bytes) | |||
| 1200 | 1188 | ||
| 1201 | 1189 | ||
| 1202 | static unsigned char * | 1190 | static unsigned char * |
| 1203 | alloc_destination (coding, nbytes, dst) | 1191 | alloc_destination (struct coding_system *coding, EMACS_INT nbytes, |
| 1204 | struct coding_system *coding; | 1192 | unsigned char *dst) |
| 1205 | EMACS_INT nbytes; | ||
| 1206 | unsigned char *dst; | ||
| 1207 | { | 1193 | { |
| 1208 | EMACS_INT offset = dst - coding->destination; | 1194 | EMACS_INT offset = dst - coding->destination; |
| 1209 | 1195 | ||
| @@ -1301,9 +1287,8 @@ alloc_destination (coding, nbytes, dst) | |||
| 1301 | #define UTF_8_BOM_3 0xBF | 1287 | #define UTF_8_BOM_3 0xBF |
| 1302 | 1288 | ||
| 1303 | static int | 1289 | static int |
| 1304 | detect_coding_utf_8 (coding, detect_info) | 1290 | detect_coding_utf_8 (struct coding_system *coding, |
| 1305 | struct coding_system *coding; | 1291 | struct coding_detection_info *detect_info) |
| 1306 | struct coding_detection_info *detect_info; | ||
| 1307 | { | 1292 | { |
| 1308 | const unsigned char *src = coding->source, *src_base; | 1293 | const unsigned char *src = coding->source, *src_base; |
| 1309 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1294 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -1386,8 +1371,7 @@ detect_coding_utf_8 (coding, detect_info) | |||
| 1386 | 1371 | ||
| 1387 | 1372 | ||
| 1388 | static void | 1373 | static void |
| 1389 | decode_coding_utf_8 (coding) | 1374 | decode_coding_utf_8 (struct coding_system *coding) |
| 1390 | struct coding_system *coding; | ||
| 1391 | { | 1375 | { |
| 1392 | const unsigned char *src = coding->source + coding->consumed; | 1376 | const unsigned char *src = coding->source + coding->consumed; |
| 1393 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1377 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -1435,8 +1419,6 @@ decode_coding_utf_8 (coding) | |||
| 1435 | } | 1419 | } |
| 1436 | CODING_UTF_8_BOM (coding) = utf_without_bom; | 1420 | CODING_UTF_8_BOM (coding) = utf_without_bom; |
| 1437 | 1421 | ||
| 1438 | |||
| 1439 | |||
| 1440 | while (1) | 1422 | while (1) |
| 1441 | { | 1423 | { |
| 1442 | int c, c1, c2, c3, c4, c5; | 1424 | int c, c1, c2, c3, c4, c5; |
| @@ -1459,7 +1441,7 @@ decode_coding_utf_8 (coding) | |||
| 1459 | { | 1441 | { |
| 1460 | c = - c1; | 1442 | c = - c1; |
| 1461 | } | 1443 | } |
| 1462 | else if (UTF_8_1_OCTET_P(c1)) | 1444 | else if (UTF_8_1_OCTET_P (c1)) |
| 1463 | { | 1445 | { |
| 1464 | if (eol_crlf && c1 == '\r') | 1446 | if (eol_crlf && c1 == '\r') |
| 1465 | ONE_MORE_BYTE (byte_after_cr); | 1447 | ONE_MORE_BYTE (byte_after_cr); |
| @@ -1543,8 +1525,7 @@ decode_coding_utf_8 (coding) | |||
| 1543 | 1525 | ||
| 1544 | 1526 | ||
| 1545 | static int | 1527 | static int |
| 1546 | encode_coding_utf_8 (coding) | 1528 | encode_coding_utf_8 (struct coding_system *coding) |
| 1547 | struct coding_system *coding; | ||
| 1548 | { | 1529 | { |
| 1549 | int multibytep = coding->dst_multibyte; | 1530 | int multibytep = coding->dst_multibyte; |
| 1550 | int *charbuf = coding->charbuf; | 1531 | int *charbuf = coding->charbuf; |
| @@ -1623,9 +1604,8 @@ encode_coding_utf_8 (coding) | |||
| 1623 | 1604 | ||
| 1624 | 1605 | ||
| 1625 | static int | 1606 | static int |
| 1626 | detect_coding_utf_16 (coding, detect_info) | 1607 | detect_coding_utf_16 (struct coding_system *coding, |
| 1627 | struct coding_system *coding; | 1608 | struct coding_detection_info *detect_info) |
| 1628 | struct coding_detection_info *detect_info; | ||
| 1629 | { | 1609 | { |
| 1630 | const unsigned char *src = coding->source, *src_base = src; | 1610 | const unsigned char *src = coding->source, *src_base = src; |
| 1631 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1611 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -1708,8 +1688,7 @@ detect_coding_utf_16 (coding, detect_info) | |||
| 1708 | } | 1688 | } |
| 1709 | 1689 | ||
| 1710 | static void | 1690 | static void |
| 1711 | decode_coding_utf_16 (coding) | 1691 | decode_coding_utf_16 (struct coding_system *coding) |
| 1712 | struct coding_system *coding; | ||
| 1713 | { | 1692 | { |
| 1714 | const unsigned char *src = coding->source + coding->consumed; | 1693 | const unsigned char *src = coding->source + coding->consumed; |
| 1715 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1694 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -1837,8 +1816,7 @@ decode_coding_utf_16 (coding) | |||
| 1837 | } | 1816 | } |
| 1838 | 1817 | ||
| 1839 | static int | 1818 | static int |
| 1840 | encode_coding_utf_16 (coding) | 1819 | encode_coding_utf_16 (struct coding_system *coding) |
| 1841 | struct coding_system *coding; | ||
| 1842 | { | 1820 | { |
| 1843 | int multibytep = coding->dst_multibyte; | 1821 | int multibytep = coding->dst_multibyte; |
| 1844 | int *charbuf = coding->charbuf; | 1822 | int *charbuf = coding->charbuf; |
| @@ -1979,9 +1957,8 @@ char emacs_mule_bytes[256]; | |||
| 1979 | else return 0. */ | 1957 | else return 0. */ |
| 1980 | 1958 | ||
| 1981 | static int | 1959 | static int |
| 1982 | detect_coding_emacs_mule (coding, detect_info) | 1960 | detect_coding_emacs_mule (struct coding_system *coding, |
| 1983 | struct coding_system *coding; | 1961 | struct coding_detection_info *detect_info) |
| 1984 | struct coding_detection_info *detect_info; | ||
| 1985 | { | 1962 | { |
| 1986 | const unsigned char *src = coding->source, *src_base; | 1963 | const unsigned char *src = coding->source, *src_base; |
| 1987 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1964 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -2069,11 +2046,9 @@ detect_coding_emacs_mule (coding, detect_info) | |||
| 2069 | -1. If SRC is too short, return -2. */ | 2046 | -1. If SRC is too short, return -2. */ |
| 2070 | 2047 | ||
| 2071 | int | 2048 | int |
| 2072 | emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) | 2049 | emacs_mule_char (struct coding_system *coding, const unsigned char *src, |
| 2073 | struct coding_system *coding; | 2050 | int *nbytes, int *nchars, int *id, |
| 2074 | const unsigned char *src; | 2051 | struct composition_status *cmp_status) |
| 2075 | int *nbytes, *nchars, *id; | ||
| 2076 | struct composition_status *cmp_status; | ||
| 2077 | { | 2052 | { |
| 2078 | const unsigned char *src_end = coding->source + coding->src_bytes; | 2053 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 2079 | const unsigned char *src_base = src; | 2054 | const unsigned char *src_base = src; |
| @@ -2210,7 +2185,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) | |||
| 2210 | (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ... | 2185 | (3) alt&rule composition: 0x80 0xF5 BYTES CHARS | ALT RULE ... ALT CHAR ... |
| 2211 | 2186 | ||
| 2212 | and these old form: | 2187 | and these old form: |
| 2213 | 2188 | ||
| 2214 | (4) relative composition: 0x80 | MSEQ ... MSEQ | 2189 | (4) relative composition: 0x80 | MSEQ ... MSEQ |
| 2215 | (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ | 2190 | (5) rulebase composition: 0x80 0xFF | MSEQ MRULE ... MSEQ |
| 2216 | 2191 | ||
| @@ -2391,9 +2366,8 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) | |||
| 2391 | 2366 | ||
| 2392 | 2367 | ||
| 2393 | static int | 2368 | static int |
| 2394 | emacs_mule_finish_composition (charbuf, cmp_status) | 2369 | emacs_mule_finish_composition (int *charbuf, |
| 2395 | int *charbuf; | 2370 | struct composition_status *cmp_status) |
| 2396 | struct composition_status *cmp_status; | ||
| 2397 | { | 2371 | { |
| 2398 | int idx = - cmp_status->length; | 2372 | int idx = - cmp_status->length; |
| 2399 | int new_chars; | 2373 | int new_chars; |
| @@ -2448,8 +2422,7 @@ emacs_mule_finish_composition (charbuf, cmp_status) | |||
| 2448 | 2422 | ||
| 2449 | 2423 | ||
| 2450 | static void | 2424 | static void |
| 2451 | decode_coding_emacs_mule (coding) | 2425 | decode_coding_emacs_mule (struct coding_system *coding) |
| 2452 | struct coding_system *coding; | ||
| 2453 | { | 2426 | { |
| 2454 | const unsigned char *src = coding->source + coding->consumed; | 2427 | const unsigned char *src = coding->source + coding->consumed; |
| 2455 | const unsigned char *src_end = coding->source + coding->src_bytes; | 2428 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -2713,8 +2686,7 @@ decode_coding_emacs_mule (coding) | |||
| 2713 | 2686 | ||
| 2714 | 2687 | ||
| 2715 | static int | 2688 | static int |
| 2716 | encode_coding_emacs_mule (coding) | 2689 | encode_coding_emacs_mule (struct coding_system *coding) |
| 2717 | struct coding_system *coding; | ||
| 2718 | { | 2690 | { |
| 2719 | int multibytep = coding->dst_multibyte; | 2691 | int multibytep = coding->dst_multibyte; |
| 2720 | int *charbuf = coding->charbuf; | 2692 | int *charbuf = coding->charbuf; |
| @@ -3007,8 +2979,7 @@ enum iso_code_class_type iso_code_class[256]; | |||
| 3007 | (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) | 2979 | (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0) |
| 3008 | 2980 | ||
| 3009 | static void | 2981 | static void |
| 3010 | setup_iso_safe_charsets (attrs) | 2982 | setup_iso_safe_charsets (Lisp_Object attrs) |
| 3011 | Lisp_Object attrs; | ||
| 3012 | { | 2983 | { |
| 3013 | Lisp_Object charset_list, safe_charsets; | 2984 | Lisp_Object charset_list, safe_charsets; |
| 3014 | Lisp_Object request; | 2985 | Lisp_Object request; |
| @@ -3076,9 +3047,8 @@ setup_iso_safe_charsets (attrs) | |||
| 3076 | If it is, return 1, else return 0. */ | 3047 | If it is, return 1, else return 0. */ |
| 3077 | 3048 | ||
| 3078 | static int | 3049 | static int |
| 3079 | detect_coding_iso_2022 (coding, detect_info) | 3050 | detect_coding_iso_2022 (struct coding_system *coding, |
| 3080 | struct coding_system *coding; | 3051 | struct coding_detection_info *detect_info) |
| 3081 | struct coding_detection_info *detect_info; | ||
| 3082 | { | 3052 | { |
| 3083 | const unsigned char *src = coding->source, *src_base = src; | 3053 | const unsigned char *src = coding->source, *src_base = src; |
| 3084 | const unsigned char *src_end = coding->source + coding->src_bytes; | 3054 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -3442,12 +3412,10 @@ detect_coding_iso_2022 (coding, detect_info) | |||
| 3442 | 3412 | ||
| 3443 | /* Finish the current composition as invalid. */ | 3413 | /* Finish the current composition as invalid. */ |
| 3444 | 3414 | ||
| 3445 | static int finish_composition P_ ((int *, struct composition_status *)); | 3415 | static int finish_composition (int *, struct composition_status *); |
| 3446 | 3416 | ||
| 3447 | static int | 3417 | static int |
| 3448 | finish_composition (charbuf, cmp_status) | 3418 | finish_composition (int *charbuf, struct composition_status *cmp_status) |
| 3449 | int *charbuf; | ||
| 3450 | struct composition_status *cmp_status; | ||
| 3451 | { | 3419 | { |
| 3452 | int idx = - cmp_status->length; | 3420 | int idx = - cmp_status->length; |
| 3453 | int new_chars; | 3421 | int new_chars; |
| @@ -3584,8 +3552,7 @@ finish_composition (charbuf, cmp_status) | |||
| 3584 | /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ | 3552 | /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ |
| 3585 | 3553 | ||
| 3586 | static void | 3554 | static void |
| 3587 | decode_coding_iso_2022 (coding) | 3555 | decode_coding_iso_2022 (struct coding_system *coding) |
| 3588 | struct coding_system *coding; | ||
| 3589 | { | 3556 | { |
| 3590 | const unsigned char *src = coding->source + coding->consumed; | 3557 | const unsigned char *src = coding->source + coding->consumed; |
| 3591 | const unsigned char *src_end = coding->source + coding->src_bytes; | 3558 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -3935,7 +3902,7 @@ decode_coding_iso_2022 (coding) | |||
| 3935 | int size; | 3902 | int size; |
| 3936 | 3903 | ||
| 3937 | ONE_MORE_BYTE (dim); | 3904 | ONE_MORE_BYTE (dim); |
| 3938 | if (dim < 0 || dim > 4) | 3905 | if (dim < '0' || dim > '4') |
| 3939 | goto invalid_code; | 3906 | goto invalid_code; |
| 3940 | ONE_MORE_BYTE (M); | 3907 | ONE_MORE_BYTE (M); |
| 3941 | if (M < 128) | 3908 | if (M < 128) |
| @@ -4130,8 +4097,8 @@ decode_coding_iso_2022 (coding) | |||
| 4130 | #define ENCODE_DESIGNATION(charset, reg, coding) \ | 4097 | #define ENCODE_DESIGNATION(charset, reg, coding) \ |
| 4131 | do { \ | 4098 | do { \ |
| 4132 | unsigned char final_char = CHARSET_ISO_FINAL (charset); \ | 4099 | unsigned char final_char = CHARSET_ISO_FINAL (charset); \ |
| 4133 | char *intermediate_char_94 = "()*+"; \ | 4100 | const char *intermediate_char_94 = "()*+"; \ |
| 4134 | char *intermediate_char_96 = ",-./"; \ | 4101 | const char *intermediate_char_96 = ",-./"; \ |
| 4135 | int revision = -1; \ | 4102 | int revision = -1; \ |
| 4136 | int c; \ | 4103 | int c; \ |
| 4137 | \ | 4104 | \ |
| @@ -4317,7 +4284,7 @@ decode_coding_iso_2022 (coding) | |||
| 4317 | 4284 | ||
| 4318 | #define ENCODE_ISO_CHARACTER(charset, c) \ | 4285 | #define ENCODE_ISO_CHARACTER(charset, c) \ |
| 4319 | do { \ | 4286 | do { \ |
| 4320 | int code = ENCODE_CHAR ((charset),(c)); \ | 4287 | int code = ENCODE_CHAR ((charset), (c)); \ |
| 4321 | \ | 4288 | \ |
| 4322 | if (CHARSET_DIMENSION (charset) == 1) \ | 4289 | if (CHARSET_DIMENSION (charset) == 1) \ |
| 4323 | ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \ | 4290 | ENCODE_ISO_CHARACTER_DIMENSION1 ((charset), code); \ |
| @@ -4331,11 +4298,9 @@ decode_coding_iso_2022 (coding) | |||
| 4331 | Return new DST. */ | 4298 | Return new DST. */ |
| 4332 | 4299 | ||
| 4333 | unsigned char * | 4300 | unsigned char * |
| 4334 | encode_invocation_designation (charset, coding, dst, p_nchars) | 4301 | encode_invocation_designation (struct charset *charset, |
| 4335 | struct charset *charset; | 4302 | struct coding_system *coding, |
| 4336 | struct coding_system *coding; | 4303 | unsigned char *dst, int *p_nchars) |
| 4337 | unsigned char *dst; | ||
| 4338 | int *p_nchars; | ||
| 4339 | { | 4304 | { |
| 4340 | int multibytep = coding->dst_multibyte; | 4305 | int multibytep = coding->dst_multibyte; |
| 4341 | int produced_chars = *p_nchars; | 4306 | int produced_chars = *p_nchars; |
| @@ -4447,10 +4412,8 @@ encode_invocation_designation (charset, coding, dst, p_nchars) | |||
| 4447 | find all the necessary designations. */ | 4412 | find all the necessary designations. */ |
| 4448 | 4413 | ||
| 4449 | static unsigned char * | 4414 | static unsigned char * |
| 4450 | encode_designation_at_bol (coding, charbuf, charbuf_end, dst) | 4415 | encode_designation_at_bol (struct coding_system *coding, int *charbuf, |
| 4451 | struct coding_system *coding; | 4416 | int *charbuf_end, unsigned char *dst) |
| 4452 | int *charbuf, *charbuf_end; | ||
| 4453 | unsigned char *dst; | ||
| 4454 | { | 4417 | { |
| 4455 | struct charset *charset; | 4418 | struct charset *charset; |
| 4456 | /* Table of charsets to be designated to each graphic register. */ | 4419 | /* Table of charsets to be designated to each graphic register. */ |
| @@ -4500,8 +4463,7 @@ encode_designation_at_bol (coding, charbuf, charbuf_end, dst) | |||
| 4500 | /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ | 4463 | /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ |
| 4501 | 4464 | ||
| 4502 | static int | 4465 | static int |
| 4503 | encode_coding_iso_2022 (coding) | 4466 | encode_coding_iso_2022 (struct coding_system *coding) |
| 4504 | struct coding_system *coding; | ||
| 4505 | { | 4467 | { |
| 4506 | int multibytep = coding->dst_multibyte; | 4468 | int multibytep = coding->dst_multibyte; |
| 4507 | int *charbuf = coding->charbuf; | 4469 | int *charbuf = coding->charbuf; |
| @@ -4691,9 +4653,8 @@ encode_coding_iso_2022 (coding) | |||
| 4691 | CATEGORY_MASK_SJIS, else return 0. */ | 4653 | CATEGORY_MASK_SJIS, else return 0. */ |
| 4692 | 4654 | ||
| 4693 | static int | 4655 | static int |
| 4694 | detect_coding_sjis (coding, detect_info) | 4656 | detect_coding_sjis (struct coding_system *coding, |
| 4695 | struct coding_system *coding; | 4657 | struct coding_detection_info *detect_info) |
| 4696 | struct coding_detection_info *detect_info; | ||
| 4697 | { | 4658 | { |
| 4698 | const unsigned char *src = coding->source, *src_base; | 4659 | const unsigned char *src = coding->source, *src_base; |
| 4699 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4660 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -4749,9 +4710,8 @@ detect_coding_sjis (coding, detect_info) | |||
| 4749 | CATEGORY_MASK_BIG5, else return 0. */ | 4710 | CATEGORY_MASK_BIG5, else return 0. */ |
| 4750 | 4711 | ||
| 4751 | static int | 4712 | static int |
| 4752 | detect_coding_big5 (coding, detect_info) | 4713 | detect_coding_big5 (struct coding_system *coding, |
| 4753 | struct coding_system *coding; | 4714 | struct coding_detection_info *detect_info) |
| 4754 | struct coding_detection_info *detect_info; | ||
| 4755 | { | 4715 | { |
| 4756 | const unsigned char *src = coding->source, *src_base; | 4716 | const unsigned char *src = coding->source, *src_base; |
| 4757 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4717 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -4797,8 +4757,7 @@ detect_coding_big5 (coding, detect_info) | |||
| 4797 | If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */ | 4757 | If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */ |
| 4798 | 4758 | ||
| 4799 | static void | 4759 | static void |
| 4800 | decode_coding_sjis (coding) | 4760 | decode_coding_sjis (struct coding_system *coding) |
| 4801 | struct coding_system *coding; | ||
| 4802 | { | 4761 | { |
| 4803 | const unsigned char *src = coding->source + coding->consumed; | 4762 | const unsigned char *src = coding->source + coding->consumed; |
| 4804 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4763 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -4916,8 +4875,7 @@ decode_coding_sjis (coding) | |||
| 4916 | } | 4875 | } |
| 4917 | 4876 | ||
| 4918 | static void | 4877 | static void |
| 4919 | decode_coding_big5 (coding) | 4878 | decode_coding_big5 (struct coding_system *coding) |
| 4920 | struct coding_system *coding; | ||
| 4921 | { | 4879 | { |
| 4922 | const unsigned char *src = coding->source + coding->consumed; | 4880 | const unsigned char *src = coding->source + coding->consumed; |
| 4923 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4881 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -5021,8 +4979,7 @@ decode_coding_big5 (coding) | |||
| 5021 | SJIS text, else encode BIG5 text. */ | 4979 | SJIS text, else encode BIG5 text. */ |
| 5022 | 4980 | ||
| 5023 | static int | 4981 | static int |
| 5024 | encode_coding_sjis (coding) | 4982 | encode_coding_sjis (struct coding_system *coding) |
| 5025 | struct coding_system *coding; | ||
| 5026 | { | 4983 | { |
| 5027 | int multibytep = coding->dst_multibyte; | 4984 | int multibytep = coding->dst_multibyte; |
| 5028 | int *charbuf = coding->charbuf; | 4985 | int *charbuf = coding->charbuf; |
| @@ -5114,8 +5071,7 @@ encode_coding_sjis (coding) | |||
| 5114 | } | 5071 | } |
| 5115 | 5072 | ||
| 5116 | static int | 5073 | static int |
| 5117 | encode_coding_big5 (coding) | 5074 | encode_coding_big5 (struct coding_system *coding) |
| 5118 | struct coding_system *coding; | ||
| 5119 | { | 5075 | { |
| 5120 | int multibytep = coding->dst_multibyte; | 5076 | int multibytep = coding->dst_multibyte; |
| 5121 | int *charbuf = coding->charbuf; | 5077 | int *charbuf = coding->charbuf; |
| @@ -5193,9 +5149,8 @@ encode_coding_big5 (coding) | |||
| 5193 | CATEGORY_MASK_CCL, else return 0. */ | 5149 | CATEGORY_MASK_CCL, else return 0. */ |
| 5194 | 5150 | ||
| 5195 | static int | 5151 | static int |
| 5196 | detect_coding_ccl (coding, detect_info) | 5152 | detect_coding_ccl (struct coding_system *coding, |
| 5197 | struct coding_system *coding; | 5153 | struct coding_detection_info *detect_info) |
| 5198 | struct coding_detection_info *detect_info; | ||
| 5199 | { | 5154 | { |
| 5200 | const unsigned char *src = coding->source, *src_base; | 5155 | const unsigned char *src = coding->source, *src_base; |
| 5201 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5156 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -5234,8 +5189,7 @@ detect_coding_ccl (coding, detect_info) | |||
| 5234 | } | 5189 | } |
| 5235 | 5190 | ||
| 5236 | static void | 5191 | static void |
| 5237 | decode_coding_ccl (coding) | 5192 | decode_coding_ccl (struct coding_system *coding) |
| 5238 | struct coding_system *coding; | ||
| 5239 | { | 5193 | { |
| 5240 | const unsigned char *src = coding->source + coding->consumed; | 5194 | const unsigned char *src = coding->source + coding->consumed; |
| 5241 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5195 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -5304,8 +5258,7 @@ decode_coding_ccl (coding) | |||
| 5304 | } | 5258 | } |
| 5305 | 5259 | ||
| 5306 | static int | 5260 | static int |
| 5307 | encode_coding_ccl (coding) | 5261 | encode_coding_ccl (struct coding_system *coding) |
| 5308 | struct coding_system *coding; | ||
| 5309 | { | 5262 | { |
| 5310 | struct ccl_program *ccl = &coding->spec.ccl->ccl; | 5263 | struct ccl_program *ccl = &coding->spec.ccl->ccl; |
| 5311 | int multibytep = coding->dst_multibyte; | 5264 | int multibytep = coding->dst_multibyte; |
| @@ -5374,8 +5327,7 @@ encode_coding_ccl (coding) | |||
| 5374 | /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ | 5327 | /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ |
| 5375 | 5328 | ||
| 5376 | static void | 5329 | static void |
| 5377 | decode_coding_raw_text (coding) | 5330 | decode_coding_raw_text (struct coding_system *coding) |
| 5378 | struct coding_system *coding; | ||
| 5379 | { | 5331 | { |
| 5380 | int eol_crlf = | 5332 | int eol_crlf = |
| 5381 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 5333 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -5394,8 +5346,7 @@ decode_coding_raw_text (coding) | |||
| 5394 | } | 5346 | } |
| 5395 | 5347 | ||
| 5396 | static int | 5348 | static int |
| 5397 | encode_coding_raw_text (coding) | 5349 | encode_coding_raw_text (struct coding_system *coding) |
| 5398 | struct coding_system *coding; | ||
| 5399 | { | 5350 | { |
| 5400 | int multibytep = coding->dst_multibyte; | 5351 | int multibytep = coding->dst_multibyte; |
| 5401 | int *charbuf = coding->charbuf; | 5352 | int *charbuf = coding->charbuf; |
| @@ -5478,9 +5429,8 @@ encode_coding_raw_text (coding) | |||
| 5478 | is, return 1, else return 0. */ | 5429 | is, return 1, else return 0. */ |
| 5479 | 5430 | ||
| 5480 | static int | 5431 | static int |
| 5481 | detect_coding_charset (coding, detect_info) | 5432 | detect_coding_charset (struct coding_system *coding, |
| 5482 | struct coding_system *coding; | 5433 | struct coding_detection_info *detect_info) |
| 5483 | struct coding_detection_info *detect_info; | ||
| 5484 | { | 5434 | { |
| 5485 | const unsigned char *src = coding->source, *src_base; | 5435 | const unsigned char *src = coding->source, *src_base; |
| 5486 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5436 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -5582,8 +5532,7 @@ detect_coding_charset (coding, detect_info) | |||
| 5582 | } | 5532 | } |
| 5583 | 5533 | ||
| 5584 | static void | 5534 | static void |
| 5585 | decode_coding_charset (coding) | 5535 | decode_coding_charset (struct coding_system *coding) |
| 5586 | struct coding_system *coding; | ||
| 5587 | { | 5536 | { |
| 5588 | const unsigned char *src = coding->source + coding->consumed; | 5537 | const unsigned char *src = coding->source + coding->consumed; |
| 5589 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5538 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| @@ -5711,8 +5660,7 @@ decode_coding_charset (coding) | |||
| 5711 | } | 5660 | } |
| 5712 | 5661 | ||
| 5713 | static int | 5662 | static int |
| 5714 | encode_coding_charset (coding) | 5663 | encode_coding_charset (struct coding_system *coding) |
| 5715 | struct coding_system *coding; | ||
| 5716 | { | 5664 | { |
| 5717 | int multibytep = coding->dst_multibyte; | 5665 | int multibytep = coding->dst_multibyte; |
| 5718 | int *charbuf = coding->charbuf; | 5666 | int *charbuf = coding->charbuf; |
| @@ -5782,9 +5730,7 @@ encode_coding_charset (coding) | |||
| 5782 | CODING_SYSTEM is invalid, signal an error. */ | 5730 | CODING_SYSTEM is invalid, signal an error. */ |
| 5783 | 5731 | ||
| 5784 | void | 5732 | void |
| 5785 | setup_coding_system (coding_system, coding) | 5733 | setup_coding_system (Lisp_Object coding_system, struct coding_system *coding) |
| 5786 | Lisp_Object coding_system; | ||
| 5787 | struct coding_system *coding; | ||
| 5788 | { | 5734 | { |
| 5789 | Lisp_Object attrs; | 5735 | Lisp_Object attrs; |
| 5790 | Lisp_Object eol_type; | 5736 | Lisp_Object eol_type; |
| @@ -5987,8 +5933,7 @@ setup_coding_system (coding_system, coding) | |||
| 5987 | /* Return a list of charsets supported by CODING. */ | 5933 | /* Return a list of charsets supported by CODING. */ |
| 5988 | 5934 | ||
| 5989 | Lisp_Object | 5935 | Lisp_Object |
| 5990 | coding_charset_list (coding) | 5936 | coding_charset_list (struct coding_system *coding) |
| 5991 | struct coding_system *coding; | ||
| 5992 | { | 5937 | { |
| 5993 | Lisp_Object attrs, charset_list; | 5938 | Lisp_Object attrs, charset_list; |
| 5994 | 5939 | ||
| @@ -6011,8 +5956,7 @@ coding_charset_list (coding) | |||
| 6011 | /* Return a list of charsets supported by CODING-SYSTEM. */ | 5956 | /* Return a list of charsets supported by CODING-SYSTEM. */ |
| 6012 | 5957 | ||
| 6013 | Lisp_Object | 5958 | Lisp_Object |
| 6014 | coding_system_charset_list (coding_system) | 5959 | coding_system_charset_list (Lisp_Object coding_system) |
| 6015 | Lisp_Object coding_system; | ||
| 6016 | { | 5960 | { |
| 6017 | int id; | 5961 | int id; |
| 6018 | Lisp_Object attrs, charset_list; | 5962 | Lisp_Object attrs, charset_list; |
| @@ -6045,8 +5989,7 @@ coding_system_charset_list (coding_system) | |||
| 6045 | eol_type as CODING-SYSTEM. */ | 5989 | eol_type as CODING-SYSTEM. */ |
| 6046 | 5990 | ||
| 6047 | Lisp_Object | 5991 | Lisp_Object |
| 6048 | raw_text_coding_system (coding_system) | 5992 | raw_text_coding_system (Lisp_Object coding_system) |
| 6049 | Lisp_Object coding_system; | ||
| 6050 | { | 5993 | { |
| 6051 | Lisp_Object spec, attrs; | 5994 | Lisp_Object spec, attrs; |
| 6052 | Lisp_Object eol_type, raw_text_eol_type; | 5995 | Lisp_Object eol_type, raw_text_eol_type; |
| @@ -6077,8 +6020,7 @@ raw_text_coding_system (coding_system) | |||
| 6077 | (system_eol_type). */ | 6020 | (system_eol_type). */ |
| 6078 | 6021 | ||
| 6079 | Lisp_Object | 6022 | Lisp_Object |
| 6080 | coding_inherit_eol_type (coding_system, parent) | 6023 | coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) |
| 6081 | Lisp_Object coding_system, parent; | ||
| 6082 | { | 6024 | { |
| 6083 | Lisp_Object spec, eol_type; | 6025 | Lisp_Object spec, eol_type; |
| 6084 | 6026 | ||
| @@ -6233,10 +6175,8 @@ coding_inherit_eol_type (coding_system, parent) | |||
| 6233 | #define MAX_EOL_CHECK_COUNT 3 | 6175 | #define MAX_EOL_CHECK_COUNT 3 |
| 6234 | 6176 | ||
| 6235 | static int | 6177 | static int |
| 6236 | detect_eol (source, src_bytes, category) | 6178 | detect_eol (const unsigned char *source, EMACS_INT src_bytes, |
| 6237 | const unsigned char *source; | 6179 | enum coding_category category) |
| 6238 | EMACS_INT src_bytes; | ||
| 6239 | enum coding_category category; | ||
| 6240 | { | 6180 | { |
| 6241 | const unsigned char *src = source, *src_end = src + src_bytes; | 6181 | const unsigned char *src = source, *src_end = src + src_bytes; |
| 6242 | unsigned char c; | 6182 | unsigned char c; |
| @@ -6334,9 +6274,7 @@ detect_eol (source, src_bytes, category) | |||
| 6334 | 6274 | ||
| 6335 | 6275 | ||
| 6336 | static Lisp_Object | 6276 | static Lisp_Object |
| 6337 | adjust_coding_eol_type (coding, eol_seen) | 6277 | adjust_coding_eol_type (struct coding_system *coding, int eol_seen) |
| 6338 | struct coding_system *coding; | ||
| 6339 | int eol_seen; | ||
| 6340 | { | 6278 | { |
| 6341 | Lisp_Object eol_type; | 6279 | Lisp_Object eol_type; |
| 6342 | 6280 | ||
| @@ -6364,8 +6302,7 @@ adjust_coding_eol_type (coding, eol_seen) | |||
| 6364 | system. */ | 6302 | system. */ |
| 6365 | 6303 | ||
| 6366 | void | 6304 | void |
| 6367 | detect_coding (coding) | 6305 | detect_coding (struct coding_system *coding) |
| 6368 | struct coding_system *coding; | ||
| 6369 | { | 6306 | { |
| 6370 | const unsigned char *src, *src_end; | 6307 | const unsigned char *src, *src_end; |
| 6371 | int saved_mode = coding->mode; | 6308 | int saved_mode = coding->mode; |
| @@ -6544,8 +6481,7 @@ detect_coding (coding) | |||
| 6544 | 6481 | ||
| 6545 | 6482 | ||
| 6546 | static void | 6483 | static void |
| 6547 | decode_eol (coding) | 6484 | decode_eol (struct coding_system *coding) |
| 6548 | struct coding_system *coding; | ||
| 6549 | { | 6485 | { |
| 6550 | Lisp_Object eol_type; | 6486 | Lisp_Object eol_type; |
| 6551 | unsigned char *p, *pbeg, *pend; | 6487 | unsigned char *p, *pbeg, *pend; |
| @@ -6610,7 +6546,7 @@ decode_eol (coding) | |||
| 6610 | for (p = pend - 2; p >= pbeg; p--) | 6546 | for (p = pend - 2; p >= pbeg; p--) |
| 6611 | if (*p == '\r') | 6547 | if (*p == '\r') |
| 6612 | { | 6548 | { |
| 6613 | safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1); | 6549 | memmove (p, p + 1, pend-- - p - 1); |
| 6614 | n++; | 6550 | n++; |
| 6615 | } | 6551 | } |
| 6616 | } | 6552 | } |
| @@ -6647,9 +6583,7 @@ decode_eol (coding) | |||
| 6647 | decoding (ENCODEP is zero). */ | 6583 | decoding (ENCODEP is zero). */ |
| 6648 | 6584 | ||
| 6649 | static Lisp_Object | 6585 | static Lisp_Object |
| 6650 | get_translation_table (attrs, encodep, max_lookup) | 6586 | get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup) |
| 6651 | Lisp_Object attrs; | ||
| 6652 | int encodep, *max_lookup; | ||
| 6653 | { | 6587 | { |
| 6654 | Lisp_Object standard, translation_table; | 6588 | Lisp_Object standard, translation_table; |
| 6655 | Lisp_Object val; | 6589 | Lisp_Object val; |
| @@ -6751,9 +6685,7 @@ get_translation_table (attrs, encodep, max_lookup) | |||
| 6751 | If BUF is too short to lookup characters in FROM, return Qt. */ | 6685 | If BUF is too short to lookup characters in FROM, return Qt. */ |
| 6752 | 6686 | ||
| 6753 | static Lisp_Object | 6687 | static Lisp_Object |
| 6754 | get_translation (trans, buf, buf_end) | 6688 | get_translation (Lisp_Object trans, int *buf, int *buf_end) |
| 6755 | Lisp_Object trans; | ||
| 6756 | int *buf, *buf_end; | ||
| 6757 | { | 6689 | { |
| 6758 | 6690 | ||
| 6759 | if (INTEGERP (trans)) | 6691 | if (INTEGERP (trans)) |
| @@ -6780,10 +6712,8 @@ get_translation (trans, buf, buf_end) | |||
| 6780 | 6712 | ||
| 6781 | 6713 | ||
| 6782 | static int | 6714 | static int |
| 6783 | produce_chars (coding, translation_table, last_block) | 6715 | produce_chars (struct coding_system *coding, Lisp_Object translation_table, |
| 6784 | struct coding_system *coding; | 6716 | int last_block) |
| 6785 | Lisp_Object translation_table; | ||
| 6786 | int last_block; | ||
| 6787 | { | 6717 | { |
| 6788 | unsigned char *dst = coding->destination + coding->produced; | 6718 | unsigned char *dst = coding->destination + coding->produced; |
| 6789 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 6719 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| @@ -6981,10 +6911,7 @@ produce_chars (coding, translation_table, last_block) | |||
| 6981 | */ | 6911 | */ |
| 6982 | 6912 | ||
| 6983 | static INLINE void | 6913 | static INLINE void |
| 6984 | produce_composition (coding, charbuf, pos) | 6914 | produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos) |
| 6985 | struct coding_system *coding; | ||
| 6986 | int *charbuf; | ||
| 6987 | EMACS_INT pos; | ||
| 6988 | { | 6915 | { |
| 6989 | int len; | 6916 | int len; |
| 6990 | EMACS_INT to; | 6917 | EMACS_INT to; |
| @@ -7028,10 +6955,7 @@ produce_composition (coding, charbuf, pos) | |||
| 7028 | */ | 6955 | */ |
| 7029 | 6956 | ||
| 7030 | static INLINE void | 6957 | static INLINE void |
| 7031 | produce_charset (coding, charbuf, pos) | 6958 | produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos) |
| 7032 | struct coding_system *coding; | ||
| 7033 | int *charbuf; | ||
| 7034 | EMACS_INT pos; | ||
| 7035 | { | 6959 | { |
| 7036 | EMACS_INT from = pos - charbuf[2]; | 6960 | EMACS_INT from = pos - charbuf[2]; |
| 7037 | struct charset *charset = CHARSET_FROM_ID (charbuf[3]); | 6961 | struct charset *charset = CHARSET_FROM_ID (charbuf[3]); |
| @@ -7066,9 +6990,7 @@ produce_charset (coding, charbuf, pos) | |||
| 7066 | 6990 | ||
| 7067 | 6991 | ||
| 7068 | static void | 6992 | static void |
| 7069 | produce_annotation (coding, pos) | 6993 | produce_annotation (struct coding_system *coding, EMACS_INT pos) |
| 7070 | struct coding_system *coding; | ||
| 7071 | EMACS_INT pos; | ||
| 7072 | { | 6994 | { |
| 7073 | int *charbuf = coding->charbuf; | 6995 | int *charbuf = coding->charbuf; |
| 7074 | int *charbuf_end = charbuf + coding->charbuf_used; | 6996 | int *charbuf_end = charbuf + coding->charbuf_used; |
| @@ -7123,8 +7045,7 @@ produce_annotation (coding, pos) | |||
| 7123 | */ | 7045 | */ |
| 7124 | 7046 | ||
| 7125 | static int | 7047 | static int |
| 7126 | decode_coding (coding) | 7048 | decode_coding (struct coding_system *coding) |
| 7127 | struct coding_system *coding; | ||
| 7128 | { | 7049 | { |
| 7129 | Lisp_Object attrs; | 7050 | Lisp_Object attrs; |
| 7130 | Lisp_Object undo_list; | 7051 | Lisp_Object undo_list; |
| @@ -7262,11 +7183,9 @@ decode_coding (coding) | |||
| 7262 | return BUF. */ | 7183 | return BUF. */ |
| 7263 | 7184 | ||
| 7264 | static INLINE int * | 7185 | static INLINE int * |
| 7265 | handle_composition_annotation (pos, limit, coding, buf, stop) | 7186 | handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, |
| 7266 | EMACS_INT pos, limit; | 7187 | struct coding_system *coding, int *buf, |
| 7267 | struct coding_system *coding; | 7188 | EMACS_INT *stop) |
| 7268 | int *buf; | ||
| 7269 | EMACS_INT *stop; | ||
| 7270 | { | 7189 | { |
| 7271 | EMACS_INT start, end; | 7190 | EMACS_INT start, end; |
| 7272 | Lisp_Object prop; | 7191 | Lisp_Object prop; |
| @@ -7347,11 +7266,9 @@ handle_composition_annotation (pos, limit, coding, buf, stop) | |||
| 7347 | property value is non-nil (limiting by LIMIT), and return BUF. */ | 7266 | property value is non-nil (limiting by LIMIT), and return BUF. */ |
| 7348 | 7267 | ||
| 7349 | static INLINE int * | 7268 | static INLINE int * |
| 7350 | handle_charset_annotation (pos, limit, coding, buf, stop) | 7269 | handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, |
| 7351 | EMACS_INT pos, limit; | 7270 | struct coding_system *coding, int *buf, |
| 7352 | struct coding_system *coding; | 7271 | EMACS_INT *stop) |
| 7353 | int *buf; | ||
| 7354 | EMACS_INT *stop; | ||
| 7355 | { | 7272 | { |
| 7356 | Lisp_Object val, next; | 7273 | Lisp_Object val, next; |
| 7357 | int id; | 7274 | int id; |
| @@ -7371,10 +7288,8 @@ handle_charset_annotation (pos, limit, coding, buf, stop) | |||
| 7371 | 7288 | ||
| 7372 | 7289 | ||
| 7373 | static void | 7290 | static void |
| 7374 | consume_chars (coding, translation_table, max_lookup) | 7291 | consume_chars (struct coding_system *coding, Lisp_Object translation_table, |
| 7375 | struct coding_system *coding; | 7292 | int max_lookup) |
| 7376 | Lisp_Object translation_table; | ||
| 7377 | int max_lookup; | ||
| 7378 | { | 7293 | { |
| 7379 | int *buf = coding->charbuf; | 7294 | int *buf = coding->charbuf; |
| 7380 | int *buf_end = coding->charbuf + coding->charbuf_size; | 7295 | int *buf_end = coding->charbuf + coding->charbuf_size; |
| @@ -7530,8 +7445,7 @@ consume_chars (coding, translation_table, max_lookup) | |||
| 7530 | memory area specified by CODING->destination. */ | 7445 | memory area specified by CODING->destination. */ |
| 7531 | 7446 | ||
| 7532 | static int | 7447 | static int |
| 7533 | encode_coding (coding) | 7448 | encode_coding (struct coding_system *coding) |
| 7534 | struct coding_system *coding; | ||
| 7535 | { | 7449 | { |
| 7536 | Lisp_Object attrs; | 7450 | Lisp_Object attrs; |
| 7537 | Lisp_Object translation_table; | 7451 | Lisp_Object translation_table; |
| @@ -7595,8 +7509,7 @@ static int reused_workbuf_in_use; | |||
| 7595 | multibyteness of returning buffer. */ | 7509 | multibyteness of returning buffer. */ |
| 7596 | 7510 | ||
| 7597 | static Lisp_Object | 7511 | static Lisp_Object |
| 7598 | make_conversion_work_buffer (multibyte) | 7512 | make_conversion_work_buffer (int multibyte) |
| 7599 | int multibyte; | ||
| 7600 | { | 7513 | { |
| 7601 | Lisp_Object name, workbuf; | 7514 | Lisp_Object name, workbuf; |
| 7602 | struct buffer *current; | 7515 | struct buffer *current; |
| @@ -7628,8 +7541,7 @@ make_conversion_work_buffer (multibyte) | |||
| 7628 | 7541 | ||
| 7629 | 7542 | ||
| 7630 | static Lisp_Object | 7543 | static Lisp_Object |
| 7631 | code_conversion_restore (arg) | 7544 | code_conversion_restore (Lisp_Object arg) |
| 7632 | Lisp_Object arg; | ||
| 7633 | { | 7545 | { |
| 7634 | Lisp_Object current, workbuf; | 7546 | Lisp_Object current, workbuf; |
| 7635 | struct gcpro gcpro1; | 7547 | struct gcpro gcpro1; |
| @@ -7650,8 +7562,7 @@ code_conversion_restore (arg) | |||
| 7650 | } | 7562 | } |
| 7651 | 7563 | ||
| 7652 | Lisp_Object | 7564 | Lisp_Object |
| 7653 | code_conversion_save (with_work_buf, multibyte) | 7565 | code_conversion_save (int with_work_buf, int multibyte) |
| 7654 | int with_work_buf, multibyte; | ||
| 7655 | { | 7566 | { |
| 7656 | Lisp_Object workbuf = Qnil; | 7567 | Lisp_Object workbuf = Qnil; |
| 7657 | 7568 | ||
| @@ -7663,11 +7574,10 @@ code_conversion_save (with_work_buf, multibyte) | |||
| 7663 | } | 7574 | } |
| 7664 | 7575 | ||
| 7665 | int | 7576 | int |
| 7666 | decode_coding_gap (coding, chars, bytes) | 7577 | decode_coding_gap (struct coding_system *coding, |
| 7667 | struct coding_system *coding; | 7578 | EMACS_INT chars, EMACS_INT bytes) |
| 7668 | EMACS_INT chars, bytes; | ||
| 7669 | { | 7579 | { |
| 7670 | int count = specpdl_ptr - specpdl; | 7580 | int count = SPECPDL_INDEX (); |
| 7671 | Lisp_Object attrs; | 7581 | Lisp_Object attrs; |
| 7672 | 7582 | ||
| 7673 | code_conversion_save (0, 0); | 7583 | code_conversion_save (0, 0); |
| @@ -7710,11 +7620,10 @@ decode_coding_gap (coding, chars, bytes) | |||
| 7710 | } | 7620 | } |
| 7711 | 7621 | ||
| 7712 | int | 7622 | int |
| 7713 | encode_coding_gap (coding, chars, bytes) | 7623 | encode_coding_gap (struct coding_system *coding, |
| 7714 | struct coding_system *coding; | 7624 | EMACS_INT chars, EMACS_INT bytes) |
| 7715 | EMACS_INT chars, bytes; | ||
| 7716 | { | 7625 | { |
| 7717 | int count = specpdl_ptr - specpdl; | 7626 | int count = SPECPDL_INDEX (); |
| 7718 | 7627 | ||
| 7719 | code_conversion_save (0, 0); | 7628 | code_conversion_save (0, 0); |
| 7720 | 7629 | ||
| @@ -7765,14 +7674,13 @@ encode_coding_gap (coding, chars, bytes) | |||
| 7765 | */ | 7674 | */ |
| 7766 | 7675 | ||
| 7767 | void | 7676 | void |
| 7768 | decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | 7677 | decode_coding_object (struct coding_system *coding, |
| 7769 | dst_object) | 7678 | Lisp_Object src_object, |
| 7770 | struct coding_system *coding; | 7679 | EMACS_INT from, EMACS_INT from_byte, |
| 7771 | Lisp_Object src_object; | 7680 | EMACS_INT to, EMACS_INT to_byte, |
| 7772 | EMACS_INT from, from_byte, to, to_byte; | 7681 | Lisp_Object dst_object) |
| 7773 | Lisp_Object dst_object; | ||
| 7774 | { | 7682 | { |
| 7775 | int count = specpdl_ptr - specpdl; | 7683 | int count = SPECPDL_INDEX (); |
| 7776 | unsigned char *destination; | 7684 | unsigned char *destination; |
| 7777 | EMACS_INT dst_bytes; | 7685 | EMACS_INT dst_bytes; |
| 7778 | EMACS_INT chars = to - from; | 7686 | EMACS_INT chars = to - from; |
| @@ -7902,7 +7810,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7902 | } | 7810 | } |
| 7903 | if (BEGV < GPT && GPT < BEGV + coding->produced_char) | 7811 | if (BEGV < GPT && GPT < BEGV + coding->produced_char) |
| 7904 | move_gap_both (BEGV, BEGV_BYTE); | 7812 | move_gap_both (BEGV, BEGV_BYTE); |
| 7905 | bcopy (BEGV_ADDR, destination, coding->produced); | 7813 | memcpy (destination, BEGV_ADDR, coding->produced); |
| 7906 | coding->destination = destination; | 7814 | coding->destination = destination; |
| 7907 | } | 7815 | } |
| 7908 | } | 7816 | } |
| @@ -7956,14 +7864,13 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7956 | 7864 | ||
| 7957 | 7865 | ||
| 7958 | void | 7866 | void |
| 7959 | encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | 7867 | encode_coding_object (struct coding_system *coding, |
| 7960 | dst_object) | 7868 | Lisp_Object src_object, |
| 7961 | struct coding_system *coding; | 7869 | EMACS_INT from, EMACS_INT from_byte, |
| 7962 | Lisp_Object src_object; | 7870 | EMACS_INT to, EMACS_INT to_byte, |
| 7963 | EMACS_INT from, from_byte, to, to_byte; | 7871 | Lisp_Object dst_object) |
| 7964 | Lisp_Object dst_object; | ||
| 7965 | { | 7872 | { |
| 7966 | int count = specpdl_ptr - specpdl; | 7873 | int count = SPECPDL_INDEX (); |
| 7967 | EMACS_INT chars = to - from; | 7874 | EMACS_INT chars = to - from; |
| 7968 | EMACS_INT bytes = to_byte - from_byte; | 7875 | EMACS_INT bytes = to_byte - from_byte; |
| 7969 | Lisp_Object attrs; | 7876 | Lisp_Object attrs; |
| @@ -8165,7 +8072,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 8165 | 8072 | ||
| 8166 | 8073 | ||
| 8167 | Lisp_Object | 8074 | Lisp_Object |
| 8168 | preferred_coding_system () | 8075 | preferred_coding_system (void) |
| 8169 | { | 8076 | { |
| 8170 | int id = coding_categories[coding_priorities[0]].id; | 8077 | int id = coding_categories[coding_priorities[0]].id; |
| 8171 | 8078 | ||
| @@ -8180,8 +8087,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. | 8087 | doc: /* Return t if OBJECT is nil or a coding-system. |
| 8181 | See the documentation of `define-coding-system' for information | 8088 | See the documentation of `define-coding-system' for information |
| 8182 | about coding-system objects. */) | 8089 | about coding-system objects. */) |
| 8183 | (object) | 8090 | (Lisp_Object object) |
| 8184 | Lisp_Object object; | ||
| 8185 | { | 8091 | { |
| 8186 | if (NILP (object) | 8092 | if (NILP (object) |
| 8187 | || CODING_SYSTEM_ID (object) >= 0) | 8093 | || CODING_SYSTEM_ID (object) >= 0) |
| @@ -8195,8 +8101,7 @@ about coding-system objects. */) | |||
| 8195 | DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, | 8101 | DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, |
| 8196 | Sread_non_nil_coding_system, 1, 1, 0, | 8102 | Sread_non_nil_coding_system, 1, 1, 0, |
| 8197 | doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) | 8103 | doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) |
| 8198 | (prompt) | 8104 | (Lisp_Object prompt) |
| 8199 | Lisp_Object prompt; | ||
| 8200 | { | 8105 | { |
| 8201 | Lisp_Object val; | 8106 | Lisp_Object val; |
| 8202 | do | 8107 | do |
| @@ -8213,8 +8118,7 @@ DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, | |||
| 8213 | If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. | 8118 | If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. |
| 8214 | Ignores case when completing coding systems (all Emacs coding systems | 8119 | Ignores case when completing coding systems (all Emacs coding systems |
| 8215 | are lower-case). */) | 8120 | are lower-case). */) |
| 8216 | (prompt, default_coding_system) | 8121 | (Lisp_Object prompt, Lisp_Object default_coding_system) |
| 8217 | Lisp_Object prompt, default_coding_system; | ||
| 8218 | { | 8122 | { |
| 8219 | Lisp_Object val; | 8123 | Lisp_Object val; |
| 8220 | int count = SPECPDL_INDEX (); | 8124 | int count = SPECPDL_INDEX (); |
| @@ -8235,8 +8139,7 @@ DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, | |||
| 8235 | If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. | 8139 | If valid, return CODING-SYSTEM, else signal a `coding-system-error' error. |
| 8236 | It is valid if it is nil or a symbol defined as a coding system by the | 8140 | It is valid if it is nil or a symbol defined as a coding system by the |
| 8237 | function `define-coding-system'. */) | 8141 | function `define-coding-system'. */) |
| 8238 | (coding_system) | 8142 | (Lisp_Object coding_system) |
| 8239 | Lisp_Object coding_system; | ||
| 8240 | { | 8143 | { |
| 8241 | Lisp_Object define_form; | 8144 | Lisp_Object define_form; |
| 8242 | 8145 | ||
| @@ -8269,13 +8172,10 @@ function `define-coding-system'. */) | |||
| 8269 | detect only text-format. */ | 8172 | detect only text-format. */ |
| 8270 | 8173 | ||
| 8271 | Lisp_Object | 8174 | Lisp_Object |
| 8272 | detect_coding_system (src, src_chars, src_bytes, highest, multibytep, | 8175 | detect_coding_system (const unsigned char *src, |
| 8273 | coding_system) | 8176 | EMACS_INT src_chars, EMACS_INT src_bytes, |
| 8274 | const unsigned char *src; | 8177 | int highest, int multibytep, |
| 8275 | EMACS_INT src_chars, src_bytes; | 8178 | Lisp_Object coding_system) |
| 8276 | int highest; | ||
| 8277 | int multibytep; | ||
| 8278 | Lisp_Object coding_system; | ||
| 8279 | { | 8179 | { |
| 8280 | const unsigned char *src_end = src + src_bytes; | 8180 | const unsigned char *src_end = src + src_bytes; |
| 8281 | Lisp_Object attrs, eol_type; | 8181 | Lisp_Object attrs, eol_type; |
| @@ -8591,8 +8491,7 @@ format. | |||
| 8591 | 8491 | ||
| 8592 | If optional argument HIGHEST is non-nil, return the coding system of | 8492 | If optional argument HIGHEST is non-nil, return the coding system of |
| 8593 | highest priority. */) | 8493 | highest priority. */) |
| 8594 | (start, end, highest) | 8494 | (Lisp_Object start, Lisp_Object end, Lisp_Object highest) |
| 8595 | Lisp_Object start, end, highest; | ||
| 8596 | { | 8495 | { |
| 8597 | int from, to; | 8496 | int from, to; |
| 8598 | int from_byte, to_byte; | 8497 | int from_byte, to_byte; |
| @@ -8630,8 +8529,7 @@ format. | |||
| 8630 | 8529 | ||
| 8631 | If optional argument HIGHEST is non-nil, return the coding system of | 8530 | If optional argument HIGHEST is non-nil, return the coding system of |
| 8632 | highest priority. */) | 8531 | highest priority. */) |
| 8633 | (string, highest) | 8532 | (Lisp_Object string, Lisp_Object highest) |
| 8634 | Lisp_Object string, highest; | ||
| 8635 | { | 8533 | { |
| 8636 | CHECK_STRING (string); | 8534 | CHECK_STRING (string); |
| 8637 | 8535 | ||
| @@ -8643,9 +8541,7 @@ highest priority. */) | |||
| 8643 | 8541 | ||
| 8644 | 8542 | ||
| 8645 | static INLINE int | 8543 | static INLINE int |
| 8646 | char_encodable_p (c, attrs) | 8544 | char_encodable_p (int c, Lisp_Object attrs) |
| 8647 | int c; | ||
| 8648 | Lisp_Object attrs; | ||
| 8649 | { | 8545 | { |
| 8650 | Lisp_Object tail; | 8546 | Lisp_Object tail; |
| 8651 | struct charset *charset; | 8547 | struct charset *charset; |
| @@ -8675,8 +8571,7 @@ DEFUN ("find-coding-systems-region-internal", | |||
| 8675 | Ffind_coding_systems_region_internal, | 8571 | Ffind_coding_systems_region_internal, |
| 8676 | Sfind_coding_systems_region_internal, 2, 3, 0, | 8572 | Sfind_coding_systems_region_internal, 2, 3, 0, |
| 8677 | doc: /* Internal use only. */) | 8573 | doc: /* Internal use only. */) |
| 8678 | (start, end, exclude) | 8574 | (Lisp_Object start, Lisp_Object end, Lisp_Object exclude) |
| 8679 | Lisp_Object start, end, exclude; | ||
| 8680 | { | 8575 | { |
| 8681 | Lisp_Object coding_attrs_list, safe_codings; | 8576 | Lisp_Object coding_attrs_list, safe_codings; |
| 8682 | EMACS_INT start_byte, end_byte; | 8577 | EMACS_INT start_byte, end_byte; |
| @@ -8809,8 +8704,7 @@ list of positions. | |||
| 8809 | If optional 5th argument STRING is non-nil, it is a string to search | 8704 | If optional 5th argument STRING is non-nil, it is a string to search |
| 8810 | for un-encodable characters. In that case, START and END are indexes | 8705 | for un-encodable characters. In that case, START and END are indexes |
| 8811 | to the string. */) | 8706 | to the string. */) |
| 8812 | (start, end, coding_system, count, string) | 8707 | (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 | { | 8708 | { |
| 8815 | int n; | 8709 | int n; |
| 8816 | struct coding_system coding; | 8710 | struct coding_system coding; |
| @@ -8925,8 +8819,7 @@ buffer positions. END is ignored. | |||
| 8925 | 8819 | ||
| 8926 | If the current buffer (or START if it is a string) is unibyte, the value | 8820 | If the current buffer (or START if it is a string) is unibyte, the value |
| 8927 | is nil. */) | 8821 | is nil. */) |
| 8928 | (start, end, coding_system_list) | 8822 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list) |
| 8929 | Lisp_Object start, end, coding_system_list; | ||
| 8930 | { | 8823 | { |
| 8931 | Lisp_Object list; | 8824 | Lisp_Object list; |
| 8932 | EMACS_INT start_byte, end_byte; | 8825 | EMACS_INT start_byte, end_byte; |
| @@ -9031,9 +8924,9 @@ is nil. */) | |||
| 9031 | 8924 | ||
| 9032 | 8925 | ||
| 9033 | Lisp_Object | 8926 | Lisp_Object |
| 9034 | code_convert_region (start, end, coding_system, dst_object, encodep, norecord) | 8927 | code_convert_region (Lisp_Object start, Lisp_Object end, |
| 9035 | Lisp_Object start, end, coding_system, dst_object; | 8928 | Lisp_Object coding_system, Lisp_Object dst_object, |
| 9036 | int encodep, norecord; | 8929 | int encodep, int norecord) |
| 9037 | { | 8930 | { |
| 9038 | struct coding_system coding; | 8931 | struct coding_system coding; |
| 9039 | EMACS_INT from, from_byte, to, to_byte; | 8932 | EMACS_INT from, from_byte, to, to_byte; |
| @@ -9092,8 +8985,7 @@ If DESTINATION is t, the decoded text is returned. | |||
| 9092 | This function sets `last-coding-system-used' to the precise coding system | 8985 | This function sets `last-coding-system-used' to the precise coding system |
| 9093 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8986 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 9094 | not fully specified.) */) | 8987 | not fully specified.) */) |
| 9095 | (start, end, coding_system, destination) | 8988 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination) |
| 9096 | Lisp_Object start, end, coding_system, destination; | ||
| 9097 | { | 8989 | { |
| 9098 | return code_convert_region (start, end, coding_system, destination, 0, 0); | 8990 | return code_convert_region (start, end, coding_system, destination, 0, 0); |
| 9099 | } | 8991 | } |
| @@ -9115,17 +9007,14 @@ If DESTINATION is t, the encoded text is returned. | |||
| 9115 | This function sets `last-coding-system-used' to the precise coding system | 9007 | This function sets `last-coding-system-used' to the precise coding system |
| 9116 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 9008 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 9117 | not fully specified.) */) | 9009 | not fully specified.) */) |
| 9118 | (start, end, coding_system, destination) | 9010 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object destination) |
| 9119 | Lisp_Object start, end, coding_system, destination; | ||
| 9120 | { | 9011 | { |
| 9121 | return code_convert_region (start, end, coding_system, destination, 1, 0); | 9012 | return code_convert_region (start, end, coding_system, destination, 1, 0); |
| 9122 | } | 9013 | } |
| 9123 | 9014 | ||
| 9124 | Lisp_Object | 9015 | Lisp_Object |
| 9125 | code_convert_string (string, coding_system, dst_object, | 9016 | code_convert_string (Lisp_Object string, Lisp_Object coding_system, |
| 9126 | encodep, nocopy, norecord) | 9017 | Lisp_Object dst_object, int encodep, int nocopy, int norecord) |
| 9127 | Lisp_Object string, coding_system, dst_object; | ||
| 9128 | int encodep, nocopy, norecord; | ||
| 9129 | { | 9018 | { |
| 9130 | struct coding_system coding; | 9019 | struct coding_system coding; |
| 9131 | EMACS_INT chars, bytes; | 9020 | EMACS_INT chars, bytes; |
| @@ -9172,9 +9061,8 @@ code_convert_string (string, coding_system, dst_object, | |||
| 9172 | ENCODE_FILE, thus we ignore character composition. */ | 9061 | ENCODE_FILE, thus we ignore character composition. */ |
| 9173 | 9062 | ||
| 9174 | Lisp_Object | 9063 | Lisp_Object |
| 9175 | code_convert_string_norecord (string, coding_system, encodep) | 9064 | code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system, |
| 9176 | Lisp_Object string, coding_system; | 9065 | int encodep) |
| 9177 | int encodep; | ||
| 9178 | { | 9066 | { |
| 9179 | return code_convert_string (string, coding_system, Qt, encodep, 0, 1); | 9067 | return code_convert_string (string, coding_system, Qt, encodep, 0, 1); |
| 9180 | } | 9068 | } |
| @@ -9194,8 +9082,7 @@ case, the return value is the length of the decoded text. | |||
| 9194 | This function sets `last-coding-system-used' to the precise coding system | 9082 | This function sets `last-coding-system-used' to the precise coding system |
| 9195 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 9083 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 9196 | not fully specified.) */) | 9084 | not fully specified.) */) |
| 9197 | (string, coding_system, nocopy, buffer) | 9085 | (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer) |
| 9198 | Lisp_Object string, coding_system, nocopy, buffer; | ||
| 9199 | { | 9086 | { |
| 9200 | return code_convert_string (string, coding_system, buffer, | 9087 | return code_convert_string (string, coding_system, buffer, |
| 9201 | 0, ! NILP (nocopy), 0); | 9088 | 0, ! NILP (nocopy), 0); |
| @@ -9215,8 +9102,7 @@ case, the return value is the length of the encoded text. | |||
| 9215 | This function sets `last-coding-system-used' to the precise coding system | 9102 | This function sets `last-coding-system-used' to the precise coding system |
| 9216 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 9103 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 9217 | not fully specified.) */) | 9104 | not fully specified.) */) |
| 9218 | (string, coding_system, nocopy, buffer) | 9105 | (Lisp_Object string, Lisp_Object coding_system, Lisp_Object nocopy, Lisp_Object buffer) |
| 9219 | Lisp_Object string, coding_system, nocopy, buffer; | ||
| 9220 | { | 9106 | { |
| 9221 | return code_convert_string (string, coding_system, buffer, | 9107 | return code_convert_string (string, coding_system, buffer, |
| 9222 | 1, ! NILP (nocopy), 1); | 9108 | 1, ! NILP (nocopy), 1); |
| @@ -9226,8 +9112,7 @@ not fully specified.) */) | |||
| 9226 | DEFUN ("decode-sjis-char", Fdecode_sjis_char, Sdecode_sjis_char, 1, 1, 0, | 9112 | DEFUN ("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. | 9113 | doc: /* Decode a Japanese character which has CODE in shift_jis encoding. |
| 9228 | Return the corresponding character. */) | 9114 | Return the corresponding character. */) |
| 9229 | (code) | 9115 | (Lisp_Object code) |
| 9230 | Lisp_Object code; | ||
| 9231 | { | 9116 | { |
| 9232 | Lisp_Object spec, attrs, val; | 9117 | Lisp_Object spec, attrs, val; |
| 9233 | struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; | 9118 | struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; |
| @@ -9274,8 +9159,7 @@ Return the corresponding character. */) | |||
| 9274 | DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0, | 9159 | DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0, |
| 9275 | doc: /* Encode a Japanese character CH to shift_jis encoding. | 9160 | doc: /* Encode a Japanese character CH to shift_jis encoding. |
| 9276 | Return the corresponding code in SJIS. */) | 9161 | Return the corresponding code in SJIS. */) |
| 9277 | (ch) | 9162 | (Lisp_Object ch) |
| 9278 | Lisp_Object ch; | ||
| 9279 | { | 9163 | { |
| 9280 | Lisp_Object spec, attrs, charset_list; | 9164 | Lisp_Object spec, attrs, charset_list; |
| 9281 | int c; | 9165 | int c; |
| @@ -9303,8 +9187,7 @@ Return the corresponding code in SJIS. */) | |||
| 9303 | DEFUN ("decode-big5-char", Fdecode_big5_char, Sdecode_big5_char, 1, 1, 0, | 9187 | DEFUN ("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. | 9188 | doc: /* Decode a Big5 character which has CODE in BIG5 coding system. |
| 9305 | Return the corresponding character. */) | 9189 | Return the corresponding character. */) |
| 9306 | (code) | 9190 | (Lisp_Object code) |
| 9307 | Lisp_Object code; | ||
| 9308 | { | 9191 | { |
| 9309 | Lisp_Object spec, attrs, val; | 9192 | Lisp_Object spec, attrs, val; |
| 9310 | struct charset *charset_roman, *charset_big5, *charset; | 9193 | struct charset *charset_roman, *charset_big5, *charset; |
| @@ -9342,8 +9225,7 @@ Return the corresponding character. */) | |||
| 9342 | DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0, | 9225 | DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0, |
| 9343 | doc: /* Encode the Big5 character CH to BIG5 coding system. | 9226 | doc: /* Encode the Big5 character CH to BIG5 coding system. |
| 9344 | Return the corresponding character code in Big5. */) | 9227 | Return the corresponding character code in Big5. */) |
| 9345 | (ch) | 9228 | (Lisp_Object ch) |
| 9346 | Lisp_Object ch; | ||
| 9347 | { | 9229 | { |
| 9348 | Lisp_Object spec, attrs, charset_list; | 9230 | Lisp_Object spec, attrs, charset_list; |
| 9349 | struct charset *charset; | 9231 | struct charset *charset; |
| @@ -9370,9 +9252,7 @@ Return the corresponding character code in Big5. */) | |||
| 9370 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, | 9252 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, |
| 9371 | Sset_terminal_coding_system_internal, 1, 2, 0, | 9253 | Sset_terminal_coding_system_internal, 1, 2, 0, |
| 9372 | doc: /* Internal use only. */) | 9254 | doc: /* Internal use only. */) |
| 9373 | (coding_system, terminal) | 9255 | (Lisp_Object coding_system, Lisp_Object terminal) |
| 9374 | Lisp_Object coding_system; | ||
| 9375 | Lisp_Object terminal; | ||
| 9376 | { | 9256 | { |
| 9377 | struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); | 9257 | struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); |
| 9378 | CHECK_SYMBOL (coding_system); | 9258 | CHECK_SYMBOL (coding_system); |
| @@ -9390,8 +9270,7 @@ DEFUN ("set-safe-terminal-coding-system-internal", | |||
| 9390 | Fset_safe_terminal_coding_system_internal, | 9270 | Fset_safe_terminal_coding_system_internal, |
| 9391 | Sset_safe_terminal_coding_system_internal, 1, 1, 0, | 9271 | Sset_safe_terminal_coding_system_internal, 1, 1, 0, |
| 9392 | doc: /* Internal use only. */) | 9272 | doc: /* Internal use only. */) |
| 9393 | (coding_system) | 9273 | (Lisp_Object coding_system) |
| 9394 | Lisp_Object coding_system; | ||
| 9395 | { | 9274 | { |
| 9396 | CHECK_SYMBOL (coding_system); | 9275 | CHECK_SYMBOL (coding_system); |
| 9397 | setup_coding_system (Fcheck_coding_system (coding_system), | 9276 | setup_coding_system (Fcheck_coding_system (coding_system), |
| @@ -9408,8 +9287,7 @@ DEFUN ("terminal-coding-system", Fterminal_coding_system, | |||
| 9408 | doc: /* Return coding system specified for terminal output on the given terminal. | 9287 | doc: /* Return coding system specified for terminal output on the given terminal. |
| 9409 | TERMINAL may be a terminal object, a frame, or nil for the selected | 9288 | TERMINAL may be a terminal object, a frame, or nil for the selected |
| 9410 | frame's terminal device. */) | 9289 | frame's terminal device. */) |
| 9411 | (terminal) | 9290 | (Lisp_Object terminal) |
| 9412 | Lisp_Object terminal; | ||
| 9413 | { | 9291 | { |
| 9414 | struct coding_system *terminal_coding | 9292 | struct coding_system *terminal_coding |
| 9415 | = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); | 9293 | = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); |
| @@ -9422,9 +9300,7 @@ frame's terminal device. */) | |||
| 9422 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, | 9300 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, |
| 9423 | Sset_keyboard_coding_system_internal, 1, 2, 0, | 9301 | Sset_keyboard_coding_system_internal, 1, 2, 0, |
| 9424 | doc: /* Internal use only. */) | 9302 | doc: /* Internal use only. */) |
| 9425 | (coding_system, terminal) | 9303 | (Lisp_Object coding_system, Lisp_Object terminal) |
| 9426 | Lisp_Object coding_system; | ||
| 9427 | Lisp_Object terminal; | ||
| 9428 | { | 9304 | { |
| 9429 | struct terminal *t = get_terminal (terminal, 1); | 9305 | struct terminal *t = get_terminal (terminal, 1); |
| 9430 | CHECK_SYMBOL (coding_system); | 9306 | CHECK_SYMBOL (coding_system); |
| @@ -9442,8 +9318,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern | |||
| 9442 | DEFUN ("keyboard-coding-system", | 9318 | DEFUN ("keyboard-coding-system", |
| 9443 | Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0, | 9319 | Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0, |
| 9444 | doc: /* Return coding system specified for decoding keyboard input. */) | 9320 | doc: /* Return coding system specified for decoding keyboard input. */) |
| 9445 | (terminal) | 9321 | (Lisp_Object terminal) |
| 9446 | Lisp_Object terminal; | ||
| 9447 | { | 9322 | { |
| 9448 | return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING | 9323 | return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING |
| 9449 | (get_terminal (terminal, 1))->id); | 9324 | (get_terminal (terminal, 1))->id); |
| @@ -9491,9 +9366,7 @@ function to call for FILENAME, that function should examine the | |||
| 9491 | contents of BUFFER instead of reading the file. | 9366 | contents of BUFFER instead of reading the file. |
| 9492 | 9367 | ||
| 9493 | usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) | 9368 | usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) |
| 9494 | (nargs, args) | 9369 | (int nargs, Lisp_Object *args) |
| 9495 | int nargs; | ||
| 9496 | Lisp_Object *args; | ||
| 9497 | { | 9370 | { |
| 9498 | Lisp_Object operation, target_idx, target, val; | 9371 | Lisp_Object operation, target_idx, target, val; |
| 9499 | register Lisp_Object chain; | 9372 | register Lisp_Object chain; |
| @@ -9569,15 +9442,13 @@ If multiple coding systems belong to the same category, | |||
| 9569 | all but the first one are ignored. | 9442 | all but the first one are ignored. |
| 9570 | 9443 | ||
| 9571 | usage: (set-coding-system-priority &rest coding-systems) */) | 9444 | usage: (set-coding-system-priority &rest coding-systems) */) |
| 9572 | (nargs, args) | 9445 | (int nargs, Lisp_Object *args) |
| 9573 | int nargs; | ||
| 9574 | Lisp_Object *args; | ||
| 9575 | { | 9446 | { |
| 9576 | int i, j; | 9447 | int i, j; |
| 9577 | int changed[coding_category_max]; | 9448 | int changed[coding_category_max]; |
| 9578 | enum coding_category priorities[coding_category_max]; | 9449 | enum coding_category priorities[coding_category_max]; |
| 9579 | 9450 | ||
| 9580 | bzero (changed, sizeof changed); | 9451 | memset (changed, 0, sizeof changed); |
| 9581 | 9452 | ||
| 9582 | for (i = j = 0; i < nargs; i++) | 9453 | for (i = j = 0; i < nargs; i++) |
| 9583 | { | 9454 | { |
| @@ -9612,7 +9483,7 @@ usage: (set-coding-system-priority &rest coding-systems) */) | |||
| 9612 | priorities[i] = coding_priorities[j]; | 9483 | priorities[i] = coding_priorities[j]; |
| 9613 | } | 9484 | } |
| 9614 | 9485 | ||
| 9615 | bcopy (priorities, coding_priorities, sizeof priorities); | 9486 | memcpy (coding_priorities, priorities, sizeof priorities); |
| 9616 | 9487 | ||
| 9617 | /* Update `coding-category-list'. */ | 9488 | /* Update `coding-category-list'. */ |
| 9618 | Vcoding_category_list = Qnil; | 9489 | Vcoding_category_list = Qnil; |
| @@ -9631,8 +9502,7 @@ The list contains a subset of coding systems; i.e. coding systems | |||
| 9631 | assigned to each coding category (see `coding-category-list'). | 9502 | assigned to each coding category (see `coding-category-list'). |
| 9632 | 9503 | ||
| 9633 | HIGHESTP non-nil means just return the highest priority one. */) | 9504 | HIGHESTP non-nil means just return the highest priority one. */) |
| 9634 | (highestp) | 9505 | (Lisp_Object highestp) |
| 9635 | Lisp_Object highestp; | ||
| 9636 | { | 9506 | { |
| 9637 | int i; | 9507 | int i; |
| 9638 | Lisp_Object val; | 9508 | Lisp_Object val; |
| @@ -9656,19 +9526,18 @@ HIGHESTP non-nil means just return the highest priority one. */) | |||
| 9656 | static const char *const suffixes[] = { "-unix", "-dos", "-mac" }; | 9526 | static const char *const suffixes[] = { "-unix", "-dos", "-mac" }; |
| 9657 | 9527 | ||
| 9658 | static Lisp_Object | 9528 | static Lisp_Object |
| 9659 | make_subsidiaries (base) | 9529 | make_subsidiaries (Lisp_Object base) |
| 9660 | Lisp_Object base; | ||
| 9661 | { | 9530 | { |
| 9662 | Lisp_Object subsidiaries; | 9531 | Lisp_Object subsidiaries; |
| 9663 | int base_name_len = SBYTES (SYMBOL_NAME (base)); | 9532 | int base_name_len = SBYTES (SYMBOL_NAME (base)); |
| 9664 | char *buf = (char *) alloca (base_name_len + 6); | 9533 | char *buf = (char *) alloca (base_name_len + 6); |
| 9665 | int i; | 9534 | int i; |
| 9666 | 9535 | ||
| 9667 | bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); | 9536 | memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len); |
| 9668 | subsidiaries = Fmake_vector (make_number (3), Qnil); | 9537 | subsidiaries = Fmake_vector (make_number (3), Qnil); |
| 9669 | for (i = 0; i < 3; i++) | 9538 | for (i = 0; i < 3; i++) |
| 9670 | { | 9539 | { |
| 9671 | bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); | 9540 | memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1); |
| 9672 | ASET (subsidiaries, i, intern (buf)); | 9541 | ASET (subsidiaries, i, intern (buf)); |
| 9673 | } | 9542 | } |
| 9674 | return subsidiaries; | 9543 | return subsidiaries; |
| @@ -9679,9 +9548,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, | |||
| 9679 | Sdefine_coding_system_internal, coding_arg_max, MANY, 0, | 9548 | Sdefine_coding_system_internal, coding_arg_max, MANY, 0, |
| 9680 | doc: /* For internal use only. | 9549 | doc: /* For internal use only. |
| 9681 | usage: (define-coding-system-internal ...) */) | 9550 | usage: (define-coding-system-internal ...) */) |
| 9682 | (nargs, args) | 9551 | (int nargs, Lisp_Object *args) |
| 9683 | int nargs; | ||
| 9684 | Lisp_Object *args; | ||
| 9685 | { | 9552 | { |
| 9686 | Lisp_Object name; | 9553 | Lisp_Object name; |
| 9687 | Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ | 9554 | Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ |
| @@ -10210,8 +10077,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 10210 | DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, | 10077 | DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, |
| 10211 | 3, 3, 0, | 10078 | 3, 3, 0, |
| 10212 | doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) | 10079 | doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) |
| 10213 | (coding_system, prop, val) | 10080 | (Lisp_Object coding_system, Lisp_Object prop, Lisp_Object val) |
| 10214 | Lisp_Object coding_system, prop, val; | ||
| 10215 | { | 10081 | { |
| 10216 | Lisp_Object spec, attrs; | 10082 | Lisp_Object spec, attrs; |
| 10217 | 10083 | ||
| @@ -10267,8 +10133,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, | |||
| 10267 | DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, | 10133 | DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, |
| 10268 | Sdefine_coding_system_alias, 2, 2, 0, | 10134 | Sdefine_coding_system_alias, 2, 2, 0, |
| 10269 | doc: /* Define ALIAS as an alias for CODING-SYSTEM. */) | 10135 | doc: /* Define ALIAS as an alias for CODING-SYSTEM. */) |
| 10270 | (alias, coding_system) | 10136 | (Lisp_Object alias, Lisp_Object coding_system) |
| 10271 | Lisp_Object alias, coding_system; | ||
| 10272 | { | 10137 | { |
| 10273 | Lisp_Object spec, aliases, eol_type, val; | 10138 | Lisp_Object spec, aliases, eol_type, val; |
| 10274 | 10139 | ||
| @@ -10308,8 +10173,7 @@ DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base, | |||
| 10308 | 1, 1, 0, | 10173 | 1, 1, 0, |
| 10309 | doc: /* Return the base of CODING-SYSTEM. | 10174 | doc: /* Return the base of CODING-SYSTEM. |
| 10310 | Any alias or subsidiary coding system is not a base coding system. */) | 10175 | Any alias or subsidiary coding system is not a base coding system. */) |
| 10311 | (coding_system) | 10176 | (Lisp_Object coding_system) |
| 10312 | Lisp_Object coding_system; | ||
| 10313 | { | 10177 | { |
| 10314 | Lisp_Object spec, attrs; | 10178 | Lisp_Object spec, attrs; |
| 10315 | 10179 | ||
| @@ -10323,8 +10187,7 @@ Any alias or subsidiary coding system is not a base coding system. */) | |||
| 10323 | DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, | 10187 | DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, |
| 10324 | 1, 1, 0, | 10188 | 1, 1, 0, |
| 10325 | doc: "Return the property list of CODING-SYSTEM.") | 10189 | doc: "Return the property list of CODING-SYSTEM.") |
| 10326 | (coding_system) | 10190 | (Lisp_Object coding_system) |
| 10327 | Lisp_Object coding_system; | ||
| 10328 | { | 10191 | { |
| 10329 | Lisp_Object spec, attrs; | 10192 | Lisp_Object spec, attrs; |
| 10330 | 10193 | ||
| @@ -10339,8 +10202,7 @@ DEFUN ("coding-system-plist", Fcoding_system_plist, Scoding_system_plist, | |||
| 10339 | DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases, | 10202 | DEFUN ("coding-system-aliases", Fcoding_system_aliases, Scoding_system_aliases, |
| 10340 | 1, 1, 0, | 10203 | 1, 1, 0, |
| 10341 | doc: /* Return the list of aliases of CODING-SYSTEM. */) | 10204 | doc: /* Return the list of aliases of CODING-SYSTEM. */) |
| 10342 | (coding_system) | 10205 | (Lisp_Object coding_system) |
| 10343 | Lisp_Object coding_system; | ||
| 10344 | { | 10206 | { |
| 10345 | Lisp_Object spec; | 10207 | Lisp_Object spec; |
| 10346 | 10208 | ||
| @@ -10361,8 +10223,7 @@ and CR respectively. | |||
| 10361 | A vector value indicates that a format of end-of-line should be | 10223 | A vector value indicates that a format of end-of-line should be |
| 10362 | detected automatically. Nth element of the vector is the subsidiary | 10224 | detected automatically. Nth element of the vector is the subsidiary |
| 10363 | coding system whose eol-type is N. */) | 10225 | coding system whose eol-type is N. */) |
| 10364 | (coding_system) | 10226 | (Lisp_Object coding_system) |
| 10365 | Lisp_Object coding_system; | ||
| 10366 | { | 10227 | { |
| 10367 | Lisp_Object spec, eol_type; | 10228 | Lisp_Object spec, eol_type; |
| 10368 | int n; | 10229 | int n; |
| @@ -10385,7 +10246,7 @@ coding system whose eol-type is N. */) | |||
| 10385 | /*** 9. Post-amble ***/ | 10246 | /*** 9. Post-amble ***/ |
| 10386 | 10247 | ||
| 10387 | void | 10248 | void |
| 10388 | init_coding_once () | 10249 | init_coding_once (void) |
| 10389 | { | 10250 | { |
| 10390 | int i; | 10251 | int i; |
| 10391 | 10252 | ||
| @@ -10427,7 +10288,7 @@ init_coding_once () | |||
| 10427 | #ifdef emacs | 10288 | #ifdef emacs |
| 10428 | 10289 | ||
| 10429 | void | 10290 | void |
| 10430 | syms_of_coding () | 10291 | syms_of_coding (void) |
| 10431 | { | 10292 | { |
| 10432 | staticpro (&Vcoding_system_hash_table); | 10293 | staticpro (&Vcoding_system_hash_table); |
| 10433 | { | 10294 | { |
| @@ -10968,7 +10829,7 @@ character."); | |||
| 10968 | for (i = 0; i < coding_category_max; i++) | 10829 | for (i = 0; i < coding_category_max; i++) |
| 10969 | Fset (AREF (Vcoding_category_table, i), Qno_conversion); | 10830 | Fset (AREF (Vcoding_category_table, i), Qno_conversion); |
| 10970 | } | 10831 | } |
| 10971 | #if defined (MSDOS) || defined (WINDOWSNT) | 10832 | #if defined (DOS_NT) |
| 10972 | system_eol_type = Qdos; | 10833 | system_eol_type = Qdos; |
| 10973 | #else | 10834 | #else |
| 10974 | system_eol_type = Qunix; | 10835 | system_eol_type = Qunix; |
| @@ -10977,8 +10838,7 @@ character."); | |||
| 10977 | } | 10838 | } |
| 10978 | 10839 | ||
| 10979 | char * | 10840 | char * |
| 10980 | emacs_strerror (error_number) | 10841 | emacs_strerror (int error_number) |
| 10981 | int error_number; | ||
| 10982 | { | 10842 | { |
| 10983 | char *str; | 10843 | char *str; |
| 10984 | 10844 | ||