Mercurial > emacs
comparison src/coding.c @ 95353:96d35f50fe34
(encode_coding_raw_text): Fix previous change.
(encode_coding_object): When the dst_object is a buffer and is
different from src_object, move gap to PT.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Wed, 28 May 2008 06:38:47 +0000 |
| parents | 0350e5efb8f7 |
| children | 90b4a0dc21cc |
comparison
equal
deleted
inserted
replaced
| 95352:a69249f54307 | 95353:96d35f50fe34 |
|---|---|
| 4879 { | 4879 { |
| 4880 ASSURE_DESTINATION (charbuf_end - charbuf); | 4880 ASSURE_DESTINATION (charbuf_end - charbuf); |
| 4881 while (charbuf < charbuf_end && dst < dst_end) | 4881 while (charbuf < charbuf_end && dst < dst_end) |
| 4882 *dst++ = *charbuf++; | 4882 *dst++ = *charbuf++; |
| 4883 } | 4883 } |
| 4884 produced_chars = charbuf - coding->charbuf; | 4884 produced_chars = dst - (coding->destination + coding->produced); |
| 4885 } | 4885 } |
| 4886 record_conversion_result (coding, CODING_RESULT_SUCCESS); | 4886 record_conversion_result (coding, CODING_RESULT_SUCCESS); |
| 4887 coding->produced_char += produced_chars; | 4887 coding->produced_char += produced_chars; |
| 4888 coding->produced = dst - coding->destination; | 4888 coding->produced = dst - coding->destination; |
| 4889 return 0; | 4889 return 0; |
| 7329 coding->dst_pos = from; | 7329 coding->dst_pos = from; |
| 7330 coding->dst_pos_byte = from_byte; | 7330 coding->dst_pos_byte = from_byte; |
| 7331 } | 7331 } |
| 7332 else | 7332 else |
| 7333 { | 7333 { |
| 7334 coding->dst_pos = BUF_PT (XBUFFER (dst_object)); | 7334 struct buffer *current = current_buffer; |
| 7335 coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); | 7335 |
| 7336 set_buffer_temp (XBUFFER (dst_object)); | |
| 7337 coding->dst_pos = PT; | |
| 7338 coding->dst_pos_byte = PT_BYTE; | |
| 7339 move_gap_both (coding->dst_pos, coding->dst_pos_byte); | |
| 7340 set_buffer_temp (current); | |
| 7336 } | 7341 } |
| 7337 coding->dst_multibyte | 7342 coding->dst_multibyte |
| 7338 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); | 7343 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); |
| 7339 } | 7344 } |
| 7340 else if (EQ (dst_object, Qt)) | 7345 else if (EQ (dst_object, Qt)) |
| 8308 START and END are buffer positions. | 8313 START and END are buffer positions. |
| 8309 | 8314 |
| 8310 Optional 4th arguments DESTINATION specifies where the decoded text goes. | 8315 Optional 4th arguments DESTINATION specifies where the decoded text goes. |
| 8311 If nil, the region between START and END is replaced by the decoded text. | 8316 If nil, the region between START and END is replaced by the decoded text. |
| 8312 If buffer, the decoded text is inserted in the buffer. | 8317 If buffer, the decoded text is inserted in the buffer. |
| 8313 If t, the decoded text is returned. | 8318 In those cases, the length of the decoded text is returned.. |
| 8319 If DESTINATION is t, the decoded text is returned. | |
| 8314 | 8320 |
| 8315 This function sets `last-coding-system-used' to the precise coding system | 8321 This function sets `last-coding-system-used' to the precise coding system |
| 8316 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8322 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8317 not fully specified.) | 8323 not fully specified.) */) |
| 8318 It returns the length of the decoded text. */) | |
| 8319 (start, end, coding_system, destination) | 8324 (start, end, coding_system, destination) |
| 8320 Lisp_Object start, end, coding_system, destination; | 8325 Lisp_Object start, end, coding_system, destination; |
| 8321 { | 8326 { |
| 8322 return code_convert_region (start, end, coding_system, destination, 0, 0); | 8327 return code_convert_region (start, end, coding_system, destination, 0, 0); |
| 8323 } | 8328 } |
| 8330 START and END are buffer positions. | 8335 START and END are buffer positions. |
| 8331 | 8336 |
| 8332 Optional 4th arguments DESTINATION specifies where the encoded text goes. | 8337 Optional 4th arguments DESTINATION specifies where the encoded text goes. |
| 8333 If nil, the region between START and END is replace by the encoded text. | 8338 If nil, the region between START and END is replace by the encoded text. |
| 8334 If buffer, the encoded text is inserted in the buffer. | 8339 If buffer, the encoded text is inserted in the buffer. |
| 8335 If t, the encoded text is returned. | 8340 In those cases, the length of the encoded text is returned.. |
| 8341 If DESTINATION is t, the encoded text is returned. | |
| 8336 | 8342 |
| 8337 This function sets `last-coding-system-used' to the precise coding system | 8343 This function sets `last-coding-system-used' to the precise coding system |
| 8338 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8344 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8339 not fully specified.) | 8345 not fully specified.) */) |
| 8340 It returns the length of the encoded text. */) | |
| 8341 (start, end, coding_system, destination) | 8346 (start, end, coding_system, destination) |
| 8342 Lisp_Object start, end, coding_system, destination; | 8347 Lisp_Object start, end, coding_system, destination; |
| 8343 { | 8348 { |
| 8344 return code_convert_region (start, end, coding_system, destination, 1, 0); | 8349 return code_convert_region (start, end, coding_system, destination, 1, 0); |
| 8345 } | 8350 } |
| 8410 Optional third arg NOCOPY non-nil means it is OK to return STRING itself | 8415 Optional third arg NOCOPY non-nil means it is OK to return STRING itself |
| 8411 if the decoding operation is trivial. | 8416 if the decoding operation is trivial. |
| 8412 | 8417 |
| 8413 Optional fourth arg BUFFER non-nil means that the decoded text is | 8418 Optional fourth arg BUFFER non-nil means that the decoded text is |
| 8414 inserted in BUFFER instead of returned as a string. In this case, | 8419 inserted in BUFFER instead of returned as a string. In this case, |
| 8415 the return value is BUFFER. | 8420 the return value is the length of the decoded text. |
| 8416 | 8421 |
| 8417 This function sets `last-coding-system-used' to the precise coding system | 8422 This function sets `last-coding-system-used' to the precise coding system |
| 8418 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8423 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8419 not fully specified.) */) | 8424 not fully specified.) */) |
| 8420 (string, coding_system, nocopy, buffer) | 8425 (string, coding_system, nocopy, buffer) |
| 8431 Optional third arg NOCOPY non-nil means it is OK to return STRING | 8436 Optional third arg NOCOPY non-nil means it is OK to return STRING |
| 8432 itself if the encoding operation is trivial. | 8437 itself if the encoding operation is trivial. |
| 8433 | 8438 |
| 8434 Optional fourth arg BUFFER non-nil means that the encoded text is | 8439 Optional fourth arg BUFFER non-nil means that the encoded text is |
| 8435 inserted in BUFFER instead of returned as a string. In this case, | 8440 inserted in BUFFER instead of returned as a string. In this case, |
| 8436 the return value is BUFFER. | 8441 the return value is the length of the encoded.text. |
| 8437 | 8442 |
| 8438 This function sets `last-coding-system-used' to the precise coding system | 8443 This function sets `last-coding-system-used' to the precise coding system |
| 8439 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8444 used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8440 not fully specified.) */) | 8445 not fully specified.) */) |
| 8441 (string, coding_system, nocopy, buffer) | 8446 (string, coding_system, nocopy, buffer) |
