fix cparser warnings
[libfirm] / include / libfirm / adt / eset.h
1 /*
2  * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       a pointer hashset (WARNING: deprecated, use hashset_new.*
23  *              instead)
24  * @author      Hubert Schmid
25  * @date        09.06.2002
26  * @version     $Id$
27  * @deprecated
28  */
29 #ifndef FIRM_ADT_ESET_H
30 #define FIRM_ADT_ESET_H
31
32 #include <stddef.h>
33
34 #include "../begin.h"
35
36 /**
37  * "eset" is a set of addresses. The addresses are used for element
38  * compare and hash calculation.
39  * The value "NULL" can not be stored, as it is used as internal sentinel.
40  */
41 typedef struct eset eset;
42
43 /** Creates a new empty set. */
44 FIRM_API eset *eset_create(void);
45
46 /**
47  * Creates a copy of the given set. Does NOT work if NULL is contained in source. */
48 FIRM_API eset *eset_copy(eset *source);
49
50 /** Deletes a set. */
51 FIRM_API void eset_destroy(eset *s);
52
53 /** Returns the number of elements in the set. */
54 FIRM_API size_t eset_count(eset *s);
55
56 /** Inserts an address into the set. */
57 FIRM_API void eset_insert(eset *s, void *p);
58
59 /** Checks, whether an address is element of a set. */
60 FIRM_API int eset_contains(eset *s, void *p);
61
62 /**
63  * Starts the iteration over a set and returns the first element or NULL
64  * if the set is empty.
65  *
66  * @note: It is NOT possible to add new elements while iterating through a set.
67  */
68 FIRM_API void *eset_first(eset *s);
69
70 /**
71  * Continues iteration through a set and returns the next element or NULL if the
72  * iteration is finished.
73  *
74  * @note: It is NOT possible to add new elements while iterating through a set.
75  */
76 FIRM_API void *eset_next(eset *s);
77
78 /** Inserts all elements of source into target (union).  Does NOT work if NULL is contained in source. */
79 FIRM_API void eset_insert_all(eset *target, eset *source);
80
81 #define eset_foreach(eset, type, iter) \
82         for ((iter) = (type)eset_first((eset)); (iter) != NULL; (iter) = (type)eset_next((eset)))
83
84 #include "../end.h"
85
86 #endif