1 2008-03-06 Ben Pfaff <blp@gnu.org>
3 * format-guesser.c (syntax): Require month names to be spelled out
4 as English words, so that single characters that happen to be
5 Roman numerals don't get detected as months. Thanks to John
6 Darrington for reporting this bug.
8 2008-03-04 Ben Pfaff <blp@gnu.org>
10 Patch #6441. Reviewed by John Darrington.
12 * format.c (fmt_fix): New function.
13 (fmt_fix_input): New function.
14 (fmt_fix_output): New function.
16 * format.def: Correct minimum width for DATETIME format. It was
17 7, should have been 17.
19 * automake.mk: Add new files.
21 * format-guesser.c: New file.
23 * format-guesser.h: New file.
25 2008-02-18 Ben Pfaff <blp@gnu.org>
27 Patch #6426. Reviewed by John Darrington.
29 * format.c (min_width): Renamed fmt_min_width and made public.
30 Updated all references.
31 (max_width): Renamed fmt_max_width and made public. Updated all
33 (max_decimals): Renamed fmt_max_decimals and made public. Updated
35 (var_create): Use the new functions for default variable
37 (var_default_formats): New function.
38 (var_default_measure): New function.
39 (var_default_alignment): New function.
41 * format.h (macro FMT_MAX_NUMERIC_WIDTH): New macro.
43 2008-02-09 Ben Pfaff <blp@gnu.org>
45 Add a couple of extensions to GET DATA TYPE=TXT. Patch #6412.
46 Thanks to John Darrington for review.
48 * data-in.c (data_in): Add new argument to designate the last
49 column of the data field being parsed, for use in error messages.
52 * data-parser (struct data_parser): New member `quote_escape'.
53 (data_parser_create): Initialize quote_escape.
54 (data_parser_set_quotes): New function.
55 (cut_field): Support escaped quotes.
56 (parse_delimited_span): Ditto.
57 (parse_delimited_no_span): Ditto.
59 * get-data.c (parse_get_txt): Support ESCAPE extension subcommand
60 in enhanced mode. Only support multiple quote characters in
63 2008-02-06 John Darrington <john@darrington.wattle.id.au>
65 psql-reader.c psql-reader.h: Read more than one tuple at
66 once. Fix bug reading a query which returns no data. Fix bug
67 when transformation followed a reader.
68 Ask the server for the number of records in the query, for the
71 2008-02-05 John Darrington <john@darrington.wattle.id.au>
73 psql-reader.c: So yesterday they release postgresql 8.3.0
74 which has money represented with 64 bits. They must get
77 2008-02-02 John Darrington <john@darrington.wattle.id.au>
79 psql-reader.c psql-reader.h: New files. Thanks to Ben Pfaff
80 for reviewing this code.
82 2008-02-02 Ben Pfaff <blp@gnu.org>
86 * sys-file-reader.c (read_variable_record): Allow missing values
87 to be specified on long string variables, but warn about them
88 because PSPP does not yet support them.
89 (read_extension_record): Ignore extension records 20 and 21, which
90 PSPP does not yet support.
91 (read_header): Fix error message when floating-point format cannot
94 2008-02-01 Ben Pfaff <blp@gnu.org>
96 Patch #6386. Thanks to John Darrington for review and for the
97 updates to gnumeric-reader.c.
99 * dictionary.c (make_hinted_name): New function.
100 (make_numeric_name): New function.
101 (dict_make_unique_var_name): New function.
103 * gnumeric-reader.c (devise_name): Removed.
104 (munge_name): Removed.
105 (gnumeric_open_reader): Use new function
106 dict_make_unique_var_name.
108 * short-names.c (set_var_short_name_suffix): Use new function
111 2008-01-19 John Darrington <john@darrington.wattle.id.au>
113 * settings.c settings.h: Moved static variables into a
114 single struct. Renamed functions to have a settings_ prefix.
116 2008-01-14 John Darrington <john@darrington.wattle.id.au>
118 * data-out.c (output_AHEX): Corrected number of bytes in
119 call to output_hex. Closes bug #22011
121 2008-01-02 John Darrington <john@darrington.wattle.id.au>
123 * variable.c variable.h: Replaced var_get_value_name with
124 var_append_value_name which doesn't use any static data.
125 Thanks to Ben for review.
127 2007-12-07 Ben Pfaff <blp@gnu.org>
131 * casegrouper.c (casegrouper_get_next_group): Cause a casegrouper
132 made from an empty casereader produce a casegrouper with no
133 groups, instead of one with one group that has no cases.
135 * casereader.c (casereader_is_empty): New function.
137 2007-12-06 Ben Pfaff <blp@gnu.org>
141 * sys-file-reader.c (read_display_parameters): Handle variable
142 display parameters record with only 2 data items per variable.
143 Reported by Guido Gay <gay@irer.it>.
145 2007-12-04 Ben Pfaff <blp@gnu.org>
147 * identifier.c (lex_id_match_n): New function.
148 (lex_id_match): Reimplement in terms of lex_id_match_n.
150 2007-11-24 Ben Pfaff <blp@gnu.org>
152 * automake.mk (src_data_libdata_a_SOURCES): Add val-type.h, to fix
155 2007-11-24 Ben Pfaff <blp@gnu.org>
157 Fix warning reported when reading back system files that include
158 very long string variables. Thanks to Guido Gay <gay@irer.it> for
161 * short-names.c (short_names_assign): Fix dumb typo, in which `i'
162 was written where `j' was meant.
164 2007-11-18 Ben Pfaff <blp@gnu.org>
166 Properly write variables that include a range of missing values to
167 system files. Thanks to Guido Gay <gay@irer.it> for reporting
170 * sys-file-writer.c (write_variable): Correctly calculate
171 n_missing_values field when writing variables that include a range
174 2007-11-10 Ben Pfaff <blp@gnu.org>
176 Cleanups and bug fixes devised while writing up documentation.
179 * automake.mk (src_data_libdata_a_SOURCES): Add new files.
181 * dict-class.c: New file.
182 (dict_class_from_id): Move here.
183 (dict_class_to_name): Move here.
185 * dict-class.h: New file.
186 (enum dict_class): Move here. Change from consecutive integers to
187 consecutive bits, to make testing for any of multiple values
188 easier. Add new DC_ALL constant.
190 * dictionary.c (struct dictionary): Change `case_limit' from
191 size_t to casenumber.
192 (dict_get_vars): Make final argument an enum dict_class.
193 (dict_get_vars_mutable): Ditto.
194 (dict_get_case_limit): Change return value to casenumber.
195 (dict_set_case_limit): Change final argument to a casenumber.
196 (dict_unset_split_var): Add assertion. Rephrase slightly.
197 (dict_set_label): Use xstrndup to simplify.
199 * format.c (fmt_step_width): AHEX format also needs 2-byte
201 (fmt_set_style): Simplify assertions.
203 * missing-values.c (mv_add_num_range): Rename mv_add_range.
204 Simplify implementation.
205 (mv_has_value): Simplify implementation.
206 (mv_pop_value): Remove the first value, not the last, to avoid
207 having GET followed by SAVE reverse the order of missing values.
208 (mv_peek_value): Rename mv_get_value. Simplify assertion.
209 (mv_has_range): Simplify implementation.
210 (mv_peek_range): Rename mv_get_range.
211 (can_resize_string): Removed.
212 (mv_is_resizable): Use value_is_resizable.
213 (mv_resize): Use value_resize.
215 * short-names.h (SHORT_NAME_LEN): Move here.
217 * val-type.h: New file, for definitions related to type and width
218 of abstract values. Before, these definitions were mixed among
219 those related to "union value" and those related to variables.
220 (macro SYSMIS): Move here.
221 (macro LOWEST): Move here.
222 (macro HIGHEST): Move here.
223 (macro MAX_STRING); Move here.
224 (enum val_type): New enum with values VAL_NUMERIC and VAL_STRING.
225 Replaces enum var_type that had values VAR_NUMERIC and VAR_STRING.
226 All references updated.
227 (val_type_is_valid): New function. Replaces var_type_is_valid.
228 All references updated.
229 (val_type_from_width): New function. Replaces
230 var_type_from_width. All references updated.
232 * value-labels.c (val_labs_copy): Renamed val_labs_clone. All
234 (val_labs_can_set_width): Use value_is_resizable.
235 (val_labs_add): Simply return false if the value labels set is too
236 wide, instead of having undefined behavior.
237 (val_labs_replace): Ditto.
238 (val_labs_replace): Ditto.
239 (val_labs_first): Set iterator to null if iteration is complete.
240 (val_labs_first_sorted): Ditto.
241 (val_labs_done): Become a no-op if the iterator is null.
243 * value.c (value_is_resizable): New function.
244 (value_resize): New function.
246 * variable.c (var_get_dict_class): New function.
248 * variable.h (macro LONG_NAME_LEN): Rename VAR_NAME_LEN. Update
251 2007-11-08 Ben Pfaff <blp@gnu.org>
253 * data-in.c: Make formatted data parsing locale-independent.
254 (parse_number): Use c_strtod instead of strtod, to avoid
255 locale-specific behavior.
258 2007-11-06 Ben Pfaff <blp@gnu.org>
260 Patch #6256: add support for binary, 360 file formats. Reviewed
263 * data-in.c (struct data_in): Add `encoding' member.
264 (data_in): Add `encoding' parameter, and re-encode the data passed
265 in where appropriate. Update all callers to pass it in.
266 (parse_A): Implement EBCDIC recoding wart described in manual.
267 (parse_AHEX): Implement EBCDIC recoding.
269 * data-out.c (data_out_legacy): New function.
270 (data_out): Make into a wrapper around data_out_legacy.
272 * file-handle-def.c (struct file_handle): New member `encoding'.
273 (fh_create_file): Set encoding.
274 (fh_default_properties): Set default encoding.
275 (fh_get_legacy_encoding): New function.
277 * file-handle-def.h (enum fh_mode): New modes FH_MODE_FIXED
278 (that replaces FH_MODE_BINARY), FH_MODE_VARIABLE,
279 FH_MODE_360_VARIABLE, FH_MODE_360_SPANNED.
280 (struct fh_properties): New member `encoding'.
282 2007-11-05 Ben Pfaff <blp@gnu.org>
284 Patch #6258. Reviewed by John Darrington.
286 * file-handle-def.c (fh_lock): Add comment that TYPE should be
287 marked with N_() in the caller. Added these markings to each
288 caller too. Should make i18n easier.
289 Suggested by Chusslove Illich <caslav.ilic@gmx.net>.
291 2007-11-03 Ben Pfaff <blp@gnu.org>
293 Allow output files to overwrite input files (bug #21280).
295 * file-handle-def.c: Separate locking of files for input and for
296 output, to allow both to take place at once. Also, distinguish a
297 file handle from the identity of the underlying file, because the
298 identity of a file changes over time and the file handle can't
299 represent two different identities.
300 (struct file_handle): Remove `next', `open_cnt', `deleted',
301 `type', `open_mode', `aux', `identity' members. Change `id' from
302 char array to char *. Add `ref_cnt' member.
303 (file_handle_from_ll) New function.
304 (file_handles) Removed.
305 (named_handles) New variable.
306 (fh_init) Initialize named_handles.
307 (fh_done) Remove name from all named_handles.
308 (free_handle) Updated for modified struct file_handle.
309 (unname_handle) New function.
310 (fh_ref) New function.
311 (fh_from_file_name) Removed.
312 (fh_unref) New function.
313 (fh_unname) New function.
314 (fh_from_id) Rewritten.
315 (create_handle) Updated for modified struct file_handle.
316 (fh_inline_file) Increment the handle's ref count.
317 (fh_create_file) Updated for modified struct file_handle.
318 (fh_create_scratch) Ditto.
323 (fh_is_open) Removed.
324 (fh_get_id) Updated for modified struct file_handle.
325 (fh_get_default_handle) Increment the handle's ref count.
326 (fh_set_default_handle) Handle ref counts.
327 (struct fh_lock) New structure.
328 (locks) New static var.
329 (fh_lock) New function.
330 (fh_unlock) New function.
331 (fh_lock_get_aux) New function.
332 (fh_lock_set_aux) New function.
333 (fh_is_locked) New function.
334 (make_key) New function.
335 (free_key) New function.
336 (compare_fh_locks) New function.
337 (hash_fh_lock) New function.
339 * file-handle-def.h (enum fh_access) New enum.
341 * file-name.c: Made file_identity the same in all supported
343 (struct file_identity): New `name' member.
344 (fn_get_identity): For a file that doesn't exist, get the
345 dev/inode of its directory plus its name. If even the directory
346 doesn't exist, just use its name. Merge the Windows
347 implementation into the Unix one.
348 (fn_compare_file_identities): Rewritten. Merge the Windows
349 implementation into the Unix one.
350 (fn_hash_identity): New function.
352 * make-file.c (struct replace_file): New structure.
353 (all_files): New static var.
354 (replace_file_start): New function.
355 (replace_file_commit): New function.
356 (replace_file_abort): New function.
357 (free_replace_file): New function.
358 (unlink_replace_files): New function.
360 * por-file-reader.c (struct pfm_reader): Add `lock' member.
361 (close_reader): Unlock file.
362 (pfm_open_reader): Lock file.
364 * por-file-writer.c (struct pfm_writer): Add fh_lock, replace_file
366 (pfm_open_writer): Lock file and prepare for its replacement.
367 (close_writer): Unlock file.
369 * scratch-handle.h (struct scratch_handle): Add unique_id so that
370 different generations of a scratch file can be distinguished.
372 * scratch-reader.c (scratch_reader_open): Verify that the file is
375 * scratch-writer.c (struct scratch_writer): Add `lock' and `dict',
376 remove scratch_handle member.
377 (scratch_writer_open): Lock handle. Prepare to replace handle
378 data, instead of doing it immediately.
379 (scratch_writer_casewriter_destroy): Replace handle data and
382 * sys-file-reader.c (struct sfm_reader): Add `lock' member.
383 (sfm_open_reader): Lock file.
384 (close_reader): Unlock file.
386 * sys-file-writer.c (struct sfm_writer): Add fh_lock, replace_file
388 (sfm_open_writer): Lock file and prepare for its replacement.
389 (close_writer): Unlock file.
391 2007-11-02 Ben Pfaff <blp@gnu.org>
393 * data-out.c (output_number): Use isfinite (from C99) instead of
394 gsl_isfinite, since we now have universal support for it in
396 (output_infinite): Ditto.
397 [!HAVE_ROUND] (round): Remove definition, since we now have a
398 replacement in gnulib.
400 2007-10-27 John Darrington <john@darrington.wattle.id.au>
402 * dictionary.c: Fixed bug in dict_clone, where the vardict.dict member
403 wasn't initialised correctly. Closes bugs #21330 and 21397
406 2007-10-08 Ben Pfaff <blp@gnu.org>
408 Fix bug #21280. Thanks to John Darrington for review.
410 * file-name.c (create_stream): New function.
412 * por-file-writer.c (pfm_open_writer): Use fh_open to open the
413 file handle before creating the file, to ensure that we don't
414 truncate a file that we're reading. Make code easier to read by
417 * sys-file-write.c (sfm_open_writer): Ditto.
419 2007-10-01 Ben Pfaff <blp@gnu.org>
421 Fix bug #21192. Thanks to John Darrington for review.
423 * casereader.c (casereader_read): Decrement case_cnt before
424 calling the casereader's "read" member function, so that we
425 interact properly with lazy_casereader.
427 * datasheet.c: Add regression test for above bug fix.
428 (clone_datasheet): New function.
429 (lazy_callback): New function.
430 (check_datasheet_casereader): New function.
431 (check_datasheet): Check datasheet contents are reported correctly
432 through an ordinary casereader and a lazy casereader.
433 (clone_model): Use clone_datasheet.
435 2007-09-24 Ben Pfaff <blp@gnu.org>
437 Patch #6210. Reviewed by John Darrington.
438 * settings.c: Drop "long view", which is not needed any longer.
439 (static var long_view): Removed.
440 (force_long_view): Removed.
441 (get_viewwidth): Removed.
442 (init_viewport): Removed long_view reference.
444 2007-09-19 John Darrington <john@darrington.wattle.id.au>
446 * settings.c settings.h: Changed viewport's length and width to be
447 owned by the user interface which uses the data library. This allows
448 better abstraction, and makes dynamically adjustable dimensions easier.
450 2007-09-18 Ben Pfaff <blp@gnu.org>
452 * procedure.c (proc_extract_active_file_data): New function.
454 * lazy-casereader.h: New file.
456 * lazy-casereader.c: New file.
458 * casereader.c (casereader_dynamic_cast): New function.
460 2007-09-14 Ben Pfaff <blp@gnu.org>
462 * dictionary.c (dict_clone): Copy case indexes from cloned
463 dictionary. Fixes bug #21061. Reviewed by John Darrington.
465 2007-09-13 John Darrington <john@darrington.wattle.id.au>
467 * value.c value.h (create_value): New function.
469 2007-09-12 Ben Pfaff <blp@gnu.org>
471 Make it clear that translator casereader and casewriter translate
472 functions are supposed to destroy their input case.
474 * casereader-translator.c (struct casereader_translator): Change
475 input case parameter of translate member function from const
476 struct ccase * to struct ccase *.
477 (casereader_create_translator): Ditto, for translate parameter.
479 * casewriter-translator.c (struct casewriter_translator): Ditto.
480 (casewriter_create_translator): Ditto.
482 2007-08-27 John Darrington <john@darrington.wattle.id.au>
484 * sys-file-reader.c (read_display_parameters): Force display width
485 to 8, if the sys file says 0 (like SPSS does).
487 2007-08-12 Ben Pfaff <blp@gnu.org>
489 * dictionary.c (dict_dump): New function.
491 2007-08-12 Ben Pfaff <blp@gnu.org>
493 Drop dict_compactor in favor of using the new struct case_map.
495 * dictionary.c (struct copy_map): Removed.
496 (struct dict_compactor): Removed.
497 (dict_make_compactor): Removed.
498 (dict_compactor_compact): Removed.
499 (dict_compactor_destroy): Removed.
501 * procedure.c (struct data_set): Change `compactor' member to be a
503 (proc_open): Use case_map_to_compact_dict instead of
505 (proc_casereader_read): Use case_map_execute instead of
506 dict_compactor_compact.
507 (proc_commit): Use case_map_destroy instead of
508 dict_compactor_destroy.
510 * scratch-writer.c (struct scratch_writer): Change `compactor'
511 member to be a struct case_map *.
512 (scratch_writer_open): Use case_map_to_compact_dict instead of
514 (scratch_writer_casewriter_write): Use case_map_execute instead of
515 dict_compactor_compact.
517 2007-08-12 Ben Pfaff <blp@gnu.org>
519 * automake.mk: Add case-map.c, case-map.h.
521 * case-map.c: New file.
523 * case-map.h: New file.
525 2007-08-12 Ben Pfaff <blp@gnu.org>
527 * dictionary.c (dict_compact_values): Don't delete scratch
528 variables as well as compacting case indexes. Update all callers.
529 (dict_get_compacted_value_cnt): Rename dict_count_values and
530 change interface. Update all callers.
531 (dict_get_compacted_value_cnt): Remove.
532 (dict_compacting_would_shrink): Remove.
533 (dict_compacting_would_change): Remove.
534 (dict_make_compactor): Add new parameter. Update all callers.
536 * procedure.c (proc_casereader_read): Use casewriter_get_value_cnt
537 instead of dict_count_values, changing an O(N) operation into
540 2007-08-12 Ben Pfaff <blp@gnu.org>
542 * casereader.c (casereader_read): Don't require cases read by a
543 casereader to be exactly the expected size: as long as they're big
546 2007-08-12 Ben Pfaff <blp@gnu.org>
548 Make casewriters keep track of the number of `union value's in
549 each case. This is useful for two reasons: casewriter_write can
550 then check that the case being written is large enough, and later
551 recipients of the casewriter can determine the size of the case.
553 * casewriter-translator.c (casewriter_create_translator): Add
556 * casewriter.c (struct casewriter): Add value_cnt member.
557 (casewriter_write): Check that the case passed in is big enough.
558 (casewriter_get_value_cnt): New function.
559 (casewriter_create): Add value_cnt parameter.
561 2007-08-09 Ben Pfaff <blp@gnu.org>
563 Fix bug reported by Jason Stover.
564 * settings.c: Move get_termcap_viewport and in particular the
565 #include for <curses.h> to the end of the file. curses.h
566 redefines bool on some systems (e.g. OpenBSD), which causes
567 disagreement between uses of bool before its inclusion and
569 Tested by Jason Stover.
571 2007-07-29 Ben Pfaff <blp@gnu.org>
573 Provisional fix for bug #18692 and bug #20161. Reviewed by John
576 * file-name.c (fn_open): Only pass "r" or "w" to popen as mode
577 argument (never "rb" or "wb") because SUSv3 says that only those
578 modes are defined, and glibc in fact rejects other modes.
580 Open portable files with fn_open so that they can be read from
581 pipes. Fix missing fh_close call to go along with fh_open.
582 Report an error if the file close reports an error.
583 * por-file-reader.c (close_reader): New function.
584 (por_file_casereader_destroy): Use close_reader.
585 (pfm_open_reader): Open file with fn_open.
587 2007-07-28 Ben Pfaff <blp@gnu.org>
589 Make PSPP able to read all the portable files I could find on the
590 web. Thanks to John Darrington for review. Bug #17620.
591 * por-file-reader.c (struct pfm_reader): New member `line_length'.
592 (error): Print file offset in hexadecimal.
593 (warning): New function.
594 (advance): Treat lines less than 80 bytes long as padded to 80
596 (pfm_open_reader): Call read_documents if we find an "E" record.
597 (convert_format): Convert invalid formats to the default format
598 instead of aborting reading the file.
599 (read_variables): Rename duplicate variable names instead of
600 aborting reading the file.
601 (read_value_label): Allow string variables of different widths to
602 be assigned value labels in the same record. Replace duplicate
603 value labels instead of aborting.
604 (read_documents): New function.
606 * por-file-writer.c (pfm_open_writer): Call write_documents if the
607 dictionary has documents.
608 (write_documents): New function.
610 2007-07-25 Ben Pfaff <blp@gnu.org>
612 Fix bugs related to bug #17213.
614 * settings.c: Use HAVE_LIBNCURSES instead of HAVE_LIBTERMCAP,
615 since the former is what config.h has. Include the needed ncurses
617 (static var echo) Rename to `do_echo' because the original name is
618 the same as an ncurses identifier.
619 (get_termcap_viewport) Use error instead of msg.
621 * file-name.c (fn_interp_vars): Fix interpolation of $VARS.
622 (fn_close): Don't close stdin, stdout, stderr.
624 2007-07-26 John Darrington <john@darrington.wattle.id.au>
626 * procedure.c procedure.h: Added callbacks which get invoked whenever
627 a dataset's transformation chain changes.
629 2007-07-24 Ben Pfaff <blp@gnu.org>
632 * sys-file-writer.c (write_variable_display_parameters): Use new
633 var_default_display_width function to choose display width of
634 segments after the first one in a given variable.
635 * variable.c (var_create): Use var_default_display_width to pick
636 new variable's display width.
637 (var_default_display_width): New function.
638 Reviewed by John Darrington.
640 2007-07-24 Ben Pfaff <blp@gnu.org>
643 * por-file-writer.c (write_variables): Write weight variable.
644 Reviewed by John Darrington.
646 2007-07-23 Ben Pfaff <blp@gnu.org>
648 Improvements to system file reader and writer.
650 First, move all detailed knowledge of very long strings into
651 sys-file-private.[ch], so that this nasty stuff can be isolated.
653 * sys-file-private.c (REAL_VLS_CHUNK): New macro.
654 (EFFECTIVE_VLS_CHUNK): New macro.
655 (min_int): New function.
656 (max_int): New function.
657 (sfm_width_to_bytes): Rewrite.
658 (sfm_width_to_octs): New function.
659 (sfm_segment_alloc_width): New function.
660 (sfm_segment_alloc_bytes): New function.
661 (sfm_segment_used_bytes): New function.
662 (sfm_segment_offset): New function.
663 (sfm_segment_effective_offset): New function.
664 (sfm_dictionary_to_sfm_vars): New function.
666 * sys-file-private.h (MIN_VERY_LONG_STRING): Removed.
667 (EFFECTIVE_LONG_STRING_LENGTH): Removed.
668 (struct sfm_var): New structure.
670 Next, improvements to the system file reader.
672 * sys-file-reader.h (struct sfm_read_info): Changed `case_cnt' to
673 type casenumber. Added `version_major', `version_minor',
676 * sys-file-reader.c (struct sfm_reader): Replaced `flt64_cnt' by
677 `oct_cnt'. Rename `vars', `var_cnt' to `sfm_vars', `sfm_var_cnt'.
678 Change `case_cnt' to type casenumber. Removed `has_vls'.
679 (struct sfm_var): Removed.
680 (sfm_open_reader): Don't warn on wrong case size if the file was
681 written by SPSS 13, which tends to get it wrong. Use
682 sfm_dictionary_to_sfm_vars.
683 (read_header): Always output system file info.
684 (read_variable_record): Simplify code for reading missing values.
685 (read_machine_int32_info): Save version numbers from system file
686 into info struct passed as new argument.
687 (read_long_string_map): Restructured to use new sys-file-private
689 (read_value_labels): Use size_overflow_p.
690 (sys_file_casereader_read): Get rid of distinction between fast
691 and slow paths. Use information provided by sys-file-primate's
692 struct sfm_var to simplify code.
693 (skip_whole_strings): New function.
694 (read_int32): Renamed read_int. Changed return value to int.
696 (read_flt64): Renamed read_float. Changed return value to
697 double. Updated all callers.
698 (int32_to_native): Removed. Changed callers to use
700 (flt64_to_double): Removed. Changed callers to use float_convert.
702 Finally, get rid of int32, flt64 terminology and types in system
703 file writer. The former wasn't very useful since a POSIX "int"
704 can hold the whole range of int32 and we generally didn't have a
705 need for it to be exactly-32-bits, just at-least-32-bits. The
706 latter was inconvenient because we had to assume that it could be
707 different from double and thereby convert special values SYSMIS,
708 HIGHEST, LOWEST to and from it in multiple places. Instead, now
709 we just use "int" and "double" in most places, and do conversions,
710 if necessary, very close to where we do I/O. This change meant
711 that the writer code couldn't represent records in the file as C
712 structs any longer, but that's no great loss. The code actually
713 seems to be more readable without them.
715 Simplify the compression buffering code: only buffer as much as
716 necessary, which is no more than eight 8-byte units at any given
719 * sys-file-writer.c (typedef flt64): Removed.
720 (macro second_lowest_flt64): Removed.
721 (struct sysfile_header): Removed.
722 (struct sysfile_variable): Removed.
723 (struct sfm_writer): Removed `needs_translation', `has_vls',
724 `flt64_cnt'. Changed `compress' to type bool and `case_cnt' to
725 type casenumber. Renamed `vars' to `sfm_vars', `var_cnt' to
726 `sfm_var_cnt'. Replaced `buf', `end', `ptr', `x', `y' for
727 compression buffering by `opcodes', `opcode_cnt', `data',
728 `data_cnt'. Renamed `var_cnt_vls' as `segment_cnt'.
729 (sfm_open_writer): Use sfm_dictionary_to_sfm_vars. Use simple
730 data writer functions instead of structures.
731 (calc_oct_idx): New function.
732 (write_header): Use simple data writer functions instead of
734 (write_format_spec): Renamed write_format. New argument.
735 (write_variable_continuation_records): New function.
736 (write_variable): Use simple data writer functions instead of
737 structures. Use write_variable_continuation_records. Write
738 entire very long string instead of requiring caller to understand
740 (write_value_labels): Use simple data writer functions instead of
742 (write_documents): Ditto.
743 (write_variable_display_parameters): Use sys-file-private
744 functions to simplify. Use simple data writer functions instead
746 (write_vls_length_table): Use simple data writer functions instead
748 (write_longvar_table): Ditto.
749 (write_rec_7_34): Break into new functions
750 write_integer_info_record, write_float_info_record. Use simple
751 data writer functions instead of structures.
752 (buf_write): Removed.
753 (append_string_max): Removed.
754 (ensure_buf_space): Removed.
755 (sys_file_casewriter_write): Get rid of the distinction between
756 fast and slow paths, which didn't seem to be too useful. Use new
757 functions write_case_uncompressed, write_case_compressed.
758 (put_instruction): Removed.
759 (put_element): Removed.
760 (write_compressed_data): Removed.
761 (close_writer): Use flush_compressed. Only write case count to
762 system file if it will fit in the field.
763 (write_case_compressed): New function.
764 (write_case_uncompressed): New function.
765 (flush_compressed): New function.
766 (put_cmp_opcode): New function.
767 (put_cmp_number): New function.
768 (write_int): New function.
769 (convert_double_to_output_format): New function.
770 (write_float): New function.
771 (write_value): New function.
772 (write_string): New function.
773 (write_bytes): New function.
774 (write_zeros): New function.
775 (write_spaces): New function.
777 Reviewed by John Darrington.
779 2007-07-22 Ben Pfaff <blp@gnu.org>
781 Don't try to write very long strings to portable files. The
782 format does not support it.
784 * por-file-writer.c (MAX_POR_WIDTH): New macro.
785 (pfm_open_writer): Limit output width to MAX_POR_WIDTH.
786 (write_format): Add arg to take width to resize format to.
787 (write_value): Limit width of value written to MAX_POR_WIDTH.
788 (write_variables): Limit width of variable and its output formats
790 Reviewed by John Darrington.
792 2007-07-22 Ben Pfaff <blp@gnu.org>
794 * sys-file-reader.c (read_variable_to_value_map): Use max_warnings
795 local variable instead of literal 5.
796 Reviewed by John Darrington.
798 2007-07-22 Ben Pfaff <blp@gnu.org>
800 Fix problems with uniqueness of short names in system files with
801 very long string variables. Now a variable may have multiple
804 * automake.mk (src_data_libdata_a_SOURCES): Add new files
805 short-names.c, short-names.h.
807 * dictionary.c (dict_clone): Clone all the short names.
808 (compare_strings): Move into short-names.c.
809 (hash_strings): Ditto.
810 (set_var_short_name_suffix): Ditto.
811 (dict_assign_short_names): Ditto, rename short_names_assign,
812 change to assign all short names.
814 * por-file-writer.c (write_variables): Use short_names_assign
815 instead of dict_assign_short_names.
817 * short-names.c: New file.
819 * short-names.h: New file.
821 * sys-file-private.c (sfm_width_to_segments): New function.
823 * sys-file-reader.c (read_long_var_name_map): Save and restore all
824 the short names, not just the first one.
826 * sys-file-writer.c (cont_var_name): Removed.
827 (sfm_open_writer): Use short_names_assign instead of
828 dict_assign_short_names. Use unique short names assigned by
829 short_names_assign instead of those generated by cont_var_name.
831 * variable.c (struct variable): Remove `short_name' member,
832 replace by `short_names' and `short_name_cnt'.
833 (var_create) Initialize new members.
834 (var_get_short_name_cnt): New function.
835 (var_get_short_name): Now takes an index argument. Changed most
837 (var_set_short_name): Ditto.
838 (var_clear_short_name): Renamed var_clear_short_names, changed to
839 clear all short names.
841 Reviewed by John Darrington.
843 2007-07-22 Ben Pfaff <blp@gnu.org>
845 * variable.c (var_set_width): Use new var_set_width function.
847 * missing-values.c (mv_n_values): Drop assertion, which was not
850 * format.c (fmt_default_for_width): New function.
851 (fmt_resize): New function.
853 Reviewed by John Darrington.
855 2007-07-18 John Darrington <john@darrington.wattle.id.au>
857 * datasheet.c (datasheet_delete_columns): Added assertion to check
858 we're not deleting outside the range of the sheet.
861 * dictionary.c dictionary.h variable.c: Added the ability for string
862 variables to be resized.
864 * vardict.h: Added some prototypes (moved from dictionary.h) as
865 these should only be called by variable.c
868 2007-07-14 John Darrington <john@darrington.wattle.id.au>
870 * sfm-reader.c: Respect case_cnt field in file header.
872 2007-07-01 John Darrington <john@darrington.wattle.id.au>
874 * transformation.c transformation.h (trns_chain_execute): Changed the
875 signature (Patch #6057)
877 2007-06-10 Ben Pfaff <blp@gnu.org>
879 * casereader-filter.c (casereader_filter_destroy): Make sure to
880 write all the remaining excluded cases to the casewriter, if any.
882 * caseinit.c (init_list_destroy): Rewrite.
883 (init_list_clear): Ditto.
885 * casegrouper.c (casegrouper_get_next_group): Always set *reader
886 to null when returning false.
888 2007-06-06 Ben Pfaff <blp@gnu.org>
890 Actually implement the new procedure code and adapt all of its
891 clients to match. Also adapt all of the other case sources and
892 sinks in the tree and their clients to use the
893 casereader/casewriter infrastructure.
895 * automake.mk: Add and remove files.
897 * any-reader.c: Change into a casereader.
898 * por-file-reader.c: Ditto.
899 * scratch-reader.c: Ditto.
900 * sys-file-reader.c: Ditto.
902 * any-writer.c: Change into a casewriter.
903 * por-file-writer.c: Ditto.
904 * scratch-writer.c: Ditto.
905 * sys-file-writer.c: Ditto.
907 * procedure.c: Change to use casereader, casewriter, caseinit, and
908 other new infrastructure.
910 * scratch-handle.c: Adapt to new infrastructure.
912 * case-sink.c: Removed, now dead code.
913 * case-sink.h: Ditto.
914 * case-source.c: Ditto.
915 * case-source.h: Ditto.
916 * casefile-factory.c: Ditto.
917 * casefile-private.h: Ditto.
920 * casefilter.c: Ditto.
921 * casefilter.h: Ditto.
924 * fastfile-factory.c: Ditto.
925 * fastfile-factory.h: Ditto.
926 * storage-stream.c: Ditto.
927 * storage-stream.h: Ditto.
929 2007-06-06 Ben Pfaff <blp@gnu.org>
933 * automake.mk: Add new files.
935 * datasheet.c: New file.
937 * datasheet.h: New file.
939 2007-06-06 Ben Pfaff <blp@gnu.org>
941 Until now, the procedure code has provided a case to the
942 case_source, which has filled in the data values that come from
943 the active file. "Left" data values that don't come from the
944 active file naturally stay the same from case to case, because the
945 procedure code keeps using that same case.
947 One of the compromises that comes with the new procedure code is
948 that the active file allocates and provides its own case, which
949 the procedure code then has to resize to provide room for any
950 other variables that should go in the case and then fill in the
951 values of "left" variables. Then, when we're done with that case,
952 we have to save the values of "left" variables to copy into the
953 next case read from the active file.
955 The caseinit code helps with this.
957 * automake.mk: Add new files.
959 * caseinit.c: New file.
961 * caseinit.h: New file.
963 2007-06-06 Ben Pfaff <blp@gnu.org>
965 * value.h (value_cnt_from_width): New function.
967 * variable.c (var_get_value_cnt): Use new function.
969 2007-06-06 Ben Pfaff <blp@gnu.org>
971 Add casegrouper, to allow cases read from a given casereader to be
972 broken into groups, each of which has its own casereader.
973 Generally cases are grouped based on having equal values for some
976 * automake.mk: Add new files.
978 * casegrouper.c: New file.
980 * casegrouper.h: New file.
982 2007-06-06 Ben Pfaff <blp@gnu.org>
984 Add interface to lexicographical ordering of cases.
986 * automake.mk: Add new files.
988 * case-ordering.c: New file.
990 * case-ordering.h: New file.
992 2007-06-06 Ben Pfaff <blp@gnu.org>
994 Add casereaders and casewriters, the basis of the new data processing
995 implementation. A casereader is a uniform interface to reading cases
996 from a data source; a casewriter is a uniform interface to writing
997 cases to a data sink.
999 * automake.mk: Add new files.
1001 * casereader-filter.c: New file.
1003 * casereader-provider.h: New file.
1005 * casereader-translator.c: New file.
1007 * casereader.c: New file.
1009 * casereader.h: New file.
1011 * casewriter-provider.h: New file.
1013 * casewriter-translator.c: New file.
1015 * casewriter.c: New file.
1017 * casewriter.h: New file.
1019 2007-06-06 Ben Pfaff <blp@gnu.org>
1021 "casewindow" data structure that extends the deque (from libpspp)
1022 of cases with the ability to dump cases to disk if we get too many
1025 * automake.mk: Add new files.
1027 * casewindow.c: New file.
1029 * casewindow.h: New file.
1031 2007-06-06 Ben Pfaff <blp@gnu.org>
1033 sparse_cases data structure that augments a sparse_array of cases
1034 with the ability to dump cases to disk if we get too many cases in
1037 * automake.mk: Add new files.
1039 * sparse-cases.c: New file.
1041 * sparse-cases.h: New file.
1043 2007-06-06 Ben Pfaff <blp@gnu.org>
1045 Adds a low-level on-disk case array data structure.
1047 * automake.mk: Add new files.
1049 * case-tmpfile.c: New file.
1051 * case-tmpfile.h: New file.
1053 2007-06-06 Ben Pfaff <blp@gnu.org>
1055 In a couple of places we calculate the maximum number of cases to
1056 keep in memory based on the user-defined workspace. Enable
1057 centralizing the calculation through a new function.
1059 * settings.c (get_workspace_cases): New function.
1061 2007-06-06 Ben Pfaff <blp@gnu.org>
1063 The casenumber type is defined in transformations.h, but case.h is
1064 a more sensible place. Move it.
1066 * case.h (CASENUMBER_MAX): New macro.
1067 (typedef casenumber): Move here, from transformations.h.
1069 2007-06-03 Ben Pfaff <blp@gnu.org>
1071 Slightly generalize case_to_values and case_from_values functions.
1073 * case.c (case_to_values): Rename case_copy_out, change interface.
1074 (case_from_values): Rename case_copy_in, change interface.
1076 * fastfile.c (fastfilereader_get_next_case): Update caller.
1077 (write_case_to_disk): Ditto.
1079 2007-06-02 Ben Pfaff <blp@gnu.org>
1081 Clean up after a forgotten part of patch #5829.
1083 * casedeque.h: Remove unused file.
1085 * automake.mk: Remove casedeque.h from sources.
1087 2007-05-10 Jason Stover <jhs@math.gcsu.edu>
1089 * category.c: Removed redundant #include
1091 2007-05-06 Ben Pfaff <blp@gnu.org>
1093 Abstract the documents within a dictionary a little better.
1094 Thanks to John Darrington for suggestion, initial version, and
1095 review. Patch #5917.
1097 * dictionary.c (struct dictionary): Change `documents' member from
1098 char * to struct string.
1099 (dict_clear): Destroy struct string.
1100 (dict_get_documents): Convert struct string to char *.
1101 (dict_set_documents): Set struct string. Pad to 80-character
1103 (dict_clear_documents): New function.
1104 (dict_add_document_line): New function.
1105 (dict_get_document_line_cnt): New function.
1106 (dict_get_document_line): New function.
1108 * dictionary.h (macro DOC_LINE_LENGTH): New macro.
1110 * sys-file-reader.c (read_documents): Use new document functions.
1112 2007-04-19 John Darrington <john@darrington.wattle.id.au>
1114 * sys-file-reader.c: When reading a system file which has no
1115 long name table, automatically create one where the long names
1116 are the lower case versions of the short names.
1118 2007-04-22 Ben Pfaff <blp@gnu.org>
1120 * dictionary.c (dict_set_split_vars): dict_destroy expects that
1121 dict_clear will free most data related to the dictionary.
1122 dict_clear does a decent job, except that dict_set_split_vars on
1123 some systems won't actually free the dict's "split" member.
1124 Instead, it'll allocate a 1-byte region. Fix this.
1126 * value.c (value_copy): New function.
1127 (value_set_missing): Ditto.
1129 2007-04-22 John Darrington <john@darrington.wattle.id.au>
1131 * Deleted existing category.h and moved cat-routines.h into
1132 category.h Encapsulated struct cat_vals better.
1134 2007-04-19 John Darrington <john@darrington.wattle.id.au>
1136 * sys-file-reader.c: When reading a system file which has no
1137 long name table, automatically create one where the long names
1138 are the lower case versions of the short names.
1140 2007-04-16 John Darrington <john@darrington.wattle.id.au>
1142 * sys-file-reader.c: Some versions of Other Software seem to
1143 produce system files with string variables' measure set to
1144 zero. We'll assume these are supposed to be nominal variables.
1146 2007-03-30 Ben Pfaff <blp@gnu.org>
1148 * procedure.c: Adapt to new deque data structure.
1150 Mon Feb 19 10:53:21 2007 John McCabe-Dansted <gmatht@gmail.com>
1151 Ben Pfaff <blp@gnu.org>
1153 * file-name.c: Mingw compatibility fixes.
1154 (fn_search_path): Use ISSLASH instead of comparing against '/'
1156 (fn_dir_name): Use dir_name from gnulib.
1157 (fn_is_absolute): Use IS_ABSOLUTE_FILE_NAME from gnulib.
1158 (fn_get_identity): Use GetFullPathName instead of canonicalize
1159 from gnulib, because the latter does not fully support
1160 Windows-style path names. Use this implementation based on the
1161 detected presence of Windows instead of the absence of Unix, since
1162 the new implementation is Windows-specific.
1163 (fn_compare_file_identities): In Windows implementation, compare
1164 names case-insensitively.
1166 Sun Feb 18 13:28:02 2007 Ben Pfaff <blp@gnu.org>
1168 * make-file.c: Don't include mkstemp.h, because gnulib now causes
1169 <stdlib.h> to have the same effect.
1171 Sun Feb 18 11:20:24 2007 Ben Pfaff <blp@gnu.org>
1173 * por-file-reader.c: Add missing _() around messages.
1175 Sun Feb 11 20:44:13 2007 Ben Pfaff <blp@gnu.org>
1177 * make-file.c: Include "mkstemp.h", without which linking on
1180 Thu Feb 8 14:59:05 2007 Ben Pfaff <blp@gnu.org>
1182 Reduce platform dependence.
1184 * file-name.c (fn_tilde_expand): Removed, and removed calls to it.
1185 Everywhere we using this, we really should have just depended on
1186 the shell to expand tildes.
1187 (fn_search_path): Simplify, given that we don't do tilde expansion
1189 (fn_normalize): Removed. Caller changed to use the canonicalize
1191 (fn_get_cwd): Removed. Only user was fn_normalize.
1192 (fn_is_absolute): Really only test for absolute names.
1193 (fn_is_special): Use pipe files if HAVE_POPEN, not if we're in
1195 (fn_readlink): Removed, as it was only used fn_normalize.
1196 (fn_exists): Assume the stat function is available; gnulib does.
1197 (fn_open): Use pipe files if HAVE_POPEN, not if we're in unix.
1199 Sat Feb 3 21:52:17 2007 Ben Pfaff <blp@gnu.org>
1201 * dictionary.c (dict_create_vector_assert): New function.
1203 Wed Feb 7 21:25:15 2007 Ben Pfaff <blp@gnu.org>
1205 * file-name.c (fn_normalize): Correct name of function
1206 fn_is_special. Thanks to John McCabe-Dansted <gmatht@gmail.com>
1207 for pointing this out.
1209 Thu Feb 1 16:53:37 2007 Ben Pfaff <blp@gnu.org>
1211 We are using a single member in struct file_handle, the "name"
1212 field, for more than one purpose. When it begins with '"', it's a
1213 file name; otherwise, it's a token that can be used to identify
1214 it. When that assertion fires, it's because we searched for the
1215 name case-sensitively as a file name (so that there was no match),
1216 and then we try to insert it case-insensitively as a token, which
1217 fails because duplicates aren't allowed.
1219 Solution: break the two purposes into two separate fields. This
1220 fixes the problem and likely makes the code easier to read too.
1222 Fixes bug #18922. Thanks to John Darrington for bug report and
1225 * file-handle-def.c (struct file_handle): New `id' member.
1226 (fh_from_name): Rename fh_from_id. Update all callers.
1227 (create_handle): New `id' parameter. Update all callers.
1228 (fh_create_file): Ditto.
1229 (fh_get_id): New function.
1231 Mon Jan 15 16:18:10 2007 Ben Pfaff <blp@gnu.org>
1233 * case.c (case_is_null): Change return type to bool.
1235 Mon Jan 15 10:57:28 2007 Ben Pfaff <blp@gnu.org>
1239 * case.c (case_clone) [DEBUGGING]: When debugging, don't use
1240 reference counting to share data. This makes it easy for
1241 valgrind, etc. to find accesses to cases that have been destroyed
1242 but have been kept around by another user's ref-count. This often
1243 happens when the data set is small enough to find in memory; if a
1244 bigger data set that would overflow to disk were used, then data
1245 corruption would occur.
1247 Mon Jan 15 10:55:18 2007 Ben Pfaff <blp@gnu.org>
1251 * case.c (case_unshare): Make it check internally whether the
1252 ref_cnt is greater than 1, so that the callers don't have to.
1253 Update callers not to check.
1255 Mon Jan 15 10:53:01 2007 Ben Pfaff <blp@gnu.org>
1257 Before, I was thinking that I might want to get rid of reference
1258 counting at some point. Now, I'm pretty sure that it's here to
1259 stay. Thus, because we have to store the value_cnt anyway for
1260 reference-counted cases, we might as well expose it to users.
1262 * case.c (case_get_value_cnt): New function.
1263 (case_resize): Drop OLD_CNT argument. Update all callers. Only
1264 resize case if its size actually changed.
1266 * casefile.c (casefile_append_xfer): Use case_get_value_cnt
1267 instead of peeking inside struct case directly.
1268 (casefile_append): Ditto.
1270 Mon Jan 15 10:50:22 2007 Ben Pfaff <blp@gnu.org>
1272 Get rid of the inlines for the case functions, which made the
1273 header file hard to read. (Also, in testing with "-O2 -DNDEBUG",
1274 the inlines didn't speed up "make check" at all, which is not a
1275 perfect benchmark but seems indicative.)
1277 * case.c: Remove #ifdef DEBUGGING...#endif around many function
1278 definitions. Remove some assertions on nonnull pointers that were
1279 redundant with a pointer dereference soon after in the function.
1281 (struct case_data): Move definition here from case.h.
1285 (case_data_wr): Ditto.
1287 Sun Jan 14 21:41:12 2007 Ben Pfaff <blp@gnu.org>
1289 * automake.mk: Add casedeque.h to sources.
1291 * casedeque.h: New file.
1293 * procedure.c: (struct dataset) Change lag_count, lag_head,
1294 lag_queue member into single struct casedeque member. Update all
1295 users to use the casedeque instead.
1298 Sun Jan 14 21:43:12 2007 Ben Pfaff <blp@gnu.org>
1300 * procedure.c: Simplify lagged cases interface. Updated all
1301 clients--well, the only client--to use the simplified interface.
1302 (dataset_n_lag) Removed.
1303 (dataset_set_n_lag) Removed.
1304 (dataset_need_lag) New function.
1306 Tue Jan 9 07:20:05 WST 2007 John Darrington <john@darrington.wattle.id.au>
1308 * dictionary.c procedure.c: More changes to ensure that callbacks occur
1309 whenever appropriate, but only when the dataset/dictionary is in a
1312 Sun Jan 7 08:33:04 WST 2007 John Darrington <john@darrington.wattle.id.au>
1314 * dictionary.c dictionary.h : Added callbacks for change of filter and
1315 split variables. Refactored some code to ensure that callbacks get
1316 invoked when appropriate.
1318 * procedure.c (proc_cancel_temporary_transformations): Make sure that
1319 replace_dict callback occurs when permanent_dict replaces the current
1322 Wed Jan 3 11:02:11 WST 2007 John Darrington <john@darrington.wattle.id.au>
1324 * dictionary.c dictionary.h : Added callback for when the weight
1325 variable of a dictionary changes.
1327 Mon Jan 1 10:36:26 WST 2007 John Darrington <john@darrington.wattle.id.au>
1329 * dictionary.c dictionary.h : Added replace_source and replace_dict
1330 callbacks, and functions to deal with them.
1332 Fri Dec 22 13:56:08 2006 Ben Pfaff <blp@gnu.org>
1334 Simplify missing value handling.
1336 * missing-values.h (enum mv_class): New type.
1337 (enum mv_type): Moved definition into missing-values.c and renamed
1338 each MV_* to MVT_*, to distinguish them from the exposed mv_class
1339 enums. Updated all uses.
1340 (struct missing_values): Changed type of `type' from `enum
1341 mv_type' to `int' because the definition is no longer exposed.
1343 * missing-values.c (mv_is_value_missing): Add new enum mv_class
1344 parameter. Update all callers.
1345 (mv_is_num_missing): Ditto.
1346 (mv_is_str_missing): Ditto.
1347 (mv_is_value_user_missing): Removed. Changed callers to use
1348 mv_is_value_missing.
1349 (mv_is_num_user_missing): Removed. Changed callers to use
1351 (mv_is_str_user_missing): Removed. Changed callers to use
1353 (mv_is_value_system_missing): Removed. Changed callers to use
1354 mv_is_value_missing.
1355 (mv_set_type): Removed. Changed callers to use mv_clear.
1356 (mv_clear): New function.
1358 * variable.c (var_is_value_missing): Add new enum mv_class
1359 parameter. Update all callers.
1360 (var_is_num_missing): Ditto.
1361 (var_is_str_missing): Ditto.
1362 (var_is_value_user_missing): Removed. Changed callers to use
1363 var_is_value_missing.
1364 (var_is_num_user_missing): Removed. Changed callers to use
1366 (var_is_str_user_missing): Removed. Changed callers to use
1368 (var_is_value_system_missing): Removed. Changed callers to use
1369 var_is_value_missing.
1371 * casefilter.c (struct casefilter): Use enum mv_class in place of
1373 (casefilter_variable_missing): Adapt to new member.
1374 (casefilter_create): Change signature to take enum mv_class,
1377 Fri Dec 22 20:08:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
1379 * casefile-factory.h fastfile-factory.c fastfile-factory.h: New files.
1381 * case-sink.c case-sink.h procedure.c procedure.h
1382 storage-stream.c: Now uses the factory.
1384 Sat Dec 16 22:05:18 2006 Ben Pfaff <blp@gnu.org>
1386 Make it possible to pull cases from the active file with a
1387 function call, instead of requiring indirection through a callback
1390 * case-source.h (struct case_source_class): Change ->read function
1391 to return a single case, instead of calling a callback function
1392 for each case. Change ->destroy function to return an error
1395 * case-source.c (free_case_source): Pass along the value returned
1396 by the case_source ->destroy function.
1398 * procedure.c (struct write_case_data): Removed.
1399 (struct dataset): Added some members to track procedure state.
1400 (procedure): Optimize the trivial case at this level.
1401 (internal_procedure): Re-implement in terms of proc_open,
1402 proc_read, proc_close.
1403 (proc_open) New function.
1404 (proc_read) New function.
1405 (proc_close) New function.
1406 (write_case) Moved into proc_read.
1407 (close_active_file) Moved closing of data source into proc_close.
1409 * storage-source.c: Rewrote to conform with modified
1410 case_source_class interface.
1412 * transformations.c (trns_chain_execute): Added argument to allow
1413 starting execution from an arbitrary transformation. Updated
1416 * transformations.h (enum TRNS_NEXT_CASE) Renamed TRNS_END_CASE.
1418 Sat Dec 16 14:09:25 2006 Ben Pfaff <blp@gnu.org>
1420 * sys-file-reader.c (read_display_parameters): Don't assume that
1421 MEASURE_* and ALIGN_* have the same values found in system files.
1423 * sys-file-writer.c (write_variable_display_parameters): Ditto.
1425 * variable.h: Change MEASURE_NOMINAL, MEASURE_ORDINAL,
1426 MEASURE_SCALE to be 0-based instead of 1-based. This also fixes
1427 the value of n_MEASURES, which was off by 1 (at least from my
1430 Sat Dec 16 12:17:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
1432 * dictionary.c dictionary.h vardict.h variable.c: Added optional
1433 callbacks which are invoked when the dictionary or its
1434 variables are changed.
1436 * missing-values.c missing-values.h value-labels.c: Tidied up
1437 consistency checks, and made some of them return false
1438 instead of assert-failing.
1440 Wed Dec 13 19:30:11 2006 Ben Pfaff <blp@gnu.org>
1442 * calendar.c (calendar_days_in_month): New function.
1444 Mon Dec 11 07:53:39 2006 Ben Pfaff <blp@gnu.org>
1446 * value-labels.c (hash_int_val_lab): Only hash as many bytes as
1447 the value label's width.
1449 Sun Dec 10 14:21:29 2006 Ben Pfaff <blp@gnu.org>
1451 * sfm-private.h: Move contents into sys-file-writer.c, which is
1452 the only remaining user. Removed Borland C++-specific directives.
1454 * sys-file-reader.c: Clean up and rewrite entire file. The
1455 rewritten version is simpler and better abstracted, and should be
1456 easier to maintain and extend. It avoids using structures to read
1457 file data, which is prone to padding variations among compilers.
1458 It should also handle non-IEEE 754 system files, although I
1459 haven't been able to find any. It has been tested against many
1460 .sav files obtained from the Web and found to produce the same
1461 results as the earlier version of the code, or in some cases
1462 improved results. It is more tolerant of format variations found
1465 * sys-file-reader.h (struct sfm_read_info): Removed `big_endian'
1466 member, putting an enum integer_format in its place. New member
1467 `float_format'. Changed `compressed' member to type bool.
1469 Sun Dec 10 13:48:53 2006 Ben Pfaff <blp@gnu.org>
1471 * dictionary.c (dict_delete_consecutive_vars): New function.
1473 Sat Dec 9 20:08:25 2006 Ben Pfaff <blp@gnu.org>
1475 * file-name.c (fn_search_path): Remove prefix arg that was unused
1476 by any caller. Updated all callers.
1478 Sat Dec 9 20:04:22 2006 Ben Pfaff <blp@gnu.org>
1480 * format.c (fmt_dollar_template): Use user's decimal point
1481 character. Add assertion.
1483 Sat Dec 9 20:02:25 2006 Ben Pfaff <blp@gnu.org>
1485 * format.c (fmt_dollar_template): New function, based on
1486 dollar_format_template from var-type-dialog.c.
1488 Sat Dec 9 18:05:59 2006 Ben Pfaff <blp@gnu.org>
1490 * data-out.c (output_scientific): Fix bad assumption that "buf" is
1493 Sat Dec 9 17:23:23 2006 Ben Pfaff <blp@gnu.org>
1495 Finish converting struct variable to an opaque type. In this
1496 phase, we add remaining setter and getter functions, convert the
1497 remaining PSPP code to use them, and do a bunch of cleanup. The
1498 resulting changes are pervasive but mostly trivial, and only the
1499 notable changes are logged.
1501 * automake.mk (src_data_libdata_a_SOURCES): Add the new source
1504 * case.c (case_data): Renamed case_data_idx.
1505 (case_num): Renamed case_num_idx.
1506 (case_str): Renamed case_str_idx.
1507 (case_data_rw): Renamed case_data_rw_idx.
1509 * case.h (case_data): New function with old name and an interface
1510 that takes a variable instead of an index, which is easier to
1511 use. Updated all callers to use the new interface, or to use the
1512 new *_idx function (see above).
1515 (case_data_rw): Ditto.
1517 * category.c (cat_stored_values_destroy): Changed interface to
1518 take a struct cat_vals * instead of a struct variable *.
1520 * dictionary.c (dict_clone): Use new vector_clone function.
1521 (dict_clear) Use new var_destroy function.
1522 (add_var) New function.
1523 (dict_create_var) Rewrite in terms of dict_create_var_assert.
1524 (dict_create_var_assert) Rewrite in terms of add_var.
1525 (dict_clone_var) Rewrite in terms of dict_clone_var_assert.
1526 (dict_clone_var_assert) Rewrite in terms of var_clone, add_var.
1527 (dict_lookup_var) Use new var_create, var_destroy functions.
1528 (dict_contains_var) Rewrite in terms of new vardict functionality.
1529 (set_var_dict_index) New function.
1530 (set_var_case_index) New function.
1531 (reindex_vars) New function.
1532 (dict_delete_var) Rewrite in terms of new vardict functionality.
1533 (dict_reorder_var) Ditto.
1534 (dict_reorder_vars) Ditto.
1535 (rename_var) New function.
1536 (dict_rename_var) Use rename_var.
1537 (dict_rename_vars) Use pool to simplify code. Use rename_var.
1538 (dict_get_compacted_idx_to_fv) Rename
1539 dict_get_compacted_dict_index_to_case_index, update callers.
1540 (dict_create_vector) Use new vector_create function.
1541 (dict_clear_vectors) Use new vector_destroy function.
1542 (set_var_short_name_suffix) Move here from variable.c, renamed
1543 from var_set_short_name_suffix, make static, update caller.
1545 * sys-file-private.c: New file.
1546 (sfm_width_to_bytes) Moved here from variable.c, renamed from
1547 width_to_bytes, update callers.
1549 * sys-file-private.h: New file. Later it will supplant
1550 sfm-private.h; for now it supplements it.
1551 (macro MIN_VERY_LONG_STRING) New macro.
1552 (macro EFFECTIVE_LONG_STRING_LENGTH) New macro, from value.h.
1554 * sys-file-reader.c: Use MIN_VERY_LONG_STRING - 1 where
1555 MAX_LONG_STRING was used before.
1557 * sys-file-writer.c: Ditto.
1559 * value-labels.c: Change the paradigm here to be that a null
1560 pointer is OK for a struct val_labs * in most cases; it just
1561 represents an empty set of value labels.
1562 (val_labs_copy) A copy of a null set is a null set.
1563 (val_labs_count) A null set has 0 labels.
1564 (val_labs_replace) Change return type to void. Rewrite for
1566 (val_labs_find) A null set does not contain the value.
1567 (value_to_string) Moved to variable.c, renamed var_get_value_name,
1568 transposed argument order, updated all callers.
1570 * value.c: New file.
1571 (value_dup) Moved here from variable.c.
1572 (compare_values) Ditto.
1575 * value.h: (macro MAX_SHORT_STRING) Rewrote for simplicity.
1576 (macro MAX_LONG_STRING) Removed, because it was only interesting
1577 for system files, not for general code.
1578 (macro MAX_VERY_LONG_STRING) Ditto.
1579 (macro EFFECTIVE_LONG_STRING_LENGTH) Moved to sys-file-private.h.
1580 (macro MAX_ELEMS_PER_VALUE) Removed, as it was unused.
1582 * vardict.h: New file, for an interface between variables and
1585 * variable.c: A lot of functions were moved around, for better
1587 (struct variable) Move definition here, from variable.h.
1588 (var_type_adj) Removed--makes i18n hard.
1589 (var_type_noun) Ditto.
1590 (var_create) New function.
1591 (var_clone) New function.
1592 (var_destroy) New function.
1593 (var_set_name) Assert that variable is not in a dictionary.
1594 (compare_var_names) Rename compare_vars_by_name and fix a couple
1595 of callers who thought the args were strings.
1596 (hash_var_name) Rename hash_var_by_name.
1597 (compare_var_ptr_names) Rename compare_var_ptrs_by_name.
1598 (hash_var_ptr_name) Rename hash_var_ptr_by_name.
1599 (var_is_very_long_string) Removed, because it was only interesting
1600 to system file code.
1601 (var_set_missing_values) Allow the argument to be the wrong width,
1602 as long as we can resize it. Simplify callers who were doing the
1603 resizing themselves.
1604 (var_get_value_labels) New function.
1605 (var_has_value_labels) New function.
1606 (var_set_value_labels) New function.
1607 (alloc_value_labels) New function.
1608 (var_add_value_label) New function.
1609 (var_replace_value_label) New function.
1610 (var_clear_value_labels) New function.
1611 (var_lookup_value_label) New function.
1612 (var_get_value_name) Moved here from variable.c, renamed from
1613 var_get_value_name, transposed argument order, updated all
1615 (var_to_string) Moved here, from variable-label.c.
1616 (var_set_leave) New function.
1617 (var_get_leave) New function.
1618 (var_must_leave) New function.
1619 (var_set_short_name_suffix) Moved to dictionary.c, renamed
1620 set_var_short_name_suffix.
1621 (var_get_dict_index) New function.
1622 (var_get_case_index) New function.
1623 (var_get_obs_vals) New function.
1624 (var_set_obs_vals) New function.
1625 (var_has_obs_vals) New function.
1626 (var_get_vardict) New function.
1627 (var_set_vardict) New function.
1628 (var_has_vardict) New function.
1629 (var_clear_vardict) New function.
1630 (value_dup) Moved to value.c.
1631 (compare_values) Ditto.
1634 * variable.h: (enum NUMERIC) Rename VAR_NUMERIC, update all users.
1635 (enum ALPHA) Rename VAR_STRING, update all users.
1637 * vector.c: New file.
1638 (struct vector) Moved here, from variable.h.
1639 (check_widths) New function.
1640 (vector_create) New function.
1641 (vector_clone) New function.
1642 (vector_destroy) New function.
1643 (vector_get_name) New function.
1644 (vector_get_var) New function.
1645 (vector_get_var_cnt) New function.
1646 (compare_vector_ptrs_by_name) New function.
1648 * vector.h: New file.
1650 Sun Dec 10 11:32:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
1652 * casefilter.c (casefilter_variable_missing): Avoided comparision of
1653 string variables to SYSMIS. Thanks to Ben Pfaff for reporting this
1656 Sat Dec 9 07:18:03 WST 2006 John Darrington <john@darrington.wattle.id.au>
1658 * value-labels.c (destroy_atoms): New function.
1659 * value-labels.c (atom_create): Call destroy_atoms in atexit handler.
1661 Thu Dec 7 17:38:26 2006 Ben Pfaff <blp@gnu.org>
1663 Thanks to Jason Stover for pointing out this problem.
1665 * data-out.c (output_number): Use gsl_finite from GSL, which is
1666 portable, instead of isfinite, which is not.
1669 Thu Dec 7 15:22:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
1671 * variable.c variable.h (value_dup): New function.
1673 Mon Dec 4 22:20:17 2006 Ben Pfaff <blp@gnu.org>
1675 Start converting struct variable to an opaque type. In this
1676 phase, we add a bunch of setter and getter functions and convert
1677 most of the PSPP code to use them. The resulting changes are
1678 pervasive but mostly trivial, and only the notable changes are
1681 * format.c (fmt_equal): New function.
1683 * variable.c (var_type_is_valid): New function.
1684 (measure_is_valid) Moved here, from format.c.
1685 (alignment_is_valid) Moved here, from format.c.
1686 (var_get_name) New function.
1687 (var_set_name) New function.
1688 (width_to_type) New function.
1689 (var_get_type) New function.
1690 (var_get_width) New function.
1691 (var_set_width) New function.
1692 (var_is_numeric) New function.
1693 (var_is_alpha) New function.
1694 (var_is_short_string) New function.
1695 (var_is_long_string) New function.
1696 (var_is_very_long_string) New function.
1697 (var_get_missing_values) New function.
1698 (var_set_missing_values) New function.
1699 (var_clear_missing_values) New function.
1700 (var_has_missing_values) New function.
1701 (var_is_value_missing) New function.
1702 (var_is_num_missing) New function.
1703 (var_is_str_missing) New function.
1704 (var_is_value_user_missing) New function.
1705 (var_is_num_user_missing) New function.
1706 (var_is_str_user_missing) New function.
1707 (var_is_value_system_missing) New function.
1708 (var_get_print_format) New function.
1709 (var_set_print_format) New function.
1710 (var_get_write_format) New function.
1711 (var_set_write_format) New function.
1712 (var_set_both_formats) New function.
1713 (var_get_label) New function.
1714 (var_set_label) New function.
1715 (var_clear_label) New function.
1716 (var_has_label) New function.
1717 (var_get_measure) New function.
1718 (var_set_measure) New function.
1719 (var_get_display_width) New function.
1720 (var_set_display_width) New function.
1721 (var_get_alignment) New function.
1722 (var_set_alignment) New function.
1723 (var_get_value_cnt) New function.
1724 (var_get_leave) New function.
1725 (var_get_short_name) New function.
1727 * variable.h: (struct variable) Removed "type" and "nv" members;
1728 they are now computed from "width" where needed.
1730 Mon Dec 4 21:38:40 2006 Ben Pfaff <blp@gnu.org>
1732 * missing-values.c (mv_resize): Don't write beyond end of the
1733 allocated buffer when resizing a long string.
1735 Sat Dec 2 16:28:32 2006 Ben Pfaff <blp@gnu.org>
1737 Clean up identifier code: don't require identifier enumerations to
1738 be in a particular order; make better use of string library;
1739 expose less of the internals.
1741 * identifier.c: (lex_skip_identifier) Rename lex_id_get_length,
1742 change interface. Updated all callers.
1743 (lex_id_match) Change interface to use struct substring, update
1745 (lex_id_match_len) Removed. Update callers to use lex_id_match.
1746 (global array keywords[]) Make static, change form. Update all
1747 users to use lex_id_name instead.
1748 (lex_is_keyword) New function.
1749 (lex_id_to_token) Change interface to use struct substring, update
1751 (lex_id_name) New function.
1753 * identifier.h: (T_FIRST_KEYWORD) Removed. Changed users to call
1754 lex_is_keyword instead.
1755 (T_LAST_KEYWORD) Removed.
1756 (T_N_KEYWORDS) Removed.
1758 Sat Nov 18 20:46:35 2006 Ben Pfaff <blp@gnu.org>
1760 * format.c: (fmt_date_template) Distinguish characters for which a
1761 space is output and any date delimiter is allowed on input, from
1762 those for which a space is output and only a space is allowed on
1763 input. The former is represented by X, the latter by a space.
1764 Also, drop distinction between h and H, changing the former to the
1767 * data-in.c: Completely rewrite internals to conform to SPSS input
1768 formats as closely as possible.
1769 (data_in) Changed external interface by replacing the structure
1770 that was used as a single argument by a set of arguments. Updated
1772 (data_in_finite_line) Removed. Converted all callers to use plain
1774 (data_in_get_integer_format) New function.
1775 (data_in_set_integer_format) New function.
1776 (data_in_get_float_format) New function.
1777 (data_in_set_float_format) New function.
1779 * data-in.h: (enums DI_IGNORE_ERROR, DI_IMPLIED_DECIMALS) Removed.
1780 (struct data_in) Removed.
1782 * data-out.c: (output_date) Drop each component from the input as
1783 it is output, to allow us to drop the distinction between h (a
1784 count of hours) and H (the hour of day) template characters.
1785 Also, handle new X template character.
1786 (output_scientific) Follow more rational rule on when to drop
1787 fraction introduced between SPSS 13 and 15. Updated test case to
1790 Sat Nov 11 11:41:26 2006 Ben Pfaff <blp@gnu.org>
1792 Fix buffer overflow reported by John Darrington.
1794 * data-out.c (output_bcd_integer): In case of SYSMIS, etc.,
1795 realize that DIGITS is a count of nibbles, not of bytes.
1797 Sat Nov 4 15:59:56 2006 Ben Pfaff <blp@gnu.org>
1799 * calendar.c (calendar_offset_to_gregorian) Also return the
1800 year-of-day. Change callers to new interface.
1802 * data-out.c: Completely rewrite internals to conform to SPSS
1803 output formats as completely as possible.
1804 (data_out) Change interface to put input parameters before output
1805 parameters, for consistency with the style I now prefer. Update
1807 (data_out_get_integer_format) New public function.
1808 (data_out_set_integer_format) New public function.
1809 (data_out_get_float_format) New public function.
1810 (data_out_set_float_format) New public function.
1812 * data-out.h: New file. Move prototype for data_out here, from
1815 * format.c: (fmt_step_width) Use equality comparison instead of
1816 bitwise and, for clarity.
1817 (fmt_is_string) Ditto.
1818 (fmt_input_to_output) Fix categories that are translated to F
1821 Sun Nov 5 08:29:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
1823 * casefilter.c casefilter.h (new files), casefile.c casefile.h
1824 casefile-private.h: Added casefilter to assist commands with missing
1827 Sat Nov 4 11:47:09 2006 Ben Pfaff <blp@gnu.org>
1829 Implement SET ERRORS, SHOW ERRORS. Fixes bug #17609.
1831 * settings.c: (route_errors_to_terminal) New variable.
1832 (route_errors_to_listing) New variable.
1833 (get_error_routing_to_terminal) New function.
1834 (set_error_routing_to_terminal) New function.
1835 (get_error_routing_to_listing) New function.
1836 (set_error_routing_to_listing) New function.
1838 * settings.h: (SET_ROUTE_* enums) Removed, because unused.
1840 Tue Oct 31 19:58:27 2006 Ben Pfaff <blp@gnu.org>
1842 * format.c: Completely rewrite, to achieve better abstraction.
1843 Rewrite all references to formats in other files.
1845 * format.def: Rewrite and reorganize.
1847 * settings.c: Move everything related to custom currency formats
1848 into format.[ch], changing them in form, so as to group related
1849 code and definitions better. Changed all references to use the
1851 (static var decimal) Removed.
1852 (static var grouping) Removed.
1853 (static var cc) Removed.
1854 (get_decimal) Removed.
1855 (set_decimal) Removed.
1856 (get_grouping) Removed.
1857 (set_grouping) Removed.
1861 * settings.h: (macro CC_CNT) Removed.
1862 (macro CC_WIDTH) Removed.
1863 (struct custom_currency) Removed.
1865 Tue Oct 31 19:56:19 2006 Ben Pfaff <blp@gnu.org>
1867 * data-in.c (data_in): Use switch statement instead of table, to
1868 avoid dependence on the order of the FMT_* enums.
1870 Tue Oct 31 19:35:36 2006 Ben Pfaff <blp@gnu.org>
1872 * data-out.c: (num_to_string) Removed, because it was dead code.
1874 Tue Oct 31 18:09:24 2006 Ben Pfaff <blp@gnu.org>
1876 * data-in.c (parse_trailer): Fix error message.
1878 Sat Oct 28 11:56:50 2006 Ben Pfaff <blp@gnu.org>
1880 * format.c (fmt_is_binary): New function.
1882 Thu Oct 19 22:59:56 WST 2006 John Darrington <john@darrington.wattle.id.au>
1884 * procedure.c procedure.h: Encapsulated the static data into a single
1887 Sat Oct 14 16:56:44 2006 Ben Pfaff <blp@gnu.org>
1889 * casefile.c (casereader_read_xfer): Always initialize the case,
1890 even on an error condition.
1892 Wed Sep 27 09:37:49 WST 2006 John Darrington <john@darrington.wattle.id.au>
1894 * procedure.c (case_limit_trns_proc): Fixed buglet which rendered the
1895 entire function useless.
1897 Mon Sep 25 17:11:46 WST 2006 John Darrington <john@darrington.wattle.id.au>
1899 * casefile-private.h casefile.c casefile.h fastfile.c: Created new
1900 casereader method casereader_clone.
1902 * procedure.c pransformations.h: Introduced new type casenum_t
1904 Thu Sep 21 07:00:30 2006 Ben Pfaff <blp@gnu.org>
1906 * variable.c: (width_to_bytes) Rephrase code for clarify.
1908 Sun Jul 16 19:52:03 2006 Ben Pfaff <blp@gnu.org>
1910 * format.c: (fmt_type_from_string) New function.
1911 (fmt_to_string) Include decimals in output if the format has
1912 decimals, even if the format type does not. This way, we can
1913 accurately reproduce incorrect formats in user output.
1914 (check_common_specifier) Make the check for a bad format type an
1915 assertion, so we get bug reports if they show up. Fix message.
1916 Check for decimal places with a format type that doesn't allow
1918 (check_input_specifier) Remove check for FMT_X, which has been
1920 (check_output_specifier) Ditto.
1922 * format.def: Remove FMT_T, FMT_X, FMT_DESCEND, FMT_NEWREC.
1924 * format.h: (macro FMT_TYPE_LEN_MAX) New macro.
1925 (struct fmt_desc) Use FMT_TYPE_LEN_MAX in definition.
1926 (enum fmt_parse_flags) Removed.
1928 Mon Jul 17 18:26:21 WST 2006 John Darrington <john@darrington.wattle.id.au>
1930 * casefile.c casefile.h: Converted to an abstract base class.
1931 * casefile-private.h fastfile.c fastfile.h: New files.
1932 * automake.mk procedure.c scratch-writer.c storage-stream.c
1934 Wed Jul 12 21:02:26 2006 Ben Pfaff <blp@gnu.org>
1936 * procedure.c (internal_procedure): Create sink_case with only as
1937 many values as the compacted dictionary.
1939 Wed Jul 12 21:01:00 2006 Ben Pfaff <blp@gnu.org>
1941 Remove "debugging" code that caused plenty of false positives and
1944 * case.h (struct ccase): [DEBUGGING] Remove `this' member.
1946 * case.c: Remove all references to `this' member.
1948 Thu Jul 6 19:09:53 2006 Ben Pfaff <blp@gnu.org>
1950 Fix link error noted by Jason Stover.
1952 * storage-stream.c: Include <assert.h>.
1954 Tue Jul 4 08:47:35 2006 Ben Pfaff <blp@gnu.org>
1956 Fix bug #15766 (/KEEP subcommand on SAVE doesn't fully support
1957 ALL) and additional underlying system file issues.
1959 Thanks to John Darrington for review.
1961 First problem: var_hash points to variables not owned by the
1962 sys-file-reader, which the caller may free or modify. Use an
1963 array of sfm_vars instead, as done earlier (e.g. CVS version
1966 * sys-file-reader.c (struct sfm_reader): Remove var_hash, svars
1967 members and remove all code that references it. Add vars, var_cnt
1968 members. Remove fix_specials member, which was unused.
1969 (struct sfm_var) Remove name member, which was unused.
1970 (sfm_close_reader) Free vars member instead of var_hash.
1971 (compare_var_shortnames) Removed.
1972 (hash_var_shortname) Removed.
1973 (sfm_open_reader) Fill out vars array.
1974 (compare_var_index) Removed.
1975 (sfm_read_case) Use vars instead of var_hash.
1977 Second problem: we're confused about when we actually have very
1978 long strings, causing us to choose incorrectly between slow path
1979 and fast path in sfm_read_case.
1981 * sys-file-reader.c: (sfm_open_reader) Only mark has_vls if we
1982 have very long strings, not when we have long variable names,
1983 which is an unrelated feature.
1985 Tue Jun 27 12:06:49 2006 Ben Pfaff <blp@gnu.org>
1987 * variable.h: Move var_set and variable parsing declarations to
1988 new header, src/language/lexer/variable-parser.h. Modified lots
1989 of files to include the new header.
1991 Sun Jun 25 22:39:32 2006 Ben Pfaff <blp@gnu.org>
1993 * value-labels.c (value_to_string): When there's no value label,
1994 format the variable according to its print format, instead of
1995 always effectively using A or F format.
1997 Mon Jun 19 18:05:42 WST 2006 John Darrington <john@darrington.wattle.id.au>
1999 * casefile.c (casefile_get_random_reader): Nasty hack to get around
2002 * format.c: Removed tortological assertion.
2004 Fri Jun 9 12:20:09 2006 Ben Pfaff <blp@gnu.org>
2006 Reform string library.
2008 * file-name.c (fn_interp_vars): Change interface to take a
2009 substring as input. Updated all users.
2011 Fri Jun 9 12:11:24 2006 Ben Pfaff <blp@gnu.org>
2013 * format.c (measure_is_valid): Really return false when m >=
2016 Tue Jun 6 18:46:26 2006 Ben Pfaff <blp@gnu.org>
2018 Implement random access to casefiles, for use in GUI.
2020 * casefile.c: (struct casereader) Add `random', `file_ofs',
2021 `buffer_ofs' members.
2022 (casefile_get_random_reader) New function.
2023 (read_open_file) Break part into new function
2024 seek_and_fill_buffer().
2025 (fill_buffer) Update buffer_ofs, file_ofs.
2026 (casereader_seek) New function.
2028 Tue May 30 19:52:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
2030 * settings.c: Added call to i18n{done, init}.
2032 Tue May 9 21:09:17 2006 Ben Pfaff <blp@gnu.org>
2034 * procedure.h: Add WARN_UNUSED_RESULT to procedure function
2037 Tue May 9 21:08:05 2006 Ben Pfaff <blp@gnu.org>
2039 * casefile.c: Convert many uses of `int' to `bool'.
2041 Sat May 6 22:49:43 2006 Ben Pfaff <blp@gnu.org>
2043 * transformations.c (trns_chain_destroy): Destroy chain's trns
2044 member, to fix memory leak.
2046 Sat May 6 22:48:30 2006 Ben Pfaff <blp@gnu.org>
2048 * storage-stream.c (storage_source_decapsulate): Destroy case
2049 source to fix memory leak.
2051 Sat May 6 22:46:47 2006 Ben Pfaff <blp@gnu.org>
2053 * scratch-reader.c (scratch_reader_read_case): Copy into existing
2054 case passed as argument instead of initializing the argument as a
2055 case. Fixes memory leak that showed up in
2056 tests/command/aggregate.sh with scratch files.
2058 Sat May 6 22:45:55 2006 Ben Pfaff <blp@gnu.org>
2060 * procedure.c (proc_done): Destroy default_dict, to fix memory
2063 Sat May 6 22:44:44 2006 Ben Pfaff <blp@gnu.org>
2065 Simplify procedure_with_splits().
2067 * procedure.c (struct split_aux_data): Removed case_count member.
2068 (procedure_with_splits) Don't initialize case_count.
2069 (split_procedure_case_func) Check whether prev_case is null
2070 instead of case_count.
2071 (split_procedure_end_func) Ditto.
2073 Sat May 6 22:42:23 2006 Ben Pfaff <blp@gnu.org>
2075 * case.c (case_move): Do nothing if dst and src are the same
2077 (case_try_create) Merge two similar cases.
2078 (case_copy) Unshare only if data must be actually copied.
2080 Sun May 7 10:04:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
2082 * data-in.c data-out.c dictionary.c sys-file-reader.c
2083 sys-file-writer.c variable.c variable.h: Reworked very long string
2084 support for better encapsulation.
2086 Sat May 6 19:02:00 2006 Ben Pfaff <blp@gnu.org>
2088 * value-labels.c (val_labs_can_set_width): New function.
2089 (val_labs_set_width) Clear labels if increasing width to long
2091 (val_labs_destroy) Remove unneeded test for null.
2093 Sat May 6 16:14:08 2006 Ben Pfaff <blp@gnu.org>
2095 * value-labels.h: Remove unneeded dependency on variable.h.
2097 Sat May 6 15:58:36 2006 Ben Pfaff <blp@gnu.org>
2099 Get rid of `char *c' member in union value, for cleanliness.
2101 * value.h: (union value) Remove `c' member.
2103 Sat May 6 15:36:59 2006 Ben Pfaff <blp@gnu.org>
2105 Make dictionary compacting functions a little more general.
2107 * sys-file-writer.c (sfm_open_writer): Use
2108 dict_compacting_would_change().
2109 (does_dict_need_translation) Removed.
2111 Sat May 6 15:35:42 2006 Ben Pfaff <blp@gnu.org>
2113 Make dictionary compacting functions a little more general.
2115 * dictionary.c (dict_needs_compaction): Rename
2116 dict_compacting_would_shrink(). Update all callers.
2117 (dict_compacting_would_change) New function.
2119 Sat May 6 14:25:49 2006 Ben Pfaff <blp@gnu.org>
2121 * sys-file-writer.c: (does_dict_need_translation) Fix bug:
2122 inverted return value (!).
2124 Sat May 6 13:37:52 2006 Ben Pfaff <blp@gnu.org>
2126 Continue reforming procedure execution.
2128 * procedure.c: Search and replace "vfm" by "proc". Notably:
2129 (static var vfm_source) Rename proc_source. Update all
2131 (static var vfm_sink) Rename proc_sink. Update all references.
2133 Sat May 6 12:38:55 2006 Ben Pfaff <blp@gnu.org>
2135 Continue reforming procedure execution. In this phase, remove
2136 PROCESS IF, which was deprecated anyway and can be easily
2137 simulated with TEMPORARY followed by SELECT IF.
2139 * procedure.c: (open_active_file) Don't call
2140 add_process_if_trns().
2141 (discard_variables) Get rid of redundant call to
2142 proc_cancel_all_transformations().
2143 (add_process_if_trns) Removed.
2144 (process_if_trns_proc) Removed.
2145 (process_if_trns_free) Removed.
2147 Sat May 6 10:58:05 2006 Ben Pfaff <blp@gnu.org>
2149 Continue reforming procedure execution. In this phase, add
2150 `const' to the case passed to procedure()'s callback.
2152 Updated all users of procedure() as well.
2154 * procedure.c: (struct write_case_data) Add "const" to ccase
2155 parameter for case_func member.
2156 (procedure) Add "const" to ccase parameter for proc_func
2158 (multipass_case_func) Make ccase parameter const.
2159 (internal_procedure) Add "const" to ccase parameter for case_func
2161 (split_procedure_case_func) Make ccase parameter const.
2162 (multipass_split_case_func) Make ccase parameter const.
2164 Sat May 6 10:30:33 2006 Ben Pfaff <blp@gnu.org>
2166 Continue reforming procedure execution. In this phase, get rid of
2167 the output code for SPLIT FILE groups in procedure.c, which really
2168 shouldn't be doing any output. Move it into the individual
2169 procedures instead. This also adds some flexibility.
2171 Updated many users of procedure_with_splits() and
2172 multipass_procedure_with_splits() to call
2173 output_split_file_values() and to deal with increased use of
2176 * procedure.c: (struct split_aux_data) Add "const struct ccase *"
2177 parameter to begin_func member.
2178 (procedure_with_splits) Add "const struct ccase *" parameter to
2179 begin_func parameter. Make ccase parameter const in proc_func
2181 (split_procedure_case_func) Don't dump split file group. Pass
2183 (dump_splits) Moved to language/dictionary/split-file.c as
2184 output_split_file_values().
2185 (struct multipass_split_aux_data) Add "const struct ccase *"
2186 parameter to split_func member.
2187 (multipass_procedure_with_splits) Add "const struct ccase *"
2188 parameter to split_func parameter.
2189 (multipass_split_case_func) Save new SPLIT FILE case before
2191 (multipass_split_output) Pass saved SPLIT FILE case to split_func.
2193 Fri May 5 22:48:50 2006 Ben Pfaff <blp@gnu.org>
2195 Continue reforming procedure execution. Change
2196 internal_procedure() so that it calls open_active_file() and
2197 close_active_file(), which isolates most of the actual procedure
2200 * procedure.c: (struct write_case_data) Rename `proc_func' member
2201 to `case_func' and update all references.
2202 (procedure) Rewrite as one-line wrapper around
2203 internal_procedure().
2204 (struct multipass_aux_data) New.
2205 (multipass_callback) Renamed multipass_case_func(). Use struct
2206 multipass_aux_data as auxiliary data.
2207 (multipass_end_func) New function.
2208 (multipass_procedure) Rewrite as wrapper for internal_procedure()
2209 that uses multipass_case_func, multipass_end_func.
2210 (internal_procedure) Add `end_func' argument. Move optimization
2211 of trivial case in here. Move call to open_active_file() and
2212 close_active_file() in here. Now assert that vfm_source is
2214 (procedure_with_splits_callback) Rename
2215 split_procedure_case_func().
2216 (split_procedure_end_func) New function.
2217 (multipass_split_callback) Rename multipass_split_case_func.
2218 (multipass_split_end_func) New function.
2219 (discard_variables) No need to test for nonnull vfm_source.
2221 Fri May 5 21:34:02 2006 Ben Pfaff <blp@gnu.org>
2223 Continue reforming procedure execution. Get rid of unused member.
2225 * procedure.c: (struct write_case_data) Remove `cases_analyzed'
2227 (write_case) Don't increment cases_analyzed.
2229 Thu May 4 21:50:11 2006 Ben Pfaff <blp@gnu.org>
2231 Continue reforming procedure execution. In this phase, move
2232 procedure.c and procedure.h from src to src/data. Update
2233 makefiles and #includes accordingly.
2235 * procedure.c: Moved here from src/.
2237 * procedure.h: Moved here from src/.
2239 Wed May 3 22:42:12 2006 Ben Pfaff <blp@gnu.org>
2241 Continue reforming procedure execution. In this phase, get rid of
2242 many global variables, consolidating procedure execution in
2243 procedure.c. Encapsulate transformations in new "struct
2244 trns_chain". Also, change implementation of N OF CASES, FILTER,
2245 and PROCESS IF from special cases to transformations.
2247 * automake.mk: (src_data_libdata_a_SOURCES) Add transformations.c,
2250 * dictionary.c: (global variable default_dict) Move to
2253 * variable.h: (TRNS_*) Move to transformations.h.
2254 (struct transformation) Move to transformations.c.
2256 Thu May 4 13:47:06 WST 2006 John Darrington <john@darrington.wattle.id.au>
2258 * sys-file-reader.c: Fixed invalid read problems.
2260 Tue May 2 15:57:10 2006 Ben Pfaff <blp@gnu.org>
2262 * storage-stream.c: Add missing function comments.
2264 Tue May 2 15:50:21 2006 Ben Pfaff <blp@gnu.org>
2266 Continue reforming procedure execution. In this phase, add some
2267 new, needed functionality to storage-stream.
2269 * storage-stream.c: (storage_source_decapsulate) New function.
2271 Tue May 2 15:43:36 2006 Ben Pfaff <blp@gnu.org>
2273 * variable.c (width_to_bytes): Declarations must precede
2274 statements for C90 compliance.
2276 Tue May 2 10:42:05 WST 2006 John Darrington <john@darrington.wattle.id.au>
2278 * data-out.c, data-in.c, variable.c, variable.h: New functions
2279 copy_mangle and copy_demangle for reading/writing cases; emulates the
2280 way SPSS deals with strings > 255 bytes.
2282 * sys-file-reader.c sys-file-writer.c: Added support for Record 7,
2283 subtype 14 needed for strings longer than 255 bytes.
2285 * dictionary.c, format.def, value.c : Updated to use MAX_STRING
2286 instead of literal values. Also fixed some constness issues.
2288 * format.h: Constness
2290 * sfm-private.h: Renamed the case_size identifier, since I discovered
2291 that SPSS's respect for this variable is very nominal.
2293 Mon May 1 15:45:42 2006 Ben Pfaff <blp@gnu.org>
2295 Change case limit type from int to size_t.
2297 * dictionary.c: (struct dictionary) Change type of case_limit
2299 (dict_get_case_limit) Change return type.
2300 (dict_set_case_limit) Change parameter type.
2302 Wed Apr 26 20:01:19 2006 Ben Pfaff <blp@gnu.org>
2304 * variable.h: (struct variable) Rename `reinit' member as `leave'
2305 and invert sense. Fix up all references.
2307 Wed Apr 26 19:39:28 2006 Ben Pfaff <blp@gnu.org>
2309 Continue reforming procedure execution. In this phase, break
2310 procedure.c into multiple files.
2312 * automake.mk: (src_data_libdata_a_SOURCES) Add all the new files.
2314 * case-sink.c: New file.
2316 * case-sink.h: New file.
2318 * case-source.c: New file.
2320 * case-source.h: New file.
2322 * storage-stream.c: New file.
2324 * storage-stream.h: New file.
2326 Wed Apr 26 14:55:19 2006 Ben Pfaff <blp@gnu.org>
2328 * variable.h: (struct variable) Remove `init' member and all
2329 references to it from other files. It was initialized in several
2330 places, but nothing really ever used it for anything worthwhile.
2331 Thanks to Jason Stover for pointing out how confusing this
2334 Sun Apr 23 22:04:45 2006 Ben Pfaff <blp@gnu.org>
2336 Continue reforming error message support. In this phase, get rid
2337 of message "titles" and put the message text in `struct error'.
2338 Now `struct error' encapsulates a message more properly.
2340 * casefile.c: (io_error) Use err_msg() instead of err_vmsg().
2341 Format message ourselves.
2343 * data-in.c: (vdls_error) Ditto.
2345 * por-file-reader.c: (error) Ditto.
2347 * sys-file-reader.c: (corrupt_msg) Ditto.
2349 Sun Apr 16 18:49:51 2006 Ben Pfaff <blp@gnu.org>
2351 GNU standards require "file name" instead of "filename" in
2352 documentation. It's nice for our code to follow the convention
2355 * casefile.c: (struct casefile) Rename `filename' member to
2356 `file_name'. Updated all references.
2358 * file-name.c: [!unix] (struct file_identity) Rename
2359 normalized_filename member to normalized_file_name. Updated all
2362 Sun Apr 16 18:35:33 2006 Ben Pfaff <blp@gnu.org>
2364 We don't really support anything but Unix-like environments well,
2365 so we might as well de-obfuscate by writing directory and path
2366 separators explicitly.
2368 * file-name.h: (macro DIR_SEPARATOR) Removed. Changed all usages
2370 (macro PATH_SEPARATOR) Removed. Changed all usages to just ':'.
2371 (macro DIR_SEPARATOR_STRING) Removed. Changed all usages to just
2373 (macro PATH_SEPARATOR_STRING) Removed. Changed all usages to just
2376 Sun Apr 16 18:28:35 2006 Ben Pfaff <blp@gnu.org>
2378 GNU standards require "file name" instead of "filename" in
2379 documentation. It's nice for our code to follow the convention
2382 * filename.c: Rename to file-name.c.
2384 * filename.h: Rename to file-name.h. Update all inclusions.
2385 Update header guards.
2387 * automake.mk: Update file names.
2389 Sun Apr 16 16:42:47 2006 Ben Pfaff <blp@gnu.org>
2391 * filename.c: (fn_dirname) Renamed fn_dir_name(), all references
2393 (fn_basename) Removed (dead code).
2394 (fn_absolute_p) Renamed fn_is_absolute(), all references updated.
2395 (fn_special_p) Renamed fn_is_special(), all references updated.
2396 (fn_exists_p) Renamed fn_exists(), all references updated.
2398 Sun Apr 16 16:33:58 2006 Ben Pfaff <blp@gnu.org>
2400 * filename.c: (fn_tilde_expand) Rewrite for cleaner code.
2401 Also, now it only tilde-expands file names, not paths.
2402 (fn_search_path) Tilde-expand one directory at a time.
2404 Sun Apr 16 16:28:06 2006 Ben Pfaff <blp@gnu.org>
2406 * filename.c: (fn_search_path) rewrite for cleaner code. Also,
2407 get rid of non-Unixlike version of the code, which has probably
2409 (fn_prepend_dir) Removed (dead code).
2411 * filename.h: (macro DIR_SEPARATOR_STRING) New.
2412 (macro PATH_SEPARATOR_STRING) New.
2413 Sun Apr 16 16:05:28 2006 Ben Pfaff <blp@gnu.org>
2415 Continue reforming error message support. In this phase, we get
2416 rid of VM() and the other msg() support for "verbosity", replacing
2417 it by a new function verbose_msg().
2419 * filename.c: (fn_search_path) Use verbose_msg() instead of
2422 Sat Apr 15 19:53:19 2006 Ben Pfaff <blp@gnu.org>
2424 * sfm-private.h: Get rid of #defines after #error, which makes no
2427 Sat Apr 15 19:48:57 2006 Ben Pfaff <blp@gnu.org>
2429 Get rid of our own int32 type in favor of the standard int32_t
2432 * sfm-private.h: (int32 macro) Don't define this anymore. Do
2435 * sys-file-reader.c: Use int32_t instead of int32 throughout.
2437 * sys-file-writer.c: Use int32_t instead of int32 throughout.
2439 Sat Apr 15 19:36:47 2006 Ben Pfaff <blp@gnu.org>
2441 Remove ill-considered file routines that are no longer used.
2443 * filename.c: (fn_open_ext) Removed.
2444 (fn_close_ext) Removed.
2446 * filename.h: (struct file_ext) Removed.
2448 Mon Apr 3 13:22:39 2006 Ben Pfaff <blp@gnu.org>
2450 * variable.c (var_is_valid_name): Move declarations before code
2453 Tue Apr 4 15:28:40 WST 2006 John Darrington <john@darrington.wattle.id.au>
2455 * filename.ch (fn_interp_vars): Fixed small buglet.
2457 Tue Mar 28 13:47:16 WST 2006 John Darrington <john@darrington.wattle.id.au>
2459 * filename.[ch] (fn_interp_vars): Changed the signature and semantics
2460 so as to modify the string inline. Thus makeing it easier to
2461 destroy the results when no longer needed.
2463 2006-03-25 Jason Stover <jhs@math.gcsu.edu>
2465 * category.c (cat_stored_values_destroy): Fixed memory leak.
2467 Fri Mar 24 18:15:41 2006 Ben Pfaff <blp@gnu.org>
2469 Add some missing frees. Thanks to John Darrington for reporting
2472 * any-writer.c (any_writer_close): Free writer.
2474 * any-reader.c (any_reader_close): Free reader.
2476 Mon Mar 20 16:33:53 2006 Ben Pfaff <blp@gnu.org>
2478 * por-file-reader.c: (error) Mark as NO_RETURN.
2480 Sat Mar 11 15:06:07 WST 2006 John Darrington <john@darrington.wattle.id.au>
2482 * settings.c: Changed default value of scompress to true.
2484 Sat Mar 4 13:22:51 2006 Ben Pfaff <blp@gnu.org>
2486 * sfm-private.h: Include variable.h, to get SHORT_NAME_LEN.
2488 * value.h: Remove check on MAX_SHORT_STRING, which I don't think
2491 * variable.h: Move definition of SHORT_NAME_LEN, LONG_NAME_LEN
2492 here from pref.h.orig.
2494 Sat Mar 4 12:50:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
2496 * sys-file-reader.c: Fixed bug reading compressed files.
2498 Thu Mar 2 08:40:33 WST 2006 John Darrington <john@darrington.wattle.id.au>
2500 * Numerous renames. See src/ChangeLog for details.
2502 * Moved files from src directory