diff options
| author | Kenichi Handa | 2001-02-07 04:24:49 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2001-02-07 04:24:49 +0000 |
| commit | 740f080d0996dd1e5c4a6cccfd0c67b1a7a40f78 (patch) | |
| tree | 8f22c7f60632c98c1fbcf92b9a8739e6d410cd3b /src | |
| parent | 347abaf72193544780fd81a7f0d6cc49f66afe4d (diff) | |
| download | emacs-740f080d0996dd1e5c4a6cccfd0c67b1a7a40f78.tar.gz emacs-740f080d0996dd1e5c4a6cccfd0c67b1a7a40f78.zip | |
(parse_str_to_multibyte): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/charset.c b/src/charset.c index a7522c4cf4e..4bad7b5ab28 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1535,6 +1535,23 @@ str_as_multibyte (str, len, nbytes, nchars) | |||
| 1535 | return (to - str); | 1535 | return (to - str); |
| 1536 | } | 1536 | } |
| 1537 | 1537 | ||
| 1538 | /* Parse unibyte string at STR of LEN bytes, and return the number of | ||
| 1539 | bytes it may ocupy when converted to multibyte string by | ||
| 1540 | `str_to_multibyte'. */ | ||
| 1541 | |||
| 1542 | int | ||
| 1543 | parse_str_to_multibyte (str, len) | ||
| 1544 | unsigned char *str; | ||
| 1545 | int len; | ||
| 1546 | { | ||
| 1547 | unsigned char *endp = str + len; | ||
| 1548 | int bytes; | ||
| 1549 | |||
| 1550 | for (bytes = 0; str < endp; str++) | ||
| 1551 | bytes += (*str < 0x80 || *str >= 0xA0) ? 1 : 2; | ||
| 1552 | return bytes; | ||
| 1553 | } | ||
| 1554 | |||
| 1538 | /* Convert unibyte text at STR of NBYTES bytes to multibyte text | 1555 | /* Convert unibyte text at STR of NBYTES bytes to multibyte text |
| 1539 | that contains the same single-byte characters. It actually | 1556 | that contains the same single-byte characters. It actually |
| 1540 | converts all 8-bit characters to multibyte forms. It is assured | 1557 | converts all 8-bit characters to multibyte forms. It is assured |