]>
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 | # ifndef cstringList_H | |
7 | # define cstringList_H | |
8 | ||
28bf4b0b | 9 | abst_typedef /*@null@*/ struct s_cstringList |
885824d3 | 10 | { |
11 | int nelements; | |
12 | int nspace; | |
13 | /*@reldef@*/ /*@relnull@*/ o_cstring *elements; | |
14 | } *cstringList ; | |
15 | ||
16 | /*@constant null cstringList cstringList_undefined;@*/ | |
17 | # define cstringList_undefined ((cstringList) NULL) | |
18 | ||
0e41eb0e | 19 | extern /*@falsewhennull@*/ bool cstringList_isDefined (cstringList p_s) /*@*/ ; |
885824d3 | 20 | # define cstringList_isDefined(s) ((s) != cstringList_undefined) |
21 | ||
22 | extern int cstringList_size (/*@sef@*/ cstringList) /*@*/ ; | |
23 | # define cstringList_size(s) (cstringList_isDefined (s) ? (s)->nelements : 0) | |
24 | ||
0e41eb0e | 25 | extern /*@unused@*/ /*@falsewhennull@*/ bool cstringList_empty (/*@sef@*/ cstringList) /*@*/ ; |
885824d3 | 26 | # define cstringList_empty(s) (cstringList_size(s) == 0) |
27 | ||
28 | extern cstring cstringList_unparseSep (cstringList p_s, cstring p_sep) /*@*/ ; | |
29 | ||
b73d1009 | 30 | extern /*@exposed@*/ /*@null@*/ ob_cstring *cstringList_getElements (cstringList) /*@*/ ; |
140c27a8 | 31 | |
885824d3 | 32 | extern /*@unused@*/ /*@only@*/ cstringList cstringList_new (void) /*@*/ ; |
33 | ||
34 | extern /*@only@*/ cstringList cstringList_single (/*@keep@*/ cstring p_el) /*@*/ ; | |
35 | ||
36 | extern cstringList | |
37 | cstringList_add (/*@returned@*/ cstringList p_s, /*@keep@*/ cstring p_el) | |
38 | /*@modifies p_s@*/ ; | |
39 | ||
28bf4b0b | 40 | extern /*@only@*/ cstringList |
41 | cstringList_prepend (/*@only@*/ /*@returned@*/ cstringList p_s, | |
42 | /*@keep@*/ cstring p_el) | |
43 | /*@modifies p_s@*/ ; | |
44 | ||
45 | extern bool cstringList_contains (cstringList p_s, cstring p_key) /*@*/ ; | |
46 | extern int cstringList_getIndex (cstringList p_s, cstring p_key) /*@*/ ; | |
47 | extern /*@observer@*/ cstring cstringList_get (cstringList p_s, int p_index) /*@*/ ; | |
48 | ||
885824d3 | 49 | extern /*@unused@*/ void cstringList_alphabetize (cstringList p_s); |
50 | extern /*@unused@*/ /*@only@*/ cstring cstringList_unparseAbbrev (cstringList p_s) /*@*/ ; | |
51 | extern /*@unused@*/ /*@only@*/ cstring cstringList_unparse (cstringList p_s) ; | |
52 | extern void cstringList_free (/*@only@*/ cstringList p_s) ; | |
53 | ||
abd7f895 | 54 | extern /*@unused@*/ void cstringList_printSpaced (cstringList p_s, size_t p_indent, size_t p_gap, int p_linelen); |
885824d3 | 55 | |
28bf4b0b | 56 | extern /*@only@*/ cstringList cstringList_copy (cstringList p_s) /*@*/ ; |
57 | ||
885824d3 | 58 | /*@constant int cstringListBASESIZE;@*/ |
59 | # define cstringListBASESIZE MIDBASESIZE | |
60 | ||
61 | /*@iter cstringList_elements (sef cstringList x, yield exposed cstring el); @*/ | |
62 | # define cstringList_elements(x, m_el) \ | |
63 | { if (cstringList_isDefined (x)) { \ | |
64 | int m_ind; cstring *m_elements = &((x)->elements[0]); \ | |
65 | for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ | |
66 | { cstring m_el = *(m_elements++); | |
67 | ||
68 | # define end_cstringList_elements }}} | |
69 | ||
70 | # else | |
71 | # error "Multiple include" | |
72 | # endif | |
73 | ||
74 | ||
75 | ||
76 |