]>
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 | /* | |
7 | ** sortSet.h | |
8 | ** | |
9 | ** based on set_template.h | |
10 | */ | |
11 | ||
12 | # ifndef SORTSET_H | |
13 | # define SORTSET_H | |
14 | ||
28bf4b0b | 15 | abst_typedef /*@null@*/ struct |
885824d3 | 16 | { |
17 | int entries; | |
18 | int nspace; | |
19 | /*@reldef@*/ /*@relnull@*/ sort *elements; | |
20 | } *sortSet ; | |
21 | ||
22 | /*@iter sortSet_elements(sef sortSet s, yield sort el); @*/ | |
23 | # define sortSet_elements(x, m_el) \ | |
24 | if (sortSet_isDefined (x)) { int m_ind; \ | |
25 | for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ | |
26 | { sort m_el = (x)->elements[m_ind]; | |
27 | ||
28 | # define end_sortSet_elements }} | |
29 | ||
30 | /*@constant null sortSet sortSet_undefined; @*/ | |
31 | # define sortSet_undefined ((sortSet) NULL) | |
0e41eb0e | 32 | extern /*@falsewhennull@*/ bool sortSet_isDefined (sortSet p_s) /*@*/ ; |
885824d3 | 33 | # define sortSet_isDefined(s) ((s) != sortSet_undefined) |
34 | ||
35 | extern int sortSet_size (/*@sef@*/ sortSet p_s); | |
36 | # define sortSet_size(s) (sortSet_isDefined (s) ? (s)->entries : 0) | |
37 | ||
38 | extern /*@only@*/ sortSet sortSet_new(void); | |
39 | extern bool sortSet_insert (sortSet p_s, sort p_el); | |
40 | extern bool sortSet_member (sortSet p_s, sort p_el); | |
41 | extern /*@only@*/ cstring sortSet_unparse (sortSet p_s); | |
42 | extern /*@only@*/ cstring sortSet_unparseClean (sortSet p_s); | |
43 | extern /*@only@*/ cstring sortSet_unparseOr (sortSet p_s); | |
44 | extern void sortSet_free (/*@only@*/ sortSet p_s); | |
45 | extern sort sortSet_choose (sortSet p_s); | |
46 | extern /*@only@*/ sortSet sortSet_copy (sortSet p_s); | |
47 | ||
48 | /*@constant int sortSetBASESIZE;@*/ | |
49 | # define sortSetBASESIZE MIDBASESIZE | |
50 | ||
51 | # else | |
52 | # error "Multiple include" | |
53 | # endif | |
54 |