zebrasrv: sortkeys args are optional
[idzebra-moved-to-github.git] / include / bset.h
1 /* This file is part of the Zebra server.
2    Copyright (C) 1994-2011 Index Data
3
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 */
19
20 #ifndef BSET_H
21 #define BSET_H
22
23 #include <yaz/yconfig.h>
24
25 YAZ_BEGIN_CDECL
26
27 typedef unsigned short BSetWord;
28 typedef BSetWord *BSet;
29
30 typedef struct BSetHandle_ {
31     unsigned size;        /* size of set in members */
32     unsigned wsize;       /* size of individual set (in BSetWord)*/
33     unsigned offset;      /* offset in current set block */
34     unsigned chunk;       /* chunk, i.e. size of each block */
35     struct BSetHandle_ *setchain;
36     BSetWord setarray[1];
37 } BSetHandle;
38
39 BSetHandle *mk_BSetHandle (int size, int chunk);
40 void       rm_BSetHandle  (BSetHandle **shp);
41 int        inf_BSetHandle (BSetHandle *sh, long *used, long *alloc);
42 BSet       cp_BSet        (BSetHandle *sh, BSet dst, BSet src);
43 void       add_BSet       (BSetHandle *sh, BSet dst, unsigned member);
44 void       union_BSet     (BSetHandle *sh, BSet dst, BSet src);
45 BSet       mk_BSet        (BSetHandle **shp);
46 void       rm_BSet        (BSetHandle **shp);
47 void       res_BSet       (BSetHandle *sh, BSet dst);
48 void       com_BSet       (BSetHandle *sh, BSet dst);
49 void       pr_BSet        (BSetHandle *sh, BSet src);
50 unsigned   test_BSet      (BSetHandle *sh, BSet src, unsigned member);
51 int        trav_BSet      (BSetHandle *sh, BSet src, unsigned member);
52 int        travi_BSet     (BSetHandle *sh, BSet src, unsigned member);
53 unsigned   hash_BSet      (BSetHandle *sh, BSet src);
54 int        eq_BSet        (BSetHandle *sh, BSet dst, BSet src);
55 void       pr_charBSet    (BSetHandle *sh, BSet src, void (*f)(int));
56
57 YAZ_END_CDECL
58
59 #endif
60 /*
61  * Local variables:
62  * c-basic-offset: 4
63  * c-file-style: "Stroustrup"
64  * indent-tabs-mode: nil
65  * End:
66  * vim: shiftwidth=4 tabstop=8 expandtab
67  */
68