John Darrington [Fri, 27 Sep 2013 12:21:08 +0000 (14:21 +0200)]
Use correct argument order for pool_nmalloc.
This function (and other calloc-like functions) are may not take zero as the size argument. Hence
the order is important. Reported by Przemek Powalko <pp.alter.ego@gmail.com>
Ben Pfaff [Thu, 26 Sep 2013 04:23:41 +0000 (21:23 -0700)]
gui: Avoid referencing freed data upon closing data window.
Without this commit, the following procedure always yielded Glib/GTK+
warnings or criticals for me:
1. Invoke PSPPIRE with a .sav file specified on the command line.
2. Choose Utilities|Variables...
3. Select a variable in the dialog box, then click on Cancel.
3. Close the output window using the window manager.
4. Close the data window using the window manager.
John Darrington [Mon, 23 Sep 2013 14:46:53 +0000 (16:46 +0200)]
Use the msg function to report errors wherever possible.
Previously, some errors were reported using the GNU "error" function from error.h
rather than the PSPP msg function. This wasn't too bad for the terminal user interace,
but gui users could miss important messages (since they never see stderr).
The reason for not using msg in some instances, was twofold: 1) Some
errors might occur before the messaging system had been initialised. 2) If an
error occured whilst reporting an error, an infinite loop would occur.
This change overcomes these problems by detecting re-entrancy, and uninitialised
messaging system, and falling back to fwrite if either of these conditions occur.
John Darrington [Wed, 18 Sep 2013 17:16:08 +0000 (19:16 +0200)]
Calculate Fisher Exact Test even if all cell counts >= 5
Remove the condition that one of the cell counts must be < 5
before calculating the fisher exact test. This condition seems
to be an anachronism, but still (erroneously) documented in Algorithms.
John Darrington [Sat, 7 Sep 2013 05:12:59 +0000 (07:12 +0200)]
Make one of the icon sets a wildcard set.
We currently have two icon sets: A 16x16 and a 24x24 set. Previously,
we had been using the 16x16 set for menuitems and the 24x24 set for the
toolbar. However it appeared that windows uses the symbol GTK_ICON_SIZE_SMALL_TOOLBAR
instead of GTK_ICON_SIZE_LARGE_TOOLBAR, which meant no icons appeared in the
toolbar.
This change sets the 24x24 set as a "wildcard" set meaning it will be used for
all purposes except menuitems.
John Darrington [Wed, 4 Sep 2013 17:32:33 +0000 (19:32 +0200)]
Change instances of GNM_SUPPORT to GNM_READ_SUPPORT
Commit 82c1097ab658e8c13ab3ad439970148defba6e19 used the preprocessor
symbol GNM_READ_SUPPORT but GNM_SUPPORT was the one set in the autconf
files. Hence some code was erroneously omitted.
This change uses GNM_READ_SUPPORT throughout which is consistent
with ODF_READ_SUPPORT
Ben Pfaff [Mon, 2 Sep 2013 20:00:30 +0000 (13:00 -0700)]
data-parser: A hard delimiter at end of line is not an empty field.
Until now, DATA LIST FREE(',') treated input like this:
1,2,
3,4,
as describing six fields, two of which were blank at the end of a line.
A bug report and subsequent experiments showed that in fact this is only
four fields, none of which is blank. This commit fixes the problem and
adds a new test that should avoid regression against this issue.
Ben Pfaff [Fri, 16 Aug 2013 05:35:19 +0000 (22:35 -0700)]
lexer: Rename LEX_ERROR_INTERACTIVE to LEX_ERROR_TERMINAL, change default
The LEX_ERROR_INTERACTIVE error handling mode really only makes sense for
reading from a terminal, where we know we're getting one line at a time
and not partial lines. Unfortunately LEX_ERROR_INTERACTIVE was the default
and it was getting used as such in the GUI for reading from syntax files.
This meant that if there was an error in the GUI then the current buffer
(which might be any arbitrary chunk of syntax) was being discarded, which
caused terrible confusion.
This commit changes the default to LEX_ERROR_CONTINUE, which works
in a reasonable fashion regardless of the input source. It also renames
LEX_ERROR_INTERACTIVE to LEX_ERROR_TERMINAL to make it clear that that's
the only reasonable use.
Reported by Thambu David <thambu@cmcvellore.ac.in>, archived at:
http://lists.gnu.org/archive/html/pspp-users/2013-08/msg00019.html
Ben Pfaff [Mon, 12 Aug 2013 04:56:52 +0000 (21:56 -0700)]
psppire-var-sheet: Hard-code size of pixbuf cells.
Otherwise the icons disappear if the sheet is initially empty, because
there's no icon for an empty row and thus nothing to make the pixbuf cells
nonzero size.
Ben Pfaff [Sat, 10 Aug 2013 16:48:32 +0000 (09:48 -0700)]
gui: Restore icons deleted in error.
These icons were deleted by commit caa467c9a26a7 (gui: Update artwork.)
even though they were still in use. This commit restores them and allows
"make -f Smake" to complete without error.
Ben Pfaff [Mon, 5 Aug 2013 02:42:29 +0000 (19:42 -0700)]
encoding-guesser: Fix bug in parsing fallback encodings.
The encoding guesser originally used UTF-8 as a fallback in situations
where it had already figured out that UTF-8 couldn't be right. Commit d6c75296 (encoding-guesser: Fall back to windows-1252 when UTF-8 can't be
right.) fixed this, by falling back to window-1252 when UTF-8 was known to
be wrong, but it also introduced a bug where this change to the fallback
encoding occurred even when UTF-8 had not be determined to be wrong. This
commit fixes that problem.
Ben Pfaff [Sat, 3 Aug 2013 21:48:36 +0000 (14:48 -0700)]
sys-file-reader: Accept measurement value of zero without complaint.
SPSS 14 seemed to output a measurement value of 0 for string variables,
but SPSS 21 does the same thing for numeric variables. We might as well
accept it.
Ben Pfaff [Sat, 3 Aug 2013 18:59:07 +0000 (11:59 -0700)]
sys-file-reader: Improve diagnostics for unexpected special values.
SPSS 21 schanged the value that it reports for "lowest" in the machine
float info record, but the existing diagnostics made it hard to tell
exactly what changed. Adding hexadecimal float output makes it obvious.
Ben Pfaff [Sun, 28 Jul 2013 22:24:39 +0000 (15:24 -0700)]
gui: Remove processor-area from status bar to reduce minimum window width.
Nothing ever puts anything in the processor-area widget, but it forces
the data window to be 35 character widths wider, so by removing it we can
allow the window to be resized much narrower when the status bar is shown.
Reported by Bastián Díaz <diaz.bastian@ymail.com>.
John Darrington [Wed, 17 Jul 2013 14:12:07 +0000 (16:12 +0200)]
REGRESSION: Fix issues found by by review
Ben reported following potential problems:
I think that if the DEPENDENT subcommand is given twice (a user error), then
the variables specified the first time will be silently leaked.
cmd_regression() has two local variables named 'i'.
I don't understand why "struct workspace" has a member 'psw' that is a
dynamically allocated array, because it looks like each element of the array
is used only during processing a single split file group. That is, I think
that 'psw' could be just a singleton, instead of an array.
I think that fill_all_vars() is wrong: if an absent var follows a not-absent
var, then vars[] will be filled with a gap and there will be a write into
unallocated memory.
Reported-by: Ben Pfaff
Avoids shadowing variable in lower scope. suggested by Ben Pfaff
John Darrington [Tue, 2 Jul 2013 17:41:16 +0000 (19:41 +0200)]
Fixed incorrect behaviour of REGRESSION when multiple dependent variables are entered
The REGRESSION command behaved badly when more than one dependent variable was entered.
The cause was that the unnormalised covariance matrix returned from the covariance
module was mutated for each variable. Consequently, each variable after the first
was wrong. This change fixes that by changing the ownership semantics of the returned
matrix (and thereby its constness).
This change also adds some comments, attends to constness and fixes the remaining
memory leaks associated with regression.
Ben Pfaff [Tue, 25 Jun 2013 06:07:12 +0000 (23:07 -0700)]
datasheet: Avoid reading a given row more than necessary in source_read().
The datasheet casereader uses datasheet_get_row(), which calls rw_case(),
which until this commit called source_read() for every column. The latter
was expensive if casereader_peek() actually copied data for a whole large
row. For a datasheet with N columns, all from a single backing source,
the upshot was that datasheet_get_row() took O(N**2) time.
This commit fixes the problem in the common case by reading as many columns
as possible from a given source in a single call to source_read().
John Darrington [Sun, 23 Jun 2013 10:07:56 +0000 (12:07 +0200)]
variable.c: New function var_set_width_and_formats
Added a new function to set the width and formats of a variable as
an atomic operation. This is necessary to allow values to re-interpreted
without going through an intermediate format and thereby perhaps loosing
information.
John Darrington [Sat, 22 Jun 2013 10:09:56 +0000 (12:09 +0200)]
Fix and simplify the code for converting variables between types
Before this commit, changing a variable from string to numeric or
vici-versa would cause all values of that variable to become SYSMIS.
This commit fixes this problem at least partially.