comparison src/print.c @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents c63e96671963
children 5ff2f3145fd1 d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
187 /* Lisp functions to do output using a stream 187 /* Lisp functions to do output using a stream
188 must have the stream in a variable called printcharfun 188 must have the stream in a variable called printcharfun
189 and must start with PRINTPREPARE, end with PRINTFINISH, 189 and must start with PRINTPREPARE, end with PRINTFINISH,
190 and use PRINTDECLARE to declare common variables. 190 and use PRINTDECLARE to declare common variables.
191 Use PRINTCHAR to output one character, 191 Use PRINTCHAR to output one character,
192 or call strout to output a block of characters. */ 192 or call strout to output a block of characters. */
193 193
194 #define PRINTDECLARE \ 194 #define PRINTDECLARE \
195 struct buffer *old = current_buffer; \ 195 struct buffer *old = current_buffer; \
196 int old_point = -1, start_point = -1; \ 196 int old_point = -1, start_point = -1; \
197 int old_point_byte = -1, start_point_byte = -1; \ 197 int old_point_byte = -1, start_point_byte = -1; \
319 { 319 {
320 unsigned char str[MAX_MULTIBYTE_LENGTH]; 320 unsigned char str[MAX_MULTIBYTE_LENGTH];
321 int len = CHAR_STRING (ch, str); 321 int len = CHAR_STRING (ch, str);
322 322
323 QUIT; 323 QUIT;
324 324
325 if (NILP (fun)) 325 if (NILP (fun))
326 { 326 {
327 if (print_buffer_pos_byte + len >= print_buffer_size) 327 if (print_buffer_pos_byte + len >= print_buffer_size)
328 print_buffer = (char *) xrealloc (print_buffer, 328 print_buffer = (char *) xrealloc (print_buffer,
329 print_buffer_size *= 2); 329 print_buffer_size *= 2);
338 } 338 }
339 else 339 else
340 { 340 {
341 int multibyte_p 341 int multibyte_p
342 = !NILP (current_buffer->enable_multibyte_characters); 342 = !NILP (current_buffer->enable_multibyte_characters);
343 343
344 setup_echo_area_for_printing (multibyte_p); 344 setup_echo_area_for_printing (multibyte_p);
345 insert_char (ch); 345 insert_char (ch);
346 message_dolog (str, len, 0, multibyte_p); 346 message_dolog (str, len, 0, multibyte_p);
347 } 347 }
348 } 348 }
395 here, that's the reason we don't call printchar to do the 395 here, that's the reason we don't call printchar to do the
396 job. */ 396 job. */
397 int i; 397 int i;
398 int multibyte_p 398 int multibyte_p
399 = !NILP (current_buffer->enable_multibyte_characters); 399 = !NILP (current_buffer->enable_multibyte_characters);
400 400
401 setup_echo_area_for_printing (multibyte_p); 401 setup_echo_area_for_printing (multibyte_p);
402 message_dolog (ptr, size_byte, 0, multibyte_p); 402 message_dolog (ptr, size_byte, 0, multibyte_p);
403 403
404 if (size == size_byte) 404 if (size == size_byte)
405 { 405 {
406 for (i = 0; i < size; ++i) 406 for (i = 0; i < size; ++i)
407 insert_char ((unsigned char )*ptr++); 407 insert_char ((unsigned char )*ptr++);
408 } 408 }
413 { 413 {
414 int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len); 414 int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len);
415 insert_char (ch); 415 insert_char (ch);
416 } 416 }
417 } 417 }
418 418
419 #ifdef MAX_PRINT_CHARS 419 #ifdef MAX_PRINT_CHARS
420 if (max_print) 420 if (max_print)
421 print_chars += size; 421 print_chars += size;
422 #endif /* MAX_PRINT_CHARS */ 422 #endif /* MAX_PRINT_CHARS */
423 } 423 }
651 with the buffer temporarily current, and the window that was used 651 with the buffer temporarily current, and the window that was used
652 to display it temporarily selected. 652 to display it temporarily selected.
653 653
654 If variable `temp-buffer-show-function' is non-nil, call it at the end 654 If variable `temp-buffer-show-function' is non-nil, call it at the end
655 to get the buffer displayed instead of just displaying the non-selected 655 to get the buffer displayed instead of just displaying the non-selected
656 buffer and calling the hook. It gets one argument, the buffer to display. 656 buffer and calling the hook. It gets one argument, the buffer to display.
657 657
658 usage: (with-output-to-temp-buffer BUFFNAME BODY ...) */) 658 usage: (with-output-to-temp-buffer BUFFNAME BODY ...) */)
659 (args) 659 (args)
660 Lisp_Object args; 660 Lisp_Object args;
661 { 661 {
1003 if (!NILP (file_error) || EQ (errname, Qend_of_file)) 1003 if (!NILP (file_error) || EQ (errname, Qend_of_file))
1004 Fprinc (obj, stream); 1004 Fprinc (obj, stream);
1005 else 1005 else
1006 Fprin1 (obj, stream); 1006 Fprin1 (obj, stream);
1007 } 1007 }
1008 1008
1009 UNGCPRO; 1009 UNGCPRO;
1010 } 1010 }
1011 1011
1012 1012
1013 1013
1014 /* 1014 /*
1015 * The buffer should be at least as large as the max string size of the 1015 * The buffer should be at least as large as the max string size of the
1016 * largest float, printed in the biggest notation. This is undoubtedly 1016 * largest float, printed in the biggest notation. This is undoubtedly
1017 * 20d float_output_format, with the negative of the C-constant "HUGE" 1017 * 20d float_output_format, with the negative of the C-constant "HUGE"
1018 * from <math.h>. 1018 * from <math.h>.
1019 * 1019 *
1020 * On the vax the worst case is -1e38 in 20d format which takes 61 bytes. 1020 * On the vax the worst case is -1e38 in 20d format which takes 61 bytes.
1021 * 1021 *
1022 * I assume that IEEE-754 format numbers can take 329 bytes for the worst 1022 * I assume that IEEE-754 format numbers can take 329 bytes for the worst
1023 * case of -1e307 in 20d float_output_format. What is one to do (short of 1023 * case of -1e307 in 20d float_output_format. What is one to do (short of
1024 * re-writing _doprnt to be more sane)? 1024 * re-writing _doprnt to be more sane)?
1025 * -wsr 1025 * -wsr
1026 */ 1026 */
1030 unsigned char *buf; 1030 unsigned char *buf;
1031 double data; 1031 double data;
1032 { 1032 {
1033 unsigned char *cp; 1033 unsigned char *cp;
1034 int width; 1034 int width;
1035 1035
1036 /* Check for plus infinity in a way that won't lose 1036 /* Check for plus infinity in a way that won't lose
1037 if there is no plus infinity. */ 1037 if there is no plus infinity. */
1038 if (data == data / 2 && data > 1.0) 1038 if (data == data / 2 && data > 1.0)
1039 { 1039 {
1040 strcpy (buf, "1.0e+INF"); 1040 strcpy (buf, "1.0e+INF");
1059 if (u_data.c[i] & u_minus_zero.c[i]) 1059 if (u_data.c[i] & u_minus_zero.c[i])
1060 { 1060 {
1061 *buf++ = '-'; 1061 *buf++ = '-';
1062 break; 1062 break;
1063 } 1063 }
1064 1064
1065 strcpy (buf, "0.0e+NaN"); 1065 strcpy (buf, "0.0e+NaN");
1066 return; 1066 return;
1067 } 1067 }
1068 1068
1069 if (NILP (Vfloat_output_format) 1069 if (NILP (Vfloat_output_format)
1596 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag); 1596 print_object (XCAR (XCDR (obj)), printcharfun, escapeflag);
1597 } 1597 }
1598 else 1598 else
1599 { 1599 {
1600 PRINTCHAR ('('); 1600 PRINTCHAR ('(');
1601 1601
1602 /* If the first element is a backquote form, 1602 /* If the first element is a backquote form,
1603 print it old-style so it won't be misunderstood. */ 1603 print it old-style so it won't be misunderstood. */
1604 if (print_quoted && CONSP (XCAR (obj)) 1604 if (print_quoted && CONSP (XCAR (obj))
1605 && CONSP (XCDR (XCAR (obj))) 1605 && CONSP (XCDR (XCAR (obj)))
1606 && NILP (XCDR (XCDR (XCAR (obj)))) 1606 && NILP (XCDR (XCDR (XCAR (obj))))
1668 } 1668 }
1669 goto end_of_list; 1669 goto end_of_list;
1670 } 1670 }
1671 } 1671 }
1672 } 1672 }
1673 1673
1674 if (i++) 1674 if (i++)
1675 PRINTCHAR (' '); 1675 PRINTCHAR (' ');
1676 1676
1677 if (print_length && i > print_length) 1677 if (print_length && i > print_length)
1678 { 1678 {
1679 strout ("...", 3, 3, printcharfun, 0); 1679 strout ("...", 3, 3, printcharfun, 0);
1680 goto end_of_list; 1680 goto end_of_list;
1681 } 1681 }
1682 1682
1683 print_object (XCAR (obj), printcharfun, escapeflag); 1683 print_object (XCAR (obj), printcharfun, escapeflag);
1684 1684
1685 obj = XCDR (obj); 1685 obj = XCDR (obj);
1686 if (!(i & 1)) 1686 if (!(i & 1))
1687 halftail = XCDR (halftail); 1687 halftail = XCDR (halftail);
1688 } 1688 }
1689 } 1689 }
1692 if (!NILP (obj)) 1692 if (!NILP (obj))
1693 { 1693 {
1694 strout (" . ", 3, 3, printcharfun, 0); 1694 strout (" . ", 3, 3, printcharfun, 0);
1695 print_object (obj, printcharfun, escapeflag); 1695 print_object (obj, printcharfun, escapeflag);
1696 } 1696 }
1697 1697
1698 end_of_list: 1698 end_of_list:
1699 PRINTCHAR (')'); 1699 PRINTCHAR (')');
1700 } 1700 }
1701 break; 1701 break;
1702 1702