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