diff options
| author | Kenichi Handa | 2004-05-10 03:56:43 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-05-10 03:56:43 +0000 |
| commit | a54ad22035c9927e89821cf48ae51d20f24e2d78 (patch) | |
| tree | 8f6bab5f13651c1bbc0461ff5ff9cad5379cb778 /src | |
| parent | efde45ca30cab8414d279d52189ffb8138a8f99f (diff) | |
| download | emacs-a54ad22035c9927e89821cf48ae51d20f24e2d78.tar.gz emacs-a54ad22035c9927e89821cf48ae51d20f24e2d78.zip | |
(count_combining): Delete it.
(concat): Don't check combining bytes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 42 |
1 files changed, 4 insertions, 38 deletions
| @@ -527,27 +527,6 @@ with the original. */) | |||
| 527 | return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); | 527 | return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | /* In string STR of length LEN, see if bytes before STR[I] combine | ||
| 531 | with bytes after STR[I] to form a single character. If so, return | ||
| 532 | the number of bytes after STR[I] which combine in this way. | ||
| 533 | Otherwize, return 0. */ | ||
| 534 | |||
| 535 | static int | ||
| 536 | count_combining (str, len, i) | ||
| 537 | unsigned char *str; | ||
| 538 | int len, i; | ||
| 539 | { | ||
| 540 | int j = i - 1, bytes; | ||
| 541 | |||
| 542 | if (i == 0 || i == len || CHAR_HEAD_P (str[i])) | ||
| 543 | return 0; | ||
| 544 | while (j >= 0 && !CHAR_HEAD_P (str[j])) j--; | ||
| 545 | if (j < 0 || ! BASE_LEADING_CODE_P (str[j])) | ||
| 546 | return 0; | ||
| 547 | PARSE_MULTIBYTE_SEQ (str + j, len - j, bytes); | ||
| 548 | return (bytes <= i - j ? 0 : bytes - (i - j)); | ||
| 549 | } | ||
| 550 | |||
| 551 | /* This structure holds information of an argument of `concat' that is | 530 | /* This structure holds information of an argument of `concat' that is |
| 552 | a string and has text properties to be copied. */ | 531 | a string and has text properties to be copied. */ |
| 553 | struct textprop_rec | 532 | struct textprop_rec |
| @@ -710,25 +689,18 @@ concat (nargs, args, target_type, last_special) | |||
| 710 | && STRING_MULTIBYTE (this) == some_multibyte) | 689 | && STRING_MULTIBYTE (this) == some_multibyte) |
| 711 | { | 690 | { |
| 712 | int thislen_byte = SBYTES (this); | 691 | int thislen_byte = SBYTES (this); |
| 713 | int combined; | ||
| 714 | 692 | ||
| 715 | bcopy (SDATA (this), SDATA (val) + toindex_byte, | 693 | bcopy (SDATA (this), SDATA (val) + toindex_byte, |
| 716 | SBYTES (this)); | 694 | SBYTES (this)); |
| 717 | combined = (some_multibyte && toindex_byte > 0 | ||
| 718 | ? count_combining (SDATA (val), | ||
| 719 | toindex_byte + thislen_byte, | ||
| 720 | toindex_byte) | ||
| 721 | : 0); | ||
| 722 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) | 695 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) |
| 723 | { | 696 | { |
| 724 | textprops[num_textprops].argnum = argnum; | 697 | textprops[num_textprops].argnum = argnum; |
| 725 | /* We ignore text properties on characters being combined. */ | 698 | textprops[num_textprops].from = 0; |
| 726 | textprops[num_textprops].from = combined; | ||
| 727 | textprops[num_textprops++].to = toindex; | 699 | textprops[num_textprops++].to = toindex; |
| 728 | } | 700 | } |
| 729 | toindex_byte += thislen_byte; | 701 | toindex_byte += thislen_byte; |
| 730 | toindex += thisleni - combined; | 702 | toindex += thisleni; |
| 731 | STRING_SET_CHARS (val, SCHARS (val) - combined); | 703 | STRING_SET_CHARS (val, SCHARS (val)); |
| 732 | } | 704 | } |
| 733 | /* Copy a single-byte string to a multibyte string. */ | 705 | /* Copy a single-byte string to a multibyte string. */ |
| 734 | else if (STRINGP (this) && STRINGP (val)) | 706 | else if (STRINGP (this) && STRINGP (val)) |
| @@ -814,13 +786,7 @@ concat (nargs, args, target_type, last_special) | |||
| 814 | SDATA (val) + toindex_byte); | 786 | SDATA (val) + toindex_byte); |
| 815 | else | 787 | else |
| 816 | SSET (val, toindex_byte++, XINT (elt)); | 788 | SSET (val, toindex_byte++, XINT (elt)); |
| 817 | if (some_multibyte | 789 | toindex++; |
| 818 | && toindex_byte > 0 | ||
| 819 | && count_combining (SDATA (val), | ||
| 820 | toindex_byte, toindex_byte - 1)) | ||
| 821 | STRING_SET_CHARS (val, SCHARS (val) - 1); | ||
| 822 | else | ||
| 823 | toindex++; | ||
| 824 | } | 790 | } |
| 825 | else | 791 | else |
| 826 | /* If we have any multibyte characters, | 792 | /* If we have any multibyte characters, |