aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2001-02-27 03:28:48 +0000
committerKenichi Handa2001-02-27 03:28:48 +0000
commita8302ba35efcac4ae68254c8d20a21c10e9c8d1b (patch)
tree26c8f5f7f057f93615952f1195cb4a742143dc03
parentade8d05effec5591596588bd9e33b507e9aafba0 (diff)
downloademacs-a8302ba35efcac4ae68254c8d20a21c10e9c8d1b.tar.gz
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.
-rw-r--r--src/ccl.c22
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
730 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ 730 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
731 } while (0) 731 } while (0)
732 732
733/* Encode one character CH to multibyte form and write to the current
734 output buffer. The output bytes always forms a valid multibyte
735 sequence. */
736#define CCL_WRITE_MULTIBYTE_CHAR(ch) \
737 do { \
738 int bytes = CHAR_BYTES (ch); \
739 if (!dst) \
740 CCL_INVALID_CMD; \
741 else if (dst + bytes + extra_bytes < (dst_bytes ? dst_end : src)) \
742 { \
743 if (CHAR_VALID_P ((ch), 0)) \
744 dst += CHAR_STRING ((ch), dst); \
745 else \
746 CCL_INVALID_CMD; \
747 } \
748 else \
749 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
750 } while (0)
751
733/* Write a string at ccl_prog[IC] of length LEN to the current output 752/* Write a string at ccl_prog[IC] of length LEN to the current output
734 buffer. */ 753 buffer. */
735#define CCL_WRITE_STRING(len) \ 754#define CCL_WRITE_STRING(len) \
@@ -1340,7 +1359,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1340 else 1359 else
1341 i = ((i - 0xE0) << 14) | reg[rrr]; 1360 i = ((i - 0xE0) << 14) | reg[rrr];
1342 1361
1343 CCL_WRITE_CHAR (i); 1362 CCL_WRITE_MULTIBYTE_CHAR (i);
1344 1363
1345 break; 1364 break;
1346 1365
@@ -1805,6 +1824,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1805 ccl->ic = ic; 1824 ccl->ic = ic;
1806 ccl->stack_idx = stack_idx; 1825 ccl->stack_idx = stack_idx;
1807 ccl->prog = ccl_prog; 1826 ccl->prog = ccl_prog;
1827 ccl->eight_bit_control = (extra_bytes > 0);
1808 if (consumed) *consumed = src - source; 1828 if (consumed) *consumed = src - source;
1809 return (dst ? dst - destination : 0); 1829 return (dst ? dst - destination : 0);
1810} 1830}