pspp
2 years agobetter error messages are awesome! matrix4
Ben Pfaff [Fri, 3 Dec 2021 06:15:01 +0000 (22:15 -0800)]
better error messages are awesome!

2 years agoexperiments
Ben Pfaff [Tue, 30 Nov 2021 14:49:03 +0000 (06:49 -0800)]
experiments

2 years agoworking
Ben Pfaff [Tue, 30 Nov 2021 14:50:13 +0000 (06:50 -0800)]
working

2 years agowork on better matrix error reporting
Ben Pfaff [Tue, 30 Nov 2021 14:12:14 +0000 (06:12 -0800)]
work on better matrix error reporting

2 years agowork toward better error reporting
Ben Pfaff [Mon, 22 Nov 2021 03:39:29 +0000 (19:39 -0800)]
work toward better error reporting

2 years agomessage: Intern file names in msg_location to make them cheaper to copy.
Ben Pfaff [Thu, 25 Nov 2021 01:00:57 +0000 (17:00 -0800)]
message: Intern file names in msg_location to make them cheaper to copy.

2 years agolexer: Allow for negative lookahead within a command.
Ben Pfaff [Tue, 23 Nov 2021 03:16:48 +0000 (19:16 -0800)]
lexer: Allow for negative lookahead within a command.

This allows to getting the location of prior tokens within a command,
which makes it easier to find the end of a group of tokens that was just
parsed by referring to the token at offset -1.

2 years agosegment: Add comment about zero-length segments.
Ben Pfaff [Tue, 30 Nov 2021 14:54:48 +0000 (06:54 -0800)]
segment: Add comment about zero-length segments.

2 years agoAdd missing 'distributions' files.
Ben Pfaff [Mon, 22 Nov 2021 20:46:34 +0000 (12:46 -0800)]
Add missing 'distributions' files.

2 years agolexer: Drop 'line_pos' from lex_token and lex_source.
Ben Pfaff [Mon, 22 Nov 2021 20:46:19 +0000 (12:46 -0800)]
lexer: Drop 'line_pos' from lex_token and lex_source.

It can now be calculated by reading backward in the source buffer.

2 years agolexer: Keep entire source file in memory.
Ben Pfaff [Mon, 22 Nov 2021 19:45:48 +0000 (11:45 -0800)]
lexer: Keep entire source file in memory.

Previously, the lexer tried to keep only part of each source file in
memory, the part that wasn't fully parsed yet.  With this commit, the
lexer holds the entire file in memory, even parts that are no longer
needed.  This should make it easier to produce better error messages.

2 years agoRevert "work toward better error reporting"
Ben Pfaff [Mon, 22 Nov 2021 03:39:31 +0000 (19:39 -0800)]
Revert "work toward better error reporting"

This reverts commit 73d1c7eda1b9ea351bb37c55a9be592a4884a516.

2 years agowork toward better error reporting
Ben Pfaff [Mon, 22 Nov 2021 03:39:29 +0000 (19:39 -0800)]
work toward better error reporting

2 years agoFix up \s.
Ben Pfaff [Sun, 21 Nov 2021 22:57:37 +0000 (14:57 -0800)]
Fix up \s.

2 years agoDocument statistical functions
Ben Pfaff [Sun, 21 Nov 2021 22:25:19 +0000 (14:25 -0800)]
Document statistical functions

2 years agoUse constraints more widely in matrix functions.
Ben Pfaff [Sun, 21 Nov 2021 21:50:12 +0000 (13:50 -0800)]
Use constraints more widely in matrix functions.

2 years agocheck number of args to matrix functions
Ben Pfaff [Sun, 21 Nov 2021 21:32:36 +0000 (13:32 -0800)]
check number of args to matrix functions

2 years agoAll the distribution functions, though they're untested.
Ben Pfaff [Sun, 21 Nov 2021 21:16:19 +0000 (13:16 -0800)]
All the distribution functions, though they're untested.

2 years agoA few more distributions.
Ben Pfaff [Sat, 20 Nov 2021 22:47:01 +0000 (14:47 -0800)]
A few more distributions.

2 years agoImplement lots of distributions in MATRIX.
Ben Pfaff [Sat, 20 Nov 2021 22:41:54 +0000 (14:41 -0800)]
Implement lots of distributions in MATRIX.

2 years agowork toward distribution functions
Ben Pfaff [Sat, 20 Nov 2021 19:23:10 +0000 (11:23 -0800)]
work toward distribution functions

2 years agoMATRIX WRITE examples.
Ben Pfaff [Sat, 20 Nov 2021 03:46:28 +0000 (19:46 -0800)]
MATRIX WRITE examples.

2 years agoRELEASE tests
Ben Pfaff [Fri, 19 Nov 2021 03:55:47 +0000 (19:55 -0800)]
RELEASE tests

2 years agoMSAVE tests
Ben Pfaff [Fri, 19 Nov 2021 03:37:23 +0000 (19:37 -0800)]
MSAVE tests

2 years agoMATRIX MGET negative tests
Ben Pfaff [Thu, 18 Nov 2021 01:34:20 +0000 (17:34 -0800)]
MATRIX MGET negative tests

2 years agoMATRIX MGET with factor and splits and TYPE
Ben Pfaff [Tue, 16 Nov 2021 05:03:06 +0000 (21:03 -0800)]
MATRIX MGET with factor and splits and TYPE

2 years agofix up test output
Ben Pfaff [Fri, 12 Nov 2021 03:50:45 +0000 (19:50 -0800)]
fix up test output

2 years agomore improvement
Ben Pfaff [Fri, 12 Nov 2021 03:48:36 +0000 (19:48 -0800)]
more improvement

2 years agoImprove MGET output table.
Ben Pfaff [Fri, 12 Nov 2021 03:46:02 +0000 (19:46 -0800)]
Improve MGET output table.

2 years agoBasic MGET tests work.
Ben Pfaff [Fri, 12 Nov 2021 03:27:50 +0000 (19:27 -0800)]
Basic MGET tests work.

2 years agoMore MATRIX SAVE negative tests.
Ben Pfaff [Tue, 9 Nov 2021 06:55:13 +0000 (22:55 -0800)]
More MATRIX SAVE negative tests.

2 years agoMATRIX SAVE negative tests
Ben Pfaff [Mon, 8 Nov 2021 19:37:02 +0000 (11:37 -0800)]
MATRIX SAVE negative tests

2 years agoMATRIX SAVE inline positive tests.
Ben Pfaff [Mon, 8 Nov 2021 01:47:14 +0000 (17:47 -0800)]
MATRIX SAVE inline positive tests.

2 years agoMATRIX SAVE positive tests.
Ben Pfaff [Mon, 8 Nov 2021 01:27:19 +0000 (17:27 -0800)]
MATRIX SAVE positive tests.

2 years agoGET is well tested.
Ben Pfaff [Sun, 7 Nov 2021 19:17:46 +0000 (11:17 -0800)]
GET is well tested.

2 years agoMATRIX GET works with the active file.
Ben Pfaff [Sun, 7 Nov 2021 03:40:42 +0000 (20:40 -0700)]
MATRIX GET works with the active file.

2 years agoMATRIX GET positive test
Ben Pfaff [Sun, 7 Nov 2021 03:09:24 +0000 (20:09 -0700)]
MATRIX GET positive test

2 years agoREAD and WRITE are tested.
Ben Pfaff [Sun, 7 Nov 2021 02:38:19 +0000 (19:38 -0700)]
READ and WRITE are tested.

2 years agoformat: Make fmt_check() easier to translate.
Ben Pfaff [Sat, 6 Nov 2021 21:15:29 +0000 (14:15 -0700)]
format: Make fmt_check() easier to translate.

2 years agoTest REREAD also.
Ben Pfaff [Sat, 6 Nov 2021 18:56:20 +0000 (11:56 -0700)]
Test REREAD also.

2 years agoMore READ negative tests.
Ben Pfaff [Sat, 6 Nov 2021 18:52:27 +0000 (11:52 -0700)]
More READ negative tests.

2 years agoREAD negative tests
Ben Pfaff [Sat, 6 Nov 2021 18:42:26 +0000 (11:42 -0700)]
READ negative tests

2 years agoMake tests pass again.
Ben Pfaff [Sat, 6 Nov 2021 18:30:15 +0000 (11:30 -0700)]
Make tests pass again.

2 years agomatrix docs
Ben Pfaff [Sat, 6 Nov 2021 05:58:13 +0000 (22:58 -0700)]
matrix docs

2 years agoMATRIX: Implement HOLD (untested).
Ben Pfaff [Sat, 6 Nov 2021 05:58:07 +0000 (22:58 -0700)]
MATRIX: Implement HOLD (untested).

2 years agoMATRIX: Factor out write_file, like read_file.
Ben Pfaff [Sat, 6 Nov 2021 05:40:28 +0000 (22:40 -0700)]
MATRIX: Factor out write_file, like read_file.

2 years agoMATRIX: Fix leak on error path.
Ben Pfaff [Sat, 6 Nov 2021 02:59:59 +0000 (19:59 -0700)]
MATRIX: Fix leak on error path.

2 years agoAdd an example for MATRIX PRINT.
Ben Pfaff [Mon, 25 Oct 2021 16:57:08 +0000 (09:57 -0700)]
Add an example for MATRIX PRINT.

2 years agoMore matrix examples.
Ben Pfaff [Mon, 25 Oct 2021 04:37:06 +0000 (21:37 -0700)]
More matrix examples.

2 years agowork on examples
Ben Pfaff [Mon, 25 Oct 2021 01:28:30 +0000 (18:28 -0700)]
work on examples

2 years agoMATRIX command documentation is complete (but needs examples)
Ben Pfaff [Sun, 24 Oct 2021 23:40:04 +0000 (16:40 -0700)]
MATRIX command documentation is complete (but needs examples)

2 years agoDocument more matrix stuff.
Ben Pfaff [Tue, 12 Oct 2021 06:03:06 +0000 (23:03 -0700)]
Document more matrix stuff.

2 years agodocumentation
Ben Pfaff [Sat, 9 Oct 2021 23:10:21 +0000 (16:10 -0700)]
documentation

2 years agoImprove matrix error messages.
Ben Pfaff [Sat, 9 Oct 2021 21:56:18 +0000 (14:56 -0700)]
Improve matrix error messages.

2 years agoMATRIX: Fix memory leaks.
Ben Pfaff [Sat, 9 Oct 2021 20:08:24 +0000 (13:08 -0700)]
MATRIX: Fix memory leaks.

2 years agoWork on documentation
Ben Pfaff [Sat, 9 Oct 2021 06:19:37 +0000 (23:19 -0700)]
Work on documentation

2 years agodocs
Ben Pfaff [Fri, 8 Oct 2021 05:52:54 +0000 (22:52 -0700)]
docs

2 years agofunction documentation
Ben Pfaff [Thu, 7 Oct 2021 21:11:23 +0000 (14:11 -0700)]
function documentation

2 years agowork on docs
Ben Pfaff [Thu, 7 Oct 2021 05:43:41 +0000 (22:43 -0700)]
work on docs

2 years agoMATRIX
Ben Pfaff [Mon, 27 Sep 2021 05:35:44 +0000 (22:35 -0700)]
MATRIX

2 years agodataset: Fix memory leak destroying a dataset that has a permanent_dict.
Ben Pfaff [Sat, 9 Oct 2021 17:20:28 +0000 (10:20 -0700)]
dataset: Fix memory leak destroying a dataset that has a permanent_dict.

Found by Address Sanitizer.

2 years agopivot-table-test: Fix memory leak when table is not displayed.
Ben Pfaff [Sat, 9 Oct 2021 17:13:34 +0000 (10:13 -0700)]
pivot-table-test: Fix memory leak when table is not displayed.

Found by Address Sanitizer.

2 years agolexer: Fix memory leak merging tokens only some of which come from macros.
Ben Pfaff [Sat, 9 Oct 2021 17:10:35 +0000 (10:10 -0700)]
lexer: Fix memory leak merging tokens only some of which come from macros.

Found by Address Sanitizer.

2 years agomacro: Fix memory leaks in error cases parsing function arguments.
Ben Pfaff [Sat, 9 Oct 2021 16:41:01 +0000 (09:41 -0700)]
macro: Fix memory leaks in error cases parsing function arguments.

Found by Address Sanitizer.

2 years agolexer: Fix memory leak when macro expands as empty.
Ben Pfaff [Sat, 9 Oct 2021 16:35:41 +0000 (09:35 -0700)]
lexer: Fix memory leak when macro expands as empty.

Found by Address Sanitizer.

2 years agomacro: Fix memory leak expanding !DO loop over list.
Ben Pfaff [Sat, 9 Oct 2021 16:32:02 +0000 (09:32 -0700)]
macro: Fix memory leak expanding !DO loop over list.

Found by Address Sanitizer.

2 years agomacro: Fix memory leak with keyword "enclose" arguments.
Ben Pfaff [Sat, 9 Oct 2021 16:23:52 +0000 (09:23 -0700)]
macro: Fix memory leak with keyword "enclose" arguments.

The memory for the argument was being allocated two places, which caused
the first-allocated block to be leaked.

Found by Address Sanitizer.

2 years agosegment: Fix read past end of buffer when input ends in '-'.
Ben Pfaff [Sat, 9 Oct 2021 16:13:40 +0000 (09:13 -0700)]
segment: Fix read past end of buffer when input ends in '-'.

Thanks to John Darrington for reporting this.
Found by Address Sanitizer.

2 years agoexpressions: Parse multiple sets of parentheses for grouping together.
Ben Pfaff [Wed, 6 Oct 2021 05:15:28 +0000 (22:15 -0700)]
expressions: Parse multiple sets of parentheses for grouping together.

Fuzzers are fond of driving expression parsers to failure by exhausting
the stack in trivial ways.  This defeats the simplest attempts by
lining up thousands of left parentheses in a row.

I am a bit curious whether the fuzzer will now invent something more
sophisticated, such as nested function calls or non-empty expressions like
1+(1+(1+(1+(1+....

This fixes bug #61286.
Thanks to Irfan Ariq for reporting the bug.

2 years agoDATA LIST: Fix assertion when RECORDS given twice with decreasing value.
Ben Pfaff [Wed, 6 Oct 2021 04:57:37 +0000 (21:57 -0700)]
DATA LIST: Fix assertion when RECORDS given twice with decreasing value.

Fixes bug #61285.
Thanks to Irfan Ariq for reporting this bug.

2 years agodictionary: Allow dict_set_documents() argument to reference old documents.
Ben Pfaff [Tue, 5 Oct 2021 16:19:26 +0000 (09:19 -0700)]
dictionary: Allow dict_set_documents() argument to reference old documents.

merge_dictionary() in combine-file.c includes the old documents in the new
ones by just copying pointers.  dict_set_documents() didn't handle this
properly.  This fixes the problem.

Fixes bug #61258.
Thanks to Irfan Ariq for reporting the problem.

2 years agoencoding-guesser: Avoid reading uninitialized data for zero-length files.
Ben Pfaff [Tue, 5 Oct 2021 15:47:46 +0000 (08:47 -0700)]
encoding-guesser: Avoid reading uninitialized data for zero-length files.

Found while investigating bug #61254.
Thanks to Irfan Ariq for reporting this bug.

2 years agosegment: Fix 1-byte read past initialized data when file ends in CR.
Ben Pfaff [Tue, 5 Oct 2021 06:14:32 +0000 (23:14 -0700)]
segment: Fix 1-byte read past initialized data when file ends in CR.

Fixes bug #61253.
Thanks to Irfan Ariq for reporting this bug.

2 years agoRemove some unnecessary gettext macro definitions
John Darrington [Sun, 3 Oct 2021 06:03:44 +0000 (08:03 +0200)]
Remove some unnecessary gettext macro definitions

2 years agoFix compiler warning
John Darrington [Sat, 2 Oct 2021 19:16:55 +0000 (21:16 +0200)]
Fix compiler warning

2 years agoFix memory leak in tokenize_string_segment
John Darrington [Sat, 2 Oct 2021 16:33:21 +0000 (18:33 +0200)]
Fix memory leak in tokenize_string_segment

2 years agoFix memory leak in MCONVERT
John Darrington [Sat, 2 Oct 2021 14:51:37 +0000 (16:51 +0200)]
Fix memory leak in MCONVERT

2 years agoFix memory leak upon failure to create matrix reader
John Darrington [Sat, 2 Oct 2021 14:35:42 +0000 (16:35 +0200)]
Fix memory leak upon failure to create matrix reader

2 years agoMore ASAN_OPTIONS
John Darrington [Sat, 2 Oct 2021 14:31:14 +0000 (16:31 +0200)]
More ASAN_OPTIONS

2 years agoUse XCALLOC / XZALLOC macros where reasonable
John Darrington [Sat, 2 Oct 2021 13:32:40 +0000 (15:32 +0200)]
Use XCALLOC / XZALLOC macros where reasonable

2 years agoFix possible segfault when running RANK with bad syntax
John Darrington [Sat, 2 Oct 2021 04:48:57 +0000 (06:48 +0200)]
Fix possible segfault when running RANK with bad syntax

* src/language/stats/rank.c (): Initialise the vars member

Fixes bug #61257

2 years agoReplace numerous instances of xzalloc with XZALLOC
John Darrington [Sat, 2 Oct 2021 04:47:31 +0000 (06:47 +0200)]
Replace numerous instances of xzalloc with XZALLOC

2 years agoMatrix readers - fix memory leaks
John Darrington [Sun, 26 Sep 2021 18:26:45 +0000 (20:26 +0200)]
Matrix readers - fix memory leaks

* src/language/data-io/matrix-reader.c (matrix_reader_destroy): free members cvar, svars and fvars

2 years agoIgnore sanitizer ODR warnings, during testing with -fsanitize=address
John Darrington [Sun, 26 Sep 2021 18:39:38 +0000 (20:39 +0200)]
Ignore sanitizer ODR warnings, during testing with -fsanitize=address

* tests/libpspp/sparse-xarray-test.at: Set detect_odr_violation=0

2 years agoImplement the MCONVERT command.
Ben Pfaff [Mon, 27 Sep 2021 05:35:33 +0000 (22:35 -0700)]
Implement the MCONVERT command.

2 years agolexer: Fix use-after-free error in lex_source_get_lookahead().
Ben Pfaff [Sun, 26 Sep 2021 18:06:45 +0000 (11:06 -0700)]
lexer: Fix use-after-free error in lex_source_get_lookahead().

This code used local variable 'out' as if its value stayed the same from
one iteration of the loop to the next, but in fact its scope meant that
it became indeterminate on each new iteration.  This commit fixes the
problem by moving its declaration to an outer scope.

Thanks to John Darrington for reporting the problem.

2 years agoAvoid numerical problems with missing weights on non-linear cases.
John Darrington [Sun, 26 Sep 2021 14:53:38 +0000 (16:53 +0200)]
Avoid numerical problems with missing weights on non-linear cases.

* src/math/order-stats.c (order_stats_accumulate_idx): Ignore cases
  with missing weight values.

2 years agoFix possible incorrect assertion when creating unique casereaders.
John Darrington [Sat, 25 Sep 2021 16:59:52 +0000 (18:59 +0200)]
Fix possible incorrect assertion when creating unique casereaders.

* src/data/casereader-translator.c (uniquify): Force dir to be an element of  {0, 1, -1}

2 years agoRemove unused module src/math/extrema
John Darrington [Sat, 25 Sep 2021 09:41:04 +0000 (11:41 +0200)]
Remove unused module src/math/extrema

* src/math/extrema.c: Delete
* src/math/extrema.h: Delete
* src/math/automake.mk: Remove entries for src/math/extrema.c and
  src/math/extrema.h

2 years agoOptions dialog: add checkbox for startup tips
John Darrington [Sat, 11 Sep 2021 05:39:29 +0000 (07:39 +0200)]
Options dialog: add checkbox for startup tips

2 years agosys-file-encoding: Automatically generate the .c file at build time.
Ben Pfaff [Mon, 6 Sep 2021 17:07:41 +0000 (10:07 -0700)]
sys-file-encoding: Automatically generate the .c file at build time.

Suggested by John Darrington.

2 years agoWindows/build-dependencies: Add -fstack-protector flags
John Darrington [Sun, 5 Sep 2021 11:16:33 +0000 (13:16 +0200)]
Windows/build-dependencies: Add -fstack-protector flags

For some reason this flag seems to be necessary with the latest
x86_64_w64-mingw32 toolchain.

2 years agoWindows/build-dependencies: Use correct logical OR operator
John Darrington [Sun, 5 Sep 2021 11:01:25 +0000 (13:01 +0200)]
Windows/build-dependencies: Use correct logical OR operator

2 years agoWindows/build-dependencies: New flag --no-clean
John Darrington [Sun, 5 Sep 2021 10:59:49 +0000 (12:59 +0200)]
Windows/build-dependencies: New flag --no-clean

2 years agoAdd some missing #include directives
John Darrington [Sat, 4 Sep 2021 07:36:55 +0000 (09:36 +0200)]
Add some missing #include directives

* src/language/stats/crosstabs.c: Add missing #include directive.
* src/libpspp/pool.c: Add missing #include directive.

2 years agoMATRIX DATA: Fully implement.
Ben Pfaff [Fri, 3 Sep 2021 05:15:53 +0000 (22:15 -0700)]
MATRIX DATA: Fully implement.

This command had a partial implementation for correlation matrices that
left out some of the language features.  This commit adds those features.

2 years agocase: Introduce new functions for numbers and substrings in cases.
Ben Pfaff [Fri, 3 Sep 2021 02:59:23 +0000 (19:59 -0700)]
case: Introduce new functions for numbers and substrings in cases.

Use the case_num_*() functions everywhere in the tree for clarity and
brevity.

2 years agosys-file-encoding: Put the buffer-read-only declaration at the very top.
Ben Pfaff [Fri, 3 Sep 2021 01:45:39 +0000 (18:45 -0700)]
sys-file-encoding: Put the buffer-read-only declaration at the very top.

This accidentally got pushed down when license notices were added to a
bunch of files en masse.  It only works if it's at the top.

2 years agoRemove unneeded Emacs declarations that say that a .c file is in C.
Ben Pfaff [Sat, 31 Jul 2021 02:48:08 +0000 (19:48 -0700)]
Remove unneeded Emacs declarations that say that a .c file is in C.

These were there because they were formerly .q files.

2 years agoDEFINE: Properly support redefining a macro.
Ben Pfaff [Thu, 2 Sep 2021 16:23:11 +0000 (09:23 -0700)]
DEFINE: Properly support redefining a macro.

Redefining a macro didn't work in simple cases because the macro name was
being expanded in the DEFINE command.

Thanks to Frans Houweling for reporting the bug.