pc+-file-reader: Fix memory leak.
[pspp.git] / src / data / val-type.h
blob8aaa06a0d92e95fc90acbafe0dc140122c281a4c
1 /* PSPP - computes sample statistics.
2 Copyright (C) 2007, 2011 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 3 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA. */
19 #ifndef DATA_VAL_TYPE_H
20 #define DATA_VAL_TYPE_H 1
22 #include <float.h>
23 #include <stdbool.h>
24 #include "libpspp/float-format.h"
26 /* Special numeric values. */
27 #define SYSMIS (-DBL_MAX) /* System-missing value. */
28 #define LOWEST (float_get_lowest ()) /* Smallest nonmissing finite value. */
29 #define HIGHEST DBL_MAX /* Largest finite value. */
31 /* Maximum length of a string variable. */
32 #define MAX_STRING 32767
34 /* Value type. */
35 enum val_type
37 VAL_NUMERIC, /* A numeric value. */
38 VAL_STRING /* A string value. */
41 /* Returns true if VAL_TYPE is a valid value type. */
42 static inline bool
43 val_type_is_valid (enum val_type val_type)
45 return val_type == VAL_NUMERIC || val_type == VAL_STRING;
48 /* Returns the value type for the given WIDTH. */
49 static inline enum val_type
50 val_type_from_width (int width)
52 return width != 0 ? VAL_STRING : VAL_NUMERIC;
55 #endif /* data/val-type.h */