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