]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. | |
3 | ** See ../LICENSE for license information. | |
4 | ** | |
5 | */ | |
6 | # ifndef cstringList_H | |
7 | # define cstringList_H | |
8 | ||
9 | abst_typedef /*@null@*/ struct _cstringList | |
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 | ||
19 | extern /*@falsenull@*/ bool cstringList_isDefined (cstringList p_s) /*@*/ ; | |
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 | ||
25 | extern /*@unused@*/ /*@falsenull@*/ bool cstringList_empty (/*@sef@*/ cstringList) /*@*/ ; | |
26 | # define cstringList_empty(s) (cstringList_size(s) == 0) | |
27 | ||
28 | extern cstring cstringList_unparseSep (cstringList p_s, cstring p_sep) /*@*/ ; | |
29 | ||
30 | extern /*@unused@*/ /*@only@*/ cstringList cstringList_new (void) /*@*/ ; | |
31 | ||
32 | extern /*@only@*/ cstringList cstringList_single (/*@keep@*/ cstring p_el) /*@*/ ; | |
33 | ||
34 | extern cstringList | |
35 | cstringList_add (/*@returned@*/ cstringList p_s, /*@keep@*/ cstring p_el) | |
36 | /*@modifies p_s@*/ ; | |
37 | ||
38 | extern /*@unused@*/ void cstringList_alphabetize (cstringList p_s); | |
39 | extern /*@unused@*/ /*@only@*/ cstring cstringList_unparseAbbrev (cstringList p_s) /*@*/ ; | |
40 | extern /*@unused@*/ /*@only@*/ cstring cstringList_unparse (cstringList p_s) ; | |
41 | extern void cstringList_free (/*@only@*/ cstringList p_s) ; | |
42 | ||
43 | extern /*@unused@*/ void cstringList_printSpaced (cstringList p_s, int p_indent, int p_gap, int p_linelen); | |
44 | ||
45 | /*@constant int cstringListBASESIZE;@*/ | |
46 | # define cstringListBASESIZE MIDBASESIZE | |
47 | ||
48 | /*@iter cstringList_elements (sef cstringList x, yield exposed cstring el); @*/ | |
49 | # define cstringList_elements(x, m_el) \ | |
50 | { if (cstringList_isDefined (x)) { \ | |
51 | int m_ind; cstring *m_elements = &((x)->elements[0]); \ | |
52 | for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ | |
53 | { cstring m_el = *(m_elements++); | |
54 | ||
55 | # define end_cstringList_elements }}} | |
56 | ||
57 | # else | |
58 | # error "Multiple include" | |
59 | # endif | |
60 | ||
61 | ||
62 | ||
63 |