Ben Pfaff [Thu, 13 May 2010 04:41:21 +0000 (21:41 -0700)]
cairo: Allow xr_driver_create()'s caller to usefully set more options.
Until now, xr_driver_create() has only parsed a few of the Cairo driver
options. This commit makes it parse more of them, in preparation for
output viewer printing to set more of them.
John Darrington [Thu, 6 May 2010 07:21:07 +0000 (09:21 +0200)]
Don't convert values returned from gettext to UTF8.
Because we have called bind_text_domain_codeset, gettext always
returns strings in UTF8 encoding. It's therefore not correct to
convert them again. Thanks to Michel Boaventura for reporting
this problem.
Ben Pfaff [Mon, 3 May 2010 04:05:42 +0000 (21:05 -0700)]
CROSSTABS: Merge functions into cmd_crosstabs().
It seems to me that this code is more straightforward if it is written as
a single function, instead of four functions, so this commit merges those
functions together.
Ben Pfaff [Mon, 3 May 2010 04:00:06 +0000 (21:00 -0700)]
Take advantage of Gnulib configmake module.
Gnulib provides the "configmake" module for discovering configuration
directories at build time. PSPP already depends on this module indirectly,
so we might as well use it instead of defining our own variables in
Makefile.am and src/automake.mk.
(We can't replace INSTALLDIR by BINDIR because it is used under the
former name by the "relocatable-prog" module.)
John Darrington [Sun, 2 May 2010 13:20:38 +0000 (15:20 +0200)]
Convert syntax files to UTF-8 before loading them.
Convert the contents of a syntax file to UTF-8 before loading
it into the syntax window. Fixes bug #29733
This change assumes that the files to be loaded are in the
encoding of the current locale. If this assumption is not
true, then an error will be displayed and the file not loaded.
Ben Pfaff [Sun, 2 May 2010 02:09:04 +0000 (19:09 -0700)]
Implement MRSETS command.
Thanks to Tom Wilson <tom_wilson@mointel.com> for reporting the format of
the MRSETS record in system files, and to John Darrington for examples of
additional types of records.
The built Perl module is not useful for cross-compilation. By default it
is disabled for cross-compilation, but cross-compilation to Mingw32 is not
always detected as cross-compilation (since some Linux systems can run
Windows binaries directly, via Wine), so this option helps in such cases.
Reported by Michel Boaventura <michel.boaventura@gmail.com>.
Ben Pfaff [Thu, 22 Apr 2010 04:11:48 +0000 (21:11 -0700)]
Document system file record type 7, subtype 16 as 64-bit number of cases.
I found this record type and subtype in all .sav files written by SPSS 14
and later (and in one file written by SPSS 13). After scratching my head
a bit I realized that it always contained the same value as the "ncases"
field in the top-level file header, but written as a 64-bit number. So
presumably the purpose is to allow for a 64-bit count of cases.
Ben Pfaff [Wed, 21 Apr 2010 04:20:30 +0000 (21:20 -0700)]
perl-module: Avoid compiler warning from conflicting "my_strftime" macros.
Avoids the following warnings:
In file included from /usr/lib/perl/5.10/CORE/perl.h:953,
from PSPP.xs:23:
/usr/lib/perl/5.10/CORE/embed.h:2803:1: warning: "my_strftime" redefined
In file included from PSPP.xs:20:
/home/blp/pspp/output/_build/config.h:1968:1: warning: this is the location of the previous definition
Ben Pfaff [Fri, 16 Apr 2010 05:23:09 +0000 (22:23 -0700)]
configure: Improve check for PostgreSQL's libpq.
Previously this test did not check that linking against libpq worked.
This commit fixes that. Besides broken installations this also guards
against pg_config that is applicable to the host when cross-compiling to
Mingw, which doesn't always show up as cross-compiling since some systems
can still run the Mingw binaries if Wine is installed as a binary
interpreter for Windows executables.
This also fixes a minor issue where -lpq was being added to the default
LIBS as well as to PG_LIBS, which meant that every PSPP binary was being
linked against it, not just the ones that needed it (which were being
linked against it twice).
Problem reported by Michel Boaventura <michel@michelboaventura.com>.
Ben Pfaff [Fri, 16 Apr 2010 03:39:47 +0000 (20:39 -0700)]
Move definition of UI_FILES out of HAVE_GUI.
UI_FILES needs to be defined regardless of whether the GUI is being built,
because the .ui files are needed to generate pspp.pot. (We don't want
pspp.pot to depend on whether the GUI is configured, either.)
Problem reported by Michel Boaventura <michel.boaventura@gmail.com>.
Ben Pfaff [Sat, 27 Mar 2010 18:32:07 +0000 (11:32 -0700)]
configure.ac: Define DEPENDS_ON_LIBINTL if LIBINTL is nonempty.
This avoids a collision between the gnulib and libintl printf wrappers.
See http://permalink.gmane.org/gmane.comp.lib.gnulib.bugs/21139 for
more information.
Thanks to Michel Boaventura for reporting the problem and to Bruno Haible
for the fix.
Ben Pfaff [Sat, 27 Mar 2010 18:30:01 +0000 (11:30 -0700)]
configure.ac: Restore use of AM_GNU_GETTEXT.
AM_GNU_GETTEXT is useful for its sophisticated support for finding the
libraries needed to use gettext, but it also calls AM_PO_SUBDIRS, which
we do not want because PSPP has its own "po" directory makefile support.
This commit reintroduces AM_GNU_GETTEXT but disables AM_PO_SUBDIRS by
declaring that we have already called it using AC_PROVIDE. It also
adds a dummy Makefile.in to the "po" directory and an ABOUT-NLS file
because Automake requires both.
Ben Pfaff [Thu, 15 Apr 2010 04:47:07 +0000 (21:47 -0700)]
perl-module: Use Autotest for testing Perl.
The output of the existing Perl test is difficult to understand, in my
opinion. When everything goes right, it prints out plenty of stuff.
When something goes wrong, it prints more stuff, but that stuff usually
doesn't make it clear to me what went wrong or where.
Moving it into Autotest helps in two ways. When everything goes right,
all you get is a clear summary that says that. When something goes wrong,
you get clear log files that explain where.
(This commit actually duplicates the Perl module tests: it makes Autotest
copies of each of the individual tests, and Autotest also runs the
t/Pspp.t unit test. The former are easier to understand; the latter is
what Perl hackers apparently expect to see.)
Ben Pfaff [Fri, 9 Apr 2010 04:06:43 +0000 (21:06 -0700)]
Make "internal variables" part of a dictionary.
The "internal variables" created by var_create_internal() are somewhat of
a nasty corner case in the PSPP dictionary and variable implementation,
because they are the only variables that have a case index and
dictionary index but do not belong to a dictionary. This commit fixes
that wart, by putting internal variables in a dictionary that is used just
for them. It adds an assertion to var_set_vardict() to ensure that this
is now an invariant property.
As part of the change, var_create_internal() is renamed
dict_Create_internal_var() and moved to dictionary.c, since it fits better
there. Also, a new function dict_destroy_internal_var() must now be used
to destroy internal variables.
The dictionary indexes of internal variables are no longer unique
process-wide. A previous commit eliminated the dependencies on this
property.
This code replaces the dictionary's "var" array by another one, so it must
either update "var_cap" to the allocated size or allocate "var_cap" (not
"var_cnt") elements. I chose the latter fix.
Ben Pfaff [Thu, 8 Apr 2010 05:12:07 +0000 (22:12 -0700)]
Get rid of unnecessary uses of var_get_dict_index().
Some code used the result of var_get_dict_index() on a pair of variables to
tell whether the variables are the same. This is unnecessary: v1 == v2
works just as well.
Other code used the result of var_get_dict_index() as part of a hash value
computation. This is reasonable, but it is even better just to hash the
pointer to the variable.
Ben Pfaff [Thu, 25 Mar 2010 04:18:34 +0000 (21:18 -0700)]
dict: Make dict_clone_var(), dict_clone_var_assert() not rename variables.
Most uses of dict_clone_var() and dict_clone_var_assert() do not involve
renaming variables, but the interface assumes that renaming is the common
case. This commit changes their interfaces to not support renaming and
adds new functions dict_clone_var_as() and dict_clone_var_as_assert() to
support renaming during cloning.
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.