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