Change "union value" to dynamically allocate long strings.
authorBen Pfaff <blp@gnu.org>
Mon, 11 May 2009 05:23:00 +0000 (22:23 -0700)
committerBen Pfaff <blp@gnu.org>
Sun, 7 Jun 2009 04:11:09 +0000 (21:11 -0700)
commit5c3291dc396b795696e94f47780308fd7ace6fc4
tree01519b7a6ac8f74df626997812cc85ac6b7b2cc7
parentc6fe58a22249f4f486b42f35fd8bd537c91e8e6e
Change "union value" to dynamically allocate long strings.

Until now, a single "union value" could hold a numeric value or a short
string value.  A long string value (one longer than MAX_SHORT_STRING)
required a number of contiguous "union value"s.  This situation was
inconvenient sometimes, because any occasion where a long string value
might be required (even if it was unlikely) required using dynamic
memory allocation.

With this change, a value of any type, regardless of whether it is numeric
or short or long string, occupies a single "union value".  The internal
representation of short and long strings is now different, however: long
strings are now internally represented by a pointer to dynamically
allocated memory.  This means that "union value"s must now be initialized
and uninitialized properly, to ensure that memory is properly allocated
and freed behind the scenese.

This change thus has a ripple effect on PSPP code that works with values.
In particular, code that deals with cases is greatly changed, because a
case now needs to know the type of each value that it contains.  Thus, a
new concept called a "case prototype", which represents the type and
width of each value within a case, is introduced, and every place in PSPP
that creates a case must now create a corresponding prototype to go with
it.  This is why this commit is so big.

As part of writing up this commit, it became clear that some code was poor
enough that it needed to be rewritten entirely.  Therefore, CROSSTABS and
T-TEST are almost completely modified by this commit.
119 files changed:
Smake
doc/data-io.texi
doc/dev/concepts.texi
doc/language.texi
doc/statistics.texi
doc/transformation.texi
perl-module/PSPP.xs
src/data/automake.mk
src/data/case-map.c
src/data/case-map.h
src/data/case-matcher.c
src/data/case-tmpfile.c
src/data/case-tmpfile.h
src/data/case.c
src/data/case.h
src/data/casegrouper.c
src/data/caseinit.c
src/data/caseproto.c [new file with mode: 0644]
src/data/caseproto.h [new file with mode: 0644]
src/data/casereader-filter.c
src/data/casereader-provider.h
src/data/casereader-translator.c
src/data/casereader.c
src/data/casereader.h
src/data/casewindow.c
src/data/casewindow.h
src/data/casewriter-provider.h
src/data/casewriter-translator.c
src/data/casewriter.c
src/data/casewriter.h
src/data/category.c
src/data/data-in.c
src/data/data-out.c
src/data/datasheet.c
src/data/datasheet.h
src/data/dictionary.c
src/data/dictionary.h
src/data/gnumeric-reader.c
src/data/lazy-casereader.c
src/data/lazy-casereader.h
src/data/missing-values.c
src/data/por-file-reader.c
src/data/por-file-writer.c
src/data/procedure.c
src/data/psql-reader.c
src/data/scratch-writer.c
src/data/settings.c
src/data/settings.h
src/data/sparse-cases.c [deleted file]
src/data/sparse-cases.h [deleted file]
src/data/subcase.c
src/data/subcase.h
src/data/sys-file-private.c
src/data/sys-file-private.h
src/data/sys-file-reader.c
src/data/sys-file-writer.c
src/data/value-labels.c
src/data/value-labels.h
src/data/value.c
src/data/value.h
src/data/vardict.h
src/data/variable.c
src/data/variable.h
src/language/data-io/combine-files.c
src/language/data-io/data-parser.c
src/language/data-io/inpt-pgm.c
src/language/dictionary/sys-file-info.c
src/language/dictionary/value-labels.c
src/language/dictionary/variable-display.c
src/language/expressions/evaluate.c
src/language/stats/aggregate.c
src/language/stats/binomial.c
src/language/stats/chisquare.c
src/language/stats/crosstabs.q
src/language/stats/examine.q
src/language/stats/flip.c
src/language/stats/freq.c
src/language/stats/freq.h
src/language/stats/frequencies.q
src/language/stats/oneway.q
src/language/stats/rank.q
src/language/stats/reliability.q
src/language/stats/sign.c
src/language/stats/t-test.q
src/language/stats/wilcoxon.c
src/language/tests/datasheet-check.c
src/language/xforms/compute.c
src/language/xforms/recode.c
src/libpspp/automake.mk
src/libpspp/str.c
src/libpspp/str.h
src/math/coefficient.c
src/math/covariance-matrix.c
src/math/group.c
src/math/interaction.c
src/math/interaction.h
src/math/merge.c
src/math/merge.h
src/math/np.c
src/math/sort.c
src/math/sort.h
src/math/ts/innovations.c
src/ui/gui/executor.c
src/ui/gui/find-dialog.c
src/ui/gui/psppire-data-editor.c
src/ui/gui/psppire-data-store.c
src/ui/gui/psppire-data-store.h
src/ui/gui/psppire-dict.c
src/ui/gui/psppire-dict.h
src/ui/gui/psppire-var-store.c
src/ui/gui/text-data-import-dialog.c
src/ui/gui/val-labs-dialog.c
src/ui/gui/variable-info-dialog.c
src/ui/syntax-gen.c
tests/automake.mk
tests/bugs/crosstabs-crash.sh
tests/bugs/crosstabs-crash2.sh
tests/bugs/t-test-alpha.sh
tests/command/longvars.sh