comparison src/coding.c @ 36650:a1859dfb6a1b

(Fdetect_coding_region): Fix comments added by the previous change.
author Kenichi Handa <handa@m17n.org>
date Thu, 08 Mar 2001 04:42:43 +0000
parents 5dc88f9ab0ef
children 8a086ca42e43
comparison
equal deleted inserted replaced
36649:5dc88f9ab0ef 36650:a1859dfb6a1b
6227 from_byte = CHAR_TO_BYTE (from); 6227 from_byte = CHAR_TO_BYTE (from);
6228 to_byte = CHAR_TO_BYTE (to); 6228 to_byte = CHAR_TO_BYTE (to);
6229 6229
6230 if (from < GPT && to >= GPT) 6230 if (from < GPT && to >= GPT)
6231 move_gap_both (to, to_byte); 6231 move_gap_both (to, to_byte);
6232 /* If we an anchor byte `\0' follows the region, we include it in
6233 the detecting source. Then code detectors can handle the tailing
6234 byte sequence more accurately.
6235
6236 Fix me: This is not an perfect solution. It is better that we
6237 add one more argument, say LAST_BLOCK, to all detect_coding_XXX.
6238 */
6232 if (to == Z || (to == GPT && GAP_SIZE > 0)) 6239 if (to == Z || (to == GPT && GAP_SIZE > 0))
6233 include_anchor_byte = 1; 6240 include_anchor_byte = 1;
6234 return detect_coding_system (BYTE_POS_ADDR (from_byte), 6241 return detect_coding_system (BYTE_POS_ADDR (from_byte),
6235 /* "+ include_anchor_byteq" is to
6236 include the anchor byte `\0'. With
6237 this, code detectors can check if
6238 tailing bytes are valid. */
6239 to_byte - from_byte + include_anchor_byte, 6242 to_byte - from_byte + include_anchor_byte,
6240 !NILP (highest), 6243 !NILP (highest),
6241 !NILP (current_buffer 6244 !NILP (current_buffer
6242 ->enable_multibyte_characters)); 6245 ->enable_multibyte_characters));
6243 } 6246 }
6259 CHECK_STRING (string, 0); 6262 CHECK_STRING (string, 0);
6260 6263
6261 return detect_coding_system (XSTRING (string)->data, 6264 return detect_coding_system (XSTRING (string)->data,
6262 /* "+ 1" is to include the anchor byte 6265 /* "+ 1" is to include the anchor byte
6263 `\0'. With this, code detectors can 6266 `\0'. With this, code detectors can
6264 check if tailing bytes are 6267 handle the tailing bytes more
6265 valid. */ 6268 accurately. */
6266 STRING_BYTES (XSTRING (string)) + 1, 6269 STRING_BYTES (XSTRING (string)) + 1,
6267 !NILP (highest), 6270 !NILP (highest),
6268 STRING_MULTIBYTE (string)); 6271 STRING_MULTIBYTE (string));
6269 } 6272 }
6270 6273