Mercurial > emacs
comparison src/term.c @ 89483:2f877ed80fa6
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 08 Sep 2003 12:53:41 +0000 |
parents | 375f2633d815 c6ed294ee664 |
children | d193de460ec1 |
comparison
equal
deleted
inserted
replaced
88123:375f2633d815 | 89483:2f877ed80fa6 |
---|---|
27 #include <string.h> | 27 #include <string.h> |
28 | 28 |
29 #include "termchar.h" | 29 #include "termchar.h" |
30 #include "termopts.h" | 30 #include "termopts.h" |
31 #include "lisp.h" | 31 #include "lisp.h" |
32 #include "buffer.h" | |
33 #include "character.h" | |
32 #include "charset.h" | 34 #include "charset.h" |
33 #include "coding.h" | 35 #include "coding.h" |
34 #include "keyboard.h" | 36 #include "keyboard.h" |
35 #include "frame.h" | 37 #include "frame.h" |
36 #include "disptab.h" | 38 #include "disptab.h" |
808 unsigned char workbuf[MAX_MULTIBYTE_LENGTH]; | 810 unsigned char workbuf[MAX_MULTIBYTE_LENGTH]; |
809 const unsigned char *buf; | 811 const unsigned char *buf; |
810 int len; | 812 int len; |
811 register int tlen = GLYPH_TABLE_LENGTH; | 813 register int tlen = GLYPH_TABLE_LENGTH; |
812 register Lisp_Object *tbase = GLYPH_TABLE_BASE; | 814 register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
813 int result; | |
814 struct coding_system *coding; | 815 struct coding_system *coding; |
815 | 816 |
816 /* If terminal_coding does any conversion, use it, otherwise use | 817 /* If terminal_coding does any conversion, use it, otherwise use |
817 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here | 818 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
818 because it always return 1 if the member src_multibyte is 1. */ | 819 because it always return 1 if the member src_multibyte is 1. */ |
827 { | 828 { |
828 g = GLYPH_FROM_CHAR_GLYPH (src[0]); | 829 g = GLYPH_FROM_CHAR_GLYPH (src[0]); |
829 | 830 |
830 if (g < 0 || g >= tlen) | 831 if (g < 0 || g >= tlen) |
831 { | 832 { |
832 /* This glyph doesn't has an entry in Vglyph_table. */ | 833 /* This glyph doesn't have an entry in Vglyph_table. */ |
833 if (! CHAR_VALID_P (src->u.ch, 0)) | 834 if (! CHAR_VALID_P (src->u.ch, 0)) |
834 { | 835 { |
835 len = 1; | 836 len = 1; |
836 buf = " "; | 837 buf = " "; |
837 coding->src_multibyte = 0; | 838 coding->src_multibyte = 0; |
866 buf = GLYPH_STRING (tbase, g); | 867 buf = GLYPH_STRING (tbase, g); |
867 coding->src_multibyte = STRING_MULTIBYTE (tbase[g]); | 868 coding->src_multibyte = STRING_MULTIBYTE (tbase[g]); |
868 } | 869 } |
869 } | 870 } |
870 | 871 |
871 result = encode_coding (coding, buf, dst, len, dst_end - dst); | 872 coding->source = buf; |
873 coding->destination = dst; | |
874 coding->dst_bytes = dst_end - dst; | |
875 encode_coding_object (coding, Qnil, 0, 0, 1, len, Qnil); | |
872 len -= coding->consumed; | 876 len -= coding->consumed; |
873 dst += coding->produced; | 877 dst += coding->produced; |
874 if (result == CODING_FINISH_INSUFFICIENT_DST | 878 if (coding->result == CODING_RESULT_INSUFFICIENT_DST) |
875 || (result == CODING_FINISH_INSUFFICIENT_SRC | |
876 && len > dst_end - dst)) | |
877 /* The remaining output buffer is too short. We must | 879 /* The remaining output buffer is too short. We must |
878 break the loop here without increasing SRC so that the | 880 break the loop here without increasing SRC so that the |
879 next call of this function starts from the same glyph. */ | 881 next call of this function starts from the same glyph. */ |
880 break; | 882 break; |
881 | 883 |
975 | 977 |
976 /* We may have to output some codes to terminate the writing. */ | 978 /* We may have to output some codes to terminate the writing. */ |
977 if (CODING_REQUIRE_FLUSHING (&terminal_coding)) | 979 if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
978 { | 980 { |
979 terminal_coding.mode |= CODING_MODE_LAST_BLOCK; | 981 terminal_coding.mode |= CODING_MODE_LAST_BLOCK; |
980 encode_coding (&terminal_coding, "", conversion_buffer, | 982 terminal_coding.source = (unsigned char *) ""; |
981 0, conversion_buffer_size); | 983 terminal_coding.destination = conversion_buffer; |
984 terminal_coding.dst_bytes = conversion_buffer_size; | |
985 encode_coding_object (&terminal_coding, Qnil, 0, 0, 0, 0, Qnil); | |
982 if (terminal_coding.produced > 0) | 986 if (terminal_coding.produced > 0) |
983 { | 987 { |
984 fwrite (conversion_buffer, 1, terminal_coding.produced, stdout); | 988 fwrite (conversion_buffer, 1, terminal_coding.produced, stdout); |
985 if (ferror (stdout)) | 989 if (ferror (stdout)) |
986 clearerr (stdout); | 990 clearerr (stdout); |
1719 if (it->glyph_row) | 1723 if (it->glyph_row) |
1720 append_glyph (it); | 1724 append_glyph (it); |
1721 } | 1725 } |
1722 else | 1726 else |
1723 { | 1727 { |
1724 /* A multi-byte character. The display width is fixed for all | 1728 it->pixel_width = CHAR_WIDTH (it->c); |
1725 characters of the set. Some of the glyphs may have to be | |
1726 ignored because they are already displayed in a continued | |
1727 line. */ | |
1728 int charset = CHAR_CHARSET (it->c); | |
1729 | |
1730 it->pixel_width = CHARSET_WIDTH (charset); | |
1731 it->nglyphs = it->pixel_width; | 1729 it->nglyphs = it->pixel_width; |
1732 | 1730 |
1733 if (it->glyph_row) | 1731 if (it->glyph_row) |
1734 append_glyph (it); | 1732 append_glyph (it); |
1735 } | 1733 } |