]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
c0de361f | 2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. |
885824d3 | 3 | ** See ../LICENSE for license information. |
4 | */ | |
5 | /* | |
6 | ** usymIdSet.h | |
7 | ** | |
8 | ** based on set_template.h | |
9 | */ | |
10 | ||
11 | # ifndef USYMIDSET_H | |
12 | # define USYMIDSET_H | |
13 | ||
28bf4b0b | 14 | abst_typedef /*@null@*/ struct |
885824d3 | 15 | { |
16 | int entries; | |
17 | int nspace; | |
18 | /*@reldef@*/ /*@relnull@*/ usymId *elements; | |
19 | } *usymIdSet ; | |
20 | ||
21 | extern usymIdSet usymIdSet_new(void); | |
22 | extern bool usymIdSet_member (usymIdSet p_s, usymId p_el) /*@*/ ; | |
23 | extern usymIdSet usymIdSet_subtract (usymIdSet p_s, usymIdSet p_t); | |
24 | extern void usymIdSet_free (/*@only@*/ /*@only@*/ usymIdSet p_s); | |
25 | extern /*@only@*/ cstring usymIdSet_unparse (usymIdSet p_ll); | |
26 | extern /*@only@*/ cstring usymIdSet_dump (usymIdSet p_lset); | |
27 | extern usymIdSet usymIdSet_undump (char **p_s); | |
28 | extern /*@only@*/ usymIdSet usymIdSet_single (usymId p_t); | |
29 | ||
30 | extern int usymIdSet_compare (usymIdSet p_l1, usymIdSet p_l2); | |
31 | ||
32 | /*@constant int usymIdSetBASESIZE;@*/ | |
33 | # define usymIdSetBASESIZE SMALLBASESIZE | |
34 | ||
35 | extern usymIdSet usymIdSet_newUnion (usymIdSet p_s1, usymIdSet p_s2) /*@*/ ; | |
36 | extern usymIdSet usymIdSet_add (usymIdSet p_s, usymId p_el) /*@*/ ; | |
37 | ||
38 | extern /*@only@*/ usymIdSet | |
39 | usymIdSet_removeFresh (/*@temp@*/ usymIdSet p_s, usymId p_el); | |
40 | ||
41 | /*@constant null usymIdSet usymIdSet_undefined; @*/ | |
42 | # define usymIdSet_undefined ((usymIdSet) NULL) | |
43 | ||
0e41eb0e | 44 | extern /*@falsewhennull@*/ bool usymIdSet_isDefined (usymIdSet p_s) /*@*/ ; |
885824d3 | 45 | # define usymIdSet_isDefined(s) ((s) != usymIdSet_undefined) |
46 | ||
0e41eb0e | 47 | extern /*@nullwhentrue@*/ bool usymIdSet_isUndefined (usymIdSet p_s) /*@*/ ; |
885824d3 | 48 | # define usymIdSet_isUndefined(s) ((s) == usymIdSet_undefined) |
49 | ||
50 | /*@iter usymIdSet_elements (sef usymIdSet u, yield usymId el); @*/ | |
51 | # define usymIdSet_elements(x, m_el) \ | |
52 | { int m_ind; if (usymIdSet_isDefined (x)) { \ | |
53 | for (m_ind = 0 ; m_ind < usymIdSet_size(x); m_ind++) \ | |
54 | { usymId m_el = (x)->elements[m_ind]; | |
55 | ||
56 | # define end_usymIdSet_elements }}} | |
57 | ||
58 | extern int usymIdSet_size (/*@sef@*/ usymIdSet p_s); | |
59 | # define usymIdSet_size(s) (usymIdSet_isUndefined(s) ? 0 : (s)->entries) | |
60 | ||
61 | # else | |
62 | # error "Multiple include" | |
63 | # endif | |
64 |