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.
John Darrington [Sat, 22 Jun 2013 05:23:16 +0000 (07:23 +0200)]
dictionary.c: Added a WHAT argument to dict_var_changed callback
Defined some bitwise constants to indicate which aspect of a variable has
changed. Added an argument to the dict_var_changed callback taking an
argument which contains a combination of these types.
This is used in later commits to avoid the callback implementation having
to guess what exactly changed.
John Darrington [Sat, 22 Jun 2013 04:52:10 +0000 (06:52 +0200)]
variable.c: Add _quiet versions of the var_set_ methods and use in var_clone
var_clone doesn't need to provoke callbacks, since the new variable does not
(yet) have a dictionary hence the callbacks can do nothing. Also the callbacks
cause problems for later commits, since they themselves could call var_clone.
This change therefore defines _quiet versions of all the var_set methods, which
do not generate any callbacks, and uses those versions in the implementation
of var_clone.
Ben Pfaff [Thu, 13 Jun 2013 07:03:51 +0000 (00:03 -0700)]
INPUT PROGRAM: Use a separate dataset for the input program.
Without this change, INPUT PROGRAM uses the same dataset as the following
syntax. This usually is fine, but there's at least one case where it
doesn't work: if the INPUT PROGRAM defines a vector, then a following
proc_execute() without any intervening transformations causes
proc_execute() to follow a "fast path" where it skips running the procedure
but instead just does a few things, like clearing the set of vectors.
Unfortunately, this means that later when the input program is really run,
it doesn't have the vectors and accesses freed memory.
This commit switches to a different tactic. INPUT PROGRAM creates a
special session and dataset that are used only for the input program. This
keeps the dataset and the transformations used for the input program
separate from those used after the input program.
Ben Pfaff [Sun, 26 May 2013 23:43:01 +0000 (16:43 -0700)]
Avoid letting data fields overflow in output and GUI.
When the output for data_out() is too big for the field width, it produces
output that consists of just asterisks: ******. This is OK when the
output is really going into a fixed-width space, such as the output for
PRINT and WRITE. But it is obnoxious if the output is going into PSPP
output or the GUI. This commit introduces a new function that typically
does not do this, and starts using it in output and the GUI.
Bug #35829.
Reported by John Darrington.
Bug #30731.
Reported by lavila <la@jump23.com>.
John Darrington [Sat, 25 May 2013 11:06:49 +0000 (13:06 +0200)]
Linear Regression Test: Provide more decimal places in test results.
This test previously had only 2 decimal places displayed, which
limited its ability to detect numerical errors. This change increases
the decimal places to 3.
The results for this test were checked against a pattern provided
by Olaf Nöhring.
Ben Pfaff [Tue, 21 May 2013 06:49:54 +0000 (23:49 -0700)]
DELETE VARIABLES: Fix crash with FILTER.
FILTER has the surprising property that it introduces a temporary
transformation, even if proc_make_temporary_transformations_permanent()
was previously called. This causes a crash if the procedure implementation
really relies on there being no temporary transformations.
This commit fixes the problem in the procedures I was able to identify as
having it, adds a comment to proc_make_temporary_transformations_permanent()
to make it a little less likely to happen again, and adds a test
specifically to check for regression on DELETE VARIABLES.
Ben Pfaff [Tue, 21 May 2013 05:54:31 +0000 (22:54 -0700)]
FLIP: Fix use-after-free and double frees with temporary transformations.
I originally thought this was a bug in FLIP, but it turned out that in
fact we just hadn't ever really tested
proc_make_temporary_transformations_permanent() properly with actual
transformations, and especially with adding a transformation after calling
proc_make_temporary_transformations_permanent().
The modified test should avoid regression for the bug.
John Darrington [Fri, 17 May 2013 14:24:31 +0000 (16:24 +0200)]
Sort items in datasheets dropdown box.
Before this change, the values in the data sheets dropdown
box appeared in a non-deterministic order (the order in
the underlying hash), which was inconvenient to users.
This change produces the values in sorted order.