Get rid of `char *c' member in union value, for cleanliness.
[pspp-builds.git] / src / data / value.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 #if !value_h
21 #define value_h 1
22
23 #include <float.h>
24
25 #include <config.h>
26
27 /* Values. */
28
29 /* Max length of a short string value, generally 8 chars. */
30 #define MAX_SHORT_STRING ( (SIZEOF_DOUBLE)>=8 ? (SIZEOF_DOUBLE + 1)/2 * 2 : 8 )
31
32 #define MIN_LONG_STRING (MAX_SHORT_STRING + 1)
33
34 /* Max string length. */
35 #define MAX_LONG_STRING 255
36
37 /* This nonsense is required for SPSS compatibility */
38 #define EFFECTIVE_LONG_STRING_LENGTH (MAX_LONG_STRING - 3)
39
40 #define MAX_VERY_LONG_STRING 32767
41
42 #define MAX_STRING MAX_VERY_LONG_STRING
43
44
45 /* Special values. */
46 #define SYSMIS (-DBL_MAX)
47 #define LOWEST second_lowest_value
48 #define HIGHEST DBL_MAX
49
50 /* A numeric or short string value.
51    Multiple consecutive values represent a long string. */
52 union value
53   {
54     double f;
55     char s[MAX_SHORT_STRING];
56   };
57
58 /* Maximum number of `union value's in a single number or string
59    value. */
60 #define MAX_ELEMS_PER_VALUE (MAX_STRING / sizeof (union value) + 1)
61
62 int compare_values (const union value *a, const union value *b, int width);
63
64 unsigned  hash_value(const union value  *v, int width);
65
66
67
68 #endif /* !value.h */