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)
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.


No differences found