]> andersk Git - splint.git/blob - src/Headers/cstringList.h
c0766463957a12ec2f8a33b9037decf7e63847ee
[splint.git] / src / Headers / cstringList.h
1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
3 ** See ../LICENSE for license information.
4 **
5 */
6 # ifndef cstringList_H
7 # define cstringList_H
8
9 abst_typedef /*@null@*/ struct s_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 /*@falsewhennull@*/ 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@*/ /*@falsewhennull@*/ 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 /*@only@*/ cstringList 
39   cstringList_prepend (/*@only@*/ /*@returned@*/ cstringList p_s,
40                        /*@keep@*/ cstring p_el) 
41   /*@modifies p_s@*/ ;
42
43 extern bool cstringList_contains (cstringList p_s, cstring p_key) /*@*/ ;
44 extern int cstringList_getIndex (cstringList p_s, cstring p_key) /*@*/ ;
45 extern /*@observer@*/ cstring cstringList_get (cstringList p_s, int p_index) /*@*/ ;
46
47 extern /*@unused@*/ void cstringList_alphabetize (cstringList p_s);
48 extern /*@unused@*/ /*@only@*/ cstring cstringList_unparseAbbrev (cstringList p_s) /*@*/ ;
49 extern /*@unused@*/ /*@only@*/ cstring cstringList_unparse (cstringList p_s) ;
50 extern void cstringList_free (/*@only@*/ cstringList p_s) ;
51
52 extern /*@unused@*/ void cstringList_printSpaced (cstringList p_s, size_t p_indent, size_t p_gap, int p_linelen);
53
54 extern /*@only@*/ cstringList cstringList_copy (cstringList p_s) /*@*/ ;
55
56 /*@constant int cstringListBASESIZE;@*/
57 # define cstringListBASESIZE MIDBASESIZE
58
59 /*@iter cstringList_elements (sef cstringList x, yield exposed cstring el); @*/
60 # define cstringList_elements(x, m_el) \
61    { if (cstringList_isDefined (x)) { \
62        int m_ind; cstring *m_elements = &((x)->elements[0]); \
63          for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \
64            { cstring m_el = *(m_elements++); 
65
66 # define end_cstringList_elements }}}
67
68 # else
69 # error "Multiple include"
70 # endif
71
72
73
74
This page took 0.02909 seconds and 3 git commands to generate.