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.
Ben Pfaff [Sun, 22 Jan 2023 20:32:59 +0000 (12:32 -0800)]
render: Fix spanned width distribution for cells not at top or left.
This code always used the widths of rules at the left or top side of the
table, even in cases where the spanned cells were not at the top of left
side of the table. This obviously made the calculations wrong sometimes.
Ben Pfaff [Mon, 6 Feb 2023 16:17:28 +0000 (08:17 -0800)]
output: Correctly define and properly implement column width ranges.
I previously had the idea that SPV files had ranges for both column
widths and row heights, which didn't really make sense, since if
you fix the range of one of those you have to be flexible about the
other. However, these settings actually control just column widths,
in two sets of columns: the columns for row headings and the columns
for column headings. This implements those properly.
Ben Pfaff [Fri, 10 Feb 2023 18:54:25 +0000 (10:54 -0800)]
spv-driver: Add page_setup to output files and allow user to configure them.
This seems better than what I see happening otherwise, which can be that
the default page_setup that SPSS Viewer picks is a ridiculous one, like a
postcard page size.
Ben Pfaff [Fri, 10 Feb 2023 17:25:43 +0000 (09:25 -0800)]
cairo: Fix crashes and bugs in 'setup' call.
Changing the page_setup was not properly supported for PNG and SVG output,
because it assert-failed in xr_set_surface_size(). In addition, for all
kinds of output, it didn't account for margins properly in the page size.
This fixes the problem and unifies page setup between initial driver
creation and update.
This wasn't noticed before because output_set_page_setup() wasn't used
much, but it could be triggered with the pspp-output utility, converting
from an SPV file that contained a page_setup. It will become more
important because an upcoming commit will cause the SPV driver to output
a page_setup every time.
Ben Pfaff [Sat, 28 Jan 2023 18:16:25 +0000 (10:16 -0800)]
ascii: Improve look of dashed line ends.
Until now, partial ends of horizontal dashed lines were rendered as
U+2574 BOX DRAWINGS LIGHT LEFT and U+2576 BOX DRAWINGS LIGHT RIGHT,
which are solid lines. This looks funny at the end of a dashed line,
especially in some fonts. This commit changes these ends to
U+254C BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL, which does extend all the
way across the character cell but looks much better.
Ben Pfaff [Sun, 22 Jan 2023 18:41:03 +0000 (10:41 -0800)]
table: Make debug code unconditional.
The debugging code in table_vline() and table_hline() was in practice
always enabled, but because of the way it was written each of the tests
was being re-tested in an assertion. It seems better to just enable it
all the time and avoid duplication.
Ben Pfaff [Fri, 27 Jan 2023 19:43:00 +0000 (11:43 -0800)]
pivot-table: Fix buffer overflow in corner case in pivot_table_dump().
Dumping a table with a layer dimension that has no leaves read from an
invalid pointer. This fixes the problem. This functionality isn't used
in PSPP, only by "pspp-output dump".
Ben Pfaff [Fri, 27 Jan 2023 02:35:38 +0000 (18:35 -0800)]
pivot-table: Fix buffer overflow in pivot_table_dump() in corner case.
This occurred when categories were more deeply nested into groups than
there were leaf categories. This functionality isn't used in PSPP, only
by "pspp-output dump".
Ben Pfaff [Sun, 15 Jan 2023 18:05:03 +0000 (10:05 -0800)]
output: Combine color and stroke into table_border_style.
Rules in tables have a line style (stroke) and a color. Until now, these
have been mostly maintained separately. This commit combines them in most
places.
Ben Pfaff [Sun, 15 Jan 2023 17:28:08 +0000 (09:28 -0800)]
render: Get rid of RENDER_LINE_* in favor of similar TABLE_STROKE_*.
These had the same values. They were separated for abstraction reasons
that don't seem to be needed, and eliminating one of them eliminates some
conversions.
Ben Pfaff [Fri, 23 Dec 2022 20:48:50 +0000 (12:48 -0800)]
table: Remove table_box().
It was only used from table_put() to erase any rules within a joined cell,
but the client code didn't ever put rules in a joined cell, so it was only
used as a no-op.
Ben Pfaff [Sun, 27 Nov 2022 18:05:35 +0000 (10:05 -0800)]
Move all command implementations into a single 'commands' directory.
The original division of commands into subdirectories was fairly arbitrary,
and over time it got more confusing, even to me (who made the divisions
to begin with). I don't see a problem with having them in a single
directory, and it will confuse me less. This commit moves them all into
one place.
Ben Pfaff [Thu, 24 Nov 2022 00:39:35 +0000 (16:39 -0800)]
CTABLES: Make EMPTY independent of other settings on CATEGORIES.
Frans Houweling reported that the following two commands behave
differently:
CTABLES /TABLE=class > datum BY size
/CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE
/CATEGORIES VARIABLES=size TOTAL=YES.
CTABLES /TABLE=class > datum BY size
/CATEGORIES VARIABLES=size TOTAL=YES
/CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE.
There was a good reason for this, which is that CATEGORIES always changes
all the category attributes of whatever variables are named. That is,
CATEGORIES VARIABLES=ALL overrides TOTAL even if EMPTY is the only
subcommand given. I don't know what SPSS does here, but this behavior is
surprising enough that I wanted to change it. This commit does that;
afterward, both of the above commands behave the same way, which
combines effects of TOTAL=YES and EMPTY=EXCLUDE for size and just
EMPTY=EXCLUDE for the class and datum.