X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvalue.h;h=cb66cb0836c7b00eeb7e992199650c192b15f780;hb=a9acce47d67e0ab35ce1690e4f1b1ac0121c2d78;hp=b7a7ee701f8ae31f695e35629ca26b562b853842;hpb=b31bac73c9affb7843d332807ffe5cef9c5e7cea;p=pspp-builds.git diff --git a/src/data/value.h b/src/data/value.h index b7a7ee70..cb66cb08 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007 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 @@ -14,35 +14,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#if !value_h -#define value_h 1 +#ifndef DATA_VALUE_H +#define DATA_VALUE_H 1 -#include -#include #include +#include #include "minmax.h" -/* Values. */ - /* "Short" strings, which are generally those no more than 8 characters wide, can participate in more operations than longer strings. */ #define MAX_SHORT_STRING (MAX (ROUND_UP (SIZEOF_DOUBLE, 2), 8)) #define MIN_LONG_STRING (MAX_SHORT_STRING + 1) -#define MAX_STRING 32767 - -/* Special values. */ -#define SYSMIS (-DBL_MAX) -#define LOWEST (float_get_lowest ()) -#define HIGHEST DBL_MAX - -/* Number of "union value"s required for a variable of the given - WIDTH. */ -static inline size_t -value_cnt_from_width (int width) -{ - return width == 0 ? 1 : DIV_RND_UP (width, MAX_SHORT_STRING); -} /* A numeric or short string value. Multiple consecutive values represent a long string. */ @@ -58,7 +41,18 @@ union value *value_create (int width); int compare_values (const union value *, const union value *, int width); unsigned hash_value (const union value *, int width); +static inline size_t value_cnt_from_width (int width); void value_copy (union value *, const union value *, int width); void value_set_missing (union value *, int width); +bool value_is_resizable (const union value *, int old_width, int new_width); +void value_resize (union value *, int old_width, int new_width); + +/* Number of "union value"s required for a variable of the given + WIDTH. */ +static inline size_t +value_cnt_from_width (int width) +{ + return width == 0 ? 1 : DIV_RND_UP (width, MAX_SHORT_STRING); +} -#endif /* !value.h */ +#endif /* data/value.h */