Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/sorting.h
Parent Directory
|
Revision Log
Revision 948 -
(show annotations)
(download)
(as text)
Wed Jan 11 18:28:30 2012 UTC (13 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 1622 byte(s)
Wed Jan 11 18:28:30 2012 UTC (13 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 1622 byte(s)
The filesort_*() functions now return a count of the number of items kept after sorting.
1 | /*************************************** |
2 | Header file for sorting function prototypes |
3 | |
4 | Part of the Routino routing software. |
5 | ******************/ /****************** |
6 | This file Copyright 2008-2012 Andrew M. Bishop |
7 | |
8 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU Affero General Public License as published by |
10 | the Free Software Foundation, either version 3 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public License |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | ***************************************/ |
21 | |
22 | |
23 | #ifndef SORTING_H |
24 | #define SORTING_H /*+ To stop multiple inclusions. +*/ |
25 | |
26 | #include <stdlib.h> |
27 | |
28 | #include "types.h" |
29 | |
30 | |
31 | /* Functions in sorting.c */ |
32 | |
33 | /*+ The type, size and alignment of variable to store the variable length +*/ |
34 | #define FILESORT_VARINT unsigned short |
35 | #define FILESORT_VARSIZE sizeof(FILESORT_VARINT) |
36 | #define FILESORT_VARALIGN sizeof(void*) |
37 | |
38 | index_t filesort_fixed(int fd_in,int fd_out,size_t itemsize,int (*compare)(const void*,const void*),int (*keep)(void*,index_t)); |
39 | |
40 | index_t filesort_vary(int fd_in,int fd_out,int (*compare)(const void*,const void*),int (*keep)(void*,index_t)); |
41 | |
42 | void filesort_heapsort(void **datap,size_t nitems,int(*compare)(const void*, const void*)); |
43 | |
44 | |
45 | #endif /* SORTING_H */ |