X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsort.h;h=37d9db577f30e02b2b6ade3857f4d0981d9e8de1;hb=6a42f0b711d699333fda01a076b8a27275fc4492;hp=63054413f539a0238f1efd7594faeb648a195869;hpb=06f9ee45954e5e71fa7f6262dbf37defa1dbf996;p=pspp diff --git a/src/sort.h b/src/sort.h index 63054413f5..37d9db577f 100644 --- a/src/sort.h +++ b/src/sort.h @@ -14,25 +14,50 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #if !sort_h #define sort_h 1 #include +#include "bool.h" struct casereader; struct dictionary; struct variable; -struct sort_criteria *sort_parse_criteria (const struct dictionary *, - struct variable ***, int *); + +/* Sort direction. */ +enum sort_direction + { + SRT_ASCEND, /* A, B, C, ..., X, Y, Z. */ + SRT_DESCEND /* Z, Y, X, ..., C, B, A. */ + }; + +/* A sort criterion. */ +struct sort_criterion + { + int fv; /* Variable data index. */ + int width; /* 0=numeric, otherwise string width. */ + enum sort_direction dir; /* Sort direction. */ + }; + +/* A set of sort criteria. */ +struct sort_criteria + { + struct sort_criterion *crits; + size_t crit_cnt; + }; + + void sort_destroy_criteria (struct sort_criteria *); struct casefile *sort_execute (struct casereader *, const struct sort_criteria *); + int sort_active_file_in_place (const struct sort_criteria *); + struct casefile *sort_active_file_to_casefile (const struct sort_criteria *); #endif /* !sort_h */