X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fmissing-values.h;h=4d046faec3a1be411c4b5be5b2f0e93881b0e182;hb=e937634e9021aa0656a6362f169ec2183efed499;hp=b504f8c769a928be238ce8d161a8cf577dbee051;hpb=a9acce47d67e0ab35ce1690e4f1b1ac0121c2d78;p=pspp diff --git a/src/data/missing-values.h b/src/data/missing-values.h index b504f8c769..4d046faec3 100644 --- a/src/data/missing-values.h +++ b/src/data/missing-values.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2009 Free Software Foundation, Inc. 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 @@ -24,11 +24,11 @@ user-missing values, or a range of numeric values, or a range plus one discrete value. - - Short string variables may have up to 3 discrete string - user-missing values. - - - Long string variables may not have user-missing - values. */ + - String variables may have up to 3 discrete string + user-missing values. (However, for long string + variables all bytes after the first MV_MAX_STRING must + be spaces.) +*/ #ifndef DATA_MISSING_VALUES_H #define DATA_MISSING_VALUES_H 1 @@ -36,6 +36,12 @@ #include #include "data/value.h" +struct pool; + +/* Missing values for long string variables after the first + MV_MAX_STRING bytes must be all spaces. */ +#define MV_MAX_STRING 8 + /* Missing values. Opaque--use access functions defined below. */ struct missing_values @@ -58,11 +64,13 @@ enum mv_class 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[], +bool mv_is_str_missing (const struct missing_values *, const uint8_t[], enum mv_class); /* Initializing missing value sets. */ void mv_init (struct missing_values *, int width); +void mv_init_pool (struct pool *pool, struct missing_values *, int width); +void mv_destroy (struct missing_values *); void mv_copy (struct missing_values *, const struct missing_values *); void mv_clear (struct missing_values *); @@ -71,13 +79,14 @@ bool mv_is_resizable (const struct missing_values *, int width); void mv_resize (struct missing_values *, int width); /* Basic property inspection. */ +bool mv_is_acceptable (const union value *, int width); bool mv_is_empty (const struct missing_values *); int mv_get_width (const struct missing_values *); /* Inspecting discrete values. */ int mv_n_values (const struct missing_values *); bool mv_has_value (const struct missing_values *); -void mv_get_value (const struct missing_values *, union value *, int idx); +const union value *mv_get_value (const struct missing_values *, int idx); /* Inspecting ranges. */ bool mv_has_range (const struct missing_values *); @@ -85,10 +94,10 @@ void mv_get_range (const struct missing_values *, double *low, double *high); /* Adding and modifying discrete values. */ bool mv_add_value (struct missing_values *, const union value *); -bool mv_add_str (struct missing_values *, const char[]); +bool mv_add_str (struct missing_values *, const uint8_t[]); bool mv_add_num (struct missing_values *, double); void mv_pop_value (struct missing_values *, union value *); -void mv_replace_value (struct missing_values *, const union value *, int idx); +bool mv_replace_value (struct missing_values *, const union value *, int idx); /* Adding and modifying ranges. */ bool mv_add_range (struct missing_values *, double low, double high);