comparison src/coding.c @ 109159:3e9fdeb960d1

* coding.c, sysdep.c: Convert some more functions to standard C.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 07 Jul 2010 11:38:03 +0200
parents 6175ebc3b6ce
children 750db9f3e6d8
comparison
equal deleted inserted replaced
109158:6175ebc3b6ce 109159:3e9fdeb960d1
152 152
153 Below is the template of these functions. */ 153 Below is the template of these functions. */
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;
163 int multibytep = coding->src_multibyte; 162 int multibytep = coding->src_multibyte;
164 int consumed_chars = 0; 163 int consumed_chars = 0;
201 200
202 Below is the template of these functions. */ 201 Below is the template of these functions. */
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;
211 /* SRC_BASE remembers the start position in source in each loop. 209 /* SRC_BASE remembers the start position in source in each loop.
212 The loop will be exited when there's not enough source code, or 210 The loop will be exited when there's not enough source code, or
259 reaches at the head of not-yet-encoded source text. 257 reaches at the head of not-yet-encoded source text.
260 258
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;
269 int *charbuf_end = charbuf->charbuf + coding->charbuf_used; 266 int *charbuf_end = charbuf->charbuf + coding->charbuf_used;
270 unsigned char *dst = coding->destination + coding->produced; 267 unsigned char *dst = coding->destination + coding->produced;
1163 coding->dst_bytes + bytes); 1160 coding->dst_bytes + bytes);
1164 coding->dst_bytes += bytes; 1161 coding->dst_bytes += bytes;
1165 } 1162 }
1166 1163
1167 static void 1164 static void
1168 coding_alloc_by_making_gap (struct coding_system *coding, EMACS_INT gap_head_used, EMACS_INT bytes) 1165 coding_alloc_by_making_gap (struct coding_system *coding,
1166 EMACS_INT gap_head_used, EMACS_INT bytes)
1169 { 1167 {
1170 if (EQ (coding->src_object, coding->dst_object)) 1168 if (EQ (coding->src_object, coding->dst_object))
1171 { 1169 {
1172 /* The gap may contain the produced data at the head and not-yet 1170 /* The gap may contain the produced data at the head and not-yet
1173 consumed data at the tail. To preserve those data, we at 1171 consumed data at the tail. To preserve those data, we at
1192 } 1190 }
1193 } 1191 }
1194 1192
1195 1193
1196 static unsigned char * 1194 static unsigned char *
1197 alloc_destination (struct coding_system *coding, EMACS_INT nbytes, unsigned char *dst) 1195 alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1196 unsigned char *dst)
1198 { 1197 {
1199 EMACS_INT offset = dst - coding->destination; 1198 EMACS_INT offset = dst - coding->destination;
1200 1199
1201 if (BUFFERP (coding->dst_object)) 1200 if (BUFFERP (coding->dst_object))
1202 { 1201 {
1290 #define UTF_8_BOM_1 0xEF 1289 #define UTF_8_BOM_1 0xEF
1291 #define UTF_8_BOM_2 0xBB 1290 #define UTF_8_BOM_2 0xBB
1292 #define UTF_8_BOM_3 0xBF 1291 #define UTF_8_BOM_3 0xBF
1293 1292
1294 static int 1293 static int
1295 detect_coding_utf_8 (struct coding_system *coding, struct coding_detection_info *detect_info) 1294 detect_coding_utf_8 (struct coding_system *coding,
1295 struct coding_detection_info *detect_info)
1296 { 1296 {
1297 const unsigned char *src = coding->source, *src_base; 1297 const unsigned char *src = coding->source, *src_base;
1298 const unsigned char *src_end = coding->source + coding->src_bytes; 1298 const unsigned char *src_end = coding->source + coding->src_bytes;
1299 int multibytep = coding->src_multibyte; 1299 int multibytep = coding->src_multibyte;
1300 int consumed_chars = 0; 1300 int consumed_chars = 0;
1420 } 1420 }
1421 } 1421 }
1422 } 1422 }
1423 } 1423 }
1424 CODING_UTF_8_BOM (coding) = utf_without_bom; 1424 CODING_UTF_8_BOM (coding) = utf_without_bom;
1425
1426
1427 1425
1428 while (1) 1426 while (1)
1429 { 1427 {
1430 int c, c1, c2, c3, c4, c5; 1428 int c, c1, c2, c3, c4, c5;
1431 1429
1608 || ((val) == 0xFFFF) \ 1606 || ((val) == 0xFFFF) \
1609 || UTF_16_LOW_SURROGATE_P (val)) 1607 || UTF_16_LOW_SURROGATE_P (val))
1610 1608
1611 1609
1612 static int 1610 static int
1613 detect_coding_utf_16 (struct coding_system *coding, struct coding_detection_info *detect_info) 1611 detect_coding_utf_16 (struct coding_system *coding,
1612 struct coding_detection_info *detect_info)
1614 { 1613 {
1615 const unsigned char *src = coding->source, *src_base = src; 1614 const unsigned char *src = coding->source, *src_base = src;
1616 const unsigned char *src_end = coding->source + coding->src_bytes; 1615 const unsigned char *src_end = coding->source + coding->src_bytes;
1617 int multibytep = coding->src_multibyte; 1616 int multibytep = coding->src_multibyte;
1618 int consumed_chars = 0; 1617 int consumed_chars = 0;
1960 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 1959 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
1961 Check if a text is encoded in `emacs-mule'. If it is, return 1, 1960 Check if a text is encoded in `emacs-mule'. If it is, return 1,
1962 else return 0. */ 1961 else return 0. */
1963 1962
1964 static int 1963 static int
1965 detect_coding_emacs_mule (struct coding_system *coding, struct coding_detection_info *detect_info) 1964 detect_coding_emacs_mule (struct coding_system *coding,
1965 struct coding_detection_info *detect_info)
1966 { 1966 {
1967 const unsigned char *src = coding->source, *src_base; 1967 const unsigned char *src = coding->source, *src_base;
1968 const unsigned char *src_end = coding->source + coding->src_bytes; 1968 const unsigned char *src_end = coding->source + coding->src_bytes;
1969 int multibytep = coding->src_multibyte; 1969 int multibytep = coding->src_multibyte;
1970 int consumed_chars = 0; 1970 int consumed_chars = 0;
2048 RULE described above, decode it and return the negative value of 2048 RULE described above, decode it and return the negative value of
2049 the decoded character or rule. If an invalid byte is found, return 2049 the decoded character or rule. If an invalid byte is found, return
2050 -1. If SRC is too short, return -2. */ 2050 -1. If SRC is too short, return -2. */
2051 2051
2052 int 2052 int
2053 emacs_mule_char (struct coding_system *coding, const unsigned char *src, int *nbytes, int *nchars, int *id, struct composition_status *cmp_status) 2053 emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2054 int *nbytes, int *nchars, int *id,
2055 struct composition_status *cmp_status)
2054 { 2056 {
2055 const unsigned char *src_end = coding->source + coding->src_bytes; 2057 const unsigned char *src_end = coding->source + coding->src_bytes;
2056 const unsigned char *src_base = src; 2058 const unsigned char *src_base = src;
2057 int multibytep = coding->src_multibyte; 2059 int multibytep = coding->src_multibyte;
2058 struct charset *charset; 2060 struct charset *charset;
2366 cmp_status->state = COMPOSING_NO; \ 2368 cmp_status->state = COMPOSING_NO; \
2367 } while (0) 2369 } while (0)
2368 2370
2369 2371
2370 static int 2372 static int
2371 emacs_mule_finish_composition (int *charbuf, struct composition_status *cmp_status) 2373 emacs_mule_finish_composition (int *charbuf,
2374 struct composition_status *cmp_status)
2372 { 2375 {
2373 int idx = - cmp_status->length; 2376 int idx = - cmp_status->length;
2374 int new_chars; 2377 int new_chars;
2375 2378
2376 if (cmp_status->old_form && cmp_status->nchars > 0) 2379 if (cmp_status->old_form && cmp_status->nchars > 0)
3046 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 3049 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
3047 Check if a text is encoded in one of ISO-2022 based codig systems. 3050 Check if a text is encoded in one of ISO-2022 based codig systems.
3048 If it is, return 1, else return 0. */ 3051 If it is, return 1, else return 0. */
3049 3052
3050 static int 3053 static int
3051 detect_coding_iso_2022 (struct coding_system *coding, struct coding_detection_info *detect_info) 3054 detect_coding_iso_2022 (struct coding_system *coding,
3055 struct coding_detection_info *detect_info)
3052 { 3056 {
3053 const unsigned char *src = coding->source, *src_base = src; 3057 const unsigned char *src = coding->source, *src_base = src;
3054 const unsigned char *src_end = coding->source + coding->src_bytes; 3058 const unsigned char *src_end = coding->source + coding->src_bytes;
3055 int multibytep = coding->src_multibyte; 3059 int multibytep = coding->src_multibyte;
3056 int single_shifting = 0; 3060 int single_shifting = 0;
4296 /* Produce designation and invocation codes at a place pointed by DST 4300 /* Produce designation and invocation codes at a place pointed by DST
4297 to use CHARSET. The element `spec.iso_2022' of *CODING is updated. 4301 to use CHARSET. The element `spec.iso_2022' of *CODING is updated.
4298 Return new DST. */ 4302 Return new DST. */
4299 4303
4300 unsigned char * 4304 unsigned char *
4301 encode_invocation_designation (struct charset *charset, struct coding_system *coding, unsigned char *dst, int *p_nchars) 4305 encode_invocation_designation (struct charset *charset,
4306 struct coding_system *coding,
4307 unsigned char *dst, int *p_nchars)
4302 { 4308 {
4303 int multibytep = coding->dst_multibyte; 4309 int multibytep = coding->dst_multibyte;
4304 int produced_chars = *p_nchars; 4310 int produced_chars = *p_nchars;
4305 int reg; /* graphic register number */ 4311 int reg; /* graphic register number */
4306 int id = CHARSET_ID (charset); 4312 int id = CHARSET_ID (charset);
4408 4414
4409 If the current block ends before any end-of-line, we may fail to 4415 If the current block ends before any end-of-line, we may fail to
4410 find all the necessary designations. */ 4416 find all the necessary designations. */
4411 4417
4412 static unsigned char * 4418 static unsigned char *
4413 encode_designation_at_bol (struct coding_system *coding, int *charbuf, int *charbuf_end, unsigned char *dst) 4419 encode_designation_at_bol (struct coding_system *coding, int *charbuf,
4420 int *charbuf_end, unsigned char *dst)
4414 { 4421 {
4415 struct charset *charset; 4422 struct charset *charset;
4416 /* Table of charsets to be designated to each graphic register. */ 4423 /* Table of charsets to be designated to each graphic register. */
4417 int r[4]; 4424 int r[4];
4418 int c, found = 0, reg; 4425 int c, found = 0, reg;
4648 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 4655 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
4649 Check if a text is encoded in SJIS. If it is, return 4656 Check if a text is encoded in SJIS. If it is, return
4650 CATEGORY_MASK_SJIS, else return 0. */ 4657 CATEGORY_MASK_SJIS, else return 0. */
4651 4658
4652 static int 4659 static int
4653 detect_coding_sjis (struct coding_system *coding, struct coding_detection_info *detect_info) 4660 detect_coding_sjis (struct coding_system *coding,
4661 struct coding_detection_info *detect_info)
4654 { 4662 {
4655 const unsigned char *src = coding->source, *src_base; 4663 const unsigned char *src = coding->source, *src_base;
4656 const unsigned char *src_end = coding->source + coding->src_bytes; 4664 const unsigned char *src_end = coding->source + coding->src_bytes;
4657 int multibytep = coding->src_multibyte; 4665 int multibytep = coding->src_multibyte;
4658 int consumed_chars = 0; 4666 int consumed_chars = 0;
4704 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 4712 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
4705 Check if a text is encoded in BIG5. If it is, return 4713 Check if a text is encoded in BIG5. If it is, return
4706 CATEGORY_MASK_BIG5, else return 0. */ 4714 CATEGORY_MASK_BIG5, else return 0. */
4707 4715
4708 static int 4716 static int
4709 detect_coding_big5 (struct coding_system *coding, struct coding_detection_info *detect_info) 4717 detect_coding_big5 (struct coding_system *coding,
4718 struct coding_detection_info *detect_info)
4710 { 4719 {
4711 const unsigned char *src = coding->source, *src_base; 4720 const unsigned char *src = coding->source, *src_base;
4712 const unsigned char *src_end = coding->source + coding->src_bytes; 4721 const unsigned char *src_end = coding->source + coding->src_bytes;
4713 int multibytep = coding->src_multibyte; 4722 int multibytep = coding->src_multibyte;
4714 int consumed_chars = 0; 4723 int consumed_chars = 0;
5142 Check if a text is encoded in a coding system of which 5151 Check if a text is encoded in a coding system of which
5143 encoder/decoder are written in CCL program. If it is, return 5152 encoder/decoder are written in CCL program. If it is, return
5144 CATEGORY_MASK_CCL, else return 0. */ 5153 CATEGORY_MASK_CCL, else return 0. */
5145 5154
5146 static int 5155 static int
5147 detect_coding_ccl (struct coding_system *coding, struct coding_detection_info *detect_info) 5156 detect_coding_ccl (struct coding_system *coding,
5157 struct coding_detection_info *detect_info)
5148 { 5158 {
5149 const unsigned char *src = coding->source, *src_base; 5159 const unsigned char *src = coding->source, *src_base;
5150 const unsigned char *src_end = coding->source + coding->src_bytes; 5160 const unsigned char *src_end = coding->source + coding->src_bytes;
5151 int multibytep = coding->src_multibyte; 5161 int multibytep = coding->src_multibyte;
5152 int consumed_chars = 0; 5162 int consumed_chars = 0;
5421 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 5431 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
5422 Check if a text is encoded in a charset-based coding system. If it 5432 Check if a text is encoded in a charset-based coding system. If it
5423 is, return 1, else return 0. */ 5433 is, return 1, else return 0. */
5424 5434
5425 static int 5435 static int
5426 detect_coding_charset (struct coding_system *coding, struct coding_detection_info *detect_info) 5436 detect_coding_charset (struct coding_system *coding,
5437 struct coding_detection_info *detect_info)
5427 { 5438 {
5428 const unsigned char *src = coding->source, *src_base; 5439 const unsigned char *src = coding->source, *src_base;
5429 const unsigned char *src_end = coding->source + coding->src_bytes; 5440 const unsigned char *src_end = coding->source + coding->src_bytes;
5430 int multibytep = coding->src_multibyte; 5441 int multibytep = coding->src_multibyte;
5431 int consumed_chars = 0; 5442 int consumed_chars = 0;
6166 Return one of EOL_SEEN_XXX. */ 6177 Return one of EOL_SEEN_XXX. */
6167 6178
6168 #define MAX_EOL_CHECK_COUNT 3 6179 #define MAX_EOL_CHECK_COUNT 3
6169 6180
6170 static int 6181 static int
6171 detect_eol (const unsigned char *source, EMACS_INT src_bytes, enum coding_category category) 6182 detect_eol (const unsigned char *source, EMACS_INT src_bytes,
6183 enum coding_category category)
6172 { 6184 {
6173 const unsigned char *src = source, *src_end = src + src_bytes; 6185 const unsigned char *src = source, *src_end = src + src_bytes;
6174 unsigned char c; 6186 unsigned char c;
6175 int total = 0; 6187 int total = 0;
6176 int eol_seen = EOL_SEEN_NONE; 6188 int eol_seen = EOL_SEEN_NONE;
6702 return Qnil; 6714 return Qnil;
6703 } 6715 }
6704 6716
6705 6717
6706 static int 6718 static int
6707 produce_chars (struct coding_system *coding, Lisp_Object translation_table, int last_block) 6719 produce_chars (struct coding_system *coding, Lisp_Object translation_table,
6720 int last_block)
6708 { 6721 {
6709 unsigned char *dst = coding->destination + coding->produced; 6722 unsigned char *dst = coding->destination + coding->produced;
6710 unsigned char *dst_end = coding->destination + coding->dst_bytes; 6723 unsigned char *dst_end = coding->destination + coding->dst_bytes;
6711 EMACS_INT produced; 6724 EMACS_INT produced;
6712 EMACS_INT produced_chars = 0; 6725 EMACS_INT produced_chars = 0;
7172 If such an annotation is not found, set *STOP to a starting 7185 If such an annotation is not found, set *STOP to a starting
7173 position of a composition after POS (if any) or to LIMIT, and 7186 position of a composition after POS (if any) or to LIMIT, and
7174 return BUF. */ 7187 return BUF. */
7175 7188
7176 static INLINE int * 7189 static INLINE int *
7177 handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) 7190 handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
7191 struct coding_system *coding, int *buf,
7192 EMACS_INT *stop)
7178 { 7193 {
7179 EMACS_INT start, end; 7194 EMACS_INT start, end;
7180 Lisp_Object prop; 7195 Lisp_Object prop;
7181 7196
7182 if (! find_composition (pos, limit, &start, &end, &prop, coding->src_object) 7197 if (! find_composition (pos, limit, &start, &end, &prop, coding->src_object)
7253 7268
7254 If the property value is nil, set *STOP to the position where the 7269 If the property value is nil, set *STOP to the position where the
7255 property value is non-nil (limiting by LIMIT), and return BUF. */ 7270 property value is non-nil (limiting by LIMIT), and return BUF. */
7256 7271
7257 static INLINE int * 7272 static INLINE int *
7258 handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, struct coding_system *coding, int *buf, EMACS_INT *stop) 7273 handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
7274 struct coding_system *coding, int *buf,
7275 EMACS_INT *stop)
7259 { 7276 {
7260 Lisp_Object val, next; 7277 Lisp_Object val, next;
7261 int id; 7278 int id;
7262 7279
7263 val = Fget_text_property (make_number (pos), Qcharset, coding->src_object); 7280 val = Fget_text_property (make_number (pos), Qcharset, coding->src_object);
7273 return buf; 7290 return buf;
7274 } 7291 }
7275 7292
7276 7293
7277 static void 7294 static void
7278 consume_chars (struct coding_system *coding, Lisp_Object translation_table, int max_lookup) 7295 consume_chars (struct coding_system *coding, Lisp_Object translation_table,
7296 int max_lookup)
7279 { 7297 {
7280 int *buf = coding->charbuf; 7298 int *buf = coding->charbuf;
7281 int *buf_end = coding->charbuf + coding->charbuf_size; 7299 int *buf_end = coding->charbuf + coding->charbuf_size;
7282 const unsigned char *src = coding->source + coding->consumed; 7300 const unsigned char *src = coding->source + coding->consumed;
7283 const unsigned char *src_end = coding->source + coding->src_bytes; 7301 const unsigned char *src_end = coding->source + coding->src_bytes;
7558 Fcons (Fcurrent_buffer (), workbuf)); 7576 Fcons (Fcurrent_buffer (), workbuf));
7559 return workbuf; 7577 return workbuf;
7560 } 7578 }
7561 7579
7562 int 7580 int
7563 decode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) 7581 decode_coding_gap (struct coding_system *coding,
7582 EMACS_INT chars, EMACS_INT bytes)
7564 { 7583 {
7565 int count = SPECPDL_INDEX (); 7584 int count = SPECPDL_INDEX ();
7566 Lisp_Object attrs; 7585 Lisp_Object attrs;
7567 7586
7568 code_conversion_save (0, 0); 7587 code_conversion_save (0, 0);
7603 unbind_to (count, Qnil); 7622 unbind_to (count, Qnil);
7604 return coding->result; 7623 return coding->result;
7605 } 7624 }
7606 7625
7607 int 7626 int
7608 encode_coding_gap (struct coding_system *coding, EMACS_INT chars, EMACS_INT bytes) 7627 encode_coding_gap (struct coding_system *coding,
7628 EMACS_INT chars, EMACS_INT bytes)
7609 { 7629 {
7610 int count = SPECPDL_INDEX (); 7630 int count = SPECPDL_INDEX ();
7611 7631
7612 code_conversion_save (0, 0); 7632 code_conversion_save (0, 0);
7613 7633
7656 CODING->destination by xmalloc. If the decoded text is longer than 7676 CODING->destination by xmalloc. If the decoded text is longer than
7657 CODING->dst_bytes, CODING->destination is relocated by xrealloc. 7677 CODING->dst_bytes, CODING->destination is relocated by xrealloc.
7658 */ 7678 */
7659 7679
7660 void 7680 void
7661 decode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7681 decode_coding_object (struct coding_system *coding,
7662 dst_object) 7682 Lisp_Object src_object,
7663 struct coding_system *coding; 7683 EMACS_INT from, EMACS_INT from_byte,
7664 Lisp_Object src_object; 7684 EMACS_INT to, EMACS_INT to_byte,
7665 EMACS_INT from, from_byte, to, to_byte; 7685 Lisp_Object dst_object)
7666 Lisp_Object dst_object;
7667 { 7686 {
7668 int count = SPECPDL_INDEX (); 7687 int count = SPECPDL_INDEX ();
7669 unsigned char *destination; 7688 unsigned char *destination;
7670 EMACS_INT dst_bytes; 7689 EMACS_INT dst_bytes;
7671 EMACS_INT chars = to - from; 7690 EMACS_INT chars = to - from;
7847 unbind_to (count, coding->dst_object); 7866 unbind_to (count, coding->dst_object);
7848 } 7867 }
7849 7868
7850 7869
7851 void 7870 void
7852 encode_coding_object (coding, src_object, from, from_byte, to, to_byte, 7871 encode_coding_object (struct coding_system *coding,
7853 dst_object) 7872 Lisp_Object src_object,
7854 struct coding_system *coding; 7873 EMACS_INT from, EMACS_INT from_byte,
7855 Lisp_Object src_object; 7874 EMACS_INT to, EMACS_INT to_byte,
7856 EMACS_INT from, from_byte, to, to_byte; 7875 Lisp_Object dst_object)
7857 Lisp_Object dst_object;
7858 { 7876 {
7859 int count = SPECPDL_INDEX (); 7877 int count = SPECPDL_INDEX ();
7860 EMACS_INT chars = to - from; 7878 EMACS_INT chars = to - from;
7861 EMACS_INT bytes = to_byte - from_byte; 7879 EMACS_INT bytes = to_byte - from_byte;
7862 Lisp_Object attrs; 7880 Lisp_Object attrs;
8160 (e.g. `iso-latin-1'), detect only eol-format. If the eol-format 8178 (e.g. `iso-latin-1'), detect only eol-format. If the eol-format
8161 part of CODING-SYSTEM is already specified (e.g. `undecided-unix'), 8179 part of CODING-SYSTEM is already specified (e.g. `undecided-unix'),
8162 detect only text-format. */ 8180 detect only text-format. */
8163 8181
8164 Lisp_Object 8182 Lisp_Object
8165 detect_coding_system (src, src_chars, src_bytes, highest, multibytep, 8183 detect_coding_system (const unsigned char *src,
8166 coding_system) 8184 EMACS_INT src_chars, EMACS_INT src_bytes,
8167 const unsigned char *src; 8185 int highest, int multibytep,
8168 EMACS_INT src_chars, src_bytes; 8186 Lisp_Object coding_system)
8169 int highest;
8170 int multibytep;
8171 Lisp_Object coding_system;
8172 { 8187 {
8173 const unsigned char *src_end = src + src_bytes; 8188 const unsigned char *src_end = src + src_bytes;
8174 Lisp_Object attrs, eol_type; 8189 Lisp_Object attrs, eol_type;
8175 Lisp_Object val = Qnil; 8190 Lisp_Object val = Qnil;
8176 struct coding_system coding; 8191 struct coding_system coding;
8920 return list; 8935 return list;
8921 } 8936 }
8922 8937
8923 8938
8924 Lisp_Object 8939 Lisp_Object
8925 code_convert_region (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object dst_object, int encodep, int norecord) 8940 code_convert_region (Lisp_Object start, Lisp_Object end,
8941 Lisp_Object coding_system, Lisp_Object dst_object,
8942 int encodep, int norecord)
8926 { 8943 {
8927 struct coding_system coding; 8944 struct coding_system coding;
8928 EMACS_INT from, from_byte, to, to_byte; 8945 EMACS_INT from, from_byte, to, to_byte;
8929 Lisp_Object src_object; 8946 Lisp_Object src_object;
8930 8947
9059 9076
9060 This function is called only from macros DECODE_FILE and 9077 This function is called only from macros DECODE_FILE and
9061 ENCODE_FILE, thus we ignore character composition. */ 9078 ENCODE_FILE, thus we ignore character composition. */
9062 9079
9063 Lisp_Object 9080 Lisp_Object
9064 code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system, int encodep) 9081 code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
9082 int encodep)
9065 { 9083 {
9066 return code_convert_string (string, coding_system, Qt, encodep, 0, 1); 9084 return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
9067 } 9085 }
9068 9086
9069 9087
10094 10112
10095 10113
10096 DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, 10114 DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
10097 3, 3, 0, 10115 3, 3, 0,
10098 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */) 10116 doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */)
10099 (coding_system, prop, val) 10117 (coding_system, prop, val)
10100 Lisp_Object coding_system, prop, val; 10118 Lisp_Object coding_system, prop, val;
10101 { 10119 {
10102 Lisp_Object spec, attrs; 10120 Lisp_Object spec, attrs;
10103 10121
10104 CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec); 10122 CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec);
10192 10210
10193 DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base, 10211 DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,
10194 1, 1, 0, 10212 1, 1, 0,
10195 doc: /* Return the base of CODING-SYSTEM. 10213 doc: /* Return the base of CODING-SYSTEM.
10196 Any alias or subsidiary coding system is not a base coding system. */) 10214 Any alias or subsidiary coding system is not a base coding system. */)
10197 (coding_system) 10215 (coding_system)
10198 Lisp_Object coding_system; 10216 Lisp_Object coding_system;
10199 { 10217 {
10200 Lisp_Object spec, attrs; 10218 Lisp_Object spec, attrs;
10201 10219
10202 if (NILP (coding_system)) 10220 if (NILP (coding_system))