]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. | |
3 | ** See ../LICENSE for license information. | |
4 | ** | |
5 | */ | |
6 | # ifndef LTOKENLIST_H | |
7 | # define LTOKENLIST_H | |
8 | ||
9 | abst_typedef /*@null@*/ struct | |
10 | { | |
11 | int nelements; | |
12 | int nspace; | |
13 | int current; | |
14 | /*@reldef@*/ /*@relnull@*/ o_ltoken *elements; | |
15 | } *ltokenList ; | |
16 | ||
17 | /*@iter ltokenList_elements (sef ltokenList x, yield exposed ltoken el); @*/ | |
18 | # define ltokenList_elements(x, m_el) \ | |
19 | { if (ltokenList_isDefined(x)) { \ | |
20 | int m_ind; ltoken *m_elements = &((x)->elements[0]); \ | |
21 | for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ | |
22 | { ltoken m_el; m_el = *m_elements; m_elements++; | |
23 | ||
24 | # define end_ltokenList_elements }}} | |
25 | ||
26 | /* | |
27 | ** ltokenList_elements is split up to avoid compiler bugs | |
28 | ** and incompatibilities in older C compilers. This has caused problems | |
29 | ** on both RS/AIX and SGI IRIX machines. | |
30 | */ | |
31 | ||
32 | /*@constant null ltokenList ltokenList_undefined;@*/ | |
33 | # define ltokenList_undefined NULL | |
34 | ||
35 | extern /*@falsewhennull@*/ bool ltokenList_isDefined (ltokenList p_s) /*@*/ ; | |
36 | # define ltokenList_isDefined(s) ((s) != ltokenList_undefined) | |
37 | ||
38 | extern /*@nullwhentrue@*/ bool ltokenList_isUndefined (ltokenList p_s) /*@*/ ; | |
39 | # define ltokenList_isUndefined(s) ((s) == ltokenList_undefined) | |
40 | ||
41 | extern int ltokenList_size (/*@sef@*/ ltokenList p_s) /*@*/ ; | |
42 | extern bool ltokenList_empty (/*@sef@*/ ltokenList p_s) /*@*/ ; | |
43 | extern /*@unused@*/ bool ltokenList_isEmpty (/*@sef@*/ ltokenList p_s) /*@*/ ; | |
44 | ||
45 | # define ltokenList_size(s) (ltokenList_isUndefined(s) ? 0 : (s)->nelements) | |
46 | # define ltokenList_empty(s) (ltokenList_isUndefined(s) || ltokenList_size(s) == 0) | |
47 | # define ltokenList_isEmpty(s) (ltokenList_empty(s)) | |
48 | ||
49 | extern /*@only@*/ /*@notnull@*/ ltokenList ltokenList_new (void) /*@*/ ; | |
50 | extern void ltokenList_addh (ltokenList p_s, /*@only@*/ ltoken p_el) /*@modifies p_s@*/ ; | |
51 | ||
52 | extern void ltokenList_reset (ltokenList p_s) /*@modifies p_s@*/ ; | |
53 | extern void ltokenList_advance (ltokenList p_s) /*@modifies p_s@*/ ; | |
54 | ||
55 | extern /*@only@*/ cstring ltokenList_unparse (ltokenList p_s) /*@*/ ; | |
56 | extern void ltokenList_free (/*@only@*/ ltokenList p_s) ; | |
57 | ||
58 | extern /*@observer@*/ ltoken ltokenList_head (ltokenList p_s) /*@*/ ; | |
59 | extern /*@observer@*/ ltoken ltokenList_current (ltokenList p_s) /*@*/ ; | |
60 | ||
61 | extern /*@only@*/ ltokenList ltokenList_copy (ltokenList p_s) /*@*/ ; | |
62 | extern /*@only@*/ /*@notnull@*/ ltokenList ltokenList_singleton (/*@only@*/ ltoken p_l); | |
63 | extern ltokenList ltokenList_push (/*@returned@*/ ltokenList p_s, /*@only@*/ ltoken p_el); | |
64 | extern bool ltokenList_equal (ltokenList p_s1, ltokenList p_s2) /*@*/ ; | |
65 | extern bool ltokenList_isFinished (ltokenList p_s) /*@*/ ; | |
66 | extern void ltokenList_removeCurrent (ltokenList p_s) /*@modifies p_s@*/ ; | |
67 | ||
68 | /*@constant int ltokenListBASESIZE;@*/ | |
69 | # define ltokenListBASESIZE SMALLBASESIZE | |
70 | ||
71 | # else | |
72 | # error "Multiple include" | |
73 | # endif | |
74 | ||
75 | ||
76 | ||
77 |