]> code.delx.au - gnu-emacs/blobdiff - src/print.c
not compiling yet
[gnu-emacs] / src / print.c
index 0938dd6e9aea19540d12869d695f78f0de268324..6ae33ee23ef3a49da995703ed3f7f1636734c877 100644 (file)
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
-#include <setjmp.h>
+
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
@@ -36,7 +36,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "termhooks.h"         /* For struct terminal.  */
 #include "font.h"
-
+#ifdef HAVE_XWIDGETS
+#include "xwidget.h"
+#endif
 Lisp_Object Qstandard_output;
 
 static Lisp_Object Qtemp_buffer_setup_hook;
@@ -45,15 +47,9 @@ static Lisp_Object Qtemp_buffer_setup_hook;
 
 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;
 
@@ -197,8 +193,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
                               ? 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)
 
@@ -488,20 +483,20 @@ temp_output_buffer_setup (const char *bufname)
   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);
-  BSET (current_buffer, directory, BVAR (old, directory));
-  BSET (current_buffer, read_only, Qnil);
-  BSET (current_buffer, filename, Qnil);
-  BSET (current_buffer, undo_list, Qt);
-  eassert (buffer_get_overlays (NULL, OV_BEFORE) == NULL);
-  eassert (buffer_get_overlays (NULL, OV_AFTER) == NULL);
-  BSET (current_buffer, enable_multibyte_characters,
-       BVAR (&buffer_defaults, enable_multibyte_characters));
+  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);
+  bset_enable_multibyte_characters
+    (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
   Ferase_buffer ();
@@ -586,6 +581,7 @@ A printed representation of an object is text which describes that object.  */)
   (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 ();
@@ -601,7 +597,8 @@ A printed representation of an object is text which describes that object.  */)
        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;
@@ -625,7 +622,7 @@ A printed representation of an object is text which describes that object.  */)
   Vdeactivate_mark = save_deactivate_mark;
   /* UNGCPRO; */
 
-  abort_on_gc--;
+  abort_on_gc = prev_abort_on_gc;
   return unbind_to (count, object);
 }
 
@@ -1194,7 +1191,7 @@ print_preprocess (Lisp_Object obj)
        {
        case Lisp_String:
          /* A string may have text properties, which can be circular.  */
-         traverse_intervals_noorder (string_get_intervals (obj),
+         traverse_intervals_noorder (string_intervals (obj),
                                      print_preprocess_string, Qnil);
          break;
 
@@ -1297,7 +1294,7 @@ static Lisp_Object
 print_prune_string_charset (Lisp_Object string)
 {
   print_check_string_result = 0;
-  traverse_intervals (string_get_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))
     {
@@ -1408,7 +1405,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
          if (! EQ (Vprint_charset_text_property, Qt))
            obj = print_prune_string_charset (obj);
 
-         if (string_get_intervals (obj))
+         if (string_intervals (obj))
            {
              PRINTCHAR ('#');
              PRINTCHAR ('(');
@@ -1499,9 +1496,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
            }
          PRINTCHAR ('\"');
 
-         if (string_get_intervals (obj))
+         if (string_intervals (obj))
            {
-             traverse_intervals (string_get_intervals (obj),
+             traverse_intervals (string_intervals (obj),
                                  0, print_interval, printcharfun);
              PRINTCHAR (')');
            }
@@ -1767,6 +1764,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
          strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun);
          PRINTCHAR ('>');
        }
+#ifdef HAVE_XWIDGETS
+      else if (XXWIDGETP (obj))
+       {
+         strout ("#<xwidget ", -1, -1, printcharfun);
+         PRINTCHAR ('>');
+       }
+#endif      
       else if (WINDOWP (obj))
        {
          int len;
@@ -1878,7 +1882,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        }
       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)
            {
@@ -2059,7 +2063,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
       {
        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));