John Darrington [Sat, 3 Jun 2023 20:01:12 +0000 (22:01 +0200)]
MEANS: Allow string variables to be selected as the categorical variable.
The gui did not allow string variables to be the subject of any MEANS command.
However it is entirely appropriate for them to be the independent (categorical)
variable.
Ben Pfaff [Sat, 3 Jun 2023 17:02:28 +0000 (10:02 -0700)]
spreadsheet-reader: Merge duplicate code with libpspp/str.h.
The tree had two functions for 26-adic spreadsheet number formatting. This
eliminates the duplication and moves the corresponding parsing function
into str.h as well.
Portability/Regression: Check OS version to skip test first (1598)
The test
1598: interactive output appears immediately
does not work on MacOS and the plan is to skip that test. I changed
the testcode to first test the OS and skip immediately instead of
first checking the python shell. Without that the test does not
stop on MacOS and runs forever.
Portability: Variable initialization not at beginning of block
Recent changes in segment.c result in compilation errors on older
compilers like on debian buster or MacOS.
../pspp/src/language/lexer/segment.c:1255:7:
error: a label can only be part of a statement
and a declaration is not a statement
int eol = at_end_of_line (input, n, eof, 1);
I changed the code such that it compiles on MacOS again to
a more traditional way to avoid the compile error.
Ben Pfaff [Tue, 30 May 2023 00:42:15 +0000 (17:42 -0700)]
ods-reader: Support more than a single piece of text in a cell.
This code read the first text content in the first <p> it found in a cell.
This meant that anything more sophisticated than just <p>text<p> broke,
including <p>text<span>some more</span></p>. This commit fixes it.
The code here was really complicated and I didn't understand it. I
simplified it a lot to use xmlTextReaderExpand(), which is a lot easier to
use than a state machine at the level we need it. I also couldn't figure
out how to make the existing caching logic work quite right, so I replaced
it by something simpler which I think will be just fine.
This updates the test by adding some bold text to a cell.
Thanks to elias tsolis for reporting this bug.
Bug #63443.
Ben Pfaff [Mon, 29 May 2023 20:23:07 +0000 (13:23 -0700)]
gui: Update how the Run menu works in the syntax window.
Until now, the Run menu had both "Selection", which ran the current
selection, and "Current line", which ran the current line. This commit
replaces that by a single menu item "Selection", which runs the current
command if there is no selection and all the selected or partially selected
commands if there is a selection. This behavior matches SPSS.
Ben Pfaff [Sun, 28 May 2023 16:31:00 +0000 (09:31 -0700)]
CTABLES: Avoid causing nhtsa.sav to appear modified after running tests.
Adding a hard link makes Git think that nhtsa.sav has been modified, before
it checks for real changes, which is sometimes annoying in the interface.
Using a symlink instead avoids the problem.
Ben Pfaff [Sun, 28 May 2023 16:27:33 +0000 (09:27 -0700)]
CTABLES: Refine treatment for applying a summary to nested variables.
In the previous commit, applying a summary to a nest operator caused an
error, which I assumed was the correct behvior. This commit changes it
to apply the summary to the inner variable.
Thanks to Matthias Faeth for reporting the correct behavior.
Ben Pfaff [Sat, 27 May 2023 23:17:22 +0000 (16:17 -0700)]
histogram: Fix a couple of bugs.
The bug report wasn't specific enough to know that this fixes
the problem, which was an assertion failure for
assert (*adjusted_min <= min);
in hist_find_pretty_no_of_bins().
Ben Pfaff [Mon, 15 May 2023 05:48:46 +0000 (22:48 -0700)]
command: Make command names available for translation.
PSPP command names should appear in translated form in labels in output,
but they didn't because their names weren't marked for translation. This
fixes that problem.
The names still won't appear translated until translators add translations
for them.
Thanks to Ali Alhaidary for reporting the bug at
https://savannah.gnu.org/bugs/?62982
Ben Pfaff [Sat, 6 May 2023 16:25:45 +0000 (09:25 -0700)]
pspp-output: Use page setup from command line by default.
pspp-output was ignoring the page setup specified on the command line in
favor of the one embedded in an SPV file. This is usually wrong, and in
particular it screwed up the examples in the manual by causing them to be
broken across multiple PNG output files, only the first of which was
actually shown in the manual.
Ben Pfaff [Thu, 4 May 2023 14:57:46 +0000 (07:57 -0700)]
gui: Fix warnings from g_string_free(..., FALSE).
This construct now causes a warning about an unused return value, so this
commit replaces it in each case with g_string_free_and_steal(), which also
leads to clearer code.
Ben Pfaff [Sun, 30 Apr 2023 01:07:35 +0000 (18:07 -0700)]
combine-files: Adopt the encoding of the first input file.
Previously, there was no good way to control the output encoding, which was
simply the default encoding. One could use SET LOCALE, but it seems more
reasonable to use the encoding from one of the input files, and the first
one is the most obvious choice.
Also, improve the warning about incompatible input encodings.
Ben Pfaff [Sun, 30 Apr 2023 00:47:05 +0000 (17:47 -0700)]
combine-files: Only give an error for different types if they're kept.
Until now, ADD FILES, MATCH FILES, and UPDATE always gave an error if
variables in the input files had different types or widths and they weren't
renamed to avoid it. This commit makes them only do that if the variables
in question aren't dropped.
Ben Pfaff [Sun, 23 Apr 2023 01:05:44 +0000 (18:05 -0700)]
Fix checks for valid integer range subset of 'double'.
Previously, I assumed that checking that a 'double' was between LONG_MIN
and LONG_MAX meant that it would convert to a sensible 'long'. This is
wrong, because LONG_MAX rounds up to a higher 'double', because it has too
many bits for a 53-bit mantissa. This could cause problems, like for
example LONG_MAX (as a double) turns out to convert back to LONG_MIN (as a
'long'). This commit fixes the problem.
Thanks to Youngseok Choi for reporting the problem.
Reported at https://lists.gnu.org/archive/html/bug-gnu-pspp/2023-04/msg00005.html.
Ben Pfaff [Tue, 18 Apr 2023 15:45:48 +0000 (08:45 -0700)]
DATA LIST: Fix crash inside LOOP.
DATA LIST should be allowed inside LOOP if the LOOP is inside INPUT
PROGRAM, and disallowed otherwise. The latter behavior was not correct
before this commit.
Ben Pfaff [Mon, 17 Apr 2023 23:08:56 +0000 (16:08 -0700)]
CTABLES: Fix treatment of string variables that differ past the first byte.
CTABLES display was treating string values with more than one byte as the
same if they had the same first byte, because var_get_type() was confused
with var_get_width(). (The former returns 0 for numeric and 1 for string
and the latter returns 0 for numeric and string width for string.)
Ben Pfaff [Sat, 18 Mar 2023 19:34:39 +0000 (12:34 -0700)]
data-out: Make binary output buffer big enough for a null terminator.
The max width for binary output is 16, for P or PK format, plus there
needs to be room for a null terminator, for a total width of 17 bytes.
The buffer here was undersized at only 16 bytes. This commit fixes the
problem.
Ben Pfaff [Sat, 18 Mar 2023 18:43:16 +0000 (11:43 -0700)]
Ensure that interactive output appears without a one-command delay.
When pspp was run in the text-based mode interactively, output for a given
command only appeared after the next command was read. This fixes the
problem and adds a test.
Ben Pfaff [Sun, 5 Mar 2023 19:07:38 +0000 (11:07 -0800)]
case-map: Identity map is only when there are no changes at all.
case_map_stage_get_case_map() called a mapping an identity map when no
data was reordered, which left the possibility that data was removed from
the end would be called an identity map. This seems like a bad idea, so
this commit tightens the criteria.
This is a bigger than necessary change that also avoids per-variable
malloc()s that weren't really needed.
This might be a bug fix. I haven't identified a particular bug that
it fixes.
Ben Pfaff [Sun, 5 Mar 2023 06:26:03 +0000 (22:26 -0800)]
dictionary: Get rid of case indexes.
Dictionary index (the index into the variables in the dictionary)
and case index (the index into struct ccase for a variable from
the dictionary) have always been independent, but they are
*usually* the same. It is much cleaner to have an invariant
that they are *always* the same. This commit makes that the case.
Ben Pfaff [Sun, 5 Mar 2023 03:06:12 +0000 (19:06 -0800)]
dictionary: Always compact immediately upon deletion of a variable.
With this change, the dictionary has a new invariant that the case_indexes
are always a permutation of [0,N) where N is the number of variables in
the dictionary. Most commonly, the case_indexes are the same as the
dict_indexes, but reordering the dictionary can permute them.
Ben Pfaff [Sun, 26 Feb 2023 00:51:00 +0000 (16:51 -0800)]
treewide: Use struct fmt_spec by value instead of pointer in most cases.
struct fmt_spec is a small struct, only 4 bytes in size. It doesn't make
sense to pass it by pointer in most cases. This commit makes that change
treewide.