aboutsummaryrefslogtreecommitdiffstats
path: root/src/print.c
diff options
context:
space:
mode:
authorStefan Monnier2010-09-30 01:28:20 +0200
committerStefan Monnier2010-09-30 01:28:20 +0200
commita01a7932080e8a6e7bc8472c58cefabcc2c37df3 (patch)
tree94b28b19c8f1536e76ffe7d5826811b74a79e3a5 /src/print.c
parentcc390e46c7ba95b76ea133d98fd386214cd01709 (diff)
parent6b0f7311f16646e0de2045b2410e20921901c616 (diff)
downloademacs-a01a7932080e8a6e7bc8472c58cefabcc2c37df3.tar.gz
emacs-a01a7932080e8a6e7bc8472c58cefabcc2c37df3.zip
Merge from trunk
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/src/print.c b/src/print.c
index 91ac68c8d30..d4cbc2ac24a 100644
--- a/src/print.c
+++ b/src/print.c
@@ -96,11 +96,11 @@ Lisp_Object being_printed[PRINT_CIRCLE];
96char *print_buffer; 96char *print_buffer;
97 97
98/* Size allocated in print_buffer. */ 98/* Size allocated in print_buffer. */
99int print_buffer_size; 99EMACS_INT print_buffer_size;
100/* Chars stored in print_buffer. */ 100/* Chars stored in print_buffer. */
101int print_buffer_pos; 101EMACS_INT print_buffer_pos;
102/* Bytes stored in print_buffer. */ 102/* Bytes stored in print_buffer. */
103int print_buffer_pos_byte; 103EMACS_INT print_buffer_pos_byte;
104 104
105/* Maximum length of list to print in full; noninteger means 105/* Maximum length of list to print in full; noninteger means
106 effectively infinity */ 106 effectively infinity */
@@ -177,8 +177,8 @@ int print_output_debug_flag = 1;
177 177
178#define PRINTDECLARE \ 178#define PRINTDECLARE \
179 struct buffer *old = current_buffer; \ 179 struct buffer *old = current_buffer; \
180 int old_point = -1, start_point = -1; \ 180 EMACS_INT old_point = -1, start_point = -1; \
181 int old_point_byte = -1, start_point_byte = -1; \ 181 EMACS_INT old_point_byte = -1, start_point_byte = -1; \
182 int specpdl_count = SPECPDL_INDEX (); \ 182 int specpdl_count = SPECPDL_INDEX (); \
183 int free_print_buffer = 0; \ 183 int free_print_buffer = 0; \
184 int multibyte = !NILP (current_buffer->enable_multibyte_characters); \ 184 int multibyte = !NILP (current_buffer->enable_multibyte_characters); \
@@ -342,8 +342,8 @@ printchar (unsigned int ch, Lisp_Object fun)
342 to data in a Lisp string. Otherwise that is not safe. */ 342 to data in a Lisp string. Otherwise that is not safe. */
343 343
344static void 344static void
345strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun, 345strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
346 int multibyte) 346 Lisp_Object printcharfun, int multibyte)
347{ 347{
348 if (size < 0) 348 if (size < 0)
349 size_byte = size = strlen (ptr); 349 size_byte = size = strlen (ptr);
@@ -395,7 +395,7 @@ strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun,
395 else 395 else
396 { 396 {
397 /* PRINTCHARFUN is a Lisp function. */ 397 /* PRINTCHARFUN is a Lisp function. */
398 int i = 0; 398 EMACS_INT i = 0;
399 399
400 if (size == size_byte) 400 if (size == size_byte)
401 { 401 {
@@ -430,7 +430,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
430{ 430{
431 if (EQ (printcharfun, Qt) || NILP (printcharfun)) 431 if (EQ (printcharfun, Qt) || NILP (printcharfun))
432 { 432 {
433 int chars; 433 EMACS_INT chars;
434 434
435 if (print_escape_nonascii) 435 if (print_escape_nonascii)
436 string = string_escape_byte8 (string); 436 string = string_escape_byte8 (string);
@@ -446,7 +446,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
446 convert STRING to a multibyte string containing the same 446 convert STRING to a multibyte string containing the same
447 character codes. */ 447 character codes. */
448 Lisp_Object newstr; 448 Lisp_Object newstr;
449 int bytes; 449 EMACS_INT bytes;
450 450
451 chars = SBYTES (string); 451 chars = SBYTES (string);
452 bytes = parse_str_to_multibyte (SDATA (string), chars); 452 bytes = parse_str_to_multibyte (SDATA (string), chars);
@@ -464,7 +464,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
464 if (EQ (printcharfun, Qt)) 464 if (EQ (printcharfun, Qt))
465 { 465 {
466 /* Output to echo area. */ 466 /* Output to echo area. */
467 int nbytes = SBYTES (string); 467 EMACS_INT nbytes = SBYTES (string);
468 char *buffer; 468 char *buffer;
469 469
470 /* Copy the string contents so that relocation of STRING by 470 /* Copy the string contents so that relocation of STRING by
@@ -489,9 +489,9 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
489 { 489 {
490 /* Otherwise, string may be relocated by printing one char. 490 /* Otherwise, string may be relocated by printing one char.
491 So re-fetch the string address for each character. */ 491 So re-fetch the string address for each character. */
492 int i; 492 EMACS_INT i;
493 int size = SCHARS (string); 493 EMACS_INT size = SCHARS (string);
494 int size_byte = SBYTES (string); 494 EMACS_INT size_byte = SBYTES (string);
495 struct gcpro gcpro1; 495 struct gcpro gcpro1;
496 GCPRO1 (string); 496 GCPRO1 (string);
497 if (size == size_byte) 497 if (size == size_byte)
@@ -868,7 +868,7 @@ to make it write to the debugging output. */)
868 (Lisp_Object character) 868 (Lisp_Object character)
869{ 869{
870 CHECK_NUMBER (character); 870 CHECK_NUMBER (character);
871 putc (XINT (character), stderr); 871 putc ((int) XINT (character), stderr);
872 872
873#ifdef WINDOWSNT 873#ifdef WINDOWSNT
874 /* Send the output to a debugger (nothing happens if there isn't one). */ 874 /* Send the output to a debugger (nothing happens if there isn't one). */
@@ -1430,8 +1430,8 @@ print_check_string_charset_prop (INTERVAL interval, Lisp_Object string)
1430 || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) 1430 || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
1431 { 1431 {
1432 int i, c; 1432 int i, c;
1433 int charpos = interval->position; 1433 EMACS_INT charpos = interval->position;
1434 int bytepos = string_char_to_byte (string, charpos); 1434 EMACS_INT bytepos = string_char_to_byte (string, charpos);
1435 Lisp_Object charset; 1435 Lisp_Object charset;
1436 1436
1437 charset = XCAR (XCDR (val)); 1437 charset = XCAR (XCDR (val));
@@ -1563,10 +1563,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1563 print_string (obj, printcharfun); 1563 print_string (obj, printcharfun);
1564 else 1564 else
1565 { 1565 {
1566 register int i, i_byte; 1566 register EMACS_INT i, i_byte;
1567 struct gcpro gcpro1; 1567 struct gcpro gcpro1;
1568 unsigned char *str; 1568 unsigned char *str;
1569 int size_byte; 1569 EMACS_INT size_byte;
1570 /* 1 means we must ensure that the next character we output 1570 /* 1 means we must ensure that the next character we output
1571 cannot be taken as part of a hex character escape. */ 1571 cannot be taken as part of a hex character escape. */
1572 int need_nonhex = 0; 1572 int need_nonhex = 0;
@@ -1684,7 +1684,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1684 register unsigned char *p = SDATA (SYMBOL_NAME (obj)); 1684 register unsigned char *p = SDATA (SYMBOL_NAME (obj));
1685 register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); 1685 register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj));
1686 register int c; 1686 register int c;
1687 int i, i_byte, size_byte; 1687 int i, i_byte;
1688 EMACS_INT size_byte;
1688 Lisp_Object name; 1689 Lisp_Object name;
1689 1690
1690 name = SYMBOL_NAME (obj); 1691 name = SYMBOL_NAME (obj);
@@ -1803,7 +1804,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1803 } 1804 }
1804 1805
1805 { 1806 {
1806 int print_length, i; 1807 EMACS_INT print_length;
1808 int i;
1807 Lisp_Object halftail = obj; 1809 Lisp_Object halftail = obj;
1808 1810
1809 /* Negative values of print-length are invalid in CL. 1811 /* Negative values of print-length are invalid in CL.
@@ -1898,7 +1900,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1898 register int i; 1900 register int i;
1899 register unsigned char c; 1901 register unsigned char c;
1900 struct gcpro gcpro1; 1902 struct gcpro gcpro1;
1901 int size_in_chars 1903 EMACS_INT size_in_chars
1902 = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1) 1904 = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
1903 / BOOL_VECTOR_BITS_PER_CHAR); 1905 / BOOL_VECTOR_BITS_PER_CHAR);
1904 1906
@@ -1984,7 +1986,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1984 else if (HASH_TABLE_P (obj)) 1986 else if (HASH_TABLE_P (obj))
1985 { 1987 {
1986 struct Lisp_Hash_Table *h = XHASH_TABLE (obj); 1988 struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
1987 int i, real_size, size; 1989 int i;
1990 EMACS_INT real_size, size;
1988#if 0 1991#if 0
1989 strout ("#<hash-table", -1, -1, printcharfun, 0); 1992 strout ("#<hash-table", -1, -1, printcharfun, 0);
1990 if (SYMBOLP (h->test)) 1993 if (SYMBOLP (h->test))
@@ -2150,7 +2153,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2150 { 2153 {
2151 register int i; 2154 register int i;
2152 register Lisp_Object tem; 2155 register Lisp_Object tem;
2153 int real_size = size; 2156 EMACS_INT real_size = size;
2154 2157
2155 /* Don't print more elements than the specified maximum. */ 2158 /* Don't print more elements than the specified maximum. */
2156 if (NATNUMP (Vprint_length) 2159 if (NATNUMP (Vprint_length)
@@ -2182,7 +2185,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2182 strout ("in no buffer", -1, -1, printcharfun, 0); 2185 strout ("in no buffer", -1, -1, printcharfun, 0);
2183 else 2186 else
2184 { 2187 {
2185 sprintf (buf, "at %d", marker_position (obj)); 2188 sprintf (buf, "at %ld", (long)marker_position (obj));
2186 strout (buf, -1, -1, printcharfun, 0); 2189 strout (buf, -1, -1, printcharfun, 0);
2187 strout (" in ", -1, -1, printcharfun, 0); 2190 strout (" in ", -1, -1, printcharfun, 0);
2188 print_string (XMARKER (obj)->buffer->name, printcharfun); 2191 print_string (XMARKER (obj)->buffer->name, printcharfun);
@@ -2196,9 +2199,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2196 strout ("in no buffer", -1, -1, printcharfun, 0); 2199 strout ("in no buffer", -1, -1, printcharfun, 0);
2197 else 2200 else
2198 { 2201 {
2199 sprintf (buf, "from %d to %d in ", 2202 sprintf (buf, "from %ld to %ld in ",
2200 marker_position (OVERLAY_START (obj)), 2203 (long)marker_position (OVERLAY_START (obj)),
2201 marker_position (OVERLAY_END (obj))); 2204 (long)marker_position (OVERLAY_END (obj)));
2202 strout (buf, -1, -1, printcharfun, 0); 2205 strout (buf, -1, -1, printcharfun, 0);
2203 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, 2206 print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
2204 printcharfun); 2207 printcharfun);