Handle variable display parameters record with only 2 data items per
[pspp-builds.git] / src / data / ChangeLog
1 2007-12-06  Ben Pfaff  <blp@gnu.org>
2
3         Patch #6303.
4
5         * sys-file-reader.c (read_display_parameters): Handle variable
6         display parameters record with only 2 data items per variable.
7         Reported by Guido Gay <gay@irer.it>.
8
9 2007-12-04  Ben Pfaff  <blp@gnu.org>
10
11         * identifier.c (lex_id_match_n): New function.
12         (lex_id_match): Reimplement in terms of lex_id_match_n.
13
14 2007-11-24  Ben Pfaff  <blp@gnu.org>
15
16         * automake.mk (src_data_libdata_a_SOURCES): Add val-type.h, to fix
17         make distcheck.
18
19 2007-11-24  Ben Pfaff  <blp@gnu.org>
20
21         Fix warning reported when reading back system files that include
22         very long string variables.  Thanks to Guido Gay <gay@irer.it> for
23         reporting this bug.
24
25         * short-names.c (short_names_assign): Fix dumb typo, in which `i'
26         was written where `j' was meant.
27
28 2007-11-18  Ben Pfaff  <blp@gnu.org>
29
30         Properly write variables that include a range of missing values to
31         system files.  Thanks to Guido Gay <gay@irer.it> for reporting
32         this bug.
33
34         * sys-file-writer.c (write_variable): Correctly calculate
35         n_missing_values field when writing variables that include a range
36         of missing values.
37
38 2007-11-10  Ben Pfaff  <blp@gnu.org>
39
40         Cleanups and bug fixes devised while writing up documentation.
41         Patch #6262.
42
43         * automake.mk (src_data_libdata_a_SOURCES): Add new files.
44
45         * dict-class.c: New file.
46         (dict_class_from_id): Move here.
47         (dict_class_to_name): Move here.
48
49         * dict-class.h: New file.
50         (enum dict_class): Move here.  Change from consecutive integers to
51         consecutive bits, to make testing for any of multiple values
52         easier.  Add new DC_ALL constant.
53
54         * dictionary.c (struct dictionary): Change `case_limit' from
55         size_t to casenumber.
56         (dict_get_vars): Make final argument an enum dict_class.
57         (dict_get_vars_mutable): Ditto.
58         (dict_get_case_limit): Change return value to casenumber.
59         (dict_set_case_limit): Change final argument to a casenumber.
60         (dict_unset_split_var): Add assertion.  Rephrase slightly.
61         (dict_set_label): Use xstrndup to simplify.
62
63         * format.c (fmt_step_width): AHEX format also needs 2-byte
64         stepping.
65         (fmt_set_style): Simplify assertions.
66
67         * missing-values.c (mv_add_num_range): Rename mv_add_range.
68         Simplify implementation.
69         (mv_has_value): Simplify implementation.
70         (mv_pop_value): Remove the first value, not the last, to avoid
71         having GET followed by SAVE reverse the order of missing values.
72         (mv_peek_value): Rename mv_get_value.  Simplify assertion.
73         (mv_has_range): Simplify implementation.
74         (mv_peek_range): Rename mv_get_range.
75         (can_resize_string): Removed.
76         (mv_is_resizable): Use value_is_resizable.
77         (mv_resize): Use value_resize.
78
79         * short-names.h (SHORT_NAME_LEN): Move here.
80
81         * val-type.h: New file, for definitions related to type and width
82         of abstract values.  Before, these definitions were mixed among
83         those related to "union value" and those related to variables.
84         (macro SYSMIS): Move here.
85         (macro LOWEST): Move here.
86         (macro HIGHEST): Move here.
87         (macro MAX_STRING); Move here.
88         (enum val_type): New enum with values VAL_NUMERIC and VAL_STRING.
89         Replaces enum var_type that had values VAR_NUMERIC and VAR_STRING.
90         All references updated.
91         (val_type_is_valid): New function.  Replaces var_type_is_valid.
92         All references updated.
93         (val_type_from_width): New function.  Replaces
94         var_type_from_width.  All references updated.
95
96         * value-labels.c (val_labs_copy): Renamed val_labs_clone.  All
97         references updated.
98         (val_labs_can_set_width): Use value_is_resizable.
99         (val_labs_add): Simply return false if the value labels set is too
100         wide, instead of having undefined behavior.
101         (val_labs_replace): Ditto.
102         (val_labs_replace): Ditto.
103         (val_labs_first): Set iterator to null if iteration is complete.
104         (val_labs_first_sorted): Ditto.
105         (val_labs_done): Become a no-op if the iterator is null.
106
107         * value.c (value_is_resizable): New function.
108         (value_resize): New function.
109
110         * variable.c (var_get_dict_class): New function.
111
112         * variable.h (macro LONG_NAME_LEN): Rename VAR_NAME_LEN.  Update
113         all references.
114
115 2007-11-08  Ben Pfaff  <blp@gnu.org>
116
117         * data-in.c: Make formatted data parsing locale-independent.
118         (parse_number): Use c_strtod instead of strtod, to avoid
119         locale-specific behavior.
120         (parse_Z): Ditto.
121
122 2007-11-06  Ben Pfaff  <blp@gnu.org>
123
124         Patch #6256: add support for binary, 360 file formats.  Reviewed
125         by John Darrington.
126
127         * data-in.c (struct data_in): Add `encoding' member.
128         (data_in): Add `encoding' parameter, and re-encode the data passed
129         in where appropriate.  Update all callers to pass it in.
130         (parse_A): Implement EBCDIC recoding wart described in manual.
131         (parse_AHEX): Implement EBCDIC recoding.
132
133         * data-out.c (data_out_legacy): New function.
134         (data_out): Make into a wrapper around data_out_legacy.
135
136         * file-handle-def.c (struct file_handle): New member `encoding'.
137         (fh_create_file): Set encoding.
138         (fh_default_properties): Set default encoding.
139         (fh_get_legacy_encoding): New function.
140
141         * file-handle-def.h (enum fh_mode): New modes FH_MODE_FIXED
142         (that replaces FH_MODE_BINARY), FH_MODE_VARIABLE,
143         FH_MODE_360_VARIABLE, FH_MODE_360_SPANNED.
144         (struct fh_properties): New member `encoding'.
145
146 2007-11-05  Ben Pfaff  <blp@gnu.org>
147
148         Patch #6258.  Reviewed by John Darrington.
149
150         * file-handle-def.c (fh_lock): Add comment that TYPE should be
151         marked with N_() in the caller.  Added these markings to each
152         caller too.  Should make i18n easier.
153         Suggested by Chusslove Illich <caslav.ilic@gmx.net>.
154
155 2007-11-03  Ben Pfaff  <blp@gnu.org>
156
157         Allow output files to overwrite input files (bug #21280).
158
159         * file-handle-def.c: Separate locking of files for input and for
160         output, to allow both to take place at once.  Also, distinguish a
161         file handle from the identity of the underlying file, because the
162         identity of a file changes over time and the file handle can't
163         represent two different identities.
164         (struct file_handle): Remove `next', `open_cnt', `deleted',
165         `type', `open_mode', `aux', `identity' members.  Change `id' from
166         char array to char *.  Add `ref_cnt' member.
167         (file_handle_from_ll) New function.
168         (file_handles) Removed.
169         (named_handles) New variable.
170         (fh_init) Initialize named_handles.
171         (fh_done) Remove name from all named_handles.
172         (free_handle) Updated for modified struct file_handle.
173         (unname_handle) New function.
174         (fh_ref) New function.
175         (fh_from_file_name) Removed.
176         (fh_unref) New function.
177         (fh_unname) New function.
178         (fh_from_id) Rewritten.
179         (create_handle) Updated for modified struct file_handle.
180         (fh_inline_file) Increment the handle's ref count.
181         (fh_create_file) Updated for modified struct file_handle.
182         (fh_create_scratch) Ditto.
183         (fh_free) Removed.
184         (mode_name) Removed.
185         (fh_open) Removed.
186         (fh_close) Removed.
187         (fh_is_open) Removed.
188         (fh_get_id) Updated for modified struct file_handle.
189         (fh_get_default_handle) Increment the handle's ref count.
190         (fh_set_default_handle) Handle ref counts.
191         (struct fh_lock) New structure.
192         (locks) New static var.
193         (fh_lock) New function.
194         (fh_unlock) New function.
195         (fh_lock_get_aux) New function.
196         (fh_lock_set_aux) New function.
197         (fh_is_locked) New function.
198         (make_key) New function.
199         (free_key) New function.
200         (compare_fh_locks) New function.
201         (hash_fh_lock) New function.
202
203         * file-handle-def.h (enum fh_access) New enum.
204
205         * file-name.c: Made file_identity the same in all supported
206         environments.
207         (struct file_identity): New `name' member.
208         (fn_get_identity): For a file that doesn't exist, get the
209         dev/inode of its directory plus its name.  If even the directory
210         doesn't exist, just use its name.  Merge the Windows
211         implementation into the Unix one.
212         (fn_compare_file_identities): Rewritten.  Merge the Windows
213         implementation into the Unix one.
214         (fn_hash_identity): New function.
215
216         * make-file.c (struct replace_file): New structure.
217         (all_files): New static var.
218         (replace_file_start): New function.
219         (replace_file_commit): New function.
220         (replace_file_abort): New function.
221         (free_replace_file): New function.
222         (unlink_replace_files): New function.
223
224         * por-file-reader.c (struct pfm_reader): Add `lock' member.
225         (close_reader): Unlock file.
226         (pfm_open_reader): Lock file.
227
228         * por-file-writer.c (struct pfm_writer): Add fh_lock, replace_file
229         members.
230         (pfm_open_writer): Lock file and prepare for its replacement.
231         (close_writer): Unlock file.
232
233         * scratch-handle.h (struct scratch_handle): Add unique_id so that
234         different generations of a scratch file can be distinguished.
235
236         * scratch-reader.c (scratch_reader_open): Verify that the file is
237         a scratch file.
238
239         * scratch-writer.c (struct scratch_writer): Add `lock' and `dict',
240         remove scratch_handle member.
241         (scratch_writer_open): Lock handle.  Prepare to replace handle
242         data, instead of doing it immediately.
243         (scratch_writer_casewriter_destroy): Replace handle data and
244         unlock handle.
245
246         * sys-file-reader.c (struct sfm_reader): Add `lock' member.
247         (sfm_open_reader): Lock file.
248         (close_reader): Unlock file.
249
250         * sys-file-writer.c (struct sfm_writer): Add fh_lock, replace_file
251         members.
252         (sfm_open_writer): Lock file and prepare for its replacement.
253         (close_writer): Unlock file.
254
255 2007-11-02  Ben Pfaff  <blp@gnu.org>
256
257         * data-out.c (output_number): Use isfinite (from C99) instead of
258         gsl_isfinite, since we now have universal support for it in
259         gnulib.
260         (output_infinite): Ditto.
261         [!HAVE_ROUND] (round): Remove definition, since we now have a
262         replacement in gnulib.
263
264 2007-10-27  John Darrington <john@darrington.wattle.id.au>
265
266         * dictionary.c: Fixed bug in dict_clone, where the vardict.dict member
267         wasn't initialised correctly. Closes bugs #21330 and 21397
268
269
270 2007-10-08  Ben Pfaff  <blp@gnu.org>
271
272         Fix bug #21280.  Thanks to John Darrington for review.
273
274         * file-name.c (create_stream): New function.
275
276         * por-file-writer.c (pfm_open_writer): Use fh_open to open the
277         file handle before creating the file, to ensure that we don't
278         truncate a file that we're reading.  Make code easier to read by
279         using create_stream.
280
281         * sys-file-write.c (sfm_open_writer): Ditto.
282
283 2007-10-01  Ben Pfaff  <blp@gnu.org>
284
285         Fix bug #21192.  Thanks to John Darrington for review.
286
287         * casereader.c (casereader_read): Decrement case_cnt before
288         calling the casereader's "read" member function, so that we
289         interact properly with lazy_casereader.
290
291         * datasheet.c: Add regression test for above bug fix.
292         (clone_datasheet): New function.
293         (lazy_callback): New function.
294         (check_datasheet_casereader): New function.
295         (check_datasheet): Check datasheet contents are reported correctly
296         through an ordinary casereader and a lazy casereader.
297         (clone_model): Use clone_datasheet.
298
299 2007-09-24  Ben Pfaff  <blp@gnu.org>
300
301         Patch #6210.  Reviewed by John Darrington.
302         * settings.c: Drop "long view", which is not needed any longer.
303         (static var long_view): Removed.
304         (force_long_view): Removed.
305         (get_viewwidth): Removed.
306         (init_viewport): Removed long_view reference.
307
308 2007-09-19  John Darrington <john@darrington.wattle.id.au>
309         
310         * settings.c settings.h: Changed viewport's length and width to be 
311         owned by the user interface which uses the data library.  This allows
312         better abstraction, and makes dynamically adjustable dimensions easier.
313         
314 2007-09-18  Ben Pfaff  <blp@gnu.org>
315
316         * procedure.c (proc_extract_active_file_data): New function.
317
318         * lazy-casereader.h: New file.
319
320         * lazy-casereader.c: New file.
321
322         * casereader.c (casereader_dynamic_cast): New function.
323
324 2007-09-14  Ben Pfaff  <blp@gnu.org>
325
326         * dictionary.c (dict_clone): Copy case indexes from cloned
327         dictionary.  Fixes bug #21061.  Reviewed by John Darrington.
328
329 2007-09-13  John Darrington <john@darrington.wattle.id.au>
330
331         * value.c value.h (create_value): New function.
332
333 2007-09-12  Ben Pfaff  <blp@gnu.org>
334
335         Make it clear that translator casereader and casewriter translate
336         functions are supposed to destroy their input case.
337         
338         * casereader-translator.c (struct casereader_translator): Change
339         input case parameter of translate member function from const
340         struct ccase * to struct ccase *.
341         (casereader_create_translator): Ditto, for translate parameter.
342
343         * casewriter-translator.c (struct casewriter_translator): Ditto.
344         (casewriter_create_translator): Ditto.
345
346 2007-08-27  John Darrington <john@darrington.wattle.id.au>
347         
348         * sys-file-reader.c (read_display_parameters): Force display width 
349         to 8, if the sys file says 0 (like SPSS does).
350
351 2007-08-12  Ben Pfaff  <blp@gnu.org>
352
353         * dictionary.c (dict_dump): New function.
354
355 2007-08-12  Ben Pfaff  <blp@gnu.org>
356
357         Drop dict_compactor in favor of using the new struct case_map.
358
359         * dictionary.c (struct copy_map): Removed.
360         (struct dict_compactor): Removed.
361         (dict_make_compactor): Removed.
362         (dict_compactor_compact): Removed.
363         (dict_compactor_destroy): Removed.
364
365         * procedure.c (struct data_set): Change `compactor' member to be a
366         struct case_map *.
367         (proc_open): Use case_map_to_compact_dict instead of
368         dict_make_compactor.
369         (proc_casereader_read): Use case_map_execute instead of
370         dict_compactor_compact.
371         (proc_commit): Use case_map_destroy instead of
372         dict_compactor_destroy.
373
374         * scratch-writer.c (struct scratch_writer): Change `compactor'
375         member to be a struct case_map *.
376         (scratch_writer_open): Use case_map_to_compact_dict instead of
377         dict_make_compactor.
378         (scratch_writer_casewriter_write): Use case_map_execute instead of
379         dict_compactor_compact.
380
381 2007-08-12  Ben Pfaff  <blp@gnu.org>
382
383         * automake.mk: Add case-map.c, case-map.h.
384
385         * case-map.c: New file.
386
387         * case-map.h: New file.
388
389 2007-08-12  Ben Pfaff  <blp@gnu.org>
390
391         * dictionary.c (dict_compact_values): Don't delete scratch
392         variables as well as compacting case indexes.  Update all callers.
393         (dict_get_compacted_value_cnt): Rename dict_count_values and
394         change interface.  Update all callers.
395         (dict_get_compacted_value_cnt): Remove.
396         (dict_compacting_would_shrink): Remove.
397         (dict_compacting_would_change): Remove.
398         (dict_make_compactor): Add new parameter.  Update all callers.
399         
400         * procedure.c (proc_casereader_read): Use casewriter_get_value_cnt
401         instead of dict_count_values, changing an O(N) operation into
402         O(1).
403
404 2007-08-12  Ben Pfaff  <blp@gnu.org>
405
406         * casereader.c (casereader_read): Don't require cases read by a
407         casereader to be exactly the expected size: as long as they're big
408         enough, it's OK.
409
410 2007-08-12  Ben Pfaff  <blp@gnu.org>
411
412         Make casewriters keep track of the number of `union value's in
413         each case.  This is useful for two reasons: casewriter_write can
414         then check that the case being written is large enough, and later
415         recipients of the casewriter can determine the size of the case.
416         
417         * casewriter-translator.c (casewriter_create_translator): Add
418         value_cnt parameter.
419         
420         * casewriter.c (struct casewriter): Add value_cnt member.
421         (casewriter_write): Check that the case passed in is big enough.
422         (casewriter_get_value_cnt): New function.
423         (casewriter_create): Add value_cnt parameter.
424
425 2007-08-09  Ben Pfaff  <blp@gnu.org>
426
427         Fix bug reported by Jason Stover.
428         * settings.c: Move get_termcap_viewport and in particular the
429         #include for <curses.h> to the end of the file.  curses.h
430         redefines bool on some systems (e.g. OpenBSD), which causes
431         disagreement between uses of bool before its inclusion and
432         afterward.
433         Tested by Jason Stover.
434
435 2007-07-29  Ben Pfaff  <blp@gnu.org>
436
437         Provisional fix for bug #18692 and bug #20161.  Reviewed by John
438         Darrington.
439
440         * file-name.c (fn_open): Only pass "r" or "w" to popen as mode
441         argument (never "rb" or "wb") because SUSv3 says that only those
442         modes are defined, and glibc in fact rejects other modes.
443
444         Open portable files with fn_open so that they can be read from
445         pipes.  Fix missing fh_close call to go along with fh_open.
446         Report an error if the file close reports an error.
447         * por-file-reader.c (close_reader): New function.
448         (por_file_casereader_destroy): Use close_reader.
449         (pfm_open_reader): Open file with fn_open.
450
451 2007-07-28  Ben Pfaff  <blp@gnu.org>
452
453         Make PSPP able to read all the portable files I could find on the
454         web.  Thanks to John Darrington for review.  Bug #17620.
455         * por-file-reader.c (struct pfm_reader): New member `line_length'.
456         (error): Print file offset in hexadecimal.
457         (warning): New function.
458         (advance): Treat lines less than 80 bytes long as padded to 80
459         bytes with spaces.
460         (pfm_open_reader): Call read_documents if we find an "E" record.
461         (convert_format): Convert invalid formats to the default format
462         instead of aborting reading the file.
463         (read_variables): Rename duplicate variable names instead of
464         aborting reading the file.
465         (read_value_label): Allow string variables of different widths to
466         be assigned value labels in the same record.  Replace duplicate
467         value labels instead of aborting.
468         (read_documents): New function.
469
470         * por-file-writer.c (pfm_open_writer): Call write_documents if the
471         dictionary has documents.
472         (write_documents): New function.
473
474 2007-07-25  Ben Pfaff  <blp@gnu.org>
475
476         Fix bugs related to bug #17213.
477
478         * settings.c: Use HAVE_LIBNCURSES instead of HAVE_LIBTERMCAP,
479         since the former is what config.h has.  Include the needed ncurses
480         headers.
481         (static var echo) Rename to `do_echo' because the original name is
482         the same as an ncurses identifier.
483         (get_termcap_viewport) Use error instead of msg.
484
485         * file-name.c (fn_interp_vars): Fix interpolation of $VARS.
486         (fn_close): Don't close stdin, stdout, stderr.
487
488 2007-07-26 John Darrington <john@darrington.wattle.id.au>
489
490         * procedure.c procedure.h: Added callbacks which get invoked whenever 
491         a dataset's transformation chain changes.
492
493 2007-07-24  Ben Pfaff  <blp@gnu.org>
494
495         Fix bug #6113.
496         * sys-file-writer.c (write_variable_display_parameters): Use new
497         var_default_display_width function to choose display width of
498         segments after the first one in a given variable.
499         * variable.c (var_create): Use var_default_display_width to pick
500         new variable's display width.
501         (var_default_display_width): New function.
502         Reviewed by John Darrington.
503
504 2007-07-24  Ben Pfaff  <blp@gnu.org>
505
506         Fix bug #20427.
507         * por-file-writer.c (write_variables): Write weight variable.
508         Reviewed by John Darrington.
509
510 2007-07-23  Ben Pfaff  <blp@gnu.org>
511
512         Improvements to system file reader and writer.
513         
514         First, move all detailed knowledge of very long strings into
515         sys-file-private.[ch], so that this nasty stuff can be isolated.
516
517         * sys-file-private.c (REAL_VLS_CHUNK): New macro.
518         (EFFECTIVE_VLS_CHUNK): New macro.
519         (min_int): New function.
520         (max_int): New function.
521         (sfm_width_to_bytes): Rewrite.
522         (sfm_width_to_octs): New function.
523         (sfm_segment_alloc_width): New function.
524         (sfm_segment_alloc_bytes): New function.
525         (sfm_segment_used_bytes): New function.
526         (sfm_segment_offset): New function.
527         (sfm_segment_effective_offset): New function.
528         (sfm_dictionary_to_sfm_vars): New function.
529
530         * sys-file-private.h (MIN_VERY_LONG_STRING): Removed.
531         (EFFECTIVE_LONG_STRING_LENGTH): Removed.
532         (struct sfm_var): New structure.
533
534         Next, improvements to the system file reader.
535
536         * sys-file-reader.h (struct sfm_read_info): Changed `case_cnt' to
537         type casenumber.  Added `version_major', `version_minor',
538         `version_revision'.
539
540         * sys-file-reader.c (struct sfm_reader): Replaced `flt64_cnt' by
541         `oct_cnt'.  Rename `vars', `var_cnt' to `sfm_vars', `sfm_var_cnt'.
542         Change `case_cnt' to type casenumber.  Removed `has_vls'.
543         (struct sfm_var): Removed.
544         (sfm_open_reader): Don't warn on wrong case size if the file was
545         written by SPSS 13, which tends to get it wrong.  Use
546         sfm_dictionary_to_sfm_vars.
547         (read_header): Always output system file info.
548         (read_variable_record): Simplify code for reading missing values.
549         (read_machine_int32_info): Save version numbers from system file
550         into info struct passed as new argument.
551         (read_long_string_map): Restructured to use new sys-file-private
552         functions.
553         (read_value_labels): Use size_overflow_p.
554         (sys_file_casereader_read): Get rid of distinction between fast
555         and slow paths.  Use information provided by sys-file-primate's
556         struct sfm_var to simplify code.
557         (skip_whole_strings): New function.
558         (read_int32): Renamed read_int.  Changed return value to int.
559         Updated all callers.
560         (read_flt64): Renamed read_float.  Changed return value to
561         double.  Updated all callers.
562         (int32_to_native): Removed.  Changed callers to use
563         integer_convert.
564         (flt64_to_double): Removed.  Changed callers to use float_convert.
565         
566         Finally, get rid of int32, flt64 terminology and types in system
567         file writer.  The former wasn't very useful since a POSIX "int"
568         can hold the whole range of int32 and we generally didn't have a
569         need for it to be exactly-32-bits, just at-least-32-bits.  The
570         latter was inconvenient because we had to assume that it could be
571         different from double and thereby convert special values SYSMIS,
572         HIGHEST, LOWEST to and from it in multiple places.  Instead, now
573         we just use "int" and "double" in most places, and do conversions,
574         if necessary, very close to where we do I/O.  This change meant
575         that the writer code couldn't represent records in the file as C
576         structs any longer, but that's no great loss.  The code actually
577         seems to be more readable without them.
578
579         Simplify the compression buffering code: only buffer as much as
580         necessary, which is no more than eight 8-byte units at any given
581         time.
582
583         * sys-file-writer.c (typedef flt64): Removed.
584         (macro second_lowest_flt64): Removed.
585         (struct sysfile_header): Removed.
586         (struct sysfile_variable): Removed.
587         (struct sfm_writer): Removed `needs_translation', `has_vls',
588         `flt64_cnt'.  Changed `compress' to type bool and `case_cnt' to
589         type casenumber.  Renamed `vars' to `sfm_vars', `var_cnt' to
590         `sfm_var_cnt'.  Replaced `buf', `end', `ptr', `x', `y' for
591         compression buffering by `opcodes', `opcode_cnt', `data',
592         `data_cnt'.  Renamed `var_cnt_vls' as `segment_cnt'.
593         (sfm_open_writer): Use sfm_dictionary_to_sfm_vars.  Use simple
594         data writer functions instead of structures.
595         (calc_oct_idx): New function.
596         (write_header): Use simple data writer functions instead of
597         structures.
598         (write_format_spec): Renamed write_format.  New argument.
599         (write_variable_continuation_records): New function.
600         (write_variable): Use simple data writer functions instead of
601         structures.  Use write_variable_continuation_records.  Write
602         entire very long string instead of requiring caller to understand
603         them.
604         (write_value_labels): Use simple data writer functions instead of
605         structures.
606         (write_documents): Ditto.
607         (write_variable_display_parameters): Use sys-file-private
608         functions to simplify.  Use simple data writer functions instead
609         of structures.
610         (write_vls_length_table): Use simple data writer functions instead
611         of structures.
612         (write_longvar_table): Ditto.
613         (write_rec_7_34): Break into new functions
614         write_integer_info_record, write_float_info_record.  Use simple
615         data writer functions instead of structures.
616         (buf_write): Removed.
617         (append_string_max): Removed.
618         (ensure_buf_space): Removed.
619         (sys_file_casewriter_write): Get rid of the distinction between
620         fast and slow paths, which didn't seem to be too useful.  Use new
621         functions write_case_uncompressed, write_case_compressed.
622         (put_instruction): Removed.
623         (put_element): Removed.
624         (write_compressed_data): Removed.
625         (close_writer): Use flush_compressed.  Only write case count to
626         system file if it will fit in the field.
627         (write_case_compressed): New function.
628         (write_case_uncompressed): New function.
629         (flush_compressed): New function.
630         (put_cmp_opcode): New function.
631         (put_cmp_number): New function.
632         (write_int): New function.
633         (convert_double_to_output_format): New function.
634         (write_float): New function.
635         (write_value): New function.
636         (write_string): New function.
637         (write_bytes): New function.
638         (write_zeros): New function.
639         (write_spaces): New function.
640
641         Reviewed by John Darrington.
642
643 2007-07-22  Ben Pfaff  <blp@gnu.org>
644
645         Don't try to write very long strings to portable files.  The
646         format does not support it.
647
648         * por-file-writer.c (MAX_POR_WIDTH): New macro.
649         (pfm_open_writer): Limit output width to MAX_POR_WIDTH.
650         (write_format): Add arg to take width to resize format to.
651         (write_value): Limit width of value written to MAX_POR_WIDTH.
652         (write_variables): Limit width of variable and its output formats
653         to MAX_POR_WIDTH.
654         Reviewed by John Darrington.
655
656 2007-07-22  Ben Pfaff  <blp@gnu.org>
657
658         * sys-file-reader.c (read_variable_to_value_map): Use max_warnings
659         local variable instead of literal 5.
660         Reviewed by John Darrington.
661         
662 2007-07-22  Ben Pfaff  <blp@gnu.org>
663
664         Fix problems with uniqueness of short names in system files with
665         very long string variables.  Now a variable may have multiple
666         short names.
667         
668         * automake.mk (src_data_libdata_a_SOURCES): Add new files
669         short-names.c, short-names.h.
670
671         * dictionary.c (dict_clone): Clone all the short names.
672         (compare_strings): Move into short-names.c.
673         (hash_strings): Ditto.
674         (set_var_short_name_suffix): Ditto.
675         (dict_assign_short_names): Ditto, rename short_names_assign,
676         change to assign all short names.
677         
678         * por-file-writer.c (write_variables): Use short_names_assign
679         instead of dict_assign_short_names.
680
681         * short-names.c: New file.
682
683         * short-names.h: New file.
684
685         * sys-file-private.c (sfm_width_to_segments): New function.
686
687         * sys-file-reader.c (read_long_var_name_map): Save and restore all
688         the short names, not just the first one.
689         
690         * sys-file-writer.c (cont_var_name): Removed.
691         (sfm_open_writer): Use short_names_assign instead of
692         dict_assign_short_names.  Use unique short names assigned by
693         short_names_assign instead of those generated by cont_var_name.
694
695         * variable.c (struct variable): Remove `short_name' member,
696         replace by `short_names' and `short_name_cnt'.
697         (var_create) Initialize new members.
698         (var_get_short_name_cnt): New function.
699         (var_get_short_name): Now takes an index argument.  Changed most
700         callers to pass 0.
701         (var_set_short_name): Ditto.
702         (var_clear_short_name): Renamed var_clear_short_names, changed to
703         clear all short names.
704         
705         Reviewed by John Darrington.
706
707 2007-07-22  Ben Pfaff  <blp@gnu.org>
708
709         * variable.c (var_set_width): Use new var_set_width function.
710
711         * missing-values.c (mv_n_values): Drop assertion, which was not
712         needed.
713
714         * format.c (fmt_default_for_width): New function.
715         (fmt_resize): New function.
716
717         Reviewed by John Darrington.
718
719 2007-07-18 John Darrington <john@darrington.wattle.id.au>
720
721         * datasheet.c (datasheet_delete_columns): Added assertion to check
722         we're not deleting outside the range of the sheet.  
723
724         
725         * dictionary.c dictionary.h variable.c: Added the ability for string
726         variables to be resized.
727         
728         * vardict.h: Added some prototypes (moved from dictionary.h) as
729         these should only be called by variable.c
730
731
732 2007-07-14 John Darrington <john@darrington.wattle.id.au>
733
734         * sfm-reader.c: Respect case_cnt field in file header.
735
736 2007-07-01 John Darrington <john@darrington.wattle.id.au>
737
738         * transformation.c transformation.h (trns_chain_execute): Changed the 
739         signature (Patch #6057)
740
741 2007-06-10  Ben Pfaff  <blp@gnu.org>
742
743         * casereader-filter.c (casereader_filter_destroy): Make sure to
744         write all the remaining excluded cases to the casewriter, if any.
745
746         * caseinit.c (init_list_destroy): Rewrite.
747         (init_list_clear): Ditto.
748
749         * casegrouper.c (casegrouper_get_next_group): Always set *reader
750         to null when returning false.
751
752 2007-06-06  Ben Pfaff  <blp@gnu.org>
753
754         Actually implement the new procedure code and adapt all of its
755         clients to match.  Also adapt all of the other case sources and
756         sinks in the tree and their clients to use the
757         casereader/casewriter infrastructure.
758
759         * automake.mk: Add and remove files.
760
761         * any-reader.c: Change into a casereader.
762         * por-file-reader.c: Ditto.
763         * scratch-reader.c: Ditto.
764         * sys-file-reader.c: Ditto.
765
766         * any-writer.c: Change into a casewriter.
767         * por-file-writer.c: Ditto.
768         * scratch-writer.c: Ditto.
769         * sys-file-writer.c: Ditto.
770
771         * procedure.c: Change to use casereader, casewriter, caseinit, and
772         other new infrastructure.
773
774         * scratch-handle.c: Adapt to new infrastructure.
775
776         * case-sink.c: Removed, now dead code.
777         * case-sink.h: Ditto.
778         * case-source.c: Ditto.
779         * case-source.h: Ditto.
780         * casefile-factory.c: Ditto.
781         * casefile-private.h: Ditto.
782         * casefile.c: Ditto.
783         * casefile.h: Ditto.
784         * casefilter.c: Ditto.
785         * casefilter.h: Ditto.
786         * fastfile.c: Ditto.
787         * fastfile.h: Ditto.
788         * fastfile-factory.c: Ditto.
789         * fastfile-factory.h: Ditto.
790         * storage-stream.c: Ditto.
791         * storage-stream.h: Ditto.
792
793 2007-06-06  Ben Pfaff  <blp@gnu.org>
794
795         Add datasheet code.
796
797         * automake.mk: Add new files.
798
799         * datasheet.c: New file.
800
801         * datasheet.h: New file.
802
803 2007-06-06  Ben Pfaff  <blp@gnu.org>
804
805         Until now, the procedure code has provided a case to the
806         case_source, which has filled in the data values that come from
807         the active file.  "Left" data values that don't come from the
808         active file naturally stay the same from case to case, because the
809         procedure code keeps using that same case.
810
811         One of the compromises that comes with the new procedure code is
812         that the active file allocates and provides its own case, which
813         the procedure code then has to resize to provide room for any
814         other variables that should go in the case and then fill in the
815         values of "left" variables.  Then, when we're done with that case,
816         we have to save the values of "left" variables to copy into the
817         next case read from the active file.
818
819         The caseinit code helps with this.
820
821         * automake.mk: Add new files.
822
823         * caseinit.c: New file. 
824
825         * caseinit.h: New file. 
826
827 2007-06-06  Ben Pfaff  <blp@gnu.org>
828
829         * value.h (value_cnt_from_width): New function.
830
831         * variable.c (var_get_value_cnt): Use new function.
832
833 2007-06-06  Ben Pfaff  <blp@gnu.org>
834
835         Add casegrouper, to allow cases read from a given casereader to be
836         broken into groups, each of which has its own casereader.
837         Generally cases are grouped based on having equal values for some
838         set of variables.
839
840         * automake.mk: Add new files.
841
842         * casegrouper.c: New file.
843
844         * casegrouper.h: New file.
845
846 2007-06-06  Ben Pfaff  <blp@gnu.org>
847
848         Add interface to lexicographical ordering of cases.
849
850         * automake.mk: Add new files.
851
852         * case-ordering.c: New file.
853
854         * case-ordering.h: New file.
855
856 2007-06-06  Ben Pfaff  <blp@gnu.org>
857
858         Add casereaders and casewriters, the basis of the new data processing
859         implementation.  A casereader is a uniform interface to reading cases
860         from a data source; a casewriter is a uniform interface to writing
861         cases to a data sink.
862
863         * automake.mk: Add new files.
864         
865         * casereader-filter.c: New file.
866         
867         * casereader-provider.h: New file.
868
869         * casereader-translator.c: New file.
870         
871         * casereader.c: New file.
872         
873         * casereader.h: New file.
874         
875         * casewriter-provider.h: New file.
876         
877         * casewriter-translator.c: New file.
878         
879         * casewriter.c: New file.
880         
881         * casewriter.h: New file.
882
883 2007-06-06  Ben Pfaff  <blp@gnu.org>
884
885         "casewindow" data structure that extends the deque (from libpspp)
886         of cases with the ability to dump cases to disk if we get too many
887         of them in memory.
888
889         * automake.mk: Add new files.
890
891         * casewindow.c: New file.
892
893         * casewindow.h: New file.
894
895 2007-06-06  Ben Pfaff  <blp@gnu.org>
896
897         sparse_cases data structure that augments a sparse_array of cases
898         with the ability to dump cases to disk if we get too many cases in
899         memory.
900
901         * automake.mk: Add new files.
902
903         * sparse-cases.c: New file.
904
905         * sparse-cases.h: New file.
906
907 2007-06-06  Ben Pfaff  <blp@gnu.org>
908
909         Adds a low-level on-disk case array data structure.
910         
911         * automake.mk: Add new files.
912
913         * case-tmpfile.c: New file.
914
915         * case-tmpfile.h: New file.
916
917 2007-06-06  Ben Pfaff  <blp@gnu.org>
918
919         In a couple of places we calculate the maximum number of cases to
920         keep in memory based on the user-defined workspace.  Enable
921         centralizing the calculation through a new function.
922         
923         * settings.c (get_workspace_cases): New function.
924
925 2007-06-06  Ben Pfaff  <blp@gnu.org>
926
927         The casenumber type is defined in transformations.h, but case.h is
928         a more sensible place.  Move it.
929
930         * case.h (CASENUMBER_MAX): New macro.
931         (typedef casenumber): Move here, from transformations.h.
932
933 2007-06-03  Ben Pfaff  <blp@gnu.org>
934
935         Slightly generalize case_to_values and case_from_values functions.
936
937         * case.c (case_to_values): Rename case_copy_out, change interface.
938         (case_from_values): Rename case_copy_in, change interface.
939
940         * fastfile.c (fastfilereader_get_next_case): Update caller.
941         (write_case_to_disk): Ditto.
942
943 2007-06-02  Ben Pfaff  <blp@gnu.org>
944
945         Clean up after a forgotten part of patch #5829.
946         
947         * casedeque.h: Remove unused file.
948
949         * automake.mk: Remove casedeque.h from sources.
950
951 2007-05-10  Jason Stover  <jhs@math.gcsu.edu>
952
953         * category.c: Removed redundant #include
954
955 2007-05-06  Ben Pfaff  <blp@gnu.org>
956
957         Abstract the documents within a dictionary a little better.
958         Thanks to John Darrington for suggestion, initial version, and
959         review.  Patch #5917.
960
961         * dictionary.c (struct dictionary): Change `documents' member from
962         char * to struct string.
963         (dict_clear): Destroy struct string.
964         (dict_get_documents): Convert struct string to char *.
965         (dict_set_documents): Set struct string.  Pad to 80-character
966         multiple.
967         (dict_clear_documents): New function.
968         (dict_add_document_line): New function.
969         (dict_get_document_line_cnt): New function.
970         (dict_get_document_line): New function.
971
972         * dictionary.h (macro DOC_LINE_LENGTH): New macro.
973
974         * sys-file-reader.c (read_documents): Use new document functions.
975
976 2007-04-19 John Darrington <john@darrington.wattle.id.au>
977
978         * sys-file-reader.c: When reading a system file which has no 
979         long name table, automatically create one where the long names 
980         are the lower case versions of the short names.
981         
982 2007-04-22  Ben Pfaff  <blp@gnu.org>
983
984         * dictionary.c (dict_set_split_vars): dict_destroy expects that
985         dict_clear will free most data related to the dictionary.
986         dict_clear does a decent job, except that dict_set_split_vars on
987         some systems won't actually free the dict's "split" member.
988         Instead, it'll allocate a 1-byte region.  Fix this.
989
990         * value.c (value_copy): New function.
991         (value_set_missing): Ditto.
992
993 2007-04-22 John Darrington <john@darrington.wattle.id.au>
994
995         * Deleted existing category.h and moved cat-routines.h into 
996         category.h  Encapsulated struct cat_vals better.
997
998 2007-04-19 John Darrington <john@darrington.wattle.id.au>
999
1000         * sys-file-reader.c: When reading a system file which has no 
1001         long name table, automatically create one where the long names 
1002         are the lower case versions of the short names.
1003         
1004 2007-04-16 John Darrington <john@darrington.wattle.id.au>
1005
1006         * sys-file-reader.c: Some versions of Other Software seem to 
1007         produce system files with string  variables' measure set to 
1008         zero.  We'll assume these are supposed to be nominal variables.
1009
1010 2007-03-30  Ben Pfaff  <blp@gnu.org>
1011
1012         * procedure.c: Adapt to new deque data structure.
1013
1014 Mon Feb 19 10:53:21 2007  John McCabe-Dansted <gmatht@gmail.com>
1015                           Ben Pfaff <blp@gnu.org>
1016
1017         * file-name.c: Mingw compatibility fixes.
1018         (fn_search_path): Use ISSLASH instead of comparing against '/'
1019         directly.
1020         (fn_dir_name): Use dir_name from gnulib.
1021         (fn_is_absolute): Use IS_ABSOLUTE_FILE_NAME from gnulib.
1022         (fn_get_identity): Use GetFullPathName instead of canonicalize
1023         from gnulib, because the latter does not fully support
1024         Windows-style path names.  Use this implementation based on the
1025         detected presence of Windows instead of the absence of Unix, since
1026         the new implementation is Windows-specific.
1027         (fn_compare_file_identities): In Windows implementation, compare
1028         names case-insensitively.
1029
1030 Sun Feb 18 13:28:02 2007  Ben Pfaff  <blp@gnu.org>
1031
1032         * make-file.c: Don't include mkstemp.h, because gnulib now causes
1033         <stdlib.h> to have the same effect.
1034
1035 Sun Feb 18 11:20:24 2007  Ben Pfaff  <blp@gnu.org>
1036
1037         * por-file-reader.c: Add missing _() around messages.
1038
1039 Sun Feb 11 20:44:13 2007  Ben Pfaff  <blp@gnu.org>
1040
1041         * make-file.c: Include "mkstemp.h", without which linking on
1042         mingw32 fails.
1043
1044 Thu Feb  8 14:59:05 2007  Ben Pfaff  <blp@gnu.org>
1045  
1046         Reduce platform dependence.
1047  
1048         * file-name.c (fn_tilde_expand): Removed, and removed calls to it.
1049         Everywhere we using this, we really should have just depended on
1050         the shell to expand tildes.
1051         (fn_search_path): Simplify, given that we don't do tilde expansion
1052         any longer.
1053         (fn_normalize): Removed.  Caller changed to use the canonicalize
1054         module from gnulib.
1055         (fn_get_cwd): Removed.  Only user was fn_normalize.
1056         (fn_is_absolute): Really only test for absolute names.
1057         (fn_is_special): Use pipe files if HAVE_POPEN, not if we're in
1058         unix.
1059         (fn_readlink): Removed, as it was only used fn_normalize.
1060         (fn_exists): Assume the stat function is available; gnulib does.
1061         (fn_open): Use pipe files if HAVE_POPEN, not if we're in unix.
1062  
1063 Sat Feb  3 21:52:17 2007  Ben Pfaff  <blp@gnu.org>
1064
1065         * dictionary.c (dict_create_vector_assert): New function.
1066
1067 Wed Feb  7 21:25:15 2007  Ben Pfaff  <blp@gnu.org>
1068
1069         * file-name.c (fn_normalize): Correct name of function
1070         fn_is_special.  Thanks to John McCabe-Dansted <gmatht@gmail.com>
1071         for pointing this out.
1072
1073 Thu Feb  1 16:53:37 2007  Ben Pfaff  <blp@gnu.org>
1074
1075         We are using a single member in struct file_handle, the "name"
1076         field, for more than one purpose.  When it begins with '"', it's a
1077         file name; otherwise, it's a token that can be used to identify
1078         it.  When that assertion fires, it's because we searched for the
1079         name case-sensitively as a file name (so that there was no match),
1080         and then we try to insert it case-insensitively as a token, which
1081         fails because duplicates aren't allowed.
1082
1083         Solution: break the two purposes into two separate fields.  This
1084         fixes the problem and likely makes the code easier to read too.
1085
1086         Fixes bug #18922.  Thanks to John Darrington for bug report and
1087         review.
1088
1089         * file-handle-def.c (struct file_handle): New `id' member.
1090         (fh_from_name): Rename fh_from_id.  Update all callers.
1091         (create_handle): New `id' parameter.  Update all callers.
1092         (fh_create_file): Ditto.
1093         (fh_get_id): New function.
1094
1095 Mon Jan 15 16:18:10 2007  Ben Pfaff  <blp@gnu.org>
1096
1097         * case.c (case_is_null): Change return type to bool.
1098
1099 Mon Jan 15 10:57:28 2007  Ben Pfaff  <blp@gnu.org>
1100
1101         Add debugging code.
1102         
1103         * case.c (case_clone) [DEBUGGING]: When debugging, don't use
1104         reference counting to share data.  This makes it easy for
1105         valgrind, etc. to find accesses to cases that have been destroyed
1106         but have been kept around by another user's ref-count.  This often
1107         happens when the data set is small enough to find in memory; if a
1108         bigger data set that would overflow to disk were used, then data
1109         corruption would occur.
1110
1111 Mon Jan 15 10:55:18 2007  Ben Pfaff  <blp@gnu.org>
1112
1113         Simplify code.
1114
1115         * case.c (case_unshare): Make it check internally whether the
1116         ref_cnt is greater than 1, so that the callers don't have to.
1117         Update callers not to check.
1118
1119 Mon Jan 15 10:53:01 2007  Ben Pfaff  <blp@gnu.org>
1120
1121         Before, I was thinking that I might want to get rid of reference
1122         counting at some point.  Now, I'm pretty sure that it's here to
1123         stay.  Thus, because we have to store the value_cnt anyway for
1124         reference-counted cases, we might as well expose it to users.
1125
1126         * case.c (case_get_value_cnt): New function.
1127         (case_resize): Drop OLD_CNT argument.  Update all callers.  Only
1128         resize case if its size actually changed.
1129
1130         * casefile.c (casefile_append_xfer): Use case_get_value_cnt
1131         instead of peeking inside struct case directly.
1132         (casefile_append): Ditto.
1133
1134 Mon Jan 15 10:50:22 2007  Ben Pfaff  <blp@gnu.org>
1135
1136         Get rid of the inlines for the case functions, which made the
1137         header file hard to read.  (Also, in testing with "-O2 -DNDEBUG",
1138         the inlines didn't speed up "make check" at all, which is not a
1139         perfect benchmark but seems indicative.)
1140         
1141         * case.c: Remove #ifdef DEBUGGING...#endif around many function
1142         definitions.  Remove some assertions on nonnull pointers that were
1143         redundant with a pointer dereference soon after in the function.
1144         Also:
1145         (struct case_data): Move definition here from case.h.
1146         (case_data): Ditto.
1147         (case_num): Ditto.
1148         (case_str): Ditto.
1149         (case_data_wr): Ditto.
1150         
1151 Sun Jan 14 21:41:12 2007  Ben Pfaff  <blp@gnu.org>
1152
1153         * automake.mk: Add casedeque.h to sources.
1154         
1155         * casedeque.h: New file.
1156
1157         * procedure.c: (struct dataset) Change lag_count, lag_head,
1158         lag_queue member into single struct casedeque member.  Update all
1159         users to use the casedeque instead.
1160         (lag_case) Removed.
1161
1162 Sun Jan 14 21:43:12 2007  Ben Pfaff  <blp@gnu.org>
1163
1164         * procedure.c: Simplify lagged cases interface.  Updated all
1165         clients--well, the only client--to use the simplified interface.
1166         (dataset_n_lag) Removed.
1167         (dataset_set_n_lag) Removed.
1168         (dataset_need_lag) New function.
1169
1170 Tue Jan  9 07:20:05 WST 2007 John Darrington <john@darrington.wattle.id.au>
1171
1172         * dictionary.c procedure.c: More changes to ensure that callbacks occur
1173         whenever appropriate, but only when the dataset/dictionary is in a 
1174         consistent state.
1175
1176 Sun Jan  7 08:33:04 WST 2007 John Darrington <john@darrington.wattle.id.au>
1177
1178         * dictionary.c dictionary.h : Added callbacks for change of filter and 
1179         split variables.  Refactored some code to ensure that callbacks get
1180         invoked when appropriate.
1181
1182         * procedure.c (proc_cancel_temporary_transformations): Make sure that 
1183         replace_dict callback occurs when permanent_dict replaces the current
1184         dictionary.
1185
1186 Wed Jan  3 11:02:11 WST 2007 John Darrington <john@darrington.wattle.id.au>
1187
1188         * dictionary.c dictionary.h : Added callback for when the weight 
1189         variable of a dictionary changes.
1190
1191 Mon Jan  1 10:36:26 WST 2007 John Darrington <john@darrington.wattle.id.au>
1192
1193         * dictionary.c dictionary.h : Added replace_source and replace_dict
1194         callbacks, and functions to deal with them.
1195
1196 Fri Dec 22 13:56:08 2006  Ben Pfaff  <blp@gnu.org>
1197
1198         Simplify missing value handling.
1199
1200         * missing-values.h (enum mv_class): New type.
1201         (enum mv_type): Moved definition into missing-values.c and renamed
1202         each MV_* to MVT_*, to distinguish them from the exposed mv_class
1203         enums.  Updated all uses.
1204         (struct missing_values): Changed type of `type' from `enum
1205         mv_type' to `int' because the definition is no longer exposed.
1206         
1207         * missing-values.c (mv_is_value_missing): Add new enum mv_class
1208         parameter.  Update all callers.
1209         (mv_is_num_missing): Ditto.
1210         (mv_is_str_missing): Ditto.
1211         (mv_is_value_user_missing): Removed.  Changed callers to use
1212         mv_is_value_missing.
1213         (mv_is_num_user_missing): Removed.  Changed callers to use
1214         mv_is_num_missing.
1215         (mv_is_str_user_missing): Removed.  Changed callers to use
1216         mv_is_str_missing.
1217         (mv_is_value_system_missing): Removed.  Changed callers to use
1218         mv_is_value_missing.
1219         (mv_set_type): Removed.  Changed callers to use mv_clear.
1220         (mv_clear): New function.
1221         
1222         * variable.c (var_is_value_missing): Add new enum mv_class
1223         parameter.  Update all callers.
1224         (var_is_num_missing): Ditto.
1225         (var_is_str_missing): Ditto.
1226         (var_is_value_user_missing): Removed.  Changed callers to use
1227         var_is_value_missing.
1228         (var_is_num_user_missing): Removed.  Changed callers to use
1229         var_is_num_missing.
1230         (var_is_str_user_missing): Removed.  Changed callers to use
1231         var_is_str_missing.
1232         (var_is_value_system_missing): Removed.  Changed callers to use
1233         var_is_value_missing.
1234         
1235         * casefilter.c (struct casefilter): Use enum mv_class in place of
1236         bool.
1237         (casefilter_variable_missing): Adapt to new member.
1238         (casefilter_create): Change signature to take enum mv_class,
1239         update callers.
1240
1241 Fri Dec 22 20:08:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
1242
1243         * casefile-factory.h fastfile-factory.c fastfile-factory.h: New files.
1244
1245         * case-sink.c case-sink.h procedure.c procedure.h 
1246           storage-stream.c: Now uses the factory.
1247         
1248 Sat Dec 16 22:05:18 2006  Ben Pfaff  <blp@gnu.org>
1249
1250         Make it possible to pull cases from the active file with a
1251         function call, instead of requiring indirection through a callback
1252         function.
1253
1254         * case-source.h (struct case_source_class): Change ->read function
1255         to return a single case, instead of calling a callback function
1256         for each case.  Change ->destroy function to return an error
1257         status.
1258
1259         * case-source.c (free_case_source): Pass along the value returned
1260         by the case_source ->destroy function.
1261
1262         * procedure.c (struct write_case_data): Removed.
1263         (struct dataset): Added some members to track procedure state.
1264         (procedure): Optimize the trivial case at this level.
1265         (internal_procedure): Re-implement in terms of proc_open,
1266         proc_read, proc_close.
1267         (proc_open) New function.
1268         (proc_read) New function.
1269         (proc_close) New function.
1270         (write_case) Moved into proc_read.
1271         (close_active_file) Moved closing of data source into proc_close.
1272
1273         * storage-source.c: Rewrote to conform with modified
1274         case_source_class interface.
1275
1276         * transformations.c (trns_chain_execute): Added argument to allow
1277         starting execution from an arbitrary transformation.  Updated
1278         callers.
1279
1280         * transformations.h (enum TRNS_NEXT_CASE) Renamed TRNS_END_CASE.
1281
1282 Sat Dec 16 14:09:25 2006  Ben Pfaff  <blp@gnu.org>
1283
1284         * sys-file-reader.c (read_display_parameters): Don't assume that
1285         MEASURE_* and ALIGN_* have the same values found in system files.
1286
1287         * sys-file-writer.c (write_variable_display_parameters): Ditto.
1288
1289         * variable.h: Change MEASURE_NOMINAL, MEASURE_ORDINAL,
1290         MEASURE_SCALE to be 0-based instead of 1-based.  This also fixes
1291         the value of n_MEASURES, which was off by 1 (at least from my
1292         point of view).
1293
1294 Sat Dec 16 12:17:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
1295
1296         * dictionary.c dictionary.h vardict.h variable.c: Added optional
1297                 callbacks which are invoked when the dictionary or its 
1298                 variables are changed.  
1299         
1300         * missing-values.c missing-values.h value-labels.c: Tidied up
1301                 consistency checks, and made some of them return false 
1302                 instead of assert-failing. 
1303
1304 Wed Dec 13 19:30:11 2006  Ben Pfaff  <blp@gnu.org>
1305
1306         * calendar.c (calendar_days_in_month): New function.
1307
1308 Mon Dec 11 07:53:39 2006  Ben Pfaff  <blp@gnu.org>
1309
1310         * value-labels.c (hash_int_val_lab): Only hash as many bytes as
1311         the value label's width.
1312
1313 Sun Dec 10 14:21:29 2006  Ben Pfaff  <blp@gnu.org>
1314
1315         * sfm-private.h: Move contents into sys-file-writer.c, which is
1316         the only remaining user.  Removed Borland C++-specific directives.
1317         
1318         * sys-file-reader.c: Clean up and rewrite entire file.  The
1319         rewritten version is simpler and better abstracted, and should be
1320         easier to maintain and extend.  It avoids using structures to read
1321         file data, which is prone to padding variations among compilers.
1322         It should also handle non-IEEE 754 system files, although I
1323         haven't been able to find any.  It has been tested against many
1324         .sav files obtained from the Web and found to produce the same
1325         results as the earlier version of the code, or in some cases
1326         improved results.  It is more tolerant of format variations found
1327         in the wild.
1328
1329         * sys-file-reader.h (struct sfm_read_info): Removed `big_endian'
1330         member, putting an enum integer_format in its place.  New member
1331         `float_format'.  Changed `compressed' member to type bool.
1332
1333 Sun Dec 10 13:48:53 2006  Ben Pfaff  <blp@gnu.org>
1334
1335         * dictionary.c (dict_delete_consecutive_vars): New function.
1336
1337 Sat Dec  9 20:08:25 2006  Ben Pfaff  <blp@gnu.org>
1338
1339         * file-name.c (fn_search_path): Remove prefix arg that was unused
1340         by any caller.  Updated all callers.
1341
1342 Sat Dec  9 20:04:22 2006  Ben Pfaff  <blp@gnu.org>
1343
1344         * format.c (fmt_dollar_template): Use user's decimal point
1345         character.  Add assertion.
1346
1347 Sat Dec  9 20:02:25 2006  Ben Pfaff  <blp@gnu.org>
1348
1349         * format.c (fmt_dollar_template): New function, based on
1350         dollar_format_template from var-type-dialog.c.
1351
1352 Sat Dec  9 18:05:59 2006  Ben Pfaff  <blp@gnu.org>
1353
1354         * data-out.c (output_scientific): Fix bad assumption that "buf" is
1355         null-terminated.
1356         
1357 Sat Dec  9 17:23:23 2006  Ben Pfaff  <blp@gnu.org>
1358
1359         Finish converting struct variable to an opaque type.  In this
1360         phase, we add remaining setter and getter functions, convert the
1361         remaining PSPP code to use them, and do a bunch of cleanup.  The
1362         resulting changes are pervasive but mostly trivial, and only the
1363         notable changes are logged.
1364         
1365         * automake.mk (src_data_libdata_a_SOURCES): Add the new source
1366         files.
1367         
1368         * case.c (case_data): Renamed case_data_idx.
1369         (case_num): Renamed case_num_idx.
1370         (case_str): Renamed case_str_idx.
1371         (case_data_rw): Renamed case_data_rw_idx.
1372
1373         * case.h (case_data): New function with old name and an interface
1374         that takes a variable instead of an index, which is easier to
1375         use.  Updated all callers to use the new interface, or to use the
1376         new *_idx function (see above).
1377         (case_num): Ditto.
1378         (case_str): Ditto.
1379         (case_data_rw): Ditto.
1380         
1381         * category.c (cat_stored_values_destroy): Changed interface to
1382         take a struct cat_vals * instead of a struct variable *.
1383
1384         * dictionary.c (dict_clone): Use new vector_clone function.     
1385         (dict_clear) Use new var_destroy function.
1386         (add_var) New function.
1387         (dict_create_var) Rewrite in terms of dict_create_var_assert.
1388         (dict_create_var_assert) Rewrite in terms of add_var.
1389         (dict_clone_var) Rewrite in terms of dict_clone_var_assert.
1390         (dict_clone_var_assert) Rewrite in terms of var_clone, add_var.
1391         (dict_lookup_var) Use new var_create, var_destroy functions.
1392         (dict_contains_var) Rewrite in terms of new vardict functionality.
1393         (set_var_dict_index) New function.
1394         (set_var_case_index) New function.
1395         (reindex_vars) New function.
1396         (dict_delete_var) Rewrite in terms of new vardict functionality.
1397         (dict_reorder_var) Ditto.
1398         (dict_reorder_vars) Ditto.
1399         (rename_var) New function.
1400         (dict_rename_var) Use rename_var.
1401         (dict_rename_vars) Use pool to simplify code.  Use rename_var.
1402         (dict_get_compacted_idx_to_fv) Rename
1403         dict_get_compacted_dict_index_to_case_index, update callers.
1404         (dict_create_vector) Use new vector_create function.
1405         (dict_clear_vectors) Use new vector_destroy function.
1406         (set_var_short_name_suffix) Move here from variable.c, renamed
1407         from var_set_short_name_suffix, make static, update caller.
1408
1409         * sys-file-private.c: New file.  
1410         (sfm_width_to_bytes) Moved here from variable.c, renamed from
1411         width_to_bytes, update callers.
1412
1413         * sys-file-private.h: New file.  Later it will supplant
1414         sfm-private.h; for now it supplements it.
1415         (macro MIN_VERY_LONG_STRING) New macro.
1416         (macro EFFECTIVE_LONG_STRING_LENGTH) New macro, from value.h.
1417
1418         * sys-file-reader.c: Use MIN_VERY_LONG_STRING - 1 where
1419         MAX_LONG_STRING was used before.
1420
1421         * sys-file-writer.c: Ditto.
1422
1423         * value-labels.c: Change the paradigm here to be that a null
1424         pointer is OK for a struct val_labs * in most cases; it just
1425         represents an empty set of value labels.
1426         (val_labs_copy) A copy of a null set is a null set.
1427         (val_labs_count) A null set has 0 labels.
1428         (val_labs_replace) Change return type to void.  Rewrite for
1429         simplicity.
1430         (val_labs_find) A null set does not contain the value.
1431         (value_to_string) Moved to variable.c, renamed var_get_value_name,
1432         transposed argument order, updated all callers.
1433
1434         * value.c: New file.
1435         (value_dup) Moved here from variable.c.
1436         (compare_values) Ditto.
1437         (hash_value) Ditto.
1438
1439         * value.h: (macro MAX_SHORT_STRING) Rewrote for simplicity.
1440         (macro MAX_LONG_STRING) Removed, because it was only interesting
1441         for system files, not for general code.
1442         (macro MAX_VERY_LONG_STRING) Ditto.
1443         (macro EFFECTIVE_LONG_STRING_LENGTH) Moved to sys-file-private.h.
1444         (macro MAX_ELEMS_PER_VALUE) Removed, as it was unused.
1445
1446         * vardict.h: New file, for an interface between variables and
1447         their dictionaries.
1448
1449         * variable.c: A lot of functions were moved around, for better
1450         organization.
1451         (struct variable) Move definition here, from variable.h.
1452         (var_type_adj) Removed--makes i18n hard.
1453         (var_type_noun) Ditto.
1454         (var_create) New function.
1455         (var_clone) New function.
1456         (var_destroy) New function.
1457         (var_set_name) Assert that variable is not in a dictionary.
1458         (compare_var_names) Rename compare_vars_by_name and fix a couple
1459         of callers who thought the args were strings.
1460         (hash_var_name) Rename hash_var_by_name.
1461         (compare_var_ptr_names) Rename compare_var_ptrs_by_name.
1462         (hash_var_ptr_name) Rename hash_var_ptr_by_name.
1463         (var_is_very_long_string) Removed, because it was only interesting
1464         to system file code.
1465         (var_set_missing_values) Allow the argument to be the wrong width,
1466         as long as we can resize it.  Simplify callers who were doing the
1467         resizing themselves.
1468         (var_get_value_labels) New function.
1469         (var_has_value_labels) New function.
1470         (var_set_value_labels) New function.
1471         (alloc_value_labels) New function.
1472         (var_add_value_label) New function.
1473         (var_replace_value_label) New function.
1474         (var_clear_value_labels) New function.
1475         (var_lookup_value_label) New function.
1476         (var_get_value_name) Moved here from variable.c, renamed from
1477         var_get_value_name, transposed argument order, updated all
1478         callers.
1479         (var_to_string) Moved here, from variable-label.c.
1480         (var_set_leave) New function.
1481         (var_get_leave) New function.
1482         (var_must_leave) New function.
1483         (var_set_short_name_suffix) Moved to dictionary.c, renamed
1484         set_var_short_name_suffix.
1485         (var_get_dict_index) New function.
1486         (var_get_case_index) New function.
1487         (var_get_obs_vals) New function.
1488         (var_set_obs_vals) New function.
1489         (var_has_obs_vals) New function.
1490         (var_get_vardict) New function.
1491         (var_set_vardict) New function.
1492         (var_has_vardict) New function.
1493         (var_clear_vardict) New function.
1494         (value_dup) Moved to value.c.
1495         (compare_values) Ditto.
1496         (hash_value) Ditto.
1497
1498         * variable.h: (enum NUMERIC) Rename VAR_NUMERIC, update all users.
1499         (enum ALPHA) Rename VAR_STRING, update all users.
1500
1501         * vector.c: New file.
1502         (struct vector) Moved here, from variable.h.
1503         (check_widths) New function.
1504         (vector_create) New function.
1505         (vector_clone) New function.
1506         (vector_destroy) New function.
1507         (vector_get_name) New function.
1508         (vector_get_var) New function.
1509         (vector_get_var_cnt) New function.
1510         (compare_vector_ptrs_by_name) New function.
1511
1512         * vector.h: New file.
1513
1514 Sun Dec 10 11:32:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
1515
1516         * casefilter.c (casefilter_variable_missing): Avoided comparision of
1517         string variables to SYSMIS.  Thanks to Ben Pfaff for reporting this
1518         problem.
1519
1520 Sat Dec  9 07:18:03 WST 2006 John Darrington <john@darrington.wattle.id.au>
1521
1522         * value-labels.c (destroy_atoms): New function.
1523         * value-labels.c (atom_create): Call destroy_atoms in atexit handler.
1524
1525 Thu Dec  7 17:38:26 2006  Ben Pfaff  <blp@gnu.org>
1526
1527         Thanks to Jason Stover for pointing out this problem.
1528         
1529         * data-out.c (output_number): Use gsl_finite from GSL, which is
1530         portable, instead of isfinite, which is not.
1531         (power256) Ditto.
1532
1533 Thu Dec  7 15:22:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
1534
1535         * variable.c variable.h (value_dup): New function.
1536
1537 Mon Dec  4 22:20:17 2006  Ben Pfaff  <blp@gnu.org>
1538
1539         Start converting struct variable to an opaque type.  In this
1540         phase, we add a bunch of setter and getter functions and convert
1541         most of the PSPP code to use them.  The resulting changes are
1542         pervasive but mostly trivial, and only the notable changes are
1543         logged.
1544         
1545         * format.c (fmt_equal): New function.
1546         
1547         * variable.c (var_type_is_valid): New function.
1548         (measure_is_valid) Moved here, from format.c.
1549         (alignment_is_valid) Moved here, from format.c.
1550         (var_get_name) New function.
1551         (var_set_name) New function.
1552         (width_to_type) New function.
1553         (var_get_type) New function.
1554         (var_get_width) New function.
1555         (var_set_width) New function.
1556         (var_is_numeric) New function.
1557         (var_is_alpha) New function.
1558         (var_is_short_string) New function.
1559         (var_is_long_string) New function.
1560         (var_is_very_long_string) New function.
1561         (var_get_missing_values) New function.
1562         (var_set_missing_values) New function.
1563         (var_clear_missing_values) New function.
1564         (var_has_missing_values) New function.
1565         (var_is_value_missing) New function.
1566         (var_is_num_missing) New function.
1567         (var_is_str_missing) New function.
1568         (var_is_value_user_missing) New function.
1569         (var_is_num_user_missing) New function.
1570         (var_is_str_user_missing) New function.
1571         (var_is_value_system_missing) New function.
1572         (var_get_print_format) New function.
1573         (var_set_print_format) New function.
1574         (var_get_write_format) New function.
1575         (var_set_write_format) New function.
1576         (var_set_both_formats) New function.
1577         (var_get_label) New function.
1578         (var_set_label) New function.
1579         (var_clear_label) New function.
1580         (var_has_label) New function.
1581         (var_get_measure) New function.
1582         (var_set_measure) New function.
1583         (var_get_display_width) New function.
1584         (var_set_display_width) New function.
1585         (var_get_alignment) New function.
1586         (var_set_alignment) New function.
1587         (var_get_value_cnt) New function.
1588         (var_get_leave) New function.
1589         (var_get_short_name) New function.
1590
1591         * variable.h: (struct variable) Removed "type" and "nv" members;
1592         they are now computed from "width" where needed.
1593
1594 Mon Dec  4 21:38:40 2006  Ben Pfaff  <blp@gnu.org>
1595
1596         * missing-values.c (mv_resize): Don't write beyond end of the
1597         allocated buffer when resizing a long string.
1598
1599 Sat Dec  2 16:28:32 2006  Ben Pfaff  <blp@gnu.org>
1600
1601         Clean up identifier code: don't require identifier enumerations to
1602         be in a particular order; make better use of string library;
1603         expose less of the internals.
1604                 
1605         * identifier.c: (lex_skip_identifier) Rename lex_id_get_length,
1606         change interface.  Updated all callers.
1607         (lex_id_match) Change interface to use struct substring, update
1608         all callers.
1609         (lex_id_match_len) Removed.  Update callers to use lex_id_match.
1610         (global array keywords[]) Make static, change form.  Update all
1611         users to use lex_id_name instead.
1612         (lex_is_keyword) New function.
1613         (lex_id_to_token) Change interface to use struct substring, update
1614         all callers.
1615         (lex_id_name) New function.
1616
1617         * identifier.h: (T_FIRST_KEYWORD) Removed.  Changed users to call
1618         lex_is_keyword instead.
1619         (T_LAST_KEYWORD) Removed.
1620         (T_N_KEYWORDS) Removed.
1621         
1622 Sat Nov 18 20:46:35 2006  Ben Pfaff  <blp@gnu.org>
1623
1624         * format.c: (fmt_date_template) Distinguish characters for which a
1625         space is output and any date delimiter is allowed on input, from
1626         those for which a space is output and only a space is allowed on
1627         input.  The former is represented by X, the latter by a space.
1628         Also, drop distinction between h and H, changing the former to the
1629         latter.
1630
1631         * data-in.c: Completely rewrite internals to conform to SPSS input
1632         formats as closely as possible.
1633         (data_in) Changed external interface by replacing the structure
1634         that was used as a single argument by a set of arguments.  Updated
1635         all callers.
1636         (data_in_finite_line) Removed.  Converted all callers to use plain
1637         data_in.
1638         (data_in_get_integer_format) New function.
1639         (data_in_set_integer_format) New function.
1640         (data_in_get_float_format) New function.
1641         (data_in_set_float_format) New function.
1642
1643         * data-in.h: (enums DI_IGNORE_ERROR, DI_IMPLIED_DECIMALS) Removed.
1644         (struct data_in) Removed.
1645
1646         * data-out.c: (output_date) Drop each component from the input as
1647         it is output, to allow us to drop the distinction between h (a
1648         count of hours) and H (the hour of day) template characters.
1649         Also, handle new X template character.
1650         (output_scientific) Follow more rational rule on when to drop
1651         fraction introduced between SPSS 13 and 15.  Updated test case to
1652         match new behavior.
1653
1654 Sat Nov 11 11:41:26 2006  Ben Pfaff  <blp@gnu.org>
1655
1656         Fix buffer overflow reported by John Darrington.
1657
1658         * data-out.c (output_bcd_integer): In case of SYSMIS, etc.,
1659         realize that DIGITS is a count of nibbles, not of bytes.
1660
1661 Sat Nov  4 15:59:56 2006  Ben Pfaff  <blp@gnu.org>
1662
1663         * calendar.c (calendar_offset_to_gregorian) Also return the
1664         year-of-day.  Change callers to new interface.
1665
1666         * data-out.c: Completely rewrite internals to conform to SPSS
1667         output formats as completely as possible.
1668         (data_out) Change interface to put input parameters before output
1669         parameters, for consistency with the style I now prefer.  Update
1670         all callers.
1671         (data_out_get_integer_format) New public function.
1672         (data_out_set_integer_format) New public function.
1673         (data_out_get_float_format) New public function.
1674         (data_out_set_float_format) New public function.
1675
1676         * data-out.h: New file.  Move prototype for data_out here, from
1677         format.h.
1678
1679         * format.c: (fmt_step_width) Use equality comparison instead of
1680         bitwise and, for clarity.
1681         (fmt_is_string) Ditto.
1682         (fmt_input_to_output) Fix categories that are translated to F
1683         format.
1684
1685 Sun Nov  5 08:29:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
1686
1687         * casefilter.c casefilter.h (new files), casefile.c casefile.h 
1688         casefile-private.h: Added casefilter to assist commands with missing 
1689         values.
1690
1691 Sat Nov  4 11:47:09 2006  Ben Pfaff  <blp@gnu.org>
1692
1693         Implement SET ERRORS, SHOW ERRORS.  Fixes bug #17609.
1694         
1695         * settings.c: (route_errors_to_terminal) New variable.
1696         (route_errors_to_listing) New variable. 
1697         (get_error_routing_to_terminal) New function.
1698         (set_error_routing_to_terminal) New function.
1699         (get_error_routing_to_listing) New function.
1700         (set_error_routing_to_listing) New function.
1701
1702         * settings.h: (SET_ROUTE_* enums) Removed, because unused.
1703
1704 Tue Oct 31 19:58:27 2006  Ben Pfaff  <blp@gnu.org>
1705
1706         * format.c: Completely rewrite, to achieve better abstraction.
1707         Rewrite all references to formats in other files.
1708         
1709         * format.def: Rewrite and reorganize.
1710
1711         * settings.c: Move everything related to custom currency formats
1712         into format.[ch], changing them in form, so as to group related
1713         code and definitions better.  Changed all references to use the
1714         new functions.
1715         (static var decimal) Removed.
1716         (static var grouping) Removed.
1717         (static var cc) Removed.
1718         (get_decimal) Removed.
1719         (set_decimal) Removed.
1720         (get_grouping) Removed.
1721         (set_grouping) Removed.
1722         (get_cc) Removed.
1723         (set_cc) Removed.
1724
1725         * settings.h: (macro CC_CNT) Removed.
1726         (macro CC_WIDTH) Removed.
1727         (struct custom_currency) Removed.
1728
1729 Tue Oct 31 19:56:19 2006  Ben Pfaff  <blp@gnu.org>
1730
1731         * data-in.c (data_in): Use switch statement instead of table, to
1732         avoid dependence on the order of the FMT_* enums.
1733
1734 Tue Oct 31 19:35:36 2006  Ben Pfaff  <blp@gnu.org>
1735
1736         * data-out.c: (num_to_string) Removed, because it was dead code.
1737
1738 Tue Oct 31 18:09:24 2006  Ben Pfaff  <blp@gnu.org>
1739
1740         * data-in.c (parse_trailer): Fix error message.
1741
1742 Sat Oct 28 11:56:50 2006  Ben Pfaff  <blp@gnu.org>
1743
1744         * format.c (fmt_is_binary): New function.
1745
1746 Thu Oct 19 22:59:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
1747
1748         * procedure.c procedure.h: Encapsulated the static data into a single
1749         struct.  
1750
1751 Sat Oct 14 16:56:44 2006  Ben Pfaff  <blp@gnu.org>
1752
1753         * casefile.c (casereader_read_xfer): Always initialize the case,
1754         even on an error condition.
1755
1756 Wed Sep 27 09:37:49 WST 2006 John Darrington <john@darrington.wattle.id.au>
1757
1758         * procedure.c (case_limit_trns_proc): Fixed buglet which rendered the 
1759         entire function useless.
1760
1761 Mon Sep 25 17:11:46 WST 2006 John Darrington <john@darrington.wattle.id.au>
1762
1763         * casefile-private.h casefile.c casefile.h fastfile.c: Created new
1764         casereader method casereader_clone.   
1765         
1766         * procedure.c pransformations.h: Introduced new type casenum_t
1767
1768 Thu Sep 21 07:00:30 2006  Ben Pfaff  <blp@gnu.org>
1769
1770         * variable.c: (width_to_bytes) Rephrase code for clarify.
1771
1772 Sun Jul 16 19:52:03 2006  Ben Pfaff  <blp@gnu.org>
1773
1774         * format.c: (fmt_type_from_string) New function.
1775         (fmt_to_string) Include decimals in output if the format has
1776         decimals, even if the format type does not.  This way, we can
1777         accurately reproduce incorrect formats in user output.
1778         (check_common_specifier) Make the check for a bad format type an
1779         assertion, so we get bug reports if they show up.  Fix message.
1780         Check for decimal places with a format type that doesn't allow
1781         them.
1782         (check_input_specifier) Remove check for FMT_X, which has been
1783         deleted.
1784         (check_output_specifier) Ditto. 
1785
1786         * format.def: Remove FMT_T, FMT_X, FMT_DESCEND, FMT_NEWREC.
1787
1788         * format.h: (macro FMT_TYPE_LEN_MAX) New macro.
1789         (struct fmt_desc) Use FMT_TYPE_LEN_MAX in definition.
1790         (enum fmt_parse_flags) Removed.
1791
1792 Mon Jul 17 18:26:21 WST 2006 John Darrington <john@darrington.wattle.id.au>
1793
1794         * casefile.c casefile.h: Converted to  an abstract base class.
1795         * casefile-private.h fastfile.c fastfile.h: New files.
1796         * automake.mk procedure.c scratch-writer.c storage-stream.c
1797
1798 Wed Jul 12 21:02:26 2006  Ben Pfaff  <blp@gnu.org>
1799
1800         * procedure.c (internal_procedure): Create sink_case with only as
1801         many values as the compacted dictionary.
1802
1803 Wed Jul 12 21:01:00 2006  Ben Pfaff  <blp@gnu.org>
1804
1805         Remove "debugging" code that caused plenty of false positives and
1806         no true positives.
1807         
1808         * case.h (struct ccase): [DEBUGGING] Remove `this' member.
1809
1810         * case.c: Remove all references to `this' member.
1811
1812 Thu Jul  6 19:09:53 2006  Ben Pfaff  <blp@gnu.org>
1813
1814         Fix link error noted by Jason Stover.
1815         
1816         * storage-stream.c: Include <assert.h>.
1817
1818 Tue Jul  4 08:47:35 2006  Ben Pfaff  <blp@gnu.org>
1819
1820         Fix bug #15766 (/KEEP subcommand on SAVE doesn't fully support
1821         ALL) and additional underlying system file issues.
1822
1823         Thanks to John Darrington for review.
1824
1825         First problem: var_hash points to variables not owned by the
1826         sys-file-reader, which the caller may free or modify.  Use an
1827         array of sfm_vars instead, as done earlier (e.g. CVS version
1828         1.12).
1829         
1830         * sys-file-reader.c (struct sfm_reader): Remove var_hash, svars
1831         members and remove all code that references it.  Add vars, var_cnt
1832         members.  Remove fix_specials member, which was unused.
1833         (struct sfm_var) Remove name member, which was unused.
1834         (sfm_close_reader) Free vars member instead of var_hash.
1835         (compare_var_shortnames) Removed.
1836         (hash_var_shortname) Removed.
1837         (sfm_open_reader) Fill out vars array.
1838         (compare_var_index) Removed.
1839         (sfm_read_case) Use vars instead of var_hash.
1840         
1841         Second problem: we're confused about when we actually have very
1842         long strings, causing us to choose incorrectly between slow path
1843         and fast path in sfm_read_case.
1844
1845         * sys-file-reader.c: (sfm_open_reader) Only mark has_vls if we
1846         have very long strings, not when we have long variable names,
1847         which is an unrelated feature.
1848
1849 Tue Jun 27 12:06:49 2006  Ben Pfaff  <blp@gnu.org>
1850
1851         * variable.h: Move var_set and variable parsing declarations to
1852         new header, src/language/lexer/variable-parser.h.  Modified lots
1853         of files to include the new header.
1854
1855 Sun Jun 25 22:39:32 2006  Ben Pfaff  <blp@gnu.org>
1856
1857         * value-labels.c (value_to_string): When there's no value label,
1858         format the variable according to its print format, instead of
1859         always effectively using A or F format.
1860
1861 Mon Jun 19 18:05:42 WST 2006 John Darrington <john@darrington.wattle.id.au>
1862
1863         * casefile.c (casefile_get_random_reader): Nasty hack to get around 
1864         the mode assertion.
1865
1866         * format.c: Removed tortological assertion.
1867
1868 Fri Jun  9 12:20:09 2006  Ben Pfaff  <blp@gnu.org>
1869
1870         Reform string library.
1871         
1872         * file-name.c (fn_interp_vars): Change interface to take a
1873         substring as input.  Updated all users.
1874         
1875 Fri Jun  9 12:11:24 2006  Ben Pfaff  <blp@gnu.org>
1876
1877         * format.c (measure_is_valid): Really return false when m >=
1878         n_MEASURES.
1879
1880 Tue Jun  6 18:46:26 2006  Ben Pfaff  <blp@gnu.org>
1881
1882         Implement random access to casefiles, for use in GUI.
1883         
1884         * casefile.c: (struct casereader) Add `random', `file_ofs',
1885         `buffer_ofs' members.
1886         (casefile_get_random_reader) New function.
1887         (read_open_file) Break part into new function
1888         seek_and_fill_buffer().
1889         (fill_buffer) Update buffer_ofs, file_ofs.
1890         (casereader_seek) New function.
1891
1892 Tue May 30 19:52:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
1893
1894         * settings.c: Added call to i18n{done, init}.
1895
1896 Tue May  9 21:09:17 2006  Ben Pfaff  <blp@gnu.org>
1897
1898         * procedure.h: Add WARN_UNUSED_RESULT to procedure function
1899         prototypes.
1900
1901 Tue May  9 21:08:05 2006  Ben Pfaff  <blp@gnu.org>
1902
1903         * casefile.c: Convert many uses of `int' to `bool'.
1904
1905 Sat May  6 22:49:43 2006  Ben Pfaff  <blp@gnu.org>
1906
1907         * transformations.c (trns_chain_destroy): Destroy chain's trns
1908         member, to fix memory leak.
1909
1910 Sat May  6 22:48:30 2006  Ben Pfaff  <blp@gnu.org>
1911
1912         * storage-stream.c (storage_source_decapsulate): Destroy case
1913         source to fix memory leak.
1914
1915 Sat May  6 22:46:47 2006  Ben Pfaff  <blp@gnu.org>
1916
1917         * scratch-reader.c (scratch_reader_read_case): Copy into existing
1918         case passed as argument instead of initializing the argument as a
1919         case.  Fixes memory leak that showed up in
1920         tests/command/aggregate.sh with scratch files.
1921
1922 Sat May  6 22:45:55 2006  Ben Pfaff  <blp@gnu.org>
1923
1924         * procedure.c (proc_done): Destroy default_dict, to fix memory
1925         leak.
1926
1927 Sat May  6 22:44:44 2006  Ben Pfaff  <blp@gnu.org>
1928
1929         Simplify procedure_with_splits().
1930         
1931         * procedure.c (struct split_aux_data): Removed case_count member.
1932         (procedure_with_splits) Don't initialize case_count.
1933         (split_procedure_case_func) Check whether prev_case is null
1934         instead of case_count.
1935         (split_procedure_end_func) Ditto.
1936
1937 Sat May  6 22:42:23 2006  Ben Pfaff  <blp@gnu.org>
1938
1939         * case.c (case_move): Do nothing if dst and src are the same
1940         object.
1941         (case_try_create) Merge two similar cases.
1942         (case_copy) Unshare only if data must be actually copied.
1943
1944 Sun May  7 10:04:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
1945
1946         * data-in.c data-out.c dictionary.c sys-file-reader.c
1947         sys-file-writer.c variable.c variable.h:  Reworked very long string
1948         support for better encapsulation.
1949
1950 Sat May  6 19:02:00 2006  Ben Pfaff  <blp@gnu.org>
1951
1952         * value-labels.c (val_labs_can_set_width): New function.
1953         (val_labs_set_width) Clear labels if increasing width to long
1954         string.
1955         (val_labs_destroy) Remove unneeded test for null.
1956         
1957 Sat May  6 16:14:08 2006  Ben Pfaff  <blp@gnu.org>
1958
1959         * value-labels.h: Remove unneeded dependency on variable.h.
1960
1961 Sat May  6 15:58:36 2006  Ben Pfaff  <blp@gnu.org>
1962
1963         Get rid of `char *c' member in union value, for cleanliness.
1964         
1965         * value.h: (union value) Remove `c' member.
1966
1967 Sat May  6 15:36:59 2006  Ben Pfaff  <blp@gnu.org>
1968
1969         Make dictionary compacting functions a little more general.
1970         
1971         * sys-file-writer.c (sfm_open_writer): Use
1972         dict_compacting_would_change().
1973         (does_dict_need_translation) Removed.
1974
1975 Sat May  6 15:35:42 2006  Ben Pfaff  <blp@gnu.org>
1976
1977         Make dictionary compacting functions a little more general.
1978         
1979         * dictionary.c (dict_needs_compaction): Rename
1980         dict_compacting_would_shrink().  Update all callers.
1981         (dict_compacting_would_change) New function.
1982         
1983 Sat May  6 14:25:49 2006  Ben Pfaff  <blp@gnu.org>
1984
1985         * sys-file-writer.c: (does_dict_need_translation) Fix bug:
1986         inverted return value (!).
1987
1988 Sat May  6 13:37:52 2006  Ben Pfaff  <blp@gnu.org>
1989
1990         Continue reforming procedure execution.  
1991
1992         * procedure.c: Search and replace "vfm" by "proc".  Notably:
1993         (static var vfm_source) Rename proc_source.  Update all
1994         references.
1995         (static var vfm_sink) Rename proc_sink.  Update all references.
1996         
1997 Sat May  6 12:38:55 2006  Ben Pfaff  <blp@gnu.org>
1998
1999         Continue reforming procedure execution.  In this phase, remove
2000         PROCESS IF, which was deprecated anyway and can be easily
2001         simulated with TEMPORARY followed by SELECT IF.
2002
2003         * procedure.c: (open_active_file) Don't call
2004         add_process_if_trns().
2005         (discard_variables) Get rid of redundant call to
2006         proc_cancel_all_transformations().
2007         (add_process_if_trns) Removed.
2008         (process_if_trns_proc) Removed.
2009         (process_if_trns_free) Removed.
2010
2011 Sat May  6 10:58:05 2006  Ben Pfaff  <blp@gnu.org>
2012
2013         Continue reforming procedure execution.  In this phase, add
2014         `const' to the case passed to procedure()'s callback.
2015
2016         Updated all users of procedure() as well.
2017         
2018         * procedure.c: (struct write_case_data) Add "const" to ccase
2019         parameter for case_func member.
2020         (procedure) Add "const" to ccase parameter for proc_func
2021         parameter.
2022         (multipass_case_func) Make ccase parameter const.
2023         (internal_procedure) Add "const" to ccase parameter for case_func
2024         parameter.
2025         (split_procedure_case_func) Make ccase parameter const.
2026         (multipass_split_case_func) Make ccase parameter const.
2027         
2028 Sat May  6 10:30:33 2006  Ben Pfaff  <blp@gnu.org>
2029
2030         Continue reforming procedure execution.  In this phase, get rid of
2031         the output code for SPLIT FILE groups in procedure.c, which really
2032         shouldn't be doing any output.  Move it into the individual
2033         procedures instead.  This also adds some flexibility.
2034
2035         Updated many users of procedure_with_splits() and
2036         multipass_procedure_with_splits() to call
2037         output_split_file_values() and to deal with increased use of
2038         const.
2039
2040         * procedure.c: (struct split_aux_data) Add "const struct ccase *"
2041         parameter to begin_func member.
2042         (procedure_with_splits) Add "const struct ccase *" parameter to
2043         begin_func parameter.  Make ccase parameter const in proc_func
2044         parameter.
2045         (split_procedure_case_func) Don't dump split file group.  Pass
2046         case to begin_func.
2047         (dump_splits) Moved to language/dictionary/split-file.c as
2048         output_split_file_values().
2049         (struct multipass_split_aux_data) Add "const struct ccase *"
2050         parameter to split_func member.
2051         (multipass_procedure_with_splits) Add "const struct ccase *"
2052         parameter to split_func parameter.
2053         (multipass_split_case_func) Save new SPLIT FILE case before
2054         outputting case.
2055         (multipass_split_output) Pass saved SPLIT FILE case to split_func.
2056         
2057 Fri May  5 22:48:50 2006  Ben Pfaff  <blp@gnu.org>
2058
2059         Continue reforming procedure execution.  Change
2060         internal_procedure() so that it calls open_active_file() and
2061         close_active_file(), which isolates most of the actual procedure
2062         functionality.
2063
2064         * procedure.c: (struct write_case_data) Rename `proc_func' member
2065         to `case_func' and update all references.
2066         (procedure) Rewrite as one-line wrapper around
2067         internal_procedure().
2068         (struct multipass_aux_data) New.
2069         (multipass_callback) Renamed multipass_case_func().  Use struct
2070         multipass_aux_data as auxiliary data.
2071         (multipass_end_func) New function.
2072         (multipass_procedure) Rewrite as wrapper for internal_procedure()
2073         that uses multipass_case_func, multipass_end_func.
2074         (internal_procedure) Add `end_func' argument.  Move optimization
2075         of trivial case in here.  Move call to open_active_file() and
2076         close_active_file() in here.  Now assert that vfm_source is
2077         non-null.
2078         (procedure_with_splits_callback) Rename
2079         split_procedure_case_func().
2080         (split_procedure_end_func) New function.
2081         (multipass_split_callback) Rename multipass_split_case_func.
2082         (multipass_split_end_func) New function.
2083         (discard_variables) No need to test for nonnull vfm_source.
2084
2085 Fri May  5 21:34:02 2006  Ben Pfaff  <blp@gnu.org>
2086
2087         Continue reforming procedure execution.  Get rid of unused member.
2088
2089         * procedure.c: (struct write_case_data) Remove `cases_analyzed'
2090         member.
2091         (write_case) Don't increment cases_analyzed.
2092
2093 Thu May  4 21:50:11 2006  Ben Pfaff  <blp@gnu.org>
2094
2095         Continue reforming procedure execution.  In this phase, move
2096         procedure.c and procedure.h from src to src/data.  Update
2097         makefiles and #includes accordingly.
2098
2099         * procedure.c: Moved here from src/.
2100
2101         * procedure.h: Moved here from src/.
2102
2103 Wed May  3 22:42:12 2006  Ben Pfaff  <blp@gnu.org>
2104
2105         Continue reforming procedure execution.  In this phase, get rid of
2106         many global variables, consolidating procedure execution in
2107         procedure.c.  Encapsulate transformations in new "struct
2108         trns_chain".  Also, change implementation of N OF CASES, FILTER,
2109         and PROCESS IF from special cases to transformations.
2110          
2111         * automake.mk: (src_data_libdata_a_SOURCES) Add transformations.c,
2112         transformations.h.
2113
2114         * dictionary.c: (global variable default_dict) Move to
2115         src/procedure.c.
2116
2117         * variable.h: (TRNS_*) Move to transformations.h.
2118         (struct transformation) Move to transformations.c.
2119
2120 Thu May  4 13:47:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
2121
2122         * sys-file-reader.c: Fixed invalid read problems.
2123
2124 Tue May  2 15:57:10 2006  Ben Pfaff  <blp@gnu.org>
2125
2126         * storage-stream.c: Add missing function comments.
2127
2128 Tue May  2 15:50:21 2006  Ben Pfaff  <blp@gnu.org>
2129
2130         Continue reforming procedure execution.  In this phase, add some
2131         new, needed functionality to storage-stream.
2132
2133         * storage-stream.c: (storage_source_decapsulate) New function.
2134
2135 Tue May  2 15:43:36 2006  Ben Pfaff  <blp@gnu.org>
2136
2137         * variable.c (width_to_bytes): Declarations must precede
2138         statements for C90 compliance.
2139
2140 Tue May  2 10:42:05 WST 2006 John Darrington <john@darrington.wattle.id.au>
2141
2142         * data-out.c, data-in.c, variable.c, variable.h: New functions 
2143         copy_mangle and copy_demangle for reading/writing cases; emulates the 
2144         way SPSS deals with strings > 255 bytes.
2145
2146         * sys-file-reader.c sys-file-writer.c: Added support for Record 7, 
2147         subtype 14 needed for strings longer than 255 bytes.
2148
2149         * dictionary.c, format.def, value.c : Updated to use MAX_STRING 
2150         instead of literal values. Also fixed some constness issues.
2151
2152         * format.h: Constness
2153
2154         * sfm-private.h: Renamed the case_size identifier, since I discovered 
2155         that SPSS's respect for this variable is very nominal.
2156
2157 Mon May  1 15:45:42 2006  Ben Pfaff  <blp@gnu.org>
2158
2159         Change case limit type from int to size_t.
2160
2161         * dictionary.c: (struct dictionary) Change type of case_limit
2162         member.
2163         (dict_get_case_limit) Change return type.
2164         (dict_set_case_limit) Change parameter type.
2165
2166 Wed Apr 26 20:01:19 2006  Ben Pfaff  <blp@gnu.org>
2167
2168         * variable.h: (struct variable) Rename `reinit' member as `leave'
2169         and invert sense.  Fix up all references.
2170
2171 Wed Apr 26 19:39:28 2006  Ben Pfaff  <blp@gnu.org>
2172
2173         Continue reforming procedure execution.  In this phase, break
2174         procedure.c into multiple files.
2175         
2176         * automake.mk: (src_data_libdata_a_SOURCES) Add all the new files.
2177
2178         * case-sink.c: New file.
2179
2180         * case-sink.h: New file.
2181         
2182         * case-source.c: New file.
2183
2184         * case-source.h: New file.
2185         
2186         * storage-stream.c: New file.
2187
2188         * storage-stream.h: New file.
2189
2190 Wed Apr 26 14:55:19 2006  Ben Pfaff  <blp@gnu.org>
2191
2192         * variable.h: (struct variable) Remove `init' member and all
2193         references to it from other files.  It was initialized in several
2194         places, but nothing really ever used it for anything worthwhile.
2195         Thanks to Jason Stover for pointing out how confusing this
2196         member is.
2197
2198 Sun Apr 23 22:04:45 2006  Ben Pfaff  <blp@gnu.org>
2199
2200         Continue reforming error message support.  In this phase, get rid
2201         of message "titles" and put the message text in `struct error'.
2202         Now `struct error' encapsulates a message more properly.
2203         
2204         * casefile.c: (io_error) Use err_msg() instead of err_vmsg().
2205         Format message ourselves.
2206
2207         * data-in.c: (vdls_error) Ditto.
2208
2209         * por-file-reader.c: (error) Ditto.
2210
2211         * sys-file-reader.c: (corrupt_msg) Ditto.
2212
2213 Sun Apr 16 18:49:51 2006  Ben Pfaff  <blp@gnu.org>
2214
2215         GNU standards require "file name" instead of "filename" in
2216         documentation.  It's nice for our code to follow the convention
2217         too.
2218         
2219         * casefile.c: (struct casefile) Rename `filename' member to
2220         `file_name'.  Updated all references.
2221
2222         * file-name.c: [!unix] (struct file_identity) Rename
2223         normalized_filename member to normalized_file_name.  Updated all
2224         references.
2225
2226 Sun Apr 16 18:35:33 2006  Ben Pfaff  <blp@gnu.org>
2227
2228         We don't really support anything but Unix-like environments well,
2229         so we might as well de-obfuscate by writing directory and path
2230         separators explicitly.
2231
2232         * file-name.h: (macro DIR_SEPARATOR) Removed.  Changed all usages
2233         to just '/'.
2234         (macro PATH_SEPARATOR) Removed.  Changed all usages to just ':'.
2235         (macro DIR_SEPARATOR_STRING) Removed.  Changed all usages to just
2236         "/".
2237         (macro PATH_SEPARATOR_STRING) Removed.  Changed all usages to just
2238         ":"
2239
2240 Sun Apr 16 18:28:35 2006  Ben Pfaff  <blp@gnu.org>
2241
2242         GNU standards require "file name" instead of "filename" in
2243         documentation.  It's nice for our code to follow the convention
2244         too.
2245         
2246         * filename.c: Rename to file-name.c.
2247
2248         * filename.h: Rename to file-name.h.  Update all inclusions.
2249         Update header guards.
2250
2251         * automake.mk: Update file names.
2252
2253 Sun Apr 16 16:42:47 2006  Ben Pfaff  <blp@gnu.org>
2254
2255         * filename.c: (fn_dirname) Renamed fn_dir_name(), all references
2256         updated.
2257         (fn_basename) Removed (dead code).
2258         (fn_absolute_p) Renamed fn_is_absolute(), all references updated.
2259         (fn_special_p) Renamed fn_is_special(), all references updated.
2260         (fn_exists_p) Renamed fn_exists(), all references updated.
2261
2262 Sun Apr 16 16:33:58 2006  Ben Pfaff  <blp@gnu.org>
2263
2264         * filename.c: (fn_tilde_expand) Rewrite for cleaner code.  
2265         Also, now it only tilde-expands file names, not paths.
2266         (fn_search_path) Tilde-expand one directory at a time.
2267
2268 Sun Apr 16 16:28:06 2006  Ben Pfaff  <blp@gnu.org>
2269
2270         * filename.c: (fn_search_path) rewrite for cleaner code.  Also,
2271         get rid of non-Unixlike version of the code, which has probably
2272         never been tested.
2273         (fn_prepend_dir) Removed (dead code).
2274
2275         * filename.h: (macro DIR_SEPARATOR_STRING) New.
2276         (macro PATH_SEPARATOR_STRING) New.
2277 Sun Apr 16 16:05:28 2006  Ben Pfaff  <blp@gnu.org>
2278
2279         Continue reforming error message support.  In this phase, we get
2280         rid of VM() and the other msg() support for "verbosity", replacing
2281         it by a new function verbose_msg().
2282
2283         * filename.c: (fn_search_path) Use verbose_msg() instead of
2284         msg(VM(), ...).  
2285
2286 Sat Apr 15 19:53:19 2006  Ben Pfaff  <blp@gnu.org>
2287
2288         * sfm-private.h: Get rid of #defines after #error, which makes no
2289         sense.
2290
2291 Sat Apr 15 19:48:57 2006  Ben Pfaff  <blp@gnu.org>
2292
2293         Get rid of our own int32 type in favor of the standard int32_t
2294         type.
2295         
2296         * sfm-private.h: (int32 macro) Don't define this anymore.  Do
2297         include <stdint.h>.
2298
2299         * sys-file-reader.c: Use int32_t instead of int32 throughout.
2300         
2301         * sys-file-writer.c: Use int32_t instead of int32 throughout.
2302
2303 Sat Apr 15 19:36:47 2006  Ben Pfaff  <blp@gnu.org>
2304
2305         Remove ill-considered file routines that are no longer used.
2306         
2307         * filename.c: (fn_open_ext) Removed.
2308         (fn_close_ext) Removed.
2309
2310         * filename.h: (struct file_ext) Removed.
2311
2312 Mon Apr  3 13:22:39 2006  Ben Pfaff  <blp@gnu.org>
2313
2314         * variable.c (var_is_valid_name): Move declarations before code
2315         for C90 compliance.
2316
2317 Tue Apr  4 15:28:40 WST 2006 John Darrington <john@darrington.wattle.id.au>
2318
2319         * filename.ch (fn_interp_vars): Fixed small buglet.
2320
2321 Tue Mar 28 13:47:16 WST 2006 John Darrington <john@darrington.wattle.id.au>
2322         
2323         * filename.[ch] (fn_interp_vars): Changed the signature and semantics
2324         so as to modify the string inline.   Thus makeing it easier to
2325         destroy the results when no longer needed.
2326         
2327 2006-03-25  Jason Stover  <jhs@math.gcsu.edu>
2328
2329         * category.c (cat_stored_values_destroy): Fixed memory leak.
2330
2331 Fri Mar 24 18:15:41 2006  Ben Pfaff  <blp@gnu.org>
2332
2333         Add some missing frees.  Thanks to John Darrington for reporting
2334         these.
2335
2336         * any-writer.c (any_writer_close): Free writer.
2337
2338         * any-reader.c (any_reader_close): Free reader.
2339
2340 Mon Mar 20 16:33:53 2006  Ben Pfaff  <blp@gnu.org>
2341
2342         * por-file-reader.c: (error) Mark as NO_RETURN.
2343
2344 Sat Mar 11 15:06:07 WST 2006 John Darrington <john@darrington.wattle.id.au>
2345
2346         * settings.c: Changed default value of scompress to true.
2347
2348 Sat Mar  4 13:22:51 2006  Ben Pfaff  <blp@gnu.org>
2349
2350         * sfm-private.h: Include variable.h, to get SHORT_NAME_LEN.
2351
2352         * value.h: Remove check on MAX_SHORT_STRING, which I don't think
2353         really applies.
2354
2355         * variable.h: Move definition of SHORT_NAME_LEN, LONG_NAME_LEN
2356         here from pref.h.orig.
2357
2358 Sat Mar  4 12:50:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
2359
2360         * sys-file-reader.c: Fixed bug reading compressed files.
2361
2362 Thu Mar  2 08:40:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
2363
2364         * Numerous renames.  See src/ChangeLog for details.
2365         
2366         * Moved files from src directory