Ben Pfaff [Sat, 19 Feb 2011 20:55:54 +0000 (12:55 -0800)]
data-out: Optimize and fix some bad assumptions.
Until now, data_out_pool() and its wrapper function data_out() have always
done at least two memory allocations: one to fill in the initial version
of the result and another to recode it to UTF-8. However, recoding to
UTF-8 is usually unnecessary, because most output formats always produce
output in UTF-8 anyway. Only binary formats and the string A format ever
produce data in other encodings, so this commit drops recoding entirely
except for those cases. Binary formats are a particularly special case:
usually it doesn't make any sense to use these formats for text output,
but this commit does its best to translate the binary output bytes into
valid UTF-8, at least up to the first null byte.
This commit also finishes fixing up display widths.
The closely related data_out_legacy() function, which only has one user
in three also needed some work. It was badly named, so I renamed it to
data_out_recode(). It made the bad assumption that the data passed in
was encoded in ASCII (written C_ENCODING). It also made the bad
assumption that the number of bytes output would be exactly the format's
width. This rewrite fixes these problems.
Ben Pfaff [Sat, 19 Feb 2011 05:58:08 +0000 (21:58 -0800)]
pool: Support NULL pool argument to pool_alloc_unaligned().
I don't see a reason that this should be unsupported.
Ben Pfaff [Thu, 17 Feb 2011 05:42:13 +0000 (21:42 -0800)]
data-out: Reorganize output_Z() to be more easily understood.
It took me a minute to figure out what was going on here, so this commit
slightly reorganizes it.
Ben Pfaff [Sat, 19 Feb 2011 05:55:18 +0000 (21:55 -0800)]
format: Count prefix and suffix width in terms of display columns.
Until now, the prefixes and suffixes for custom currency formats
(CCA, etc.) have been considered to occupy one display column per
byte. This is fine for prefixes and suffixes like "$" or "%", but
falls down badly with U+00A5 (¥) or U+20AC (€), which occupy two
or three bytes, respectively, in UTF-8, while occupying only a
single display column.
This commit fixes the problem. It doesn't add a test yet because
there are still some higher-level issues, but that will come in
a later commit when those remaining issues are resolved.
Ben Pfaff [Wed, 16 Feb 2011 06:00:33 +0000 (22:00 -0800)]
format: Create a new "struct fmt_affix" for prefix and suffix strings.
This combines two changes: changing the string type for numeric
prefix and suffix strings from "struct substring" to plain "char *",
and putting the string inside a new structure. Both of these will
make more sense after the following commit, which adds another member
to the new structure and stops using the length of the string in so
many places (which is the reason that "struct substring" was a good
choice).
Ben Pfaff [Sat, 19 Feb 2011 06:30:00 +0000 (22:30 -0800)]
data-out: Make each converter responsible for storing null terminator.
Until now, every converter has produced output that is exactly as many
bytes long as the format's width. In upcoming patches this will change,
because in UTF-8 a character that occupies a single display column can
require multiple bytes. In preparation, this commit requires the
individual converters to write out their own null byte, giving a bit
more flexibility regarding length.
Ben Pfaff [Tue, 15 Feb 2011 07:17:11 +0000 (23:17 -0800)]
format: Increase abstraction of fmt_number_style.
Upcoming commits will make some changes to fmt_number_style, so it
seems best to avoid having clients actually construct and modify
instances of this structure. This commit makes that change.
We could take it one step further and add accessor functions even
for reading out the structure, but in my opinion that would be
overkill for this structure.
Ben Pfaff [Sun, 13 Feb 2011 19:23:06 +0000 (11:23 -0800)]
legacy-encoding: Remove.
The functions in this module are no longer used.
Ben Pfaff [Sun, 13 Feb 2011 19:49:30 +0000 (11:49 -0800)]
i18n: Introduce C_ENCODING as replacement for LEGACY_NATIVE.
The LEGACY_NATIVE name seems a bit awkward for something that is just the
name of the encoding for strings in C source code, that is, the C locale,
so this commit renames it to C_ENCODING and moves it to i18n.h with the
rest of the encoding-related functions.
In addition, PSPP assumes in various places that the local system has
ASCII-based locales. I don't think there's much point in pretending to
support EBCDIC, so this commit removes that little bit of support.
Ben Pfaff [Sun, 13 Feb 2011 19:36:27 +0000 (11:36 -0800)]
i18n: New function recode_byte().
Ben Pfaff [Sun, 20 Feb 2011 00:55:58 +0000 (16:55 -0800)]
PRINT: Use UTF-8 encoding for output to the output subsystem.
All string data coming into the output subsystem must be encoded in UTF-8,
but PRINT was recoding it into ASCII instead.
Ben Pfaff [Tue, 15 Feb 2011 06:04:51 +0000 (22:04 -0800)]
CROSSTABS: Eliminate redundant data copying.
There's no point in copying the output string twice.
Ben Pfaff [Mon, 14 Feb 2011 06:20:45 +0000 (22:20 -0800)]
Use new Gnulib function dtoastr() to format short, accurate real numbers.
%.*g with DBL_DIG + 1 as argument is simple but in rare cases it fails to
accurately format a real number. The recently added Gnulib routine
dtoastr() always formats a real number accurately, so switch to using it
for these cases.
Ben Pfaff [Sun, 13 Feb 2011 19:20:35 +0000 (11:20 -0800)]
operations.def: Fix indentation.
Ben Pfaff [Sat, 12 Feb 2011 16:02:48 +0000 (08:02 -0800)]
PRINT SPACE: When an output file is specified, don't ignore expression.
When both OUTFILE= and an expression were specified on PRINT SPACE, the
expression was ignored (if it was only a single token) or an error would
occur (if it was was more than one token).
Ben Pfaff [Sun, 6 Feb 2011 21:39:38 +0000 (13:39 -0800)]
GET DATA: Get rid of lex_put_back().
An upcoming commit will get rid of lex_put_back(), so don't use it here.
Ben Pfaff [Sun, 12 Dec 2010 22:00:28 +0000 (14:00 -0800)]
float-format: Eliminate tests' dependence on exact string encoding.
Until now, the float-format tests have depended on the PSPP syntax
accepting arbitrary byte values in strings, without treating them as part
of any particular encoding. The lexer is being rewritten so that this
assumption is no longer true, so this commit eliminates this assumption in
the float-format tests. After this commit, the tests only use ASCII
characters in strings.
Ben Pfaff [Sun, 2 Jan 2011 00:42:06 +0000 (16:42 -0800)]
por-file-reader: Remove dependency on VAR_NAME_LEN.
VAR_NAME_LEN wasn't really needed here because we knew that the name we
started from was no more than 8 bytes long. Also, we know that we can
come up with a unique name within ULONG_MAX tries since we'd run out of
memory before running out of values to try.
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, 2 Jan 2011 00:30:42 +0000 (16:30 -0800)]
text-data-import-dialog: Eliminate VAR_NAME_LEN restriction.
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, 2 Jan 2011 00:26:25 +0000 (16:26 -0800)]
REGRESSION: Eliminate restriction to VAR_NAME_LEN in reg_get_name().
There's still an obvious problem here that the prefix isn't being trimmed
down so that the suffix will fit. Since an upcoming series of changes
would have to completely redo how this would be done, I'm not fixing that
now, only marking it with XXX.
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, 2 Jan 2011 00:16:30 +0000 (16:16 -0800)]
FLIP: Eliminate false dependency on VAR_NAME_LEN.
The size of this buffer really shouldn't have anything to do with
VAR_NAME_LEN but with the string about to be put into it.
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, 2 Jan 2011 00:08:03 +0000 (16:08 -0800)]
DESCRIPTIVES: Eliminate main restriction on Z-score variable name length.
Ben Pfaff [Sat, 1 Jan 2011 23:54:54 +0000 (15:54 -0800)]
variable-parser: Drop VAR_NAME_LEN restriction from var_set_lookup_var_idx().
This restriction is purely artificial, as part of an assertion. Since
longer variable names are going to have to be supported, remove it.
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 21:00:49 +0000 (13:00 -0800)]
variable-parser: Rewrite parse_DATA_LIST_vars().
This rewrite was prompted by getting rid of the VAR_NAME_LEN limit inside
parse_DATA_LIST_vars(), but then I noticed that the variable naming and
coding style was dated, and that duplicate variable names were only
detected for variables named using TO, not for individual names, so I
rewrote much of the code instead.
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.
Ben Pfaff [Sat, 1 Jan 2011 19:05:14 +0000 (11:05 -0800)]
DATAFILE ATTRIBUTE, VARIABLE ATTRIBUTE: 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 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 [Sat, 1 Jan 2011 18:39:07 +0000 (10:39 -0800)]
dict: Make dict_make_unique_var_name() return an allocated string.
Ben Pfaff [Sun, 12 Dec 2010 22:29:00 +0000 (14:29 -0800)]
tests: Add `check-programs' target.
Occasionally I want to build all the programs required to run "make check"
without actually running the tests. This target allows me to do that.
Ben Pfaff [Mon, 27 Dec 2010 05:12:06 +0000 (21:12 -0800)]
Smake: Avoid duplicating $(GNULIB_TOOL) invocation.
The "all" and "gnulib" rules both contained the same gnulib-tool
invocation. This commit changes the "all" rule to use the "gnulib" rule
as a subrule.
Ben Pfaff [Sat, 5 Feb 2011 05:33:47 +0000 (21:33 -0800)]
i18n: Always allocate from pool in recode_substring_pool().
Ben Pfaff [Wed, 5 Jan 2011 05:55:07 +0000 (21:55 -0800)]
sys-file-writer: Fix subtype used for v14+ multiple response set records.
Ben Pfaff [Mon, 3 Jan 2011 21:10:07 +0000 (13:10 -0800)]
doc: Document that type-7 records must appear in ascending numerical order.
Every system file that I have seen puts them in this order, so I cannot
imagine that any other order receives any testing.
Ben Pfaff [Sat, 5 Feb 2011 21:18:07 +0000 (13:18 -0800)]
doc: Update description of character encoding information in system files.
Based on information provided by John Darrington and on system files
obtained freely from the Internet.
Ben Pfaff [Fri, 4 Feb 2011 04:41:40 +0000 (20:41 -0800)]
sys-file-reader: Add tests.
Ben Pfaff [Sun, 30 Jan 2011 23:41:12 +0000 (15:41 -0800)]
sys-file-reader: Elevate invalid number of labels from warning to error.
There's no way to figure out when the labels end when the count is wrong,
so this has to be an error.
Ben Pfaff [Sun, 30 Jan 2011 23:27:06 +0000 (15:27 -0800)]
sys-file-reader: Avoid redundant "within system file" in messages.
All system file message already state the system file's name, which should
be enough identification.
Ben Pfaff [Sun, 30 Jan 2011 23:42:51 +0000 (15:42 -0800)]
sys-file-reader: Improve debugging usefulness of error messages.
I found that these changes made it easier to debug problems with system
files while I was developing tests.
Ben Pfaff [Sun, 30 Jan 2011 23:40:17 +0000 (15:40 -0800)]
sys-file-reader: Really enable warnings for invalid variable formats.
With these operator in the wrong order, I never saw any warnings, although
other people might have seen different behavior.
Ben Pfaff [Sun, 30 Jan 2011 23:29:38 +0000 (15:29 -0800)]
sys-file-reader: Add missing periods at end of error messages.
Most of the error messages already ended in periods, so this adds them to
the others for consistency.
Ben Pfaff [Sun, 30 Jan 2011 23:35:48 +0000 (15:35 -0800)]
sys-file-reader: Check that multiple response set names begin with `$'.
This invariant was being checked by an assertion in dict_add_mrset(), so
this change avoids an assertion failure for invalid system files.
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 [Sat, 29 Jan 2011 18:02:32 +0000 (10:02 -0800)]
q2c: T_RPAREN should be T_LPAREN for matching a left parenthesis.
Also add a test for this case on the T-TEST command, where the bug was
first reported.
Bug #32061.
Reported by Mindaugas <embar@super.lt>.
Reported by Chuck Kralowec <chuck.kralowec@gmail.com>.
Ben Pfaff [Wed, 5 Jan 2011 17:18:27 +0000 (09:18 -0800)]
Updated the Lithuanian translation from translationproject.org.
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 [Tue, 21 Dec 2010 08:00:25 +0000 (00:00 -0800)]
NPAR TESTS: Fix "NPAR TESTS BINOMIAL, P = 0.5; N1/N2 < 1" test failure.
Ben Pfaff [Tue, 21 Dec 2010 07:59:28 +0000 (23:59 -0800)]
lexer: Fix GCC warning for unhandled TOKEN_N_TYPES in lex_token_name().
Ben Pfaff [Tue, 21 Dec 2010 07:58:59 +0000 (23:58 -0800)]
lexer: Remove unused function lex_put_back_id().
Ben Pfaff [Fri, 10 Dec 2010 05:41:49 +0000 (21:41 -0800)]
value-parser: Remove redundant call to lex_force_string() in parse_value().
Ben Pfaff [Sun, 12 Dec 2010 04:56:15 +0000 (20:56 -0800)]
GET DATA: Fix punctuation in error message.
Ben Pfaff [Fri, 10 Dec 2010 05:55:58 +0000 (21:55 -0800)]
AGGREGATE: Align arg_func_tab[] in columns.
This makes the code more readable. It should not change PSPP behavior.
Ben Pfaff [Tue, 7 Dec 2010 04:54:15 +0000 (20:54 -0800)]
i18n: Remove unnecessary #ifs.
The test for LC_MESSAGES should not be necessary because Gnulib ensures
that LC_MESSAGES is always defined.
The test for ENABLE_NLS should not be necessary because PSPP has not
supported that configuration for some time.
Ben Pfaff [Tue, 7 Dec 2010 04:48:32 +0000 (20:48 -0800)]
ECHO: Use text_item, as intended.
TEXT_ITEM_ECHO is meant for use by ECHO but it had been overlooked
accidentally until now.
Ben Pfaff [Tue, 7 Dec 2010 04:47:44 +0000 (20:47 -0800)]
float-format: Don't translate test strings.
These aren't visible to users in normal operation, so we might as well not
burden translators with them.
Ben Pfaff [Tue, 7 Dec 2010 04:46:35 +0000 (20:46 -0800)]
DO REPEAT: Make this command usable anywhere.
DO REPEAT just does macro expansion so there's no reason to limit it to
just after an active dataset has been defined.
Ben Pfaff [Tue, 7 Dec 2010 04:43:27 +0000 (20:43 -0800)]
identifier: New function token_type_to_string().
This is useful for debugging and testing code.
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, 5 Dec 2010 23:16:03 +0000 (15:16 -0800)]
INPUT PROGRAM: Remove unused enumeration.
Ben Pfaff [Sun, 12 Dec 2010 06:07:56 +0000 (22:07 -0800)]
expressions: Make extract_min_valid() parameter const.
This fixes the following warning:
parse.c: In function ‘parse_function’:
parse.c:1213: warning: passing argument 1 of ‘extract_min_valid’ discards qualifiers from pointer target type
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:13:03 +0000 (21:13 -0800)]
ONEWAY: Fix warning for passing "const" pointer as non-const parameter.
Ben Pfaff [Sun, 12 Dec 2010 05:09:45 +0000 (21:09 -0800)]
mann-whitney: Suppress GCC warning about unused parameter.
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 [Sat, 4 Dec 2010 19:11:51 +0000 (11:11 -0800)]
command: Don't allow SORT as an abbreviation for SORT CASES.
This abbreviation has never been documented, and I don't see a reason to
keep it.
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 [Sun, 21 Nov 2010 19:16:10 +0000 (11:16 -0800)]
Remove the NULLINE and ENDCMD settings.
These settings change the lexical structure of the language, which makes
lexical analysis difficult.
Ben Pfaff [Sat, 4 Dec 2010 19:10:02 +0000 (11:10 -0800)]
VALUE LABELS: Relax limit on value label length from 60 bytes to 255.
Requested by friedrich nietzsche <f_nietsje@hotmail.com>.
With improvements by John Darrington.
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 [Fri, 19 Nov 2010 05:30:24 +0000 (21:30 -0800)]
identifier: Add some functions for Unicode syntax.
Ben Pfaff [Fri, 19 Nov 2010 05:25:39 +0000 (21:25 -0800)]
str: Add some functions for handling UTF-8.
Ben Pfaff [Thu, 18 Nov 2010 04:03:26 +0000 (20:03 -0800)]
str: Change "char" to "byte" in function names.
As PSPP moves toward using UTF-8 pervasively for command syntax, a
character is no longer always a byte, so this naming is clearer.
Ben Pfaff [Fri, 19 Nov 2010 06:17:31 +0000 (22:17 -0800)]
str: Inline some trivial functions.
Ben Pfaff [Wed, 17 Nov 2010 17:07:57 +0000 (09:07 -0800)]
Updated the Lithuanian translation from translationproject.org.
Jason H Stover [Wed, 17 Nov 2010 15:40:13 +0000 (10:40 -0500)]
Fixed degrees of freed in t-stat for intercept
Ben Pfaff [Fri, 5 Nov 2010 05:10:19 +0000 (22:10 -0700)]
sys-file: Add functions for converting between codepage numbers and names.
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 06:01:07 +0000 (22:01 -0800)]
INSTALL: Update to mention test-only dependencies.
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 [Mon, 15 Nov 2010 05:21:50 +0000 (21:21 -0800)]
ONEWAY: Accept 3.88 instead of 3.87 in multiple variables test.
Reported by Jeremy Lavergne <jeremy@lavergne.gotdns.org> on bug-gnu-pspp.
Also reported by bojo42@gmail.com in bug #31611.
Ben Pfaff [Mon, 15 Nov 2010 05:16:29 +0000 (21:16 -0800)]
NPAR TESTS: Accept .313 instead of .312 for point probability in SIGN test.
Reported by Jeremy Lavergne <jeremy@lavergne.gotdns.org> on bug-gnu-pspp.
Also reported by bojo42@gmail.com in bug #31611.
Ben Pfaff [Sat, 6 Nov 2010 04:20:55 +0000 (21:20 -0700)]
csv: Make the character used for quoting configurable.
Requested by Björn Manke <bjoernmanke@gmx.net>.
Ben Pfaff [Sat, 6 Nov 2010 04:11:24 +0000 (21:11 -0700)]
csv: Add ability to suppress table captions.
Requested by Björn Manke <bjoernmanke@gmx.net>.
Ben Pfaff [Fri, 5 Nov 2010 16:11:51 +0000 (09:11 -0700)]
Added the Lithuanian translation from translationproject.org.