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