Bump year. Change Aps->ApS
[idzebra-moved-to-github.git] / include / bset.h
1 /* $Id: bset.h,v 1.5 2005-01-15 19:38:24 adam Exp $
2    Copyright (C) 1995-2005
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 */
22
23
24 #ifndef BSET_H
25 #define BSET_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef unsigned short BSetWord;
32 typedef BSetWord *BSet;
33
34 typedef struct BSetHandle_ {
35     unsigned size;        /* size of set in members */
36     unsigned wsize;       /* size of individual set (in BSetWord)*/
37     unsigned offset;      /* offset in current set block */
38     unsigned chunk;       /* chunk, i.e. size of each block */
39     struct BSetHandle_ *setchain;
40     BSetWord setarray[1];
41 } BSetHandle;
42
43 BSetHandle *mk_BSetHandle (int size, int chunk);
44 void       rm_BSetHandle  (BSetHandle **shp);
45 int        inf_BSetHandle (BSetHandle *sh, long *used, long *alloc);
46 BSet       cp_BSet        (BSetHandle *sh, BSet dst, BSet src);
47 void       add_BSet       (BSetHandle *sh, BSet dst, unsigned member);
48 void       union_BSet     (BSetHandle *sh, BSet dst, BSet src);
49 BSet       mk_BSet        (BSetHandle **shp);
50 void       rm_BSet        (BSetHandle **shp);
51 void       res_BSet       (BSetHandle *sh, BSet dst);
52 void       com_BSet       (BSetHandle *sh, BSet dst);
53 void       pr_BSet        (BSetHandle *sh, BSet src);
54 unsigned   test_BSet      (BSetHandle *sh, BSet src, unsigned member);
55 int        trav_BSet      (BSetHandle *sh, BSet src, unsigned member);
56 int        travi_BSet     (BSetHandle *sh, BSet src, unsigned member);
57 unsigned   hash_BSet      (BSetHandle *sh, BSet src);
58 int        eq_BSet        (BSetHandle *sh, BSet dst, BSet src);
59 void       pr_charBSet    (BSetHandle *sh, BSet src, void (*f)(int));
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif