From aca2020bdb42b5390b1796c8d230ad13f1396d8c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 18 Oct 1999 02:01:56 +0000 Subject: [PATCH] (print_preprocess): In case print-circle is nil, add OBJ to Vprint_number_table only when OBJ is a symbol. --- src/ChangeLog | 5 ++++ src/print.c | 67 +++++++++++++++++++++++++++------------------------ 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e664129af30..22cb4e7443c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +1999-10-18 Keisuke Nishida + + * print.c (print_preprocess): In case print-circle is nil, + add OBJ to Vprint_number_table only when OBJ is a symbol. + 1999-10-08 Kenichi Handa * coding.c (code_convert_string): Add record_unwind_protect to diff --git a/src/print.c b/src/print.c index dc28ed0ce11..163c23cb8be 100644 --- a/src/print.c +++ b/src/print.c @@ -1110,42 +1110,47 @@ print_preprocess (obj) || (! NILP (Vprint_gensym) && SYMBOLP (obj) && NILP (XSYMBOL (obj)->obarray))) { - for (i = 0; i < print_number_index; i++) - if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) - { - /* OBJ appears more than once. Let's remember that. */ - PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt; - return; - } - - /* OBJ is not yet recorded. Let's add to the table. */ - if (print_number_index == 0) + /* In case print-circle is nil and print-gensym is t, + add OBJ to Vprint_number_table only when OBJ is a symbol. */ + if (! NILP (Vprint_circle) || SYMBOLP (obj)) { - /* Initialize the table. */ - Vprint_number_table = Fmake_vector (make_number (40), Qnil); - } - else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2) - { - /* Reallocate the table. */ - int i = print_number_index * 4; - Lisp_Object old_table = Vprint_number_table; - Vprint_number_table = Fmake_vector (make_number (i), Qnil); for (i = 0; i < print_number_index; i++) + if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) + { + /* OBJ appears more than once. Let's remember that. */ + PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt; + return; + } + + /* OBJ is not yet recorded. Let's add to the table. */ + if (print_number_index == 0) { - PRINT_NUMBER_OBJECT (Vprint_number_table, i) - = PRINT_NUMBER_OBJECT (old_table, i); - PRINT_NUMBER_STATUS (Vprint_number_table, i) - = PRINT_NUMBER_STATUS (old_table, i); + /* Initialize the table. */ + Vprint_number_table = Fmake_vector (make_number (40), Qnil); + } + else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2) + { + /* Reallocate the table. */ + int i = print_number_index * 4; + Lisp_Object old_table = Vprint_number_table; + Vprint_number_table = Fmake_vector (make_number (i), Qnil); + for (i = 0; i < print_number_index; i++) + { + PRINT_NUMBER_OBJECT (Vprint_number_table, i) + = PRINT_NUMBER_OBJECT (old_table, i); + PRINT_NUMBER_STATUS (Vprint_number_table, i) + = PRINT_NUMBER_STATUS (old_table, i); + } } + PRINT_NUMBER_OBJECT (Vprint_number_table, print_number_index) = obj; + /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym, + always print the gensym with a number. This is a special for + the lisp function byte-compile-output-docform. */ + if (! NILP (Vprint_continuous_numbering) && SYMBOLP (obj) + && NILP (XSYMBOL (obj)->obarray)) + PRINT_NUMBER_STATUS (Vprint_number_table, print_number_index) = Qt; + print_number_index++; } - PRINT_NUMBER_OBJECT (Vprint_number_table, print_number_index) = obj; - /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym, - always print the gensym with a number. This is a special for - the lisp function byte-compile-output-docform. */ - if (! NILP (Vprint_continuous_numbering) && SYMBOLP (obj) - && NILP (XSYMBOL (obj)->obarray)) - PRINT_NUMBER_STATUS (Vprint_number_table, print_number_index) = Qt; - print_number_index++; switch (XGCTYPE (obj)) { -- 2.39.5