Mercurial > emacs
annotate src/print.c @ 20200:b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
| author | Paul Eggert <eggert@twinsun.com> |
|---|---|
| date | Wed, 29 Oct 1997 07:47:37 +0000 |
| parents | 1e352b03fd8a |
| children | 13efdf0fe96e |
| rev | line source |
|---|---|
| 329 | 1 /* Lisp object printing and output streams. |
|
20200
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
2 Copyright (C) 1985, 86, 88, 93, 94, 95, 97 Free Software Foundation, Inc. |
| 329 | 3 |
| 4 This file is part of GNU Emacs. | |
| 5 | |
| 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 | |
| 621 | 8 the Free Software Foundation; either version 2, or (at your option) |
| 329 | 9 any later version. |
| 10 | |
| 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. | |
| 15 | |
| 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 | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14084
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14084
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
| 329 | 20 |
| 21 | |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4224
diff
changeset
|
22 #include <config.h> |
| 329 | 23 #include <stdio.h> |
| 24 #include "lisp.h" | |
| 25 | |
| 26 #ifndef standalone | |
| 27 #include "buffer.h" | |
| 17040 | 28 #include "charset.h" |
| 766 | 29 #include "frame.h" |
| 329 | 30 #include "window.h" |
| 31 #include "process.h" | |
| 32 #include "dispextern.h" | |
| 33 #include "termchar.h" | |
| 11341 | 34 #include "keyboard.h" |
| 329 | 35 #endif /* not standalone */ |
| 36 | |
| 1967 | 37 #ifdef USE_TEXT_PROPERTIES |
| 38 #include "intervals.h" | |
| 39 #endif | |
| 40 | |
| 329 | 41 Lisp_Object Vstandard_output, Qstandard_output; |
| 42 | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
43 /* These are used to print like we read. */ |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
44 extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
45 |
| 329 | 46 #ifdef LISP_FLOAT_TYPE |
| 47 Lisp_Object Vfloat_output_format, Qfloat_output_format; | |
| 20121 | 48 |
| 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 | |
| 57 #endif | |
| 58 | |
| 59 #include <math.h> | |
| 60 | |
| 61 #if STDC_HEADERS | |
| 62 #include <float.h> | |
| 63 #include <stdlib.h> | |
| 64 #endif | |
| 65 | |
| 66 /* Default to values appropriate for IEEE floating point. */ | |
| 67 #ifndef FLT_RADIX | |
| 68 #define FLT_RADIX 2 | |
| 69 #endif | |
| 70 #ifndef DBL_MANT_DIG | |
| 71 #define DBL_MANT_DIG 53 | |
| 72 #endif | |
| 73 #ifndef DBL_DIG | |
| 74 #define DBL_DIG 15 | |
| 75 #endif | |
|
20200
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
76 #ifndef DBL_MIN |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
77 #define DBL_MIN 2.2250738585072014e-308 |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
78 #endif |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
79 |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
80 #ifdef DBL_MIN_REPLACEMENT |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
81 #undef DBL_MIN |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
82 #define DBL_MIN DBL_MIN_REPLACEMENT |
|
b69f8ea35fef
(DBL_MIN): Use workaround if DBL_MIN_REPLACEMENT is defined.
Paul Eggert <eggert@twinsun.com>
parents:
20121
diff
changeset
|
83 #endif |
| 20121 | 84 |
| 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 */ | |
| 92 #else | |
| 93 #define DOUBLE_DIGITS_BOUND ((int) ceil (log10 (pow (FLT_RADIX, DBL_MANT_DIG)))) | |
| 94 #endif | |
| 95 | |
| 329 | 96 #endif /* LISP_FLOAT_TYPE */ |
| 97 | |
| 98 /* Avoid actual stack overflow in print. */ | |
| 99 int print_depth; | |
| 100 | |
|
379
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
101 /* Detect most circularities to print finite output. */ |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
102 #define PRINT_CIRCLE 200 |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
103 Lisp_Object being_printed[PRINT_CIRCLE]; |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
104 |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
105 /* When printing into a buffer, first we put the text in this |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
106 block, then insert it all at once. */ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
107 char *print_buffer; |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
108 |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
109 /* Size allocated in print_buffer. */ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
110 int print_buffer_size; |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
111 /* Size used in print_buffer. */ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
112 int print_buffer_pos; |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
113 |
| 329 | 114 /* Maximum length of list to print in full; noninteger means |
| 115 effectively infinity */ | |
| 116 | |
| 117 Lisp_Object Vprint_length; | |
| 118 | |
| 119 /* Maximum depth of list to print in full; noninteger means | |
| 120 effectively infinity. */ | |
| 121 | |
| 122 Lisp_Object Vprint_level; | |
| 123 | |
| 124 /* Nonzero means print newlines in strings as \n. */ | |
| 125 | |
| 126 int print_escape_newlines; | |
| 127 | |
| 128 Lisp_Object Qprint_escape_newlines; | |
| 129 | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
130 /* Nonzero means print (quote foo) forms as 'foo, etc. */ |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
131 |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
132 int print_quoted; |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
133 |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
134 /* Non-nil means print #: before uninterned symbols. |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
135 Neither t nor nil means so that and don't clear Vprint_gensym_alist |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
136 on entry to and exit from print functions. */ |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
137 |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
138 Lisp_Object Vprint_gensym; |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
139 |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
140 /* Association list of certain objects that are `eq' in the form being |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
141 printed and which should be `eq' when read back in, using the #n=object |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
142 and #n# reader forms. Each element has the form (object . n). */ |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
143 |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
144 Lisp_Object Vprint_gensym_alist; |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
145 |
|
10418
fdad41459fd6
(printchar, strout): Call message_dolog.
Karl Heuer <kwzh@gnu.org>
parents:
10301
diff
changeset
|
146 /* Nonzero means print newline to stdout before next minibuffer message. |
| 329 | 147 Defined in xdisp.c */ |
| 148 | |
| 149 extern int noninteractive_need_newline; | |
|
10418
fdad41459fd6
(printchar, strout): Call message_dolog.
Karl Heuer <kwzh@gnu.org>
parents:
10301
diff
changeset
|
150 |
|
19001
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
151 extern int minibuffer_auto_raise; |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
152 |
| 329 | 153 #ifdef MAX_PRINT_CHARS |
| 154 static int print_chars; | |
| 155 static int max_print; | |
| 156 #endif /* MAX_PRINT_CHARS */ | |
| 1967 | 157 |
| 158 void print_interval (); | |
| 329 | 159 |
| 160 #if 0 | |
| 161 /* Convert between chars and GLYPHs */ | |
| 162 | |
| 163 int | |
| 164 glyphlen (glyphs) | |
| 165 register GLYPH *glyphs; | |
| 166 { | |
| 167 register int i = 0; | |
| 168 | |
| 169 while (glyphs[i]) | |
| 170 i++; | |
| 171 return i; | |
| 172 } | |
| 173 | |
| 174 void | |
| 175 str_to_glyph_cpy (str, glyphs) | |
| 176 char *str; | |
| 177 GLYPH *glyphs; | |
| 178 { | |
| 179 register GLYPH *gp = glyphs; | |
| 180 register char *cp = str; | |
| 181 | |
| 182 while (*cp) | |
| 183 *gp++ = *cp++; | |
| 184 } | |
| 185 | |
| 186 void | |
| 187 str_to_glyph_ncpy (str, glyphs, n) | |
| 188 char *str; | |
| 189 GLYPH *glyphs; | |
| 190 register int n; | |
| 191 { | |
| 192 register GLYPH *gp = glyphs; | |
| 193 register char *cp = str; | |
| 194 | |
| 195 while (n-- > 0) | |
| 196 *gp++ = *cp++; | |
| 197 } | |
| 198 | |
| 199 void | |
| 200 glyph_to_str_cpy (glyphs, str) | |
| 201 GLYPH *glyphs; | |
| 202 char *str; | |
| 203 { | |
| 204 register GLYPH *gp = glyphs; | |
| 205 register char *cp = str; | |
| 206 | |
| 207 while (*gp) | |
| 208 *str++ = *gp++ & 0377; | |
| 209 } | |
| 210 #endif | |
| 211 | |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3377
diff
changeset
|
212 /* Low level output routines for characters and strings */ |
| 329 | 213 |
| 214 /* Lisp functions to do output using a stream | |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
215 must have the stream in a variable called printcharfun |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
216 and must start with PRINTPREPARE, end with PRINTFINISH, |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
217 and use PRINTDECLARE to declare common variables. |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
218 Use PRINTCHAR to output one character, |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
219 or call strout to output a block of characters. |
| 329 | 220 */ |
| 221 | |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
222 #define PRINTDECLARE \ |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
223 struct buffer *old = current_buffer; \ |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
224 int old_point = -1, start_point; \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
225 int specpdl_count = specpdl_ptr - specpdl; \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
226 int free_print_buffer = 0; \ |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
227 Lisp_Object original |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
228 |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
229 #define PRINTPREPARE \ |
|
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
230 original = printcharfun; \ |
|
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
231 if (NILP (printcharfun)) printcharfun = Qt; \ |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
232 if (BUFFERP (printcharfun)) \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
233 { \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
234 if (XBUFFER (printcharfun) != current_buffer) \ |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
235 Fset_buffer (printcharfun); \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
236 printcharfun = Qnil; \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
237 } \ |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
238 if (MARKERP (printcharfun)) \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
239 { \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
240 if (!(XMARKER (original)->buffer)) \ |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
241 error ("Marker does not point anywhere"); \ |
|
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
242 if (XMARKER (original)->buffer != current_buffer) \ |
|
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
243 set_buffer_internal (XMARKER (original)->buffer); \ |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15908
diff
changeset
|
244 old_point = PT; \ |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
245 SET_PT (marker_position (printcharfun)); \ |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15908
diff
changeset
|
246 start_point = PT; \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
247 printcharfun = Qnil; \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
248 } \ |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
249 if (NILP (printcharfun)) \ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
250 { \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
251 if (print_buffer != 0) \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
252 record_unwind_protect (print_unwind, \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
253 make_string (print_buffer, \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
254 print_buffer_pos)); \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
255 else \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
256 { \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
257 print_buffer_size = 1000; \ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
258 print_buffer = (char *) xmalloc (print_buffer_size); \ |
|
16513
ecf0700e9550
(PRINTPREPARE): Really do set free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16512
diff
changeset
|
259 free_print_buffer = 1; \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
260 } \ |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
261 print_buffer_pos = 0; \ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
262 } \ |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
263 if (!CONSP (Vprint_gensym)) \ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
264 Vprint_gensym_alist = Qnil |
| 329 | 265 |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
266 #define PRINTFINISH \ |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
267 if (NILP (printcharfun)) \ |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
268 insert (print_buffer, print_buffer_pos); \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
269 if (free_print_buffer) \ |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
270 { \ |
|
16520
d18129921259
(PRINTFINISH): Use xfree, not free.
Richard M. Stallman <rms@gnu.org>
parents:
16513
diff
changeset
|
271 xfree (print_buffer); \ |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
272 print_buffer = 0; \ |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
273 } \ |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
274 unbind_to (specpdl_count, Qnil); \ |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
275 if (MARKERP (original)) \ |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15908
diff
changeset
|
276 Fset_marker (original, make_number (PT), Qnil); \ |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
277 if (old_point >= 0) \ |
|
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
278 SET_PT (old_point + (old_point >= start_point \ |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15908
diff
changeset
|
279 ? PT - start_point : 0)); \ |
|
2193
652b38173a63
(PRINTPREPARE): Handle marker that points nowhere.
Richard M. Stallman <rms@gnu.org>
parents:
1991
diff
changeset
|
280 if (old != current_buffer) \ |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
281 set_buffer_internal (old); \ |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
282 if (!CONSP (Vprint_gensym)) \ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
283 Vprint_gensym_alist = Qnil |
| 329 | 284 |
| 285 #define PRINTCHAR(ch) printchar (ch, printcharfun) | |
| 286 | |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
287 /* Nonzero if there is no room to print any more characters |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
288 so print might as well return right away. */ |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
289 |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
290 #define PRINTFULLP() \ |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
291 (EQ (printcharfun, Qt) && !noninteractive \ |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
292 && printbufidx >= FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))))) |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
293 |
|
16512
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
294 /* This is used to restore the saved contents of print_buffer |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
295 when there is a recursive call to print. */ |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
296 static Lisp_Object |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
297 print_unwind (saved_text) |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
298 Lisp_Object saved_text; |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
299 { |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
300 bcopy (XSTRING (saved_text)->data, print_buffer, XSTRING (saved_text)->size); |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
301 } |
|
59835b743b93
(PRINTDECLARE): Declare specpdl_count and free_print_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
16496
diff
changeset
|
302 |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
303 /* Index of first unused element of FRAME_MESSAGE_BUF (mini_frame). */ |
| 329 | 304 static int printbufidx; |
| 305 | |
| 306 static void | |
| 307 printchar (ch, fun) | |
| 17040 | 308 unsigned int ch; |
| 329 | 309 Lisp_Object fun; |
| 310 { | |
| 311 Lisp_Object ch1; | |
| 312 | |
| 313 #ifdef MAX_PRINT_CHARS | |
| 314 if (max_print) | |
| 315 print_chars++; | |
| 316 #endif /* MAX_PRINT_CHARS */ | |
| 317 #ifndef standalone | |
| 318 if (EQ (fun, Qnil)) | |
| 319 { | |
| 17040 | 320 int len; |
| 321 char work[4], *str; | |
| 322 | |
| 329 | 323 QUIT; |
| 17040 | 324 len = CHAR_STRING (ch, work, str); |
| 325 if (print_buffer_pos + len >= print_buffer_size) | |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
326 print_buffer = (char *) xrealloc (print_buffer, |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
327 print_buffer_size *= 2); |
| 17040 | 328 bcopy (str, print_buffer + print_buffer_pos, len); |
| 329 print_buffer_pos += len; | |
| 329 | 330 return; |
| 331 } | |
| 332 | |
| 333 if (EQ (fun, Qt)) | |
| 334 { | |
|
6808
514a324b3681
(printchar, strout): Use FRAME_PTR, not struct frame *.
Karl Heuer <kwzh@gnu.org>
parents:
6802
diff
changeset
|
335 FRAME_PTR mini_frame |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
336 = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 17040 | 337 unsigned char work[4], *str; |
| 338 int len = CHAR_STRING (ch, work, str); | |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
339 |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
340 QUIT; |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
341 |
| 329 | 342 if (noninteractive) |
| 343 { | |
| 17040 | 344 while (len--) |
| 345 putchar (*str), str++; | |
| 329 | 346 noninteractive_need_newline = 1; |
| 347 return; | |
| 348 } | |
| 349 | |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
350 if (echo_area_glyphs != FRAME_MESSAGE_BUF (mini_frame) |
| 329 | 351 || !message_buf_print) |
| 352 { | |
|
10568
275f62e27ee2
(printchar, strout): Use message_log_maybe_newline.
Karl Heuer <kwzh@gnu.org>
parents:
10482
diff
changeset
|
353 message_log_maybe_newline (); |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
354 echo_area_glyphs = FRAME_MESSAGE_BUF (mini_frame); |
| 329 | 355 printbufidx = 0; |
|
5233
83e771f33251
(printchar, strout): Set echo_area_glyphs_length.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
356 echo_area_glyphs_length = 0; |
| 329 | 357 message_buf_print = 1; |
|
19001
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
358 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
359 if (minibuffer_auto_raise) |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
360 { |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
361 Lisp_Object mini_window; |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
362 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
363 /* Get the frame containing the minibuffer |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
364 that the selected frame is using. */ |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
365 mini_window = FRAME_MINIBUF_WINDOW (selected_frame); |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
366 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
367 Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window))); |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
368 } |
| 329 | 369 } |
| 370 | |
| 17040 | 371 message_dolog (str, len, 0); |
| 372 if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len) | |
| 373 bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len), | |
| 374 printbufidx += len; | |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
375 FRAME_MESSAGE_BUF (mini_frame)[printbufidx] = 0; |
|
5233
83e771f33251
(printchar, strout): Set echo_area_glyphs_length.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
376 echo_area_glyphs_length = printbufidx; |
| 329 | 377 |
| 378 return; | |
| 379 } | |
| 380 #endif /* not standalone */ | |
| 381 | |
|
9317
58f6a917533b
(printchar): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9276
diff
changeset
|
382 XSETFASTINT (ch1, ch); |
| 329 | 383 call1 (fun, ch1); |
| 384 } | |
| 385 | |
| 386 static void | |
| 387 strout (ptr, size, printcharfun) | |
| 388 char *ptr; | |
| 389 int size; | |
| 390 Lisp_Object printcharfun; | |
| 391 { | |
| 392 int i = 0; | |
| 393 | |
| 17040 | 394 if (size < 0) |
| 395 size = strlen (ptr); | |
| 396 | |
| 329 | 397 if (EQ (printcharfun, Qnil)) |
| 398 { | |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
399 if (print_buffer_pos + size > print_buffer_size) |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
400 { |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
401 print_buffer_size = print_buffer_size * 2 + size; |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
402 print_buffer = (char *) xrealloc (print_buffer, |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
403 print_buffer_size); |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
404 } |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
405 bcopy (ptr, print_buffer + print_buffer_pos, size); |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
406 print_buffer_pos += size; |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
407 |
| 329 | 408 #ifdef MAX_PRINT_CHARS |
| 409 if (max_print) | |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
410 print_chars += size; |
| 329 | 411 #endif /* MAX_PRINT_CHARS */ |
| 412 return; | |
| 413 } | |
| 414 if (EQ (printcharfun, Qt)) | |
| 415 { | |
|
6808
514a324b3681
(printchar, strout): Use FRAME_PTR, not struct frame *.
Karl Heuer <kwzh@gnu.org>
parents:
6802
diff
changeset
|
416 FRAME_PTR mini_frame |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
417 = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
|
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
418 |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
419 QUIT; |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
420 |
| 329 | 421 #ifdef MAX_PRINT_CHARS |
| 422 if (max_print) | |
| 17040 | 423 print_chars += size; |
| 329 | 424 #endif /* MAX_PRINT_CHARS */ |
| 425 | |
| 426 if (noninteractive) | |
| 427 { | |
| 17040 | 428 fwrite (ptr, 1, size, stdout); |
| 329 | 429 noninteractive_need_newline = 1; |
| 430 return; | |
| 431 } | |
| 432 | |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
433 if (echo_area_glyphs != FRAME_MESSAGE_BUF (mini_frame) |
| 329 | 434 || !message_buf_print) |
| 435 { | |
|
10568
275f62e27ee2
(printchar, strout): Use message_log_maybe_newline.
Karl Heuer <kwzh@gnu.org>
parents:
10482
diff
changeset
|
436 message_log_maybe_newline (); |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
437 echo_area_glyphs = FRAME_MESSAGE_BUF (mini_frame); |
| 329 | 438 printbufidx = 0; |
|
5233
83e771f33251
(printchar, strout): Set echo_area_glyphs_length.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
439 echo_area_glyphs_length = 0; |
| 329 | 440 message_buf_print = 1; |
|
19001
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
441 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
442 if (minibuffer_auto_raise) |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
443 { |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
444 Lisp_Object mini_window; |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
445 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
446 /* Get the frame containing the minibuffer |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
447 that the selected frame is using. */ |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
448 mini_window = FRAME_MINIBUF_WINDOW (selected_frame); |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
449 |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
450 Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window))); |
|
2190c39dc640
(strout, printchar): Handle minibuffer_auto_raise.
Richard M. Stallman <rms@gnu.org>
parents:
18961
diff
changeset
|
451 } |
| 329 | 452 } |
| 453 | |
| 17040 | 454 message_dolog (ptr, size, 0); |
| 455 if (size > FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1) | |
| 456 { | |
| 457 size = FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1; | |
| 458 /* Rewind incomplete multi-byte form. */ | |
| 459 while (size && (unsigned char) ptr[size] >= 0xA0) size--; | |
| 460 } | |
| 461 bcopy (ptr, &FRAME_MESSAGE_BUF (mini_frame) [printbufidx], size); | |
| 462 printbufidx += size; | |
|
5233
83e771f33251
(printchar, strout): Set echo_area_glyphs_length.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
463 echo_area_glyphs_length = printbufidx; |
|
5487
58a9bb23c3ea
(strout, printchar): Use proper frame for minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
5233
diff
changeset
|
464 FRAME_MESSAGE_BUF (mini_frame) [printbufidx] = 0; |
| 329 | 465 |
| 466 return; | |
| 467 } | |
| 468 | |
| 17040 | 469 i = 0; |
| 470 while (i < size) | |
| 471 { | |
| 472 /* Here, we must convert each multi-byte form to the | |
| 473 corresponding character code before handing it to PRINTCHAR. */ | |
| 474 int len; | |
| 475 int ch = STRING_CHAR_AND_LENGTH (ptr + i, size - i, len); | |
| 476 | |
| 477 PRINTCHAR (ch); | |
| 478 i += len; | |
| 479 } | |
| 329 | 480 } |
| 481 | |
| 482 /* Print the contents of a string STRING using PRINTCHARFUN. | |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
483 It isn't safe to use strout in many cases, |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
484 because printing one char can relocate. */ |
| 329 | 485 |
| 486 print_string (string, printcharfun) | |
| 487 Lisp_Object string; | |
| 488 Lisp_Object printcharfun; | |
| 489 { | |
|
15801
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
490 if (EQ (printcharfun, Qt) || NILP (printcharfun)) |
|
b0bd5de2ce82
When printing into a buffer, generate all the text
Richard M. Stallman <rms@gnu.org>
parents:
15707
diff
changeset
|
491 /* strout is safe for output to a frame (echo area) or to print_buffer. */ |
| 329 | 492 strout (XSTRING (string)->data, XSTRING (string)->size, printcharfun); |
| 493 else | |
| 494 { | |
| 495 /* Otherwise, fetch the string address for each character. */ | |
| 496 int i; | |
| 497 int size = XSTRING (string)->size; | |
| 498 struct gcpro gcpro1; | |
| 499 GCPRO1 (string); | |
| 500 for (i = 0; i < size; i++) | |
| 501 PRINTCHAR (XSTRING (string)->data[i]); | |
| 502 UNGCPRO; | |
| 503 } | |
| 504 } | |
| 505 | |
| 506 DEFUN ("write-char", Fwrite_char, Swrite_char, 1, 2, 0, | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
507 "Output character CHARACTER to stream PRINTCHARFUN.\n\ |
| 7185 | 508 PRINTCHARFUN defaults to the value of `standard-output' (which see).") |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
509 (character, printcharfun) |
|
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
510 Lisp_Object character, printcharfun; |
| 329 | 511 { |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
512 PRINTDECLARE; |
| 329 | 513 |
| 520 | 514 if (NILP (printcharfun)) |
| 329 | 515 printcharfun = Vstandard_output; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
516 CHECK_NUMBER (character, 0); |
| 329 | 517 PRINTPREPARE; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
518 PRINTCHAR (XINT (character)); |
| 329 | 519 PRINTFINISH; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
520 return character; |
| 329 | 521 } |
| 522 | |
| 523 /* Used from outside of print.c to print a block of SIZE chars at DATA | |
| 524 on the default output stream. | |
| 525 Do not use this on the contents of a Lisp string. */ | |
| 526 | |
| 527 write_string (data, size) | |
| 528 char *data; | |
| 529 int size; | |
| 530 { | |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
531 PRINTDECLARE; |
| 329 | 532 Lisp_Object printcharfun; |
| 533 | |
| 534 printcharfun = Vstandard_output; | |
| 535 | |
| 536 PRINTPREPARE; | |
| 537 strout (data, size, printcharfun); | |
| 538 PRINTFINISH; | |
| 539 } | |
| 540 | |
| 541 /* Used from outside of print.c to print a block of SIZE chars at DATA | |
| 542 on a specified stream PRINTCHARFUN. | |
| 543 Do not use this on the contents of a Lisp string. */ | |
| 544 | |
| 545 write_string_1 (data, size, printcharfun) | |
| 546 char *data; | |
| 547 int size; | |
| 548 Lisp_Object printcharfun; | |
| 549 { | |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
550 PRINTDECLARE; |
| 329 | 551 |
| 552 PRINTPREPARE; | |
| 553 strout (data, size, printcharfun); | |
| 554 PRINTFINISH; | |
| 555 } | |
| 556 | |
| 557 | |
| 558 #ifndef standalone | |
| 559 | |
| 560 void | |
| 561 temp_output_buffer_setup (bufname) | |
| 562 char *bufname; | |
| 563 { | |
| 564 register struct buffer *old = current_buffer; | |
| 565 register Lisp_Object buf; | |
| 566 | |
| 567 Fset_buffer (Fget_buffer_create (build_string (bufname))); | |
| 568 | |
|
11114
c8ab5c627f74
(temp_output_buffer_setup): (Re)set the default
Richard M. Stallman <rms@gnu.org>
parents:
11010
diff
changeset
|
569 current_buffer->directory = old->directory; |
| 329 | 570 current_buffer->read_only = Qnil; |
| 571 Ferase_buffer (); | |
| 572 | |
|
9276
ae62e12feac5
(temp_output_buffer_setup): Use new accessor macros instead of calling XSET
Karl Heuer <kwzh@gnu.org>
parents:
9117
diff
changeset
|
573 XSETBUFFER (buf, current_buffer); |
| 329 | 574 specbind (Qstandard_output, buf); |
| 575 | |
| 576 set_buffer_internal (old); | |
| 577 } | |
| 578 | |
| 579 Lisp_Object | |
| 580 internal_with_output_to_temp_buffer (bufname, function, args) | |
| 581 char *bufname; | |
| 582 Lisp_Object (*function) (); | |
| 583 Lisp_Object args; | |
| 584 { | |
| 585 int count = specpdl_ptr - specpdl; | |
| 586 Lisp_Object buf, val; | |
|
8315
8921d0012bd5
(internal_with_output_to_temp_buffer): gcpro things.
Richard M. Stallman <rms@gnu.org>
parents:
7185
diff
changeset
|
587 struct gcpro gcpro1; |
| 329 | 588 |
|
8315
8921d0012bd5
(internal_with_output_to_temp_buffer): gcpro things.
Richard M. Stallman <rms@gnu.org>
parents:
7185
diff
changeset
|
589 GCPRO1 (args); |
| 329 | 590 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
| 591 temp_output_buffer_setup (bufname); | |
| 592 buf = Vstandard_output; | |
|
8315
8921d0012bd5
(internal_with_output_to_temp_buffer): gcpro things.
Richard M. Stallman <rms@gnu.org>
parents:
7185
diff
changeset
|
593 UNGCPRO; |
| 329 | 594 |
| 595 val = (*function) (args); | |
| 596 | |
|
8315
8921d0012bd5
(internal_with_output_to_temp_buffer): gcpro things.
Richard M. Stallman <rms@gnu.org>
parents:
7185
diff
changeset
|
597 GCPRO1 (val); |
| 329 | 598 temp_output_buffer_show (buf); |
|
8315
8921d0012bd5
(internal_with_output_to_temp_buffer): gcpro things.
Richard M. Stallman <rms@gnu.org>
parents:
7185
diff
changeset
|
599 UNGCPRO; |
| 329 | 600 |
| 601 return unbind_to (count, val); | |
| 602 } | |
| 603 | |
| 604 DEFUN ("with-output-to-temp-buffer", Fwith_output_to_temp_buffer, Swith_output_to_temp_buffer, | |
| 605 1, UNEVALLED, 0, | |
| 606 "Bind `standard-output' to buffer BUFNAME, eval BODY, then show that buffer.\n\ | |
| 607 The buffer is cleared out initially, and marked as unmodified when done.\n\ | |
| 608 All output done by BODY is inserted in that buffer by default.\n\ | |
| 609 The buffer is displayed in another window, but not selected.\n\ | |
| 610 The value of the last form in BODY is returned.\n\ | |
| 611 If BODY does not finish normally, the buffer BUFNAME is not displayed.\n\n\ | |
|
3337
f5f76ebe6286
(Fwith_output_to_temp_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
2782
diff
changeset
|
612 If variable `temp-buffer-show-function' is non-nil, call it at the end\n\ |
| 329 | 613 to get the buffer displayed. It gets one argument, the buffer to display.") |
| 614 (args) | |
| 615 Lisp_Object args; | |
| 616 { | |
| 617 struct gcpro gcpro1; | |
| 618 Lisp_Object name; | |
| 619 int count = specpdl_ptr - specpdl; | |
| 620 Lisp_Object buf, val; | |
| 621 | |
| 622 GCPRO1(args); | |
| 623 name = Feval (Fcar (args)); | |
| 624 UNGCPRO; | |
| 625 | |
| 626 CHECK_STRING (name, 0); | |
| 627 temp_output_buffer_setup (XSTRING (name)->data); | |
| 628 buf = Vstandard_output; | |
| 629 | |
| 630 val = Fprogn (Fcdr (args)); | |
| 631 | |
| 632 temp_output_buffer_show (buf); | |
| 633 | |
| 634 return unbind_to (count, val); | |
| 635 } | |
| 636 #endif /* not standalone */ | |
| 637 | |
| 638 static void print (); | |
| 639 | |
| 640 DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0, | |
| 7185 | 641 "Output a newline to stream PRINTCHARFUN.\n\ |
| 642 If PRINTCHARFUN is omitted or nil, the value of `standard-output' is used.") | |
| 329 | 643 (printcharfun) |
| 644 Lisp_Object printcharfun; | |
| 645 { | |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
646 PRINTDECLARE; |
| 329 | 647 |
| 520 | 648 if (NILP (printcharfun)) |
| 329 | 649 printcharfun = Vstandard_output; |
| 650 PRINTPREPARE; | |
| 651 PRINTCHAR ('\n'); | |
| 652 PRINTFINISH; | |
| 653 return Qt; | |
| 654 } | |
| 655 | |
| 656 DEFUN ("prin1", Fprin1, Sprin1, 1, 2, 0, | |
| 657 "Output the printed representation of OBJECT, any Lisp object.\n\ | |
| 658 Quoting characters are printed when needed to make output that `read'\n\ | |
| 659 can handle, whenever this is possible.\n\ | |
| 7185 | 660 Output stream is PRINTCHARFUN, or value of `standard-output' (which see).") |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
661 (object, printcharfun) |
|
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
662 Lisp_Object object, printcharfun; |
| 329 | 663 { |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
664 PRINTDECLARE; |
| 329 | 665 |
| 666 #ifdef MAX_PRINT_CHARS | |
| 667 max_print = 0; | |
| 668 #endif /* MAX_PRINT_CHARS */ | |
| 520 | 669 if (NILP (printcharfun)) |
| 329 | 670 printcharfun = Vstandard_output; |
| 671 PRINTPREPARE; | |
| 672 print_depth = 0; | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
673 print (object, printcharfun, 1); |
| 329 | 674 PRINTFINISH; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
675 return object; |
| 329 | 676 } |
| 677 | |
| 678 /* a buffer which is used to hold output being built by prin1-to-string */ | |
| 679 Lisp_Object Vprin1_to_string_buffer; | |
| 680 | |
| 681 DEFUN ("prin1-to-string", Fprin1_to_string, Sprin1_to_string, 1, 2, 0, | |
| 682 "Return a string containing the printed representation of OBJECT,\n\ | |
| 683 any Lisp object. Quoting characters are used when needed to make output\n\ | |
| 684 that `read' can handle, whenever this is possible, unless the optional\n\ | |
| 685 second argument NOESCAPE is non-nil.") | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
686 (object, noescape) |
|
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
687 Lisp_Object object, noescape; |
| 329 | 688 { |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
689 PRINTDECLARE; |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
690 Lisp_Object printcharfun; |
|
15270
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
691 struct gcpro gcpro1, gcpro2; |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
692 Lisp_Object tem; |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
693 |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
694 /* Save and restore this--we are altering a buffer |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
695 but we don't want to deactivate the mark just for that. |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
696 No need for specbind, since errors deactivate the mark. */ |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
697 tem = Vdeactivate_mark; |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
698 GCPRO2 (object, tem); |
| 329 | 699 |
| 700 printcharfun = Vprin1_to_string_buffer; | |
| 701 PRINTPREPARE; | |
| 702 print_depth = 0; | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
703 print (object, printcharfun, NILP (noescape)); |
| 329 | 704 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ |
| 705 PRINTFINISH; | |
| 706 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
707 object = Fbuffer_string (); |
| 329 | 708 |
| 709 Ferase_buffer (); | |
| 710 set_buffer_internal (old); | |
|
15270
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
711 |
|
22867e90511f
(Fprin1_to_string): Preserve Vdeactivate_mark.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
712 Vdeactivate_mark = tem; |
| 329 | 713 UNGCPRO; |
| 714 | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
715 return object; |
| 329 | 716 } |
| 717 | |
| 718 DEFUN ("princ", Fprinc, Sprinc, 1, 2, 0, | |
| 719 "Output the printed representation of OBJECT, any Lisp object.\n\ | |
| 720 No quoting characters are used; no delimiters are printed around\n\ | |
| 721 the contents of strings.\n\ | |
| 7185 | 722 Output stream is PRINTCHARFUN, or value of standard-output (which see).") |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
723 (object, printcharfun) |
|
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
724 Lisp_Object object, printcharfun; |
| 329 | 725 { |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
726 PRINTDECLARE; |
| 329 | 727 |
| 520 | 728 if (NILP (printcharfun)) |
| 329 | 729 printcharfun = Vstandard_output; |
| 730 PRINTPREPARE; | |
| 731 print_depth = 0; | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
732 print (object, printcharfun, 0); |
| 329 | 733 PRINTFINISH; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
734 return object; |
| 329 | 735 } |
| 736 | |
| 737 DEFUN ("print", Fprint, Sprint, 1, 2, 0, | |
| 738 "Output the printed representation of OBJECT, with newlines around it.\n\ | |
| 739 Quoting characters are printed when needed to make output that `read'\n\ | |
| 740 can handle, whenever this is possible.\n\ | |
| 7185 | 741 Output stream is PRINTCHARFUN, or value of `standard-output' (which see).") |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
742 (object, printcharfun) |
|
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
743 Lisp_Object object, printcharfun; |
| 329 | 744 { |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
745 PRINTDECLARE; |
| 329 | 746 struct gcpro gcpro1; |
| 747 | |
| 748 #ifdef MAX_PRINT_CHARS | |
| 749 print_chars = 0; | |
| 750 max_print = MAX_PRINT_CHARS; | |
| 751 #endif /* MAX_PRINT_CHARS */ | |
| 520 | 752 if (NILP (printcharfun)) |
| 329 | 753 printcharfun = Vstandard_output; |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
754 GCPRO1 (object); |
| 329 | 755 PRINTPREPARE; |
| 756 print_depth = 0; | |
| 757 PRINTCHAR ('\n'); | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
758 print (object, printcharfun, 1); |
| 329 | 759 PRINTCHAR ('\n'); |
| 760 PRINTFINISH; | |
| 761 #ifdef MAX_PRINT_CHARS | |
| 762 max_print = 0; | |
| 763 print_chars = 0; | |
| 764 #endif /* MAX_PRINT_CHARS */ | |
| 765 UNGCPRO; | |
|
14084
8765a56417ac
(Fwrite_char, Fprin1, Fprin1_to_string, Fprinc, Fprint): Harmonize
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
766 return object; |
| 329 | 767 } |
| 768 | |
| 769 /* The subroutine object for external-debugging-output is kept here | |
| 770 for the convenience of the debugger. */ | |
| 771 Lisp_Object Qexternal_debugging_output; | |
| 772 | |
| 621 | 773 DEFUN ("external-debugging-output", Fexternal_debugging_output, Sexternal_debugging_output, 1, 1, 0, |
| 774 "Write CHARACTER to stderr.\n\ | |
| 329 | 775 You can call print while debugging emacs, and pass it this function\n\ |
| 776 to make it write to the debugging output.\n") | |
| 621 | 777 (character) |
| 778 Lisp_Object character; | |
| 329 | 779 { |
| 780 CHECK_NUMBER (character, 0); | |
| 781 putc (XINT (character), stderr); | |
|
19882
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
782 |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
783 #ifdef WINDOWSNT |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
784 /* Send the output to a debugger (nothing happens if there isn't one). */ |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
785 { |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
786 char buf[2] = {(char) XINT (character), '\0'}; |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
787 OutputDebugString (buf); |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
788 } |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
789 #endif |
|
b6aaf1f70676
(Fexternal_debugging_output): On Windows output to debugger.
Richard M. Stallman <rms@gnu.org>
parents:
19001
diff
changeset
|
790 |
| 329 | 791 return character; |
| 792 } | |
|
6533
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
793 |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
794 /* This is the interface for debugging printing. */ |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
795 |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
796 void |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
797 debug_print (arg) |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
798 Lisp_Object arg; |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
799 { |
|
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
800 Fprin1 (arg, Qexternal_debugging_output); |
|
13456
b66f0626addb
(debug_print): Explicitly print a CR.
Richard M. Stallman <rms@gnu.org>
parents:
13405
diff
changeset
|
801 fprintf (stderr, "\r\n"); |
|
6533
49f896769be4
(debug_print): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5852
diff
changeset
|
802 } |
| 329 | 803 |
|
13776
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
804 DEFUN ("error-message-string", Ferror_message_string, Serror_message_string, |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
805 1, 1, 0, |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
806 "Convert an error value (ERROR-SYMBOL . DATA) to an error message.") |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
807 (obj) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
808 Lisp_Object obj; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
809 { |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
810 struct buffer *old = current_buffer; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
811 Lisp_Object original, printcharfun, value; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
812 struct gcpro gcpro1; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
813 |
|
18342
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
814 /* If OBJ is (error STRING), just return STRING. |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
815 That is not only faster, it also avoids the need to allocate |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
816 space here when the error is due to memory full. */ |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
817 if (CONSP (obj) && EQ (XCONS (obj)->car, Qerror) |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
818 && CONSP (XCONS (obj)->cdr) |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
819 && STRINGP (XCONS (XCONS (obj)->cdr)->car) |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
820 && NILP (XCONS (XCONS (obj)->cdr)->cdr)) |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
821 return XCONS (XCONS (obj)->cdr)->car; |
|
913d2cc5a6aa
(Ferror_message_string): Optimize (error STRING) case.
Richard M. Stallman <rms@gnu.org>
parents:
17509
diff
changeset
|
822 |
|
13776
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
823 print_error_message (obj, Vprin1_to_string_buffer, NULL); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
824 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
825 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
826 value = Fbuffer_string (); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
827 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
828 GCPRO1 (value); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
829 Ferase_buffer (); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
830 set_buffer_internal (old); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
831 UNGCPRO; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
832 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
833 return value; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
834 } |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
835 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
836 /* Print an error message for the error DATA |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
837 onto Lisp output stream STREAM (suitable for the print functions). */ |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
838 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
839 print_error_message (data, stream) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
840 Lisp_Object data, stream; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
841 { |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
842 Lisp_Object errname, errmsg, file_error, tail; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
843 struct gcpro gcpro1; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
844 int i; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
845 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
846 errname = Fcar (data); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
847 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
848 if (EQ (errname, Qerror)) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
849 { |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
850 data = Fcdr (data); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
851 if (!CONSP (data)) data = Qnil; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
852 errmsg = Fcar (data); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
853 file_error = Qnil; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
854 } |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
855 else |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
856 { |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
857 errmsg = Fget (errname, Qerror_message); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
858 file_error = Fmemq (Qfile_error, |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
859 Fget (errname, Qerror_conditions)); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
860 } |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
861 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
862 /* Print an error message including the data items. */ |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
863 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
864 tail = Fcdr_safe (data); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
865 GCPRO1 (tail); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
866 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
867 /* For file-error, make error message by concatenating |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
868 all the data items. They are all strings. */ |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
869 if (!NILP (file_error) && !NILP (tail)) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
870 errmsg = XCONS (tail)->car, tail = XCONS (tail)->cdr; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
871 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
872 if (STRINGP (errmsg)) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
873 Fprinc (errmsg, stream); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
874 else |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
875 write_string_1 ("peculiar error", -1, stream); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
876 |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
877 for (i = 0; CONSP (tail); tail = Fcdr (tail), i++) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
878 { |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
879 write_string_1 (i ? ", " : ": ", 2, stream); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
880 if (!NILP (file_error)) |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
881 Fprinc (Fcar (tail), stream); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
882 else |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
883 Fprin1 (Fcar (tail), stream); |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
884 } |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
885 UNGCPRO; |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
886 } |
|
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
887 |
| 329 | 888 #ifdef LISP_FLOAT_TYPE |
| 889 | |
| 890 /* | |
|
1759
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
891 * The buffer should be at least as large as the max string size of the |
| 14036 | 892 * largest float, printed in the biggest notation. This is undoubtedly |
| 329 | 893 * 20d float_output_format, with the negative of the C-constant "HUGE" |
| 894 * from <math.h>. | |
| 895 * | |
| 896 * On the vax the worst case is -1e38 in 20d format which takes 61 bytes. | |
| 897 * | |
| 898 * I assume that IEEE-754 format numbers can take 329 bytes for the worst | |
| 899 * case of -1e307 in 20d float_output_format. What is one to do (short of | |
| 900 * re-writing _doprnt to be more sane)? | |
| 901 * -wsr | |
| 902 */ | |
|
1759
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
903 |
|
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
904 void |
|
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
905 float_to_string (buf, data) |
|
1991
0f88f314fc34
* print.c (float_to_string): Define buf to be an unsigned char, to
Jim Blandy <jimb@redhat.com>
parents:
1967
diff
changeset
|
906 unsigned char *buf; |
| 329 | 907 double data; |
| 908 { | |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
909 unsigned char *cp; |
|
4224
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
910 int width; |
| 329 | 911 |
| 520 | 912 if (NILP (Vfloat_output_format) |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
913 || !STRINGP (Vfloat_output_format)) |
| 329 | 914 lose: |
|
4224
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
915 { |
| 20121 | 916 /* Generate the fewest number of digits that represent the |
| 917 floating point value without losing information. | |
| 918 The following method is simple but a bit slow. | |
| 919 For ideas about speeding things up, please see: | |
| 920 | |
| 921 Guy L Steele Jr & Jon L White, How to print floating-point numbers | |
| 922 accurately. SIGPLAN notices 25, 6 (June 1990), 112-126. | |
| 923 | |
| 924 Robert G Burger & R Kent Dybvig, Printing floating point numbers | |
| 925 quickly and accurately, SIGPLAN notices 31, 5 (May 1996), 108-116. */ | |
| 926 | |
| 927 width = fabs (data) < DBL_MIN ? 1 : DBL_DIG; | |
| 928 do | |
| 929 sprintf (buf, "%.*g", width, data); | |
| 930 while (width++ < DOUBLE_DIGITS_BOUND && atof (buf) != data); | |
|
4224
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
931 } |
| 329 | 932 else /* oink oink */ |
| 933 { | |
| 934 /* Check that the spec we have is fully valid. | |
| 935 This means not only valid for printf, | |
| 936 but meant for floats, and reasonable. */ | |
| 937 cp = XSTRING (Vfloat_output_format)->data; | |
| 938 | |
| 939 if (cp[0] != '%') | |
| 940 goto lose; | |
| 941 if (cp[1] != '.') | |
| 942 goto lose; | |
| 943 | |
| 944 cp += 2; | |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
945 |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
946 /* Check the width specification. */ |
|
4224
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
947 width = -1; |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
948 if ('0' <= *cp && *cp <= '9') |
|
11798
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
949 { |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
950 width = 0; |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
951 do |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
952 width = (width * 10) + (*cp++ - '0'); |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
953 while (*cp >= '0' && *cp <= '9'); |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
954 |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
955 /* A precision of zero is valid only for %f. */ |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
956 if (width > DBL_DIG |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
957 || (width == 0 && *cp != 'f')) |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
958 goto lose; |
|
7646040d7383
(float_to_string): Fix type mismatch and simplify.
Karl Heuer <kwzh@gnu.org>
parents:
11697
diff
changeset
|
959 } |
| 329 | 960 |
| 961 if (*cp != 'e' && *cp != 'f' && *cp != 'g') | |
| 962 goto lose; | |
| 963 | |
| 964 if (cp[1] != 0) | |
| 965 goto lose; | |
| 966 | |
| 967 sprintf (buf, XSTRING (Vfloat_output_format)->data, data); | |
| 968 } | |
|
1759
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
969 |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
970 /* Make sure there is a decimal point with digit after, or an |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
971 exponent, so that the value is readable as a float. But don't do |
|
4224
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
972 this with "%.0f"; it's valid for that not to produce a decimal |
|
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
973 point. Note that width can be 0 only for %.0f. */ |
|
6cb1cfba6500
(float_to_string): Don't use uninitialized pointer `cp'.
Richard M. Stallman <rms@gnu.org>
parents:
4140
diff
changeset
|
974 if (width != 0) |
|
1764
94ff5d9ef48a
(float_to_string): Add final 0 if text ends with decimal pt.
Richard M. Stallman <rms@gnu.org>
parents:
1759
diff
changeset
|
975 { |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
976 for (cp = buf; *cp; cp++) |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
977 if ((*cp < '0' || *cp > '9') && *cp != '-') |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
978 break; |
|
1764
94ff5d9ef48a
(float_to_string): Add final 0 if text ends with decimal pt.
Richard M. Stallman <rms@gnu.org>
parents:
1759
diff
changeset
|
979 |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
980 if (*cp == '.' && cp[1] == 0) |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
981 { |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
982 cp[1] = '0'; |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
983 cp[2] = 0; |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
984 } |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
985 |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
986 if (*cp == 0) |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
987 { |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
988 *cp++ = '.'; |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
989 *cp++ = '0'; |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
990 *cp++ = 0; |
|
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
991 } |
|
1759
3c615a9dcd64
(float_to_string): Add `.0' at end if needed.
Richard M. Stallman <rms@gnu.org>
parents:
1521
diff
changeset
|
992 } |
| 329 | 993 } |
| 994 #endif /* LISP_FLOAT_TYPE */ | |
| 995 | |
| 996 static void | |
| 997 print (obj, printcharfun, escapeflag) | |
| 998 Lisp_Object obj; | |
| 999 register Lisp_Object printcharfun; | |
| 1000 int escapeflag; | |
| 1001 { | |
| 1002 char buf[30]; | |
| 1003 | |
| 1004 QUIT; | |
| 1005 | |
|
379
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1006 #if 1 /* I'm not sure this is really worth doing. */ |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1007 /* Detect circularities and truncate them. |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1008 No need to offer any alternative--this is better than an error. */ |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
1009 if (CONSP (obj) || VECTORP (obj) || COMPILEDP (obj)) |
|
379
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1010 { |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1011 int i; |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1012 for (i = 0; i < print_depth; i++) |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1013 if (EQ (obj, being_printed[i])) |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1014 { |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1015 sprintf (buf, "#%d", i); |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1016 strout (buf, -1, printcharfun); |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1017 return; |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1018 } |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1019 } |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1020 #endif |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1021 |
|
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1022 being_printed[print_depth] = obj; |
| 329 | 1023 print_depth++; |
| 1024 | |
|
379
34ec8957c6c0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
373
diff
changeset
|
1025 if (print_depth > PRINT_CIRCLE) |
| 329 | 1026 error ("Apparently circular structure being printed"); |
| 1027 #ifdef MAX_PRINT_CHARS | |
| 1028 if (max_print && print_chars > max_print) | |
| 1029 { | |
| 1030 PRINTCHAR ('\n'); | |
| 1031 print_chars = 0; | |
| 1032 } | |
| 1033 #endif /* MAX_PRINT_CHARS */ | |
| 1034 | |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1035 switch (XGCTYPE (obj)) |
| 329 | 1036 { |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1037 case Lisp_Int: |
|
11697
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1038 if (sizeof (int) == sizeof (EMACS_INT)) |
|
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1039 sprintf (buf, "%d", XINT (obj)); |
|
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1040 else if (sizeof (long) == sizeof (EMACS_INT)) |
|
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1041 sprintf (buf, "%ld", XINT (obj)); |
|
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1042 else |
|
2de5b0c89802
(print): Make the printing understand EMACS_INTs
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1043 abort (); |
| 329 | 1044 strout (buf, -1, printcharfun); |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1045 break; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1046 |
| 10001 | 1047 #ifdef LISP_FLOAT_TYPE |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1048 case Lisp_Float: |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1049 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1050 char pigbuf[350]; /* see comments in float_to_string */ |
| 329 | 1051 |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1052 float_to_string (pigbuf, XFLOAT(obj)->data); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1053 strout (pigbuf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1054 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1055 break; |
| 10001 | 1056 #endif |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1057 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1058 case Lisp_String: |
| 329 | 1059 if (!escapeflag) |
| 1060 print_string (obj, printcharfun); | |
| 1061 else | |
| 1062 { | |
| 1063 register int i; | |
| 1064 register unsigned char c; | |
| 1065 struct gcpro gcpro1; | |
| 1066 | |
| 1967 | 1067 GCPRO1 (obj); |
| 1068 | |
| 1069 #ifdef USE_TEXT_PROPERTIES | |
| 1070 if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) | |
| 1071 { | |
| 1072 PRINTCHAR ('#'); | |
| 1073 PRINTCHAR ('('); | |
| 1074 } | |
| 1075 #endif | |
| 329 | 1076 |
| 1077 PRINTCHAR ('\"'); | |
| 1078 for (i = 0; i < XSTRING (obj)->size; i++) | |
| 1079 { | |
| 1080 QUIT; | |
| 1081 c = XSTRING (obj)->data[i]; | |
| 1082 if (c == '\n' && print_escape_newlines) | |
| 1083 { | |
| 1084 PRINTCHAR ('\\'); | |
| 1085 PRINTCHAR ('n'); | |
| 1086 } | |
|
5852
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1087 else if (c == '\f' && print_escape_newlines) |
|
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1088 { |
|
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1089 PRINTCHAR ('\\'); |
|
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1090 PRINTCHAR ('f'); |
|
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1091 } |
| 329 | 1092 else |
| 1093 { | |
| 1094 if (c == '\"' || c == '\\') | |
| 1095 PRINTCHAR ('\\'); | |
| 1096 PRINTCHAR (c); | |
| 1097 } | |
| 1098 } | |
| 1099 PRINTCHAR ('\"'); | |
| 1967 | 1100 |
| 1101 #ifdef USE_TEXT_PROPERTIES | |
| 1102 if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) | |
| 1103 { | |
| 1104 traverse_intervals (XSTRING (obj)->intervals, | |
| 1105 0, 0, print_interval, printcharfun); | |
| 1106 PRINTCHAR (')'); | |
| 1107 } | |
| 1108 #endif | |
| 1109 | |
| 329 | 1110 UNGCPRO; |
| 1111 } | |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1112 break; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1113 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1114 case Lisp_Symbol: |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1115 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1116 register int confusing; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1117 register unsigned char *p = XSYMBOL (obj)->name->data; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1118 register unsigned char *end = p + XSYMBOL (obj)->name->size; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1119 register unsigned char c; |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1120 int i; |
| 329 | 1121 |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1122 if (p != end && (*p == '-' || *p == '+')) p++; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1123 if (p == end) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1124 confusing = 0; |
|
17509
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1125 /* If symbol name begins with a digit, and ends with a digit, |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1126 and contains nothing but digits and `e', it could be treated |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1127 as a number. So set CONFUSING. |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1128 |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1129 Symbols that contain periods could also be taken as numbers, |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1130 but periods are always escaped, so we don't have to worry |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1131 about them here. */ |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1132 else if (*p >= '0' && *p <= '9' |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1133 && end[-1] >= '0' && end[-1] <= '9') |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1134 { |
|
17223
ed068c0c1648
(print): Generate a backslash in \2e10.
Richard M. Stallman <rms@gnu.org>
parents:
17040
diff
changeset
|
1135 while (p != end && ((*p >= '0' && *p <= '9') |
|
ed068c0c1648
(print): Generate a backslash in \2e10.
Richard M. Stallman <rms@gnu.org>
parents:
17040
diff
changeset
|
1136 /* Needed for \2e10. */ |
|
ed068c0c1648
(print): Generate a backslash in \2e10.
Richard M. Stallman <rms@gnu.org>
parents:
17040
diff
changeset
|
1137 || *p == 'e')) |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1138 p++; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1139 confusing = (end == p); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1140 } |
|
17509
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1141 else |
|
0c38918fbf13
(print): Symbols like e2 and 2e are not confusing.
Richard M. Stallman <rms@gnu.org>
parents:
17325
diff
changeset
|
1142 confusing = 0; |
| 329 | 1143 |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1144 /* If we print an uninterned symbol as part of a complex object and |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1145 the flag print-gensym is non-nil, prefix it with #n= to read the |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1146 object back with the #n# reader syntax later if needed. */ |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1147 if (! NILP (Vprint_gensym) && NILP (XSYMBOL (obj)->obarray)) |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1148 { |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1149 if (print_depth > 1) |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1150 { |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1151 Lisp_Object tem; |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1152 tem = Fassq (obj, Vprint_gensym_alist); |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1153 if (CONSP (tem)) |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1154 { |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1155 PRINTCHAR ('#'); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1156 print (XCDR (tem), printcharfun, escapeflag); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1157 PRINTCHAR ('#'); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1158 break; |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1159 } |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1160 else |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1161 { |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1162 if (CONSP (Vprint_gensym_alist)) |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1163 XSETFASTINT (tem, XFASTINT (XCDR (XCAR (Vprint_gensym_alist))) + 1); |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1164 else |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1165 XSETFASTINT (tem, 1); |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1166 Vprint_gensym_alist = Fcons (Fcons (obj, tem), Vprint_gensym_alist); |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1167 |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1168 PRINTCHAR ('#'); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1169 print (tem, printcharfun, escapeflag); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1170 PRINTCHAR ('='); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1171 } |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1172 } |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1173 PRINTCHAR ('#'); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1174 PRINTCHAR (':'); |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1175 } |
|
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1176 |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1177 for (i = 0; i < XSYMBOL (obj)->name->size; i++) |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1178 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1179 QUIT; |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1180 c = XSYMBOL (obj)->name->data[i]; |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1181 |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1182 if (escapeflag) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1183 { |
|
16496
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1184 if (c == '\"' || c == '\\' || c == '\'' |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1185 || c == ';' || c == '#' || c == '(' || c == ')' |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1186 || c == ',' || c =='.' || c == '`' |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1187 || c == '[' || c == ']' || c == '?' || c <= 040 |
|
a4e5a8ee32cc
(printchar, strout): Do QUIT for echo area output.
Richard M. Stallman <rms@gnu.org>
parents:
16140
diff
changeset
|
1188 || confusing) |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1189 PRINTCHAR ('\\'), confusing = 0; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1190 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1191 PRINTCHAR (c); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1192 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1193 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1194 break; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1195 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1196 case Lisp_Cons: |
| 329 | 1197 /* If deeper than spec'd depth, print placeholder. */ |
|
9117
f69e6cf74874
(PRINTPREPARE, PRINTFINISH, float_to_string, print): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8854
diff
changeset
|
1198 if (INTEGERP (Vprint_level) |
| 329 | 1199 && print_depth > XINT (Vprint_level)) |
| 10001 | 1200 strout ("...", -1, printcharfun); |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1201 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1202 && (EQ (XCAR (obj), Qquote))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1203 { |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1204 PRINTCHAR ('\''); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1205 print (XCAR (XCDR (obj)), printcharfun, escapeflag); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1206 } |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1207 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1208 && (EQ (XCAR (obj), Qfunction))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1209 { |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1210 PRINTCHAR ('#'); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1211 PRINTCHAR ('\''); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1212 print (XCAR (XCDR (obj)), printcharfun, escapeflag); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1213 } |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1214 else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1215 && ((EQ (XCAR (obj), Qbackquote) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1216 || EQ (XCAR (obj), Qcomma) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1217 || EQ (XCAR (obj), Qcomma_at) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1218 || EQ (XCAR (obj), Qcomma_dot)))) |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1219 { |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1220 print (XCAR (obj), printcharfun, 0); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1221 print (XCAR (XCDR (obj)), printcharfun, escapeflag); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1222 } |
| 10001 | 1223 else |
| 329 | 1224 { |
| 10001 | 1225 PRINTCHAR ('('); |
| 329 | 1226 { |
| 10001 | 1227 register int i = 0; |
| 1228 register int max = 0; | |
| 1229 | |
| 1230 if (INTEGERP (Vprint_length)) | |
| 1231 max = XINT (Vprint_length); | |
| 1232 /* Could recognize circularities in cdrs here, | |
| 1233 but that would make printing of long lists quadratic. | |
| 1234 It's not worth doing. */ | |
| 1235 while (CONSP (obj)) | |
| 329 | 1236 { |
| 10001 | 1237 if (i++) |
| 1238 PRINTCHAR (' '); | |
| 1239 if (max && i > max) | |
| 1240 { | |
| 1241 strout ("...", 3, printcharfun); | |
| 1242 break; | |
| 1243 } | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1244 print (XCAR (obj), printcharfun, escapeflag); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1245 obj = XCDR (obj); |
| 329 | 1246 } |
| 1247 } | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1248 if (!NILP (obj)) |
| 10001 | 1249 { |
| 1250 strout (" . ", 3, printcharfun); | |
| 1251 print (obj, printcharfun, escapeflag); | |
| 1252 } | |
| 1253 PRINTCHAR (')'); | |
| 329 | 1254 } |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1255 break; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1256 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1257 case Lisp_Vectorlike: |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1258 if (PROCESSP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1259 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1260 if (escapeflag) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1261 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1262 strout ("#<process ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1263 print_string (XPROCESS (obj)->name, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1264 PRINTCHAR ('>'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1265 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1266 else |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1267 print_string (XPROCESS (obj)->name, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1268 } |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1269 else if (BOOL_VECTOR_P (obj)) |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1270 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1271 register int i; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1272 register unsigned char c; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1273 struct gcpro gcpro1; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1274 int size_in_chars |
|
16893
5889a6e7c71b
(print): Round size of bool-vector properly.
Richard M. Stallman <rms@gnu.org>
parents:
16520
diff
changeset
|
1275 = (XBOOL_VECTOR (obj)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR; |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1276 |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1277 GCPRO1 (obj); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1278 |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1279 PRINTCHAR ('#'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1280 PRINTCHAR ('&'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1281 sprintf (buf, "%d", XBOOL_VECTOR (obj)->size); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1282 strout (buf, -1, printcharfun); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1283 PRINTCHAR ('\"'); |
|
15563
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1284 |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1285 /* Don't print more characters than the specified maximum. */ |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1286 if (INTEGERP (Vprint_length) |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1287 && XINT (Vprint_length) < size_in_chars) |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1288 size_in_chars = XINT (Vprint_length); |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1289 |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1290 for (i = 0; i < size_in_chars; i++) |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1291 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1292 QUIT; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1293 c = XBOOL_VECTOR (obj)->data[i]; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1294 if (c == '\n' && print_escape_newlines) |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1295 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1296 PRINTCHAR ('\\'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1297 PRINTCHAR ('n'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1298 } |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1299 else if (c == '\f' && print_escape_newlines) |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1300 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1301 PRINTCHAR ('\\'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1302 PRINTCHAR ('f'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1303 } |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1304 else |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1305 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1306 if (c == '\"' || c == '\\') |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1307 PRINTCHAR ('\\'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1308 PRINTCHAR (c); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1309 } |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1310 } |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1311 PRINTCHAR ('\"'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1312 |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1313 UNGCPRO; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1314 } |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1315 else if (SUBRP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1316 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1317 strout ("#<subr ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1318 strout (XSUBR (obj)->symbol_name, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1319 PRINTCHAR ('>'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1320 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1321 #ifndef standalone |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1322 else if (WINDOWP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1323 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1324 strout ("#<window ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1325 sprintf (buf, "%d", XFASTINT (XWINDOW (obj)->sequence_number)); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1326 strout (buf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1327 if (!NILP (XWINDOW (obj)->buffer)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1328 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1329 strout (" on ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1330 print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1331 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1332 PRINTCHAR ('>'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1333 } |
|
10301
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1334 else if (BUFFERP (obj)) |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1335 { |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1336 if (NILP (XBUFFER (obj)->name)) |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1337 strout ("#<killed buffer>", -1, printcharfun); |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1338 else if (escapeflag) |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1339 { |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1340 strout ("#<buffer ", -1, printcharfun); |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1341 print_string (XBUFFER (obj)->name, printcharfun); |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1342 PRINTCHAR ('>'); |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1343 } |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1344 else |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1345 print_string (XBUFFER (obj)->name, printcharfun); |
|
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1346 } |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1347 else if (WINDOW_CONFIGURATIONP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1348 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1349 strout ("#<window-configuration>", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1350 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1351 else if (FRAMEP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1352 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1353 strout ((FRAME_LIVE_P (XFRAME (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1354 ? "#<frame " : "#<dead frame "), |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1355 -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1356 print_string (XFRAME (obj)->name, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1357 sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj))); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1358 strout (buf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1359 PRINTCHAR ('>'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1360 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1361 #endif /* not standalone */ |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1362 else |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1363 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1364 int size = XVECTOR (obj)->size; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1365 if (COMPILEDP (obj)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1366 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1367 PRINTCHAR ('#'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1368 size &= PSEUDOVECTOR_SIZE_MASK; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1369 } |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1370 if (CHAR_TABLE_P (obj)) |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1371 { |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1372 /* We print a char-table as if it were a vector, |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1373 lumping the parent and default slots in with the |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1374 character slots. But we add #^ as a prefix. */ |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1375 PRINTCHAR ('#'); |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1376 PRINTCHAR ('^'); |
|
17325
c19c552c486f
(read1): Adjusted for the new structure of Lisp_Char_Table.
Kenichi Handa <handa@m17n.org>
parents:
17223
diff
changeset
|
1377 if (SUB_CHAR_TABLE_P (obj)) |
|
c19c552c486f
(read1): Adjusted for the new structure of Lisp_Char_Table.
Kenichi Handa <handa@m17n.org>
parents:
17223
diff
changeset
|
1378 PRINTCHAR ('^'); |
|
13147
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1379 size &= PSEUDOVECTOR_SIZE_MASK; |
|
bd9ff4ee6cd4
(print): Handle chartables and boolvectors.
Richard M. Stallman <rms@gnu.org>
parents:
12782
diff
changeset
|
1380 } |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1381 if (size & PSEUDOVECTOR_FLAG) |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1382 goto badtype; |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1383 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1384 PRINTCHAR ('['); |
| 329 | 1385 { |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1386 register int i; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1387 register Lisp_Object tem; |
|
15563
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1388 |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1389 /* Don't print more elements than the specified maximum. */ |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1390 if (INTEGERP (Vprint_length) |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1391 && XINT (Vprint_length) < size) |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1392 size = XINT (Vprint_length); |
|
e47df82909ff
(print): Obey Vprint_length for vectors, bitvectors.
Richard M. Stallman <rms@gnu.org>
parents:
15270
diff
changeset
|
1393 |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1394 for (i = 0; i < size; i++) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1395 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1396 if (i) PRINTCHAR (' '); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1397 tem = XVECTOR (obj)->contents[i]; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1398 print (tem, printcharfun, escapeflag); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1399 } |
| 329 | 1400 } |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1401 PRINTCHAR (']'); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1402 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1403 break; |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1404 |
| 329 | 1405 #ifndef standalone |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1406 case Lisp_Misc: |
|
11241
5fed07fb66fb
(print): Use XMISCTYPE.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1407 switch (XMISCTYPE (obj)) |
| 329 | 1408 { |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1409 case Lisp_Misc_Marker: |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1410 strout ("#<marker ", -1, printcharfun); |
| 17040 | 1411 #if 0 |
| 1412 /* Do you think this is necessary? */ | |
| 1413 if (XMARKER (obj)->insertion_type != 0) | |
| 1414 strout ("(before-insertion) ", -1, printcharfun); | |
| 1415 #endif /* 0 */ | |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1416 if (!(XMARKER (obj)->buffer)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1417 strout ("in no buffer", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1418 else |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1419 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1420 sprintf (buf, "at %d", marker_position (obj)); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1421 strout (buf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1422 strout (" in ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1423 print_string (XMARKER (obj)->buffer->name, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1424 } |
| 329 | 1425 PRINTCHAR ('>'); |
|
10301
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1426 break; |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1427 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1428 case Lisp_Misc_Overlay: |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1429 strout ("#<overlay ", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1430 if (!(XMARKER (OVERLAY_START (obj))->buffer)) |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1431 strout ("in no buffer", -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1432 else |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1433 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1434 sprintf (buf, "from %d to %d in ", |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1435 marker_position (OVERLAY_START (obj)), |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1436 marker_position (OVERLAY_END (obj))); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1437 strout (buf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1438 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1439 printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1440 } |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1441 PRINTCHAR ('>'); |
|
10301
aa73a5c0d1f2
(print): Don't drop thru to error for markers and overlays.
Richard M. Stallman <rms@gnu.org>
parents:
10293
diff
changeset
|
1442 break; |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1443 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1444 /* Remaining cases shouldn't happen in normal usage, but let's print |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1445 them anyway for the benefit of the debugger. */ |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1446 case Lisp_Misc_Free: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1447 strout ("#<misc free cell>", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1448 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1449 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1450 case Lisp_Misc_Intfwd: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1451 sprintf (buf, "#<intfwd to %d>", *XINTFWD (obj)->intvar); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1452 strout (buf, -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1453 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1454 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1455 case Lisp_Misc_Boolfwd: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1456 sprintf (buf, "#<boolfwd to %s>", |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1457 (*XBOOLFWD (obj)->boolvar ? "t" : "nil")); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1458 strout (buf, -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1459 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1460 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1461 case Lisp_Misc_Objfwd: |
|
15707
303f5be100a9
(print): Fix args in strout calls.
Karl Heuer <kwzh@gnu.org>
parents:
15563
diff
changeset
|
1462 strout ("#<objfwd to ", -1, printcharfun); |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1463 print (*XOBJFWD (obj)->objvar, printcharfun, escapeflag); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1464 PRINTCHAR ('>'); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1465 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1466 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1467 case Lisp_Misc_Buffer_Objfwd: |
|
15707
303f5be100a9
(print): Fix args in strout calls.
Karl Heuer <kwzh@gnu.org>
parents:
15563
diff
changeset
|
1468 strout ("#<buffer_objfwd to ", -1, printcharfun); |
|
10583
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1469 print (*(Lisp_Object *)((char *)current_buffer |
|
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1470 + XBUFFER_OBJFWD (obj)->offset), |
|
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1471 printcharfun, escapeflag); |
|
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1472 PRINTCHAR ('>'); |
|
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1473 break; |
|
6736693cb8c8
(print): Handle internal display-local object.
Karl Heuer <kwzh@gnu.org>
parents:
10568
diff
changeset
|
1474 |
|
11010
45ae0022c48a
(print): Rename perdisplay to kboard.
Karl Heuer <kwzh@gnu.org>
parents:
10993
diff
changeset
|
1475 case Lisp_Misc_Kboard_Objfwd: |
|
15707
303f5be100a9
(print): Fix args in strout calls.
Karl Heuer <kwzh@gnu.org>
parents:
15563
diff
changeset
|
1476 strout ("#<kboard_objfwd to ", -1, printcharfun); |
|
11010
45ae0022c48a
(print): Rename perdisplay to kboard.
Karl Heuer <kwzh@gnu.org>
parents:
10993
diff
changeset
|
1477 print (*(Lisp_Object *)((char *) current_kboard |
|
45ae0022c48a
(print): Rename perdisplay to kboard.
Karl Heuer <kwzh@gnu.org>
parents:
10993
diff
changeset
|
1478 + XKBOARD_OBJFWD (obj)->offset), |
|
10993
e72bd65cab70
(print): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
10651
diff
changeset
|
1479 printcharfun, escapeflag); |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1480 PRINTCHAR ('>'); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1481 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1482 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1483 case Lisp_Misc_Buffer_Local_Value: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1484 strout ("#<buffer_local_value ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1485 goto do_buffer_local; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1486 case Lisp_Misc_Some_Buffer_Local_Value: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1487 strout ("#<some_buffer_local_value ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1488 do_buffer_local: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1489 strout ("[realvalue] ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1490 print (XBUFFER_LOCAL_VALUE (obj)->car, printcharfun, escapeflag); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1491 strout ("[buffer] ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1492 print (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->car, |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1493 printcharfun, escapeflag); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1494 strout ("[alist-elt] ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1495 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->car, |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1496 printcharfun, escapeflag); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1497 strout ("[default-value] ", -1, printcharfun); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1498 print (XCONS (XCONS (XBUFFER_LOCAL_VALUE (obj)->cdr)->cdr)->cdr, |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1499 printcharfun, escapeflag); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1500 PRINTCHAR ('>'); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1501 break; |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1502 |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1503 default: |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1504 goto badtype; |
| 329 | 1505 } |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1506 break; |
| 329 | 1507 #endif /* standalone */ |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1508 |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1509 default: |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1510 badtype: |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1511 { |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1512 /* We're in trouble if this happens! |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1513 Probably should just abort () */ |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1514 strout ("#<EMACS BUG: INVALID DATATYPE ", -1, printcharfun); |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1515 if (MISCP (obj)) |
|
11241
5fed07fb66fb
(print): Use XMISCTYPE.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1516 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); |
|
10482
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1517 else if (VECTORLIKEP (obj)) |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1518 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1519 else |
|
a15a058ec779
(print): Print internal types too, for debugging.
Karl Heuer <kwzh@gnu.org>
parents:
10418
diff
changeset
|
1520 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); |
|
10293
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1521 strout (buf, -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1522 strout (" Save your buffers immediately and please report this bug>", |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1523 -1, printcharfun); |
|
96cc5c0a7ada
(print): Get size of compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10001
diff
changeset
|
1524 } |
| 329 | 1525 } |
| 1526 | |
| 1527 print_depth--; | |
| 1528 } | |
| 1529 | |
| 1967 | 1530 #ifdef USE_TEXT_PROPERTIES |
| 1531 | |
| 1532 /* Print a description of INTERVAL using PRINTCHARFUN. | |
| 1533 This is part of printing a string that has text properties. */ | |
| 1534 | |
| 1535 void | |
| 1536 print_interval (interval, printcharfun) | |
| 1537 INTERVAL interval; | |
| 1538 Lisp_Object printcharfun; | |
| 1539 { | |
|
4003
49918d6c6dda
* print.c: Get rid of extra space at the end of print syntax for
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
1540 PRINTCHAR (' '); |
| 1967 | 1541 print (make_number (interval->position), printcharfun, 1); |
| 1542 PRINTCHAR (' '); | |
| 1543 print (make_number (interval->position + LENGTH (interval)), | |
| 1544 printcharfun, 1); | |
| 1545 PRINTCHAR (' '); | |
| 1546 print (interval->plist, printcharfun, 1); | |
| 1547 } | |
| 1548 | |
| 1549 #endif /* USE_TEXT_PROPERTIES */ | |
| 1550 | |
| 329 | 1551 void |
| 1552 syms_of_print () | |
| 1553 { | |
| 1554 DEFVAR_LISP ("standard-output", &Vstandard_output, | |
| 1555 "Output stream `print' uses by default for outputting a character.\n\ | |
| 1556 This may be any function of one argument.\n\ | |
| 1557 It may also be a buffer (output is inserted before point)\n\ | |
| 1558 or a marker (output is inserted and the marker is advanced)\n\ | |
|
13776
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
1559 or the symbol t (output appears in the echo area)."); |
| 329 | 1560 Vstandard_output = Qt; |
| 1561 Qstandard_output = intern ("standard-output"); | |
| 1562 staticpro (&Qstandard_output); | |
| 1563 | |
| 1564 #ifdef LISP_FLOAT_TYPE | |
| 1565 DEFVAR_LISP ("float-output-format", &Vfloat_output_format, | |
|
687
e2b747dd6a6e
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
686
diff
changeset
|
1566 "The format descriptor string used to print floats.\n\ |
| 329 | 1567 This is a %-spec like those accepted by `printf' in C,\n\ |
| 1568 but with some restrictions. It must start with the two characters `%.'.\n\ | |
| 1569 After that comes an integer precision specification,\n\ | |
| 1570 and then a letter which controls the format.\n\ | |
| 1571 The letters allowed are `e', `f' and `g'.\n\ | |
| 1572 Use `e' for exponential notation \"DIG.DIGITSeEXPT\"\n\ | |
| 1573 Use `f' for decimal point notation \"DIGITS.DIGITS\".\n\ | |
| 1574 Use `g' to choose the shorter of those two formats for the number at hand.\n\ | |
| 1575 The precision in any of these cases is the number of digits following\n\ | |
| 1576 the decimal point. With `f', a precision of 0 means to omit the\n\ | |
|
4140
2738089e8383
* print.c (float_to_string): Distinguish between a precision of
Jim Blandy <jimb@redhat.com>
parents:
4003
diff
changeset
|
1577 decimal point. 0 is not allowed with `e' or `g'.\n\n\ |
| 20121 | 1578 A value of nil means to use the shortest notation\n\ |
| 1579 that represents the number without losing information."); | |
| 329 | 1580 Vfloat_output_format = Qnil; |
| 1581 Qfloat_output_format = intern ("float-output-format"); | |
| 1582 staticpro (&Qfloat_output_format); | |
| 1583 #endif /* LISP_FLOAT_TYPE */ | |
| 1584 | |
| 1585 DEFVAR_LISP ("print-length", &Vprint_length, | |
|
686
bd3068742807
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
621
diff
changeset
|
1586 "Maximum length of list to print before abbreviating.\n\ |
| 329 | 1587 A value of nil means no limit."); |
| 1588 Vprint_length = Qnil; | |
| 1589 | |
| 1590 DEFVAR_LISP ("print-level", &Vprint_level, | |
|
686
bd3068742807
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
621
diff
changeset
|
1591 "Maximum depth of list nesting to print before abbreviating.\n\ |
| 329 | 1592 A value of nil means no limit."); |
| 1593 Vprint_level = Qnil; | |
| 1594 | |
| 1595 DEFVAR_BOOL ("print-escape-newlines", &print_escape_newlines, | |
|
6802
7d69da13c140
(syms_of_print): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6533
diff
changeset
|
1596 "Non-nil means print newlines in strings as backslash-n.\n\ |
|
5852
f2e341b1f908
(print): If print_escapes_newlines, print '\f' as "\\f".
Roland McGrath <roland@gnu.org>
parents:
5487
diff
changeset
|
1597 Also print formfeeds as backslash-f."); |
| 329 | 1598 print_escape_newlines = 0; |
| 1599 | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1600 DEFVAR_BOOL ("print-quoted", &print_quoted, |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1601 "Non-nil means print quoted forms with reader syntax.\n\ |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1602 I.e., (quote foo) prints as 'foo, (function foo) as #'foo, and, backquoted\n\ |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1603 forms print in the new syntax."); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1604 print_quoted = 0; |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1605 |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1606 DEFVAR_LISP ("print-gensym", &Vprint_gensym, |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1607 "Non-nil means print uninterned symbols so they will read as uninterned.\n\ |
|
20025
37e3d9d78ad7
(syms_of_print): Fix doc string of print-gensym.
Karl Heuer <kwzh@gnu.org>
parents:
19882
diff
changeset
|
1608 I.e., the value of (make-symbol \"foobar\") prints as #:foobar.\n\ |
|
18961
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1609 When the uninterned symbol appears within a larger data structure,\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1610 in addition use the #...# and #...= constructs as needed,\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1611 so that multiple references to the same symbol are shared once again\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1612 when the text is read back.\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1613 \n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1614 If the value of `print-gensym' is a cons cell, then in addition refrain from\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1615 clearing `print-gensym-alist' on entry to and exit from printing functions,\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1616 so that the use of #...# and #...= can carry over for several separately\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1617 printed objects."); |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1618 Vprint_gensym = Qnil; |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1619 |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1620 DEFVAR_LISP ("print-gensym-alist", &Vprint_gensym_alist, |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1621 "Association list of elements (GENSYM . N) to guide use of #N# and #N=.\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1622 In each element, GENSYM is an uninterned symbol that has been associated\n\ |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1623 with #N= for the specified value of N."); |
|
e537071624ee
(Vprint_gensym_alist): Renamed from printed_gensyms.
Richard M. Stallman <rms@gnu.org>
parents:
18613
diff
changeset
|
1624 Vprint_gensym_alist = Qnil; |
|
16140
e7de214aac01
Add #n=object, #n#, and #:symbol constructs to printer.
Erik Naggum <erik@naggum.no>
parents:
16051
diff
changeset
|
1625 |
| 329 | 1626 /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ |
| 1627 staticpro (&Vprin1_to_string_buffer); | |
| 1628 | |
| 1629 defsubr (&Sprin1); | |
| 1630 defsubr (&Sprin1_to_string); | |
|
13776
8160ed43603e
(Ferror_message_string): New function.
Karl Heuer <kwzh@gnu.org>
parents:
13456
diff
changeset
|
1631 defsubr (&Serror_message_string); |
| 329 | 1632 defsubr (&Sprinc); |
| 1633 defsubr (&Sprint); | |
| 1634 defsubr (&Sterpri); | |
| 1635 defsubr (&Swrite_char); | |
| 1636 defsubr (&Sexternal_debugging_output); | |
| 1637 | |
| 1638 Qexternal_debugging_output = intern ("external-debugging-output"); | |
| 1639 staticpro (&Qexternal_debugging_output); | |
| 1640 | |
|
15908
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1641 Qprint_escape_newlines = intern ("print-escape-newlines"); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1642 staticpro (&Qprint_escape_newlines); |
|
045bf20a0e7c
(print-quoted): New variable.
Erik Naggum <erik@naggum.no>
parents:
15801
diff
changeset
|
1643 |
| 329 | 1644 #ifndef standalone |
| 1645 defsubr (&Swith_output_to_temp_buffer); | |
| 1646 #endif /* not standalone */ | |
| 1647 } |
