comparison src/ccl.c @ 51326:92b845a3d3a6

(CCL_WRITE_CHAR): Increment extra_bytes only when it is nonzero. (ccl_driver): Initialize extra_bytes to ccl->eight_bit_control. (setup_ccl_program): Initialize ccl->eight_bit_control to zero.
author Kenichi Handa <handa@m17n.org>
date Fri, 30 May 2003 07:56:08 +0000
parents 23a1cea22d13
children 695cf19ef79e
comparison
equal deleted inserted replaced
51325:6ef863c4a5d8 51326:92b845a3d3a6
728 else if (dst + bytes + extra_bytes < (dst_bytes ? dst_end : src)) \ 728 else if (dst + bytes + extra_bytes < (dst_bytes ? dst_end : src)) \
729 { \ 729 { \
730 if (bytes == 1) \ 730 if (bytes == 1) \
731 { \ 731 { \
732 *dst++ = (ch); \ 732 *dst++ = (ch); \
733 if ((ch) >= 0x80 && (ch) < 0xA0) \ 733 if (extra_bytes && (ch) >= 0x80 && (ch) < 0xA0) \
734 /* We may have to convert this eight-bit char to \ 734 /* We may have to convert this eight-bit char to \
735 multibyte form later. */ \ 735 multibyte form later. */ \
736 extra_bytes++; \ 736 extra_bytes++; \
737 } \ 737 } \
738 else if (CHAR_VALID_P (ch, 0)) \ 738 else if (CHAR_VALID_P (ch, 0)) \
885 int this_ic = 0; 885 int this_ic = 0;
886 /* CCL_WRITE_CHAR will produce 8-bit code of range 0x80..0x9F. But, 886 /* CCL_WRITE_CHAR will produce 8-bit code of range 0x80..0x9F. But,
887 each of them will be converted to multibyte form of 2-byte 887 each of them will be converted to multibyte form of 2-byte
888 sequence. For that conversion, we remember how many more bytes 888 sequence. For that conversion, we remember how many more bytes
889 we must keep in DESTINATION in this variable. */ 889 we must keep in DESTINATION in this variable. */
890 int extra_bytes = 0; 890 int extra_bytes = ccl->eight_bit_control;
891 891
892 if (ic >= ccl->eof_ic) 892 if (ic >= ccl->eof_ic)
893 ic = CCL_HEADER_MAIN; 893 ic = CCL_HEADER_MAIN;
894 894
895 if (ccl->buf_magnification == 0) /* We can't produce any bytes. */ 895 if (ccl->buf_magnification == 0) /* We can't produce any bytes. */
1903 1903
1904 ccl_finish: 1904 ccl_finish:
1905 ccl->ic = ic; 1905 ccl->ic = ic;
1906 ccl->stack_idx = stack_idx; 1906 ccl->stack_idx = stack_idx;
1907 ccl->prog = ccl_prog; 1907 ccl->prog = ccl_prog;
1908 ccl->eight_bit_control = (extra_bytes > 0); 1908 ccl->eight_bit_control = (extra_bytes > 1);
1909 if (consumed) 1909 if (consumed)
1910 *consumed = src - source; 1910 *consumed = src - source;
1911 return (dst ? dst - destination : 0); 1911 return (dst ? dst - destination : 0);
1912 } 1912 }
1913 1913
2058 ccl->private_state = 0; 2058 ccl->private_state = 0;
2059 ccl->status = 0; 2059 ccl->status = 0;
2060 ccl->stack_idx = 0; 2060 ccl->stack_idx = 0;
2061 ccl->eol_type = CODING_EOL_LF; 2061 ccl->eol_type = CODING_EOL_LF;
2062 ccl->suppress_error = 0; 2062 ccl->suppress_error = 0;
2063 ccl->eight_bit_control = 0;
2063 return 0; 2064 return 0;
2064 } 2065 }
2065 2066
2066 DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0, 2067 DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0,
2067 doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code. 2068 doc: /* Return t if OBJECT is a CCL program name or a compiled CCL program code.