Finish converting struct variable to an opaque type. In this
[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 #include <libpspp/misc.h>
25 #include "minmax.h"
26
27 /* Values. */
28
29 /* "Short" strings, which are generally those no more than 8
30    characters wide, can participate in more operations than
31    longer strings. */
32 #define MAX_SHORT_STRING (MAX (ROUND_UP (SIZEOF_DOUBLE, 2), 8))
33 #define MIN_LONG_STRING (MAX_SHORT_STRING + 1)
34 #define MAX_STRING 32767
35
36 /* Special values. */
37 #define SYSMIS (-DBL_MAX)
38 #define LOWEST second_lowest_value
39 #define HIGHEST DBL_MAX
40
41 /* A numeric or short string value.
42    Multiple consecutive values represent a long string. */
43 union value
44   {
45     double f;
46     char s[MAX_SHORT_STRING];
47   };
48
49 union value *value_dup (const union value *, int width);
50 int compare_values (const union value *, const union value *, int width);
51 unsigned hash_value (const union value  *, int width);
52
53 #endif /* !value.h */