Fix problems with uniqueness of short names in system files with very
[pspp-builds.git] / src / data / ChangeLog
1 2007-07-22  Ben Pfaff  <blp@gnu.org>
2
3         Fix problems with uniqueness of short names in system files with
4         very long string variables.  Now a variable may have multiple
5         short names.
6         
7         * automake.mk (src_data_libdata_a_SOURCES): Add new files
8         short-names.c, short-names.h.
9
10         * dictionary.c (dict_clone): Clone all the short names.
11         (compare_strings): Move into short-names.c.
12         (hash_strings): Ditto.
13         (set_var_short_name_suffix): Ditto.
14         (dict_assign_short_names): Ditto, rename short_names_assign,
15         change to assign all short names.
16         
17         * por-file-writer.c (write_variables): Use short_names_assign
18         instead of dict_assign_short_names.
19
20         * short-names.c: New file.
21
22         * short-names.h: New file.
23
24         * sys-file-private.c (sfm_width_to_segments): New function.
25
26         * sys-file-reader.c (read_long_var_name_map): Save and restore all
27         the short names, not just the first one.
28         
29         * sys-file-writer.c (cont_var_name): Removed.
30         (sfm_open_writer): Use short_names_assign instead of
31         dict_assign_short_names.  Use unique short names assigned by
32         short_names_assign instead of those generated by cont_var_name.
33
34         * variable.c (struct variable): Remove `short_name' member,
35         replace by `short_names' and `short_name_cnt'.
36         (var_create) Initialize new members.
37         (var_get_short_name_cnt): New function.
38         (var_get_short_name): Now takes an index argument.  Changed most
39         callers to pass 0.
40         (var_set_short_name): Ditto.
41         (var_clear_short_name): Renamed var_clear_short_names, changed to
42         clear all short names.
43         
44 2007-07-22  Ben Pfaff  <blp@gnu.org>
45
46         * variable.c (var_set_width): Use new var_set_width function.
47
48         * missing-values.c (mv_n_values): Drop assertion, which was not
49         needed.
50
51         * format.c (fmt_default_for_width): New function.
52         (fmt_resize): New function.
53
54 2007-07-18 John Darrington <john@darrington.wattle.id.au>
55
56         * datasheet.c (datasheet_delete_columns): Added assertion to check
57         we're not deleting outside the range of the sheet.  
58
59         
60         * dictionary.c dictionary.h variable.c: Added the ability for string
61         variables to be resized.
62         
63         * vardict.h: Added some prototypes (moved from dictionary.h) as
64         these should only be called by variable.c
65
66
67 2007-07-14 John Darrington <john@darrington.wattle.id.au>
68
69         * sfm-reader.c: Respect case_cnt field in file header.
70
71 2007-07-01 John Darrington <john@darrington.wattle.id.au>
72
73         * transformation.c transformation.h (trns_chain_execute): Changed the 
74         signature (Patch #6057)
75
76 2007-06-10  Ben Pfaff  <blp@gnu.org>
77
78         * casereader-filter.c (casereader_filter_destroy): Make sure to
79         write all the remaining excluded cases to the casewriter, if any.
80
81         * caseinit.c (init_list_destroy): Rewrite.
82         (init_list_clear): Ditto.
83
84         * casegrouper.c (casegrouper_get_next_group): Always set *reader
85         to null when returning false.
86
87 2007-06-06  Ben Pfaff  <blp@gnu.org>
88
89         Actually implement the new procedure code and adapt all of its
90         clients to match.  Also adapt all of the other case sources and
91         sinks in the tree and their clients to use the
92         casereader/casewriter infrastructure.
93
94         * automake.mk: Add and remove files.
95
96         * any-reader.c: Change into a casereader.
97         * por-file-reader.c: Ditto.
98         * scratch-reader.c: Ditto.
99         * sys-file-reader.c: Ditto.
100
101         * any-writer.c: Change into a casewriter.
102         * por-file-writer.c: Ditto.
103         * scratch-writer.c: Ditto.
104         * sys-file-writer.c: Ditto.
105
106         * procedure.c: Change to use casereader, casewriter, caseinit, and
107         other new infrastructure.
108
109         * scratch-handle.c: Adapt to new infrastructure.
110
111         * case-sink.c: Removed, now dead code.
112         * case-sink.h: Ditto.
113         * case-source.c: Ditto.
114         * case-source.h: Ditto.
115         * casefile-factory.c: Ditto.
116         * casefile-private.h: Ditto.
117         * casefile.c: Ditto.
118         * casefile.h: Ditto.
119         * casefilter.c: Ditto.
120         * casefilter.h: Ditto.
121         * fastfile.c: Ditto.
122         * fastfile.h: Ditto.
123         * fastfile-factory.c: Ditto.
124         * fastfile-factory.h: Ditto.
125         * storage-stream.c: Ditto.
126         * storage-stream.h: Ditto.
127
128 2007-06-06  Ben Pfaff  <blp@gnu.org>
129
130         Add datasheet code.
131
132         * automake.mk: Add new files.
133
134         * datasheet.c: New file.
135
136         * datasheet.h: New file.
137
138 2007-06-06  Ben Pfaff  <blp@gnu.org>
139
140         Until now, the procedure code has provided a case to the
141         case_source, which has filled in the data values that come from
142         the active file.  "Left" data values that don't come from the
143         active file naturally stay the same from case to case, because the
144         procedure code keeps using that same case.
145
146         One of the compromises that comes with the new procedure code is
147         that the active file allocates and provides its own case, which
148         the procedure code then has to resize to provide room for any
149         other variables that should go in the case and then fill in the
150         values of "left" variables.  Then, when we're done with that case,
151         we have to save the values of "left" variables to copy into the
152         next case read from the active file.
153
154         The caseinit code helps with this.
155
156         * automake.mk: Add new files.
157
158         * caseinit.c: New file. 
159
160         * caseinit.h: New file. 
161
162 2007-06-06  Ben Pfaff  <blp@gnu.org>
163
164         * value.h (value_cnt_from_width): New function.
165
166         * variable.c (var_get_value_cnt): Use new function.
167
168 2007-06-06  Ben Pfaff  <blp@gnu.org>
169
170         Add casegrouper, to allow cases read from a given casereader to be
171         broken into groups, each of which has its own casereader.
172         Generally cases are grouped based on having equal values for some
173         set of variables.
174
175         * automake.mk: Add new files.
176
177         * casegrouper.c: New file.
178
179         * casegrouper.h: New file.
180
181 2007-06-06  Ben Pfaff  <blp@gnu.org>
182
183         Add interface to lexicographical ordering of cases.
184
185         * automake.mk: Add new files.
186
187         * case-ordering.c: New file.
188
189         * case-ordering.h: New file.
190
191 2007-06-06  Ben Pfaff  <blp@gnu.org>
192
193         Add casereaders and casewriters, the basis of the new data processing
194         implementation.  A casereader is a uniform interface to reading cases
195         from a data source; a casewriter is a uniform interface to writing
196         cases to a data sink.
197
198         * automake.mk: Add new files.
199         
200         * casereader-filter.c: New file.
201         
202         * casereader-provider.h: New file.
203
204         * casereader-translator.c: New file.
205         
206         * casereader.c: New file.
207         
208         * casereader.h: New file.
209         
210         * casewriter-provider.h: New file.
211         
212         * casewriter-translator.c: New file.
213         
214         * casewriter.c: New file.
215         
216         * casewriter.h: New file.
217
218 2007-06-06  Ben Pfaff  <blp@gnu.org>
219
220         "casewindow" data structure that extends the deque (from libpspp)
221         of cases with the ability to dump cases to disk if we get too many
222         of them in memory.
223
224         * automake.mk: Add new files.
225
226         * casewindow.c: New file.
227
228         * casewindow.h: New file.
229
230 2007-06-06  Ben Pfaff  <blp@gnu.org>
231
232         sparse_cases data structure that augments a sparse_array of cases
233         with the ability to dump cases to disk if we get too many cases in
234         memory.
235
236         * automake.mk: Add new files.
237
238         * sparse-cases.c: New file.
239
240         * sparse-cases.h: New file.
241
242 2007-06-06  Ben Pfaff  <blp@gnu.org>
243
244         Adds a low-level on-disk case array data structure.
245         
246         * automake.mk: Add new files.
247
248         * case-tmpfile.c: New file.
249
250         * case-tmpfile.h: New file.
251
252 2007-06-06  Ben Pfaff  <blp@gnu.org>
253
254         In a couple of places we calculate the maximum number of cases to
255         keep in memory based on the user-defined workspace.  Enable
256         centralizing the calculation through a new function.
257         
258         * settings.c (get_workspace_cases): New function.
259
260 2007-06-06  Ben Pfaff  <blp@gnu.org>
261
262         The casenumber type is defined in transformations.h, but case.h is
263         a more sensible place.  Move it.
264
265         * case.h (CASENUMBER_MAX): New macro.
266         (typedef casenumber): Move here, from transformations.h.
267
268 2007-06-03  Ben Pfaff  <blp@gnu.org>
269
270         Slightly generalize case_to_values and case_from_values functions.
271
272         * case.c (case_to_values): Rename case_copy_out, change interface.
273         (case_from_values): Rename case_copy_in, change interface.
274
275         * fastfile.c (fastfilereader_get_next_case): Update caller.
276         (write_case_to_disk): Ditto.
277
278 2007-06-02  Ben Pfaff  <blp@gnu.org>
279
280         Clean up after a forgotten part of patch #5829.
281         
282         * casedeque.h: Remove unused file.
283
284         * automake.mk: Remove casedeque.h from sources.
285
286 2007-05-10  Jason Stover  <jhs@math.gcsu.edu>
287
288         * category.c: Removed redundant #include
289
290 2007-05-06  Ben Pfaff  <blp@gnu.org>
291
292         Abstract the documents within a dictionary a little better.
293         Thanks to John Darrington for suggestion, initial version, and
294         review.  Patch #5917.
295
296         * dictionary.c (struct dictionary): Change `documents' member from
297         char * to struct string.
298         (dict_clear): Destroy struct string.
299         (dict_get_documents): Convert struct string to char *.
300         (dict_set_documents): Set struct string.  Pad to 80-character
301         multiple.
302         (dict_clear_documents): New function.
303         (dict_add_document_line): New function.
304         (dict_get_document_line_cnt): New function.
305         (dict_get_document_line): New function.
306
307         * dictionary.h (macro DOC_LINE_LENGTH): New macro.
308
309         * sys-file-reader.c (read_documents): Use new document functions.
310
311 2007-04-19 John Darrington <john@darrington.wattle.id.au>
312
313         * sys-file-reader.c: When reading a system file which has no 
314         long name table, automatically create one where the long names 
315         are the lower case versions of the short names.
316         
317 2007-04-22  Ben Pfaff  <blp@gnu.org>
318
319         * dictionary.c (dict_set_split_vars): dict_destroy expects that
320         dict_clear will free most data related to the dictionary.
321         dict_clear does a decent job, except that dict_set_split_vars on
322         some systems won't actually free the dict's "split" member.
323         Instead, it'll allocate a 1-byte region.  Fix this.
324
325         * value.c (value_copy): New function.
326         (value_set_missing): Ditto.
327
328 2007-04-22 John Darrington <john@darrington.wattle.id.au>
329
330         * Deleted existing category.h and moved cat-routines.h into 
331         category.h  Encapsulated struct cat_vals better.
332
333 2007-04-19 John Darrington <john@darrington.wattle.id.au>
334
335         * sys-file-reader.c: When reading a system file which has no 
336         long name table, automatically create one where the long names 
337         are the lower case versions of the short names.
338         
339 2007-04-16 John Darrington <john@darrington.wattle.id.au>
340
341         * sys-file-reader.c: Some versions of Other Software seem to 
342         produce system files with string  variables' measure set to 
343         zero.  We'll assume these are supposed to be nominal variables.
344
345 2007-03-30  Ben Pfaff  <blp@gnu.org>
346
347         * procedure.c: Adapt to new deque data structure.
348
349 Mon Feb 19 10:53:21 2007  John McCabe-Dansted <gmatht@gmail.com>
350                           Ben Pfaff <blp@gnu.org>
351
352         * file-name.c: Mingw compatibility fixes.
353         (fn_search_path): Use ISSLASH instead of comparing against '/'
354         directly.
355         (fn_dir_name): Use dir_name from gnulib.
356         (fn_is_absolute): Use IS_ABSOLUTE_FILE_NAME from gnulib.
357         (fn_get_identity): Use GetFullPathName instead of canonicalize
358         from gnulib, because the latter does not fully support
359         Windows-style path names.  Use this implementation based on the
360         detected presence of Windows instead of the absence of Unix, since
361         the new implementation is Windows-specific.
362         (fn_compare_file_identities): In Windows implementation, compare
363         names case-insensitively.
364
365 Sun Feb 18 13:28:02 2007  Ben Pfaff  <blp@gnu.org>
366
367         * make-file.c: Don't include mkstemp.h, because gnulib now causes
368         <stdlib.h> to have the same effect.
369
370 Sun Feb 18 11:20:24 2007  Ben Pfaff  <blp@gnu.org>
371
372         * por-file-reader.c: Add missing _() around messages.
373
374 Sun Feb 11 20:44:13 2007  Ben Pfaff  <blp@gnu.org>
375
376         * make-file.c: Include "mkstemp.h", without which linking on
377         mingw32 fails.
378
379 Thu Feb  8 14:59:05 2007  Ben Pfaff  <blp@gnu.org>
380  
381         Reduce platform dependence.
382  
383         * file-name.c (fn_tilde_expand): Removed, and removed calls to it.
384         Everywhere we using this, we really should have just depended on
385         the shell to expand tildes.
386         (fn_search_path): Simplify, given that we don't do tilde expansion
387         any longer.
388         (fn_normalize): Removed.  Caller changed to use the canonicalize
389         module from gnulib.
390         (fn_get_cwd): Removed.  Only user was fn_normalize.
391         (fn_is_absolute): Really only test for absolute names.
392         (fn_is_special): Use pipe files if HAVE_POPEN, not if we're in
393         unix.
394         (fn_readlink): Removed, as it was only used fn_normalize.
395         (fn_exists): Assume the stat function is available; gnulib does.
396         (fn_open): Use pipe files if HAVE_POPEN, not if we're in unix.
397  
398 Sat Feb  3 21:52:17 2007  Ben Pfaff  <blp@gnu.org>
399
400         * dictionary.c (dict_create_vector_assert): New function.
401
402 Wed Feb  7 21:25:15 2007  Ben Pfaff  <blp@gnu.org>
403
404         * file-name.c (fn_normalize): Correct name of function
405         fn_is_special.  Thanks to John McCabe-Dansted <gmatht@gmail.com>
406         for pointing this out.
407
408 Thu Feb  1 16:53:37 2007  Ben Pfaff  <blp@gnu.org>
409
410         We are using a single member in struct file_handle, the "name"
411         field, for more than one purpose.  When it begins with '"', it's a
412         file name; otherwise, it's a token that can be used to identify
413         it.  When that assertion fires, it's because we searched for the
414         name case-sensitively as a file name (so that there was no match),
415         and then we try to insert it case-insensitively as a token, which
416         fails because duplicates aren't allowed.
417
418         Solution: break the two purposes into two separate fields.  This
419         fixes the problem and likely makes the code easier to read too.
420
421         Fixes bug #18922.  Thanks to John Darrington for bug report and
422         review.
423
424         * file-handle-def.c (struct file_handle): New `id' member.
425         (fh_from_name): Rename fh_from_id.  Update all callers.
426         (create_handle): New `id' parameter.  Update all callers.
427         (fh_create_file): Ditto.
428         (fh_get_id): New function.
429
430 Mon Jan 15 16:18:10 2007  Ben Pfaff  <blp@gnu.org>
431
432         * case.c (case_is_null): Change return type to bool.
433
434 Mon Jan 15 10:57:28 2007  Ben Pfaff  <blp@gnu.org>
435
436         Add debugging code.
437         
438         * case.c (case_clone) [DEBUGGING]: When debugging, don't use
439         reference counting to share data.  This makes it easy for
440         valgrind, etc. to find accesses to cases that have been destroyed
441         but have been kept around by another user's ref-count.  This often
442         happens when the data set is small enough to find in memory; if a
443         bigger data set that would overflow to disk were used, then data
444         corruption would occur.
445
446 Mon Jan 15 10:55:18 2007  Ben Pfaff  <blp@gnu.org>
447
448         Simplify code.
449
450         * case.c (case_unshare): Make it check internally whether the
451         ref_cnt is greater than 1, so that the callers don't have to.
452         Update callers not to check.
453
454 Mon Jan 15 10:53:01 2007  Ben Pfaff  <blp@gnu.org>
455
456         Before, I was thinking that I might want to get rid of reference
457         counting at some point.  Now, I'm pretty sure that it's here to
458         stay.  Thus, because we have to store the value_cnt anyway for
459         reference-counted cases, we might as well expose it to users.
460
461         * case.c (case_get_value_cnt): New function.
462         (case_resize): Drop OLD_CNT argument.  Update all callers.  Only
463         resize case if its size actually changed.
464
465         * casefile.c (casefile_append_xfer): Use case_get_value_cnt
466         instead of peeking inside struct case directly.
467         (casefile_append): Ditto.
468
469 Mon Jan 15 10:50:22 2007  Ben Pfaff  <blp@gnu.org>
470
471         Get rid of the inlines for the case functions, which made the
472         header file hard to read.  (Also, in testing with "-O2 -DNDEBUG",
473         the inlines didn't speed up "make check" at all, which is not a
474         perfect benchmark but seems indicative.)
475         
476         * case.c: Remove #ifdef DEBUGGING...#endif around many function
477         definitions.  Remove some assertions on nonnull pointers that were
478         redundant with a pointer dereference soon after in the function.
479         Also:
480         (struct case_data): Move definition here from case.h.
481         (case_data): Ditto.
482         (case_num): Ditto.
483         (case_str): Ditto.
484         (case_data_wr): Ditto.
485         
486 Sun Jan 14 21:41:12 2007  Ben Pfaff  <blp@gnu.org>
487
488         * automake.mk: Add casedeque.h to sources.
489         
490         * casedeque.h: New file.
491
492         * procedure.c: (struct dataset) Change lag_count, lag_head,
493         lag_queue member into single struct casedeque member.  Update all
494         users to use the casedeque instead.
495         (lag_case) Removed.
496
497 Sun Jan 14 21:43:12 2007  Ben Pfaff  <blp@gnu.org>
498
499         * procedure.c: Simplify lagged cases interface.  Updated all
500         clients--well, the only client--to use the simplified interface.
501         (dataset_n_lag) Removed.
502         (dataset_set_n_lag) Removed.
503         (dataset_need_lag) New function.
504
505 Tue Jan  9 07:20:05 WST 2007 John Darrington <john@darrington.wattle.id.au>
506
507         * dictionary.c procedure.c: More changes to ensure that callbacks occur
508         whenever appropriate, but only when the dataset/dictionary is in a 
509         consistent state.
510
511 Sun Jan  7 08:33:04 WST 2007 John Darrington <john@darrington.wattle.id.au>
512
513         * dictionary.c dictionary.h : Added callbacks for change of filter and 
514         split variables.  Refactored some code to ensure that callbacks get
515         invoked when appropriate.
516
517         * procedure.c (proc_cancel_temporary_transformations): Make sure that 
518         replace_dict callback occurs when permanent_dict replaces the current
519         dictionary.
520
521 Wed Jan  3 11:02:11 WST 2007 John Darrington <john@darrington.wattle.id.au>
522
523         * dictionary.c dictionary.h : Added callback for when the weight 
524         variable of a dictionary changes.
525
526 Mon Jan  1 10:36:26 WST 2007 John Darrington <john@darrington.wattle.id.au>
527
528         * dictionary.c dictionary.h : Added replace_source and replace_dict
529         callbacks, and functions to deal with them.
530
531 Fri Dec 22 13:56:08 2006  Ben Pfaff  <blp@gnu.org>
532
533         Simplify missing value handling.
534
535         * missing-values.h (enum mv_class): New type.
536         (enum mv_type): Moved definition into missing-values.c and renamed
537         each MV_* to MVT_*, to distinguish them from the exposed mv_class
538         enums.  Updated all uses.
539         (struct missing_values): Changed type of `type' from `enum
540         mv_type' to `int' because the definition is no longer exposed.
541         
542         * missing-values.c (mv_is_value_missing): Add new enum mv_class
543         parameter.  Update all callers.
544         (mv_is_num_missing): Ditto.
545         (mv_is_str_missing): Ditto.
546         (mv_is_value_user_missing): Removed.  Changed callers to use
547         mv_is_value_missing.
548         (mv_is_num_user_missing): Removed.  Changed callers to use
549         mv_is_num_missing.
550         (mv_is_str_user_missing): Removed.  Changed callers to use
551         mv_is_str_missing.
552         (mv_is_value_system_missing): Removed.  Changed callers to use
553         mv_is_value_missing.
554         (mv_set_type): Removed.  Changed callers to use mv_clear.
555         (mv_clear): New function.
556         
557         * variable.c (var_is_value_missing): Add new enum mv_class
558         parameter.  Update all callers.
559         (var_is_num_missing): Ditto.
560         (var_is_str_missing): Ditto.
561         (var_is_value_user_missing): Removed.  Changed callers to use
562         var_is_value_missing.
563         (var_is_num_user_missing): Removed.  Changed callers to use
564         var_is_num_missing.
565         (var_is_str_user_missing): Removed.  Changed callers to use
566         var_is_str_missing.
567         (var_is_value_system_missing): Removed.  Changed callers to use
568         var_is_value_missing.
569         
570         * casefilter.c (struct casefilter): Use enum mv_class in place of
571         bool.
572         (casefilter_variable_missing): Adapt to new member.
573         (casefilter_create): Change signature to take enum mv_class,
574         update callers.
575
576 Fri Dec 22 20:08:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
577
578         * casefile-factory.h fastfile-factory.c fastfile-factory.h: New files.
579
580         * case-sink.c case-sink.h procedure.c procedure.h 
581           storage-stream.c: Now uses the factory.
582         
583 Sat Dec 16 22:05:18 2006  Ben Pfaff  <blp@gnu.org>
584
585         Make it possible to pull cases from the active file with a
586         function call, instead of requiring indirection through a callback
587         function.
588
589         * case-source.h (struct case_source_class): Change ->read function
590         to return a single case, instead of calling a callback function
591         for each case.  Change ->destroy function to return an error
592         status.
593
594         * case-source.c (free_case_source): Pass along the value returned
595         by the case_source ->destroy function.
596
597         * procedure.c (struct write_case_data): Removed.
598         (struct dataset): Added some members to track procedure state.
599         (procedure): Optimize the trivial case at this level.
600         (internal_procedure): Re-implement in terms of proc_open,
601         proc_read, proc_close.
602         (proc_open) New function.
603         (proc_read) New function.
604         (proc_close) New function.
605         (write_case) Moved into proc_read.
606         (close_active_file) Moved closing of data source into proc_close.
607
608         * storage-source.c: Rewrote to conform with modified
609         case_source_class interface.
610
611         * transformations.c (trns_chain_execute): Added argument to allow
612         starting execution from an arbitrary transformation.  Updated
613         callers.
614
615         * transformations.h (enum TRNS_NEXT_CASE) Renamed TRNS_END_CASE.
616
617 Sat Dec 16 14:09:25 2006  Ben Pfaff  <blp@gnu.org>
618
619         * sys-file-reader.c (read_display_parameters): Don't assume that
620         MEASURE_* and ALIGN_* have the same values found in system files.
621
622         * sys-file-writer.c (write_variable_display_parameters): Ditto.
623
624         * variable.h: Change MEASURE_NOMINAL, MEASURE_ORDINAL,
625         MEASURE_SCALE to be 0-based instead of 1-based.  This also fixes
626         the value of n_MEASURES, which was off by 1 (at least from my
627         point of view).
628
629 Sat Dec 16 12:17:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
630
631         * dictionary.c dictionary.h vardict.h variable.c: Added optional
632                 callbacks which are invoked when the dictionary or its 
633                 variables are changed.  
634         
635         * missing-values.c missing-values.h value-labels.c: Tidied up
636                 consistency checks, and made some of them return false 
637                 instead of assert-failing. 
638
639 Wed Dec 13 19:30:11 2006  Ben Pfaff  <blp@gnu.org>
640
641         * calendar.c (calendar_days_in_month): New function.
642
643 Mon Dec 11 07:53:39 2006  Ben Pfaff  <blp@gnu.org>
644
645         * value-labels.c (hash_int_val_lab): Only hash as many bytes as
646         the value label's width.
647
648 Sun Dec 10 14:21:29 2006  Ben Pfaff  <blp@gnu.org>
649
650         * sfm-private.h: Move contents into sys-file-writer.c, which is
651         the only remaining user.  Removed Borland C++-specific directives.
652         
653         * sys-file-reader.c: Clean up and rewrite entire file.  The
654         rewritten version is simpler and better abstracted, and should be
655         easier to maintain and extend.  It avoids using structures to read
656         file data, which is prone to padding variations among compilers.
657         It should also handle non-IEEE 754 system files, although I
658         haven't been able to find any.  It has been tested against many
659         .sav files obtained from the Web and found to produce the same
660         results as the earlier version of the code, or in some cases
661         improved results.  It is more tolerant of format variations found
662         in the wild.
663
664         * sys-file-reader.h (struct sfm_read_info): Removed `big_endian'
665         member, putting an enum integer_format in its place.  New member
666         `float_format'.  Changed `compressed' member to type bool.
667
668 Sun Dec 10 13:48:53 2006  Ben Pfaff  <blp@gnu.org>
669
670         * dictionary.c (dict_delete_consecutive_vars): New function.
671
672 Sat Dec  9 20:08:25 2006  Ben Pfaff  <blp@gnu.org>
673
674         * file-name.c (fn_search_path): Remove prefix arg that was unused
675         by any caller.  Updated all callers.
676
677 Sat Dec  9 20:04:22 2006  Ben Pfaff  <blp@gnu.org>
678
679         * format.c (fmt_dollar_template): Use user's decimal point
680         character.  Add assertion.
681
682 Sat Dec  9 20:02:25 2006  Ben Pfaff  <blp@gnu.org>
683
684         * format.c (fmt_dollar_template): New function, based on
685         dollar_format_template from var-type-dialog.c.
686
687 Sat Dec  9 18:05:59 2006  Ben Pfaff  <blp@gnu.org>
688
689         * data-out.c (output_scientific): Fix bad assumption that "buf" is
690         null-terminated.
691         
692 Sat Dec  9 17:23:23 2006  Ben Pfaff  <blp@gnu.org>
693
694         Finish converting struct variable to an opaque type.  In this
695         phase, we add remaining setter and getter functions, convert the
696         remaining PSPP code to use them, and do a bunch of cleanup.  The
697         resulting changes are pervasive but mostly trivial, and only the
698         notable changes are logged.
699         
700         * automake.mk (src_data_libdata_a_SOURCES): Add the new source
701         files.
702         
703         * case.c (case_data): Renamed case_data_idx.
704         (case_num): Renamed case_num_idx.
705         (case_str): Renamed case_str_idx.
706         (case_data_rw): Renamed case_data_rw_idx.
707
708         * case.h (case_data): New function with old name and an interface
709         that takes a variable instead of an index, which is easier to
710         use.  Updated all callers to use the new interface, or to use the
711         new *_idx function (see above).
712         (case_num): Ditto.
713         (case_str): Ditto.
714         (case_data_rw): Ditto.
715         
716         * category.c (cat_stored_values_destroy): Changed interface to
717         take a struct cat_vals * instead of a struct variable *.
718
719         * dictionary.c (dict_clone): Use new vector_clone function.     
720         (dict_clear) Use new var_destroy function.
721         (add_var) New function.
722         (dict_create_var) Rewrite in terms of dict_create_var_assert.
723         (dict_create_var_assert) Rewrite in terms of add_var.
724         (dict_clone_var) Rewrite in terms of dict_clone_var_assert.
725         (dict_clone_var_assert) Rewrite in terms of var_clone, add_var.
726         (dict_lookup_var) Use new var_create, var_destroy functions.
727         (dict_contains_var) Rewrite in terms of new vardict functionality.
728         (set_var_dict_index) New function.
729         (set_var_case_index) New function.
730         (reindex_vars) New function.
731         (dict_delete_var) Rewrite in terms of new vardict functionality.
732         (dict_reorder_var) Ditto.
733         (dict_reorder_vars) Ditto.
734         (rename_var) New function.
735         (dict_rename_var) Use rename_var.
736         (dict_rename_vars) Use pool to simplify code.  Use rename_var.
737         (dict_get_compacted_idx_to_fv) Rename
738         dict_get_compacted_dict_index_to_case_index, update callers.
739         (dict_create_vector) Use new vector_create function.
740         (dict_clear_vectors) Use new vector_destroy function.
741         (set_var_short_name_suffix) Move here from variable.c, renamed
742         from var_set_short_name_suffix, make static, update caller.
743
744         * sys-file-private.c: New file.  
745         (sfm_width_to_bytes) Moved here from variable.c, renamed from
746         width_to_bytes, update callers.
747
748         * sys-file-private.h: New file.  Later it will supplant
749         sfm-private.h; for now it supplements it.
750         (macro MIN_VERY_LONG_STRING) New macro.
751         (macro EFFECTIVE_LONG_STRING_LENGTH) New macro, from value.h.
752
753         * sys-file-reader.c: Use MIN_VERY_LONG_STRING - 1 where
754         MAX_LONG_STRING was used before.
755
756         * sys-file-writer.c: Ditto.
757
758         * value-labels.c: Change the paradigm here to be that a null
759         pointer is OK for a struct val_labs * in most cases; it just
760         represents an empty set of value labels.
761         (val_labs_copy) A copy of a null set is a null set.
762         (val_labs_count) A null set has 0 labels.
763         (val_labs_replace) Change return type to void.  Rewrite for
764         simplicity.
765         (val_labs_find) A null set does not contain the value.
766         (value_to_string) Moved to variable.c, renamed var_get_value_name,
767         transposed argument order, updated all callers.
768
769         * value.c: New file.
770         (value_dup) Moved here from variable.c.
771         (compare_values) Ditto.
772         (hash_value) Ditto.
773
774         * value.h: (macro MAX_SHORT_STRING) Rewrote for simplicity.
775         (macro MAX_LONG_STRING) Removed, because it was only interesting
776         for system files, not for general code.
777         (macro MAX_VERY_LONG_STRING) Ditto.
778         (macro EFFECTIVE_LONG_STRING_LENGTH) Moved to sys-file-private.h.
779         (macro MAX_ELEMS_PER_VALUE) Removed, as it was unused.
780
781         * vardict.h: New file, for an interface between variables and
782         their dictionaries.
783
784         * variable.c: A lot of functions were moved around, for better
785         organization.
786         (struct variable) Move definition here, from variable.h.
787         (var_type_adj) Removed--makes i18n hard.
788         (var_type_noun) Ditto.
789         (var_create) New function.
790         (var_clone) New function.
791         (var_destroy) New function.
792         (var_set_name) Assert that variable is not in a dictionary.
793         (compare_var_names) Rename compare_vars_by_name and fix a couple
794         of callers who thought the args were strings.
795         (hash_var_name) Rename hash_var_by_name.
796         (compare_var_ptr_names) Rename compare_var_ptrs_by_name.
797         (hash_var_ptr_name) Rename hash_var_ptr_by_name.
798         (var_is_very_long_string) Removed, because it was only interesting
799         to system file code.
800         (var_set_missing_values) Allow the argument to be the wrong width,
801         as long as we can resize it.  Simplify callers who were doing the
802         resizing themselves.
803         (var_get_value_labels) New function.
804         (var_has_value_labels) New function.
805         (var_set_value_labels) New function.
806         (alloc_value_labels) New function.
807         (var_add_value_label) New function.
808         (var_replace_value_label) New function.
809         (var_clear_value_labels) New function.
810         (var_lookup_value_label) New function.
811         (var_get_value_name) Moved here from variable.c, renamed from
812         var_get_value_name, transposed argument order, updated all
813         callers.
814         (var_to_string) Moved here, from variable-label.c.
815         (var_set_leave) New function.
816         (var_get_leave) New function.
817         (var_must_leave) New function.
818         (var_set_short_name_suffix) Moved to dictionary.c, renamed
819         set_var_short_name_suffix.
820         (var_get_dict_index) New function.
821         (var_get_case_index) New function.
822         (var_get_obs_vals) New function.
823         (var_set_obs_vals) New function.
824         (var_has_obs_vals) New function.
825         (var_get_vardict) New function.
826         (var_set_vardict) New function.
827         (var_has_vardict) New function.
828         (var_clear_vardict) New function.
829         (value_dup) Moved to value.c.
830         (compare_values) Ditto.
831         (hash_value) Ditto.
832
833         * variable.h: (enum NUMERIC) Rename VAR_NUMERIC, update all users.
834         (enum ALPHA) Rename VAR_STRING, update all users.
835
836         * vector.c: New file.
837         (struct vector) Moved here, from variable.h.
838         (check_widths) New function.
839         (vector_create) New function.
840         (vector_clone) New function.
841         (vector_destroy) New function.
842         (vector_get_name) New function.
843         (vector_get_var) New function.
844         (vector_get_var_cnt) New function.
845         (compare_vector_ptrs_by_name) New function.
846
847         * vector.h: New file.
848
849 Sun Dec 10 11:32:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
850
851         * casefilter.c (casefilter_variable_missing): Avoided comparision of
852         string variables to SYSMIS.  Thanks to Ben Pfaff for reporting this
853         problem.
854
855 Sat Dec  9 07:18:03 WST 2006 John Darrington <john@darrington.wattle.id.au>
856
857         * value-labels.c (destroy_atoms): New function.
858         * value-labels.c (atom_create): Call destroy_atoms in atexit handler.
859
860 Thu Dec  7 17:38:26 2006  Ben Pfaff  <blp@gnu.org>
861
862         Thanks to Jason Stover for pointing out this problem.
863         
864         * data-out.c (output_number): Use gsl_finite from GSL, which is
865         portable, instead of isfinite, which is not.
866         (power256) Ditto.
867
868 Thu Dec  7 15:22:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
869
870         * variable.c variable.h (value_dup): New function.
871
872 Mon Dec  4 22:20:17 2006  Ben Pfaff  <blp@gnu.org>
873
874         Start converting struct variable to an opaque type.  In this
875         phase, we add a bunch of setter and getter functions and convert
876         most of the PSPP code to use them.  The resulting changes are
877         pervasive but mostly trivial, and only the notable changes are
878         logged.
879         
880         * format.c (fmt_equal): New function.
881         
882         * variable.c (var_type_is_valid): New function.
883         (measure_is_valid) Moved here, from format.c.
884         (alignment_is_valid) Moved here, from format.c.
885         (var_get_name) New function.
886         (var_set_name) New function.
887         (width_to_type) New function.
888         (var_get_type) New function.
889         (var_get_width) New function.
890         (var_set_width) New function.
891         (var_is_numeric) New function.
892         (var_is_alpha) New function.
893         (var_is_short_string) New function.
894         (var_is_long_string) New function.
895         (var_is_very_long_string) New function.
896         (var_get_missing_values) New function.
897         (var_set_missing_values) New function.
898         (var_clear_missing_values) New function.
899         (var_has_missing_values) New function.
900         (var_is_value_missing) New function.
901         (var_is_num_missing) New function.
902         (var_is_str_missing) New function.
903         (var_is_value_user_missing) New function.
904         (var_is_num_user_missing) New function.
905         (var_is_str_user_missing) New function.
906         (var_is_value_system_missing) New function.
907         (var_get_print_format) New function.
908         (var_set_print_format) New function.
909         (var_get_write_format) New function.
910         (var_set_write_format) New function.
911         (var_set_both_formats) New function.
912         (var_get_label) New function.
913         (var_set_label) New function.
914         (var_clear_label) New function.
915         (var_has_label) New function.
916         (var_get_measure) New function.
917         (var_set_measure) New function.
918         (var_get_display_width) New function.
919         (var_set_display_width) New function.
920         (var_get_alignment) New function.
921         (var_set_alignment) New function.
922         (var_get_value_cnt) New function.
923         (var_get_leave) New function.
924         (var_get_short_name) New function.
925
926         * variable.h: (struct variable) Removed "type" and "nv" members;
927         they are now computed from "width" where needed.
928
929 Mon Dec  4 21:38:40 2006  Ben Pfaff  <blp@gnu.org>
930
931         * missing-values.c (mv_resize): Don't write beyond end of the
932         allocated buffer when resizing a long string.
933
934 Sat Dec  2 16:28:32 2006  Ben Pfaff  <blp@gnu.org>
935
936         Clean up identifier code: don't require identifier enumerations to
937         be in a particular order; make better use of string library;
938         expose less of the internals.
939                 
940         * identifier.c: (lex_skip_identifier) Rename lex_id_get_length,
941         change interface.  Updated all callers.
942         (lex_id_match) Change interface to use struct substring, update
943         all callers.
944         (lex_id_match_len) Removed.  Update callers to use lex_id_match.
945         (global array keywords[]) Make static, change form.  Update all
946         users to use lex_id_name instead.
947         (lex_is_keyword) New function.
948         (lex_id_to_token) Change interface to use struct substring, update
949         all callers.
950         (lex_id_name) New function.
951
952         * identifier.h: (T_FIRST_KEYWORD) Removed.  Changed users to call
953         lex_is_keyword instead.
954         (T_LAST_KEYWORD) Removed.
955         (T_N_KEYWORDS) Removed.
956         
957 Sat Nov 18 20:46:35 2006  Ben Pfaff  <blp@gnu.org>
958
959         * format.c: (fmt_date_template) Distinguish characters for which a
960         space is output and any date delimiter is allowed on input, from
961         those for which a space is output and only a space is allowed on
962         input.  The former is represented by X, the latter by a space.
963         Also, drop distinction between h and H, changing the former to the
964         latter.
965
966         * data-in.c: Completely rewrite internals to conform to SPSS input
967         formats as closely as possible.
968         (data_in) Changed external interface by replacing the structure
969         that was used as a single argument by a set of arguments.  Updated
970         all callers.
971         (data_in_finite_line) Removed.  Converted all callers to use plain
972         data_in.
973         (data_in_get_integer_format) New function.
974         (data_in_set_integer_format) New function.
975         (data_in_get_float_format) New function.
976         (data_in_set_float_format) New function.
977
978         * data-in.h: (enums DI_IGNORE_ERROR, DI_IMPLIED_DECIMALS) Removed.
979         (struct data_in) Removed.
980
981         * data-out.c: (output_date) Drop each component from the input as
982         it is output, to allow us to drop the distinction between h (a
983         count of hours) and H (the hour of day) template characters.
984         Also, handle new X template character.
985         (output_scientific) Follow more rational rule on when to drop
986         fraction introduced between SPSS 13 and 15.  Updated test case to
987         match new behavior.
988
989 Sat Nov 11 11:41:26 2006  Ben Pfaff  <blp@gnu.org>
990
991         Fix buffer overflow reported by John Darrington.
992
993         * data-out.c (output_bcd_integer): In case of SYSMIS, etc.,
994         realize that DIGITS is a count of nibbles, not of bytes.
995
996 Sat Nov  4 15:59:56 2006  Ben Pfaff  <blp@gnu.org>
997
998         * calendar.c (calendar_offset_to_gregorian) Also return the
999         year-of-day.  Change callers to new interface.
1000
1001         * data-out.c: Completely rewrite internals to conform to SPSS
1002         output formats as completely as possible.
1003         (data_out) Change interface to put input parameters before output
1004         parameters, for consistency with the style I now prefer.  Update
1005         all callers.
1006         (data_out_get_integer_format) New public function.
1007         (data_out_set_integer_format) New public function.
1008         (data_out_get_float_format) New public function.
1009         (data_out_set_float_format) New public function.
1010
1011         * data-out.h: New file.  Move prototype for data_out here, from
1012         format.h.
1013
1014         * format.c: (fmt_step_width) Use equality comparison instead of
1015         bitwise and, for clarity.
1016         (fmt_is_string) Ditto.
1017         (fmt_input_to_output) Fix categories that are translated to F
1018         format.
1019
1020 Sun Nov  5 08:29:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
1021
1022         * casefilter.c casefilter.h (new files), casefile.c casefile.h 
1023         casefile-private.h: Added casefilter to assist commands with missing 
1024         values.
1025
1026 Sat Nov  4 11:47:09 2006  Ben Pfaff  <blp@gnu.org>
1027
1028         Implement SET ERRORS, SHOW ERRORS.  Fixes bug #17609.
1029         
1030         * settings.c: (route_errors_to_terminal) New variable.
1031         (route_errors_to_listing) New variable. 
1032         (get_error_routing_to_terminal) New function.
1033         (set_error_routing_to_terminal) New function.
1034         (get_error_routing_to_listing) New function.
1035         (set_error_routing_to_listing) New function.
1036
1037         * settings.h: (SET_ROUTE_* enums) Removed, because unused.
1038
1039 Tue Oct 31 19:58:27 2006  Ben Pfaff  <blp@gnu.org>
1040
1041         * format.c: Completely rewrite, to achieve better abstraction.
1042         Rewrite all references to formats in other files.
1043         
1044         * format.def: Rewrite and reorganize.
1045
1046         * settings.c: Move everything related to custom currency formats
1047         into format.[ch], changing them in form, so as to group related
1048         code and definitions better.  Changed all references to use the
1049         new functions.
1050         (static var decimal) Removed.
1051         (static var grouping) Removed.
1052         (static var cc) Removed.
1053         (get_decimal) Removed.
1054         (set_decimal) Removed.
1055         (get_grouping) Removed.
1056         (set_grouping) Removed.
1057         (get_cc) Removed.
1058         (set_cc) Removed.
1059
1060         * settings.h: (macro CC_CNT) Removed.
1061         (macro CC_WIDTH) Removed.
1062         (struct custom_currency) Removed.
1063
1064 Tue Oct 31 19:56:19 2006  Ben Pfaff  <blp@gnu.org>
1065
1066         * data-in.c (data_in): Use switch statement instead of table, to
1067         avoid dependence on the order of the FMT_* enums.
1068
1069 Tue Oct 31 19:35:36 2006  Ben Pfaff  <blp@gnu.org>
1070
1071         * data-out.c: (num_to_string) Removed, because it was dead code.
1072
1073 Tue Oct 31 18:09:24 2006  Ben Pfaff  <blp@gnu.org>
1074
1075         * data-in.c (parse_trailer): Fix error message.
1076
1077 Sat Oct 28 11:56:50 2006  Ben Pfaff  <blp@gnu.org>
1078
1079         * format.c (fmt_is_binary): New function.
1080
1081 Thu Oct 19 22:59:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
1082
1083         * procedure.c procedure.h: Encapsulated the static data into a single
1084         struct.  
1085
1086 Sat Oct 14 16:56:44 2006  Ben Pfaff  <blp@gnu.org>
1087
1088         * casefile.c (casereader_read_xfer): Always initialize the case,
1089         even on an error condition.
1090
1091 Wed Sep 27 09:37:49 WST 2006 John Darrington <john@darrington.wattle.id.au>
1092
1093         * procedure.c (case_limit_trns_proc): Fixed buglet which rendered the 
1094         entire function useless.
1095
1096 Mon Sep 25 17:11:46 WST 2006 John Darrington <john@darrington.wattle.id.au>
1097
1098         * casefile-private.h casefile.c casefile.h fastfile.c: Created new
1099         casereader method casereader_clone.   
1100         
1101         * procedure.c pransformations.h: Introduced new type casenum_t
1102
1103 Thu Sep 21 07:00:30 2006  Ben Pfaff  <blp@gnu.org>
1104
1105         * variable.c: (width_to_bytes) Rephrase code for clarify.
1106
1107 Sun Jul 16 19:52:03 2006  Ben Pfaff  <blp@gnu.org>
1108
1109         * format.c: (fmt_type_from_string) New function.
1110         (fmt_to_string) Include decimals in output if the format has
1111         decimals, even if the format type does not.  This way, we can
1112         accurately reproduce incorrect formats in user output.
1113         (check_common_specifier) Make the check for a bad format type an
1114         assertion, so we get bug reports if they show up.  Fix message.
1115         Check for decimal places with a format type that doesn't allow
1116         them.
1117         (check_input_specifier) Remove check for FMT_X, which has been
1118         deleted.
1119         (check_output_specifier) Ditto. 
1120
1121         * format.def: Remove FMT_T, FMT_X, FMT_DESCEND, FMT_NEWREC.
1122
1123         * format.h: (macro FMT_TYPE_LEN_MAX) New macro.
1124         (struct fmt_desc) Use FMT_TYPE_LEN_MAX in definition.
1125         (enum fmt_parse_flags) Removed.
1126
1127 Mon Jul 17 18:26:21 WST 2006 John Darrington <john@darrington.wattle.id.au>
1128
1129         * casefile.c casefile.h: Converted to  an abstract base class.
1130         * casefile-private.h fastfile.c fastfile.h: New files.
1131         * automake.mk procedure.c scratch-writer.c storage-stream.c
1132
1133 Wed Jul 12 21:02:26 2006  Ben Pfaff  <blp@gnu.org>
1134
1135         * procedure.c (internal_procedure): Create sink_case with only as
1136         many values as the compacted dictionary.
1137
1138 Wed Jul 12 21:01:00 2006  Ben Pfaff  <blp@gnu.org>
1139
1140         Remove "debugging" code that caused plenty of false positives and
1141         no true positives.
1142         
1143         * case.h (struct ccase): [DEBUGGING] Remove `this' member.
1144
1145         * case.c: Remove all references to `this' member.
1146
1147 Thu Jul  6 19:09:53 2006  Ben Pfaff  <blp@gnu.org>
1148
1149         Fix link error noted by Jason Stover.
1150         
1151         * storage-stream.c: Include <assert.h>.
1152
1153 Tue Jul  4 08:47:35 2006  Ben Pfaff  <blp@gnu.org>
1154
1155         Fix bug #15766 (/KEEP subcommand on SAVE doesn't fully support
1156         ALL) and additional underlying system file issues.
1157
1158         Thanks to John Darrington for review.
1159
1160         First problem: var_hash points to variables not owned by the
1161         sys-file-reader, which the caller may free or modify.  Use an
1162         array of sfm_vars instead, as done earlier (e.g. CVS version
1163         1.12).
1164         
1165         * sys-file-reader.c (struct sfm_reader): Remove var_hash, svars
1166         members and remove all code that references it.  Add vars, var_cnt
1167         members.  Remove fix_specials member, which was unused.
1168         (struct sfm_var) Remove name member, which was unused.
1169         (sfm_close_reader) Free vars member instead of var_hash.
1170         (compare_var_shortnames) Removed.
1171         (hash_var_shortname) Removed.
1172         (sfm_open_reader) Fill out vars array.
1173         (compare_var_index) Removed.
1174         (sfm_read_case) Use vars instead of var_hash.
1175         
1176         Second problem: we're confused about when we actually have very
1177         long strings, causing us to choose incorrectly between slow path
1178         and fast path in sfm_read_case.
1179
1180         * sys-file-reader.c: (sfm_open_reader) Only mark has_vls if we
1181         have very long strings, not when we have long variable names,
1182         which is an unrelated feature.
1183
1184 Tue Jun 27 12:06:49 2006  Ben Pfaff  <blp@gnu.org>
1185
1186         * variable.h: Move var_set and variable parsing declarations to
1187         new header, src/language/lexer/variable-parser.h.  Modified lots
1188         of files to include the new header.
1189
1190 Sun Jun 25 22:39:32 2006  Ben Pfaff  <blp@gnu.org>
1191
1192         * value-labels.c (value_to_string): When there's no value label,
1193         format the variable according to its print format, instead of
1194         always effectively using A or F format.
1195
1196 Mon Jun 19 18:05:42 WST 2006 John Darrington <john@darrington.wattle.id.au>
1197
1198         * casefile.c (casefile_get_random_reader): Nasty hack to get around 
1199         the mode assertion.
1200
1201         * format.c: Removed tortological assertion.
1202
1203 Fri Jun  9 12:20:09 2006  Ben Pfaff  <blp@gnu.org>
1204
1205         Reform string library.
1206         
1207         * file-name.c (fn_interp_vars): Change interface to take a
1208         substring as input.  Updated all users.
1209         
1210 Fri Jun  9 12:11:24 2006  Ben Pfaff  <blp@gnu.org>
1211
1212         * format.c (measure_is_valid): Really return false when m >=
1213         n_MEASURES.
1214
1215 Tue Jun  6 18:46:26 2006  Ben Pfaff  <blp@gnu.org>
1216
1217         Implement random access to casefiles, for use in GUI.
1218         
1219         * casefile.c: (struct casereader) Add `random', `file_ofs',
1220         `buffer_ofs' members.
1221         (casefile_get_random_reader) New function.
1222         (read_open_file) Break part into new function
1223         seek_and_fill_buffer().
1224         (fill_buffer) Update buffer_ofs, file_ofs.
1225         (casereader_seek) New function.
1226
1227 Tue May 30 19:52:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
1228
1229         * settings.c: Added call to i18n{done, init}.
1230
1231 Tue May  9 21:09:17 2006  Ben Pfaff  <blp@gnu.org>
1232
1233         * procedure.h: Add WARN_UNUSED_RESULT to procedure function
1234         prototypes.
1235
1236 Tue May  9 21:08:05 2006  Ben Pfaff  <blp@gnu.org>
1237
1238         * casefile.c: Convert many uses of `int' to `bool'.
1239
1240 Sat May  6 22:49:43 2006  Ben Pfaff  <blp@gnu.org>
1241
1242         * transformations.c (trns_chain_destroy): Destroy chain's trns
1243         member, to fix memory leak.
1244
1245 Sat May  6 22:48:30 2006  Ben Pfaff  <blp@gnu.org>
1246
1247         * storage-stream.c (storage_source_decapsulate): Destroy case
1248         source to fix memory leak.
1249
1250 Sat May  6 22:46:47 2006  Ben Pfaff  <blp@gnu.org>
1251
1252         * scratch-reader.c (scratch_reader_read_case): Copy into existing
1253         case passed as argument instead of initializing the argument as a
1254         case.  Fixes memory leak that showed up in
1255         tests/command/aggregate.sh with scratch files.
1256
1257 Sat May  6 22:45:55 2006  Ben Pfaff  <blp@gnu.org>
1258
1259         * procedure.c (proc_done): Destroy default_dict, to fix memory
1260         leak.
1261
1262 Sat May  6 22:44:44 2006  Ben Pfaff  <blp@gnu.org>
1263
1264         Simplify procedure_with_splits().
1265         
1266         * procedure.c (struct split_aux_data): Removed case_count member.
1267         (procedure_with_splits) Don't initialize case_count.
1268         (split_procedure_case_func) Check whether prev_case is null
1269         instead of case_count.
1270         (split_procedure_end_func) Ditto.
1271
1272 Sat May  6 22:42:23 2006  Ben Pfaff  <blp@gnu.org>
1273
1274         * case.c (case_move): Do nothing if dst and src are the same
1275         object.
1276         (case_try_create) Merge two similar cases.
1277         (case_copy) Unshare only if data must be actually copied.
1278
1279 Sun May  7 10:04:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
1280
1281         * data-in.c data-out.c dictionary.c sys-file-reader.c
1282         sys-file-writer.c variable.c variable.h:  Reworked very long string
1283         support for better encapsulation.
1284
1285 Sat May  6 19:02:00 2006  Ben Pfaff  <blp@gnu.org>
1286
1287         * value-labels.c (val_labs_can_set_width): New function.
1288         (val_labs_set_width) Clear labels if increasing width to long
1289         string.
1290         (val_labs_destroy) Remove unneeded test for null.
1291         
1292 Sat May  6 16:14:08 2006  Ben Pfaff  <blp@gnu.org>
1293
1294         * value-labels.h: Remove unneeded dependency on variable.h.
1295
1296 Sat May  6 15:58:36 2006  Ben Pfaff  <blp@gnu.org>
1297
1298         Get rid of `char *c' member in union value, for cleanliness.
1299         
1300         * value.h: (union value) Remove `c' member.
1301
1302 Sat May  6 15:36:59 2006  Ben Pfaff  <blp@gnu.org>
1303
1304         Make dictionary compacting functions a little more general.
1305         
1306         * sys-file-writer.c (sfm_open_writer): Use
1307         dict_compacting_would_change().
1308         (does_dict_need_translation) Removed.
1309
1310 Sat May  6 15:35:42 2006  Ben Pfaff  <blp@gnu.org>
1311
1312         Make dictionary compacting functions a little more general.
1313         
1314         * dictionary.c (dict_needs_compaction): Rename
1315         dict_compacting_would_shrink().  Update all callers.
1316         (dict_compacting_would_change) New function.
1317         
1318 Sat May  6 14:25:49 2006  Ben Pfaff  <blp@gnu.org>
1319
1320         * sys-file-writer.c: (does_dict_need_translation) Fix bug:
1321         inverted return value (!).
1322
1323 Sat May  6 13:37:52 2006  Ben Pfaff  <blp@gnu.org>
1324
1325         Continue reforming procedure execution.  
1326
1327         * procedure.c: Search and replace "vfm" by "proc".  Notably:
1328         (static var vfm_source) Rename proc_source.  Update all
1329         references.
1330         (static var vfm_sink) Rename proc_sink.  Update all references.
1331         
1332 Sat May  6 12:38:55 2006  Ben Pfaff  <blp@gnu.org>
1333
1334         Continue reforming procedure execution.  In this phase, remove
1335         PROCESS IF, which was deprecated anyway and can be easily
1336         simulated with TEMPORARY followed by SELECT IF.
1337
1338         * procedure.c: (open_active_file) Don't call
1339         add_process_if_trns().
1340         (discard_variables) Get rid of redundant call to
1341         proc_cancel_all_transformations().
1342         (add_process_if_trns) Removed.
1343         (process_if_trns_proc) Removed.
1344         (process_if_trns_free) Removed.
1345
1346 Sat May  6 10:58:05 2006  Ben Pfaff  <blp@gnu.org>
1347
1348         Continue reforming procedure execution.  In this phase, add
1349         `const' to the case passed to procedure()'s callback.
1350
1351         Updated all users of procedure() as well.
1352         
1353         * procedure.c: (struct write_case_data) Add "const" to ccase
1354         parameter for case_func member.
1355         (procedure) Add "const" to ccase parameter for proc_func
1356         parameter.
1357         (multipass_case_func) Make ccase parameter const.
1358         (internal_procedure) Add "const" to ccase parameter for case_func
1359         parameter.
1360         (split_procedure_case_func) Make ccase parameter const.
1361         (multipass_split_case_func) Make ccase parameter const.
1362         
1363 Sat May  6 10:30:33 2006  Ben Pfaff  <blp@gnu.org>
1364
1365         Continue reforming procedure execution.  In this phase, get rid of
1366         the output code for SPLIT FILE groups in procedure.c, which really
1367         shouldn't be doing any output.  Move it into the individual
1368         procedures instead.  This also adds some flexibility.
1369
1370         Updated many users of procedure_with_splits() and
1371         multipass_procedure_with_splits() to call
1372         output_split_file_values() and to deal with increased use of
1373         const.
1374
1375         * procedure.c: (struct split_aux_data) Add "const struct ccase *"
1376         parameter to begin_func member.
1377         (procedure_with_splits) Add "const struct ccase *" parameter to
1378         begin_func parameter.  Make ccase parameter const in proc_func
1379         parameter.
1380         (split_procedure_case_func) Don't dump split file group.  Pass
1381         case to begin_func.
1382         (dump_splits) Moved to language/dictionary/split-file.c as
1383         output_split_file_values().
1384         (struct multipass_split_aux_data) Add "const struct ccase *"
1385         parameter to split_func member.
1386         (multipass_procedure_with_splits) Add "const struct ccase *"
1387         parameter to split_func parameter.
1388         (multipass_split_case_func) Save new SPLIT FILE case before
1389         outputting case.
1390         (multipass_split_output) Pass saved SPLIT FILE case to split_func.
1391         
1392 Fri May  5 22:48:50 2006  Ben Pfaff  <blp@gnu.org>
1393
1394         Continue reforming procedure execution.  Change
1395         internal_procedure() so that it calls open_active_file() and
1396         close_active_file(), which isolates most of the actual procedure
1397         functionality.
1398
1399         * procedure.c: (struct write_case_data) Rename `proc_func' member
1400         to `case_func' and update all references.
1401         (procedure) Rewrite as one-line wrapper around
1402         internal_procedure().
1403         (struct multipass_aux_data) New.
1404         (multipass_callback) Renamed multipass_case_func().  Use struct
1405         multipass_aux_data as auxiliary data.
1406         (multipass_end_func) New function.
1407         (multipass_procedure) Rewrite as wrapper for internal_procedure()
1408         that uses multipass_case_func, multipass_end_func.
1409         (internal_procedure) Add `end_func' argument.  Move optimization
1410         of trivial case in here.  Move call to open_active_file() and
1411         close_active_file() in here.  Now assert that vfm_source is
1412         non-null.
1413         (procedure_with_splits_callback) Rename
1414         split_procedure_case_func().
1415         (split_procedure_end_func) New function.
1416         (multipass_split_callback) Rename multipass_split_case_func.
1417         (multipass_split_end_func) New function.
1418         (discard_variables) No need to test for nonnull vfm_source.
1419
1420 Fri May  5 21:34:02 2006  Ben Pfaff  <blp@gnu.org>
1421
1422         Continue reforming procedure execution.  Get rid of unused member.
1423
1424         * procedure.c: (struct write_case_data) Remove `cases_analyzed'
1425         member.
1426         (write_case) Don't increment cases_analyzed.
1427
1428 Thu May  4 21:50:11 2006  Ben Pfaff  <blp@gnu.org>
1429
1430         Continue reforming procedure execution.  In this phase, move
1431         procedure.c and procedure.h from src to src/data.  Update
1432         makefiles and #includes accordingly.
1433
1434         * procedure.c: Moved here from src/.
1435
1436         * procedure.h: Moved here from src/.
1437
1438 Wed May  3 22:42:12 2006  Ben Pfaff  <blp@gnu.org>
1439
1440         Continue reforming procedure execution.  In this phase, get rid of
1441         many global variables, consolidating procedure execution in
1442         procedure.c.  Encapsulate transformations in new "struct
1443         trns_chain".  Also, change implementation of N OF CASES, FILTER,
1444         and PROCESS IF from special cases to transformations.
1445          
1446         * automake.mk: (src_data_libdata_a_SOURCES) Add transformations.c,
1447         transformations.h.
1448
1449         * dictionary.c: (global variable default_dict) Move to
1450         src/procedure.c.
1451
1452         * variable.h: (TRNS_*) Move to transformations.h.
1453         (struct transformation) Move to transformations.c.
1454
1455 Thu May  4 13:47:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
1456
1457         * sys-file-reader.c: Fixed invalid read problems.
1458
1459 Tue May  2 15:57:10 2006  Ben Pfaff  <blp@gnu.org>
1460
1461         * storage-stream.c: Add missing function comments.
1462
1463 Tue May  2 15:50:21 2006  Ben Pfaff  <blp@gnu.org>
1464
1465         Continue reforming procedure execution.  In this phase, add some
1466         new, needed functionality to storage-stream.
1467
1468         * storage-stream.c: (storage_source_decapsulate) New function.
1469
1470 Tue May  2 15:43:36 2006  Ben Pfaff  <blp@gnu.org>
1471
1472         * variable.c (width_to_bytes): Declarations must precede
1473         statements for C90 compliance.
1474
1475 Tue May  2 10:42:05 WST 2006 John Darrington <john@darrington.wattle.id.au>
1476
1477         * data-out.c, data-in.c, variable.c, variable.h: New functions 
1478         copy_mangle and copy_demangle for reading/writing cases; emulates the 
1479         way SPSS deals with strings > 255 bytes.
1480
1481         * sys-file-reader.c sys-file-writer.c: Added support for Record 7, 
1482         subtype 14 needed for strings longer than 255 bytes.
1483
1484         * dictionary.c, format.def, value.c : Updated to use MAX_STRING 
1485         instead of literal values. Also fixed some constness issues.
1486
1487         * format.h: Constness
1488
1489         * sfm-private.h: Renamed the case_size identifier, since I discovered 
1490         that SPSS's respect for this variable is very nominal.
1491
1492 Mon May  1 15:45:42 2006  Ben Pfaff  <blp@gnu.org>
1493
1494         Change case limit type from int to size_t.
1495
1496         * dictionary.c: (struct dictionary) Change type of case_limit
1497         member.
1498         (dict_get_case_limit) Change return type.
1499         (dict_set_case_limit) Change parameter type.
1500
1501 Wed Apr 26 20:01:19 2006  Ben Pfaff  <blp@gnu.org>
1502
1503         * variable.h: (struct variable) Rename `reinit' member as `leave'
1504         and invert sense.  Fix up all references.
1505
1506 Wed Apr 26 19:39:28 2006  Ben Pfaff  <blp@gnu.org>
1507
1508         Continue reforming procedure execution.  In this phase, break
1509         procedure.c into multiple files.
1510         
1511         * automake.mk: (src_data_libdata_a_SOURCES) Add all the new files.
1512
1513         * case-sink.c: New file.
1514
1515         * case-sink.h: New file.
1516         
1517         * case-source.c: New file.
1518
1519         * case-source.h: New file.
1520         
1521         * storage-stream.c: New file.
1522
1523         * storage-stream.h: New file.
1524
1525 Wed Apr 26 14:55:19 2006  Ben Pfaff  <blp@gnu.org>
1526
1527         * variable.h: (struct variable) Remove `init' member and all
1528         references to it from other files.  It was initialized in several
1529         places, but nothing really ever used it for anything worthwhile.
1530         Thanks to Jason Stover for pointing out how confusing this
1531         member is.
1532
1533 Sun Apr 23 22:04:45 2006  Ben Pfaff  <blp@gnu.org>
1534
1535         Continue reforming error message support.  In this phase, get rid
1536         of message "titles" and put the message text in `struct error'.
1537         Now `struct error' encapsulates a message more properly.
1538         
1539         * casefile.c: (io_error) Use err_msg() instead of err_vmsg().
1540         Format message ourselves.
1541
1542         * data-in.c: (vdls_error) Ditto.
1543
1544         * por-file-reader.c: (error) Ditto.
1545
1546         * sys-file-reader.c: (corrupt_msg) Ditto.
1547
1548 Sun Apr 16 18:49:51 2006  Ben Pfaff  <blp@gnu.org>
1549
1550         GNU standards require "file name" instead of "filename" in
1551         documentation.  It's nice for our code to follow the convention
1552         too.
1553         
1554         * casefile.c: (struct casefile) Rename `filename' member to
1555         `file_name'.  Updated all references.
1556
1557         * file-name.c: [!unix] (struct file_identity) Rename
1558         normalized_filename member to normalized_file_name.  Updated all
1559         references.
1560
1561 Sun Apr 16 18:35:33 2006  Ben Pfaff  <blp@gnu.org>
1562
1563         We don't really support anything but Unix-like environments well,
1564         so we might as well de-obfuscate by writing directory and path
1565         separators explicitly.
1566
1567         * file-name.h: (macro DIR_SEPARATOR) Removed.  Changed all usages
1568         to just '/'.
1569         (macro PATH_SEPARATOR) Removed.  Changed all usages to just ':'.
1570         (macro DIR_SEPARATOR_STRING) Removed.  Changed all usages to just
1571         "/".
1572         (macro PATH_SEPARATOR_STRING) Removed.  Changed all usages to just
1573         ":"
1574
1575 Sun Apr 16 18:28:35 2006  Ben Pfaff  <blp@gnu.org>
1576
1577         GNU standards require "file name" instead of "filename" in
1578         documentation.  It's nice for our code to follow the convention
1579         too.
1580         
1581         * filename.c: Rename to file-name.c.
1582
1583         * filename.h: Rename to file-name.h.  Update all inclusions.
1584         Update header guards.
1585
1586         * automake.mk: Update file names.
1587
1588 Sun Apr 16 16:42:47 2006  Ben Pfaff  <blp@gnu.org>
1589
1590         * filename.c: (fn_dirname) Renamed fn_dir_name(), all references
1591         updated.
1592         (fn_basename) Removed (dead code).
1593         (fn_absolute_p) Renamed fn_is_absolute(), all references updated.
1594         (fn_special_p) Renamed fn_is_special(), all references updated.
1595         (fn_exists_p) Renamed fn_exists(), all references updated.
1596
1597 Sun Apr 16 16:33:58 2006  Ben Pfaff  <blp@gnu.org>
1598
1599         * filename.c: (fn_tilde_expand) Rewrite for cleaner code.  
1600         Also, now it only tilde-expands file names, not paths.
1601         (fn_search_path) Tilde-expand one directory at a time.
1602
1603 Sun Apr 16 16:28:06 2006  Ben Pfaff  <blp@gnu.org>
1604
1605         * filename.c: (fn_search_path) rewrite for cleaner code.  Also,
1606         get rid of non-Unixlike version of the code, which has probably
1607         never been tested.
1608         (fn_prepend_dir) Removed (dead code).
1609
1610         * filename.h: (macro DIR_SEPARATOR_STRING) New.
1611         (macro PATH_SEPARATOR_STRING) New.
1612 Sun Apr 16 16:05:28 2006  Ben Pfaff  <blp@gnu.org>
1613
1614         Continue reforming error message support.  In this phase, we get
1615         rid of VM() and the other msg() support for "verbosity", replacing
1616         it by a new function verbose_msg().
1617
1618         * filename.c: (fn_search_path) Use verbose_msg() instead of
1619         msg(VM(), ...).  
1620
1621 Sat Apr 15 19:53:19 2006  Ben Pfaff  <blp@gnu.org>
1622
1623         * sfm-private.h: Get rid of #defines after #error, which makes no
1624         sense.
1625
1626 Sat Apr 15 19:48:57 2006  Ben Pfaff  <blp@gnu.org>
1627
1628         Get rid of our own int32 type in favor of the standard int32_t
1629         type.
1630         
1631         * sfm-private.h: (int32 macro) Don't define this anymore.  Do
1632         include <stdint.h>.
1633
1634         * sys-file-reader.c: Use int32_t instead of int32 throughout.
1635         
1636         * sys-file-writer.c: Use int32_t instead of int32 throughout.
1637
1638 Sat Apr 15 19:36:47 2006  Ben Pfaff  <blp@gnu.org>
1639
1640         Remove ill-considered file routines that are no longer used.
1641         
1642         * filename.c: (fn_open_ext) Removed.
1643         (fn_close_ext) Removed.
1644
1645         * filename.h: (struct file_ext) Removed.
1646
1647 Mon Apr  3 13:22:39 2006  Ben Pfaff  <blp@gnu.org>
1648
1649         * variable.c (var_is_valid_name): Move declarations before code
1650         for C90 compliance.
1651
1652 Tue Apr  4 15:28:40 WST 2006 John Darrington <john@darrington.wattle.id.au>
1653
1654         * filename.ch (fn_interp_vars): Fixed small buglet.
1655
1656 Tue Mar 28 13:47:16 WST 2006 John Darrington <john@darrington.wattle.id.au>
1657         
1658         * filename.[ch] (fn_interp_vars): Changed the signature and semantics
1659         so as to modify the string inline.   Thus makeing it easier to
1660         destroy the results when no longer needed.
1661         
1662 2006-03-25  Jason Stover  <jhs@math.gcsu.edu>
1663
1664         * category.c (cat_stored_values_destroy): Fixed memory leak.
1665
1666 Fri Mar 24 18:15:41 2006  Ben Pfaff  <blp@gnu.org>
1667
1668         Add some missing frees.  Thanks to John Darrington for reporting
1669         these.
1670
1671         * any-writer.c (any_writer_close): Free writer.
1672
1673         * any-reader.c (any_reader_close): Free reader.
1674
1675 Mon Mar 20 16:33:53 2006  Ben Pfaff  <blp@gnu.org>
1676
1677         * por-file-reader.c: (error) Mark as NO_RETURN.
1678
1679 Sat Mar 11 15:06:07 WST 2006 John Darrington <john@darrington.wattle.id.au>
1680
1681         * settings.c: Changed default value of scompress to true.
1682
1683 Sat Mar  4 13:22:51 2006  Ben Pfaff  <blp@gnu.org>
1684
1685         * sfm-private.h: Include variable.h, to get SHORT_NAME_LEN.
1686
1687         * value.h: Remove check on MAX_SHORT_STRING, which I don't think
1688         really applies.
1689
1690         * variable.h: Move definition of SHORT_NAME_LEN, LONG_NAME_LEN
1691         here from pref.h.orig.
1692
1693 Sat Mar  4 12:50:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
1694
1695         * sys-file-reader.c: Fixed bug reading compressed files.
1696
1697 Thu Mar  2 08:40:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
1698
1699         * Numerous renames.  See src/ChangeLog for details.
1700         
1701         * Moved files from src directory