X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsort.h;h=af443edc34b8b4f5b5003b2d73d8f805b29003ce;hb=e210b20bf6f405637c8c03dd280b5a4a627191b8;hp=15a5b2db25d71f6f3a7d554e63426021ca52504d;hpb=5906e30c29662d12594199e1652ba3a7e5670944;p=pspp diff --git a/src/sort.h b/src/sort.h index 15a5b2db25..af443edc34 100644 --- a/src/sort.h +++ b/src/sort.h @@ -14,20 +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 "vfm.h" +#include +#include -/* SORT CASES programmatic interface. */ -int sort_cases (int separate); -void read_sort_output (write_case_func *, write_case_data); +struct casereader; +struct dictionary; +struct variable; -/* Variables to sort. */ -extern struct variable **v_sort; -extern int nv_sort; + +/* 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 */