]>
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 | /* | |
7 | ** aliasTable.h | |
8 | */ | |
9 | ||
10 | # ifndef aliasTable_H | |
11 | # define aliasTable_H | |
12 | ||
13 | typedef /*@only@*/ sRefSet o_sRefSet; | |
14 | typedef /*@exposed@*/ sRef e_sRef; | |
15 | ||
28bf4b0b | 16 | struct s_aliasTable /*@i32 reserved works for struct identifiers@*/ |
885824d3 | 17 | { |
18 | int nelements; | |
19 | int nspace; | |
20 | /*@reldef@*/ /*@only@*/ e_sRef *keys; | |
21 | /*@reldef@*/ /*@only@*/ o_sRefSet *values; | |
22 | } ; | |
23 | ||
24 | extern /*@unused@*/ /*@truenull@*/ bool aliasTable_isUndefined (aliasTable p_s); | |
25 | extern /*@unused@*/ /*@truenull@*/ bool | |
26 | aliasTable_isEmpty (/*@sef@*/ aliasTable p_s); | |
27 | extern /*@falsenull@*/ bool aliasTable_isDefined (aliasTable p_s); | |
28 | ||
29 | /*@constant null aliasTable aliasTable_undefined; @*/ | |
30 | # define aliasTable_undefined ((aliasTable) NULL) | |
31 | # define aliasTable_isDefined(s) ((s) != aliasTable_undefined) | |
32 | # define aliasTable_isUndefined(s) ((s) == aliasTable_undefined) | |
33 | # define aliasTable_isEmpty(s) (aliasTable_size(s) == 0) | |
34 | ||
35 | extern int aliasTable_size (/*@sef@*/ aliasTable p_s); | |
36 | # define aliasTable_size(s) (aliasTable_isDefined (s) ? (s)->nelements : 0) | |
37 | ||
38 | /*@iter aliasTable_elements (sef aliasTable t, yield exposed sRef key, yield exposed sRefSet values); @*/ | |
39 | # define aliasTable_elements(t, m_key, m_value) \ | |
40 | { if (aliasTable_isDefined (t)) \ | |
41 | { int m_ind; sRef *m_keys = &((t)->keys[0]); \ | |
42 | sRefSet *m_values = &((t)->values[0]); \ | |
43 | for (m_ind = 0 ; m_ind < (t)->nelements; m_ind++) \ | |
44 | { sRef m_key = *(m_keys++); sRefSet m_value = *(m_values++); | |
45 | ||
46 | # define end_aliasTable_elements }}} | |
47 | ||
48 | extern aliasTable aliasTable_new (void) /*@*/ ; | |
49 | ||
50 | extern void aliasTable_clearAliases (aliasTable p_s, sRef p_sr) | |
51 | /*@modifies p_s, p_sr@*/ ; | |
52 | ||
53 | extern /*@only@*/ sRefSet aliasTable_canAlias (aliasTable p_s, sRef p_sr) /*@*/ ; | |
54 | extern aliasTable aliasTable_copy (aliasTable p_s) /*@*/ ; | |
55 | ||
56 | extern /*@only@*/ cstring aliasTable_unparse (aliasTable p_s) /*@*/ ; | |
57 | extern void aliasTable_free (/*@only@*/ aliasTable p_s) ; | |
58 | ||
59 | extern aliasTable | |
28bf4b0b | 60 | aliasTable_addMustAlias (/*@returned@*/ aliasTable p_s, /*@exposed@*/ sRef p_sr, /*@exposed@*/ sRef p_al) |
885824d3 | 61 | /*@modifies p_s@*/ ; |
62 | ||
63 | extern aliasTable | |
64 | aliasTable_levelUnion (/*@returned@*/ aliasTable p_t1, aliasTable p_t2, int p_level) | |
65 | /*@modifies p_t1@*/ ; | |
66 | ||
67 | extern aliasTable | |
68 | aliasTable_levelUnionNew (aliasTable p_t1, aliasTable p_t2, int p_level) | |
69 | /*@modifies nothing*/ ; | |
70 | ||
71 | extern void aliasTable_checkGlobs (aliasTable p_t) /*@modifies g_msgstream@*/ ; | |
72 | extern /*@only@*/ sRefSet aliasTable_aliasedBy (aliasTable p_s, sRef p_sr) /*@*/ ; | |
73 | extern void aliasTable_fixSrefs (aliasTable p_s); | |
74 | extern aliasTable aliasTable_levelUnionSeq (/*@returned@*/ aliasTable p_t1, | |
75 | /*@only@*/ aliasTable p_t2, int p_level); | |
76 | ||
77 | /*@constant int aliasTableBASESIZE; @*/ | |
78 | # define aliasTableBASESIZE MIDBASESIZE | |
79 | ||
80 | # else | |
81 | # error "Multiple include" | |
82 | # endif | |
83 | ||
84 | ||
85 | ||
86 |