Make the missing value code do more work, so that its callers can do
[pspp-builds.git] / src / data / ChangeLog
1 Fri Dec 22 13:56:08 2006  Ben Pfaff  <blp@gnu.org>
2
3         Simplify missing value handling.
4
5         * missing-values.h (enum mv_class): New type.
6         (enum mv_type): Moved definition into missing-values.c and renamed
7         each MV_* to MVT_*, to distinguish them from the exposed mv_class
8         enums.  Updated all uses.
9         (struct missing_values): Changed type of `type' from `enum
10         mv_type' to `int' because the definition is no longer exposed.
11         
12         * missing-values.c (mv_is_value_missing): Add new enum mv_class
13         parameter.  Update all callers.
14         (mv_is_num_missing): Ditto.
15         (mv_is_str_missing): Ditto.
16         (mv_is_value_user_missing): Removed.  Changed callers to use
17         mv_is_value_missing.
18         (mv_is_num_user_missing): Removed.  Changed callers to use
19         mv_is_num_missing.
20         (mv_is_str_user_missing): Removed.  Changed callers to use
21         mv_is_str_missing.
22         (mv_is_value_system_missing): Removed.  Changed callers to use
23         mv_is_value_missing.
24         (mv_set_type): Removed.  Changed callers to use mv_clear.
25         (mv_clear): New function.
26         
27         * variable.c (var_is_value_missing): Add new enum mv_class
28         parameter.  Update all callers.
29         (var_is_num_missing): Ditto.
30         (var_is_str_missing): Ditto.
31         (var_is_value_user_missing): Removed.  Changed callers to use
32         var_is_value_missing.
33         (var_is_num_user_missing): Removed.  Changed callers to use
34         var_is_num_missing.
35         (var_is_str_user_missing): Removed.  Changed callers to use
36         var_is_str_missing.
37         (var_is_value_system_missing): Removed.  Changed callers to use
38         var_is_value_missing.
39         
40         * casefilter.c (struct casefilter): Use enum mv_class in place of
41         bool.
42         (casefilter_variable_missing): Adapt to new member.
43         (casefilter_create): Change signature to take enum mv_class,
44         update callers.
45
46 Fri Dec 22 20:08:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
47
48         * casefile-factory.h fastfile-factory.c fastfile-factory.h: New files.
49
50         * case-sink.c case-sink.h procedure.c procedure.h 
51           storage-stream.c: Now uses the factory.
52         
53 Sat Dec 16 22:05:18 2006  Ben Pfaff  <blp@gnu.org>
54
55         Make it possible to pull cases from the active file with a
56         function call, instead of requiring indirection through a callback
57         function.
58
59         * case-source.h (struct case_source_class): Change ->read function
60         to return a single case, instead of calling a callback function
61         for each case.  Change ->destroy function to return an error
62         status.
63
64         * case-source.c (free_case_source): Pass along the value returned
65         by the case_source ->destroy function.
66
67         * procedure.c (struct write_case_data): Removed.
68         (struct dataset): Added some members to track procedure state.
69         (procedure): Optimize the trivial case at this level.
70         (internal_procedure): Re-implement in terms of proc_open,
71         proc_read, proc_close.
72         (proc_open) New function.
73         (proc_read) New function.
74         (proc_close) New function.
75         (write_case) Moved into proc_read.
76         (close_active_file) Moved closing of data source into proc_close.
77
78         * storage-source.c: Rewrote to conform with modified
79         case_source_class interface.
80
81         * transformations.c (trns_chain_execute): Added argument to allow
82         starting execution from an arbitrary transformation.  Updated
83         callers.
84
85         * transformations.h (enum TRNS_NEXT_CASE) Renamed TRNS_END_CASE.
86
87 Sat Dec 16 14:09:25 2006  Ben Pfaff  <blp@gnu.org>
88
89         * sys-file-reader.c (read_display_parameters): Don't assume that
90         MEASURE_* and ALIGN_* have the same values found in system files.
91
92         * sys-file-writer.c (write_variable_display_parameters): Ditto.
93
94         * variable.h: Change MEASURE_NOMINAL, MEASURE_ORDINAL,
95         MEASURE_SCALE to be 0-based instead of 1-based.  This also fixes
96         the value of n_MEASURES, which was off by 1 (at least from my
97         point of view).
98
99 Sat Dec 16 12:17:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
100
101         * dictionary.c dictionary.h vardict.h variable.c: Added optional
102                 callbacks which are invoked when the dictionary or its 
103                 variables are changed.  
104         
105         * missing-values.c missing-values.h value-labels.c: Tidied up
106                 consistency checks, and made some of them return false 
107                 instead of assert-failing. 
108
109 Wed Dec 13 19:30:11 2006  Ben Pfaff  <blp@gnu.org>
110
111         * calendar.c (calendar_days_in_month): New function.
112
113 Mon Dec 11 07:53:39 2006  Ben Pfaff  <blp@gnu.org>
114
115         * value-labels.c (hash_int_val_lab): Only hash as many bytes as
116         the value label's width.
117
118 Sun Dec 10 14:21:29 2006  Ben Pfaff  <blp@gnu.org>
119
120         * sfm-private.h: Move contents into sys-file-writer.c, which is
121         the only remaining user.  Removed Borland C++-specific directives.
122         
123         * sys-file-reader.c: Clean up and rewrite entire file.  The
124         rewritten version is simpler and better abstracted, and should be
125         easier to maintain and extend.  It avoids using structures to read
126         file data, which is prone to padding variations among compilers.
127         It should also handle non-IEEE 754 system files, although I
128         haven't been able to find any.  It has been tested against many
129         .sav files obtained from the Web and found to produce the same
130         results as the earlier version of the code, or in some cases
131         improved results.  It is more tolerant of format variations found
132         in the wild.
133
134         * sys-file-reader.h (struct sfm_read_info): Removed `big_endian'
135         member, putting an enum integer_format in its place.  New member
136         `float_format'.  Changed `compressed' member to type bool.
137
138 Sun Dec 10 13:48:53 2006  Ben Pfaff  <blp@gnu.org>
139
140         * dictionary.c (dict_delete_consecutive_vars): New function.
141
142 Sat Dec  9 20:08:25 2006  Ben Pfaff  <blp@gnu.org>
143
144         * file-name.c (fn_search_path): Remove prefix arg that was unused
145         by any caller.  Updated all callers.
146
147 Sat Dec  9 20:04:22 2006  Ben Pfaff  <blp@gnu.org>
148
149         * format.c (fmt_dollar_template): Use user's decimal point
150         character.  Add assertion.
151
152 Sat Dec  9 20:02:25 2006  Ben Pfaff  <blp@gnu.org>
153
154         * format.c (fmt_dollar_template): New function, based on
155         dollar_format_template from var-type-dialog.c.
156
157 Sat Dec  9 18:05:59 2006  Ben Pfaff  <blp@gnu.org>
158
159         * data-out.c (output_scientific): Fix bad assumption that "buf" is
160         null-terminated.
161         
162 Sat Dec  9 17:23:23 2006  Ben Pfaff  <blp@gnu.org>
163
164         Finish converting struct variable to an opaque type.  In this
165         phase, we add remaining setter and getter functions, convert the
166         remaining PSPP code to use them, and do a bunch of cleanup.  The
167         resulting changes are pervasive but mostly trivial, and only the
168         notable changes are logged.
169         
170         * automake.mk (src_data_libdata_a_SOURCES): Add the new source
171         files.
172         
173         * case.c (case_data): Renamed case_data_idx.
174         (case_num): Renamed case_num_idx.
175         (case_str): Renamed case_str_idx.
176         (case_data_rw): Renamed case_data_rw_idx.
177
178         * case.h (case_data): New function with old name and an interface
179         that takes a variable instead of an index, which is easier to
180         use.  Updated all callers to use the new interface, or to use the
181         new *_idx function (see above).
182         (case_num): Ditto.
183         (case_str): Ditto.
184         (case_data_rw): Ditto.
185         
186         * category.c (cat_stored_values_destroy): Changed interface to
187         take a struct cat_vals * instead of a struct variable *.
188
189         * dictionary.c (dict_clone): Use new vector_clone function.     
190         (dict_clear) Use new var_destroy function.
191         (add_var) New function.
192         (dict_create_var) Rewrite in terms of dict_create_var_assert.
193         (dict_create_var_assert) Rewrite in terms of add_var.
194         (dict_clone_var) Rewrite in terms of dict_clone_var_assert.
195         (dict_clone_var_assert) Rewrite in terms of var_clone, add_var.
196         (dict_lookup_var) Use new var_create, var_destroy functions.
197         (dict_contains_var) Rewrite in terms of new vardict functionality.
198         (set_var_dict_index) New function.
199         (set_var_case_index) New function.
200         (reindex_vars) New function.
201         (dict_delete_var) Rewrite in terms of new vardict functionality.
202         (dict_reorder_var) Ditto.
203         (dict_reorder_vars) Ditto.
204         (rename_var) New function.
205         (dict_rename_var) Use rename_var.
206         (dict_rename_vars) Use pool to simplify code.  Use rename_var.
207         (dict_get_compacted_idx_to_fv) Rename
208         dict_get_compacted_dict_index_to_case_index, update callers.
209         (dict_create_vector) Use new vector_create function.
210         (dict_clear_vectors) Use new vector_destroy function.
211         (set_var_short_name_suffix) Move here from variable.c, renamed
212         from var_set_short_name_suffix, make static, update caller.
213
214         * sys-file-private.c: New file.  
215         (sfm_width_to_bytes) Moved here from variable.c, renamed from
216         width_to_bytes, update callers.
217
218         * sys-file-private.h: New file.  Later it will supplant
219         sfm-private.h; for now it supplements it.
220         (macro MIN_VERY_LONG_STRING) New macro.
221         (macro EFFECTIVE_LONG_STRING_LENGTH) New macro, from value.h.
222
223         * sys-file-reader.c: Use MIN_VERY_LONG_STRING - 1 where
224         MAX_LONG_STRING was used before.
225
226         * sys-file-writer.c: Ditto.
227
228         * value-labels.c: Change the paradigm here to be that a null
229         pointer is OK for a struct val_labs * in most cases; it just
230         represents an empty set of value labels.
231         (val_labs_copy) A copy of a null set is a null set.
232         (val_labs_count) A null set has 0 labels.
233         (val_labs_replace) Change return type to void.  Rewrite for
234         simplicity.
235         (val_labs_find) A null set does not contain the value.
236         (value_to_string) Moved to variable.c, renamed var_get_value_name,
237         transposed argument order, updated all callers.
238
239         * value.c: New file.
240         (value_dup) Moved here from variable.c.
241         (compare_values) Ditto.
242         (hash_value) Ditto.
243
244         * value.h: (macro MAX_SHORT_STRING) Rewrote for simplicity.
245         (macro MAX_LONG_STRING) Removed, because it was only interesting
246         for system files, not for general code.
247         (macro MAX_VERY_LONG_STRING) Ditto.
248         (macro EFFECTIVE_LONG_STRING_LENGTH) Moved to sys-file-private.h.
249         (macro MAX_ELEMS_PER_VALUE) Removed, as it was unused.
250
251         * vardict.h: New file, for an interface between variables and
252         their dictionaries.
253
254         * variable.c: A lot of functions were moved around, for better
255         organization.
256         (struct variable) Move definition here, from variable.h.
257         (var_type_adj) Removed--makes i18n hard.
258         (var_type_noun) Ditto.
259         (var_create) New function.
260         (var_clone) New function.
261         (var_destroy) New function.
262         (var_set_name) Assert that variable is not in a dictionary.
263         (compare_var_names) Rename compare_vars_by_name and fix a couple
264         of callers who thought the args were strings.
265         (hash_var_name) Rename hash_var_by_name.
266         (compare_var_ptr_names) Rename compare_var_ptrs_by_name.
267         (hash_var_ptr_name) Rename hash_var_ptr_by_name.
268         (var_is_very_long_string) Removed, because it was only interesting
269         to system file code.
270         (var_set_missing_values) Allow the argument to be the wrong width,
271         as long as we can resize it.  Simplify callers who were doing the
272         resizing themselves.
273         (var_get_value_labels) New function.
274         (var_has_value_labels) New function.
275         (var_set_value_labels) New function.
276         (alloc_value_labels) New function.
277         (var_add_value_label) New function.
278         (var_replace_value_label) New function.
279         (var_clear_value_labels) New function.
280         (var_lookup_value_label) New function.
281         (var_get_value_name) Moved here from variable.c, renamed from
282         var_get_value_name, transposed argument order, updated all
283         callers.
284         (var_to_string) Moved here, from variable-label.c.
285         (var_set_leave) New function.
286         (var_get_leave) New function.
287         (var_must_leave) New function.
288         (var_set_short_name_suffix) Moved to dictionary.c, renamed
289         set_var_short_name_suffix.
290         (var_get_dict_index) New function.
291         (var_get_case_index) New function.
292         (var_get_obs_vals) New function.
293         (var_set_obs_vals) New function.
294         (var_has_obs_vals) New function.
295         (var_get_vardict) New function.
296         (var_set_vardict) New function.
297         (var_has_vardict) New function.
298         (var_clear_vardict) New function.
299         (value_dup) Moved to value.c.
300         (compare_values) Ditto.
301         (hash_value) Ditto.
302
303         * variable.h: (enum NUMERIC) Rename VAR_NUMERIC, update all users.
304         (enum ALPHA) Rename VAR_STRING, update all users.
305
306         * vector.c: New file.
307         (struct vector) Moved here, from variable.h.
308         (check_widths) New function.
309         (vector_create) New function.
310         (vector_clone) New function.
311         (vector_destroy) New function.
312         (vector_get_name) New function.
313         (vector_get_var) New function.
314         (vector_get_var_cnt) New function.
315         (compare_vector_ptrs_by_name) New function.
316
317         * vector.h: New file.
318
319 Sun Dec 10 11:32:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
320
321         * casefilter.c (casefilter_variable_missing): Avoided comparision of
322         string variables to SYSMIS.  Thanks to Ben Pfaff for reporting this
323         problem.
324
325 Sat Dec  9 07:18:03 WST 2006 John Darrington <john@darrington.wattle.id.au>
326
327         * value-labels.c (destroy_atoms): New function.
328         * value-labels.c (atom_create): Call destroy_atoms in atexit handler.
329
330 Thu Dec  7 17:38:26 2006  Ben Pfaff  <blp@gnu.org>
331
332         Thanks to Jason Stover for pointing out this problem.
333         
334         * data-out.c (output_number): Use gsl_finite from GSL, which is
335         portable, instead of isfinite, which is not.
336         (power256) Ditto.
337
338 Thu Dec  7 15:22:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
339
340         * variable.c variable.h (value_dup): New function.
341
342 Mon Dec  4 22:20:17 2006  Ben Pfaff  <blp@gnu.org>
343
344         Start converting struct variable to an opaque type.  In this
345         phase, we add a bunch of setter and getter functions and convert
346         most of the PSPP code to use them.  The resulting changes are
347         pervasive but mostly trivial, and only the notable changes are
348         logged.
349         
350         * format.c (fmt_equal): New function.
351         
352         * variable.c (var_type_is_valid): New function.
353         (measure_is_valid) Moved here, from format.c.
354         (alignment_is_valid) Moved here, from format.c.
355         (var_get_name) New function.
356         (var_set_name) New function.
357         (width_to_type) New function.
358         (var_get_type) New function.
359         (var_get_width) New function.
360         (var_set_width) New function.
361         (var_is_numeric) New function.
362         (var_is_alpha) New function.
363         (var_is_short_string) New function.
364         (var_is_long_string) New function.
365         (var_is_very_long_string) New function.
366         (var_get_missing_values) New function.
367         (var_set_missing_values) New function.
368         (var_clear_missing_values) New function.
369         (var_has_missing_values) New function.
370         (var_is_value_missing) New function.
371         (var_is_num_missing) New function.
372         (var_is_str_missing) New function.
373         (var_is_value_user_missing) New function.
374         (var_is_num_user_missing) New function.
375         (var_is_str_user_missing) New function.
376         (var_is_value_system_missing) New function.
377         (var_get_print_format) New function.
378         (var_set_print_format) New function.
379         (var_get_write_format) New function.
380         (var_set_write_format) New function.
381         (var_set_both_formats) New function.
382         (var_get_label) New function.
383         (var_set_label) New function.
384         (var_clear_label) New function.
385         (var_has_label) New function.
386         (var_get_measure) New function.
387         (var_set_measure) New function.
388         (var_get_display_width) New function.
389         (var_set_display_width) New function.
390         (var_get_alignment) New function.
391         (var_set_alignment) New function.
392         (var_get_value_cnt) New function.
393         (var_get_leave) New function.
394         (var_get_short_name) New function.
395
396         * variable.h: (struct variable) Removed "type" and "nv" members;
397         they are now computed from "width" where needed.
398
399 Mon Dec  4 21:38:40 2006  Ben Pfaff  <blp@gnu.org>
400
401         * missing-values.c (mv_resize): Don't write beyond end of the
402         allocated buffer when resizing a long string.
403
404 Sat Dec  2 16:28:32 2006  Ben Pfaff  <blp@gnu.org>
405
406         Clean up identifier code: don't require identifier enumerations to
407         be in a particular order; make better use of string library;
408         expose less of the internals.
409                 
410         * identifier.c: (lex_skip_identifier) Rename lex_id_get_length,
411         change interface.  Updated all callers.
412         (lex_id_match) Change interface to use struct substring, update
413         all callers.
414         (lex_id_match_len) Removed.  Update callers to use lex_id_match.
415         (global array keywords[]) Make static, change form.  Update all
416         users to use lex_id_name instead.
417         (lex_is_keyword) New function.
418         (lex_id_to_token) Change interface to use struct substring, update
419         all callers.
420         (lex_id_name) New function.
421
422         * identifier.h: (T_FIRST_KEYWORD) Removed.  Changed users to call
423         lex_is_keyword instead.
424         (T_LAST_KEYWORD) Removed.
425         (T_N_KEYWORDS) Removed.
426         
427 Sat Nov 18 20:46:35 2006  Ben Pfaff  <blp@gnu.org>
428
429         * format.c: (fmt_date_template) Distinguish characters for which a
430         space is output and any date delimiter is allowed on input, from
431         those for which a space is output and only a space is allowed on
432         input.  The former is represented by X, the latter by a space.
433         Also, drop distinction between h and H, changing the former to the
434         latter.
435
436         * data-in.c: Completely rewrite internals to conform to SPSS input
437         formats as closely as possible.
438         (data_in) Changed external interface by replacing the structure
439         that was used as a single argument by a set of arguments.  Updated
440         all callers.
441         (data_in_finite_line) Removed.  Converted all callers to use plain
442         data_in.
443         (data_in_get_integer_format) New function.
444         (data_in_set_integer_format) New function.
445         (data_in_get_float_format) New function.
446         (data_in_set_float_format) New function.
447
448         * data-in.h: (enums DI_IGNORE_ERROR, DI_IMPLIED_DECIMALS) Removed.
449         (struct data_in) Removed.
450
451         * data-out.c: (output_date) Drop each component from the input as
452         it is output, to allow us to drop the distinction between h (a
453         count of hours) and H (the hour of day) template characters.
454         Also, handle new X template character.
455         (output_scientific) Follow more rational rule on when to drop
456         fraction introduced between SPSS 13 and 15.  Updated test case to
457         match new behavior.
458
459 Sat Nov 11 11:41:26 2006  Ben Pfaff  <blp@gnu.org>
460
461         Fix buffer overflow reported by John Darrington.
462
463         * data-out.c (output_bcd_integer): In case of SYSMIS, etc.,
464         realize that DIGITS is a count of nibbles, not of bytes.
465
466 Sat Nov  4 15:59:56 2006  Ben Pfaff  <blp@gnu.org>
467
468         * calendar.c (calendar_offset_to_gregorian) Also return the
469         year-of-day.  Change callers to new interface.
470
471         * data-out.c: Completely rewrite internals to conform to SPSS
472         output formats as completely as possible.
473         (data_out) Change interface to put input parameters before output
474         parameters, for consistency with the style I now prefer.  Update
475         all callers.
476         (data_out_get_integer_format) New public function.
477         (data_out_set_integer_format) New public function.
478         (data_out_get_float_format) New public function.
479         (data_out_set_float_format) New public function.
480
481         * data-out.h: New file.  Move prototype for data_out here, from
482         format.h.
483
484         * format.c: (fmt_step_width) Use equality comparison instead of
485         bitwise and, for clarity.
486         (fmt_is_string) Ditto.
487         (fmt_input_to_output) Fix categories that are translated to F
488         format.
489
490 Sun Nov  5 08:29:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
491
492         * casefilter.c casefilter.h (new files), casefile.c casefile.h 
493         casefile-private.h: Added casefilter to assist commands with missing 
494         values.
495
496 Sat Nov  4 11:47:09 2006  Ben Pfaff  <blp@gnu.org>
497
498         Implement SET ERRORS, SHOW ERRORS.  Fixes bug #17609.
499         
500         * settings.c: (route_errors_to_terminal) New variable.
501         (route_errors_to_listing) New variable. 
502         (get_error_routing_to_terminal) New function.
503         (set_error_routing_to_terminal) New function.
504         (get_error_routing_to_listing) New function.
505         (set_error_routing_to_listing) New function.
506
507         * settings.h: (SET_ROUTE_* enums) Removed, because unused.
508
509 Tue Oct 31 19:58:27 2006  Ben Pfaff  <blp@gnu.org>
510
511         * format.c: Completely rewrite, to achieve better abstraction.
512         Rewrite all references to formats in other files.
513         
514         * format.def: Rewrite and reorganize.
515
516         * settings.c: Move everything related to custom currency formats
517         into format.[ch], changing them in form, so as to group related
518         code and definitions better.  Changed all references to use the
519         new functions.
520         (static var decimal) Removed.
521         (static var grouping) Removed.
522         (static var cc) Removed.
523         (get_decimal) Removed.
524         (set_decimal) Removed.
525         (get_grouping) Removed.
526         (set_grouping) Removed.
527         (get_cc) Removed.
528         (set_cc) Removed.
529
530         * settings.h: (macro CC_CNT) Removed.
531         (macro CC_WIDTH) Removed.
532         (struct custom_currency) Removed.
533
534 Tue Oct 31 19:56:19 2006  Ben Pfaff  <blp@gnu.org>
535
536         * data-in.c (data_in): Use switch statement instead of table, to
537         avoid dependence on the order of the FMT_* enums.
538
539 Tue Oct 31 19:35:36 2006  Ben Pfaff  <blp@gnu.org>
540
541         * data-out.c: (num_to_string) Removed, because it was dead code.
542
543 Tue Oct 31 18:09:24 2006  Ben Pfaff  <blp@gnu.org>
544
545         * data-in.c (parse_trailer): Fix error message.
546
547 Sat Oct 28 11:56:50 2006  Ben Pfaff  <blp@gnu.org>
548
549         * format.c (fmt_is_binary): New function.
550
551 Thu Oct 19 22:59:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
552
553         * procedure.c procedure.h: Encapsulated the static data into a single
554         struct.  
555
556 Sat Oct 14 16:56:44 2006  Ben Pfaff  <blp@gnu.org>
557
558         * casefile.c (casereader_read_xfer): Always initialize the case,
559         even on an error condition.
560
561 Wed Sep 27 09:37:49 WST 2006 John Darrington <john@darrington.wattle.id.au>
562
563         * procedure.c (case_limit_trns_proc): Fixed buglet which rendered the 
564         entire function useless.
565
566 Mon Sep 25 17:11:46 WST 2006 John Darrington <john@darrington.wattle.id.au>
567
568         * casefile-private.h casefile.c casefile.h fastfile.c: Created new
569         casereader method casereader_clone.   
570         
571         * procedure.c pransformations.h: Introduced new type casenum_t
572
573 Thu Sep 21 07:00:30 2006  Ben Pfaff  <blp@gnu.org>
574
575         * variable.c: (width_to_bytes) Rephrase code for clarify.
576
577 Sun Jul 16 19:52:03 2006  Ben Pfaff  <blp@gnu.org>
578
579         * format.c: (fmt_type_from_string) New function.
580         (fmt_to_string) Include decimals in output if the format has
581         decimals, even if the format type does not.  This way, we can
582         accurately reproduce incorrect formats in user output.
583         (check_common_specifier) Make the check for a bad format type an
584         assertion, so we get bug reports if they show up.  Fix message.
585         Check for decimal places with a format type that doesn't allow
586         them.
587         (check_input_specifier) Remove check for FMT_X, which has been
588         deleted.
589         (check_output_specifier) Ditto. 
590
591         * format.def: Remove FMT_T, FMT_X, FMT_DESCEND, FMT_NEWREC.
592
593         * format.h: (macro FMT_TYPE_LEN_MAX) New macro.
594         (struct fmt_desc) Use FMT_TYPE_LEN_MAX in definition.
595         (enum fmt_parse_flags) Removed.
596
597 Mon Jul 17 18:26:21 WST 2006 John Darrington <john@darrington.wattle.id.au>
598
599         * casefile.c casefile.h: Converted to  an abstract base class.
600         * casefile-private.h fastfile.c fastfile.h: New files.
601         * automake.mk procedure.c scratch-writer.c storage-stream.c
602
603 Wed Jul 12 21:02:26 2006  Ben Pfaff  <blp@gnu.org>
604
605         * procedure.c (internal_procedure): Create sink_case with only as
606         many values as the compacted dictionary.
607
608 Wed Jul 12 21:01:00 2006  Ben Pfaff  <blp@gnu.org>
609
610         Remove "debugging" code that caused plenty of false positives and
611         no true positives.
612         
613         * case.h (struct ccase): [DEBUGGING] Remove `this' member.
614
615         * case.c: Remove all references to `this' member.
616
617 Thu Jul  6 19:09:53 2006  Ben Pfaff  <blp@gnu.org>
618
619         Fix link error noted by Jason Stover.
620         
621         * storage-stream.c: Include <assert.h>.
622
623 Tue Jul  4 08:47:35 2006  Ben Pfaff  <blp@gnu.org>
624
625         Fix bug #15766 (/KEEP subcommand on SAVE doesn't fully support
626         ALL) and additional underlying system file issues.
627
628         Thanks to John Darrington for review.
629
630         First problem: var_hash points to variables not owned by the
631         sys-file-reader, which the caller may free or modify.  Use an
632         array of sfm_vars instead, as done earlier (e.g. CVS version
633         1.12).
634         
635         * sys-file-reader.c (struct sfm_reader): Remove var_hash, svars
636         members and remove all code that references it.  Add vars, var_cnt
637         members.  Remove fix_specials member, which was unused.
638         (struct sfm_var) Remove name member, which was unused.
639         (sfm_close_reader) Free vars member instead of var_hash.
640         (compare_var_shortnames) Removed.
641         (hash_var_shortname) Removed.
642         (sfm_open_reader) Fill out vars array.
643         (compare_var_index) Removed.
644         (sfm_read_case) Use vars instead of var_hash.
645         
646         Second problem: we're confused about when we actually have very
647         long strings, causing us to choose incorrectly between slow path
648         and fast path in sfm_read_case.
649
650         * sys-file-reader.c: (sfm_open_reader) Only mark has_vls if we
651         have very long strings, not when we have long variable names,
652         which is an unrelated feature.
653
654 Tue Jun 27 12:06:49 2006  Ben Pfaff  <blp@gnu.org>
655
656         * variable.h: Move var_set and variable parsing declarations to
657         new header, src/language/lexer/variable-parser.h.  Modified lots
658         of files to include the new header.
659
660 Sun Jun 25 22:39:32 2006  Ben Pfaff  <blp@gnu.org>
661
662         * value-labels.c (value_to_string): When there's no value label,
663         format the variable according to its print format, instead of
664         always effectively using A or F format.
665
666 Mon Jun 19 18:05:42 WST 2006 John Darrington <john@darrington.wattle.id.au>
667
668         * casefile.c (casefile_get_random_reader): Nasty hack to get around 
669         the mode assertion.
670
671         * format.c: Removed tortological assertion.
672
673 Fri Jun  9 12:20:09 2006  Ben Pfaff  <blp@gnu.org>
674
675         Reform string library.
676         
677         * file-name.c (fn_interp_vars): Change interface to take a
678         substring as input.  Updated all users.
679         
680 Fri Jun  9 12:11:24 2006  Ben Pfaff  <blp@gnu.org>
681
682         * format.c (measure_is_valid): Really return false when m >=
683         n_MEASURES.
684
685 Tue Jun  6 18:46:26 2006  Ben Pfaff  <blp@gnu.org>
686
687         Implement random access to casefiles, for use in GUI.
688         
689         * casefile.c: (struct casereader) Add `random', `file_ofs',
690         `buffer_ofs' members.
691         (casefile_get_random_reader) New function.
692         (read_open_file) Break part into new function
693         seek_and_fill_buffer().
694         (fill_buffer) Update buffer_ofs, file_ofs.
695         (casereader_seek) New function.
696
697 Tue May 30 19:52:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
698
699         * settings.c: Added call to i18n{done, init}.
700
701 Tue May  9 21:09:17 2006  Ben Pfaff  <blp@gnu.org>
702
703         * procedure.h: Add WARN_UNUSED_RESULT to procedure function
704         prototypes.
705
706 Tue May  9 21:08:05 2006  Ben Pfaff  <blp@gnu.org>
707
708         * casefile.c: Convert many uses of `int' to `bool'.
709
710 Sat May  6 22:49:43 2006  Ben Pfaff  <blp@gnu.org>
711
712         * transformations.c (trns_chain_destroy): Destroy chain's trns
713         member, to fix memory leak.
714
715 Sat May  6 22:48:30 2006  Ben Pfaff  <blp@gnu.org>
716
717         * storage-stream.c (storage_source_decapsulate): Destroy case
718         source to fix memory leak.
719
720 Sat May  6 22:46:47 2006  Ben Pfaff  <blp@gnu.org>
721
722         * scratch-reader.c (scratch_reader_read_case): Copy into existing
723         case passed as argument instead of initializing the argument as a
724         case.  Fixes memory leak that showed up in
725         tests/command/aggregate.sh with scratch files.
726
727 Sat May  6 22:45:55 2006  Ben Pfaff  <blp@gnu.org>
728
729         * procedure.c (proc_done): Destroy default_dict, to fix memory
730         leak.
731
732 Sat May  6 22:44:44 2006  Ben Pfaff  <blp@gnu.org>
733
734         Simplify procedure_with_splits().
735         
736         * procedure.c (struct split_aux_data): Removed case_count member.
737         (procedure_with_splits) Don't initialize case_count.
738         (split_procedure_case_func) Check whether prev_case is null
739         instead of case_count.
740         (split_procedure_end_func) Ditto.
741
742 Sat May  6 22:42:23 2006  Ben Pfaff  <blp@gnu.org>
743
744         * case.c (case_move): Do nothing if dst and src are the same
745         object.
746         (case_try_create) Merge two similar cases.
747         (case_copy) Unshare only if data must be actually copied.
748
749 Sun May  7 10:04:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
750
751         * data-in.c data-out.c dictionary.c sys-file-reader.c
752         sys-file-writer.c variable.c variable.h:  Reworked very long string
753         support for better encapsulation.
754
755 Sat May  6 19:02:00 2006  Ben Pfaff  <blp@gnu.org>
756
757         * value-labels.c (val_labs_can_set_width): New function.
758         (val_labs_set_width) Clear labels if increasing width to long
759         string.
760         (val_labs_destroy) Remove unneeded test for null.
761         
762 Sat May  6 16:14:08 2006  Ben Pfaff  <blp@gnu.org>
763
764         * value-labels.h: Remove unneeded dependency on variable.h.
765
766 Sat May  6 15:58:36 2006  Ben Pfaff  <blp@gnu.org>
767
768         Get rid of `char *c' member in union value, for cleanliness.
769         
770         * value.h: (union value) Remove `c' member.
771
772 Sat May  6 15:36:59 2006  Ben Pfaff  <blp@gnu.org>
773
774         Make dictionary compacting functions a little more general.
775         
776         * sys-file-writer.c (sfm_open_writer): Use
777         dict_compacting_would_change().
778         (does_dict_need_translation) Removed.
779
780 Sat May  6 15:35:42 2006  Ben Pfaff  <blp@gnu.org>
781
782         Make dictionary compacting functions a little more general.
783         
784         * dictionary.c (dict_needs_compaction): Rename
785         dict_compacting_would_shrink().  Update all callers.
786         (dict_compacting_would_change) New function.
787         
788 Sat May  6 14:25:49 2006  Ben Pfaff  <blp@gnu.org>
789
790         * sys-file-writer.c: (does_dict_need_translation) Fix bug:
791         inverted return value (!).
792
793 Sat May  6 13:37:52 2006  Ben Pfaff  <blp@gnu.org>
794
795         Continue reforming procedure execution.  
796
797         * procedure.c: Search and replace "vfm" by "proc".  Notably:
798         (static var vfm_source) Rename proc_source.  Update all
799         references.
800         (static var vfm_sink) Rename proc_sink.  Update all references.
801         
802 Sat May  6 12:38:55 2006  Ben Pfaff  <blp@gnu.org>
803
804         Continue reforming procedure execution.  In this phase, remove
805         PROCESS IF, which was deprecated anyway and can be easily
806         simulated with TEMPORARY followed by SELECT IF.
807
808         * procedure.c: (open_active_file) Don't call
809         add_process_if_trns().
810         (discard_variables) Get rid of redundant call to
811         proc_cancel_all_transformations().
812         (add_process_if_trns) Removed.
813         (process_if_trns_proc) Removed.
814         (process_if_trns_free) Removed.
815
816 Sat May  6 10:58:05 2006  Ben Pfaff  <blp@gnu.org>
817
818         Continue reforming procedure execution.  In this phase, add
819         `const' to the case passed to procedure()'s callback.
820
821         Updated all users of procedure() as well.
822         
823         * procedure.c: (struct write_case_data) Add "const" to ccase
824         parameter for case_func member.
825         (procedure) Add "const" to ccase parameter for proc_func
826         parameter.
827         (multipass_case_func) Make ccase parameter const.
828         (internal_procedure) Add "const" to ccase parameter for case_func
829         parameter.
830         (split_procedure_case_func) Make ccase parameter const.
831         (multipass_split_case_func) Make ccase parameter const.
832         
833 Sat May  6 10:30:33 2006  Ben Pfaff  <blp@gnu.org>
834
835         Continue reforming procedure execution.  In this phase, get rid of
836         the output code for SPLIT FILE groups in procedure.c, which really
837         shouldn't be doing any output.  Move it into the individual
838         procedures instead.  This also adds some flexibility.
839
840         Updated many users of procedure_with_splits() and
841         multipass_procedure_with_splits() to call
842         output_split_file_values() and to deal with increased use of
843         const.
844
845         * procedure.c: (struct split_aux_data) Add "const struct ccase *"
846         parameter to begin_func member.
847         (procedure_with_splits) Add "const struct ccase *" parameter to
848         begin_func parameter.  Make ccase parameter const in proc_func
849         parameter.
850         (split_procedure_case_func) Don't dump split file group.  Pass
851         case to begin_func.
852         (dump_splits) Moved to language/dictionary/split-file.c as
853         output_split_file_values().
854         (struct multipass_split_aux_data) Add "const struct ccase *"
855         parameter to split_func member.
856         (multipass_procedure_with_splits) Add "const struct ccase *"
857         parameter to split_func parameter.
858         (multipass_split_case_func) Save new SPLIT FILE case before
859         outputting case.
860         (multipass_split_output) Pass saved SPLIT FILE case to split_func.
861         
862 Fri May  5 22:48:50 2006  Ben Pfaff  <blp@gnu.org>
863
864         Continue reforming procedure execution.  Change
865         internal_procedure() so that it calls open_active_file() and
866         close_active_file(), which isolates most of the actual procedure
867         functionality.
868
869         * procedure.c: (struct write_case_data) Rename `proc_func' member
870         to `case_func' and update all references.
871         (procedure) Rewrite as one-line wrapper around
872         internal_procedure().
873         (struct multipass_aux_data) New.
874         (multipass_callback) Renamed multipass_case_func().  Use struct
875         multipass_aux_data as auxiliary data.
876         (multipass_end_func) New function.
877         (multipass_procedure) Rewrite as wrapper for internal_procedure()
878         that uses multipass_case_func, multipass_end_func.
879         (internal_procedure) Add `end_func' argument.  Move optimization
880         of trivial case in here.  Move call to open_active_file() and
881         close_active_file() in here.  Now assert that vfm_source is
882         non-null.
883         (procedure_with_splits_callback) Rename
884         split_procedure_case_func().
885         (split_procedure_end_func) New function.
886         (multipass_split_callback) Rename multipass_split_case_func.
887         (multipass_split_end_func) New function.
888         (discard_variables) No need to test for nonnull vfm_source.
889
890 Fri May  5 21:34:02 2006  Ben Pfaff  <blp@gnu.org>
891
892         Continue reforming procedure execution.  Get rid of unused member.
893
894         * procedure.c: (struct write_case_data) Remove `cases_analyzed'
895         member.
896         (write_case) Don't increment cases_analyzed.
897
898 Thu May  4 21:50:11 2006  Ben Pfaff  <blp@gnu.org>
899
900         Continue reforming procedure execution.  In this phase, move
901         procedure.c and procedure.h from src to src/data.  Update
902         makefiles and #includes accordingly.
903
904         * procedure.c: Moved here from src/.
905
906         * procedure.h: Moved here from src/.
907
908 Wed May  3 22:42:12 2006  Ben Pfaff  <blp@gnu.org>
909
910         Continue reforming procedure execution.  In this phase, get rid of
911         many global variables, consolidating procedure execution in
912         procedure.c.  Encapsulate transformations in new "struct
913         trns_chain".  Also, change implementation of N OF CASES, FILTER,
914         and PROCESS IF from special cases to transformations.
915          
916         * automake.mk: (src_data_libdata_a_SOURCES) Add transformations.c,
917         transformations.h.
918
919         * dictionary.c: (global variable default_dict) Move to
920         src/procedure.c.
921
922         * variable.h: (TRNS_*) Move to transformations.h.
923         (struct transformation) Move to transformations.c.
924
925 Thu May  4 13:47:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
926
927         * sys-file-reader.c: Fixed invalid read problems.
928
929 Tue May  2 15:57:10 2006  Ben Pfaff  <blp@gnu.org>
930
931         * storage-stream.c: Add missing function comments.
932
933 Tue May  2 15:50:21 2006  Ben Pfaff  <blp@gnu.org>
934
935         Continue reforming procedure execution.  In this phase, add some
936         new, needed functionality to storage-stream.
937
938         * storage-stream.c: (storage_source_decapsulate) New function.
939
940 Tue May  2 15:43:36 2006  Ben Pfaff  <blp@gnu.org>
941
942         * variable.c (width_to_bytes): Declarations must precede
943         statements for C90 compliance.
944
945 Tue May  2 10:42:05 WST 2006 John Darrington <john@darrington.wattle.id.au>
946
947         * data-out.c, data-in.c, variable.c, variable.h: New functions 
948         copy_mangle and copy_demangle for reading/writing cases; emulates the 
949         way SPSS deals with strings > 255 bytes.
950
951         * sys-file-reader.c sys-file-writer.c: Added support for Record 7, 
952         subtype 14 needed for strings longer than 255 bytes.
953
954         * dictionary.c, format.def, value.c : Updated to use MAX_STRING 
955         instead of literal values. Also fixed some constness issues.
956
957         * format.h: Constness
958
959         * sfm-private.h: Renamed the case_size identifier, since I discovered 
960         that SPSS's respect for this variable is very nominal.
961
962 Mon May  1 15:45:42 2006  Ben Pfaff  <blp@gnu.org>
963
964         Change case limit type from int to size_t.
965
966         * dictionary.c: (struct dictionary) Change type of case_limit
967         member.
968         (dict_get_case_limit) Change return type.
969         (dict_set_case_limit) Change parameter type.
970
971 Wed Apr 26 20:01:19 2006  Ben Pfaff  <blp@gnu.org>
972
973         * variable.h: (struct variable) Rename `reinit' member as `leave'
974         and invert sense.  Fix up all references.
975
976 Wed Apr 26 19:39:28 2006  Ben Pfaff  <blp@gnu.org>
977
978         Continue reforming procedure execution.  In this phase, break
979         procedure.c into multiple files.
980         
981         * automake.mk: (src_data_libdata_a_SOURCES) Add all the new files.
982
983         * case-sink.c: New file.
984
985         * case-sink.h: New file.
986         
987         * case-source.c: New file.
988
989         * case-source.h: New file.
990         
991         * storage-stream.c: New file.
992
993         * storage-stream.h: New file.
994
995 Wed Apr 26 14:55:19 2006  Ben Pfaff  <blp@gnu.org>
996
997         * variable.h: (struct variable) Remove `init' member and all
998         references to it from other files.  It was initialized in several
999         places, but nothing really ever used it for anything worthwhile.
1000         Thanks to Jason Stover for pointing out how confusing this
1001         member is.
1002
1003 Sun Apr 23 22:04:45 2006  Ben Pfaff  <blp@gnu.org>
1004
1005         Continue reforming error message support.  In this phase, get rid
1006         of message "titles" and put the message text in `struct error'.
1007         Now `struct error' encapsulates a message more properly.
1008         
1009         * casefile.c: (io_error) Use err_msg() instead of err_vmsg().
1010         Format message ourselves.
1011
1012         * data-in.c: (vdls_error) Ditto.
1013
1014         * por-file-reader.c: (error) Ditto.
1015
1016         * sys-file-reader.c: (corrupt_msg) Ditto.
1017
1018 Sun Apr 16 18:49:51 2006  Ben Pfaff  <blp@gnu.org>
1019
1020         GNU standards require "file name" instead of "filename" in
1021         documentation.  It's nice for our code to follow the convention
1022         too.
1023         
1024         * casefile.c: (struct casefile) Rename `filename' member to
1025         `file_name'.  Updated all references.
1026
1027         * file-name.c: [!unix] (struct file_identity) Rename
1028         normalized_filename member to normalized_file_name.  Updated all
1029         references.
1030
1031 Sun Apr 16 18:35:33 2006  Ben Pfaff  <blp@gnu.org>
1032
1033         We don't really support anything but Unix-like environments well,
1034         so we might as well de-obfuscate by writing directory and path
1035         separators explicitly.
1036
1037         * file-name.h: (macro DIR_SEPARATOR) Removed.  Changed all usages
1038         to just '/'.
1039         (macro PATH_SEPARATOR) Removed.  Changed all usages to just ':'.
1040         (macro DIR_SEPARATOR_STRING) Removed.  Changed all usages to just
1041         "/".
1042         (macro PATH_SEPARATOR_STRING) Removed.  Changed all usages to just
1043         ":"
1044
1045 Sun Apr 16 18:28:35 2006  Ben Pfaff  <blp@gnu.org>
1046
1047         GNU standards require "file name" instead of "filename" in
1048         documentation.  It's nice for our code to follow the convention
1049         too.
1050         
1051         * filename.c: Rename to file-name.c.
1052
1053         * filename.h: Rename to file-name.h.  Update all inclusions.
1054         Update header guards.
1055
1056         * automake.mk: Update file names.
1057
1058 Sun Apr 16 16:42:47 2006  Ben Pfaff  <blp@gnu.org>
1059
1060         * filename.c: (fn_dirname) Renamed fn_dir_name(), all references
1061         updated.
1062         (fn_basename) Removed (dead code).
1063         (fn_absolute_p) Renamed fn_is_absolute(), all references updated.
1064         (fn_special_p) Renamed fn_is_special(), all references updated.
1065         (fn_exists_p) Renamed fn_exists(), all references updated.
1066
1067 Sun Apr 16 16:33:58 2006  Ben Pfaff  <blp@gnu.org>
1068
1069         * filename.c: (fn_tilde_expand) Rewrite for cleaner code.  
1070         Also, now it only tilde-expands file names, not paths.
1071         (fn_search_path) Tilde-expand one directory at a time.
1072
1073 Sun Apr 16 16:28:06 2006  Ben Pfaff  <blp@gnu.org>
1074
1075         * filename.c: (fn_search_path) rewrite for cleaner code.  Also,
1076         get rid of non-Unixlike version of the code, which has probably
1077         never been tested.
1078         (fn_prepend_dir) Removed (dead code).
1079
1080         * filename.h: (macro DIR_SEPARATOR_STRING) New.
1081         (macro PATH_SEPARATOR_STRING) New.
1082 Sun Apr 16 16:05:28 2006  Ben Pfaff  <blp@gnu.org>
1083
1084         Continue reforming error message support.  In this phase, we get
1085         rid of VM() and the other msg() support for "verbosity", replacing
1086         it by a new function verbose_msg().
1087
1088         * filename.c: (fn_search_path) Use verbose_msg() instead of
1089         msg(VM(), ...).  
1090
1091 Sat Apr 15 19:53:19 2006  Ben Pfaff  <blp@gnu.org>
1092
1093         * sfm-private.h: Get rid of #defines after #error, which makes no
1094         sense.
1095
1096 Sat Apr 15 19:48:57 2006  Ben Pfaff  <blp@gnu.org>
1097
1098         Get rid of our own int32 type in favor of the standard int32_t
1099         type.
1100         
1101         * sfm-private.h: (int32 macro) Don't define this anymore.  Do
1102         include <stdint.h>.
1103
1104         * sys-file-reader.c: Use int32_t instead of int32 throughout.
1105         
1106         * sys-file-writer.c: Use int32_t instead of int32 throughout.
1107
1108 Sat Apr 15 19:36:47 2006  Ben Pfaff  <blp@gnu.org>
1109
1110         Remove ill-considered file routines that are no longer used.
1111         
1112         * filename.c: (fn_open_ext) Removed.
1113         (fn_close_ext) Removed.
1114
1115         * filename.h: (struct file_ext) Removed.
1116
1117 Mon Apr  3 13:22:39 2006  Ben Pfaff  <blp@gnu.org>
1118
1119         * variable.c (var_is_valid_name): Move declarations before code
1120         for C90 compliance.
1121
1122 Tue Apr  4 15:28:40 WST 2006 John Darrington <john@darrington.wattle.id.au>
1123
1124         * filename.ch (fn_interp_vars): Fixed small buglet.
1125
1126 Tue Mar 28 13:47:16 WST 2006 John Darrington <john@darrington.wattle.id.au>
1127         
1128         * filename.[ch] (fn_interp_vars): Changed the signature and semantics
1129         so as to modify the string inline.   Thus makeing it easier to
1130         destroy the results when no longer needed.
1131         
1132 2006-03-25  Jason Stover  <jhs@math.gcsu.edu>
1133
1134         * category.c (cat_stored_values_destroy): Fixed memory leak.
1135
1136 Fri Mar 24 18:15:41 2006  Ben Pfaff  <blp@gnu.org>
1137
1138         Add some missing frees.  Thanks to John Darrington for reporting
1139         these.
1140
1141         * any-writer.c (any_writer_close): Free writer.
1142
1143         * any-reader.c (any_reader_close): Free reader.
1144
1145 Mon Mar 20 16:33:53 2006  Ben Pfaff  <blp@gnu.org>
1146
1147         * por-file-reader.c: (error) Mark as NO_RETURN.
1148
1149 Sat Mar 11 15:06:07 WST 2006 John Darrington <john@darrington.wattle.id.au>
1150
1151         * settings.c: Changed default value of scompress to true.
1152
1153 Sat Mar  4 13:22:51 2006  Ben Pfaff  <blp@gnu.org>
1154
1155         * sfm-private.h: Include variable.h, to get SHORT_NAME_LEN.
1156
1157         * value.h: Remove check on MAX_SHORT_STRING, which I don't think
1158         really applies.
1159
1160         * variable.h: Move definition of SHORT_NAME_LEN, LONG_NAME_LEN
1161         here from pref.h.orig.
1162
1163 Sat Mar  4 12:50:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
1164
1165         * sys-file-reader.c: Fixed bug reading compressed files.
1166
1167 Thu Mar  2 08:40:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
1168
1169         * Numerous renames.  See src/ChangeLog for details.
1170         
1171         * Moved files from src directory