diff options
| author | Kenichi Handa | 2000-05-19 23:59:04 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-05-19 23:59:04 +0000 |
| commit | 9a599130ca12af563d1f7a64f07e1998ee1d29c8 (patch) | |
| tree | e9d324df488fe4e8c282c021948c1665a3d019de /src/editfns.c | |
| parent | 37309c9d3d51de1219d558425926dbfa444c59eb (diff) | |
| download | emacs-9a599130ca12af563d1f7a64f07e1998ee1d29c8.tar.gz emacs-9a599130ca12af563d1f7a64f07e1998ee1d29c8.zip | |
(Fformat): Be sure to convert 8-bit characters to
multibyte form.
(Ftranspose_region) [BYTE_COMBINING_DEBUG]: Abort if byte
combining occurs.
(Ftranspose_region): Delete codes for handling byte combining.
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 73 |
1 files changed, 22 insertions, 51 deletions
diff --git a/src/editfns.c b/src/editfns.c index d4f8b5fd8c4..63c1183837c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3131,7 +3131,10 @@ Use %% to put a single % into the output.") | |||
| 3131 | && !CHAR_HEAD_P (*((unsigned char *) p))) | 3131 | && !CHAR_HEAD_P (*((unsigned char *) p))) |
| 3132 | maybe_combine_byte = 1; | 3132 | maybe_combine_byte = 1; |
| 3133 | this_nchars = strlen (p); | 3133 | this_nchars = strlen (p); |
| 3134 | p += this_nchars; | 3134 | if (multibyte) |
| 3135 | p += str_to_multibyte (p, buf + total - p, this_nchars); | ||
| 3136 | else | ||
| 3137 | p += this_nchars; | ||
| 3135 | nchars += this_nchars; | 3138 | nchars += this_nchars; |
| 3136 | } | 3139 | } |
| 3137 | } | 3140 | } |
| @@ -3359,8 +3362,6 @@ Transposing beyond buffer boundaries is an error.") | |||
| 3359 | int start1_byte, start2_byte, len1_byte, len2_byte; | 3362 | int start1_byte, start2_byte, len1_byte, len2_byte; |
| 3360 | int gap, len1, len_mid, len2; | 3363 | int gap, len1, len_mid, len2; |
| 3361 | unsigned char *start1_addr, *start2_addr, *temp; | 3364 | unsigned char *start1_addr, *start2_addr, *temp; |
| 3362 | int combined_before_bytes_1, combined_after_bytes_1; | ||
| 3363 | int combined_before_bytes_2, combined_after_bytes_2; | ||
| 3364 | struct gcpro gcpro1, gcpro2; | 3365 | struct gcpro gcpro1, gcpro2; |
| 3365 | 3366 | ||
| 3366 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2; | 3367 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2; |
| @@ -3431,61 +3432,31 @@ Transposing beyond buffer boundaries is an error.") | |||
| 3431 | len1_byte = CHAR_TO_BYTE (end1) - start1_byte; | 3432 | len1_byte = CHAR_TO_BYTE (end1) - start1_byte; |
| 3432 | len2_byte = CHAR_TO_BYTE (end2) - start2_byte; | 3433 | len2_byte = CHAR_TO_BYTE (end2) - start2_byte; |
| 3433 | 3434 | ||
| 3435 | #ifdef BYTE_COMBINING_DEBUG | ||
| 3434 | if (end1 == start2) | 3436 | if (end1 == start2) |
| 3435 | { | 3437 | { |
| 3436 | combined_before_bytes_2 | 3438 | if (count_combining_before (BYTE_POS_ADDR (start2_byte), |
| 3437 | = count_combining_before (BYTE_POS_ADDR (start2_byte), | 3439 | len2_byte, start1, start1_byte) |
| 3438 | len2_byte, start1, start1_byte); | 3440 | || count_combining_before (BYTE_POS_ADDR (start1_byte), |
| 3439 | combined_before_bytes_1 | 3441 | len1_byte, end2, start2_byte + len2_byte) |
| 3440 | = count_combining_before (BYTE_POS_ADDR (start1_byte), | 3442 | || count_combining_after (BYTE_POS_ADDR (start1_byte), |
| 3441 | len1_byte, end2, start2_byte + len2_byte); | 3443 | len1_byte, end2, start2_byte + len2_byte)) |
| 3442 | combined_after_bytes_1 | 3444 | abort (); |
| 3443 | = count_combining_after (BYTE_POS_ADDR (start1_byte), | ||
| 3444 | len1_byte, end2, start2_byte + len2_byte); | ||
| 3445 | combined_after_bytes_2 = 0; | ||
| 3446 | } | 3445 | } |
| 3447 | else | 3446 | else |
| 3448 | { | 3447 | { |
| 3449 | combined_before_bytes_2 | 3448 | if (count_combining_before (BYTE_POS_ADDR (start2_byte), |
| 3450 | = count_combining_before (BYTE_POS_ADDR (start2_byte), | 3449 | len2_byte, start1, start1_byte) |
| 3451 | len2_byte, start1, start1_byte); | 3450 | || count_combining_before (BYTE_POS_ADDR (start1_byte), |
| 3452 | combined_before_bytes_1 | 3451 | len1_byte, start2, start2_byte) |
| 3453 | = count_combining_before (BYTE_POS_ADDR (start1_byte), | 3452 | || count_combining_after (BYTE_POS_ADDR (start2_byte), |
| 3454 | len1_byte, start2, start2_byte); | 3453 | len2_byte, end1, start1_byte + len1_byte) |
| 3455 | combined_after_bytes_2 | 3454 | || count_combining_after (BYTE_POS_ADDR (start1_byte), |
| 3456 | = count_combining_after (BYTE_POS_ADDR (start2_byte), | 3455 | len1_byte, end2, start2_byte + len2_byte)) |
| 3457 | len2_byte, end1, start1_byte + len1_byte); | 3456 | abort (); |
| 3458 | combined_after_bytes_1 | ||
| 3459 | = count_combining_after (BYTE_POS_ADDR (start1_byte), | ||
| 3460 | len1_byte, end2, start2_byte + len2_byte); | ||
| 3461 | } | 3457 | } |
| 3458 | #endif | ||
| 3462 | 3459 | ||
| 3463 | /* If any combining is going to happen, do this the stupid way, | ||
| 3464 | because replace handles combining properly. */ | ||
| 3465 | if (combined_before_bytes_1 || combined_before_bytes_2 | ||
| 3466 | || combined_after_bytes_1 || combined_after_bytes_2) | ||
| 3467 | { | ||
| 3468 | Lisp_Object text1, text2; | ||
| 3469 | |||
| 3470 | text1 = text2 = Qnil; | ||
| 3471 | GCPRO2 (text1, text2); | ||
| 3472 | |||
| 3473 | text1 = make_buffer_string_both (start1, start1_byte, | ||
| 3474 | end1, start1_byte + len1_byte, 1); | ||
| 3475 | text2 = make_buffer_string_both (start2, start2_byte, | ||
| 3476 | end2, start2_byte + len2_byte, 1); | ||
| 3477 | |||
| 3478 | transpose_markers (start1, end1, start2, end2, | ||
| 3479 | start1_byte, start1_byte + len1_byte, | ||
| 3480 | start2_byte, start2_byte + len2_byte); | ||
| 3481 | |||
| 3482 | replace_range (start2, end2, text1, 1, 0, 0); | ||
| 3483 | replace_range (start1, end1, text2, 1, 0, 0); | ||
| 3484 | |||
| 3485 | UNGCPRO; | ||
| 3486 | return Qnil; | ||
| 3487 | } | ||
| 3488 | |||
| 3489 | /* Hmmm... how about checking to see if the gap is large | 3460 | /* Hmmm... how about checking to see if the gap is large |
| 3490 | enough to use as the temporary storage? That would avoid an | 3461 | enough to use as the temporary storage? That would avoid an |
| 3491 | allocation... interesting. Later, don't fool with it now. */ | 3462 | allocation... interesting. Later, don't fool with it now. */ |