]> andersk Git - splint.git/blob - src/Headers/fileloc.h
Lots of changes. Code is mostly annotated. Still lots of breaken stuff though.
[splint.git] / src / Headers / fileloc.h
1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000.
3 ** See ../LICENSE for license information.
4 **
5 */
6 /*
7 ** fileloc.h
8 */
9
10 # ifndef FILELOC_H
11 # define FILELOC_H
12
13 # include "fileId.h"
14
15 typedef enum 
16
17   FL_NORMAL, FL_SPEC, FL_LIB, FL_STDLIB, FL_STDHDR, FL_IMPORT, FL_BUILTIN,
18   FL_PREPROC, FL_RC, FL_EXTERNAL,
19   FL_POST, FL_SIDE
20 } flkind;
21
22 /*added fl_post and fl_side for use with constraint generation
23   DRL 8/22/2000
24 */
25
26
27 struct __fileloc
28 {
29   flkind  kind;
30   fileId  fid;
31   int     lineno;
32   int     column;
33 } ;
34
35 /* typedef in forwardTypes */
36 typedef /*@only@*/ fileloc o_fileloc;
37
38 extern fileloc fileloc_update (/*@only@*/ fileloc p_old, fileloc p_fnew) 
39    /*@modifies p_old@*/ ;
40
41 extern fileloc fileloc_create (fileId p_fid, int p_line, int p_col) /*@*/ ;
42 extern bool fileloc_isSystemFile (fileloc p_f1) /*@*/ ;
43
44 # ifndef NOLCL
45 extern fileloc fileloc_createSpec (fileId p_fid, int p_line, int p_col) /*@*/ ;
46 # endif
47
48 extern fileloc fileloc_createLib (cstring p_ln) /*@*/ ;
49 extern fileloc fileloc_createRc (cstring p_name) /*@*/ ;
50 extern fileloc fileloc_decColumn (fileloc p_f, int p_x) /*@*/ ;
51 extern void fileloc_subColumn (fileloc p_f, int p_x) /*@modifies p_f@*/ ;
52 extern fileloc fileloc_getBuiltin (void) /*@*/ ;
53 extern /*@observer@*/ fileloc fileloc_observeBuiltin (void) /*@*/ ;
54 extern fileloc fileloc_createBuiltin (void) /*@*/ ;
55
56 # ifndef NOLCL
57 extern fileloc fileloc_createImport (cstring p_fname, int p_lineno) /*@*/ ;
58 # endif
59
60 extern bool fileloc_isSpecialFile (fileloc p_f) /*@*/ ;
61 extern bool fileloc_sameBaseFile (fileloc p_f1, fileloc p_f2) /*@*/ ;
62 extern /*@observer@*/ cstring fileloc_filename (fileloc p_f) /*@*/ ;
63 extern int fileloc_column (fileloc p_f) /*@*/ ;
64 extern /*@only@*/ cstring fileloc_unparse (fileloc p_f) /*@*/ ;
65 extern cstring fileloc_unparseRaw (cstring p_fname, int p_lineno) /*@*/ ;
66 extern cstring fileloc_unparseRawCol (cstring p_fname, int p_lineno, int p_col) /*@*/ ;
67 extern bool fileloc_sameFile (fileloc p_f1, fileloc p_f2) /*@*/ ;
68 extern void fileloc_free (/*@only@*/ fileloc p_f);
69 extern void fileloc_reallyFree (/*@only@*/ fileloc p_f);
70 extern int fileloc_lineno (fileloc p_f) /*@*/ ;
71 extern bool fileloc_equal (fileloc p_f1, fileloc p_f2) /*@*/ ;
72 extern bool fileloc_lessthan (fileloc p_f1, fileloc p_f2) /*@*/ ;
73 extern int fileloc_compare (fileloc p_f1, fileloc p_f2) /*@*/ ;
74 extern /*@observer@*/ cstring fileloc_getBase (fileloc p_f) /*@*/ ;
75 extern bool fileloc_isHeader (fileloc p_f) /*@*/ ;
76 extern bool fileloc_isSpec (fileloc p_f) /*@*/ ;
77 extern bool fileloc_isRealSpec (fileloc p_f) /*@*/ ;
78 extern fileloc fileloc_copy (fileloc p_f) /*@*/ ;
79 extern cstring fileloc_unparseDirect (fileloc p_fl) /*@*/ ;
80 extern bool fileloc_notAfter (fileloc p_f1, fileloc p_f2) /*@*/ ;
81 extern bool fileloc_almostSameFile (fileloc p_f1, fileloc p_f2) /*@*/ ;
82 extern fileloc fileloc_noColumn (fileloc p_f) /*@*/ ;
83 extern /*@observer@*/ fileloc fileloc_getExternal (void) /*@*/ ;
84 extern fileloc fileloc_createExternal (void) /*@*/ ;
85
86 extern bool fileloc_isExternal (/*@sef@*/ fileloc p_f) /*@*/;
87 # define fileloc_isExternal(f) \
88      (fileloc_isDefined(f) && ((f)->kind == FL_EXTERNAL))
89
90 extern /*@falsenull@*/ bool fileloc_isDefined (/*@null@*/ fileloc p_f) /*@*/ ;
91 extern /*@truenull@*/ bool fileloc_isUndefined (/*@null@*/ fileloc p_f) /*@*/ ;
92 extern bool fileloc_isInvalid (/*@sef@*/ /*@null@*/ fileloc p_f) /*@*/ ;
93
94 /*@constant null fileloc fileloc_undefined; @*/
95 # define fileloc_undefined      ((fileloc)0)
96 # define fileloc_isDefined(f)   ((f) != fileloc_undefined)
97 # define fileloc_isUndefined(f) ((f) == fileloc_undefined)
98 # define fileloc_isInvalid(f)   (!(fileloc_isValid(f)))
99
100 extern bool fileloc_isLib (fileloc p_f) /*@*/ ;
101 extern bool fileloc_isRealLib (fileloc p_f) /*@*/ ;
102
103 # ifndef NOLCL
104 extern fileloc fileloc_fromTok (ltoken p_t) /*@*/ ;
105 # endif
106
107 /*@constant int UNKNOWN_LINE; @*/
108 # define UNKNOWN_LINE (0)
109
110 /*@constant int UNKNOWN_COLUMN; @*/
111 # define UNKNOWN_COLUMN (0)
112
113 extern /*@unused@*/ bool fileloc_linenoDefined (/*@sef@*/ fileloc p_f) /*@*/ ;
114 extern /*@unused@*/ bool fileloc_columnDefined (/*@sef@*/ fileloc p_f) /*@*/ ;
115
116 # define fileloc_linenoDefined(f) \
117   (fileloc_isValid (f) && (f)->lineno != UNKNOWN_LINE)
118
119 # define fileloc_columnDefined(f) \
120   (fileloc_isValid (f) && (f)->column != UNKNOWN_COLUMN)
121
122 # ifndef NOLCL
123 extern void fileloc_setColumnUndefined (/*@sef@*/ fileloc p_f) /*@modifies p_f@*/;
124 # define fileloc_setColumnUndefined(f) \
125   (fileloc_isDefined(f) ? (f)->column = UNKNOWN_COLUMN : UNKNOWN_COLUMN)
126 # endif
127
128 extern /*@falsenull@*/ bool fileloc_isValid (/*@sef@*/ fileloc p_f);
129 # define fileloc_isValid(f) \
130   (fileloc_isDefined(f) && ((f)->lineno >= 0))
131
132 extern bool fileloc_isImport (/*@sef@*/ fileloc p_fl);
133 # define fileloc_isImport(fl)  (fileloc_isDefined(fl) && (fl)->kind == FL_IMPORT)
134
135 extern bool fileloc_isPreproc (/*@sef@*/ fileloc p_fl);
136 # define fileloc_isPreproc(fl)  (fileloc_isDefined(fl) && (fl)->kind == FL_PREPROC)
137
138 extern void fileloc_setLineno (/*@sef@*/ fileloc p_f, int p_i) /*@modifies p_f@*/ ;
139 # define fileloc_setLineno(fl, i) \
140       (fileloc_isDefined(fl) ? ((fl)->lineno = (i), (fl)->column = 1) : (i))
141
142 extern void fileloc_nextLine (/*@sef@*/ fileloc p_f) /*@modifies p_f@*/ ;
143 # define fileloc_nextLine(fl) \
144       (fileloc_isDefined(fl) ? ((fl)->lineno++, (fl)->column = 1) : 0)
145
146 extern void fileloc_addLine (/*@sef@*/ fileloc p_f, int p_i) /*@modifies p_f@*/ ;
147 # define fileloc_addLine(fl, i) \
148       (fileloc_isDefined(fl) ? ((fl)->lineno += (i), (fl)->column = 1) : (i))
149
150 extern fileId fileloc_fileId (/*@sef@*/ fileloc p_fl) /*@*/ ;
151 # define fileloc_fileId(fl) \
152       (fileloc_isDefined (fl) ? (fl)->fid : fileId_invalid)
153
154 extern void fileloc_setColumn (/*@sef@*/ fileloc p_fl, int p_i) /*@modifies p_fl@*/ ;
155 # define fileloc_setColumn(fl, i) \
156       (fileloc_isDefined (fl) ? ((fl)->column = (i)) : (i))
157
158 extern void fileloc_addColumn (/*@sef@*/ fileloc p_fl, int p_i) /*@modifies p_fl@*/ ;
159 # define fileloc_addColumn(fl, i) \
160       (fileloc_isDefined (fl) ? ((fl)->column += (i)) : (i))
161
162 extern void fileloc_incColumn (/*@sef@*/ fileloc p_fl) /*@modifies p_fl@*/ ;
163 # define fileloc_incColumn(fl) \
164       (fileloc_isDefined (fl) ? ((fl)->column++) : 0)
165
166 extern bool fileloc_isBuiltin (/*@sef@*/ fileloc p_fl) /*@*/ ;
167 # define fileloc_isBuiltin(fl) \
168    (fileloc_isDefined (fl) && ((fl)->kind == FL_BUILTIN))
169
170 extern fileloc fileloc_updateFileId (/*@only@*/ fileloc p_old, fileId p_s) /*@*/ ;
171 extern fileloc fileloc_makePreproc (fileloc p_loc) /*@*/ ;
172 extern fileloc fileloc_makePreprocPrevious (fileloc p_loc) /*@*/ ;
173
174 # ifndef NOLCL
175 extern bool fileloc_isStandardLibrary (fileloc p_f) /*@*/ ;
176 # endif
177
178 extern bool fileloc_isStandardLib (fileloc p_f) /*@*/ ;
179 extern cstring fileloc_unparseFilename (fileloc p_f) /*@*/ ;
180 extern bool fileloc_withinLines (fileloc p_f1, fileloc p_f2, int p_n) /*@*/ ;
181 extern bool fileloc_isUser (fileloc p_f) /*@*/ ;
182 extern bool fileloc_sameModule (fileloc p_f1, fileloc p_f2) /*@*/ ;
183
184 # else
185 # error "Multiple include"
186 # endif
187
188
189
190
191
192
This page took 0.056532 seconds and 5 git commands to generate.