]>
Commit | Line | Data |
---|---|---|
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 | ** context.h | |
8 | */ | |
9 | ||
10 | # ifndef CONTEXT_H | |
11 | # define CONTEXT_H | |
12 | ||
13 | extern void context_pushLoc (void); | |
14 | extern void context_popLoc (void); | |
15 | ||
16 | extern bool context_doMerge (void); | |
17 | extern bool context_doDump (void); | |
18 | ||
19 | extern void context_resetAllFlags (void); | |
20 | ||
21 | extern /*@unused@*/ cstring context_unparseFlagMarkers (void) /*@*/ ; | |
22 | ||
23 | extern void context_enterDoWhileClause (void) /*@modifies internalState@*/ ; | |
24 | ||
25 | extern bool context_hasMods (void); | |
26 | ||
27 | extern bool context_isSystemDir (cstring p_dir) /*@*/ ; | |
28 | ||
28bf4b0b | 29 | extern /*@observer@*/ cstring context_selectedLibrary (void) /*@*/ ; |
885824d3 | 30 | extern bool context_usingPosixLibrary (void) /*@*/ ; |
31 | extern bool context_usingAnsiLibrary (void) /*@*/ ; | |
32 | extern flagcode context_getLibrary (void) /*@*/ ; | |
33 | extern void context_setLibrary (flagcode) /*@modifies internalState@*/ ; | |
34 | ||
35 | extern void context_setPreprocessing (void) /*@modifies internalState@*/; | |
36 | extern void context_clearPreprocessing (void) /*@modifies internalState@*/; | |
37 | extern bool context_isPreprocessing (void) /*@*/; | |
990ec868 | 38 | extern bool context_loadingLibrary (void) /*@*/ ; |
885824d3 | 39 | |
40 | extern void context_setInCommandLine (void) /*@modifies internalState@*/ ; | |
41 | extern void context_clearInCommandLine (void) /*@modifies internalState@*/ ; | |
b7e84605 | 42 | |
43 | extern void context_checkGlobalScope (void) /*@modifies internalState@*/ ; | |
44 | ||
885824d3 | 45 | extern bool context_isInCommandLine (void) /*@*/ ; |
28bf4b0b | 46 | extern bool context_inXHFile (void) /*@*/ ; |
885824d3 | 47 | |
48 | extern void context_resetErrors (void); | |
49 | ||
50 | extern int context_getLinesProcessed (void) /*@*/ ; | |
51 | extern int context_getSpecLinesProcessed (void) /*@*/ ; | |
52 | ||
53 | extern bool context_setBoolName (void) /*@*/ ; | |
54 | extern /*@observer@*/ cstring context_getBoolName (void) /*@*/ ; | |
55 | extern /*@observer@*/ cstring context_printBoolName (void) /*@*/ ; | |
56 | extern /*@observer@*/ cstring context_getFalseName (void) /*@*/ ; | |
57 | extern /*@observer@*/ cstring context_getTrueName (void) /*@*/ ; | |
58 | extern /*@observer@*/ cstring context_getLarchPath (void) /*@*/ ; | |
59 | extern /*@observer@*/ cstring context_getLCLImportDir (void) /*@*/ ; | |
60 | ||
61 | extern bool context_checkExport (uentry p_e) /*@*/ ; | |
62 | extern bool context_checkGlobMod (sRef p_el) /*@*/ ; | |
63 | extern bool context_checkGlobUse (uentry p_glob); | |
64 | extern bool context_checkAliasGlob (uentry p_glob); | |
65 | extern bool context_checkInternalUse (void); | |
66 | extern void context_recordFileModifies (/*@dependent@*/ sRefSet p_mods); | |
67 | extern void context_clearJustPopped (void); | |
68 | extern bool context_justPopped (void); | |
69 | ||
70 | extern void context_enterTrueClause (exprNode p_e); | |
71 | extern void context_enterFalseClause (exprNode p_e); | |
72 | extern void context_exitClause (exprNode p_pred, | |
73 | exprNode p_tbranch, exprNode p_fbranch); | |
74 | extern void context_exitInnerSafe (void); | |
75 | extern void context_exitInnerPlain (void) /*@modifies internalState@*/ ; | |
76 | ||
77 | extern bool context_inGlobalScope (void); | |
78 | extern bool context_inInnerScope (void); | |
79 | extern void context_setProtectVars (void); | |
80 | ||
81 | extern int context_getLimit (void) /*@*/ ; | |
82 | extern bool context_unlimitedMessages (void) /*@*/ ; | |
83 | ||
84 | extern void context_releaseVars (void); | |
85 | extern void context_sizeofReleaseVars (void); | |
86 | extern bool context_inProtectVars (void); | |
87 | ||
88 | extern bool context_hasFileAccess (typeId p_t); | |
89 | ||
90 | extern void context_hideShowscan (void); | |
91 | extern void context_unhideShowscan (void); | |
92 | ||
93 | extern void context_setMode (cstring p_s); | |
982cc10b | 94 | extern void context_setModeNoWarn (cstring p_s); |
885824d3 | 95 | extern void context_exitAllClauses (void); |
28bf4b0b | 96 | extern void context_exitAllClausesQuiet (void); |
885824d3 | 97 | extern bool context_inHeader (void); |
98 | ||
99 | extern /*@dependent@*/ /*@exposed@*/ fileTable context_fileTable (void) /*@*/ ; | |
100 | ||
101 | extern /*@exposed@*/ messageLog context_messageLog (void); | |
102 | extern /*@dependent@*/ /*@observer@*/ cstring context_tmpdir (void); | |
103 | ||
28bf4b0b | 104 | extern void context_enterMTfile (void) /*@modifies internalState@*/ ; |
105 | extern void context_exitMTfile (void) /*@modifies internalState@*/ ; | |
106 | ||
885824d3 | 107 | # ifndef NOLCL |
108 | extern void context_enterLCLfile (void); | |
109 | extern void context_exitLCLfile (void); | |
110 | extern void context_enterImport (void) ; | |
111 | extern void context_leaveImport (void) ; | |
112 | extern void context_processedSpecLine (void) /*@modifies internalState@*/ ; | |
113 | extern int context_getLCLExpect (void) /*@*/ ; | |
114 | extern bool context_msgLh (void) /*@*/ ; | |
115 | extern bool context_inLCLLib (void) /*@globals internalState@*/ ; | |
116 | extern bool context_inImport (void) /*@globals internalState@*/ ; | |
117 | extern void context_resetSpecLines (void) /*@modifies internalState@*/ ; | |
118 | # endif | |
119 | ||
120 | extern void context_exitMacroCache (void); | |
121 | extern void context_enterSuppressRegion (void); | |
122 | extern void context_exitSuppressRegion (void); | |
123 | extern void context_enterMacroFile (void); | |
124 | extern typeIdSet context_fileAccessTypes (void); | |
125 | extern void context_addFileAccessType (typeId p_t); | |
126 | extern void context_removeFileAccessType (typeId p_t); | |
127 | extern /*@observer@*/ uentryList context_getParams (void); | |
128 | ||
129 | extern bool context_isSpecialFile (cstring p_fname); | |
130 | extern /*@observer@*/ cstring context_inFunctionName (void) /*@*/ ; | |
131 | extern ctype context_currentFunctionType (void) /*@*/ ; | |
28bf4b0b | 132 | extern void context_exitCFile (void); |
885824d3 | 133 | extern void context_enterConstantMacro (/*@dependent@*/ /*@exposed@*/ uentry p_e); |
134 | extern void context_enterMacro (/*@observer@*/ uentry p_e); | |
135 | extern void context_enterFunction (/*@exposed@*/ uentry p_e); | |
136 | extern void context_exitFunction (void); | |
137 | extern void context_initMod (void) /*@modifies internalState@*/ ; | |
138 | extern void context_enterInnerContext(void); | |
139 | extern void context_exitInner (exprNode p_exp); | |
140 | extern bool context_globAccess (sRef p_s); | |
141 | extern /*@observer@*/ globSet context_getUsedGlobs (void); | |
142 | extern bool context_hasAccess (typeId p_t); | |
143 | extern bool context_couldHaveAccess (typeId p_t); | |
b7e84605 | 144 | extern /*@only@*/ cstring context_unparse (void) /*@*/ ; |
885824d3 | 145 | extern void context_setFunctionDefined (fileloc p_loc); |
146 | extern void context_setFlagTemp (flagcode p_f, bool p_b); | |
147 | ||
a0a162cd | 148 | extern /*@unused@*/ void context_showFilelocStack (void) ; |
149 | ||
885824d3 | 150 | extern bool context_getFlag (flagcode p_d) /*@*/ ; |
28bf4b0b | 151 | extern bool context_flagOn (flagcode p_f, fileloc p_loc) /*@*/ ; |
152 | ||
885824d3 | 153 | extern int context_getLineLen (void) /*@*/ ; |
154 | # define context_getLineLen() ((int)context_getValue(FLG_LINELEN)) | |
155 | ||
28bf4b0b | 156 | extern int context_getIndentSpaces (void) /*@*/ ; |
157 | # define context_getIndentSpaces() ((int)context_getValue(FLG_INDENTSPACES)) | |
158 | ||
885824d3 | 159 | extern int context_getValue (flagcode p_flag) /*@*/ ; |
160 | extern void context_setValueAndFlag (flagcode p_flag, int p_val) | |
161 | /*@modifies internalState@*/ ; | |
162 | ||
163 | extern /*@unused@*/ int context_getCounter (flagcode p_flag) /*@*/ ; | |
164 | extern /*@unused@*/ void context_incCounter (flagcode p_flag) | |
165 | /*@modifies internalState@*/ ; | |
166 | extern /*@unused@*/ void context_decCounter (flagcode p_flag) | |
167 | /*@modifies internalState@*/ ; | |
168 | ||
169 | extern bool context_maybeSet (flagcode p_d) /*@*/ ; | |
170 | ||
171 | extern /*@observer@*/ cstring context_getString (flagcode p_flag) /*@*/ ; | |
172 | extern void context_setString (flagcode p_flag, /*@only@*/ cstring p_val) | |
173 | /*@modifies internalState@*/ ; | |
174 | ||
175 | extern bool context_getDebug (flagcode p_d); | |
176 | # define context_getDebug(p_d) context_getFlag(p_d) | |
177 | ||
178 | extern void context_userSetFlag (flagcode p_f, bool p_b); | |
179 | ||
180 | extern int context_getExpect (void) /*@*/ ; | |
181 | ||
182 | extern /*@observer@*/ sRefSet context_modList(void); | |
183 | extern /*@exposed@*/ uentry context_getHeader(void) /*@*/; | |
28bf4b0b | 184 | extern void context_usedGlobal (/*@exposed@*/ sRef p_el); |
885824d3 | 185 | extern void context_resetModeFlags (void); |
186 | extern ctype context_typeofZero (void); | |
187 | extern ctype context_typeofOne (void); | |
188 | extern void context_enterFile (void); | |
189 | extern void context_enterUnknownMacro (/*@dependent@*/ /*@observer@*/ uentry p_e); | |
190 | extern char context_getCommentMarkerChar (void); | |
191 | extern void context_setCommentMarkerChar (char p_c); | |
192 | extern bool context_inMacroConstant (void) /*@*/ ; | |
193 | extern void context_returnFunction (void); | |
194 | extern bool context_processingMacros (void); | |
195 | ||
196 | extern void context_saveLocation (void); | |
197 | extern /*@only@*/ fileloc context_getSaveLocation (void); | |
198 | ||
199 | extern void context_setFileId (fileId p_s); | |
200 | extern void context_setFilename(fileId p_fid, int p_lineno) | |
201 | /*@globals fileloc g_currentloc; @*/ | |
202 | /*@modifies g_currentloc@*/ ; | |
203 | ||
204 | extern void context_fileSetFlag (flagcode p_f, ynm p_set); | |
205 | ||
206 | extern /*@unused@*/ /*@only@*/ cstring context_unparseAccess (void) /*@*/ ; | |
207 | extern bool context_inFunction(void) /*@*/ ; | |
208 | extern bool context_inFunctionLike (void) /*@*/ ; | |
209 | ||
210 | extern void context_setMacroMissingParams (void); | |
211 | extern void context_resetMacroMissingParams (void); | |
212 | extern bool context_isMacroMissingParams (void) /*@*/ ; | |
b7e84605 | 213 | extern bool context_inUnknownMacro (void) /*@*/ ; |
885824d3 | 214 | |
215 | /*@observer@*/ cstring context_getDump (void) /*@*/ ; | |
216 | /*@observer@*/ cstring context_getMerge (void) /*@*/ ; | |
217 | ||
218 | extern void context_incLineno (void); | |
219 | extern bool context_inSuppressRegion (void) /*@*/ ; | |
220 | extern void context_exitTrueClause (exprNode p_pred, exprNode p_tbranch); | |
221 | extern void context_destroyMod (void) /*@modifies internalState@*/ ; | |
222 | extern void context_addMacroCache (/*@only@*/ cstring p_def); | |
223 | extern void context_processAllMacros (void); | |
224 | extern void context_addComment (/*@only@*/ cstring p_def); | |
225 | extern void context_enterSuppressLine (int p_count); | |
226 | extern bool context_inSuppressZone (fileloc p_fl) /*@*/ ; | |
227 | extern void context_dumpModuleAccess (FILE *p_fout); | |
228 | extern void context_loadModuleAccess (FILE *p_in); | |
229 | extern bool context_inIterDef (void) /*@*/ ; | |
230 | extern bool context_inMacro (void) /*@*/ ; | |
231 | extern bool context_inIterEnd (void) /*@*/ ; | |
232 | extern ctype context_getRetType (void) /*@*/ ; | |
233 | ||
234 | extern void context_enterIterDef (/*@observer@*/ uentry p_le); | |
235 | extern void context_enterIterEnd (/*@observer@*/ uentry p_le); | |
236 | extern void context_addBoolAccess (void); | |
237 | extern bool context_canAccessBool (void); | |
238 | extern void context_quietExitFunction (void); | |
239 | ||
240 | /* speedy shortcuts for frequently used flags */ | |
241 | ||
242 | extern bool context_msgBoolInt (void) /*@*/ ; | |
243 | extern bool context_msgCharInt (void) /*@*/ ; | |
244 | extern bool context_msgEnumInt (void) /*@*/ ; | |
245 | extern bool context_msgPointerArith (void) /*@*/ ; | |
246 | extern bool context_msgStrictOps (void) /*@*/ ; | |
247 | ||
248 | extern void context_exitStructInnerContext (void); | |
249 | extern void context_enterStructInnerContext (void); | |
250 | extern bool context_inRealFunction (void) /*@*/ ; | |
251 | extern void context_exitOrClause (exprNode p_pred, exprNode p_tbranch); | |
252 | extern void context_exitAndClause (exprNode p_pred, exprNode p_tbranch); | |
253 | extern void context_enterOrClause (exprNode p_e); | |
254 | extern void context_enterAndClause (exprNode p_e); | |
255 | ||
256 | extern void context_enterForClause (exprNode p_e); | |
257 | extern void context_enterWhileClause (exprNode p_e); | |
258 | ||
259 | extern void context_enterIterClause (void); | |
260 | extern void context_exitIterClause (exprNode p_body); | |
261 | ||
262 | extern void context_exitWhileClause (exprNode p_pred, exprNode p_body); | |
263 | extern void context_exitDoWhileClause (exprNode p_pred); | |
264 | extern void context_exitForClause (exprNode p_forPred, exprNode p_body); | |
265 | ||
266 | extern /*@only@*/ cstring context_unparseClauses (void) /*@*/ ; | |
267 | extern /*@observer@*/ globSet context_getGlobs (void) /*@*/ ; | |
268 | ||
269 | extern /*@only@*/ cstring context_getMessageAnnote (void); | |
270 | extern void context_clearMessageAnnote (void); | |
271 | extern bool context_hasMessageAnnote (void); | |
272 | extern void context_setMessageAnnote (/*@only@*/ cstring p_s); | |
273 | extern bool context_suppressFlagMsg (flagcode p_flag, fileloc p_fl); | |
274 | extern bool context_suppressNotFlagMsg (flagcode p_flag, fileloc p_fl); | |
275 | extern void context_enterCaseClause (exprNode p_e); | |
276 | extern void context_enterSwitch (exprNode p_e); | |
277 | extern void context_exitSwitch (exprNode p_e, bool p_allpaths); | |
278 | ||
279 | extern bool context_showFunction (void); | |
280 | extern void context_setShownFunction (void); | |
281 | ||
282 | extern void context_clearAliasAnnote (void); | |
283 | extern cstring context_getAliasAnnote (void); | |
284 | extern bool context_hasAliasAnnote (void); | |
285 | extern void context_setAliasAnnote (/*@observer@*/ sRef p_s, /*@observer@*/ sRef p_t); | |
286 | ||
287 | extern bool context_inDeepLoop (void) /*@globals internalState@*/ ; | |
288 | extern bool context_inDeepLoopSwitch (void) /*@globals internalState@*/ ; | |
289 | extern bool context_inConditional (void) /*@globals internalState@*/ ; | |
290 | extern bool context_inDeepSwitch (void) /*@globals internalState@*/ ; | |
291 | ||
292 | extern clause context_breakClause (void); | |
293 | extern clause context_nextBreakClause (void); | |
294 | ||
295 | extern bool context_anyErrors (void) /*@globals internalState@*/ ; | |
296 | extern void context_hasError (void) /*@modifies internalState@*/ ; | |
297 | extern int context_numErrors (void) /*@globals internalState@*/ ; | |
298 | extern bool context_neednl (void); | |
299 | extern void context_setNeednl (void); | |
300 | ||
301 | extern bool context_inGlobalContext (void) /*@globals internalState@*/ ; | |
302 | extern bool context_inMacroFunction (void) /*@globals internalState@*/ ; | |
303 | ||
304 | extern /*@observer@*/ cstring context_moduleName (void) /*@*/ ; | |
305 | extern void context_recordFileGlobals (/*@dependent@*/ globSet p_mods); | |
306 | extern void context_checkSuppressCounts (void) /*@modifies g_msgstream@*/ ; | |
307 | ||
28bf4b0b | 308 | extern bool context_inFunctionHeader (void) /*@globals internalState@*/ ; |
309 | extern void context_enterFunctionHeader (void) /*@modifies internalState@*/ ; | |
310 | extern void context_exitFunctionHeader (void) /*@modifies internalState@*/ ; | |
311 | ||
312 | extern bool context_inFunctionDeclaration (void) /*@globals internalState@*/ ; | |
313 | extern void context_enterFunctionDeclaration (/*@exposed@*/ uentry) /*@modifies internalState@*/ ; | |
314 | extern void context_exitFunctionDeclaration (void) /*@modifies internalState@*/ ; | |
7ebcc5bb | 315 | extern void context_enterOldStyleScope (void) /*@modifies internalState@*/ ; |
316 | extern void context_completeOldStyleFunction (/*@exposed@*/ uentry p_e) /*@modifies internalState@*/ ; | |
885824d3 | 317 | |
a0a162cd | 318 | extern ctype context_boolImplementationType (void) /*@*/ ; |
28bf4b0b | 319 | extern /*@observer@*/ /*@null@*/ annotationInfo |
320 | context_lookupAnnotation (cstring p_annot) /*@*/ ; | |
321 | ||
322 | extern /*@observer@*/ metaStateTable context_getMetaStateTable (void) | |
323 | /*@globals internalState@*/ ; | |
324 | ||
325 | extern /*@observer@*/ metaStateInfo context_lookupMetaStateInfo (cstring p_key) | |
326 | /*@globals internalState@*/ ; | |
327 | ||
328 | extern void context_addAnnotation (/*@only@*/ annotationInfo) | |
329 | /*@modifies internalState@*/ ; | |
330 | ||
331 | extern void context_addMetaState (/*@only@*/ cstring, /*@only@*/ metaStateInfo) | |
332 | /*@modifies internalState@*/ ; | |
333 | ||
6970c11b | 334 | extern valueTable context_createValueTable (sRef p_s, /*@only@*/ stateInfo p_sinfo) |
28bf4b0b | 335 | /*@globals internalState@*/ ; |
336 | ||
6970c11b | 337 | extern valueTable context_createGlobalMarkerValueTable (/*@only@*/ stateInfo p_sinfo) |
28bf4b0b | 338 | /*@globals internalState@*/ ; |
339 | ||
340 | extern int context_getBugsLimit (void) /*@*/ ; | |
341 | # define context_getBugsLimit() ((int)context_getValue(FLG_BUGSLIMIT)) | |
a0a162cd | 342 | |
885824d3 | 343 | # else |
344 | # error "Multiple include" | |
345 | # endif | |
346 | ||
347 | ||
348 | ||
349 | ||
350 | ||
351 | ||
352 | ||
353 |