Ben Pfaff [Sat, 1 Jan 2011 19:15:33 +0000 (11:15 -0800)]
DEBUG EVALUATE: Eliminate VAR_NAME_LEN limit.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 19:11:07 +0000 (11:11 -0800)]
VECTOR: Eliminate VAR_NAME_LEN limit for variable names.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 19:09:01 +0000 (11:09 -0800)]
MODIFY VARIABLES: Eliminate VAR_NAME_LEN limit on variable names.
This is actually a general code improvement, since it eliminates memory
allocation and copying that was not actually necessary.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 18:59:03 +0000 (10:59 -0800)]
GET DATA /TYPE=TXT: Get rid of VAR_NAME_LEN limit on variable names.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 18:56:55 +0000 (10:56 -0800)]
FILE HANDLE: Get rid of VAR_NAME_LEN limit on handle name.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 18:52:14 +0000 (10:52 -0800)]
combine-files: Eliminate VAR_NAME_LEN restriction from combine_files().
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 18:47:56 +0000 (10:47 -0800)]
vector: Remove VAR_NAME_LEN limit for internal representation of name.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sat, 1 Jan 2011 18:45:11 +0000 (10:45 -0800)]
variable: Remove VAR_NAME_LEN limit for internal representation of name.
Most uses of VAR_NAME_LEN within PSPP are wrong due to encoding issues:
the limit applies to variable names in the encoding used by the data
set, but most uses of VAR_NAME_LEN actually limit the length of a name
in UTF-8. The UTF-8 representation of a name can be longer or shorter
than its representation in the data set encoding, so it seems best to
eliminate references to VAR_NAME_LEN entirely.
Ben Pfaff [Sun, 30 Jan 2011 23:33:30 +0000 (15:33 -0800)]
sys-file-reader: Fix double-free on read of partial record.
partial_record() does a longjmp() to code near the top of
sys_file_casereader_read() that unrefs the case, but this code at the
end of sys_file_casereader_read() would have already unref'ed it once in
that case, resulting in a double-free.
Ben Pfaff [Mon, 31 Jan 2011 04:34:32 +0000 (20:34 -0800)]
hash-functions: Use C instead of preprocessor to test size of double.
I don't see a reason that this has to be done as an #if directive. The
compiler should be easily able to optimize out the branch that will never
be taken. This allows us to get rid of a configure check, so it seems
worthwhile to me.
Ben Pfaff [Sun, 2 Jan 2011 16:37:31 +0000 (08:37 -0800)]
README: Describe meaning of copyright year ranges.
This is required by the GNU maintainers guide as a prerequisite for using
copyright year ranges. So far, PSPP itself doesn't use ranges, but Gnulib
(which PSPP uses) does.
Ben Pfaff [Sat, 1 Jan 2011 21:42:04 +0000 (13:42 -0800)]
expressions: Fix test failures due to new year.
Some of the date-related test cases assumed that year 41 would be
interpreted as 1941, but due to the 30-year century window, as soon as it
became 2011 this assumption failed. Write these years explicitly as 1941
instead to fix the problem.
Ben Pfaff [Tue, 21 Dec 2010 08:12:09 +0000 (00:12 -0800)]
NPAR TESTS: Fix two test failures.
Tests "NPAR TESTS CHISQUARE with DESCRIPTIVES" and "NPAR TESTS CHISQUARE,
listwise missing" were failing because of some unexpected behavior of
lex_put_back(). This fixes the problem by avoiding lex_put_back()
entirely.
Ben Pfaff [Mon, 6 Dec 2010 06:21:14 +0000 (22:21 -0800)]
NPAR TESTS: Prefer lex_match_id() over lex_match_hyphenated_word()
This code used lex_match_hyphenated_word() in many places where it was
necessary to match a plain identifier. But it is better to use
lex_match_id() when it can be, because it is simpler and faster, so this
commit does that.
Ben Pfaff [Mon, 6 Dec 2010 06:19:34 +0000 (22:19 -0800)]
q2c: Prefer lex_match_id() over lex_match_hyphenated_word() in emitted code.
Until now, q2c has used lex_match_hyphenated_word() wherever it was
necessary to match a plain identifier. But it is better to use
lex_match_id() when it can be, because it is simpler and faster, so this
commit does that.
Ben Pfaff [Sun, 12 Dec 2010 06:17:01 +0000 (22:17 -0800)]
DEBUG XFORM FAIL: Issue an error message as part of transformation.
PSPP only returns a failure exit status if an error message is issued, but
DEBUG XFORM FAIL doesn't issue an error message. This means that, if PSPP
has no other errors, then it's difficult to tell that the transformation
really did what it should have. This commit fixes the potential problem.
Ben Pfaff [Sun, 12 Dec 2010 06:07:14 +0000 (22:07 -0800)]
categoricals: Make parameter to categoricals_done() const.
From a high-level point of view, categoricals_done() does not actually
mutate any data in a categoricals object. Instead, it just computes a
cache. So it seems reasonable to make it take a "const" parameter, and
this fixes a warning:
oneway.c: In function ‘run_oneway’:
oneway.c:502: warning: initialization discards qualifiers from pointer target type
Ben Pfaff [Sun, 12 Dec 2010 05:29:55 +0000 (21:29 -0800)]
covariance: Fix const-ness of covariance_calculate[_unnormalized] retval.
The covariance_calculate() and covariance_calculate_unnormalized()
functions documented that their return values were owned by the covariance
object itself and thus should not be freed by the caller. However, this
documentation was incorrect, because in fact the covariance object did not
retain the pointer at all. This commit fixes the comments, updates
the return values to be non-"const", and changes the callers to free the
returned "gsl_matrix" objects.
Ben Pfaff [Sun, 12 Dec 2010 05:09:17 +0000 (21:09 -0800)]
friedman: Fix GCC warning about uninitialized fr.w.
On my machine GCC 4.4 complains:
friedman.c: In function ‘friedman_execute’:
friedman.c:106: warning: ‘fr.w’ may be used uninitialized in this function
This appears to be because GCC can't see that the assignment to fr.w and
its later use (in show_sig_box()) both have the same condition. At any
rate, this commit suppresses the warning by always initializing fr.w.
Ben Pfaff [Sun, 5 Dec 2010 14:43:51 +0000 (06:43 -0800)]
gui: Factor out duplicated code for executing and pasting syntax.
Reducing code duplication is good on its own. This will also make it
easier in upcoming patches to swap out "getl_interface" with a new
structure, by eliminating most of the references to getl_interface.
Ben Pfaff [Sun, 21 Nov 2010 20:00:32 +0000 (12:00 -0800)]
Remove the PROMPT, CPROMPT, and DPROMPT settings.
These settings will be insufficient to configure prompting for the new
lexer, which is able to detect more special cases in syntax and report
them through the prompt. (However, if users actually want this feature,
then we could add it; it's not difficult.)
Ben Pfaff [Sat, 20 Nov 2010 05:05:04 +0000 (21:05 -0800)]
lexer: Change the functions for retrieving token strings.
Until now, lex_tokid() has been for T_ID tokens only and lex_tokstr() has
been for T_ID and T_STRING tokens. For T_ID tokens, lex_tokid() and
lex_tokstr() had slightly different semantics.
This doesn't entirely make sense, and these particular functions are not
the ones wanted most by clients, so this commit removes these functions
in favor of lex_tokcstr() and lex_tokss(), which are both applicable
to both T_ID and T_STRING tokens, with the same semantics in each case.
These functions are also easier for the upcoming reimplementation of the
lexer.
Ben Pfaff [Tue, 20 Jul 2010 05:52:18 +0000 (22:52 -0700)]
lexer: Get rid of lex_negative_to_dash().
This function stands in the way of replacing the lexer in a
straightforward way, because it disrupts the stream of tokens: the
lexer can't tell in advance whether, e.g., "-4" is one token or
two. Fortunately, it is not used in very many places and is
relatively easy to remove.
Ben Pfaff [Mon, 20 Sep 2010 00:37:30 +0000 (17:37 -0700)]
lexer: New type enum token_type.
It seems useful to have a type that indicates that a value is a token.
Furthermore, being able to enumerate all of the possible tokens in a
straightforward way seems worthwhile. It also makes it possible for
GCC to check "switch" statements on token types and to build arrays
indexed by token.
Ben Pfaff [Fri, 19 Nov 2010 06:19:58 +0000 (22:19 -0800)]
command: Factor command name matching out of command.c.
Making command parsing into a library will allow other code to use
the same functionality, which will be useful later in the lexer.
It also simplifies parsing command names and allows us to easily
add tests for command name parsing.
The new command name parsing code supports UTF-8. This is not useful yet,
because its only client does not feed it UTF-8 strings, but it will be
useful later when the rest of the lexer is rewritten, where it will gain
another client that does feed it UTF-8.
Ben Pfaff [Mon, 15 Nov 2010 06:13:37 +0000 (22:13 -0800)]
perl-module: Fix return value of append_case subroutine.
The casewriter_write() function does not have a return value (it is
declared as "void"), but the append_case subroutine tried to use its
return value anyway. This cannot work properly, of course, and in fact
caused problems on 64-bit builds in particular.
I don't know why there is no C compiler warning about this problem. I
guess the Perl module build must somehow turn off a lot of GCC warnings.
Reported by bojo42 <bojo42@gmail.com> in bug #31611.
Ben Pfaff [Mon, 15 Nov 2010 05:58:28 +0000 (21:58 -0800)]
perl-module: Only run the combined test if Text::Diff is present.
The combined test using Pspp.t only works if Text::Diff is installed
(although the broken-out tests don't require it), so only try that test if
Text::Diff is available.
Ben Pfaff [Mon, 15 Nov 2010 05:42:34 +0000 (21:42 -0800)]
tests: Only attempt to run PostgreSQL tests if the server is installed.
PSQL_SUPPORT only indicates that PSPP was compiled against the PostgreSQL
client library, but the test also requires the PostgreSQL server and
utilities to be installed, so skip the test if they are not.
Ben Pfaff [Fri, 5 Nov 2010 04:04:05 +0000 (21:04 -0700)]
csv: Better support separators other than comma or tab.
Before this commit, although any separator could be specified for cvs
output, the set of characters that triggered quoting was fixed, and only
really suitable for comma and tab separators. This commit fixes the
problem, making sure that whenever the specified separator appears in a
field, that field will be quoted.
Problem noticed during a discussion with Björn Manke <bjoernmanke@gmx.net>
on pspp-users.
Ben Pfaff [Tue, 2 Nov 2010 13:39:05 +0000 (06:39 -0700)]
Improve failure output of tests that use wc.
Commit 37c5ded73 "Make tests which use wc more robust." made these tests
tolerate slightly different output formats, but at the same time, if the
tests fail we don't find out why. This commit should retain the fix but
also provide more feedback in the log on failure.
Ben Pfaff [Sat, 30 Oct 2010 03:12:00 +0000 (20:12 -0700)]
cairo: Fix rendering of wide titles for GUI rendering.
The width of the title was not being taken into account in calculating the
size of a table_item in the code path used by the GUI, so titles wider
than their tables were truncated at the width of the table. This commit
fixes the problem.
Ben Pfaff [Wed, 27 Oct 2010 04:58:14 +0000 (21:58 -0700)]
psppire-output-window: Insert a half-line of space between output items.
Before, the lack of table titles put some vertical space into the output
window. Now that table titles are shown, there's no white space left, so
this commit reintroduces some by putting half a line of vertical white
space between output items.
Ben Pfaff [Wed, 27 Oct 2010 04:53:53 +0000 (21:53 -0700)]
cairo: Always save output item in xr_rendering_create().
Currently xr_rendering_create() only saves the output item passed in if it
is a chart. However an upcoming commit will have a need for table output
items too, so this commit always saves them.