1 /* Lisp object printing and output streams.
2 Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
32 #include "dispextern.h"
35 #endif /* not standalone */
37 #ifdef USE_TEXT_PROPERTIES
38 #include "intervals.h"
41 Lisp_Object Vstandard_output
, Qstandard_output
;
43 /* These are used to print like we read. */
44 extern Lisp_Object Qbackquote
, Qcomma
, Qcomma_at
, Qcomma_dot
, Qfunction
;
46 #ifdef LISP_FLOAT_TYPE
47 Lisp_Object Vfloat_output_format
, Qfloat_output_format
;
49 /* Work around a problem that happens because math.h on hpux 7
50 defines two static variables--which, in Emacs, are not really static,
51 because `static' is defined as nothing. The problem is that they are
52 defined both here and in lread.c.
53 These macros prevent the name conflict. */
54 #if defined (HPUX) && !defined (HPUX8)
55 #define _MAXLDBL print_maxldbl
56 #define _NMAXLDBL print_nmaxldbl
66 /* Default to values appropriate for IEEE floating point. */
71 #define DBL_MANT_DIG 53
77 #define DBL_MIN 2.2250738585072014e-308
80 #ifdef DBL_MIN_REPLACEMENT
82 #define DBL_MIN DBL_MIN_REPLACEMENT
85 /* Define DOUBLE_DIGITS_BOUND, an upper bound on the number of decimal digits
86 needed to express a float without losing information.
87 The general-case formula is valid for the usual case, IEEE floating point,
88 but many compilers can't optimize the formula to an integer constant,
89 so make a special case for it. */
90 #if FLT_RADIX == 2 && DBL_MANT_DIG == 53
91 #define DOUBLE_DIGITS_BOUND 17 /* IEEE floating point */
93 #define DOUBLE_DIGITS_BOUND ((int) ceil (log10 (pow (FLT_RADIX, DBL_MANT_DIG))))
96 #endif /* LISP_FLOAT_TYPE */
98 /* Avoid actual stack overflow in print. */
101 /* Detect most circularities to print finite output. */
102 #define PRINT_CIRCLE 200
103 Lisp_Object being_printed
[PRINT_CIRCLE
];
105 /* When printing into a buffer, first we put the text in this
106 block, then insert it all at once. */
109 /* Size allocated in print_buffer. */
110 int print_buffer_size
;
111 /* Chars stored in print_buffer. */
112 int print_buffer_pos
;
113 /* Bytes stored in print_buffer. */
114 int print_buffer_pos_byte
;
116 /* Maximum length of list to print in full; noninteger means
117 effectively infinity */
119 Lisp_Object Vprint_length
;
121 /* Maximum depth of list to print in full; noninteger means
122 effectively infinity. */
124 Lisp_Object Vprint_level
;
126 /* Nonzero means print newlines in strings as \n. */
128 int print_escape_newlines
;
130 Lisp_Object Qprint_escape_newlines
;
132 /* Nonzero means print (quote foo) forms as 'foo, etc. */
136 /* Non-nil means print #: before uninterned symbols.
137 Neither t nor nil means so that and don't clear Vprint_gensym_alist
138 on entry to and exit from print functions. */
140 Lisp_Object Vprint_gensym
;
142 /* Association list of certain objects that are `eq' in the form being
143 printed and which should be `eq' when read back in, using the #n=object
144 and #n# reader forms. Each element has the form (object . n). */
146 Lisp_Object Vprint_gensym_alist
;
148 /* Nonzero means print newline to stdout before next minibuffer message.
149 Defined in xdisp.c */
151 extern int noninteractive_need_newline
;
153 extern int minibuffer_auto_raise
;
155 #ifdef MAX_PRINT_CHARS
156 static int print_chars
;
157 static int max_print
;
158 #endif /* MAX_PRINT_CHARS */
160 void print_interval ();
163 /* Convert between chars and GLYPHs */
167 register GLYPH
*glyphs
;
177 str_to_glyph_cpy (str
, glyphs
)
181 register GLYPH
*gp
= glyphs
;
182 register char *cp
= str
;
189 str_to_glyph_ncpy (str
, glyphs
, n
)
194 register GLYPH
*gp
= glyphs
;
195 register char *cp
= str
;
202 glyph_to_str_cpy (glyphs
, str
)
206 register GLYPH
*gp
= glyphs
;
207 register char *cp
= str
;
210 *str
++ = *gp
++ & 0377;
214 /* Low level output routines for characters and strings */
216 /* Lisp functions to do output using a stream
217 must have the stream in a variable called printcharfun
218 and must start with PRINTPREPARE, end with PRINTFINISH,
219 and use PRINTDECLARE to declare common variables.
220 Use PRINTCHAR to output one character,
221 or call strout to output a block of characters.
224 #define PRINTDECLARE \
225 struct buffer *old = current_buffer; \
226 int old_point = -1, start_point; \
227 int old_point_byte, start_point_byte; \
228 int specpdl_count = specpdl_ptr - specpdl; \
229 int free_print_buffer = 0; \
232 #define PRINTPREPARE \
233 original = printcharfun; \
234 if (NILP (printcharfun)) printcharfun = Qt; \
235 if (BUFFERP (printcharfun)) \
237 if (XBUFFER (printcharfun) != current_buffer) \
238 Fset_buffer (printcharfun); \
239 printcharfun = Qnil; \
241 if (MARKERP (printcharfun)) \
243 if (!(XMARKER (original)->buffer)) \
244 error ("Marker does not point anywhere"); \
245 if (XMARKER (original)->buffer != current_buffer) \
246 set_buffer_internal (XMARKER (original)->buffer); \
248 old_point_byte = PT_BYTE; \
249 SET_PT_BOTH (marker_position (printcharfun), \
250 marker_byte_position (printcharfun)); \
252 start_point_byte = PT_BYTE; \
253 printcharfun = Qnil; \
255 if (NILP (printcharfun)) \
257 Lisp_Object string; \
258 if (print_buffer != 0) \
260 string = make_multibyte_string (print_buffer, \
262 print_buffer_pos_byte); \
263 record_unwind_protect (print_unwind, string); \
267 print_buffer_size = 1000; \
268 print_buffer = (char *) xmalloc (print_buffer_size); \
269 free_print_buffer = 1; \
271 print_buffer_pos = 0; \
272 print_buffer_pos_byte = 0; \
274 if (!CONSP (Vprint_gensym)) \
275 Vprint_gensym_alist = Qnil
277 #define PRINTFINISH \
278 if (NILP (printcharfun)) \
279 insert_1_both (print_buffer, print_buffer_pos, \
280 print_buffer_pos_byte, 0, 1, 0); \
281 if (free_print_buffer) \
283 xfree (print_buffer); \
286 unbind_to (specpdl_count, Qnil); \
287 if (MARKERP (original)) \
288 set_marker_both (original, Qnil, PT, PT_BYTE); \
289 if (old_point >= 0) \
290 SET_PT_BOTH (old_point + (old_point >= start_point \
291 ? PT - start_point : 0), \
292 old_point_byte + (old_point_byte >= start_point_byte \
293 ? PT_BYTE - start_point_byte : 0)); \
294 if (old != current_buffer) \
295 set_buffer_internal (old); \
296 if (!CONSP (Vprint_gensym)) \
297 Vprint_gensym_alist = Qnil
299 #define PRINTCHAR(ch) printchar (ch, printcharfun)
301 /* Nonzero if there is no room to print any more characters
302 so print might as well return right away. */
304 #define PRINTFULLP() \
305 (EQ (printcharfun, Qt) && !noninteractive \
306 && printbufidx >= FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window)))))
308 /* This is used to restore the saved contents of print_buffer
309 when there is a recursive call to print. */
311 print_unwind (saved_text
)
312 Lisp_Object saved_text
;
314 bcopy (XSTRING (saved_text
)->data
, print_buffer
, XSTRING (saved_text
)->size
);
317 /* Index of first unused element of FRAME_MESSAGE_BUF (mini_frame). */
318 static int printbufidx
;
327 #ifdef MAX_PRINT_CHARS
330 #endif /* MAX_PRINT_CHARS */
335 unsigned char work
[4], *str
;
338 len
= CHAR_STRING (ch
, work
, str
);
339 if (print_buffer_pos_byte
+ len
>= print_buffer_size
)
340 print_buffer
= (char *) xrealloc (print_buffer
,
341 print_buffer_size
*= 2);
342 bcopy (str
, print_buffer
+ print_buffer_pos_byte
, len
);
343 print_buffer_pos
+= 1;
344 print_buffer_pos_byte
+= len
;
351 = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window
)));
352 unsigned char work
[4], *str
;
353 int len
= CHAR_STRING (ch
, work
, str
);
360 putchar (*str
), str
++;
361 noninteractive_need_newline
= 1;
365 if (echo_area_glyphs
!= FRAME_MESSAGE_BUF (mini_frame
)
366 || !message_buf_print
)
368 message_log_maybe_newline ();
369 echo_area_glyphs
= FRAME_MESSAGE_BUF (mini_frame
);
371 echo_area_glyphs_length
= 0;
372 message_buf_print
= 1;
374 if (minibuffer_auto_raise
)
376 Lisp_Object mini_window
;
378 /* Get the frame containing the minibuffer
379 that the selected frame is using. */
380 mini_window
= FRAME_MINIBUF_WINDOW (selected_frame
);
382 Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window
)));
386 message_dolog (str
, len
, 0, len
> 1);
387 if (printbufidx
< FRAME_MESSAGE_BUF_SIZE (mini_frame
) - len
)
388 bcopy (str
, &FRAME_MESSAGE_BUF (mini_frame
)[printbufidx
], len
),
390 FRAME_MESSAGE_BUF (mini_frame
)[printbufidx
] = 0;
391 echo_area_glyphs_length
= printbufidx
;
395 #endif /* not standalone */
397 XSETFASTINT (ch1
, ch
);
402 strout (ptr
, size
, size_byte
, printcharfun
, multibyte
)
405 Lisp_Object printcharfun
;
411 size_byte
= size
= strlen (ptr
);
413 if (EQ (printcharfun
, Qnil
))
415 if (print_buffer_pos_byte
+ size_byte
> print_buffer_size
)
417 print_buffer_size
= print_buffer_size
* 2 + size_byte
;
418 print_buffer
= (char *) xrealloc (print_buffer
,
421 bcopy (ptr
, print_buffer
+ print_buffer_pos_byte
, size_byte
);
422 print_buffer_pos
+= size
;
423 print_buffer_pos_byte
+= size_byte
;
425 #ifdef MAX_PRINT_CHARS
428 #endif /* MAX_PRINT_CHARS */
431 if (EQ (printcharfun
, Qt
))
434 = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window
)));
438 #ifdef MAX_PRINT_CHARS
441 #endif /* MAX_PRINT_CHARS */
445 fwrite (ptr
, 1, size_byte
, stdout
);
446 noninteractive_need_newline
= 1;
450 if (echo_area_glyphs
!= FRAME_MESSAGE_BUF (mini_frame
)
451 || !message_buf_print
)
453 message_log_maybe_newline ();
454 echo_area_glyphs
= FRAME_MESSAGE_BUF (mini_frame
);
456 echo_area_glyphs_length
= 0;
457 message_buf_print
= 1;
459 if (minibuffer_auto_raise
)
461 Lisp_Object mini_window
;
463 /* Get the frame containing the minibuffer
464 that the selected frame is using. */
465 mini_window
= FRAME_MINIBUF_WINDOW (selected_frame
);
467 Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window
)));
471 message_dolog (ptr
, size_byte
, 0, multibyte
);
472 if (size_byte
> FRAME_MESSAGE_BUF_SIZE (mini_frame
) - printbufidx
- 1)
474 size_byte
= FRAME_MESSAGE_BUF_SIZE (mini_frame
) - printbufidx
- 1;
475 /* Rewind incomplete multi-byte form. */
476 while (size_byte
&& (unsigned char) ptr
[size
] >= 0xA0) size
--;
478 bcopy (ptr
, &FRAME_MESSAGE_BUF (mini_frame
) [printbufidx
], size_byte
);
479 printbufidx
+= size_byte
;
480 echo_area_glyphs_length
= printbufidx
;
481 FRAME_MESSAGE_BUF (mini_frame
) [printbufidx
] = 0;
487 if (size
== size_byte
)
488 while (i
< size_byte
)
495 while (i
< size_byte
)
497 /* Here, we must convert each multi-byte form to the
498 corresponding character code before handing it to PRINTCHAR. */
500 int ch
= STRING_CHAR_AND_LENGTH (ptr
+ i
, size_byte
- i
, len
);
507 /* Print the contents of a string STRING using PRINTCHARFUN.
508 It isn't safe to use strout in many cases,
509 because printing one char can relocate. */
512 print_string (string
, printcharfun
)
514 Lisp_Object printcharfun
;
516 if (EQ (printcharfun
, Qt
) || NILP (printcharfun
))
517 /* strout is safe for output to a frame (echo area) or to print_buffer. */
518 strout (XSTRING (string
)->data
,
519 XSTRING (string
)->size
,
520 XSTRING (string
)->size_byte
,
521 printcharfun
, STRING_MULTIBYTE (string
));
524 /* Otherwise, string may be relocated by printing one char.
525 So re-fetch the string address for each character. */
527 int size
= XSTRING (string
)->size
;
528 int size_byte
= XSTRING (string
)->size_byte
;
531 if (size
== size_byte
)
532 for (i
= 0; i
< size
; i
++)
533 PRINTCHAR (XSTRING (string
)->data
[i
]);
535 for (i
= 0; i
< size_byte
; i
++)
537 /* Here, we must convert each multi-byte form to the
538 corresponding character code before handing it to PRINTCHAR. */
540 int ch
= STRING_CHAR_AND_LENGTH (XSTRING (string
)->data
+ i
,
550 DEFUN ("write-char", Fwrite_char
, Swrite_char
, 1, 2, 0,
551 "Output character CHARACTER to stream PRINTCHARFUN.\n\
552 PRINTCHARFUN defaults to the value of `standard-output' (which see).")
553 (character
, printcharfun
)
554 Lisp_Object character
, printcharfun
;
558 if (NILP (printcharfun
))
559 printcharfun
= Vstandard_output
;
560 CHECK_NUMBER (character
, 0);
562 PRINTCHAR (XINT (character
));
567 /* Used from outside of print.c to print a block of SIZE
568 single-byte chars at DATA on the default output stream.
569 Do not use this on the contents of a Lisp string. */
572 write_string (data
, size
)
577 Lisp_Object printcharfun
;
579 printcharfun
= Vstandard_output
;
582 strout (data
, size
, size
, printcharfun
, 0);
586 /* Used from outside of print.c to print a block of SIZE
587 single-byte chars at DATA on a specified stream PRINTCHARFUN.
588 Do not use this on the contents of a Lisp string. */
591 write_string_1 (data
, size
, printcharfun
)
594 Lisp_Object printcharfun
;
599 strout (data
, size
, size
, printcharfun
, 0);
607 temp_output_buffer_setup (bufname
)
610 register struct buffer
*old
= current_buffer
;
611 register Lisp_Object buf
;
613 Fset_buffer (Fget_buffer_create (build_string (bufname
)));
615 current_buffer
->directory
= old
->directory
;
616 current_buffer
->read_only
= Qnil
;
619 XSETBUFFER (buf
, current_buffer
);
620 specbind (Qstandard_output
, buf
);
622 set_buffer_internal (old
);
626 internal_with_output_to_temp_buffer (bufname
, function
, args
)
628 Lisp_Object (*function
) ();
631 int count
= specpdl_ptr
- specpdl
;
632 Lisp_Object buf
, val
;
636 record_unwind_protect (Fset_buffer
, Fcurrent_buffer ());
637 temp_output_buffer_setup (bufname
);
638 buf
= Vstandard_output
;
641 val
= (*function
) (args
);
644 temp_output_buffer_show (buf
);
647 return unbind_to (count
, val
);
650 DEFUN ("with-output-to-temp-buffer", Fwith_output_to_temp_buffer
, Swith_output_to_temp_buffer
,
652 "Bind `standard-output' to buffer BUFNAME, eval BODY, then show that buffer.\n\
653 The buffer is cleared out initially, and marked as unmodified when done.\n\
654 All output done by BODY is inserted in that buffer by default.\n\
655 The buffer is displayed in another window, but not selected.\n\
656 The value of the last form in BODY is returned.\n\
657 If BODY does not finish normally, the buffer BUFNAME is not displayed.\n\n\
658 If variable `temp-buffer-show-function' is non-nil, call it at the end\n\
659 to get the buffer displayed. It gets one argument, the buffer to display.")
665 int count
= specpdl_ptr
- specpdl
;
666 Lisp_Object buf
, val
;
669 name
= Feval (Fcar (args
));
672 CHECK_STRING (name
, 0);
673 temp_output_buffer_setup (XSTRING (name
)->data
);
674 buf
= Vstandard_output
;
676 val
= Fprogn (Fcdr (args
));
678 temp_output_buffer_show (buf
);
680 return unbind_to (count
, val
);
682 #endif /* not standalone */
684 static void print ();
686 DEFUN ("terpri", Fterpri
, Sterpri
, 0, 1, 0,
687 "Output a newline to stream PRINTCHARFUN.\n\
688 If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used.")
690 Lisp_Object printcharfun
;
694 if (NILP (printcharfun
))
695 printcharfun
= Vstandard_output
;
702 DEFUN ("prin1", Fprin1
, Sprin1
, 1, 2, 0,
703 "Output the printed representation of OBJECT, any Lisp object.\n\
704 Quoting characters are printed when needed to make output that `read'\n\
705 can handle, whenever this is possible.\n\
706 Output stream is PRINTCHARFUN, or value of `standard-output' (which see).")
707 (object
, printcharfun
)
708 Lisp_Object object
, printcharfun
;
712 #ifdef MAX_PRINT_CHARS
714 #endif /* MAX_PRINT_CHARS */
715 if (NILP (printcharfun
))
716 printcharfun
= Vstandard_output
;
719 print (object
, printcharfun
, 1);
724 /* a buffer which is used to hold output being built by prin1-to-string */
725 Lisp_Object Vprin1_to_string_buffer
;
727 DEFUN ("prin1-to-string", Fprin1_to_string
, Sprin1_to_string
, 1, 2, 0,
728 "Return a string containing the printed representation of OBJECT,\n\
729 any Lisp object. Quoting characters are used when needed to make output\n\
730 that `read' can handle, whenever this is possible, unless the optional\n\
731 second argument NOESCAPE is non-nil.")
733 Lisp_Object object
, noescape
;
736 Lisp_Object printcharfun
;
737 struct gcpro gcpro1
, gcpro2
;
740 /* Save and restore this--we are altering a buffer
741 but we don't want to deactivate the mark just for that.
742 No need for specbind, since errors deactivate the mark. */
743 tem
= Vdeactivate_mark
;
744 GCPRO2 (object
, tem
);
746 printcharfun
= Vprin1_to_string_buffer
;
749 print (object
, printcharfun
, NILP (noescape
));
750 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */
752 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer
));
753 object
= Fbuffer_string ();
756 set_buffer_internal (old
);
758 Vdeactivate_mark
= tem
;
764 DEFUN ("princ", Fprinc
, Sprinc
, 1, 2, 0,
765 "Output the printed representation of OBJECT, any Lisp object.\n\
766 No quoting characters are used; no delimiters are printed around\n\
767 the contents of strings.\n\
768 Output stream is PRINTCHARFUN, or value of standard-output (which see).")
769 (object
, printcharfun
)
770 Lisp_Object object
, printcharfun
;
774 if (NILP (printcharfun
))
775 printcharfun
= Vstandard_output
;
778 print (object
, printcharfun
, 0);
783 DEFUN ("print", Fprint
, Sprint
, 1, 2, 0,
784 "Output the printed representation of OBJECT, with newlines around it.\n\
785 Quoting characters are printed when needed to make output that `read'\n\
786 can handle, whenever this is possible.\n\
787 Output stream is PRINTCHARFUN, or value of `standard-output' (which see).")
788 (object
, printcharfun
)
789 Lisp_Object object
, printcharfun
;
794 #ifdef MAX_PRINT_CHARS
796 max_print
= MAX_PRINT_CHARS
;
797 #endif /* MAX_PRINT_CHARS */
798 if (NILP (printcharfun
))
799 printcharfun
= Vstandard_output
;
804 print (object
, printcharfun
, 1);
807 #ifdef MAX_PRINT_CHARS
810 #endif /* MAX_PRINT_CHARS */
815 /* The subroutine object for external-debugging-output is kept here
816 for the convenience of the debugger. */
817 Lisp_Object Qexternal_debugging_output
;
819 DEFUN ("external-debugging-output", Fexternal_debugging_output
, Sexternal_debugging_output
, 1, 1, 0,
820 "Write CHARACTER to stderr.\n\
821 You can call print while debugging emacs, and pass it this function\n\
822 to make it write to the debugging output.\n")
824 Lisp_Object character
;
826 CHECK_NUMBER (character
, 0);
827 putc (XINT (character
), stderr
);
830 /* Send the output to a debugger (nothing happens if there isn't one). */
832 char buf
[2] = {(char) XINT (character
), '\0'};
833 OutputDebugString (buf
);
840 /* This is the interface for debugging printing. */
846 Fprin1 (arg
, Qexternal_debugging_output
);
847 fprintf (stderr
, "\r\n");
850 DEFUN ("error-message-string", Ferror_message_string
, Serror_message_string
,
852 "Convert an error value (ERROR-SYMBOL . DATA) to an error message.")
856 struct buffer
*old
= current_buffer
;
857 Lisp_Object original
, printcharfun
, value
;
860 /* If OBJ is (error STRING), just return STRING.
861 That is not only faster, it also avoids the need to allocate
862 space here when the error is due to memory full. */
863 if (CONSP (obj
) && EQ (XCONS (obj
)->car
, Qerror
)
864 && CONSP (XCONS (obj
)->cdr
)
865 && STRINGP (XCONS (XCONS (obj
)->cdr
)->car
)
866 && NILP (XCONS (XCONS (obj
)->cdr
)->cdr
))
867 return XCONS (XCONS (obj
)->cdr
)->car
;
869 print_error_message (obj
, Vprin1_to_string_buffer
);
871 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer
));
872 value
= Fbuffer_string ();
876 set_buffer_internal (old
);
882 /* Print an error message for the error DATA
883 onto Lisp output stream STREAM (suitable for the print functions). */
886 print_error_message (data
, stream
)
887 Lisp_Object data
, stream
;
889 Lisp_Object errname
, errmsg
, file_error
, tail
;
893 errname
= Fcar (data
);
895 if (EQ (errname
, Qerror
))
898 if (!CONSP (data
)) data
= Qnil
;
899 errmsg
= Fcar (data
);
904 errmsg
= Fget (errname
, Qerror_message
);
905 file_error
= Fmemq (Qfile_error
,
906 Fget (errname
, Qerror_conditions
));
909 /* Print an error message including the data items. */
911 tail
= Fcdr_safe (data
);
914 /* For file-error, make error message by concatenating
915 all the data items. They are all strings. */
916 if (!NILP (file_error
) && !NILP (tail
))
917 errmsg
= XCONS (tail
)->car
, tail
= XCONS (tail
)->cdr
;
919 if (STRINGP (errmsg
))
920 Fprinc (errmsg
, stream
);
922 write_string_1 ("peculiar error", -1, stream
);
924 for (i
= 0; CONSP (tail
); tail
= Fcdr (tail
), i
++)
926 write_string_1 (i
? ", " : ": ", 2, stream
);
927 if (!NILP (file_error
))
928 Fprinc (Fcar (tail
), stream
);
930 Fprin1 (Fcar (tail
), stream
);
935 #ifdef LISP_FLOAT_TYPE
938 * The buffer should be at least as large as the max string size of the
939 * largest float, printed in the biggest notation. This is undoubtedly
940 * 20d float_output_format, with the negative of the C-constant "HUGE"
943 * On the vax the worst case is -1e38 in 20d format which takes 61 bytes.
945 * I assume that IEEE-754 format numbers can take 329 bytes for the worst
946 * case of -1e307 in 20d float_output_format. What is one to do (short of
947 * re-writing _doprnt to be more sane)?
952 float_to_string (buf
, data
)
959 /* Check for plus infinity in a way that won't lose
960 if there is no plus infinity. */
961 if (data
== data
/ 2 && data
> 1.0)
963 strcpy (buf
, "1.0e+INF");
966 /* Likewise for minus infinity. */
967 if (data
== data
/ 2 && data
< -1.0)
969 strcpy (buf
, "-1.0e+INF");
972 /* Check for NaN in a way that won't fail if there are no NaNs. */
973 if (! (data
* 0.0 >= 0.0))
975 strcpy (buf
, "0.0e+NaN");
979 if (NILP (Vfloat_output_format
)
980 || !STRINGP (Vfloat_output_format
))
983 /* Generate the fewest number of digits that represent the
984 floating point value without losing information.
985 The following method is simple but a bit slow.
986 For ideas about speeding things up, please see:
988 Guy L Steele Jr & Jon L White, How to print floating-point numbers
989 accurately. SIGPLAN notices 25, 6 (June 1990), 112-126.
991 Robert G Burger & R Kent Dybvig, Printing floating point numbers
992 quickly and accurately, SIGPLAN notices 31, 5 (May 1996), 108-116. */
994 width
= fabs (data
) < DBL_MIN
? 1 : DBL_DIG
;
996 sprintf (buf
, "%.*g", width
, data
);
997 while (width
++ < DOUBLE_DIGITS_BOUND
&& atof (buf
) != data
);
1001 /* Check that the spec we have is fully valid.
1002 This means not only valid for printf,
1003 but meant for floats, and reasonable. */
1004 cp
= XSTRING (Vfloat_output_format
)->data
;
1013 /* Check the width specification. */
1015 if ('0' <= *cp
&& *cp
<= '9')
1019 width
= (width
* 10) + (*cp
++ - '0');
1020 while (*cp
>= '0' && *cp
<= '9');
1022 /* A precision of zero is valid only for %f. */
1024 || (width
== 0 && *cp
!= 'f'))
1028 if (*cp
!= 'e' && *cp
!= 'f' && *cp
!= 'g')
1034 sprintf (buf
, XSTRING (Vfloat_output_format
)->data
, data
);
1037 /* Make sure there is a decimal point with digit after, or an
1038 exponent, so that the value is readable as a float. But don't do
1039 this with "%.0f"; it's valid for that not to produce a decimal
1040 point. Note that width can be 0 only for %.0f. */
1043 for (cp
= buf
; *cp
; cp
++)
1044 if ((*cp
< '0' || *cp
> '9') && *cp
!= '-')
1047 if (*cp
== '.' && cp
[1] == 0)
1061 #endif /* LISP_FLOAT_TYPE */
1064 print (obj
, printcharfun
, escapeflag
)
1066 register Lisp_Object printcharfun
;
1073 #if 1 /* I'm not sure this is really worth doing. */
1074 /* Detect circularities and truncate them.
1075 No need to offer any alternative--this is better than an error. */
1076 if (CONSP (obj
) || VECTORP (obj
) || COMPILEDP (obj
))
1079 for (i
= 0; i
< print_depth
; i
++)
1080 if (EQ (obj
, being_printed
[i
]))
1082 sprintf (buf
, "#%d", i
);
1083 strout (buf
, -1, -1, printcharfun
, 0);
1089 being_printed
[print_depth
] = obj
;
1092 if (print_depth
> PRINT_CIRCLE
)
1093 error ("Apparently circular structure being printed");
1094 #ifdef MAX_PRINT_CHARS
1095 if (max_print
&& print_chars
> max_print
)
1100 #endif /* MAX_PRINT_CHARS */
1102 switch (XGCTYPE (obj
))
1105 if (sizeof (int) == sizeof (EMACS_INT
))
1106 sprintf (buf
, "%d", XINT (obj
));
1107 else if (sizeof (long) == sizeof (EMACS_INT
))
1108 sprintf (buf
, "%ld", XINT (obj
));
1111 strout (buf
, -1, -1, printcharfun
, 0);
1114 #ifdef LISP_FLOAT_TYPE
1117 char pigbuf
[350]; /* see comments in float_to_string */
1119 float_to_string (pigbuf
, XFLOAT(obj
)->data
);
1120 strout (pigbuf
, -1, -1, printcharfun
, 0);
1127 print_string (obj
, printcharfun
);
1130 register int i
, i_byte
;
1131 register unsigned char c
;
1132 struct gcpro gcpro1
;
1137 #ifdef USE_TEXT_PROPERTIES
1138 if (!NULL_INTERVAL_P (XSTRING (obj
)->intervals
))
1146 size_byte
= XSTRING (obj
)->size_byte
;
1148 for (i
= 0, i_byte
= 0; i_byte
< size_byte
;)
1150 /* Here, we must convert each multi-byte form to the
1151 corresponding character code before handing it to PRINTCHAR. */
1155 if (STRING_MULTIBYTE (obj
))
1156 FETCH_STRING_CHAR_ADVANCE (c
, obj
, i
, i_byte
);
1158 c
= XSTRING (obj
)->data
[i_byte
++];
1162 if (c
== '\n' && print_escape_newlines
)
1167 else if (c
== '\f' && print_escape_newlines
)
1172 else if ((! SINGLE_BYTE_CHAR_P (c
)
1173 && NILP (current_buffer
->enable_multibyte_characters
)))
1175 /* When multibyte is disabled,
1176 print multibyte string chars using hex escapes. */
1177 unsigned char outbuf
[50];
1178 sprintf (outbuf
, "\\x%x", c
);
1179 strout (outbuf
, -1, -1, printcharfun
, 0);
1181 else if (SINGLE_BYTE_CHAR_P (c
)
1182 && ! ASCII_BYTE_P (c
)
1183 && ! NILP (current_buffer
->enable_multibyte_characters
))
1185 /* When multibyte is enabled,
1186 print single-byte non-ASCII string chars
1187 using octal escapes. */
1188 unsigned char outbuf
[5];
1189 sprintf (outbuf
, "\\%03o", c
);
1190 strout (outbuf
, -1, -1, printcharfun
, 0);
1194 if (c
== '\"' || c
== '\\')
1201 #ifdef USE_TEXT_PROPERTIES
1202 if (!NULL_INTERVAL_P (XSTRING (obj
)->intervals
))
1204 traverse_intervals (XSTRING (obj
)->intervals
,
1205 0, 0, print_interval
, printcharfun
);
1216 register int confusing
;
1217 register unsigned char *p
= XSYMBOL (obj
)->name
->data
;
1218 register unsigned char *end
= p
+ XSYMBOL (obj
)->name
->size_byte
;
1219 register unsigned char c
;
1220 int i
, i_byte
, size_byte
;
1223 XSETSTRING (name
, XSYMBOL (obj
)->name
);
1225 if (p
!= end
&& (*p
== '-' || *p
== '+')) p
++;
1228 /* If symbol name begins with a digit, and ends with a digit,
1229 and contains nothing but digits and `e', it could be treated
1230 as a number. So set CONFUSING.
1232 Symbols that contain periods could also be taken as numbers,
1233 but periods are always escaped, so we don't have to worry
1235 else if (*p
>= '0' && *p
<= '9'
1236 && end
[-1] >= '0' && end
[-1] <= '9')
1238 while (p
!= end
&& ((*p
>= '0' && *p
<= '9')
1239 /* Needed for \2e10. */
1242 confusing
= (end
== p
);
1247 /* If we print an uninterned symbol as part of a complex object and
1248 the flag print-gensym is non-nil, prefix it with #n= to read the
1249 object back with the #n# reader syntax later if needed. */
1250 if (! NILP (Vprint_gensym
) && NILP (XSYMBOL (obj
)->obarray
))
1252 if (print_depth
> 1)
1255 tem
= Fassq (obj
, Vprint_gensym_alist
);
1259 print (XCDR (tem
), printcharfun
, escapeflag
);
1265 if (CONSP (Vprint_gensym_alist
))
1266 XSETFASTINT (tem
, XFASTINT (XCDR (XCAR (Vprint_gensym_alist
))) + 1);
1268 XSETFASTINT (tem
, 1);
1269 Vprint_gensym_alist
= Fcons (Fcons (obj
, tem
), Vprint_gensym_alist
);
1272 print (tem
, printcharfun
, escapeflag
);
1280 size_byte
= XSTRING (name
)->size_byte
;
1282 for (i
= 0, i_byte
= 0; i_byte
< size_byte
;)
1284 /* Here, we must convert each multi-byte form to the
1285 corresponding character code before handing it to PRINTCHAR. */
1287 if (STRING_MULTIBYTE (name
))
1288 FETCH_STRING_CHAR_ADVANCE (c
, name
, i
, i_byte
);
1290 c
= XSTRING (name
)->data
[i_byte
++];
1296 if (c
== '\"' || c
== '\\' || c
== '\''
1297 || c
== ';' || c
== '#' || c
== '(' || c
== ')'
1298 || c
== ',' || c
=='.' || c
== '`'
1299 || c
== '[' || c
== ']' || c
== '?' || c
<= 040
1301 PRINTCHAR ('\\'), confusing
= 0;
1309 /* If deeper than spec'd depth, print placeholder. */
1310 if (INTEGERP (Vprint_level
)
1311 && print_depth
> XINT (Vprint_level
))
1312 strout ("...", -1, -1, printcharfun
, 0);
1313 else if (print_quoted
&& CONSP (XCDR (obj
)) && NILP (XCDR (XCDR (obj
)))
1314 && (EQ (XCAR (obj
), Qquote
)))
1317 print (XCAR (XCDR (obj
)), printcharfun
, escapeflag
);
1319 else if (print_quoted
&& CONSP (XCDR (obj
)) && NILP (XCDR (XCDR (obj
)))
1320 && (EQ (XCAR (obj
), Qfunction
)))
1324 print (XCAR (XCDR (obj
)), printcharfun
, escapeflag
);
1326 else if (print_quoted
&& CONSP (XCDR (obj
)) && NILP (XCDR (XCDR (obj
)))
1327 && ((EQ (XCAR (obj
), Qbackquote
)
1328 || EQ (XCAR (obj
), Qcomma
)
1329 || EQ (XCAR (obj
), Qcomma_at
)
1330 || EQ (XCAR (obj
), Qcomma_dot
))))
1332 print (XCAR (obj
), printcharfun
, 0);
1333 print (XCAR (XCDR (obj
)), printcharfun
, escapeflag
);
1340 register int max
= 0;
1342 if (INTEGERP (Vprint_length
))
1343 max
= XINT (Vprint_length
);
1344 /* Could recognize circularities in cdrs here,
1345 but that would make printing of long lists quadratic.
1346 It's not worth doing. */
1353 strout ("...", 3, 3, printcharfun
, 0);
1356 print (XCAR (obj
), printcharfun
, escapeflag
);
1362 strout (" . ", 3, 3, printcharfun
, 0);
1363 print (obj
, printcharfun
, escapeflag
);
1369 case Lisp_Vectorlike
:
1374 strout ("#<process ", -1, -1, printcharfun
, 0);
1375 print_string (XPROCESS (obj
)->name
, printcharfun
);
1379 print_string (XPROCESS (obj
)->name
, printcharfun
);
1381 else if (BOOL_VECTOR_P (obj
))
1384 register unsigned char c
;
1385 struct gcpro gcpro1
;
1387 = (XBOOL_VECTOR (obj
)->size
+ BITS_PER_CHAR
- 1) / BITS_PER_CHAR
;
1393 sprintf (buf
, "%d", XBOOL_VECTOR (obj
)->size
);
1394 strout (buf
, -1, -1, printcharfun
, 0);
1397 /* Don't print more characters than the specified maximum. */
1398 if (INTEGERP (Vprint_length
)
1399 && XINT (Vprint_length
) < size_in_chars
)
1400 size_in_chars
= XINT (Vprint_length
);
1402 for (i
= 0; i
< size_in_chars
; i
++)
1405 c
= XBOOL_VECTOR (obj
)->data
[i
];
1406 if (c
== '\n' && print_escape_newlines
)
1411 else if (c
== '\f' && print_escape_newlines
)
1418 if (c
== '\"' || c
== '\\')
1427 else if (SUBRP (obj
))
1429 strout ("#<subr ", -1, -1, printcharfun
, 0);
1430 strout (XSUBR (obj
)->symbol_name
, -1, -1, printcharfun
, 0);
1434 else if (WINDOWP (obj
))
1436 strout ("#<window ", -1, -1, printcharfun
, 0);
1437 sprintf (buf
, "%d", XFASTINT (XWINDOW (obj
)->sequence_number
));
1438 strout (buf
, -1, -1, printcharfun
, 0);
1439 if (!NILP (XWINDOW (obj
)->buffer
))
1441 strout (" on ", -1, -1, printcharfun
, 0);
1442 print_string (XBUFFER (XWINDOW (obj
)->buffer
)->name
, printcharfun
);
1446 else if (BUFFERP (obj
))
1448 if (NILP (XBUFFER (obj
)->name
))
1449 strout ("#<killed buffer>", -1, -1, printcharfun
, 0);
1450 else if (escapeflag
)
1452 strout ("#<buffer ", -1, -1, printcharfun
, 0);
1453 print_string (XBUFFER (obj
)->name
, printcharfun
);
1457 print_string (XBUFFER (obj
)->name
, printcharfun
);
1459 else if (WINDOW_CONFIGURATIONP (obj
))
1461 strout ("#<window-configuration>", -1, -1, printcharfun
, 0);
1463 else if (FRAMEP (obj
))
1465 strout ((FRAME_LIVE_P (XFRAME (obj
))
1466 ? "#<frame " : "#<dead frame "),
1467 -1, -1, printcharfun
, 0);
1468 print_string (XFRAME (obj
)->name
, printcharfun
);
1469 sprintf (buf
, " 0x%lx\\ ", (unsigned long) (XFRAME (obj
)));
1470 strout (buf
, -1, -1, printcharfun
, 0);
1473 #endif /* not standalone */
1476 int size
= XVECTOR (obj
)->size
;
1477 if (COMPILEDP (obj
))
1480 size
&= PSEUDOVECTOR_SIZE_MASK
;
1482 if (CHAR_TABLE_P (obj
))
1484 /* We print a char-table as if it were a vector,
1485 lumping the parent and default slots in with the
1486 character slots. But we add #^ as a prefix. */
1489 if (SUB_CHAR_TABLE_P (obj
))
1491 size
&= PSEUDOVECTOR_SIZE_MASK
;
1493 if (size
& PSEUDOVECTOR_FLAG
)
1499 register Lisp_Object tem
;
1501 /* Don't print more elements than the specified maximum. */
1502 if (INTEGERP (Vprint_length
)
1503 && XINT (Vprint_length
) < size
)
1504 size
= XINT (Vprint_length
);
1506 for (i
= 0; i
< size
; i
++)
1508 if (i
) PRINTCHAR (' ');
1509 tem
= XVECTOR (obj
)->contents
[i
];
1510 print (tem
, printcharfun
, escapeflag
);
1519 switch (XMISCTYPE (obj
))
1521 case Lisp_Misc_Marker
:
1522 strout ("#<marker ", -1, -1, printcharfun
, 0);
1523 /* Do you think this is necessary? */
1524 if (XMARKER (obj
)->insertion_type
!= 0)
1525 strout ("(before-insertion) ", -1, -1, printcharfun
, 0);
1526 if (!(XMARKER (obj
)->buffer
))
1527 strout ("in no buffer", -1, -1, printcharfun
, 0);
1530 sprintf (buf
, "at %d", marker_position (obj
));
1531 strout (buf
, -1, -1, printcharfun
, 0);
1532 strout (" in ", -1, -1, printcharfun
, 0);
1533 print_string (XMARKER (obj
)->buffer
->name
, printcharfun
);
1538 case Lisp_Misc_Overlay
:
1539 strout ("#<overlay ", -1, -1, printcharfun
, 0);
1540 if (!(XMARKER (OVERLAY_START (obj
))->buffer
))
1541 strout ("in no buffer", -1, -1, printcharfun
, 0);
1544 sprintf (buf
, "from %d to %d in ",
1545 marker_position (OVERLAY_START (obj
)),
1546 marker_position (OVERLAY_END (obj
)));
1547 strout (buf
, -1, -1, printcharfun
, 0);
1548 print_string (XMARKER (OVERLAY_START (obj
))->buffer
->name
,
1554 /* Remaining cases shouldn't happen in normal usage, but let's print
1555 them anyway for the benefit of the debugger. */
1556 case Lisp_Misc_Free
:
1557 strout ("#<misc free cell>", -1, -1, printcharfun
, 0);
1560 case Lisp_Misc_Intfwd
:
1561 sprintf (buf
, "#<intfwd to %d>", *XINTFWD (obj
)->intvar
);
1562 strout (buf
, -1, -1, printcharfun
, 0);
1565 case Lisp_Misc_Boolfwd
:
1566 sprintf (buf
, "#<boolfwd to %s>",
1567 (*XBOOLFWD (obj
)->boolvar
? "t" : "nil"));
1568 strout (buf
, -1, -1, printcharfun
, 0);
1571 case Lisp_Misc_Objfwd
:
1572 strout ("#<objfwd to ", -1, -1, printcharfun
, 0);
1573 print (*XOBJFWD (obj
)->objvar
, printcharfun
, escapeflag
);
1577 case Lisp_Misc_Buffer_Objfwd
:
1578 strout ("#<buffer_objfwd to ", -1, -1, printcharfun
, 0);
1579 print (*(Lisp_Object
*)((char *)current_buffer
1580 + XBUFFER_OBJFWD (obj
)->offset
),
1581 printcharfun
, escapeflag
);
1585 case Lisp_Misc_Kboard_Objfwd
:
1586 strout ("#<kboard_objfwd to ", -1, -1, printcharfun
, 0);
1587 print (*(Lisp_Object
*)((char *) current_kboard
1588 + XKBOARD_OBJFWD (obj
)->offset
),
1589 printcharfun
, escapeflag
);
1593 case Lisp_Misc_Buffer_Local_Value
:
1594 strout ("#<buffer_local_value ", -1, -1, printcharfun
, 0);
1595 goto do_buffer_local
;
1596 case Lisp_Misc_Some_Buffer_Local_Value
:
1597 strout ("#<some_buffer_local_value ", -1, -1, printcharfun
, 0);
1599 strout ("[realvalue] ", -1, -1, printcharfun
, 0);
1600 print (XBUFFER_LOCAL_VALUE (obj
)->car
, printcharfun
, escapeflag
);
1601 strout ("[buffer] ", -1, -1, printcharfun
, 0);
1602 print (XCONS (XBUFFER_LOCAL_VALUE (obj
)->cdr
)->car
,
1603 printcharfun
, escapeflag
);
1604 strout ("[alist-elt] ", -1, -1, printcharfun
, 0);
1605 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj
)->cdr
)->cdr
)->car
,
1606 printcharfun
, escapeflag
);
1607 strout ("[default-value] ", -1, -1, printcharfun
, 0);
1608 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj
)->cdr
)->cdr
)->cdr
,
1609 printcharfun
, escapeflag
);
1617 #endif /* standalone */
1622 /* We're in trouble if this happens!
1623 Probably should just abort () */
1624 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun
, 0);
1626 sprintf (buf
, "(MISC 0x%04x)", (int) XMISCTYPE (obj
));
1627 else if (VECTORLIKEP (obj
))
1628 sprintf (buf
, "(PVEC 0x%08x)", (int) XVECTOR (obj
)->size
);
1630 sprintf (buf
, "(0x%02x)", (int) XTYPE (obj
));
1631 strout (buf
, -1, -1, printcharfun
, 0);
1632 strout (" Save your buffers immediately and please report this bug>",
1633 -1, -1, printcharfun
, 0);
1640 #ifdef USE_TEXT_PROPERTIES
1642 /* Print a description of INTERVAL using PRINTCHARFUN.
1643 This is part of printing a string that has text properties. */
1646 print_interval (interval
, printcharfun
)
1648 Lisp_Object printcharfun
;
1651 print (make_number (interval
->position
), printcharfun
, 1);
1653 print (make_number (interval
->position
+ LENGTH (interval
)),
1656 print (interval
->plist
, printcharfun
, 1);
1659 #endif /* USE_TEXT_PROPERTIES */
1664 DEFVAR_LISP ("standard-output", &Vstandard_output
,
1665 "Output stream `print' uses by default for outputting a character.\n\
1666 This may be any function of one argument.\n\
1667 It may also be a buffer (output is inserted before point)\n\
1668 or a marker (output is inserted and the marker is advanced)\n\
1669 or the symbol t (output appears in the echo area).");
1670 Vstandard_output
= Qt
;
1671 Qstandard_output
= intern ("standard-output");
1672 staticpro (&Qstandard_output
);
1674 #ifdef LISP_FLOAT_TYPE
1675 DEFVAR_LISP ("float-output-format", &Vfloat_output_format
,
1676 "The format descriptor string used to print floats.\n\
1677 This is a %-spec like those accepted by `printf' in C,\n\
1678 but with some restrictions. It must start with the two characters `%.'.\n\
1679 After that comes an integer precision specification,\n\
1680 and then a letter which controls the format.\n\
1681 The letters allowed are `e', `f' and `g'.\n\
1682 Use `e' for exponential notation \"DIG.DIGITSeEXPT\"\n\
1683 Use `f' for decimal point notation \"DIGITS.DIGITS\".\n\
1684 Use `g' to choose the shorter of those two formats for the number at hand.\n\
1685 The precision in any of these cases is the number of digits following\n\
1686 the decimal point. With `f', a precision of 0 means to omit the\n\
1687 decimal point. 0 is not allowed with `e' or `g'.\n\n\
1688 A value of nil means to use the shortest notation\n\
1689 that represents the number without losing information.");
1690 Vfloat_output_format
= Qnil
;
1691 Qfloat_output_format
= intern ("float-output-format");
1692 staticpro (&Qfloat_output_format
);
1693 #endif /* LISP_FLOAT_TYPE */
1695 DEFVAR_LISP ("print-length", &Vprint_length
,
1696 "Maximum length of list to print before abbreviating.\n\
1697 A value of nil means no limit.");
1698 Vprint_length
= Qnil
;
1700 DEFVAR_LISP ("print-level", &Vprint_level
,
1701 "Maximum depth of list nesting to print before abbreviating.\n\
1702 A value of nil means no limit.");
1703 Vprint_level
= Qnil
;
1705 DEFVAR_BOOL ("print-escape-newlines", &print_escape_newlines
,
1706 "Non-nil means print newlines in strings as backslash-n.\n\
1707 Also print formfeeds as backslash-f.");
1708 print_escape_newlines
= 0;
1710 DEFVAR_BOOL ("print-quoted", &print_quoted
,
1711 "Non-nil means print quoted forms with reader syntax.\n\
1712 I.e., (quote foo) prints as 'foo, (function foo) as #'foo, and, backquoted\n\
1713 forms print in the new syntax.");
1716 DEFVAR_LISP ("print-gensym", &Vprint_gensym
,
1717 "Non-nil means print uninterned symbols so they will read as uninterned.\n\
1718 I.e., the value of (make-symbol \"foobar\") prints as #:foobar.\n\
1719 When the uninterned symbol appears within a larger data structure,\n\
1720 in addition use the #...# and #...= constructs as needed,\n\
1721 so that multiple references to the same symbol are shared once again\n\
1722 when the text is read back.\n\
1724 If the value of `print-gensym' is a cons cell, then in addition refrain from\n\
1725 clearing `print-gensym-alist' on entry to and exit from printing functions,\n\
1726 so that the use of #...# and #...= can carry over for several separately\n\
1728 Vprint_gensym
= Qnil
;
1730 DEFVAR_LISP ("print-gensym-alist", &Vprint_gensym_alist
,
1731 "Association list of elements (GENSYM . N) to guide use of #N# and #N=.\n\
1732 In each element, GENSYM is an uninterned symbol that has been associated\n\
1733 with #N= for the specified value of N.");
1734 Vprint_gensym_alist
= Qnil
;
1736 /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */
1737 staticpro (&Vprin1_to_string_buffer
);
1740 defsubr (&Sprin1_to_string
);
1741 defsubr (&Serror_message_string
);
1745 defsubr (&Swrite_char
);
1746 defsubr (&Sexternal_debugging_output
);
1748 Qexternal_debugging_output
= intern ("external-debugging-output");
1749 staticpro (&Qexternal_debugging_output
);
1751 Qprint_escape_newlines
= intern ("print-escape-newlines");
1752 staticpro (&Qprint_escape_newlines
);
1755 defsubr (&Swith_output_to_temp_buffer
);
1756 #endif /* not standalone */