X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.h;h=44cfba703fe56a162f9bd6f418cb311df95c27d1;hb=29956ba4326b9d6a2bc4d22a9f323902c7a08d43;hp=0cb20b8fec3dd9204f3281e012462aa17335391b;hpb=338fb2a2e84df6427a2fdee6769421f57d5666d8;p=pspp diff --git a/src/data/variable.h b/src/data/variable.h index 0cb20b8fec..44cfba703f 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -1,28 +1,25 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 1997-9, 2000 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 !variable_h #define variable_h 1 #include -#include "config.h" #include +#include union value; @@ -62,6 +59,9 @@ unsigned hash_var_ptr_by_name (const void *, const void *); enum var_type var_get_type (const struct variable *); int var_get_width (const struct variable *); void var_set_width (struct variable *, int width); + +typedef bool var_predicate_func (const struct variable *); + bool var_is_numeric (const struct variable *); bool var_is_alpha (const struct variable *); bool var_is_short_string (const struct variable *); @@ -74,17 +74,10 @@ void var_set_missing_values (struct variable *, const struct missing_values *); void var_clear_missing_values (struct variable *); bool var_has_missing_values (const struct variable *); -typedef bool var_is_missing_func (const struct variable *, - const union value *); -bool var_is_value_missing (const struct variable *, const union value *); -bool var_is_num_missing (const struct variable *, double); -bool var_is_str_missing (const struct variable *, const char[]); -bool var_is_value_user_missing (const struct variable *, - const union value *); -bool var_is_num_user_missing (const struct variable *, double); -bool var_is_str_user_missing (const struct variable *, const char[]); -bool var_is_value_system_missing (const struct variable *, - const union value *); +bool var_is_value_missing (const struct variable *, const union value *, + enum mv_class); +bool var_is_num_missing (const struct variable *, double, enum mv_class); +bool var_is_str_missing (const struct variable *, const char[], enum mv_class); /* Value labels. */ const struct val_labs *var_get_value_labels (const struct variable *); @@ -116,9 +109,9 @@ bool var_has_label (const struct variable *); /* How data is measured. */ enum measure { - MEASURE_NOMINAL = 1, - MEASURE_ORDINAL = 2, - MEASURE_SCALE = 3, + MEASURE_NOMINAL = 0, + MEASURE_ORDINAL = 1, + MEASURE_SCALE = 2, n_MEASURES }; @@ -130,8 +123,10 @@ void var_set_measure (struct variable *, enum measure); int var_get_display_width (const struct variable *); void var_set_display_width (struct variable *, int display_width); +int var_default_display_width (int width); + /* Alignment of data for display. */ -enum alignment +enum alignment { ALIGN_LEFT = 0, ALIGN_RIGHT = 1, @@ -150,9 +145,10 @@ void var_set_leave (struct variable *, bool leave); bool var_must_leave (const struct variable *); /* Short names. */ -const char *var_get_short_name (const struct variable *); -void var_set_short_name (struct variable *, const char *); -void var_clear_short_name (struct variable *); +size_t var_get_short_name_cnt (const struct variable *); +const char *var_get_short_name (const struct variable *, size_t idx); +void var_set_short_name (struct variable *, size_t, const char *); +void var_clear_short_names (struct variable *); /* Relationship with dictionary. */ size_t var_get_dict_index (const struct variable *); @@ -160,7 +156,7 @@ size_t var_get_case_index (const struct variable *); /* Variable auxiliary data. */ void *var_get_aux (const struct variable *); -void *var_attach_aux (struct variable *, +void *var_attach_aux (const struct variable *, void *aux, void (*aux_dtor) (struct variable *)); void var_clear_aux (struct variable *); void *var_detach_aux (struct variable *); @@ -168,11 +164,11 @@ void var_dtor_free (struct variable *); /* Observed categorical values. */ struct cat_vals *var_get_obs_vals (const struct variable *); -void var_set_obs_vals (struct variable *, struct cat_vals *); +void var_set_obs_vals (const struct variable *, struct cat_vals *); bool var_has_obs_vals (const struct variable *); /* Classes of variables. */ -enum dict_class +enum dict_class { DC_ORDINARY, /* Ordinary identifier. */ DC_SYSTEM, /* System variable. */