Fixed bug with switch conds
[libfirm] / ir / ana2 / lset.h
1 /* -*- c -*- */
2
3 /*
4  * Project:     libFIRM
5  * File name:   ir/ana2/lset.h
6  * Purpose:     Lists, err, Sets
7  * Author:      Florian
8  * Modified by:
9  * Created:     Mon 18 Oct 2004
10  * CVS-ID:      $Id$
11  * Copyright:   (c) 1999-2004 Universität Karlsruhe
12  * Licence:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
13  */
14
15 # ifndef _LSET_H_
16 # define _LSET_H_
17
18 /*
19   Data Types and Structures
20 */
21 /* Lists, err, Sets */
22 typedef struct lset_entry
23 {
24   void *data;
25   struct lset_entry *next;
26 } lset_entry_t;
27
28 typedef struct lset
29 {
30   lset_entry_t *first;
31   lset_entry_t *last;           /* useful for lset_append */
32   lset_entry_t *curs;           /* for lset_first/lset_next */
33   int n_entries;
34 } lset_t;
35
36 /* create a new lset */
37 lset_t *lset_create (void);
38 /* check whether the lset contains an entry for the given data */
39 int lset_contains (lset_t*, void*);
40 /* check whether the given lset is empty */
41 int lset_empty (lset_t*);
42 /* insert the data into the lset (unless there's an entry for it
43    already) */
44 void lset_insert (lset_t*, void*);
45 /* insert all entries from src into tgt */
46 void lset_insert_all (lset_t*, lset_t*);
47 /* append src to tgt. src is deallocated. */
48 void lset_append (lset_t*, lset_t*);
49
50 /* remove the entry for the given data element from the lset. return
51    TRUE iff it was on the list in the first place, FALSE else */
52 int lset_remove (lset_t*, void*);
53 /* prepare the given lset for an iteration. return the first element. */
54 void *lset_first (lset_t*);
55 /* after calling lset_first, get the next element, if applicable, or
56    NULL */
57 void *lset_next (lset_t*);
58 /* say how many entries there are in the given lset */
59 int lset_n_entries (lset_t*);
60 /* deallocate the lset and all of its entries */
61 void lset_destroy (lset_t*);
62
63
64
65 # endif /* not defined _LSET_H_ */
66
67 \f
68 /*
69   $Log$
70   Revision 1.1  2004/10/21 11:09:37  liekweg
71   Moved memwalk stuf into irmemwalk
72   Moved lset stuff into lset
73   Moved typalise stuff into typalise
74
75
76  */