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