X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsubcase.h;h=71bf6fd7cc33d4227a4e3c4380f6773a1bfc599a;hb=10564d2d51762fa92574ea2a42262157ff013474;hp=d50d0748ba86fbe89b64cd93db82f3b0f6a07408;hpb=9a331fe64eb814ae5c1322e21717a04fb254bf65;p=pspp diff --git a/src/data/subcase.h b/src/data/subcase.h index d50d0748ba..71bf6fd7cc 100644 --- a/src/data/subcase.h +++ b/src/data/subcase.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -44,7 +44,8 @@ struct subcase { struct subcase_field *fields; size_t n_fields; - size_t n_values; + + struct caseproto *proto; /* Created lazily. */ }; void subcase_init_empty (struct subcase *); @@ -52,17 +53,34 @@ void subcase_init_vars (struct subcase *, const struct variable *const *, size_t n_vars); void subcase_init_var (struct subcase *, const struct variable *, enum subcase_direction); +void subcase_init (struct subcase *, int index, int width, + enum subcase_direction); + void subcase_clone (struct subcase *, const struct subcase *); void subcase_clear (struct subcase *); void subcase_destroy (struct subcase *); +bool subcase_contains (const struct subcase *, int case_index); +bool subcase_contains_var (const struct subcase *, const struct variable *); + +bool subcase_add (struct subcase *, int case_index, int width, + enum subcase_direction direction); bool subcase_add_var (struct subcase *, const struct variable *, enum subcase_direction); +void subcase_add_always (struct subcase *sc, int case_index, int width, + enum subcase_direction direction); +void subcase_add_var_always (struct subcase *, const struct variable *, + enum subcase_direction); +void subcase_add_proto_always (struct subcase *, const struct caseproto *); + +const struct caseproto *subcase_get_proto (const struct subcase *); + static inline bool subcase_is_empty (const struct subcase *); static inline size_t subcase_get_n_fields (const struct subcase *); -static inline size_t subcase_get_n_values (const struct subcase *); +static inline size_t subcase_get_case_index (const struct subcase *, + size_t idx); static inline enum subcase_direction subcase_get_direction ( const struct subcase *, size_t idx); @@ -92,6 +110,12 @@ bool subcase_equal_cx (const struct subcase *, bool subcase_equal_xx (const struct subcase *, const union value *a, const union value *b); +static inline size_t +subcase_get_case_index (const struct subcase *sc, size_t idx) +{ + return sc->fields[idx].case_index; +} + static inline enum subcase_direction subcase_get_direction (const struct subcase *sc, size_t idx) { @@ -110,10 +134,4 @@ subcase_get_n_fields (const struct subcase *sc) return sc->n_fields; } -static inline size_t -subcase_get_n_values (const struct subcase *sc) -{ - return sc->n_values; -} - #endif /* data/subcase.h */