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=752d5270007bcdc4d505e2eb4ad4ba887b27e8fd;hb=2f5ea6bbd8c8c8a01f87bf3cdb9e1e1eab6e7fd6;hp=61256ccdbc6d1f8dd19e284232778263a585ed41;hpb=490ac70d9c9f754f733552d64c23dd6aedced342;p=pspp diff --git a/src/math/sort.c b/src/math/sort.c index 61256ccdbc..752d527000 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -219,6 +219,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 {