Ben Pfaff [Sun, 14 Mar 2010 05:53:05 +0000 (21:53 -0800)]
FREQUENCIES: Modernize syntax and improve chart support.
The FREQUENCIES syntax was carrying a lot of baggage from old versions
that is no longer mentioned in the SPSS syntax reference. This commit
removes support for those obsolete features.
The implementation only supported a single chart at a time. Now it
supports pie charts and histograms in a single command. The MIN and
MAX format options are now implemented, as are the MISSING/NOMISSING
options for pie charts. (The FREQ/PERCENT options are still not
implemented.)
Ben Pfaff [Sat, 13 Mar 2010 19:43:13 +0000 (11:43 -0800)]
FREQUENCIES: Use Freedman-Diaconis formula to choose histogram bin width.
Recently the FREQUENCIES procedure adopted Sturges' formula, more or less
arbitrarily, to choose the bin width of histograms. Gaj Vidmar
<gaj.vidmar@mf.uni-lj.si>, however, recommended the Freedman-Diaconis
formula instead, so this commit adopts that formula instead.
Ben Pfaff [Wed, 10 Mar 2010 05:48:42 +0000 (21:48 -0800)]
gui: Merge File|Open|Syntax and File|Open|Data into File|Open.
In playing with the GUI, I've found it increasingly annoying to have to
click an extra time to tell PSPPIRE whether I want to open a data file or
a syntax file. There's no need for that--it can easily figure out what
kind of file it's being asked to read. This commit implements that
behavior.
Ben Pfaff [Wed, 10 Mar 2010 04:52:48 +0000 (20:52 -0800)]
FREQUENCIES: Choose number of bins for histogram based on valid cases.
Until now, histograms have always had exactly 11 bins. There is no
"correct" number of bins, but a fixed number of bins also seems less than
ideal. Use Sturges' formula, instead, to choose the number of bins.
Reported by Erik Frebold <efrebold@interchange.ubc.ca>.
Ben Pfaff [Tue, 9 Mar 2010 05:25:46 +0000 (21:25 -0800)]
CROSSTABS: Make 3-way crosstabulation work reasonably.
As reported in bug #27452, until now 3-way crosstabulations have completely
failed to work. This commit makes them work, apparently correctly at
first glance. Only the actual crosstabulation tables have been tested; it
is likely that statistics tables still do not display correctly or cause
runtime failures.
Ben Pfaff [Sat, 6 Mar 2010 19:43:42 +0000 (11:43 -0800)]
terminal UI: Fix circumstances when errors should be logged to stdout.
The logic here was supposed to be that, if errors weren't already being
logged explicitly and if no output driver was already directed to stdout,
then send errors to standard output. But one of the conditions was
reversed. This fixes the problem.
Ben Pfaff [Tue, 2 Mar 2010 06:20:02 +0000 (22:20 -0800)]
procedure: Fix LIST procedure (and others) in GUI.
John Darrington reported that the following syntax makes PSPPIRE
crash:
data list list /alpha * beta * gamma *.
begin data.
1 2 3
4 5 6
end data.
list.
The problem is that the GUI output driver keeps a reference to the
output_items that are submitted to it. An output_item that in turn
has a reference to the casereader for the procedure casereader (that
is, the casereader returned by proc_open()), which currently is LIST
and few if any other procedures, then causes an assertion failure in
proc_commit(). This is because until now a precondition of
proc_commit() has been that the procedure casereader be closed, which
is what the assertion enforces.
This commit fixes the problem by getting rid of the precondition on
proc_commit(). Now the procedure casereader's lifetime may be
extended arbitrarily. This should help take PSPP output in the
direction that I want it to go, where more and more output is
generated directly or semi-directly from casereaders, as the LIST
procedure now does.
Ben Pfaff [Tue, 2 Mar 2010 06:12:48 +0000 (22:12 -0800)]
casereader: Factor buffering shim out into separate source file.
This moves the "shim" code out of casereader.c into a separate
casereader-shim.[ch] in preparation for using it from procedure.c.
This commit also adds an optimization: if the shim reads all of the
subreader, then it closes the subreader immediately, instead of waiting
for the shim itself to be destroyed. This can allow resources to be freed
earlier.
This commit also adds a new function casereader_shim_slurp(). This
function will be used for the first time in the following commit.
Ben Pfaff [Fri, 26 Feb 2010 05:40:52 +0000 (21:40 -0800)]
gui: Save positions of windows only when they are closed.
When windows in the GUI are moved around the desktop or resized, the
machine's disk can thrash madly in some setups. This is because each
change in a window's position or size triggers a write to the PSPPIRE
preferences file noting the new position as a default for the next
PSPPIRE run. It wasn't always a problem, but newer Glib versions call
fsync() from g_file_set_contents(), the function used to write the
preferences file, which bypasses the OS cache and forces a synchronous
disk write.
This commit makes PSPPIRE update the preferences file only when a window
is closed, which fixes the problem. Avoiding g_file_set_contents() would
be another reasonable solution.
Reported by Grzegorz Artur Daszuta <crefff@gmail.com>.
Ben Pfaff [Sun, 21 Feb 2010 21:19:29 +0000 (13:19 -0800)]
csv: Fix setting output file name.
The output file named used to be provided as an option named "output-file",
but now it is a separate argument to the "create" function. This had
been overlooked for the CSV driver, so that it always produced output in
a file named "pspp.csv", but this commit fixes the problem.
Ben Pfaff [Sat, 20 Feb 2010 20:34:25 +0000 (12:34 -0800)]
gui: Fix File|Export in output viewer.
Commit f51ecb480 "Greatly simplify PSPP configuration" changed how PSPP
output drivers are configured but failed to completely update the
implementation of File|Export to match. This commit fixes the problem.
A few problems, perhaps not connected, linger:
* The CSV driver appears to always output to "pspp.csv" when invoked
from the GUI, regardless of the requested file name.
* The ODT driver appears to be broken.
Reported by John Darrington <john@darrington.wattle.id.au>.
Ben Pfaff [Sat, 20 Feb 2010 19:24:34 +0000 (11:24 -0800)]
gnumeric-reader: Avoid convert_xml_string_to_value segfault on NULL string
If the 'xv' argument is null, the previous version of this code would
still dereference it. This commit rewrites it to instead just set the
value as missing and avoid the segfault. It also takes advantage of the
fairly recently added function value_copy_str_rpad() to eliminate some
code.
Ben Pfaff [Thu, 11 Feb 2010 04:00:31 +0000 (20:00 -0800)]
q2c: Fix format string errors.
These calls to write blank lines have caused warnings before, so introduce
a new function just for the purpose so that any future warnings can be
fixed in a single place.
Ben Pfaff [Thu, 11 Feb 2010 04:07:08 +0000 (20:07 -0800)]
FREQUENCIES: Fix corner case for histogram calculation.
calc_stats() assumes that ft->n_valid is nonzero. It has two callers, but
only one of them was checking ft->valid. The other one (which produces a
histogram) is fixed up by this commit.
Ben Pfaff [Thu, 11 Feb 2010 04:26:15 +0000 (20:26 -0800)]
gui: Fix theoretical comparison against garbage pointer.
Presumably gtk_tree_model_iter_n_children() never returns a negative value,
but in case it ever could, this eliminates a comparison against an
uninitialized 'v1' value.
Ben Pfaff [Thu, 11 Feb 2010 04:22:42 +0000 (20:22 -0800)]
MISSING VALUES: Fix free of indeterminate pointer.
If the main "while" loop in this function falls through immediately without
ever executing its body, then 'v' is passed to free() without ever being
initialized.
Ben Pfaff [Tue, 16 Feb 2010 17:45:27 +0000 (09:45 -0800)]
testsuite: Don't check pspp version with AT_TESTED.
AT_TESTED is for reporting the versions of binaries that you test, but
the testsuite doesn't currently test the "pspp" binary. More
importantly, the Makefile doesn't ensure that the "pspp" binary is in
$PATH when the testsuite runs, which can cause a spurious test failure.
Ben Pfaff [Mon, 15 Feb 2010 23:15:03 +0000 (15:15 -0800)]
perl-module: Automatically update PSPP.pm version number check.
Until now the $PSPP::VERSION variable was hard-coded in the source tree
and had to be manually updated whenever configure.ac was updated to
specify a new version number. This is easy to forget. So this commit
makes perl-module/lib/PSPP.pm a generated file, with the value of
$PSPP::VERSION automatically expanded from the @VERSION_FOR_PERL@
variable already set up by "configure".
Ben Pfaff [Mon, 15 Feb 2010 22:41:55 +0000 (14:41 -0800)]
FACTOR: Avoid freeing indeterminate pointer.
The first test in cmd_factor() is:
if (!lex_force_match_id (lexer, "VARIABLES"))
If this fails, then control jumps to the "error" label, which frees
factor.vars, which has not been initialized at this point.
This commit fixes the problem by initializing factor.vars to NULL. It is
not strictly necessary to also initialize factor.n_vars to 0, but it seems
like a good idea.
Ben Pfaff [Mon, 15 Feb 2010 21:46:49 +0000 (13:46 -0800)]
Allow more version number flexibility, by using Automake "gnu" mode.
The "gnits" mode that PSPP has used for some time constrains version
numbers considerably. For example, it prevents using two hyphens in the
version number to indicate, for instance, a prerelease and a Git commit
number like 0.8.0-pre1-g12345678.
This commit changes PSPP to use "gnu" mode instead, and then to also
enable the extra options that "gnits" mode enabled automatically
that we still want to use.
The Automake manual discourages using "gnits" mode anyhow:
...Unless you are a Gnits standards contributor, it is
recommended that you avoid this option until such time as the Gnits
standard is actually published (which may never happen).
Ben Pfaff [Fri, 12 Feb 2010 06:05:55 +0000 (22:05 -0800)]
FACTOR: Mark translatable string as not a printf format string.
gettext uses a heuristic to guess whether a translatable string is a printf
format string. In this case, it guesses wrong, so add a comment that tells
gettext that "% of Variance" is not a format string.
Without this change, the translationproject.org robot rejects translations.
Ben Pfaff [Fri, 12 Feb 2010 05:53:38 +0000 (21:53 -0800)]
odt: Restore writing creator metadata.
Commit 4d7a2ed5 "odt: Remove dependency on <pwd.h> because mingw32 does
not have it" stopped writing creator metadata to ODT output files. This
commit adds it back, but only on systems that have <pwd.h>.
This commit also adds avoids a null pointer dereference if getpwuid()
returns NULL. That should happen only rarely, but it is best to handle it
properly.
Ben Pfaff [Tue, 9 Feb 2010 05:09:15 +0000 (21:09 -0800)]
hmap-test: Disable ordered insert tests on GCC 4.3.
GCC 4.3 miscompiles this test (although it does not seem to miscompile
any important code actually in PSPP) so disable it to avoid spurious
failures from "make check".
Ben Pfaff [Sun, 7 Feb 2010 17:42:53 +0000 (09:42 -0800)]
output: Make errors, warnings, and notes into a new "message_item".
This lets us move the terminal UI's support for writing errors to a file
or to stdout into a new "msglog" output driver, and to convert journaling
from a special case to an output driver of its own.
Ben Pfaff [Sun, 7 Feb 2010 04:35:46 +0000 (20:35 -0800)]
Greatly simplify PSPP configuration.
This gets rid of the "devices" configuration file entirely. Now you
can make pspp output to, for example, an HTML file, by invoking it as
"pspp -o out.html". Please read the documentation for full information.
It would be good to have a way to read options from a file to support,
for example, the IBM-PC or Unicode line drawing characters as implemented
in "devices" in previous versions. I hope that we can introduce that
soon.
Ben Pfaff [Sat, 6 Feb 2010 19:02:00 +0000 (11:02 -0800)]
Add Spanish translation from translationproject.org.
This translation is by F.J.Miguel <Miguel.Quesada@uab.cat> and others.
Miguel included the following note:
I appreciate very much the work of Xavier and Palmira with translation, the
support from coordinators Jordi and Santiago, and the comments from Ben,
John and Michel. Encouragement for those working with other languages!!!
Ben Pfaff [Wed, 3 Feb 2010 05:53:14 +0000 (21:53 -0800)]
verbose-msg: Remove.
This feature is not used very much and in fact is really only useful at all
because it is difficult to understand how PSPP configuration works.
Upcoming commits will make PSPP configuration much simpler, so we drop it
now to simplify the code in advance.
Ben Pfaff [Thu, 4 Feb 2010 05:05:43 +0000 (21:05 -0800)]
csv: Close pipe files properly.
csv_create() opens the output file with fn_open() so csv_destroy() should
close it with fn_close() to ensure that pipes and the standard file
descriptors are closed properly.
Ben Pfaff [Tue, 19 Jan 2010 06:19:13 +0000 (22:19 -0800)]
pspp: Fix interactive usability for multi-line commands.
Until now, the terminal UI has only flushed output just before reading
the first line of a command. This generally worked OK because typically
only the final command produced output, not intermediate lines. But now
every line of a command potentially produces output (e.g. the command name
or the command syntax). With the ASCII driver that makes the interface
difficult to use because it typically opens and holds open a pipe to an
interactive program such as "more", which in turn turns off terminal echo
etc.
Flushing output before reading each command avoids this problem and makes
the terminal UI more usable.
Ben Pfaff [Tue, 19 Jan 2010 06:10:30 +0000 (22:10 -0800)]
ascii: Fix closing pipe files in ascii_destroy().
Files that are opened with fn_open() must be closed with fn_close(), but
ascii_destroy() wasn't doing that. This made a particular difference for
interactive output where fn_close() calls pclose() instead of fclose().