Mercurial > emacs
comparison src/print.c @ 47526:0055228ad95f
(print): Clear out the unused parts of Vprint_number_table.
(syms_of_print): Doc fix for `print-number-table'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 18 Sep 2002 15:57:39 +0000 |
parents | 2f83f3473b40 |
children | c63e96671963 |
comparison
equal
deleted
inserted
replaced
47525:2455f742ffba | 47526:0055228ad95f |
---|---|
1167 | 1167 |
1168 /* Construct Vprint_number_table for print-gensym and print-circle. */ | 1168 /* Construct Vprint_number_table for print-gensym and print-circle. */ |
1169 if (!NILP (Vprint_gensym) || !NILP (Vprint_circle)) | 1169 if (!NILP (Vprint_gensym) || !NILP (Vprint_circle)) |
1170 { | 1170 { |
1171 int i, start, index; | 1171 int i, start, index; |
1172 /* Construct Vprint_number_table. */ | |
1173 start = index = print_number_index; | 1172 start = index = print_number_index; |
1173 /* Construct Vprint_number_table. | |
1174 This increments print_number_index for the objects added. */ | |
1174 print_preprocess (obj); | 1175 print_preprocess (obj); |
1176 | |
1175 /* Remove unnecessary objects, which appear only once in OBJ; | 1177 /* Remove unnecessary objects, which appear only once in OBJ; |
1176 that is, whose status is Qnil. */ | 1178 that is, whose status is Qnil. Compactify the necessary objects. */ |
1177 for (i = start; i < print_number_index; i++) | 1179 for (i = start; i < print_number_index; i++) |
1178 if (!NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i))) | 1180 if (!NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i))) |
1179 { | 1181 { |
1180 PRINT_NUMBER_OBJECT (Vprint_number_table, index) | 1182 PRINT_NUMBER_OBJECT (Vprint_number_table, index) |
1181 = PRINT_NUMBER_OBJECT (Vprint_number_table, i); | 1183 = PRINT_NUMBER_OBJECT (Vprint_number_table, i); |
1182 /* Reset the status field for the next print step. Now this | |
1183 field means whether the object has already been printed. */ | |
1184 PRINT_NUMBER_STATUS (Vprint_number_table, index) = Qnil; | |
1185 index++; | 1184 index++; |
1186 } | 1185 } |
1186 | |
1187 /* Clear out objects outside the active part of the table. */ | |
1188 for (i = index; i < print_number_index; i++) | |
1189 PRINT_NUMBER_OBJECT (Vprint_number_table, i) = Qnil; | |
1190 | |
1191 /* Reset the status field for the next print step. Now this | |
1192 field means whether the object has already been printed. */ | |
1193 for (i = start; i < print_number_index; i++) | |
1194 PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qnil; | |
1195 | |
1187 print_number_index = index; | 1196 print_number_index = index; |
1188 } | 1197 } |
1189 | 1198 |
1190 print_object (obj, printcharfun, escapeflag); | 1199 print_object (obj, printcharfun, escapeflag); |
1191 } | 1200 } |
2085 Vprint_continuous_numbering = Qnil; | 2094 Vprint_continuous_numbering = Qnil; |
2086 | 2095 |
2087 DEFVAR_LISP ("print-number-table", &Vprint_number_table, | 2096 DEFVAR_LISP ("print-number-table", &Vprint_number_table, |
2088 doc: /* A vector used internally to produce `#N=' labels and `#N#' references. | 2097 doc: /* A vector used internally to produce `#N=' labels and `#N#' references. |
2089 The Lisp printer uses this vector to detect Lisp objects referenced more | 2098 The Lisp printer uses this vector to detect Lisp objects referenced more |
2090 than once. When `print-continuous-numbering' is bound to t, you should | 2099 than once. |
2091 probably also bind `print-number-table' to nil. This ensures that the | 2100 |
2092 value of `print-number-table' can be garbage-collected once the printing | 2101 When you bind `print-continuous-numbering' to t, you should probably |
2093 is done. */); | 2102 also bind `print-number-table' to nil. This ensures that the value of |
2103 `print-number-table' can be garbage-collected once the printing is | |
2104 done. If all elements of `print-number-table' are nil, it means that | |
2105 the printing done so far has not found any shared structure or objects | |
2106 that need to be recorded in the table. */); | |
2094 Vprint_number_table = Qnil; | 2107 Vprint_number_table = Qnil; |
2095 | 2108 |
2096 /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ | 2109 /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ |
2097 staticpro (&Vprin1_to_string_buffer); | 2110 staticpro (&Vprin1_to_string_buffer); |
2098 | 2111 |