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. */
48 void mv_init (struct missing_values *, int width);
49 void mv_set_type(struct missing_values *mv, enum mv_type type);
51 void mv_copy (struct missing_values *, const struct missing_values *);
52 bool mv_is_empty (const struct missing_values *);
53 int mv_get_width (const struct missing_values *);
55 bool mv_add_value (struct missing_values *, const union value *);
56 bool mv_add_str (struct missing_values *, const char[]);
57 bool mv_add_num (struct missing_values *, double);
58 bool mv_add_num_range (struct missing_values *, double low, double high);
60 bool mv_has_value (const struct missing_values *);
61 void mv_pop_value (struct missing_values *, union value *);
62 void mv_peek_value (const struct missing_values *mv, union value *v, int idx);
63 void mv_replace_value (struct missing_values *mv, const union value *v, int idx);
65 int mv_n_values (const struct missing_values *mv);
68 bool mv_has_range (const struct missing_values *);
69 void mv_pop_range (struct missing_values *, double *low, double *high);
70 void mv_peek_range (const struct missing_values *, double *low, double *high);
72 bool mv_is_resizable (struct missing_values *, int width);
73 void mv_resize (struct missing_values *, int width);
75 typedef bool is_missing_func (const struct missing_values *,
78 /* Is a value system or user missing? */
79 bool mv_is_value_missing (const struct missing_values *, const union value *);
80 bool mv_is_num_missing (const struct missing_values *, double);
81 bool mv_is_str_missing (const struct missing_values *, const char[]);
83 /* Is a value user missing? */
84 bool mv_is_value_user_missing (const struct missing_values *,
86 bool mv_is_num_user_missing (const struct missing_values *, double);
87 bool mv_is_str_user_missing (const struct missing_values *, const char[]);
89 /* Is a value system missing? */
90 bool mv_is_value_system_missing (const struct missing_values *,
93 #endif /* missing-values.h */