1 /* PSPP - computes sample statistics.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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
21 #define missing_values_h 1
26 /* Types of user-missing values.
27 Invisible--use access functions defined below instead. */
30 MV_NONE = 0, /* No user-missing values. */
31 MV_1 = 1, /* One user-missing value. */
32 MV_2 = 2, /* Two user-missing values. */
33 MV_3 = 3, /* Three user-missing values. */
34 MV_RANGE = 4, /* A range of user-missing values. */
35 MV_RANGE_1 = 5 /* A range plus an individual value. */
39 Opaque--use access functions defined below. */
42 unsigned type; /* Number and type of missing values. */
43 int width; /* 0=numeric, otherwise string width. */
44 union value values[3]; /* Missing values. [y,z] are the range. */
47 void mv_init (struct missing_values *, int width);
48 void mv_copy (struct missing_values *, const struct missing_values *);
49 bool mv_is_empty (const struct missing_values *);
50 int mv_get_width (const struct missing_values *);
52 bool mv_add_value (struct missing_values *, const union value *);
53 bool mv_add_str (struct missing_values *, const unsigned char[]);
54 bool mv_add_num (struct missing_values *, double);
55 bool mv_add_num_range (struct missing_values *, double low, double high);
57 bool mv_has_value (struct missing_values *);
58 void mv_pop_value (struct missing_values *, union value *);
59 bool mv_has_range (struct missing_values *);
60 void mv_pop_range (struct missing_values *, double *low, double *high);
62 bool mv_is_resizable (struct missing_values *, int width);
63 void mv_resize (struct missing_values *, int width);
65 typedef bool is_missing_func (const struct missing_values *,
68 /* Is a value system or user missing? */
69 bool mv_is_value_missing (const struct missing_values *, const union value *);
70 bool mv_is_num_missing (const struct missing_values *, double);
71 bool mv_is_str_missing (const struct missing_values *, const unsigned char[]);
73 /* Is a value user missing? */
74 bool mv_is_value_user_missing (const struct missing_values *,
76 bool mv_is_num_user_missing (const struct missing_values *, double);
77 bool mv_is_str_user_missing (const struct missing_values *,
78 const unsigned char[]);
80 /* Is a value system missing? */
81 bool mv_is_value_system_missing (const struct missing_values *,
84 #endif /* missing-values.h */