pspp
13 years agoAdd new output/ascii.h header to the distribution, fixing "make dist".
Ben Pfaff [Sat, 23 Apr 2011 14:53:00 +0000 (07:53 -0700)]
Add new output/ascii.h header to the distribution, fixing "make dist".

13 years agoascii: Print syntax in output single-spaced. 20110423030508/pspp
Ben Pfaff [Sat, 23 Apr 2011 05:29:19 +0000 (22:29 -0700)]
ascii: Print syntax in output single-spaced.

When SET PRINTBACK=ON was in effect, the ASCII output driver would
put a blank line between successive lines of syntax, because each line
was output separately.  This commit fixes that, by causing the output
core to combine successive syntax output items into a single item that
contains multiple lines of text.  This was essentially what the HTML
output driver was doing anyhow, so putting this into the core also
allows removing the corresponding logic from the HTML driver.

13 years agoascii: Don't print command names in output.
Ben Pfaff [Sat, 23 Apr 2011 05:10:04 +0000 (22:10 -0700)]
ascii: Don't print command names in output.

This seems to be closer to what users expect.

I think that having the command names in output was being confused
by users with SET PRINTBACK=ON (see e.g. bug #31561) even though I
really just added that so that there are clear titles for the output
that goes with each procedure.  This change should help, I think.

It might make sense to make drivers only print the titles of
procedures that have other output, but this commit doesn't do that.

13 years agoodt: Write command name in output both only before command, not after.
Ben Pfaff [Sat, 23 Apr 2011 05:07:52 +0000 (22:07 -0700)]
odt: Write command name in output both only before command, not after.

13 years agoascii: Add support for multibyte characters.
Ben Pfaff [Sat, 23 Apr 2011 03:21:57 +0000 (20:21 -0700)]
ascii: Add support for multibyte characters.

This commit modifies render.at, changing hyphens to non-breaking
hyphens.  This change is only to ensure that the output for the tests
in render.at are the same afterward.  Without these changes, these
tests wrap these tables differently, because they break after the
hyphens; before, only spaces were considered valid breakpoints.

Bug #31478.

13 years agoascii: Drop useless 'wrap_mode' parameter from ascii_layout_cell().
Ben Pfaff [Sun, 17 Apr 2011 01:43:56 +0000 (18:43 -0700)]
ascii: Drop useless 'wrap_mode' parameter from ascii_layout_cell().

This parameter is always supplied as WRAP_WORD, so there's no point
in having it at all.

13 years agoUpdated the Lithuanian translation from http://translationproject.org. 20110418030503/pspp 20110419030503/pspp 20110420030502/pspp 20110421030503/pspp 20110422030503/pspp
Ben Pfaff [Sun, 17 Apr 2011 23:55:09 +0000 (16:55 -0700)]
Updated the Lithuanian translation from translationproject.org.

13 years agogui: Add Lithuanian translation and MIME type to pspp.desktop
Mindaugas [Sun, 17 Apr 2011 23:52:41 +0000 (16:52 -0700)]
gui: Add Lithuanian translation and MIME type to pspp.desktop

13 years agoUpdated the Lithuanian translation from http://translationproject.org. 20110417030505/pspp
Ben Pfaff [Sat, 16 Apr 2011 20:40:43 +0000 (13:40 -0700)]
Updated the Lithuanian translation from translationproject.org.

13 years agogui: Fix crash in executor when inline data is missing.
Ben Pfaff [Sat, 16 Apr 2011 18:20:59 +0000 (11:20 -0700)]
gui: Fix crash in executor when inline data is missing.

Without this commit, typing "DATA LIST /x 1." into an otherwise empty
syntax window and executing it caused a crash because the lexer was
being accessed after it was destroyed.  This commit averts the crash.

13 years agoCROSSTABS: Fix output of multiway statistics tables.
Ben Pfaff [Sat, 16 Apr 2011 16:52:34 +0000 (09:52 -0700)]
CROSSTABS: Fix output of multiway statistics tables.

Bug #27452.

13 years agoUpdated the Lithuanian translation from http://translationproject.org.
Ben Pfaff [Sat, 16 Apr 2011 16:30:10 +0000 (09:30 -0700)]
Updated the Lithuanian translation from translationproject.org.

13 years agotable-casereader: Put space between columns. 20110416030505/pspp
Ben Pfaff [Sat, 16 Apr 2011 05:49:00 +0000 (22:49 -0700)]
table-casereader: Put space between columns.

When table_casereaders are pasted together next to each other, there
should normally be a little bit of space between neighboring columns,
instead of having them directly abutting.  This makes the output of
LIST, for example, much more readable.

Without this commit, LIST output for three variables named x, y, and
z, all with F1.0 format, looks something like this:

xyz
---
111
222
311
412
521
612
711
811
912

With this commit, it looks like this:

x y z
-----
1 1 1
2 2 2
3 1 1
4 1 2
5 2 1
6 1 2
7 1 1
8 1 1
9 1 2

13 years agorender: Fix rendering of TAL_GAP rules.
Ben Pfaff [Sat, 16 Apr 2011 05:26:43 +0000 (22:26 -0700)]
render: Fix rendering of TAL_GAP rules.

A rule that is set to TAL_GAP is supposed to have the same width or
height as a rule of type TAL_1, but without drawing the line.  That
is, it is supposed to be a small blank space between rows or columns.

Unfortunately, TAL_GAP was not implemented properly in the rendering
code.  It was treated just like TAL_0, which meant that it was ignored
and no gap appeared.

This commit implements TAL_GAP, fixing the problem.

13 years agoconfigure: Invoke AM_GNU_GETTEXT by hand.
Ben Pfaff [Sat, 16 Apr 2011 03:16:02 +0000 (20:16 -0700)]
configure: Invoke AM_GNU_GETTEXT by hand.

The Gnulib "gettext" module does not invoke AM_GNU_GETTEXT, because
gnulib-tool uses "sed" to filter it out.  So we must invoke it
ourselves.

John Darrington narrowed the problem down to the commit b54a5702b6
"Fix up build following dropping ulc-width-linebreaks module" that
started using the gettext Gnulib module.

Bug #33083.
Reported by Mindaugus.

13 years agogui: Add missing scroll bar in K related samples variables list. 20110415030503/pspp
Ben Pfaff [Fri, 15 Apr 2011 04:09:00 +0000 (21:09 -0700)]
gui: Add missing scroll bar in K related samples variables list.

Reported by and fix from Mindaugas Baranauskas <embar@super.lt>.
Reviewed by John Darrington.

13 years agovalue-labels: Interpret \n as new-line in value labels. 20110414030503/pspp
Ben Pfaff [Thu, 14 Apr 2011 04:24:30 +0000 (21:24 -0700)]
value-labels: Interpret \n as new-line in value labels.

Bug #18497.

13 years agointern: New function intern_strlen().
Ben Pfaff [Wed, 13 Apr 2011 05:19:45 +0000 (22:19 -0700)]
intern: New function intern_strlen().

13 years agointern: Use UP_CAST macro instad of open-coding it.
Ben Pfaff [Wed, 13 Apr 2011 03:42:47 +0000 (20:42 -0700)]
intern: Use UP_CAST macro instad of open-coding it.

13 years agopo: Update Dutch translation. 20110413030503/pspp
Ben Pfaff [Wed, 13 Apr 2011 03:33:13 +0000 (20:33 -0700)]
po: Update Dutch translation.

Thanks to the Dutch translation team and the translationproject.org
coordinators.

13 years agovalue-parser: Make parse_value() accept variable's print format also.
Ben Pfaff [Tue, 12 Apr 2011 13:48:08 +0000 (06:48 -0700)]
value-parser: Make parse_value() accept variable's print format also.

Previously commands such as VALUE LABELS required numeric values to
be given as plain numbers, but this makes it difficult to add
meaningful value labels for variables with date and time formats.
This commit allows values for this command and a few others to be
given in a variable's print format instead.

Bug #18497.

13 years agovalue-labels: Fix comment.
Ben Pfaff [Tue, 12 Apr 2011 13:45:53 +0000 (06:45 -0700)]
value-labels: Fix comment.

13 years agoDISPLAY: Display values for value labels using the variable's format.
Ben Pfaff [Tue, 12 Apr 2011 13:45:33 +0000 (06:45 -0700)]
DISPLAY: Display values for value labels using the variable's format.

Until now, the values in value labels have been displayed as plain
numbers, but this makes the values for variables with date and time
formats unreadable.  Changing them to use the variable's own format
makes them easier to read.

13 years agotab: Make tab_value() take a variable instead of a dictionary.
Ben Pfaff [Tue, 12 Apr 2011 13:43:04 +0000 (06:43 -0700)]
tab: Make tab_value() take a variable instead of a dictionary.

It seems far more likely that callers will have the variable handy
than the dictionary.  Also, when the variable is used the format can
be optional since tab_value() can get it from the variable's print
format.

13 years agoFORMATS: Allow an optional slash before each set of variable names. 20110412030503/pspp
Ben Pfaff [Tue, 12 Apr 2011 05:49:01 +0000 (22:49 -0700)]
FORMATS: Allow an optional slash before each set of variable names.

This increases compatibility.

13 years agoFORMATS: Allow setting formats of string variables.
Ben Pfaff [Tue, 12 Apr 2011 05:48:08 +0000 (22:48 -0700)]
FORMATS: Allow setting formats of string variables.

Thanks to John Darrington for reporting this bug.
Bug #22012.

13 years agogui: psppire-var-view: Change "<unset>" to null string. 20110411030503/pspp
Ben Pfaff [Sun, 10 Apr 2011 16:52:31 +0000 (09:52 -0700)]
gui: psppire-var-view: Change "<unset>" to null string.

Commit 0cb2b9c42 caused NULL variables to be displayed as "<unset>".
This commit changes that to the empty string, which doesn't require
translation and is equally clear.

Suggested by John Darrington <john@darrington.wattle.id.au>.

13 years agoLIST: Fix crash when SPLIT FILE was used. 20110410030503/pspp
Ben Pfaff [Sun, 10 Apr 2011 02:11:44 +0000 (19:11 -0700)]
LIST: Fix crash when SPLIT FILE was used.

Thanks to John Darrington for reporting the problem and to Michel
Boaventura for reducing the problem to a simple test case.

13 years agogui: Fix crash in Paired T-Test dialog on selecting first variable.
Ben Pfaff [Sat, 9 Apr 2011 23:53:26 +0000 (16:53 -0700)]
gui: Fix crash in Paired T-Test dialog on selecting first variable.

When a variable is moved into the list of selected variables in the
Paired T-Test dialog, that row of the treeview has one nonnull
variable and one null variable.  Calling var_get_name(NULL) causes a
segfault.

I'm not certain that this is the correct fix, but it fixes the
segfault.  The missing variable is now shown as <unset> until a second
variable is moved into the treeview.

Bug #32958.

13 years agogui: Fix Glib warnings for dialogs in realize and configure callbacks.
Ben Pfaff [Sat, 9 Apr 2011 23:50:44 +0000 (16:50 -0700)]
gui: Fix Glib warnings for dialogs in realize and configure callbacks.

The GtkBuilder documentation says:

    Prior to 2.20, GtkBuilder was setting the "name" property of
    constructed widgets to the "id" attribute. In GTK+ 2.20 or newer,
    you have to use gtk_buildable_get_name() instead of
    gtk_widget_get_name() to obtain the "id", or set the "name"
    property in your UI definition.

This commit fixes the problem by switching from using the "name"
property to calling gtk_buildable_get_name().

13 years agogui: Link against $(LIBICONV) too.
Ben Pfaff [Sat, 9 Apr 2011 17:57:55 +0000 (10:57 -0700)]
gui: Link against $(LIBICONV) too.

The GUI now uses iconv, so we need to link libiconv too.

Problem reported by Harry Thijssen <harry.thijssen@gmail.com>.
Fix suggested by John Darrington <john@darrington.wattle.id.au>.

13 years agou8-istream: Add cast to iconv() to suppress warnings on some systems.
Ben Pfaff [Sat, 9 Apr 2011 17:55:53 +0000 (10:55 -0700)]
u8-istream: Add cast to iconv() to suppress warnings on some systems.

Problem reported by Harry Thijssen <harry.thijssen@gmail.com>.
Fix suggested by John Darrington <john@darrington.wattle.id.au>.

13 years agou8-istream: Include <limits.h> for definition of MB_LEN_MAX.
Ben Pfaff [Sat, 9 Apr 2011 16:25:59 +0000 (09:25 -0700)]
u8-istream: Include <limits.h> for definition of MB_LEN_MAX.

Problem reported by Harry Thijssen <pspp@sjpaes.nl>.
Fix suggested by John Darrington <john@darrington.wattle.id.au>.

13 years agosegment: Fix uninitialized variable in segmenter_parse_comment_2__(). 20110409030503/pspp
Ben Pfaff [Sat, 9 Apr 2011 04:14:13 +0000 (21:14 -0700)]
segment: Fix uninitialized variable in segmenter_parse_comment_2__().

This caused a couple of test failures on Mac OS X.

Thanks to Jeremy Lavergne <jeremy@lavergne.gotdns.org> for reporting
the problem.

13 years agotests: Only check MODE=360 when EBCDIC is supported. 20110408030502/pspp
Ben Pfaff [Fri, 8 Apr 2011 04:49:13 +0000 (21:49 -0700)]
tests: Only check MODE=360 when EBCDIC is supported.

Jeremy Lavergne <jeremy@lavergne.gotdns.org> reported that these tests
fail on Mac OS X.  testsuite.log showed that Mac OS X did not support
the EBCDIC-US encoding, so this OS cannot support these tests.

13 years agotests: Fix quoting in data-in tests.
Ben Pfaff [Fri, 8 Apr 2011 04:37:37 +0000 (21:37 -0700)]
tests: Fix quoting in data-in tests.

Without [[ ]] around the test commands, m4 swallows the inner [] in
the sed argument, causing the substitution to be ineffective.

Reported by Jeremy Lavergne <jeremy@lavergne.gotdns.org>.

13 years agogui: widget-io: Fix cleanup code in widget_printf(), widget_scanf().
Ben Pfaff [Fri, 8 Apr 2011 04:05:31 +0000 (21:05 -0700)]
gui: widget-io: Fix cleanup code in widget_printf(), widget_scanf().

The 'arg' member of arguments and the 'dir' member of char_directives
are only allocated from malloc() if there are more than fit in the
arrays that are included inside their respective structures, so they
must only be freed when that internal structure is not used.

Also, these arrays are allocated with malloc() and so must be freed
with free(), not g_free().

Thanks to Benoit Flippen <anagogue@gmail.com> for reporting the
problem.

13 years agoFREQUENCIES: Fix crash when median and histogram both requested.
Ben Pfaff [Fri, 8 Apr 2011 03:53:18 +0000 (20:53 -0700)]
FREQUENCIES: Fix crash when median and histogram both requested.

Thanks to Benoit Flippen <anagogue@gmail.com> for reporting this bug.

13 years agoUpdate version number to 0.7.7 to 20110325030502/pspp 20110326030503/pspp 20110327030503/pspp 20110328030503/pspp 20110329030503/pspp 20110330030502/pspp 20110331030503/pspp 20110401030503/pspp 20110402030503/pspp 20110403030503/pspp 20110404030502/pspp 20110405030501/pspp 20110406030501/pspp 20110407030503/pspp
Ben Pfaff [Fri, 25 Mar 2011 03:50:27 +0000 (20:50 -0700)]
Update version number to 0.7.7 to

13 years agocairo: Correctly render table during scrolling. 20110323030507/pspp 20110324030502/pspp
Ben Pfaff [Wed, 23 Mar 2011 05:10:49 +0000 (22:10 -0700)]
cairo: Correctly render table during scrolling.

Commit 845d4b4f3f (cairo: Draw table titles in xr_rendering_draw()
too) started rendering table titles in the GUI but forgot to
compensate for this in the call to render_page_draw_region(), so
scrolling caused visible damage.

Bug #31569.
Reported-by: John Darrington <john@darrington.wattle.id.au>
13 years agoi18n: Only close valid iconv converters in i18n_done().
Ben Pfaff [Wed, 23 Mar 2011 04:20:04 +0000 (21:20 -0700)]
i18n: Only close valid iconv converters in i18n_done().

iconv_open() returns (iconv_t) -1 to indicate an error.  We shouldn't
pass this to iconv_Close().

Reported-by: Jeremy Lavergne <jeremy@lavergne.gotdns.org>.
John Darrington suggested that this was probably the problem, and
Jeremy confirmed it with valgrind.

13 years agoi18n: Test converting between unknown encodings too.
Ben Pfaff [Wed, 23 Mar 2011 04:14:15 +0000 (21:14 -0700)]
i18n: Test converting between unknown encodings too.

This would have found the bug fixed by the previous commit.

13 years agostr: Make ss_alloc_substring_pool() null-terminate its output.
Ben Pfaff [Wed, 23 Mar 2011 03:55:55 +0000 (20:55 -0700)]
str: Make ss_alloc_substring_pool() null-terminate its output.

It's inconsistent that ss_alloc_substring() null-terminates its output
but ss_alloc_substring_pool() does not.  This caught us out in
recode_substring_pool(), which used ss_alloc_substring_pool() in a
fallback case where create_iconv() failed and expected the result to
be null-terminated.

Reported-by: Jeremy Lavergne <jeremy@lavergne.gotdns.org>
13 years agotests: Wrap more binaries for "check-valgrind" target.
Ben Pfaff [Wed, 23 Mar 2011 04:12:11 +0000 (21:12 -0700)]
tests: Wrap more binaries for "check-valgrind" target.

13 years agoSmake: Add 'memrchr' Gnulib module.
Ben Pfaff [Tue, 22 Mar 2011 14:58:37 +0000 (07:58 -0700)]
Smake: Add 'memrchr' Gnulib module.

Thanks to John Darrington for reporting that this was needed.

13 years agoAdd valgrind support to testsuite. 20110322030503/pspp
Ben Pfaff [Tue, 22 Mar 2011 04:22:54 +0000 (21:22 -0700)]
Add valgrind support to testsuite.

13 years agoFix up build following dropping ulc-width-linebreaks module. 20110321030505/pspp
Ben Pfaff [Mon, 21 Mar 2011 04:03:15 +0000 (21:03 -0700)]
Fix up build following dropping ulc-width-linebreaks module.

Commit b5cebf00d5e "Smake: Remove  module"
unexpectedly broke the build, because ulc-width-linebreaks had several
indirect dependencies that PSPP actually used but were not in the
list of Gnulib modules in Smake.  This fixes the problem.

The oddest consequence fixed by this commit has to do with
build-aux/config.rpath.  AM_GNU_GETTEXT requires this file, which is
supplied by only a few Gnulib modules: havelib, gettext, and
threadlib.  ulc-width-linebreaks depended indirectly on havelib, but
PSPP did not otherwise depend on any of these modules.  It seemed that
the best fix was simply to use the Gnulib gettext module, which is
what this commit does.

13 years agoChange terminology from "active file" to "active dataset".
Ben Pfaff [Sun, 20 Mar 2011 18:39:55 +0000 (11:39 -0700)]
Change terminology from "active file" to "active dataset".

I plan to introduce the concept of multiple datasets.  One of these is
active at any given time, and the others are inactive.  Each one is
similar to what has been called the "active file" until now.  Thus, it
is natural to rename the "active file" to the "active dataset".  I
guess that this greater uniformity of terminology will cause less
user confusion.

13 years agodataset: Use similar form to dictionary code for callbacks, and document.
Ben Pfaff [Sun, 20 Mar 2011 18:35:11 +0000 (11:35 -0700)]
dataset: Use similar form to dictionary code for callbacks, and document.

13 years agodataset: Rename functions with "dataset_" prefix.
Ben Pfaff [Sun, 20 Mar 2011 18:25:53 +0000 (11:25 -0700)]
dataset: Rename functions with "dataset_" prefix.

13 years agoRename procedure.[ch] to dataset.[ch].
Ben Pfaff [Sun, 20 Mar 2011 18:19:39 +0000 (11:19 -0700)]
Rename procedure.[ch] to dataset.[ch].

These functions deal with datasets, so it is good to name the file after
the data structure.

13 years agodataset: Remove unused types and useless struct forward declaration.
Ben Pfaff [Tue, 31 Aug 2010 04:45:24 +0000 (21:45 -0700)]
dataset: Remove unused types and useless struct forward declaration.

These typedefs were not used anywhere in the tree.  The struct forward
declaration duplicates an identical one at the top of the header.

13 years agomessage: Remove reference to deleted type "struct source_stream".
Ben Pfaff [Sun, 20 Mar 2011 18:09:16 +0000 (11:09 -0700)]
message: Remove reference to deleted type "struct source_stream".

13 years agoNEWS: Remove Time-stamp line.
Ben Pfaff [Sun, 20 Mar 2011 18:07:30 +0000 (11:07 -0700)]
NEWS: Remove Time-stamp line.

This isn't useful in conjunction with a version control system.  It
just causes artificial merge conflicts.

13 years agolexer: Reimplement for better testability and internationalization.
Ben Pfaff [Sun, 20 Mar 2011 00:05:47 +0000 (17:05 -0700)]
lexer: Reimplement for better testability and internationalization.

This commit reimplements PSPP lexical analysis from the ground up.
From a PSPP user's perspective, this should make PSPP more reliable
and make it easier to work with syntax files in non-ASCII encodings.
See the changes to NEWS for more details.

From a developer's perspective, the most visible change may be that
strings within tokens are now always encoded in UTF-8, regardless of
the syntax file's encoding.  Many of the changes in this commit are
due to this, especially those to functions that check for valid
identifiers: an identifier in UTF-8 is not necessarily the same length
when encoded in the dictionary's encoding, but limits on identifier
length must be enforced in the dictionary's encoding (otherwise it
might not be possible to write out a valid system file, since the
identifier might not fit in the fixed length fields in such files).

Another important change is that, whereas before some special syntax
had to be handled by the parser providing feedback to the lexer, now
increasing the sophistication of the lexer has enabled all PSPP syntax
to be analyzed into tokens.  This permitted some other improvements:

  - An arbitrary number of tokens of lookahead, up to the end of the
    current command, is now supported using lex_next_token() and
    related functions.

  - Before, some command implementations had a special attribute that
    meant that the top-level PSPP command parser would not consume the
    final token of the command name (because that token was not
    followed by tokenizable syntax).  This is no longer necessary and
    has been removed.

  - Before, each command implementation was responsible for ensuring
    that valid command syntax was not followed by trailing garbage,
    often by calling lex_end_of_command() as the last step of parsing.
    This is no longer necessary; the main command parser will ensure
    this for itself.

13 years agoscan: New library for high-level PSPP syntax lexical analysis.
Ben Pfaff [Sat, 19 Mar 2011 23:32:16 +0000 (16:32 -0700)]
scan: New library for high-level PSPP syntax lexical analysis.

This library converts a stream of segments output by the "segment"
library into PSPP tokens.

13 years agosegment: New library for low-level phase of lexical syntax analysis.
Ben Pfaff [Sat, 19 Mar 2011 23:30:55 +0000 (16:30 -0700)]
segment: New library for low-level phase of lexical syntax analysis.

This library provides for a low-level part of lexical analysis for
PSPP syntax, which I call "segmentation".  Segmentation accepts a
stream of UTF-8 bytes as input.  It outputs a label (a segment type)
for each byte or contiguous sequence of bytes in the input.

The following commit will implement the high-level phase of lexical
analysis, called "scanning", that converts a sequence of segments into
PSPP tokens.

13 years agou8-istream: New library for reading a text file and recoding to UTF-8.
Ben Pfaff [Sat, 19 Mar 2011 23:34:53 +0000 (16:34 -0700)]
u8-istream: New library for reading a text file and recoding to UTF-8.

This new library will be used in an upcoming commit.

13 years agoencoding-guesser: New library to guess the encoding of a text file.
Ben Pfaff [Sun, 20 Mar 2011 16:43:42 +0000 (09:43 -0700)]
encoding-guesser: New library to guess the encoding of a text file.

This will be used by other new libraries in upcoming commits.

13 years agoi18n: New functions and data structure for obtaining encoding info.
Ben Pfaff [Sat, 19 Mar 2011 23:20:44 +0000 (16:20 -0700)]
i18n: New functions and data structure for obtaining encoding info.

For now these functions don't do any caching, but it might sense to
add caching later if they are called frequently.

13 years agoidentifier: Rename token_type_to_string() and make a new version.
Ben Pfaff [Sat, 19 Mar 2011 21:40:11 +0000 (14:40 -0700)]
identifier: Rename token_type_to_string() and make a new version.

13 years agoi18n: New functions for truncating strings in an arbitrary encoding.
Ben Pfaff [Sun, 13 Feb 2011 18:43:57 +0000 (10:43 -0800)]
i18n: New functions for truncating strings in an arbitrary encoding.

13 years agoi18n: New function recode_string_len().
Ben Pfaff [Sun, 13 Feb 2011 00:37:10 +0000 (16:37 -0800)]
i18n: New function recode_string_len().

13 years agoi18n: New function uc_name().
Ben Pfaff [Sun, 12 Dec 2010 04:58:32 +0000 (20:58 -0800)]
i18n: New function uc_name().

13 years agohash-functions: New function hash_case_bytes().
Ben Pfaff [Tue, 7 Dec 2010 04:50:04 +0000 (20:50 -0800)]
hash-functions: New function hash_case_bytes().

This is useful for hashing an arbitrary byte sequence case-insensitively.
Obviously most uses would be better off working with Unicode but we aren't
there yet.

13 years agostr: New functions for checking for and removing string suffixes.
Ben Pfaff [Thu, 10 Mar 2011 06:21:11 +0000 (22:21 -0800)]
str: New functions for checking for and removing string suffixes.

13 years agostr: Rename ss_chomp() to ss_chomp_byte(), ds_chomp() to ds_chomp_byte().
Ben Pfaff [Thu, 10 Mar 2011 06:10:48 +0000 (22:10 -0800)]
str: Rename ss_chomp() to ss_chomp_byte(), ds_chomp() to ds_chomp_byte().

This paves the way for new functions that chomp an entire substring.

13 years agostr: New function ss_realloc().
Ben Pfaff [Tue, 7 Dec 2010 04:46:56 +0000 (20:46 -0800)]
str: New function ss_realloc().

13 years agooutput: New function text_item_create_nocopy().
Ben Pfaff [Tue, 7 Dec 2010 04:54:40 +0000 (20:54 -0800)]
output: New function text_item_create_nocopy().

13 years agosys-file-reader: Refactor to clean up character encoding support.
Ben Pfaff [Sun, 6 Feb 2011 05:10:10 +0000 (21:10 -0800)]
sys-file-reader: Refactor to clean up character encoding support.

The system file format is unusual in that it does not record the encoding
used by character strings at the beginning or at any fixed place in the
file.  Instead, it can be recorded practically anywhere in the file.  It
never precedes all of the actual character strings in the file, which makes
it impossible to interpret those strings completely and correctly until it
is encountered.

Until now, the system file reader has dealt with this situation by
stuffing uninterpreted character strings into data structures until the
encoding is known, then at that point fetching out the character strings,
reencoding them, and stuffing them back into the data structures.  This
does work, but it has the disadvantage that all of the PSPP data
structures have to tolerate character strings with unknown encoding.  In
some cases this seems like an ugly situation.  For example, arbitrary
variable names have to be supported, even though the syntax for variable
names is circumscribed by the language, because the syntax rules for
variable names cannot be completely and correctly applied to a string that
is in an unknown encoding.

This commit fixes that problem by adopting a new way to read system files.
Each record in the system file dictionary is essentially slurped into
memory as a chunk, then the character encoding is extracted from it, then
the rest of the dictionary is interpreted based on that encoding.  The
actual implementation is a little more intricate because the format of
system file records is somewhat non-uniform.

13 years agofile-name: Do not make output files line-buffered in fn_open().
Ben Pfaff [Thu, 17 Mar 2011 04:33:54 +0000 (21:33 -0700)]
file-name: Do not make output files line-buffered in fn_open().

I don't see any reason to do this.  I can't see anything in the commit
log for this file or in OChangeLog that explains why it was done.

13 years agodata-reader: Remove unreachable "return" statements.
Ben Pfaff [Tue, 15 Mar 2011 01:19:23 +0000 (18:19 -0700)]
data-reader: Remove unreachable "return" statements.

13 years agofile-handle-def: Use hmap instead of list for name table. 20110320030508/pspp
Ben Pfaff [Sun, 5 Sep 2010 03:56:41 +0000 (20:56 -0700)]
file-handle-def: Use hmap instead of list for name table.

It makes much more sense to keep an index of names using a hash table
than using a linked list.

13 years agoUpdate all #include directives to the currently preferred style.
Ben Pfaff [Sat, 19 Mar 2011 20:48:24 +0000 (13:48 -0700)]
Update all #include directives to the currently preferred style.

I left src/ui/gui alone for now.

13 years agoSmake: Remove ulc-width-linebreaks module.
Ben Pfaff [Sat, 19 Mar 2011 20:57:45 +0000 (13:57 -0700)]
Smake: Remove ulc-width-linebreaks module.

This function has not been used in PSPP for a long time now.

13 years agoFREQUENCIES: Fix percentiles calculation. 20110312030504/pspp 20110313030503/pspp 20110314030506/pspp 20110315030503/pspp 20110316030502/pspp 20110317030504/pspp 20110318030507/pspp 20110319030507/pspp
Ben Pfaff [Sat, 12 Mar 2011 06:10:54 +0000 (22:10 -0800)]
FREQUENCIES: Fix percentiles calculation.

The condition for using a variate directly instead of interpolating was
just wrong.  It would interpolate in cases where it clearly should not,
which produced incorrect results in many cases.

Thanks to Fabio Bordignon <bordignon@demos.it> for reporting the problem
and supplying a simple test case.

13 years agoT-TEST: Fix use-after-free with TEMPORARY and independent samples. 20110311030503/pspp
Ben Pfaff [Fri, 11 Mar 2011 06:53:17 +0000 (22:53 -0800)]
T-TEST: Fix use-after-free with TEMPORARY and independent samples.

When TEMPORARY is in effect, proc_commit() destroys the temporary
dictionary.  This means that any procedure that does not somehow disable
temporary transformations and refers to a variable following proc_commit()
has a use-after-free error.

T-TEST has two different bugs of this type.  First, the loop that destroys
group statistics refers to destroyed variables.  This commit fixes this
problem by instead using variable aux data destructors to destroy group
statistics.

Second, when there is an independent variable, destroying its values
requires knowing the variable's width.  This commit fixes this problem by
destroying the values before calling proc_commit().

The AUTORECODE, DESCRIPTIVES, RANK, and REGRESSION procedures appear to
have similar issues (not fixed by this commit).

Reported by Jeremy Lavergne <jeremy@lavergne.gotdns.org>.

13 years agogroup: Delete unused functions.
Ben Pfaff [Fri, 11 Mar 2011 06:46:04 +0000 (22:46 -0800)]
group: Delete unused functions.

13 years agoDELETE VARIABLES: Style fix.
Ben Pfaff [Fri, 11 Mar 2011 06:44:50 +0000 (22:44 -0800)]
DELETE VARIABLES: Style fix.

13 years agoREADME.Git: Update to newer commit. 20110225030502/pspp 20110225070542/pspp 20110226030503/pspp 20110227030503/pspp 20110228030503/pspp 20110301030502/pspp 20110302030503/pspp 20110303030502/pspp 20110304030502/pspp 20110305030508/pspp 20110306030502/pspp 20110307030503/pspp 20110308030502/pspp 20110309030501/pspp 20110310030503/pspp
Ben Pfaff [Fri, 25 Feb 2011 05:31:44 +0000 (21:31 -0800)]
README.Git: Update to newer commit.

This is the Gnulib commit I'm testing against locally.  It should fix the
problem that showed up in the nightly build, in which the dtoastr module
was missing.

13 years agodata-out: Add test for non-ASCII custom currency formats. 20110223030502/pspp 20110224030502/pspp
Ben Pfaff [Sun, 20 Feb 2011 01:30:39 +0000 (17:30 -0800)]
data-out: Add test for non-ASCII custom currency formats.

These now work as I would expect, so add a test to avoid future regression.

13 years agodata-out: Optimize and fix some bad assumptions.
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.

13 years agopool: Support NULL pool argument to pool_alloc_unaligned().
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.

13 years agodata-out: Reorganize output_Z() to be more easily understood.
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.

13 years agoformat: Count prefix and suffix width in terms of display columns.
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.

13 years agoformat: Create a new "struct fmt_affix" for prefix and suffix strings.
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).

13 years agodata-out: Make each converter responsible for storing null terminator.
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.

13 years agoformat: Increase abstraction of fmt_number_style.
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.

13 years agolegacy-encoding: Remove.
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.

13 years agoi18n: Introduce C_ENCODING as replacement for LEGACY_NATIVE.
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.

13 years agoi18n: New function recode_byte().
Ben Pfaff [Sun, 13 Feb 2011 19:36:27 +0000 (11:36 -0800)]
i18n: New function recode_byte().

13 years agoPRINT: Use UTF-8 encoding for output to the output subsystem.
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.

13 years agoCROSSTABS: Eliminate redundant data copying.
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.

13 years agoUse new Gnulib function dtoastr() to format short, accurate real numbers.
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.

13 years agooperations.def: Fix indentation. 191/pspp 192/pspp 193/pspp 194/pspp 195/pspp 196/pspp 197/pspp 198/pspp 199/pspp 20110214030502/pspp 20110215030502/pspp 20110216030503/pspp 20110217030502/pspp 20110218030502/pspp 20110219030503/pspp 20110220030503/pspp 20110221030503/pspp 20110222030502/pspp
Ben Pfaff [Sun, 13 Feb 2011 19:20:35 +0000 (11:20 -0800)]
operations.def: Fix indentation.

13 years agoPRINT SPACE: When an output file is specified, don't ignore expression. 190/pspp 20110213030502/pspp
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).

13 years agoGET DATA: Get rid of lex_put_back().
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.

13 years agofloat-format: Eliminate tests' dependence on exact string encoding.
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.

13 years agopor-file-reader: Remove dependency on VAR_NAME_LEN. 189/pspp 20110212030502/pspp
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.

13 years agotext-data-import-dialog: Eliminate VAR_NAME_LEN restriction.
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.