X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fsort.c;fp=src%2Fmath%2Fsort.c;h=233d0f585c680e8c75a963d5aee7d7c72fab325f;hb=4e57d32680bf79fc93f7cd0d5b92a2c713211972;hp=9c2118985c59583bfe42d66ed5152452e3417d3b;hpb=86189d786fc34c9da174b5018bec27640f7062e4;p=pspp diff --git a/src/math/sort.c b/src/math/sort.c index 9c2118985c..233d0f585c 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -216,6 +216,23 @@ sort_execute_1var (struct casereader *input, const struct variable *var) subcase_destroy (&sc); return reader; } + +/* Reads all the cases from INPUT. Sorts the cases according to ORDERING, + combining cases that have the same ORDERING values using COMBINE. + Returns the sorted cases in a new casereader. */ +struct casereader * +sort_distinct_execute (struct casereader *input, + const struct subcase *ordering, + sort_distinct_combine_func *combine, + sort_distinct_destroy_func *destroy, + void *aux) +{ + struct casewriter *output = + sort_distinct_create_writer (ordering, casereader_get_proto (input), + combine, destroy, aux); + casereader_transfer (input, output); + return casewriter_make_reader (output); +} struct pqueue {