aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-01-05 17:29:16 +0000
committerRichard M. Stallman1998-01-05 17:29:16 +0000
commitdc2a0b79d63fd55cdc4289c78d0e692a9d5b5dbf (patch)
tree92d01529b69c6c8c23af54ddd9f488676d5000c3 /src
parentfc4126860550e4e8f95e8e6e4bb5e953b1bca84a (diff)
downloademacs-dc2a0b79d63fd55cdc4289c78d0e692a9d5b5dbf.tar.gz
emacs-dc2a0b79d63fd55cdc4289c78d0e692a9d5b5dbf.zip
(print_string): Now static.
(print): When multibyte is disabled, print multibyte string chars using hex escapes. (printchar): Pass new arg to message_dolog. (strout): New arg MULTIBYTE. Callers changed. (strout): Take args SIZE and SIZE_BYTE; operate on both chars and bytes. (print_string): Pass new arg to strout. If not using strout, fetch a whole multibyte char at once. (write_string): Pass new arg to strout. (write_string_1): Likewise. (print) <case Lisp_String>: Scan by chars and bytes. (print) <case Lisp_Symbol>: Scan name by chars and bytes. (PRINTPREPARE): Use make_multibyte_string. Initialize print_buffer_pos_byte. Use insert_1_both. (printchar): Update print_buffer_pos_byte and print_buffer_pos. (print_buffer_pos_byte): New variable.
Diffstat (limited to 'src')
-rw-r--r--src/print.c257
1 files changed, 156 insertions, 101 deletions
diff --git a/src/print.c b/src/print.c
index c6c6c2b5294..038e6ff3d15 100644
--- a/src/print.c
+++ b/src/print.c
@@ -108,8 +108,10 @@ char *print_buffer;
108 108
109/* Size allocated in print_buffer. */ 109/* Size allocated in print_buffer. */
110int print_buffer_size; 110int print_buffer_size;
111/* Size used in print_buffer. */ 111/* Chars stored in print_buffer. */
112int print_buffer_pos; 112int print_buffer_pos;
113/* Bytes stored in print_buffer. */
114int print_buffer_pos_byte;
113 115
114/* Maximum length of list to print in full; noninteger means 116/* Maximum length of list to print in full; noninteger means
115 effectively infinity */ 117 effectively infinity */
@@ -252,10 +254,14 @@ glyph_to_str_cpy (glyphs, str)
252 } \ 254 } \
253 if (NILP (printcharfun)) \ 255 if (NILP (printcharfun)) \
254 { \ 256 { \
257 Lisp_Object string; \
255 if (print_buffer != 0) \ 258 if (print_buffer != 0) \
256 record_unwind_protect (print_unwind, \ 259 { \
257 make_string (print_buffer, \ 260 string = make_multibyte_string (print_buffer, \
258 print_buffer_pos)); \ 261 print_buffer_pos, \
262 print_buffer_pos_byte); \
263 record_unwind_protect (print_unwind, string); \
264 } \
259 else \ 265 else \
260 { \ 266 { \
261 print_buffer_size = 1000; \ 267 print_buffer_size = 1000; \
@@ -263,13 +269,15 @@ glyph_to_str_cpy (glyphs, str)
263 free_print_buffer = 1; \ 269 free_print_buffer = 1; \
264 } \ 270 } \
265 print_buffer_pos = 0; \ 271 print_buffer_pos = 0; \
272 print_buffer_pos_byte = 0; \
266 } \ 273 } \
267 if (!CONSP (Vprint_gensym)) \ 274 if (!CONSP (Vprint_gensym)) \
268 Vprint_gensym_alist = Qnil 275 Vprint_gensym_alist = Qnil
269 276
270#define PRINTFINISH \ 277#define PRINTFINISH \
271 if (NILP (printcharfun)) \ 278 if (NILP (printcharfun)) \
272 insert (print_buffer, print_buffer_pos); \ 279 insert_1_both (print_buffer, print_buffer_pos, \
280 print_buffer_pos_byte, 0, 1, 0); \
273 if (free_print_buffer) \ 281 if (free_print_buffer) \
274 { \ 282 { \
275 xfree (print_buffer); \ 283 xfree (print_buffer); \
@@ -328,11 +336,12 @@ printchar (ch, fun)
328 336
329 QUIT; 337 QUIT;
330 len = CHAR_STRING (ch, work, str); 338 len = CHAR_STRING (ch, work, str);
331 if (print_buffer_pos + len >= print_buffer_size) 339 if (print_buffer_pos_byte + len >= print_buffer_size)
332 print_buffer = (char *) xrealloc (print_buffer, 340 print_buffer = (char *) xrealloc (print_buffer,
333 print_buffer_size *= 2); 341 print_buffer_size *= 2);
334 bcopy (str, print_buffer + print_buffer_pos, len); 342 bcopy (str, print_buffer + print_buffer_pos_byte, len);
335 print_buffer_pos += len; 343 print_buffer_pos += 1;
344 print_buffer_pos_byte += len;
336 return; 345 return;
337 } 346 }
338 347
@@ -374,7 +383,7 @@ printchar (ch, fun)
374 } 383 }
375 } 384 }
376 385
377 message_dolog (str, len, 0); 386 message_dolog (str, len, 0, len > 1);
378 if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len) 387 if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len)
379 bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len), 388 bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len),
380 printbufidx += len; 389 printbufidx += len;
@@ -390,26 +399,28 @@ printchar (ch, fun)
390} 399}
391 400
392static void 401static void
393strout (ptr, size, printcharfun) 402strout (ptr, size, size_byte, printcharfun, multibyte)
394 char *ptr; 403 char *ptr;
395 int size; 404 int size, size_byte;
396 Lisp_Object printcharfun; 405 Lisp_Object printcharfun;
406 int multibyte;
397{ 407{
398 int i = 0; 408 int i = 0;
399 409
400 if (size < 0) 410 if (size < 0)
401 size = strlen (ptr); 411 size_byte = size = strlen (ptr);
402 412
403 if (EQ (printcharfun, Qnil)) 413 if (EQ (printcharfun, Qnil))
404 { 414 {
405 if (print_buffer_pos + size > print_buffer_size) 415 if (print_buffer_pos_byte + size_byte > print_buffer_size)
406 { 416 {
407 print_buffer_size = print_buffer_size * 2 + size; 417 print_buffer_size = print_buffer_size * 2 + size_byte;
408 print_buffer = (char *) xrealloc (print_buffer, 418 print_buffer = (char *) xrealloc (print_buffer,
409 print_buffer_size); 419 print_buffer_size);
410 } 420 }
411 bcopy (ptr, print_buffer + print_buffer_pos, size); 421 bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte);
412 print_buffer_pos += size; 422 print_buffer_pos += size;
423 print_buffer_pos_byte += size_byte;
413 424
414#ifdef MAX_PRINT_CHARS 425#ifdef MAX_PRINT_CHARS
415 if (max_print) 426 if (max_print)
@@ -431,7 +442,7 @@ strout (ptr, size, printcharfun)
431 442
432 if (noninteractive) 443 if (noninteractive)
433 { 444 {
434 fwrite (ptr, 1, size, stdout); 445 fwrite (ptr, 1, size_byte, stdout);
435 noninteractive_need_newline = 1; 446 noninteractive_need_newline = 1;
436 return; 447 return;
437 } 448 }
@@ -457,15 +468,15 @@ strout (ptr, size, printcharfun)
457 } 468 }
458 } 469 }
459 470
460 message_dolog (ptr, size, 0); 471 message_dolog (ptr, size_byte, 0, multibyte);
461 if (size > FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1) 472 if (size_byte > FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1)
462 { 473 {
463 size = FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1; 474 size_byte = FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1;
464 /* Rewind incomplete multi-byte form. */ 475 /* Rewind incomplete multi-byte form. */
465 while (size && (unsigned char) ptr[size] >= 0xA0) size--; 476 while (size_byte && (unsigned char) ptr[size] >= 0xA0) size--;
466 } 477 }
467 bcopy (ptr, &FRAME_MESSAGE_BUF (mini_frame) [printbufidx], size); 478 bcopy (ptr, &FRAME_MESSAGE_BUF (mini_frame) [printbufidx], size_byte);
468 printbufidx += size; 479 printbufidx += size_byte;
469 echo_area_glyphs_length = printbufidx; 480 echo_area_glyphs_length = printbufidx;
470 FRAME_MESSAGE_BUF (mini_frame) [printbufidx] = 0; 481 FRAME_MESSAGE_BUF (mini_frame) [printbufidx] = 0;
471 482
@@ -473,39 +484,65 @@ strout (ptr, size, printcharfun)
473 } 484 }
474 485
475 i = 0; 486 i = 0;
476 while (i < size) 487 if (size == size_byte)
477 { 488 while (i < size_byte)
478 /* Here, we must convert each multi-byte form to the 489 {
479 corresponding character code before handing it to PRINTCHAR. */ 490 int ch = ptr[i++];
480 int len;
481 int ch = STRING_CHAR_AND_LENGTH (ptr + i, size - i, len);
482 491
483 PRINTCHAR (ch); 492 PRINTCHAR (ch);
484 i += len; 493 }
485 } 494 else
495 while (i < size_byte)
496 {
497 /* Here, we must convert each multi-byte form to the
498 corresponding character code before handing it to PRINTCHAR. */
499 int len;
500 int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
501
502 PRINTCHAR (ch);
503 i += len;
504 }
486} 505}
487 506
488/* Print the contents of a string STRING using PRINTCHARFUN. 507/* Print the contents of a string STRING using PRINTCHARFUN.
489 It isn't safe to use strout in many cases, 508 It isn't safe to use strout in many cases,
490 because printing one char can relocate. */ 509 because printing one char can relocate. */
491 510
492void 511static void
493print_string (string, printcharfun) 512print_string (string, printcharfun)
494 Lisp_Object string; 513 Lisp_Object string;
495 Lisp_Object printcharfun; 514 Lisp_Object printcharfun;
496{ 515{
497 if (EQ (printcharfun, Qt) || NILP (printcharfun)) 516 if (EQ (printcharfun, Qt) || NILP (printcharfun))
498 /* strout is safe for output to a frame (echo area) or to print_buffer. */ 517 /* strout is safe for output to a frame (echo area) or to print_buffer. */
499 strout (XSTRING (string)->data, XSTRING (string)->size, printcharfun); 518 strout (XSTRING (string)->data,
519 XSTRING (string)->size,
520 XSTRING (string)->size_byte,
521 printcharfun, STRING_MULTIBYTE (string));
500 else 522 else
501 { 523 {
502 /* Otherwise, fetch the string address for each character. */ 524 /* Otherwise, string may be relocated by printing one char.
525 So re-fetch the string address for each character. */
503 int i; 526 int i;
504 int size = XSTRING (string)->size; 527 int size = XSTRING (string)->size;
528 int size_byte = XSTRING (string)->size_byte;
505 struct gcpro gcpro1; 529 struct gcpro gcpro1;
506 GCPRO1 (string); 530 GCPRO1 (string);
507 for (i = 0; i < size; i++) 531 if (size == size_byte)
508 PRINTCHAR (XSTRING (string)->data[i]); 532 for (i = 0; i < size; i++)
533 PRINTCHAR (XSTRING (string)->data[i]);
534 else
535 for (i = 0; i < size_byte; i++)
536 {
537 /* Here, we must convert each multi-byte form to the
538 corresponding character code before handing it to PRINTCHAR. */
539 int len;
540 int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i,
541 size_byte - i, len);
542
543 PRINTCHAR (ch);
544 i += len;
545 }
509 UNGCPRO; 546 UNGCPRO;
510 } 547 }
511} 548}
@@ -527,8 +564,8 @@ PRINTCHARFUN defaults to the value of `standard-output' (which see).")
527 return character; 564 return character;
528} 565}
529 566
530/* Used from outside of print.c to print a block of SIZE chars at DATA 567/* Used from outside of print.c to print a block of SIZE
531 on the default output stream. 568 single-byte chars at DATA on the default output stream.
532 Do not use this on the contents of a Lisp string. */ 569 Do not use this on the contents of a Lisp string. */
533 570
534void 571void
@@ -542,12 +579,12 @@ write_string (data, size)
542 printcharfun = Vstandard_output; 579 printcharfun = Vstandard_output;
543 580
544 PRINTPREPARE; 581 PRINTPREPARE;
545 strout (data, size, printcharfun); 582 strout (data, size, size, printcharfun, 0);
546 PRINTFINISH; 583 PRINTFINISH;
547} 584}
548 585
549/* Used from outside of print.c to print a block of SIZE chars at DATA 586/* Used from outside of print.c to print a block of SIZE
550 on a specified stream PRINTCHARFUN. 587 single-byte chars at DATA on a specified stream PRINTCHARFUN.
551 Do not use this on the contents of a Lisp string. */ 588 Do not use this on the contents of a Lisp string. */
552 589
553void 590void
@@ -559,7 +596,7 @@ write_string_1 (data, size, printcharfun)
559 PRINTDECLARE; 596 PRINTDECLARE;
560 597
561 PRINTPREPARE; 598 PRINTPREPARE;
562 strout (data, size, printcharfun); 599 strout (data, size, size, printcharfun, 0);
563 PRINTFINISH; 600 PRINTFINISH;
564} 601}
565 602
@@ -1023,7 +1060,7 @@ print (obj, printcharfun, escapeflag)
1023 if (EQ (obj, being_printed[i])) 1060 if (EQ (obj, being_printed[i]))
1024 { 1061 {
1025 sprintf (buf, "#%d", i); 1062 sprintf (buf, "#%d", i);
1026 strout (buf, -1, printcharfun); 1063 strout (buf, -1, -1, printcharfun, 0);
1027 return; 1064 return;
1028 } 1065 }
1029 } 1066 }
@@ -1051,7 +1088,7 @@ print (obj, printcharfun, escapeflag)
1051 sprintf (buf, "%ld", XINT (obj)); 1088 sprintf (buf, "%ld", XINT (obj));
1052 else 1089 else
1053 abort (); 1090 abort ();
1054 strout (buf, -1, printcharfun); 1091 strout (buf, -1, -1, printcharfun, 0);
1055 break; 1092 break;
1056 1093
1057#ifdef LISP_FLOAT_TYPE 1094#ifdef LISP_FLOAT_TYPE
@@ -1060,7 +1097,7 @@ print (obj, printcharfun, escapeflag)
1060 char pigbuf[350]; /* see comments in float_to_string */ 1097 char pigbuf[350]; /* see comments in float_to_string */
1061 1098
1062 float_to_string (pigbuf, XFLOAT(obj)->data); 1099 float_to_string (pigbuf, XFLOAT(obj)->data);
1063 strout (pigbuf, -1, printcharfun); 1100 strout (pigbuf, -1, -1, printcharfun, 0);
1064 } 1101 }
1065 break; 1102 break;
1066#endif 1103#endif
@@ -1070,10 +1107,10 @@ print (obj, printcharfun, escapeflag)
1070 print_string (obj, printcharfun); 1107 print_string (obj, printcharfun);
1071 else 1108 else
1072 { 1109 {
1073 register int i; 1110 register int i, i_byte;
1074 register unsigned char c; 1111 register unsigned char c;
1075 struct gcpro gcpro1; 1112 struct gcpro gcpro1;
1076 int size; 1113 int size_byte;
1077 1114
1078 GCPRO1 (obj); 1115 GCPRO1 (obj);
1079 1116
@@ -1086,15 +1123,20 @@ print (obj, printcharfun, escapeflag)
1086#endif 1123#endif
1087 1124
1088 PRINTCHAR ('\"'); 1125 PRINTCHAR ('\"');
1089 size = XSTRING (obj)->size; 1126 size_byte = XSTRING (obj)->size_byte;
1090 for (i = 0; i < size;) 1127
1128 for (i = 0, i_byte = 0; i_byte < size_byte;)
1091 { 1129 {
1092 /* Here, we must convert each multi-byte form to the 1130 /* Here, we must convert each multi-byte form to the
1093 corresponding character code before handing it to PRINTCHAR. */ 1131 corresponding character code before handing it to PRINTCHAR. */
1094 int len; 1132 int len;
1095 int c = STRING_CHAR_AND_LENGTH (&XSTRING (obj)->data[i], 1133 int c;
1096 size - i, len); 1134
1097 i += len; 1135 if (STRING_MULTIBYTE (obj))
1136 FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte);
1137 else
1138 c = XSTRING (obj)->data[i_byte++];
1139
1098 QUIT; 1140 QUIT;
1099 1141
1100 if (c == '\n' && print_escape_newlines) 1142 if (c == '\n' && print_escape_newlines)
@@ -1107,6 +1149,15 @@ print (obj, printcharfun, escapeflag)
1107 PRINTCHAR ('\\'); 1149 PRINTCHAR ('\\');
1108 PRINTCHAR ('f'); 1150 PRINTCHAR ('f');
1109 } 1151 }
1152 else if (! SINGLE_BYTE_CHAR_P (c)
1153 && NILP (current_buffer->enable_multibyte_characters))
1154 {
1155 /* When multibyte is disabled,
1156 print multibyte string chars using hex escapes. */
1157 unsigned char outbuf[50];
1158 sprintf (outbuf, "\\x%x", c);
1159 strout (outbuf, -1, -1, printcharfun, 0);
1160 }
1110 else 1161 else
1111 { 1162 {
1112 if (c == '\"' || c == '\\') 1163 if (c == '\"' || c == '\\')
@@ -1133,9 +1184,12 @@ print (obj, printcharfun, escapeflag)
1133 { 1184 {
1134 register int confusing; 1185 register int confusing;
1135 register unsigned char *p = XSYMBOL (obj)->name->data; 1186 register unsigned char *p = XSYMBOL (obj)->name->data;
1136 register unsigned char *end = p + XSYMBOL (obj)->name->size; 1187 register unsigned char *end = p + XSYMBOL (obj)->name->size_byte;
1137 register unsigned char c; 1188 register unsigned char c;
1138 int i, size; 1189 int i, i_byte, size_byte;
1190 Lisp_Object name;
1191
1192 XSETSTRING (name, XSYMBOL (obj)->name);
1139 1193
1140 if (p != end && (*p == '-' || *p == '+')) p++; 1194 if (p != end && (*p == '-' || *p == '+')) p++;
1141 if (p == end) 1195 if (p == end)
@@ -1192,15 +1246,18 @@ print (obj, printcharfun, escapeflag)
1192 PRINTCHAR (':'); 1246 PRINTCHAR (':');
1193 } 1247 }
1194 1248
1195 size = XSYMBOL (obj)->name->size; 1249 size_byte = XSTRING (name)->size_byte;
1196 for (i = 0; i < size;) 1250
1251 for (i = 0, i_byte = 0; i_byte < size_byte;)
1197 { 1252 {
1198 /* Here, we must convert each multi-byte form to the 1253 /* Here, we must convert each multi-byte form to the
1199 corresponding character code before handing it to PRINTCHAR. */ 1254 corresponding character code before handing it to PRINTCHAR. */
1200 int len; 1255
1201 int c = STRING_CHAR_AND_LENGTH (&XSYMBOL (obj)->name->data[i], 1256 if (STRING_MULTIBYTE (name))
1202 size - i, len); 1257 FETCH_STRING_CHAR_ADVANCE (c, name, i, i_byte);
1203 i += len; 1258 else
1259 c = XSTRING (name)->data[i_byte++];
1260
1204 QUIT; 1261 QUIT;
1205 1262
1206 if (escapeflag) 1263 if (escapeflag)
@@ -1221,7 +1278,7 @@ print (obj, printcharfun, escapeflag)
1221 /* If deeper than spec'd depth, print placeholder. */ 1278 /* If deeper than spec'd depth, print placeholder. */
1222 if (INTEGERP (Vprint_level) 1279 if (INTEGERP (Vprint_level)
1223 && print_depth > XINT (Vprint_level)) 1280 && print_depth > XINT (Vprint_level))
1224 strout ("...", -1, printcharfun); 1281 strout ("...", -1, -1, printcharfun, 0);
1225 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) 1282 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj)))
1226 && (EQ (XCAR (obj), Qquote))) 1283 && (EQ (XCAR (obj), Qquote)))
1227 { 1284 {
@@ -1262,7 +1319,7 @@ print (obj, printcharfun, escapeflag)
1262 PRINTCHAR (' '); 1319 PRINTCHAR (' ');
1263 if (max && i > max) 1320 if (max && i > max)
1264 { 1321 {
1265 strout ("...", 3, printcharfun); 1322 strout ("...", 3, 3, printcharfun, 0);
1266 break; 1323 break;
1267 } 1324 }
1268 print (XCAR (obj), printcharfun, escapeflag); 1325 print (XCAR (obj), printcharfun, escapeflag);
@@ -1271,7 +1328,7 @@ print (obj, printcharfun, escapeflag)
1271 } 1328 }
1272 if (!NILP (obj)) 1329 if (!NILP (obj))
1273 { 1330 {
1274 strout (" . ", 3, printcharfun); 1331 strout (" . ", 3, 3, printcharfun, 0);
1275 print (obj, printcharfun, escapeflag); 1332 print (obj, printcharfun, escapeflag);
1276 } 1333 }
1277 PRINTCHAR (')'); 1334 PRINTCHAR (')');
@@ -1283,7 +1340,7 @@ print (obj, printcharfun, escapeflag)
1283 { 1340 {
1284 if (escapeflag) 1341 if (escapeflag)
1285 { 1342 {
1286 strout ("#<process ", -1, printcharfun); 1343 strout ("#<process ", -1, -1, printcharfun, 0);
1287 print_string (XPROCESS (obj)->name, printcharfun); 1344 print_string (XPROCESS (obj)->name, printcharfun);
1288 PRINTCHAR ('>'); 1345 PRINTCHAR ('>');
1289 } 1346 }
@@ -1303,7 +1360,7 @@ print (obj, printcharfun, escapeflag)
1303 PRINTCHAR ('#'); 1360 PRINTCHAR ('#');
1304 PRINTCHAR ('&'); 1361 PRINTCHAR ('&');
1305 sprintf (buf, "%d", XBOOL_VECTOR (obj)->size); 1362 sprintf (buf, "%d", XBOOL_VECTOR (obj)->size);
1306 strout (buf, -1, printcharfun); 1363 strout (buf, -1, -1, printcharfun, 0);
1307 PRINTCHAR ('\"'); 1364 PRINTCHAR ('\"');
1308 1365
1309 /* Don't print more characters than the specified maximum. */ 1366 /* Don't print more characters than the specified maximum. */
@@ -1338,19 +1395,19 @@ print (obj, printcharfun, escapeflag)
1338 } 1395 }
1339 else if (SUBRP (obj)) 1396 else if (SUBRP (obj))
1340 { 1397 {
1341 strout ("#<subr ", -1, printcharfun); 1398 strout ("#<subr ", -1, -1, printcharfun, 0);
1342 strout (XSUBR (obj)->symbol_name, -1, printcharfun); 1399 strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun, 0);
1343 PRINTCHAR ('>'); 1400 PRINTCHAR ('>');
1344 } 1401 }
1345#ifndef standalone 1402#ifndef standalone
1346 else if (WINDOWP (obj)) 1403 else if (WINDOWP (obj))
1347 { 1404 {
1348 strout ("#<window ", -1, printcharfun); 1405 strout ("#<window ", -1, -1, printcharfun, 0);
1349 sprintf (buf, "%d", XFASTINT (XWINDOW (obj)->sequence_number)); 1406 sprintf (buf, "%d", XFASTINT (XWINDOW (obj)->sequence_number));
1350 strout (buf, -1, printcharfun); 1407 strout (buf, -1, -1, printcharfun, 0);
1351 if (!NILP (XWINDOW (obj)->buffer)) 1408 if (!NILP (XWINDOW (obj)->buffer))
1352 { 1409 {
1353 strout (" on ", -1, printcharfun); 1410 strout (" on ", -1, -1, printcharfun, 0);
1354 print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun); 1411 print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun);
1355 } 1412 }
1356 PRINTCHAR ('>'); 1413 PRINTCHAR ('>');
@@ -1358,10 +1415,10 @@ print (obj, printcharfun, escapeflag)
1358 else if (BUFFERP (obj)) 1415 else if (BUFFERP (obj))
1359 { 1416 {
1360 if (NILP (XBUFFER (obj)->name)) 1417 if (NILP (XBUFFER (obj)->name))
1361 strout ("#<killed buffer>", -1, printcharfun); 1418 strout ("#<killed buffer>", -1, -1, printcharfun, 0);
1362 else if (escapeflag) 1419 else if (escapeflag)
1363 { 1420 {
1364 strout ("#<buffer ", -1, printcharfun); 1421 strout ("#<buffer ", -1, -1, printcharfun, 0);
1365 print_string (XBUFFER (obj)->name, printcharfun); 1422 print_string (XBUFFER (obj)->name, printcharfun);
1366 PRINTCHAR ('>'); 1423 PRINTCHAR ('>');
1367 } 1424 }
@@ -1370,16 +1427,16 @@ print (obj, printcharfun, escapeflag)
1370 } 1427 }
1371 else if (WINDOW_CONFIGURATIONP (obj)) 1428 else if (WINDOW_CONFIGURATIONP (obj))
1372 { 1429 {
1373 strout ("#<window-configuration>", -1, printcharfun); 1430 strout ("#<window-configuration>", -1, -1, printcharfun, 0);
1374 } 1431 }
1375 else if (FRAMEP (obj)) 1432 else if (FRAMEP (obj))
1376 { 1433 {
1377 strout ((FRAME_LIVE_P (XFRAME (obj)) 1434 strout ((FRAME_LIVE_P (XFRAME (obj))
1378 ? "#<frame " : "#<dead frame "), 1435 ? "#<frame " : "#<dead frame "),
1379 -1, printcharfun); 1436 -1, -1, printcharfun, 0);
1380 print_string (XFRAME (obj)->name, printcharfun); 1437 print_string (XFRAME (obj)->name, printcharfun);
1381 sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj))); 1438 sprintf (buf, " 0x%lx\\ ", (unsigned long) (XFRAME (obj)));
1382 strout (buf, -1, printcharfun); 1439 strout (buf, -1, -1, printcharfun, 0);
1383 PRINTCHAR ('>'); 1440 PRINTCHAR ('>');
1384 } 1441 }
1385#endif /* not standalone */ 1442#endif /* not standalone */
@@ -1431,34 +1488,32 @@ print (obj, printcharfun, escapeflag)
1431 switch (XMISCTYPE (obj)) 1488 switch (XMISCTYPE (obj))
1432 { 1489 {
1433 case Lisp_Misc_Marker: 1490 case Lisp_Misc_Marker:
1434 strout ("#<marker ", -1, printcharfun); 1491 strout ("#<marker ", -1, -1, printcharfun, 0);
1435#if 0
1436 /* Do you think this is necessary? */ 1492 /* Do you think this is necessary? */
1437 if (XMARKER (obj)->insertion_type != 0) 1493 if (XMARKER (obj)->insertion_type != 0)
1438 strout ("(before-insertion) ", -1, printcharfun); 1494 strout ("(before-insertion) ", -1, -1, printcharfun, 0);
1439#endif /* 0 */
1440 if (!(XMARKER (obj)->buffer)) 1495 if (!(XMARKER (obj)->buffer))
1441 strout ("in no buffer", -1, printcharfun); 1496 strout ("in no buffer", -1, -1, printcharfun, 0);
1442 else 1497 else
1443 { 1498 {
1444 sprintf (buf, "at %d", marker_position (obj)); 1499 sprintf (buf, "at %d", marker_position (obj));
1445 strout (buf, -1, printcharfun); 1500 strout (buf, -1, -1, printcharfun, 0);
1446 strout (" in ", -1, printcharfun); 1501 strout (" in ", -1, -1, printcharfun, 0);
1447 print_string (XMARKER (obj)->buffer->name, printcharfun); 1502 print_string (XMARKER (obj)->buffer->name, printcharfun);
1448 } 1503 }
1449 PRINTCHAR ('>'); 1504 PRINTCHAR ('>');
1450 break; 1505 break;
1451 1506
1452 case Lisp_Misc_Overlay: 1507 case Lisp_Misc_Overlay:
1453 strout ("#<overlay ", -1, printcharfun); 1508 strout ("#<overlay ", -1, -1, printcharfun, 0);
1454 if (!(XMARKER (OVERLAY_START (obj))->buffer)) 1509 if (!(XMARKER (OVERLAY_START (obj))->buffer))
1455 strout ("in no buffer", -1, printcharfun); 1510 strout ("in no buffer", -1, -1, printcharfun, 0);
1456 else 1511 else
1457 { 1512 {
1458 sprintf (buf, "from %d to %d in ", 1513 sprintf (buf, "from %d to %d in ",
1459 marker_position (OVERLAY_START (obj)), 1514 marker_position (OVERLAY_START (obj)),
1460 marker_position (OVERLAY_END (obj))); 1515 marker_position (OVERLAY_END (obj)));
1461 strout (buf, -1, printcharfun); 1516 strout (buf, -1, -1, printcharfun, 0);
1462 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, 1517 print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
1463 printcharfun); 1518 printcharfun);
1464 } 1519 }
@@ -1468,28 +1523,28 @@ print (obj, printcharfun, escapeflag)
1468 /* Remaining cases shouldn't happen in normal usage, but let's print 1523 /* Remaining cases shouldn't happen in normal usage, but let's print
1469 them anyway for the benefit of the debugger. */ 1524 them anyway for the benefit of the debugger. */
1470 case Lisp_Misc_Free: 1525 case Lisp_Misc_Free:
1471 strout ("#<misc free cell>", -1, printcharfun); 1526 strout ("#<misc free cell>", -1, -1, printcharfun, 0);
1472 break; 1527 break;
1473 1528
1474 case Lisp_Misc_Intfwd: 1529 case Lisp_Misc_Intfwd:
1475 sprintf (buf, "#<intfwd to %d>", *XINTFWD (obj)->intvar); 1530 sprintf (buf, "#<intfwd to %d>", *XINTFWD (obj)->intvar);
1476 strout (buf, -1, printcharfun); 1531 strout (buf, -1, -1, printcharfun, 0);
1477 break; 1532 break;
1478 1533
1479 case Lisp_Misc_Boolfwd: 1534 case Lisp_Misc_Boolfwd:
1480 sprintf (buf, "#<boolfwd to %s>", 1535 sprintf (buf, "#<boolfwd to %s>",
1481 (*XBOOLFWD (obj)->boolvar ? "t" : "nil")); 1536 (*XBOOLFWD (obj)->boolvar ? "t" : "nil"));
1482 strout (buf, -1, printcharfun); 1537 strout (buf, -1, -1, printcharfun, 0);
1483 break; 1538 break;
1484 1539
1485 case Lisp_Misc_Objfwd: 1540 case Lisp_Misc_Objfwd:
1486 strout ("#<objfwd to ", -1, printcharfun); 1541 strout ("#<objfwd to ", -1, -1, printcharfun, 0);
1487 print (*XOBJFWD (obj)->objvar, printcharfun, escapeflag); 1542 print (*XOBJFWD (obj)->objvar, printcharfun, escapeflag);
1488 PRINTCHAR ('>'); 1543 PRINTCHAR ('>');
1489 break; 1544 break;
1490 1545
1491 case Lisp_Misc_Buffer_Objfwd: 1546 case Lisp_Misc_Buffer_Objfwd:
1492 strout ("#<buffer_objfwd to ", -1, printcharfun); 1547 strout ("#<buffer_objfwd to ", -1, -1, printcharfun, 0);
1493 print (*(Lisp_Object *)((char *)current_buffer 1548 print (*(Lisp_Object *)((char *)current_buffer
1494 + XBUFFER_OBJFWD (obj)->offset), 1549 + XBUFFER_OBJFWD (obj)->offset),
1495 printcharfun, escapeflag); 1550 printcharfun, escapeflag);
@@ -1497,7 +1552,7 @@ print (obj, printcharfun, escapeflag)
1497 break; 1552 break;
1498 1553
1499 case Lisp_Misc_Kboard_Objfwd: 1554 case Lisp_Misc_Kboard_Objfwd:
1500 strout ("#<kboard_objfwd to ", -1, printcharfun); 1555 strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0);
1501 print (*(Lisp_Object *)((char *) current_kboard 1556 print (*(Lisp_Object *)((char *) current_kboard
1502 + XKBOARD_OBJFWD (obj)->offset), 1557 + XKBOARD_OBJFWD (obj)->offset),
1503 printcharfun, escapeflag); 1558 printcharfun, escapeflag);
@@ -1505,20 +1560,20 @@ print (obj, printcharfun, escapeflag)
1505 break; 1560 break;
1506 1561
1507 case Lisp_Misc_Buffer_Local_Value: 1562 case Lisp_Misc_Buffer_Local_Value:
1508 strout ("#<buffer_local_value ", -1, printcharfun); 1563 strout ("#<buffer_local_value ", -1, -1, printcharfun, 0);
1509 goto do_buffer_local; 1564 goto do_buffer_local;
1510 case Lisp_Misc_Some_Buffer_Local_Value: 1565 case Lisp_Misc_Some_Buffer_Local_Value:
1511 strout ("#<some_buffer_local_value ", -1, printcharfun); 1566 strout ("#<some_buffer_local_value ", -1, -1, printcharfun, 0);
1512 do_buffer_local: 1567 do_buffer_local:
1513 strout ("[realvalue] ", -1, printcharfun); 1568 strout ("[realvalue] ", -1, -1, printcharfun, 0);
1514 print (XBUFFER_LOCAL_VALUE (obj)->car, printcharfun, escapeflag); 1569 print (XBUFFER_LOCAL_VALUE (obj)->car, printcharfun, escapeflag);
1515 strout ("[buffer] ", -1, printcharfun); 1570 strout ("[buffer] ", -1, -1, printcharfun, 0);
1516 print (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->car, 1571 print (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->car,
1517 printcharfun, escapeflag); 1572 printcharfun, escapeflag);
1518 strout ("[alist-elt] ", -1, printcharfun); 1573 strout ("[alist-elt] ", -1, -1, printcharfun, 0);
1519 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->car, 1574 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->car,
1520 printcharfun, escapeflag); 1575 printcharfun, escapeflag);
1521 strout ("[default-value] ", -1, printcharfun); 1576 strout ("[default-value] ", -1, -1, printcharfun, 0);
1522 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->cdr, 1577 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->cdr,
1523 printcharfun, escapeflag); 1578 printcharfun, escapeflag);
1524 PRINTCHAR ('>'); 1579 PRINTCHAR ('>');
@@ -1535,16 +1590,16 @@ print (obj, printcharfun, escapeflag)
1535 { 1590 {
1536 /* We're in trouble if this happens! 1591 /* We're in trouble if this happens!
1537 Probably should just abort () */ 1592 Probably should just abort () */
1538 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, printcharfun); 1593 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun, 0);
1539 if (MISCP (obj)) 1594 if (MISCP (obj))
1540 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); 1595 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
1541 else if (VECTORLIKEP (obj)) 1596 else if (VECTORLIKEP (obj))
1542 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); 1597 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
1543 else 1598 else
1544 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); 1599 sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
1545 strout (buf, -1, printcharfun); 1600 strout (buf, -1, -1, printcharfun, 0);
1546 strout (" Save your buffers immediately and please report this bug>", 1601 strout (" Save your buffers immediately and please report this bug>",
1547 -1, printcharfun); 1602 -1, -1, printcharfun, 0);
1548 } 1603 }
1549 } 1604 }
1550 1605