Ben Pfaff [Thu, 13 Sep 2007 04:23:15 +0000 (04:23 +0000)]
(postcalc): Free sorted_tab and the structures that it points to, to
plug a memory leak. Fixes bug #20910. Thanks to John Darrington for
reporting this bug and for review.
Ben Pfaff [Wed, 12 Sep 2007 13:43:49 +0000 (13:43 +0000)]
* casereader-translator.c (struct casereader_translator): Change
input case parameter of translate member function from const
struct ccase * to struct ccase *.
(casereader_create_translator): Ditto, for translate parameter.
* get.c (get_translate_case): Change input case parameter from
const struct ccase * to struct ccase *, to match change in
casereader and casewriter translators. Destroy input case, to fix
memory leak.
Ben Pfaff [Tue, 11 Sep 2007 03:12:34 +0000 (03:12 +0000)]
(psppire_variable_sheet_create): Use xstrdup to save string returned
by bind_textdomain_codeset. Otherwise it can get freed by a
subsequent call. Patch #6193. Reviewed by John Darrington.
Ben Pfaff [Wed, 5 Sep 2007 04:56:15 +0000 (04:56 +0000)]
Update scripts that invoke Perl to invoke it as simply "perl" if
not run from the PSPP Makefiles. Patch #6169. Thanks to John
Darrington for suggestion and review.
* bugs/big-input-2.sh: Make $PERL default to perl.
* command/sort.sh: Ditto.
* formats/bcd-in.sh: Ditto.
* formats/date-in.sh: Ditto.
* formats/ib-in.sh: Ditto.
* formats/legacy-in.sh: Ditto.
* formats/num-in.sh: Ditto.
* formats/num-out.sh: Ditto.
* formats/time-in.sh: Ditto.
Ben Pfaff [Sun, 26 Aug 2007 18:35:45 +0000 (18:35 +0000)]
(main): When testing mode is enabled, use a built-in output driver
configuration instead of reading it from the configuration file.
Updated most invocations of PSPP in the tests to use --testing-mode
and to avoid specifying an output format with -o (because
--testing-mode implies -o raw-ascii).
Ben Pfaff [Fri, 24 Aug 2007 05:00:50 +0000 (05:00 +0000)]
Implement journaling. Bug #17240.
* msg-ui.c (handle_msg): Send message to write_journal function
as well as msg_file.
(dump_message): Change interface so that it takes a function
pointer instead of a FILE.
(write_stream): New function.
(write_journal): New function.
* read-line.c (welcome): Call journal_enable, so that the journal
is enabled by default.
Ben Pfaff [Mon, 13 Aug 2007 04:36:47 +0000 (04:36 +0000)]
Output variable measurement level, alignment, and display width as
part of DISPLAY DICTIONARY and SYSFILE INFO output. Bug #13019.
Reviewed by John Darrington.
* sys-file-info.c (cmd_sysfile_info): Allow space for new rows of
info in output.
(display_variables): Ditto.
(describe_variable): Output variable measurement level, alignment,
and display width as part of DISPLAY DICTIONARY and SYSFILE INFO
output.
* procedure.c (struct data_set): Change `compactor' member to be a
struct case_map *.
(proc_open): Use case_map_to_compact_dict instead of
dict_make_compactor.
(proc_casereader_read): Use case_map_execute instead of
dict_compactor_compact.
(proc_commit): Use case_map_destroy instead of
dict_compactor_destroy.
* scratch-writer.c (struct scratch_writer): Change `compactor'
member to be a struct case_map *.
(scratch_writer_open): Use case_map_to_compact_dict instead of
dict_make_compactor.
(scratch_writer_casewriter_write): Use case_map_execute instead of
dict_compactor_compact.
Ben Pfaff [Mon, 13 Aug 2007 03:44:45 +0000 (03:44 +0000)]
* psppire-dict.c (psppire_dict_dump): Don't use
dict_get_compacted_dict_index_to_case_index, as that function has
been deleted.
* flip.c: Drop use of dict_get_compacted_dict_index_to_case_index
and just use the ordinary case indexes. There seemed to be no
reason for the former method.
* get.c (case_map_get_value_cnt): New function.
* dictionary.c (dict_compact_values): Don't delete scratch
variables as well as compacting case indexes. Update all callers.
(dict_get_compacted_value_cnt): Rename dict_count_values and
change interface. Update all callers.
(dict_get_compacted_value_cnt): Remove.
(dict_compacting_would_shrink): Remove.
(dict_compacting_would_change): Remove.
(dict_make_compactor): Add new parameter. Update all callers.
* procedure.c (proc_casereader_read): Use casewriter_get_value_cnt
instead of dict_count_values, changing an O(N) operation into
O(1).
Ben Pfaff [Mon, 13 Aug 2007 00:41:34 +0000 (00:41 +0000)]
Make casewriters keep track of the number of `union value's in each
case. This is useful for two reasons: casewriter_write can then check
that the case being written is large enough, and later recipients of
the casewriter can determine the size of the case.
* casewriter.c (struct casewriter): Add value_cnt member.
(casewriter_write): Check that the case passed in is big enough.
(casewriter_get_value_cnt): New function.
(casewriter_create): Add value_cnt parameter.
Ben Pfaff [Mon, 13 Aug 2007 00:26:31 +0000 (00:26 +0000)]
Add support for charts to ASCII driver. Bug #16364.
Thanks to John Darrington for review.
* ascii.c (struct ascii_driver_ext): Add chart_type,
chart_file_name, chart_cnt members.
(ascii_open_driver): Initialize new members.
(static array option_tab): Add new options, reorganize slightly.
(handle_option): Handle new options.
(ascii_submit): New function.
(ascii_chart_initialise): Implement.
(ascii_chart_finalise): Implement.
* chart.c (chart_init_separate): New function.
(chart_finalise_separate): New function.
* dummy-chart.c (chart_init_separate): New function.
(chart_finalise_separate): New function.
* html.c (html_open_driver): Don't free chart_file_name.
(html_close_driver): Do free chart_file_name.
(handle_option): Only give an error for chart-files options that
don't contain "#".
(html_initialise_chart): Use new chart_init_separate.
(html_finalise_chart): Use new chart_finalise_separate.
Ben Pfaff [Fri, 10 Aug 2007 00:16:18 +0000 (00:16 +0000)]
Fix bug reported by Jason Stover.
* settings.c: Move get_termcap_viewport and in particular the
#include for <curses.h> to the end of the file. curses.h
redefines bool on some systems (e.g. OpenBSD), which causes
disagreement between uses of bool before its inclusion and
afterward.
Tested by Jason Stover.
Ben Pfaff [Thu, 2 Aug 2007 03:07:17 +0000 (03:07 +0000)]
Clean up handling of median, by treating it almost like any other
percentile. Fixes bug #17424. Thanks to John Darrington for
review.
* frequencies.q (internal_cmd_frequencies): Fix handling of bit
masks for `stats' variable. If median is selected, turn it off
and add a 50th percentile.
(add_percentile): Simplify code a little.
(calc_stats): Drop special casing of median.
(dump_statistics): Ditto, except that we label the 50th percentile
as "50 (Median)" to make it clear that it's also the median.
Ben Pfaff [Sun, 29 Jul 2007 05:40:51 +0000 (05:40 +0000)]
Make PSPP able to read all the portable files I could find on the
web.
* por-file-reader.c (struct pfm_reader): New member `line_length'.
(error): Print file offset in hexadecimal.
(warning): New function.
(advance): Treat lines less than 80 bytes long as padded to 80
bytes with spaces.
(pfm_open_reader): Call read_documents if we find an "E" record.
(convert_format): Convert invalid formats to the default format
instead of aborting reading the file.
(read_variables): Rename duplicate variable names instead of
aborting reading the file.
(read_value_label): Allow string variables of different widths to
be assigned value labels in the same record. Replace duplicate
value labels instead of aborting.
(read_documents): New function.
* por-file-writer.c (pfm_open_writer): Call write_documents if the
dictionary has documents.
(write_documents): New function.
Ben Pfaff [Fri, 27 Jul 2007 22:59:32 +0000 (22:59 +0000)]
Add tty and listing devices that use VT100 (and xterm) line-drawing
characters, and corresponding support for an initialization string in
the ASCII output device.
Ben Pfaff [Fri, 27 Jul 2007 22:58:02 +0000 (22:58 +0000)]
Make interactive output go to the terminal (bug #17213), by
causing the UI to flush output to the user when it prompts for a
command.
Thanks to John Darrington for review.
Ben Pfaff [Fri, 27 Jul 2007 21:44:18 +0000 (21:44 +0000)]
(run_regression): Move casereader_destroy call so that it always gets
called, not just if there was some valid data. Fixes bug #19581.
Reviewed by Jason Stover.
Ben Pfaff [Fri, 27 Jul 2007 21:33:35 +0000 (21:33 +0000)]
Make PKG_CHECK_MODULES tests more user-friendly,
by having them give their errors at the end of the configuration
process instead of stopping it in the middle. Patch #6116.
Reviewed by Jason Stover.
Ben Pfaff [Wed, 25 Jul 2007 04:31:34 +0000 (04:31 +0000)]
Fix bug #6113.
* sys-file-writer.c (write_variable_display_parameters): Use new
var_default_display_width function to choose display width of
segments after the first one in a given variable.
* variable.c (var_create): Use var_default_display_width to pick
new variable's display width.
(var_default_display_width): New function.
Ben Pfaff [Wed, 25 Jul 2007 04:03:58 +0000 (04:03 +0000)]
Fix bugs #20493, #20494.
* flip.c (struct flip_pgm): Remove `case_size' member (now
unused).
(cmd_flip): Pass var_cnt as number of cases instead of case_cnt,
to fix bug #20494. Don't assign to `case_size' member, which was
unused after assignment.
(build_dictionary): When NEWNAMES not used, get the number of
variables right, to fix bug #20493.
* tests/command/flip.sh: Add tests to avoid regression on bugs
#20493, #20494.
Ben Pfaff [Mon, 23 Jul 2007 05:11:58 +0000 (05:11 +0000)]
Don't try to write very long strings to portable files. The format
does not support it.
(MAX_POR_WIDTH): New macro.
(pfm_open_writer): Limit output width to MAX_POR_WIDTH.
(write_format): Add arg to take width to resize format to.
(write_value): Limit width of value written to MAX_POR_WIDTH.
(write_variables): Limit width of variable and its output formats
to MAX_POR_WIDTH.
Ben Pfaff [Mon, 23 Jul 2007 05:05:45 +0000 (05:05 +0000)]
Fix problems with uniqueness of short names in system files with very
long string variables. Now a variable may have multiple short names.
* automake.mk (src_data_libdata_a_SOURCES): Add new files
short-names.c, short-names.h.
* dictionary.c (dict_clone): Clone all the short names.
(compare_strings): Move into short-names.c.
(hash_strings): Ditto.
(set_var_short_name_suffix): Ditto.
(dict_assign_short_names): Ditto, rename short_names_assign,
change to assign all short names.
* por-file-writer.c (write_variables): Use short_names_assign
instead of dict_assign_short_names.
* short-names.c: New file.
* short-names.h: New file.
* sys-file-private.c (sfm_width_to_segments): New function.
* sys-file-reader.c (read_long_var_name_map): Save and restore all
the short names, not just the first one.
* sys-file-writer.c (cont_var_name): Removed.
(sfm_open_writer): Use short_names_assign instead of
dict_assign_short_names. Use unique short names assigned by
short_names_assign instead of those generated by cont_var_name.
* variable.c (struct variable): Remove `short_name' member,
replace by `short_names' and `short_name_cnt'.
(var_create) Initialize new members.
(var_get_short_name_cnt): New function.
(var_get_short_name): Now takes an index argument. Changed most
callers to pass 0.
(var_set_short_name): Ditto.
(var_clear_short_name): Renamed var_clear_short_names, changed to
clear all short names.
Ben Pfaff [Wed, 18 Jul 2007 04:28:11 +0000 (04:28 +0000)]
Ignore directories that have been removed from CVS. These used to not
show up in Emacs' pcl-cvs mode, but for some reason they now pollute
the display.