comparison src/print.c @ 22183:3eedfddbbadd

(print_string): Don't ignore garbage bytes following a multibyte characters. (print): Likewise.
author Kenichi Handa <handa@m17n.org>
date Fri, 22 May 1998 09:44:27 +0000
parents fa9ff387d260
children 35af9a276272
comparison
equal deleted inserted replaced
22182:8075f717f3e4 22183:3eedfddbbadd
587 for (i = 0; i < size_byte; i++) 587 for (i = 0; i < size_byte; i++)
588 { 588 {
589 /* Here, we must convert each multi-byte form to the 589 /* Here, we must convert each multi-byte form to the
590 corresponding character code before handing it to PRINTCHAR. */ 590 corresponding character code before handing it to PRINTCHAR. */
591 int len; 591 int len;
592 int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i, 592 int ch = STRING_CHAR_AND_CHAR_LENGTH (XSTRING (string)->data + i,
593 size_byte - i, len); 593 size_byte - i, len);
594 594
595 PRINTCHAR (ch); 595 PRINTCHAR (ch);
596 i += len; 596 i += len;
597 } 597 }
598 UNGCPRO; 598 UNGCPRO;
1186 else 1186 else
1187 { 1187 {
1188 register int i, i_byte; 1188 register int i, i_byte;
1189 register unsigned char c; 1189 register unsigned char c;
1190 struct gcpro gcpro1; 1190 struct gcpro gcpro1;
1191 unsigned char *str;
1191 int size_byte; 1192 int size_byte;
1192 /* 1 means we must ensure that the next character we output 1193 /* 1 means we must ensure that the next character we output
1193 cannot be taken as part of a hex character escape. */ 1194 cannot be taken as part of a hex character escape. */
1194 int need_nonhex = 0; 1195 int need_nonhex = 0;
1195 1196
1202 PRINTCHAR ('('); 1203 PRINTCHAR ('(');
1203 } 1204 }
1204 #endif 1205 #endif
1205 1206
1206 PRINTCHAR ('\"'); 1207 PRINTCHAR ('\"');
1208 str = XSTRING (obj)->data;
1207 size_byte = STRING_BYTES (XSTRING (obj)); 1209 size_byte = STRING_BYTES (XSTRING (obj));
1208 1210
1209 for (i = 0, i_byte = 0; i_byte < size_byte;) 1211 for (i = 0, i_byte = 0; i_byte < size_byte;)
1210 { 1212 {
1211 /* Here, we must convert each multi-byte form to the 1213 /* Here, we must convert each multi-byte form to the
1212 corresponding character code before handing it to PRINTCHAR. */ 1214 corresponding character code before handing it to PRINTCHAR. */
1213 int len; 1215 int len;
1214 int c; 1216 int c;
1215 1217
1216 if (STRING_MULTIBYTE (obj)) 1218 if (STRING_MULTIBYTE (obj))
1217 FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte); 1219 {
1220 c = STRING_CHAR_AND_CHAR_LENGTH (str + i_byte,
1221 size_byte - i_byte, len);
1222 i_byte += len;
1223 }
1218 else 1224 else
1219 c = XSTRING (obj)->data[i_byte++]; 1225 c = str[i_byte++];
1220 1226
1221 QUIT; 1227 QUIT;
1222 1228
1223 if (c == '\n' && print_escape_newlines) 1229 if (c == '\n' && print_escape_newlines)
1224 { 1230 {