diff options
author | Kenichi Handa <handa@m17n.org> | 2001-02-27 03:28:48 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2001-02-27 03:28:48 +0000 |
commit | a8302ba35efcac4ae68254c8d20a21c10e9c8d1b (patch) | |
tree | 26c8f5f7f057f93615952f1195cb4a742143dc03 /src/ccl.c | |
parent | ade8d05effec5591596588bd9e33b507e9aafba0 (diff) | |
download | emacs-a8302ba35efcac4ae68254c8d20a21c10e9c8d1b.tar.gz emacs-a8302ba35efcac4ae68254c8d20a21c10e9c8d1b.tar.bz2 emacs-a8302ba35efcac4ae68254c8d20a21c10e9c8d1b.zip |
(CCL_WRITE_MULTIBYTE_CHAR): New macro.
(ccl_driver) <CCL_WriteMultibyteChar2>: Use
CCL_WRITE_MULTIBYTE_CHAR instead of CCL_WRITE_CHAR.
<ccl_finish>: Set ccl->eight_bit_control properly.
Diffstat (limited to 'src/ccl.c')
-rw-r--r-- | src/ccl.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ccl.c b/src/ccl.c index fe7faafb9e5..718563d5529 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -730,6 +730,25 @@ else CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ } while (0) +/* Encode one character CH to multibyte form and write to the current + output buffer. The output bytes always forms a valid multibyte + sequence. */ +#define CCL_WRITE_MULTIBYTE_CHAR(ch) \ + do { \ + int bytes = CHAR_BYTES (ch); \ + if (!dst) \ + CCL_INVALID_CMD; \ + else if (dst + bytes + extra_bytes < (dst_bytes ? dst_end : src)) \ + { \ + if (CHAR_VALID_P ((ch), 0)) \ + dst += CHAR_STRING ((ch), dst); \ + else \ + CCL_INVALID_CMD; \ + } \ + else \ + CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ + } while (0) + /* Write a string at ccl_prog[IC] of length LEN to the current output buffer. */ #define CCL_WRITE_STRING(len) \ @@ -1340,7 +1359,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed) else i = ((i - 0xE0) << 14) | reg[rrr]; - CCL_WRITE_CHAR (i); + CCL_WRITE_MULTIBYTE_CHAR (i); break; @@ -1805,6 +1824,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed) ccl->ic = ic; ccl->stack_idx = stack_idx; ccl->prog = ccl_prog; + ccl->eight_bit_control = (extra_bytes > 0); if (consumed) *consumed = src - source; return (dst ? dst - destination : 0); } |