Mercurial > emacs
comparison src/term.c @ 26999:5d0057e6170e
(encode_terminal_code): Adjusted for the change of struct
glyph and GLYPH_FROM_CHAR_GLYPH.
(write_glyphs) (insert_glyphs) (append_glyph): Adjusted for the
change of struct glyph.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 27 Dec 1999 05:07:56 +0000 |
parents | 264b83a3a688 |
children | 59913a531d4e |
comparison
equal
deleted
inserted
replaced
26998:02e902f732d1 | 26999:5d0057e6170e |
---|---|
937 ? &terminal_coding | 937 ? &terminal_coding |
938 : &safe_terminal_coding); | 938 : &safe_terminal_coding); |
939 | 939 |
940 while (src < src_end) | 940 while (src < src_end) |
941 { | 941 { |
942 g = GLYPH_FROM_CHAR_GLYPH (*src); | |
943 | |
944 /* We must skip glyphs to be padded for a wide character. */ | 942 /* We must skip glyphs to be padded for a wide character. */ |
945 if (! CHAR_GLYPH_PADDING_P (*src)) | 943 if (! CHAR_GLYPH_PADDING_P (*src)) |
946 { | 944 { |
947 c = src->u.ch.code; | 945 g = GLYPH_FROM_CHAR_GLYPH (src[0]); |
948 if (! GLYPH_CHAR_VALID_P (c)) | 946 |
947 if (g < 0 || g >= tlen) | |
949 { | 948 { |
950 c = ' '; | 949 /* This glyph doesn't has an entry in Vglyph_table. */ |
951 g = MAKE_GLYPH (sf, c, GLYPH_FACE (sf, g)); | 950 if (! CHAR_VALID_P (src->u.ch, 0)) |
952 } | 951 { |
953 if (c < tlen) | 952 len = 1; |
954 { | 953 buf = " "; |
955 /* G has an entry in Vglyph_table, | 954 } |
956 so process any alias before testing for simpleness. */ | 955 else |
957 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); | 956 { |
958 c = GLYPH_CHAR (sf, g); | 957 len = CHAR_STRING (src->u.ch, workbuf); |
959 } | 958 buf = workbuf; |
960 if (GLYPH_SIMPLE_P (tbase, tlen, g)) | 959 } |
961 { | |
962 /* We set the multi-byte form of C at WORKBUF. */ | |
963 len = CHAR_STRING (c, workbuf); | |
964 buf = workbuf; | |
965 } | 960 } |
966 else | 961 else |
967 { | 962 { |
968 /* We have a string in Vglyph_table. */ | 963 /* This glyph has an entry in Vglyph_table, |
969 len = GLYPH_LENGTH (tbase, g); | 964 so process any alias before testing for simpleness. */ |
970 buf = GLYPH_STRING (tbase, g); | 965 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
966 | |
967 if (GLYPH_SIMPLE_P (tbase, tlen, g)) | |
968 { | |
969 /* We set the multi-byte form of C at WORKBUF. */ | |
970 len = CHAR_STRING (src->u.ch, workbuf); | |
971 buf = workbuf; | |
972 } | |
973 else | |
974 { | |
975 /* We have a string in Vglyph_table. */ | |
976 len = GLYPH_LENGTH (tbase, g); | |
977 buf = GLYPH_STRING (tbase, g); | |
978 } | |
971 } | 979 } |
972 | 980 |
973 result = encode_coding (coding, buf, dst, len, dst_end - dst); | 981 result = encode_coding (coding, buf, dst, len, dst_end - dst); |
974 len -= coding->consumed; | 982 len -= coding->consumed; |
975 dst += coding->produced; | 983 dst += coding->produced; |
1034 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; | 1042 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
1035 | 1043 |
1036 while (len > 0) | 1044 while (len > 0) |
1037 { | 1045 { |
1038 /* Identify a run of glyphs with the same face. */ | 1046 /* Identify a run of glyphs with the same face. */ |
1039 int face_id = string->u.ch.face_id; | 1047 int face_id = string->face_id; |
1040 int n; | 1048 int n; |
1041 | 1049 |
1042 for (n = 1; n < len; ++n) | 1050 for (n = 1; n < len; ++n) |
1043 if (string[n].u.ch.face_id != face_id) | 1051 if (string[n].face_id != face_id) |
1044 break; | 1052 break; |
1045 | 1053 |
1046 /* Turn appearance modes of the face of the run on. */ | 1054 /* Turn appearance modes of the face of the run on. */ |
1047 turn_on_face (f, face_id); | 1055 turn_on_face (f, face_id); |
1048 | 1056 |
1097 insert_glyphs (start, len) | 1105 insert_glyphs (start, len) |
1098 register struct glyph *start; | 1106 register struct glyph *start; |
1099 register int len; | 1107 register int len; |
1100 { | 1108 { |
1101 char *buf; | 1109 char *buf; |
1102 GLYPH g; | 1110 struct glyph *glyph; |
1103 struct frame *f, *sf; | 1111 struct frame *f, *sf; |
1104 | 1112 |
1105 if (len <= 0) | 1113 if (len <= 0) |
1106 return; | 1114 return; |
1107 | 1115 |
1130 /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */ | 1138 /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */ |
1131 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; | 1139 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
1132 while (len-- > 0) | 1140 while (len-- > 0) |
1133 { | 1141 { |
1134 int produced, consumed; | 1142 int produced, consumed; |
1135 struct glyph glyph; | |
1136 | 1143 |
1137 OUTPUT1_IF (TS_ins_char); | 1144 OUTPUT1_IF (TS_ins_char); |
1138 if (!start) | 1145 if (!start) |
1139 g = SPACEGLYPH; | 1146 { |
1147 conversion_buffer[0] = SPACEGLYPH; | |
1148 produced = 1; | |
1149 } | |
1140 else | 1150 else |
1141 { | 1151 { |
1142 g = GLYPH_FROM_CHAR_GLYPH (*start); | 1152 turn_on_face (f, start->face_id); |
1153 glyph= start; | |
1143 ++start; | 1154 ++start; |
1144 /* We must open sufficient space for a character which | 1155 /* We must open sufficient space for a character which |
1145 occupies more than one column. */ | 1156 occupies more than one column. */ |
1146 while (len && CHAR_GLYPH_PADDING_P (*start)) | 1157 while (len && CHAR_GLYPH_PADDING_P (*start)) |
1147 { | 1158 { |
1148 OUTPUT1_IF (TS_ins_char); | 1159 OUTPUT1_IF (TS_ins_char); |
1149 start++, len--; | 1160 start++, len--; |
1150 } | 1161 } |
1162 | |
1163 if (len <= 0) | |
1164 /* This is the last glyph. */ | |
1165 terminal_coding.mode |= CODING_MODE_LAST_BLOCK; | |
1166 | |
1167 /* We use shared conversion buffer of the current size (1024 | |
1168 bytes at least). It is surely sufficient for just one glyph. */ | |
1169 produced = encode_terminal_code (&glyph, conversion_buffer, 1, | |
1170 conversion_buffer_size, &consumed); | |
1151 } | 1171 } |
1152 | 1172 |
1153 if (len <= 0) | |
1154 /* This is the last glyph. */ | |
1155 terminal_coding.mode |= CODING_MODE_LAST_BLOCK; | |
1156 | |
1157 /* We use shared conversion buffer of the current size (1024 | |
1158 bytes at least). It is surely sufficient for just one glyph. */ | |
1159 SET_CHAR_GLYPH_FROM_GLYPH (glyph, g); | |
1160 turn_on_face (f, glyph.u.ch.face_id); | |
1161 produced = encode_terminal_code (&glyph, conversion_buffer, | |
1162 1, conversion_buffer_size, &consumed); | |
1163 if (produced > 0) | 1173 if (produced > 0) |
1164 { | 1174 { |
1165 fwrite (conversion_buffer, 1, produced, stdout); | 1175 fwrite (conversion_buffer, 1, produced, stdout); |
1166 if (ferror (stdout)) | 1176 if (ferror (stdout)) |
1167 clearerr (stdout); | 1177 clearerr (stdout); |
1168 if (termscript) | 1178 if (termscript) |
1169 fwrite (conversion_buffer, 1, produced, termscript); | 1179 fwrite (conversion_buffer, 1, produced, termscript); |
1170 } | 1180 } |
1171 | 1181 |
1172 OUTPUT1_IF (TS_pad_inserted_char); | 1182 OUTPUT1_IF (TS_pad_inserted_char); |
1173 turn_off_face (f, glyph.u.ch.face_id); | 1183 if (start) |
1184 turn_off_face (f, glyph->face_id); | |
1174 } | 1185 } |
1175 | 1186 |
1176 cmcheckmagic (); | 1187 cmcheckmagic (); |
1177 } | 1188 } |
1178 | 1189 |
1750 i < it->pixel_width && glyph < end; | 1761 i < it->pixel_width && glyph < end; |
1751 ++i) | 1762 ++i) |
1752 { | 1763 { |
1753 glyph->type = CHAR_GLYPH; | 1764 glyph->type = CHAR_GLYPH; |
1754 glyph->pixel_width = 1; | 1765 glyph->pixel_width = 1; |
1755 glyph->u.ch.code = it->c; | 1766 glyph->u.ch = it->c; |
1756 glyph->u.ch.face_id = it->face_id; | 1767 glyph->face_id = it->face_id; |
1757 glyph->u.ch.padding_p = i > 0; | 1768 glyph->padding_p = i > 0; |
1758 glyph->charpos = CHARPOS (it->position); | 1769 glyph->charpos = CHARPOS (it->position); |
1759 glyph->object = it->object; | 1770 glyph->object = it->object; |
1760 | 1771 |
1761 ++it->glyph_row->used[it->area]; | 1772 ++it->glyph_row->used[it->area]; |
1762 ++glyph; | 1773 ++glyph; |