]> andersk Git - splint.git/blame - src/Headers/fileTable.h
Fixes after removing -unrecogcomments flag for make splintme.
[splint.git] / src / Headers / fileTable.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** fileTable.h
8*/
9
10# ifndef FILETABLE_H
11# define FILETABLE_H
12
13/*@constant int FTBASESIZE; @*/
14# define FTBASESIZE 64
15
16/* moved to fileloc.h
17** typedef int fileId;
18*/
19
20typedef enum { FILE_NORMAL, FILE_LSLTEMP, FILE_NODELETE,
28bf4b0b 21 FILE_HEADER, FILE_XH, FILE_MACROS, FILE_METASTATE } fileType;
885824d3 22
517a2db3 23/*:private:*/ typedef struct
885824d3 24{
25 bool ftemp BOOLBITS;
26 bool fsystem BOOLBITS;
27 bool fspecial BOOLBITS;
6fcd0b1e 28 /*@only@*/ cstring fname;
885824d3 29 cstring basename;
30 fileType ftype;
31 fileId fder;
32} *ftentry;
33
34typedef /*@only@*/ ftentry o_ftentry;
35
dfd82dce 36typedef /*@only@*/ struct {
abd7f895 37 /*@null@*/ /*@dependent@*/ /*@exposed@*/ FILE *f;
dfd82dce 38 /*@only@*/ cstring fname;
39} *foentry;
40
28bf4b0b 41abst_typedef /*@null@*/ struct
885824d3 42{
43 int nentries;
44 int nspace;
28bf4b0b 45 cstringTable htable;
885824d3 46 /*@reldef@*/ /*@only@*/ o_ftentry *elements;
dfd82dce 47
48 /*
49 ** Keep track of all the open files, so we can close them on error exits.
50 */
51
52 int nopen;
53 int nopenspace;
6fcd0b1e 54 /*@reldef@*/ /*@only@*/ foentry *openelements; /* evans 2002-07-12: removed reldef */
885824d3 55} *fileTable ;
56
57/*@constant null fileTable fileTable_undefined; @*/
58# define fileTable_undefined ((fileTable) NULL)
59
0e41eb0e 60extern /*@unused@*/ /*@nullwhentrue@*/ bool
885824d3 61 fileTable_isUndefined (/*@null@*/ fileTable p_f) /*@*/ ;
0e41eb0e 62extern /*@unused@*/ /*@falsewhennull@*/ bool
885824d3 63 fileTable_isDefined (/*@null@*/ fileTable p_f) /*@*/ ;
64
65# define fileTable_isUndefined(ft) ((ft) == fileTable_undefined)
66# define fileTable_isDefined(ft) ((ft) != fileTable_undefined)
67extern /*@observer@*/ cstring fileTable_getName (fileTable p_ft, fileId p_fid) /*@*/ ;
68extern /*@observer@*/ cstring fileTable_getNameBase (fileTable p_ft, fileId p_fid) ;
69extern fileId fileTable_addFile (fileTable p_ft, cstring p_name)
70 /*@modifies p_ft@*/ ;
80489f0a 71
72extern void fileTable_addStreamFile (fileTable p_ft, /*@dependent@*/ FILE *p_fstream,
73 cstring p_name)
74 /*@modifies p_ft@*/ ;
75
885824d3 76extern fileId fileTable_addHeaderFile (fileTable p_ft, cstring p_name)
77 /*@modifies p_ft@*/ ;
28bf4b0b 78extern fileId fileTable_addXHFile (fileTable p_ft, cstring p_name)
79 /*@modifies p_ft@*/ ;
885824d3 80extern fileId fileTable_addLibraryFile (fileTable p_ft, cstring p_name)
81 /*@modifies p_ft@*/ ;
82
885824d3 83extern fileId fileTable_addLCLFile (fileTable p_ft, cstring p_name)
84 /*@modifies p_ft@*/ ;
85
86extern fileId fileTable_addltemp (fileTable p_ft);
87
885824d3 88extern /*@notnull@*/ /*@only@*/ fileTable fileTable_create (void) /*@*/ ;
89extern fileId fileTable_lookup (fileTable p_ft, cstring p_s) /*@*/ ;
90extern fileId fileTable_addCTempFile (fileTable p_ft, fileId p_fid)
91 /*@modifies p_ft@*/ ;
92extern fileId fileTable_addFileOnly (fileTable p_ft, /*@only@*/ cstring p_name)
93 /*@modifies p_ft@*/ ;
94
885824d3 95extern fileId fileTable_addImportFile (fileTable p_ft, cstring p_name)
96 /*@modifies p_ft@*/ ;
885824d3 97
98extern fileId fileTable_addMacrosFile (fileTable p_ft)
99 /*@modifies p_ft@*/ ;
28bf4b0b 100
101extern fileId fileTable_addMetastateFile (fileTable p_ft, cstring p_name)
102 /*@modifies p_ft@*/ ;
103
104extern void fileTable_setFilePath (fileTable p_ft, fileId p_fid, cstring p_path)
105 /*@modifies p_ft@*/ ;
106
885824d3 107extern /*@observer@*/ cstring fileTable_getRootName (fileTable p_ft, fileId p_fid) /*@*/ ;
108extern bool fileTable_isHeader (fileTable p_ft, fileId p_fid) /*@*/ ;
109extern bool fileId_isHeader (fileId p_f) /*@*/ ;
110# define fileId_isHeader(f) (fileTable_isHeader (context_fileTable(), f))
111
112extern bool fileTable_sameBase (fileTable p_ft, fileId p_f1, fileId p_f2);
113extern void fileTable_cleanup (fileTable p_ft) /*@modifies fileSystem@*/;
114extern fileId fileTable_lookupBase (fileTable p_ft, cstring p_base) /*@modifies p_ft@*/ ;
80489f0a 115extern void fileTable_printTemps (fileTable p_ft) /*@modifies g_warningstream@*/ ;
885824d3 116extern /*@unused@*/ /*@only@*/ cstring fileTable_unparse (fileTable p_ft) /*@*/ ;
117extern bool fileTable_exists (fileTable p_ft, cstring p_s) /*@*/ ;
118extern void fileTable_free (/*@only@*/ fileTable p_f);
119extern bool fileTable_isSpecialFile (fileTable p_ft, fileId p_fid) /*@*/ ;
120extern bool fileTable_isSystemFile (fileTable p_ft, fileId p_fid) /*@*/ ;
28bf4b0b 121extern bool fileTable_isXHFile (fileTable p_ft, fileId p_fid) /*@*/ ;
885824d3 122
4dd72714 123extern /*@observer@*/ cstring fileTable_fileName (fileId p_fid) /*@*/ ;
124extern /*@observer@*/ cstring fileTable_fileNameBase (fileId p_fid) /*@*/ ;
125extern /*@observer@*/ cstring fileTable_rootFileName (fileId p_fid) /*@*/ ;
126
d5047b91 127extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *fileTable_createFile (fileTable p_ft, cstring p_fname)
128 /*@modifies p_ft, fileSystem@*/ ;
129
130extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *fileTable_createMacrosFile (fileTable p_ft, cstring p_fname)
131 /*@modifies p_ft, fileSystem@*/ ;
132
4dd72714 133# define fileTable_fileName(fid) (fileTable_getName(context_fileTable(), fid))
134# define fileTable_fileNameBase(fid) (fileTable_getNameBase(context_fileTable(), fid))
135# define fileTable_rootFileName(fid) (fileTable_getRootName(context_fileTable(), fid))
885824d3 136
137extern void fileTable_noDelete (fileTable, cstring);
138extern bool fileId_baseEqual (/*@sef@*/ fileId p_t1, /*@sef@*/ fileId p_t2) /*@*/ ;
139# define fileId_baseEqual(t1,t2) \
140 (fileId_equal (t1, t2) || fileTable_sameBase (context_fileTable (), t1, t2))
141
d5047b91 142extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *
143fileTable_openReadFile (fileTable p_ft, cstring p_fname)
144 /*@modifies p_ft@*/ ;
145
146extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *
147fileTable_openWriteFile (fileTable p_ft, cstring p_fname)
148 /*@modifies p_ft@*/ ;
dfd82dce 149
150extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *
d5047b91 151fileTable_openWriteUpdateFile (fileTable p_ft, cstring p_fname)
dfd82dce 152 /*@modifies p_ft@*/ ;
153
154extern bool fileTable_closeFile (fileTable p_ft, FILE *p_f)
155 /*@ensures closed p_f@*/
156 /*@modifies p_ft, p_f@*/ ;
157
158extern void fileTable_closeAll (fileTable p_ft)
159 /*@modifies p_ft@*/ ;
160
885824d3 161# else
162# error "Multiple include"
163#endif
164
This page took 0.090827 seconds and 5 git commands to generate.