emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107975: * src/print.c (print_preproc


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107975: * src/print.c (print_preprocess): Only check print_depth if print-circle
Date: Fri, 20 Apr 2012 09:02:20 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107975
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2012-04-20 09:02:20 -0400
message:
  * src/print.c (print_preprocess): Only check print_depth if print-circle
  is nil.
  (print_object): Check for cycles even when print-circle is nil and
  print-gensym is t, but only check print_depth if print-circle is nil.
modified:
  src/ChangeLog
  src/print.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-04-20 08:48:50 +0000
+++ b/src/ChangeLog     2012-04-20 13:02:20 +0000
@@ -1,3 +1,10 @@
+2012-04-20  Stefan Monnier  <address@hidden>
+
+       * print.c (print_preprocess): Only check print_depth if print-circle
+       is nil.
+       (print_object): Check for cycles even when print-circle is nil and
+       print-gensym is t, but only check print_depth if print-circle is nil.
+
 2012-04-20  Chong Yidong  <address@hidden>
 
        * process.c (wait_reading_process_output): If EIO occurs on a pty,
@@ -16,13 +23,14 @@
        (set_cursor_from_row): If called for a mode-line or header-line
        row, return zero immediately.
        (try_cursor_movement): If inside continuation line, don't back up
-       farther than the first row after the header line, if any.  Don't
-       consider the header-line row as "partially visible", even if
+       farther than the first row after the header line, if any.
+       Don't consider the header-line row as "partially visible", even if
        MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero.  (Bug#11261)
 
 2012-04-20  Atsuo Ohki  <address@hidden>  (tiny change)
 
-       * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n" 
(bug#11238).
+       * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n"
+       (bug#11238).
 
 2012-04-20  Teodor Zlatanov  <address@hidden>
 2012-04-18  Paul Eggert  <address@hidden>
@@ -91,7 +99,7 @@
        (union aligned_Lisp_Misc): Define.
        (MARKER_BLOCK_SIZE, struct marker_block): Use union
        aligned_Lisp_Misc instead of union Lisp_Misc.
-       (Fmake_symbol, allocate_misc, gc_sweep): Adjust
+       (Fmake_symbol, allocate_misc, gc_sweep): Adjust.
 
 2012-04-14  Paul Eggert  <address@hidden>
 

=== modified file 'src/print.c'
--- a/src/print.c       2012-04-09 13:05:48 +0000
+++ b/src/print.c       2012-04-20 13:02:20 +0000
@@ -93,14 +93,14 @@
 int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
 
 
-/* Low level output routines for characters and strings */
+/* Low level output routines for characters and strings.  */
 
 /* Lisp functions to do output using a stream
    must have the stream in a variable called printcharfun
    and must start with PRINTPREPARE, end with PRINTFINISH,
    and use PRINTDECLARE to declare common variables.
    Use PRINTCHAR to output one character,
-   or call strout to output a block of characters. */
+   or call strout to output a block of characters.  */
 
 #define PRINTDECLARE                                                   \
    struct buffer *old = current_buffer;                                        
\
@@ -1130,15 +1130,15 @@
   int loop_count = 0;
   Lisp_Object halftail;
 
-  /* Give up if we go so deep that print_object will get an error.  */
-  /* See similar code in print_object.  */
-  if (print_depth >= PRINT_CIRCLE)
-    error ("Apparently circular structure being printed");
-
   /* Avoid infinite recursion for circular nested structure
      in the case where Vprint_circle is nil.  */
   if (NILP (Vprint_circle))
     {
+      /* Give up if we go so deep that print_object will get an error.  */
+      /* See similar code in print_object.  */
+      if (print_depth >= PRINT_CIRCLE)
+       error ("Apparently circular structure being printed");
+
       for (i = 0; i < print_depth; i++)
        if (EQ (obj, being_printed[i]))
          return;
@@ -1240,7 +1240,7 @@
 #define PRINT_STRING_NON_CHARSET_FOUND 1
 #define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
 
-/* Bitwise or of the above macros. */
+/* Bitwise or of the above macros.  */
 static int print_check_string_result;
 
 static void
@@ -1323,48 +1323,46 @@
 
   QUIT;
 
-  /* See similar code in print_preprocess.  */
-  if (print_depth >= PRINT_CIRCLE)
-    error ("Apparently circular structure being printed");
-
   /* Detect circularities and truncate them.  */
-  if (PRINT_CIRCLE_CANDIDATE_P (obj))
-    {
-      if (NILP (Vprint_circle) && NILP (Vprint_gensym))
-       {
-         /* Simple but incomplete way.  */
-         int i;
-         for (i = 0; i < print_depth; i++)
-           if (EQ (obj, being_printed[i]))
-             {
-               sprintf (buf, "#%d", i);
-               strout (buf, -1, -1, printcharfun);
-               return;
-             }
-         being_printed[print_depth] = obj;
-       }
-      else
-       {
-         /* With the print-circle feature.  */
-         Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
-         if (INTEGERP (num))
+  if (NILP (Vprint_circle))
+    {
+      /* Simple but incomplete way.  */
+      int i;
+
+      /* See similar code in print_preprocess.  */
+      if (print_depth >= PRINT_CIRCLE)
+       error ("Apparently circular structure being printed");
+
+      for (i = 0; i < print_depth; i++)
+       if (EQ (obj, being_printed[i]))
+         {
+           sprintf (buf, "#%d", i);
+           strout (buf, -1, -1, printcharfun);
+           return;
+         }
+      being_printed[print_depth] = obj;
+    }
+  else if (PRINT_CIRCLE_CANDIDATE_P (obj))
+    {
+      /* With the print-circle feature.  */
+      Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
+      if (INTEGERP (num))
+       {
+         EMACS_INT n = XINT (num);
+         if (n < 0)
+           { /* Add a prefix #n= if OBJ has not yet been printed;
+                that is, its status field is nil.  */
+             sprintf (buf, "#%"pI"d=", -n);
+             strout (buf, -1, -1, printcharfun);
+             /* OBJ is going to be printed.  Remember that fact.  */
+             Fputhash (obj, make_number (- n), Vprint_number_table);
+           }
+         else
            {
-             EMACS_INT n = XINT (num);
-             if (n < 0)
-               { /* Add a prefix #n= if OBJ has not yet been printed;
-                    that is, its status field is nil.  */
-                 sprintf (buf, "#%"pI"d=", -n);
-                 strout (buf, -1, -1, printcharfun);
-                 /* OBJ is going to be printed.  Remember that fact.  */
-                 Fputhash (obj, make_number (- n), Vprint_number_table);
-               }
-             else
-               {
-                 /* Just print #n# if OBJ has already been printed.  */
-                 sprintf (buf, "#%"pI"d#", n);
-                 strout (buf, -1, -1, printcharfun);
-                 return;
-               }
+             /* Just print #n# if OBJ has already been printed.  */
+             sprintf (buf, "#%"pI"d#", n);
+             strout (buf, -1, -1, printcharfun);
+             return;
            }
        }
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]