X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fmissing-values.h;h=4f87f54360ff3aa19616489ef1c9a0848a219620;hb=679e253a4777564db48ccec70b8ce2f6e5b7e46b;hp=43e6290726a02e1a589bc12a597fa5033405c071;hpb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;p=pspp-builds.git diff --git a/src/data/missing-values.h b/src/data/missing-values.h index 43e62907..4f87f543 100644 --- a/src/data/missing-values.h +++ b/src/data/missing-values.h @@ -1,21 +1,18 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2005 Free Software Foundation, Inc. - Written by Ben Pfaff . - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #if !missing_values_h #define missing_values_h 1 @@ -23,30 +20,26 @@ #include #include "value.h" -/* Types of user-missing values. - Invisible--use access functions defined below instead. */ -enum mv_type - { - MV_NONE = 0, /* No user-missing values. */ - MV_1 = 1, /* One user-missing value. */ - MV_2 = 2, /* Two user-missing values. */ - MV_3 = 3, /* Three user-missing values. */ - MV_RANGE = 4, /* A range of user-missing values. */ - MV_RANGE_1 = 5 /* A range plus an individual value. */ - }; - /* Missing values. Opaque--use access functions defined below. */ -struct missing_values +struct missing_values { - unsigned type; /* Number and type of missing values. */ + int type; /* Types of missing values, one of MVT_*. */ int width; /* 0=numeric, otherwise string width. */ union value values[3]; /* Missing values. [y,z] are the range. */ }; +/* Classes of missing values. */ +enum mv_class + { + MV_NEVER = 0, /* Never considered missing. */ + MV_USER = 1, /* Missing if value is user-missing. */ + MV_SYSTEM = 2, /* Missing if value is system-missing. */ + MV_ANY = MV_USER | MV_SYSTEM /* Missing if it is user or system-missing. */ + }; void mv_init (struct missing_values *, int width); -void mv_set_type(struct missing_values *mv, enum mv_type type); +void mv_clear (struct missing_values *); void mv_copy (struct missing_values *, const struct missing_values *); bool mv_is_empty (const struct missing_values *); @@ -69,25 +62,17 @@ bool mv_has_range (const struct missing_values *); void mv_pop_range (struct missing_values *, double *low, double *high); void mv_peek_range (const struct missing_values *, double *low, double *high); -bool mv_is_resizable (struct missing_values *, int width); +bool mv_is_resizable (const struct missing_values *, int width); void mv_resize (struct missing_values *, int width); -typedef bool is_missing_func (const struct missing_values *, - const union value *); - -/* Is a value system or user missing? */ -bool mv_is_value_missing (const struct missing_values *, const union value *); -bool mv_is_num_missing (const struct missing_values *, double); -bool mv_is_str_missing (const struct missing_values *, const char[]); - -/* Is a value user missing? */ -bool mv_is_value_user_missing (const struct missing_values *, - const union value *); -bool mv_is_num_user_missing (const struct missing_values *, double); -bool mv_is_str_user_missing (const struct missing_values *, const char[]); - -/* Is a value system missing? */ -bool mv_is_value_system_missing (const struct missing_values *, +typedef bool mv_is_missing_func (const struct missing_values *, const union value *); +/* Is a value missing? */ +bool mv_is_value_missing (const struct missing_values *, const union value *, + enum mv_class); +bool mv_is_num_missing (const struct missing_values *, double, enum mv_class); +bool mv_is_str_missing (const struct missing_values *, const char[], + enum mv_class); + #endif /* missing-values.h */