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.
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".