Bug #21111. Reviewed by John Darrington.
[pspp-builds.git] / src / language / data-io / ChangeLog
1 2007-09-23  Ben Pfaff  <blp@gnu.org>
2
3         Bug #21111.  Reviewed by John Darrington.
4
5         * data-list.c (data_list_trns_proc): Properly set retval when END
6         subcommand is in use.
7
8 2007-09-12  Ben Pfaff  <blp@gnu.org>
9
10         * get.c (get_translate_case): Change input case parameter from
11         const struct ccase * to struct ccase *, to match change in
12         casereader and casewriter translators.  Destroy input case, to fix
13         memory leak.
14
15 2007-08-12  Ben Pfaff  <blp@gnu.org>
16
17         * get.c (parse_read_command): Compact the values in the target
18         dictionary, to save space.
19
20 2007-08-12  Ben Pfaff  <blp@gnu.org>
21
22         * get.c (struct case_map): Move into new file src/data/case-map.c.
23         (start_case_map): Ditto, and rename case_map_prepare_dict.
24         (finish_case_map): Ditto, and rename case_map_from_dict.
25         (map_case): Ditto, and rename case_map_execute.
26         (destroy_case_map): Ditto, and rename case_map_destroy.
27         (case_map_get_value_cnt): Ditto.
28
29 2007-08-12  Ben Pfaff  <blp@gnu.org>
30
31         * get.c (case_map_get_value_cnt): New function.
32
33 2007-07-25  Ben Pfaff  <blp@gnu.org>
34
35         Fix bug #17100.
36         * data-list.c (read_from_data_list_fixed): Handle multi-record
37         DATA LIST correctly.
38
39 2007-07-11  Ben Pfaff  <blp@gnu.org>
40
41         * get.c (map_case): Create destination case instead of leaving it
42         undefined.  Fixes bug #20285.
43         Reviewed by John Darrington.
44
45 2007-06-06  Ben Pfaff  <blp@gnu.org>
46
47         * get.c: Essentially rewrite MATCH FILES to support FIRST and
48         LAST.
49
50 2007-06-06  Ben Pfaff  <blp@gnu.org>
51
52         Adapt case sources, sinks, and clients of procedure code to the
53         new infrastructure.
54         
55         * data-list.c: Make DATA LIST into a casereader.
56
57         * get.c: Change GET, IMPORT, SAVE, EXPORT to use casereaders,
58         casewriters.
59
60         * inpt-pgm.c: Use caseinit code.  Turn INPUT PROGRAM into a
61         casereader.
62
63         * list.q: Adapt to new procedure code.
64
65 2007-05-06  Ben Pfaff  <blp@gnu.org>
66
67         Abstract the documents within a dictionary a little better.
68         Thanks to John Darrington for suggestion, initial version, and
69         review.  Patch #5917.
70
71         * get.c (mtf_merge_dictionary): Simplify creating merged document.
72
73         * sys-file-info.c (display_documents): Use new
74         dict_get_document_line_cnt and dict_get_document_line functions.
75
76 Thu Feb  1 16:56:02 2007  Ben Pfaff  <blp@gnu.org>
77
78         * file-handle.q (fh_parse): Update to new fh_create_file
79         prototype.
80
81 Sat Dec 16 22:16:18 2006  Ben Pfaff  <blp@gnu.org>
82
83         Make it possible to pull cases from the active file with a
84         function call, instead of requiring indirection through a callback
85         function.
86
87         * automake.mk: Removed matrix-data.c.
88
89         * matrix-data.c: Removed.
90
91         * data-list.c (data_list_source_read): Conform with new
92         case_source_class interface.
93         (data_list_source_destroy): Ditto.
94
95         * get.c (case_reader_source_class): Ditto.
96         (case_reader_source_destroy): Ditto.
97         (parse_output_proc): Take advantage of new procedure interface.
98         (output_proc): Removed.
99         (struct mtf_file): Add "struct ccase *" member to allow use of new
100         procedure interface.
101         (cmd_match_files): Take advantage of new procedure interface.
102         (mtf_processing_finish): Removed.
103         (mtf_read_nonactive_records): Renamed mtf_read_records.  Now reads
104         from every file, without any exception for the active file.
105         (mtf_compare_BY_values): Simplify for new interface.
106         (mtf_processing): Simplify for new interface.
107
108         * inpt-pgm.c (is_valid_state): New function.
109         (input_program_source_read): Conform with new case_source_class
110         interface.
111         (input_program_source_destroy): Ditto.
112         (end_case_trns_proc): Now just needs to return TRNS_END_CASE.
113
114 Sat Dec  9 18:43:34 2006  Ben Pfaff  <blp@gnu.org>
115
116         * list.q (cmd_list): Use new var_create, var_destroy functions.
117
118 Thu Nov 30 21:51:58 2006  Ben Pfaff  <blp@gnu.org>
119
120         * inpt-pgm.c (cmd_reread): Always return error code upon detecting
121         syntax error.  Fixes bug #18419.  Thanks to John Darrington for
122         reporting this bug.
123
124 Sun Nov 19 09:17:45 2006  Ben Pfaff  <blp@gnu.org>
125
126         * data-list.c (parse_free): Follow documented (but odd) rule that
127         N format is treated as F format for free-field input.
128         
129         * data-reader.c (read_file_record): Drop new-line character from
130         input text lines.  This is symmetrical with the recently changed
131         dfm_put_record semantics.
132
133 Thu Nov  2 20:56:03 2006  Ben Pfaff  <blp@gnu.org>
134
135         Implement SKIP keyword on DATA LIST.  Fixes bug #17099.
136         
137         * data-list.c: (struct data_list_pgm) Add `skip_records' members.
138         (cmd_data_list) Set skip_records based on user input.
139         (data_list_source_read) Skip records requested by user.
140
141 Tue Oct 31 20:04:06 2006  Ben Pfaff  <blp@gnu.org>
142
143         * placement-parser.c: (PRS_TYPE_T) Now that struct fmt_spec uses
144         an enum fmt_type for its type member, we can't depend on the
145         ability to put negative values into that member as out-of-band
146         values, because enum fmt_type might be an unsigned type.  So use
147         values around SCHAR_MAX instead, because we know that SCHAR_MAX
148         will fit into any type, signed or unsigned, and there aren't
149         nearly that many format types.
150         (parse_var_placements) Add for_input parameter to specify whether
151         we're parsing input or output formats.  Update all callers.
152         (fixed_parse_columns) Ditto.
153         (fixed_parse_fortran) Ditto.
154         
155 Tue Oct 31 18:21:48 2006  Ben Pfaff  <blp@gnu.org>
156
157         * print-space.c (print_space_trns_proc): Let dfm_put_record add
158         the new-line character, to match dfm_put_record change below.
159
160 Sat Oct 28 11:57:19 2006  Ben Pfaff  <blp@gnu.org>
161
162         * data-writer.c (struct dfm_writer): Removed `bounce' member, and
163         all references to it.
164         (dfm_put_record) Change semantics so that it adds formatting
165         itself, such as new-line characters, instead of putting that
166         responsibility on the caller.  Also, pad binary records with
167         spaces instead of zeros, for compatibility.
168
169         * print.c (struct prt_out_spec) New member `sysmis_as_spaces'.
170         (struct print_trns) Remove `omit_new_lines' and all references,
171         since dfm_put_record() is taking care of that.  Add
172         `include_prefix'.
173         (internal_cmd_print) Allow an empty set of data to print.  Set
174         include_prefix.
175         (parse_specs) Allow an empty set of data to print.
176         (parse_variable_argument) Only add space with PRINT command.  Set
177         sysmis_as_spaces.
178         (print_trns_proc) Indent records if include_prefix is set, for
179         compatibility.  Output SYSMIS as spaces if sysmis_as_spaces is
180         set.  Put "1" in first column if PRINT EJECT is used with an
181         external output file.
182         (flush_records) Ditto.
183
184 Sat Oct 28 16:19:57 WST 2006 John Darrington <john@darrington.wattle.id.au>
185
186         * data-reader.c: Eliminated references to extern variable getl_buf
187
188 Sat Aug  5 08:25:07 2006  Ben Pfaff  <blp@gnu.org>
189
190         Fix bug #17329 in REREAD parsing, reported by John Darrington.
191
192         * inpt-pgm.c (cmd_reread): Fix file handle parsing.
193
194 Mon Jul 31 10:32:31 2006  Ben Pfaff  <blp@gnu.org>
195
196         * print.c (parse_specs): Allow a comma between specifications.
197
198 Sun Jul 16 19:57:10 2006  Ben Pfaff  <blp@gnu.org>
199
200         * automake.mk: (src_language_data_io_libdata_io_a_SOURCE) Add
201         print-space.c, placement-parser.c, placement-parser.h.
202
203         * data-list.c: Basically rewrote the whole thing.  Broke out a lot
204         of code into placement-parser.c.  Code is much cleaner now.
205
206         * placement-parser.c: New file.
207
208         * placement-parser.h: New file.
209
210         * print.c: Basically rewrote the whole thing.  Broke out PRINT
211         SPACE into print-space.c.  Code is much cleaner now.
212
213         * print-space.c: New file.
214
215 Sat Jul  1 17:39:40 2006  Ben Pfaff  <blp@gnu.org>
216
217         Fix bug #11612, "q2c documentation does not agree with code".
218         
219         * list.q: Audit use of q2c "+" prefixes that indicate that a
220         command may appear multiple times.
221
222 Sat Jul  1 20:44:22 2006  Ben Pfaff  <blp@gnu.org>
223
224         Fix bug #15786: System File Creation crashes if directoy is
225         nonexistent.
226         
227         * get.c (parse_write_command): Check that the any_writer open
228         succeeds.
229
230 Tue Jun 27 22:44:28 2006  Ben Pfaff  <blp@gnu.org>
231
232         Fix regression in command name completion reported by John
233         Darrington.  Now completion is again state-dependent and occurs
234         only on the first line of a command.
235         
236         * inpt-pgm.c: (cmd_input_program) Reading of first token in
237         command moved into cmd_parse.
238
239 Fri Jun  9 13:56:00 2006  Ben Pfaff  <blp@gnu.org>
240
241         Reform string library.
242         
243         * matrix-data.c (context): Use dynamic string.
244         (another_token) Deal with changed dfm_get_record() interface.
245         (mget_token) Ditto.
246         (force_eol) Ditto.
247
248         * data-list.c (struct data_list_pgm) Delete delims, delim_cnt
249         members, replacing them by struct string delims.  Update all
250         references to use struct string functions.
251         (cut_field) Change interface to avoid needing "end_blank", by
252         getting the data-reader to remember that state for us.  Change
253         internals to use substring.  Update both callers.
254
255         * data-reader.c (read_file_record): Use ds_read_stream().
256         (dfm_get_record) Change interface to return substring.  Updated
257         all callers.
258         (dfm_expand_tabs) Use ds_find_char().  Now maintain position
259         relative to end-of-line.  Use ds_swap().
260         (dfm_reread_record) Don't limit position by line length.
261         (dfm_column_start) Make parameter const.
262         (dfm_columns_past_end) New function.
263         (dfm_get_column) New function.
264
265 Thu May 25 18:26:26 WST 2006 John Darrington <john@darrington.wattle.id.au>
266
267         * print.c (print_trns_free): Made the code agree with the comment, by
268         not freeing PRT.  Has the side effect that the command no longer
269         crashes on invalid syntax.
270
271 Tue May  9 20:55:46 2006  Ben Pfaff  <blp@gnu.org>
272
273         * get.c (cmd_match_files): Fix memory leak replacing default_dict.
274
275 Sat May  6 22:25:09 2006  Ben Pfaff  <blp@gnu.org>
276
277         Fix segfault.
278         
279         * list.q (write_fallback_headers): (write_fallback_headers)
280         Properly record width of leader and pass it to write_varname().
281
282 Sat May  6 19:03:13 2006  Ben Pfaff  <blp@gnu.org>
283
284         * get.c: (mtf_merge_dictionary) Fix value label memory leak.
285
286 Sat May  6 13:51:16 2006  Ben Pfaff  <blp@gnu.org>
287
288         Use a casefile, instead of a case sink, for MATCH FILES output.
289         It's more straightforward, although it has the same effect.
290         
291         * get.c: (struct mtf_proc) Replace `sink' case sink member by
292         `output' casefile member.
293         (cmd_match_files) Work with casefile instead of sink.
294         (mtf_processing) Add case to casefile instead of sink.
295
296 Sat May  6 10:43:07 2006  Ben Pfaff  <blp@gnu.org>
297
298         Continue reforming procedure execution.  In this phase, get rid of
299         the output code for SPLIT FILE groups in procedure.c, which really
300         shouldn't be doing any output.  Move it into the individual
301         procedures instead.  This also adds some flexibility.
302
303         * list.q (write_all_headers): Call output_split_file_values().
304
305 Wed May  3 23:00:17 2006  Ben Pfaff  <blp@gnu.org>
306
307         Continue reforming procedure execution.  In this phase, get rid of
308         many global variables, consolidating procedure execution in
309         procedure.c.  Encapsulate transformations in new "struct
310         trns_chain".  Also, change implementation of N OF CASES, FILTER,
311         and PROCESS IF from special cases to transformations.
312          
313         * data-list.c: (data_list_trns_proc) Return TRNS_END_FILE at end
314         of file.  (Why didn't we do this before?)
315         (cmd_match_files) Direct procedure output to null sink.
316         Use discard_variables() instead of indirect version.
317
318         * inpt-pgm.c: Use transformation chain.
319         (struct input_program_pgm) Add trns_chain member.
320         (cmd_input_program) Initialize trns_chain member and capture
321         transformations with proc_capture_transformations().
322         (input_program_source_read) Use trns_chain_execute().
323         (destroy_input_program) Destroy input chain.
324
325 Tue May  2 10:39:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
326
327         * list.q Changed from using fixed length char buffers to struct 
328         string so that any length variables can be used.
329
330 Mon May  1 18:21:19 2006  Ben Pfaff  <blp@gnu.org>
331
332         Further clean up the CMD_* command result codes.
333         
334         * (enum cmd_result_extensions) New.  Add CMD_END_INPUT_PROGRAM and
335         CMD_END_CASE result codes.
336         (struct input_program_pgm) Added case_nr, write_case, wc_data
337         members for use by END CASE transformation.
338         (emit_END_CASE) New function.
339         (cmd_input_program) Interpret CMD_END_CASE by outputting an END
340         CASE transformation.  If none is output by the input program
341         itself, add one automatically at the end.  Change lack of
342         variables from warning to error.
343         (cmd_end_input_program) Return CMD_END_INPUT_PROGRAM instead of
344         CMD_END_SUBLOOP.
345         (input_program_source_read) No longer any need to special-case END
346         CASE.  Handle TRNS_DROP_CASE properly.  Initialize new members in
347         inp for use by END CASE transformation.
348         (destroy_input_program) New function.
349         (input_program_source_destroy) Just call destroy_input_program().
350         (cmd_end_case) Just return CMD_END_CASE.
351         (end_case_trns_proc) No longer a stub handled by
352         input_program_source_read().  Actually output the case and
353         increment the case number.
354
355 Mon May  1 16:06:30 2006  Ben Pfaff  <blp@gnu.org>
356
357         Remove vestiges of REPEATING DATA support.
358         
359         * data-list.c: (struct rpd_num_or_var) Removed.
360         (struct repeating_data_trns) Removed.
361         (cmd_repeating_data) Removed.
362         (find_variable_input_spec) Removed.
363         (parse_num_or_var) Removed.
364         (parse_repeating_data) Removed.
365         (realize_value) Removed.
366         (struct rpd_parse_info) Removed.
367         (rpd_parse_record) Removed.
368         (repeating_data_trns_proc) Removed.
369         (repeating_data_trns_free) Removed.
370         (repeating_data_set_write_case) Removed.
371         (rpd_msg) Removed.
372
373         * inpt-pgm.c: (input_program_source_read) Don't deal with
374         REPEATING DATA.
375
376         * data-list.h: Removed.
377
378         * automake.mk (src_language_data_io_libdata_io_a_SOURCES): Removed
379         data-list.h.
380
381 Mon May  1 15:58:28 2006  Ben Pfaff  <blp@gnu.org>
382
383         Remove vestiges of FILE TYPE support. 
384         
385         * data-list.c: (cmd_data_list) Don't check for FILE TYPE.
386         (cmd_repeating_data) Ditto.
387         
388         * automake.mk (src_language_data_io_libdata_io_a_SOURCES): Remove
389         file-type.c, file-type.h.
390
391         * file-type.c: Removed.
392         
393         * file-type.h: Removed.
394
395 Wed Apr 26 13:16:28 2006  Ben Pfaff  <blp@gnu.org>
396
397         Improve the way we handle the various parsing "states".  Until now
398         we've hard-coded the state transitions in the command definition
399         file, but that's error-prone and, worse, it's redundant--we can
400         figure out what state we're in anyhow.  We can cleanly handle
401         INPUT PROGRAM and FILE TYPE with a nested command-processing loop.
402         
403         * data-list.c: (cmd_data_list) Use in_file_type() or
404         in_input_program() in place of case_source_is_class() or
405         case_source_is_complex().
406
407         * file-type.c: NB: Not really fixed except minimally to compile,
408         because it doesn't work anyway.
409         (in_file_type) New function.
410         (cmd_record_type) No need to check that we're in FILE TYPE.
411         (cmd_end_file_type) Ditto.
412         (var file_type_source_class) Make static.
413
414         * get.c: (cmd_match_files) Check vfm_source instead of pgm_state.
415
416         * inpt-pgm.c: (in_input_program) New function.
417         (cmd_input_program) Rewrite to include nested command processing
418         loop.
419         (cmd_end_input_program) Just return CMD_END_SUBLOOP.
420         (var input_program_source_class) Make static.
421         (cmd_end_case) No need to check that we're in INPUT PROGRAM.
422         (cmd_end_file) Ditto.
423         
424         * automake.mk (src_language_data_io_libdata_io_a_SOURCES): Add
425         file-type.h, inpt-pgm.h.
426
427         * file-type.h: New file.
428
429         * inpt-pgm.h: New file.
430
431 Tue Apr 25 13:11:55 2006  Ben Pfaff  <blp@gnu.org>
432
433         * print.c: Don't special-case MS-DOS line terminators.
434         (macro LINE_END_WIDTH) Removed.
435         (alloc_line) Line ends are 1 byte.
436         (print_trns_proc) Just output \n for line end.
437
438 Sun Apr 23 22:05:58 2006  Ben Pfaff  <blp@gnu.org>
439
440         Continue reforming error message support.  In this phase, get rid
441         of message "titles" and put the message text in `struct error'.
442         Now `struct error' encapsulates a message more properly.
443         
444         * data-list.c: (macro RPD_ERR) Removed.
445         (rpd_msg) New function.  Updated all references to tmsg() to call
446         this function instead.
447
448 Sat Apr 15 19:38:13 2006  Ben Pfaff  <blp@gnu.org>
449
450         Remove last users of struct file_ext so we can get rid of it
451         entirely.
452         
453         * data-reader.c: (struct dfm_reader) Change file member from
454         struct file_ext to FILE *.  Updated all references.
455         (dfm_close_reader) Close file with fn_close() instead of
456         fn_close_ext().  Also, make a copy of the file name from the file
457         handle before closing it, because we can't extract it after we
458         close the file.
459         (dfm_open_reader) Open file with fn_open() instead of
460         fn_open_ext().
461
462         * data-writer.c: (struct dfm_writer) Change file member 
463         struct file_ext to FILE *.  Updated all references.
464         (dfm_close_writer) Close file with fn_close() instead of
465         fn_close_ext().  Also, make a copy of the file name from the file
466         handle before closing it, because we can't extract it after we
467         close the file.
468         (dfm_open_writer) Open file with fn_open() instead of
469         fn_open_ext().
470
471 Sat Apr 15 18:00:32 2006  Ben Pfaff  <blp@gnu.org>
472
473         * data-list.c: Add prototype to suppress warning for
474         cmd_repeating_data().
475         
476 Thu Mar  2 08:40:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
477         
478         * Moved files from src directory