c397886411d78b06177f002d6dc23f9e769a32d0
[idzebra-moved-to-github.git] / include / set.h
1 /* $Id: set.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 SET_H
25 #define SET_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct SetElement_  {
32     struct SetElement_ *next;
33     int value;
34 } SetElement, *Set;
35
36 typedef struct {
37     Set  alloclist;
38     Set  freelist;
39     long used;
40     int  chunk;
41 } *SetType;
42
43 SetType  mk_SetType   (int chunk);
44 int      inf_SetType  (SetType st, long *used, long *allocated);
45 SetType  rm_SetType   (SetType st);
46 Set      mk_Set       (SetType st);
47 Set      add_Set      (SetType st, Set s, int value);
48 Set      merge_Set    (SetType st, Set s1, Set s2);
49 Set      union_Set    (SetType st, Set s1, Set s2);
50 Set      rm_Set       (SetType st, Set s);
51 Set      cp_Set       (SetType st, Set s);
52 void     pr_Set       (SetType st, Set s);
53 unsigned hash_Set     (SetType st, Set s);
54 int      eq_Set       (SetType s, Set s1, Set s2);
55
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif
61