X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcasereader.h;h=3b903bbfd52d66cdba8ffe0e960fa7f0d1ef2474;hb=2896dffb3e6af00a5c764f0b3c0f67bd292ef51e;hp=31e448fbc2215ccc00f9fb087307c283246edf7e;hpb=43b1296aafe7582e7dbe6c2b6a8b478d7d9b0fcf;p=pspp-builds.git diff --git a/src/data/casereader.h b/src/data/casereader.h index 31e448fb..3b903bbf 100644 --- a/src/data/casereader.h +++ b/src/data/casereader.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 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 @@ -59,7 +59,7 @@ struct dictionary; struct casereader; struct casewriter; -bool casereader_read (struct casereader *, struct ccase *); +struct ccase *casereader_read (struct casereader *); bool casereader_destroy (struct casereader *); struct casereader *casereader_clone (const struct casereader *); @@ -68,8 +68,8 @@ void casereader_split (struct casereader *, struct casereader *casereader_rename (struct casereader *); void casereader_swap (struct casereader *, struct casereader *); -bool casereader_peek (struct casereader *, casenumber, struct ccase *) - WARN_UNUSED_RESULT; +struct ccase *casereader_peek (struct casereader *, casenumber); +bool casereader_is_empty (struct casereader *); bool casereader_error (const struct casereader *); void casereader_force_error (struct casereader *); @@ -77,7 +77,7 @@ const struct taint *casereader_get_taint (const struct casereader *); casenumber casereader_get_case_cnt (struct casereader *); casenumber casereader_count_cases (struct casereader *); -size_t casereader_get_value_cnt (struct casereader *); +const struct caseproto *casereader_get_proto (const struct casereader *); void casereader_transfer (struct casereader *, struct casewriter *); @@ -97,6 +97,7 @@ struct casereader * casereader_create_filter_missing (struct casereader *, const struct variable **vars, size_t var_cnt, enum mv_class, + casenumber *n_missing, struct casewriter *exclude); struct casereader * @@ -104,11 +105,45 @@ casereader_create_counter (struct casereader *, casenumber *counter, casenumber initial_value); struct casereader * -casereader_create_translator (struct casereader *, size_t output_value_cnt, - void (*translate) (const struct ccase *input, - struct ccase *output, - void *aux), +casereader_create_translator (struct casereader *, + const struct caseproto *output_proto, + struct ccase *(*translate) (struct ccase *, + void *aux), bool (*destroy) (void *aux), void *aux); +/* A function which creates a numberic value from an existing case */ +typedef double new_value_func (const struct ccase *, casenumber, void *); + +struct casereader * +casereader_create_append_numeric (struct casereader *subreader, + new_value_func func, void *aux, + void (*destroy) (void *aux)); + +struct casereader * +casereader_create_arithmetic_sequence (struct casereader *, + double first, double increment); + +enum rank_error + { + RANK_ERR_NONE = 0, + RANK_ERR_NEGATIVE_WEIGHT = 0x01, + RANK_ERR_UNSORTED = 0x02 + }; + + +typedef void distinct_func (double v, casenumber n, double w, void *aux); + +struct casereader * +casereader_create_append_rank (struct casereader *, + const struct variable *v, const struct variable *w, + enum rank_error *err, + distinct_func *distinct_callback, void *aux); + +struct casereader * +casereader_create_distinct (struct casereader *input, + const struct variable *key, + const struct variable *weight); + + #endif /* data/casereader.h */