#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
static Lisp_Object Qfloat_output_format;
-#include <math.h>
#include <float.h>
#include <ftoastr.h>
-/* Default to values appropriate for IEEE floating point. */
-#ifndef DBL_DIG
-#define DBL_DIG 15
-#endif
-
/* Avoid actual stack overflow in print. */
static ptrdiff_t print_depth;
? PT - start_point : 0), \
old_point_byte + (old_point_byte >= start_point_byte \
? PT_BYTE - start_point_byte : 0)); \
- if (old != current_buffer) \
- set_buffer_internal (old);
+ set_buffer_internal (old);
#define PRINTCHAR(ch) printchar (ch, printcharfun)
register struct buffer *old = current_buffer;
register Lisp_Object buf;
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (Fget_buffer_create (build_string (bufname)));
Fkill_all_local_variables ();
delete_all_overlays (current_buffer);
- BVAR (current_buffer, directory) = BVAR (old, directory);
- BVAR (current_buffer, read_only) = Qnil;
- BVAR (current_buffer, filename) = Qnil;
- BVAR (current_buffer, undo_list) = Qt;
+ bset_directory (current_buffer, BVAR (old, directory));
+ bset_read_only (current_buffer, Qnil);
+ bset_filename (current_buffer, Qnil);
+ bset_undo_list (current_buffer, Qt);
eassert (current_buffer->overlays_before == NULL);
eassert (current_buffer->overlays_after == NULL);
- BVAR (current_buffer, enable_multibyte_characters)
- = BVAR (&buffer_defaults, enable_multibyte_characters);
+ bset_enable_multibyte_characters
+ (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
(Lisp_Object object, Lisp_Object noescape)
{
Lisp_Object printcharfun;
+ bool prev_abort_on_gc;
/* struct gcpro gcpro1, gcpro2; */
Lisp_Object save_deactivate_mark;
ptrdiff_t count = SPECPDL_INDEX ();
No need for specbind, since errors deactivate the mark. */
save_deactivate_mark = Vdeactivate_mark;
/* GCPRO2 (object, save_deactivate_mark); */
- abort_on_gc++;
+ prev_abort_on_gc = abort_on_gc;
+ abort_on_gc = 1;
printcharfun = Vprin1_to_string_buffer;
PRINTPREPARE;
Vdeactivate_mark = save_deactivate_mark;
/* UNGCPRO; */
- abort_on_gc--;
+ abort_on_gc = prev_abort_on_gc;
return unbind_to (count, object);
}
{
if (initial_stderr_stream != NULL)
{
- BLOCK_INPUT;
+ block_input ();
fclose (stderr);
- UNBLOCK_INPUT;
+ unblock_input ();
}
stderr = initial_stderr_stream;
initial_stderr_stream = NULL;
{
case Lisp_String:
/* A string may have text properties, which can be circular. */
- traverse_intervals_noorder (STRING_INTERVALS (obj),
+ traverse_intervals_noorder (string_intervals (obj),
print_preprocess_string, Qnil);
break;
print_prune_string_charset (Lisp_Object string)
{
print_check_string_result = 0;
- traverse_intervals (STRING_INTERVALS (string), 0,
+ traverse_intervals (string_intervals (string), 0,
print_check_string_charset_prop, string);
if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
{
if (! EQ (Vprint_charset_text_property, Qt))
obj = print_prune_string_charset (obj);
- if (!NULL_INTERVAL_P (STRING_INTERVALS (obj)))
+ if (string_intervals (obj))
{
PRINTCHAR ('#');
PRINTCHAR ('(');
}
PRINTCHAR ('\"');
- if (!NULL_INTERVAL_P (STRING_INTERVALS (obj)))
+ if (string_intervals (obj))
{
- traverse_intervals (STRING_INTERVALS (obj),
+ traverse_intervals (string_intervals (obj),
0, print_interval, printcharfun);
PRINTCHAR (')');
}
if (escapeflag)
{
strout ("#<process ", -1, -1, printcharfun);
- print_string (PVAR (XPROCESS (obj), name), printcharfun);
+ print_string (XPROCESS (obj)->name, printcharfun);
PRINTCHAR ('>');
}
else
- print_string (PVAR (XPROCESS (obj), name), printcharfun);
+ print_string (XPROCESS (obj)->name, printcharfun);
}
else if (BOOL_VECTOR_P (obj))
{
strout ("#<window ", -1, -1, printcharfun);
len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number);
strout (buf, len, len, printcharfun);
- if (!NILP (WVAR (XWINDOW (obj), buffer)))
+ if (!NILP (XWINDOW (obj)->buffer))
{
strout (" on ", -1, -1, printcharfun);
- print_string (BVAR (XBUFFER (WVAR (XWINDOW (obj), buffer)), name),
+ print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name),
printcharfun);
}
PRINTCHAR ('>');
}
else if (BUFFERP (obj))
{
- if (NILP (BVAR (XBUFFER (obj), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (obj)))
strout ("#<killed buffer>", -1, -1, printcharfun);
else if (escapeflag)
{
else if (FRAMEP (obj))
{
int len;
- Lisp_Object frame_name = FGET (XFRAME (obj), name);
+ Lisp_Object frame_name = XFRAME (obj)->name;
strout ((FRAME_LIVE_P (XFRAME (obj))
? "#<frame " : "#<dead frame "),
{
int len;
/* We're in trouble if this happens!
- Probably should just abort () */
+ Probably should just emacs_abort (). */
strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun);
if (MISCP (obj))
len = sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));