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