X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdictionary.c;h=a2e3fb8fc1ee2a6e42d6d287eb6bd3047cee9277;hb=c6caca37f19989f96ad843e2baee09a54c4f23ba;hp=c13321c7827bb2cd877c598d834f5bbc2a341c6e;hpb=24cbabb1547682037cda854b46c2e4bdf87a2c8a;p=pspp diff --git a/src/data/dictionary.c b/src/data/dictionary.c index c13321c782..a2e3fb8fc1 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -416,6 +416,12 @@ dict_set_split_vars__ (struct dictionary *d, } } +enum split_type +dict_get_split_type (const struct dictionary *d) +{ + return d->split_type; +} + /* Sets N split vars SPLIT in dictionary D. */ void dict_set_split_vars (struct dictionary *d, @@ -1256,7 +1262,7 @@ dict_get_weight (const struct dictionary *d) } /* Returns the value of D's weighting variable in case C, except - that a negative weight is returned as 0. Returns 1 if the + that a negative or missing weight is returned as 0. Returns 1 if the dictionary is unweighted. Will warn about missing, negative, or zero values if *WARN_ON_INVALID is true. The function will set *WARN_ON_INVALID to false if an invalid weight is @@ -1277,6 +1283,15 @@ dict_get_case_weight (const struct dictionary *d, const struct ccase *c, } } +/* Like dict_get_case_weight(), but additionally rounds each weight to the + nearest integer. */ +double +dict_get_rounded_case_weight (const struct dictionary *d, + const struct ccase *c, bool *warn_on_invalid) +{ + return floor (dict_get_case_weight (d, c, warn_on_invalid) + 0.5); +} + /* Returns the format to use for weights. */ const struct fmt_spec * dict_get_weight_format (const struct dictionary *d)