comparison src/print.c @ 26069:6bf93a8f0e73

(print_preprocess): In case print-circle is nil, add OBJ to Vprint_number_table only when OBJ is a symbol.
author Kenichi Handa <handa@m17n.org>
date Mon, 18 Oct 1999 02:01:11 +0000
parents 1751b057e4b0
children b7aa6ac26872
comparison
equal deleted inserted replaced
26068:3803a546186f 26069:6bf93a8f0e73
1108 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1108 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
1109 || COMPILEDP (obj) || CHAR_TABLE_P (obj) 1109 || COMPILEDP (obj) || CHAR_TABLE_P (obj)
1110 || (! NILP (Vprint_gensym) 1110 || (! NILP (Vprint_gensym)
1111 && SYMBOLP (obj) && NILP (XSYMBOL (obj)->obarray))) 1111 && SYMBOLP (obj) && NILP (XSYMBOL (obj)->obarray)))
1112 { 1112 {
1113 for (i = 0; i < print_number_index; i++) 1113 /* In case print-circle is nil and print-gensym is t,
1114 if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj) 1114 add OBJ to Vprint_number_table only when OBJ is a symbol. */
1115 { 1115 if (! NILP (Vprint_circle) || SYMBOLP (obj))
1116 /* OBJ appears more than once. Let's remember that. */ 1116 {
1117 PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt;
1118 return;
1119 }
1120
1121 /* OBJ is not yet recorded. Let's add to the table. */
1122 if (print_number_index == 0)
1123 {
1124 /* Initialize the table. */
1125 Vprint_number_table = Fmake_vector (make_number (40), Qnil);
1126 }
1127 else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2)
1128 {
1129 /* Reallocate the table. */
1130 int i = print_number_index * 4;
1131 Lisp_Object old_table = Vprint_number_table;
1132 Vprint_number_table = Fmake_vector (make_number (i), Qnil);
1133 for (i = 0; i < print_number_index; i++) 1117 for (i = 0; i < print_number_index; i++)
1118 if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj)
1119 {
1120 /* OBJ appears more than once. Let's remember that. */
1121 PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt;
1122 return;
1123 }
1124
1125 /* OBJ is not yet recorded. Let's add to the table. */
1126 if (print_number_index == 0)
1134 { 1127 {
1135 PRINT_NUMBER_OBJECT (Vprint_number_table, i) 1128 /* Initialize the table. */
1136 = PRINT_NUMBER_OBJECT (old_table, i); 1129 Vprint_number_table = Fmake_vector (make_number (40), Qnil);
1137 PRINT_NUMBER_STATUS (Vprint_number_table, i)
1138 = PRINT_NUMBER_STATUS (old_table, i);
1139 } 1130 }
1140 } 1131 else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2)
1141 PRINT_NUMBER_OBJECT (Vprint_number_table, print_number_index) = obj; 1132 {
1142 /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym, 1133 /* Reallocate the table. */
1143 always print the gensym with a number. This is a special for 1134 int i = print_number_index * 4;
1144 the lisp function byte-compile-output-docform. */ 1135 Lisp_Object old_table = Vprint_number_table;
1145 if (! NILP (Vprint_continuous_numbering) && SYMBOLP (obj) 1136 Vprint_number_table = Fmake_vector (make_number (i), Qnil);
1146 && NILP (XSYMBOL (obj)->obarray)) 1137 for (i = 0; i < print_number_index; i++)
1147 PRINT_NUMBER_STATUS (Vprint_number_table, print_number_index) = Qt; 1138 {
1148 print_number_index++; 1139 PRINT_NUMBER_OBJECT (Vprint_number_table, i)
1140 = PRINT_NUMBER_OBJECT (old_table, i);
1141 PRINT_NUMBER_STATUS (Vprint_number_table, i)
1142 = PRINT_NUMBER_STATUS (old_table, i);
1143 }
1144 }
1145 PRINT_NUMBER_OBJECT (Vprint_number_table, print_number_index) = obj;
1146 /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym,
1147 always print the gensym with a number. This is a special for
1148 the lisp function byte-compile-output-docform. */
1149 if (! NILP (Vprint_continuous_numbering) && SYMBOLP (obj)
1150 && NILP (XSYMBOL (obj)->obarray))
1151 PRINT_NUMBER_STATUS (Vprint_number_table, print_number_index) = Qt;
1152 print_number_index++;
1153 }
1149 1154
1150 switch (XGCTYPE (obj)) 1155 switch (XGCTYPE (obj))
1151 { 1156 {
1152 case Lisp_String: 1157 case Lisp_String:
1153 #ifdef USE_TEXT_PROPERTIES 1158 #ifdef USE_TEXT_PROPERTIES