diff options
| author | Richard M. Stallman | 2002-09-18 15:57:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-09-18 15:57:39 +0000 |
| commit | e6d4cddda286906a13a7c1c195780d79d785c76c (patch) | |
| tree | 35f8cedcde7e7f66fb73ba1de347f1d4653db805 /src/print.c | |
| parent | fef7974b61b9c6d2d128966cdd5ce959312e6ad3 (diff) | |
| download | emacs-e6d4cddda286906a13a7c1c195780d79d785c76c.tar.gz emacs-e6d4cddda286906a13a7c1c195780d79d785c76c.zip | |
(print): Clear out the unused parts of Vprint_number_table.
(syms_of_print): Doc fix for `print-number-table'.
Diffstat (limited to 'src/print.c')
| -rw-r--r-- | src/print.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/print.c b/src/print.c index 42dd0371469..038a9aaeaa4 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1169,21 +1169,30 @@ print (obj, printcharfun, escapeflag) | |||
| 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 | ||
| @@ -2087,10 +2096,14 @@ This variable should not be set with `setq'; bind it with a `let' instead. */); | |||
| 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 */ |