]> andersk Git - splint.git/blame - src/Headers/lctype.h
Fixed problem with resetting null state after error for constants.
[splint.git] / src / Headers / lctype.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** lctype.h
8**
9** renamed from ctype.h to avoid confusion with standard
10** header file
11*/
12
13# ifndef CTYPE_H
14# define CTYPE_H
15
16/*
17** since this is the header file for the ctype module, we need
18** to use an access comment to provide access to the representation.
19*/
20
21/* in forwardTypes: typedef int ctype; */
22
23typedef enum
24{
25 CT_UNKNOWN,
26 CT_PRIM,
27 CT_USER,
28 CT_ABST,
29 CT_ENUM,
30 CT_PTR,
31 CT_ARRAY,
32 CT_FIXEDARRAY,
33 CT_FCN,
34 CT_STRUCT,
35 CT_UNION,
36 CT_ENUMLIST, /* bogus type for keeping unnamed enums around */
37 CT_BOOL, /* since booleans aren't really prim's but we don't
38 want them to be user or abst, they are a separate type */
39 CT_CONJ, /* conjunction */
40 CT_EXPFCN
41 } ctuid ;
42
43/*@access ctype@*/
44
45/* hack alert! */
46
47/*@constant int CTK_ELIPS;@*/
48# define CTK_ELIPS -23
49
50/*@constant int CTK_MISSINGPARAMS;@*/
51# define CTK_MISSINGPARAMS -37
52
53/*@constant int CT_FIRST;@*/
54# define CT_FIRST 0
55
56/*@constant int CTK_PREDEFINED;@*/
57# define CTK_PREDEFINED (CTX_LAST + 1)
58
59/*@constant int CTK_PREDEFINED2;@*/
60# define CTK_PREDEFINED2 (CTK_PREDEFINED + CTK_PREDEFINED)
61
62/*@constant int LAST_PREDEFINED;@*/
63# define LAST_PREDEFINED (CTK_PREDEFINED + CTK_PREDEFINED2)
64
65/*@constant int CTP_VOID;@*/
66# define CTP_VOID (CTX_VOID + CTK_PREDEFINED)
67
68/*@constant int CTP_CHAR;@*/
69# define CTP_CHAR (CTX_CHAR + CTK_PREDEFINED)
70
71/*@constant int CTK_BASESIZE;@*/
72# define CTK_BASESIZE BIGBASESIZE
73
74typedef enum
75{
02b84d4b 76 CTK_ANYTYPE = -4,
885824d3 77 CTK_UNKNOWN = -3,
78 CTK_INVALID = -2,
79 CTK_DNE = -1,
80 CTK_PLAIN = 0, /* these must be in order */
81 CTK_PTR = 1,
82 CTK_ARRAY = 2,
83 CTK_COMPLEX = 3
84 } ctkind ;
85
86extern int ctkind_toInt (ctkind p_x);
87# define ctkind_toInt(x) ((int)(x))
88
89/*
90** ctypes are integer indexes into ctype table
91**
92** the most common ctypes are hard wired (see cprim.h)
93*/
94
95/*@constant ctype ctype_undefined; @*/
96# define ctype_undefined ((ctype) CTK_INVALID)
97
98/*@constant ctype ctype_dne; @*/
99# define ctype_dne ((ctype) CTK_DNE)
100
02b84d4b 101/*@constant ctype ctype_anytype; @*/
102# define ctype_anytype ((ctype) CTK_ANYTYPE)
103
885824d3 104/*@constant ctype ctype_unknown; @*/
105# define ctype_unknown CTX_UNKNOWN
106
107/*@constant ctype ctype_void; @*/
108# define ctype_void CTX_VOID
109
110/*@constant ctype ctype_char; @*/
111# define ctype_char CTX_CHAR
112
113/*@constant ctype ctype_uchar; @*/
114# define ctype_uchar CTX_UCHAR
115
116/*@constant ctype ctype_double; @*/
117# define ctype_double CTX_DOUBLE
118
119/*@constant ctype ctype_ldouble; @*/
120# define ctype_ldouble CTX_LDOUBLE
121
122/*@constant ctype ctype_float; @*/
123# define ctype_float CTX_FLOAT
124
125/*@constant ctype ctype_int; @*/
126# define ctype_int CTX_INT
127
128/*@constant ctype ctype_uint; @*/
129# define ctype_uint CTX_UINT
130
131/*@constant ctype ctype_sint; @*/
132# define ctype_sint CTX_SINT
133
134/*@constant ctype ctype_lint; @*/
135# define ctype_lint CTX_LINT
136
137/*@constant ctype ctype_usint; @*/
138# define ctype_usint CTX_USINT
139
140/*@constant ctype ctype_ulint; @*/
141# define ctype_ulint CTX_ULINT
142
143/*@constant ctype ctype_llint; @*/
144# define ctype_llint CTX_LLINT
145
146/*@constant ctype ctype_ullint; @*/
147# define ctype_ullint CTX_ULLINT
148
149/*@constant ctype ctype_bool; @*/
150# define ctype_bool CTX_BOOL
151
152/*@constant ctype ctype_string; @*/
153# define ctype_string CTP_CHAR
154
155/*@constant ctype ctype_anyintegral @*/
156# define ctype_anyintegral CTX_ANYINTEGRAL
157
158/*@constant ctype ctype_unsignedintegral @*/
159# define ctype_unsignedintegral CTX_UNSIGNEDINTEGRAL
160
161/*@constant ctype ctype_signedintegral @*/
162# define ctype_signedintegral CTX_SIGNEDINTEGRAL
163
164/*@constant ctype ctype_voidPointer; @*/
165# define ctype_voidPointer CTP_VOID
166
167extern ctype ctype_forceRealType (ctype p_c);
168extern bool ctype_forceMatch (ctype p_c1, ctype p_c2);
a0a162cd 169extern bool ctype_genMatch (ctype p_c1, ctype p_c2, bool p_force, bool p_arg, bool p_def, bool p_deep);
885824d3 170
171extern bool ctype_isSimple (ctype p_c) /*@*/ ;
172extern bool ctype_isAbstract (ctype p_c) /*@*/ ;
173extern bool ctype_isArray (ctype p_c) /*@*/ ;
174extern bool ctype_isFixedArray (ctype p_c) /*@*/ ;
175extern bool ctype_isIncompleteArray (ctype p_c) /*@*/ ;
176extern bool ctype_isArrayPtr (ctype p_c) /*@*/ ;
a0a162cd 177extern bool ctype_isBool (ctype p_c) /*@*/ ; /* matches type bool */
178extern bool ctype_isManifestBool (ctype p_c) /*@*/ ; /* declared as type bool */
885824d3 179extern bool ctype_isChar (ctype p_c) /*@*/ ;
180extern bool ctype_isUnsignedChar (ctype p_c) /*@*/ ;
181extern bool ctype_isSignedChar (ctype p_c) /*@*/ ;
182extern bool ctype_isString (ctype p_c) /*@*/ ;
183extern bool ctype_isConj (ctype p_c) /*@*/ ;
184extern bool ctype_isDirectBool (ctype p_c) /*@*/ ;
185extern bool ctype_isDirectInt(ctype p_c) /*@*/ ;
186extern bool ctype_isEnum(ctype p_c) /*@*/ ;
187extern bool ctype_isExpFcn (ctype p_c) /*@*/ ;
188extern bool ctype_isFirstVoid (ctype p_c) /*@*/ ;
189extern bool ctype_isForceRealBool (ctype *p_c) /*@*/ ;
190extern bool ctype_isForceRealInt (ctype *p_c) /*@*/ ;
191extern bool ctype_isForceRealNumeric (ctype *p_c) /*@*/ ;
192extern bool ctype_isFunction (ctype p_c) /*@*/ ;
193extern bool ctype_isArbitraryIntegral (ctype p_c) /*@*/ ;
194extern bool ctype_isUnsignedIntegral (ctype p_c) /*@*/ ;
195extern bool ctype_isSignedIntegral (ctype p_c) /*@*/ ;
196extern bool ctype_isInt (ctype p_c) /*@*/ ;
197extern bool ctype_isRegularInt (ctype p_c) /*@*/ ;
198extern bool ctype_isMutable (ctype p_t) /*@*/ ;
28bf4b0b 199extern bool ctype_isImmutableAbstract (ctype p_t) /*@*/ ;
885824d3 200extern bool ctype_isNumeric (ctype p_c) /*@*/ ;
201extern bool ctype_isPointer (ctype p_c) /*@*/ ;
202extern bool ctype_isReal (ctype p_c) /*@*/ ;
203extern /*@unused@*/ bool ctype_isFloat (ctype p_c) /*@*/ ;
204extern bool ctype_isDouble (ctype p_c) /*@*/ ;
205extern bool ctype_isSigned (ctype p_c) /*@*/ ;
206extern bool ctype_isUnsigned (ctype p_c) /*@*/ ;
207extern bool ctype_isRealAP (ctype p_c) /*@*/ ;
208extern bool ctype_isRealAbstract(ctype p_c) /*@*/ ;
209extern bool ctype_isRealArray (ctype p_c) /*@*/ ;
210extern bool ctype_isRealBool (ctype p_c) /*@*/ ;
211extern bool ctype_isRealFunction (ctype p_c) /*@*/ ;
212extern bool ctype_isRealInt (ctype p_c) /*@*/ ;
213extern bool ctype_isRealNumeric (ctype p_c) /*@*/ ;
214extern bool ctype_isRealPointer (ctype p_c) /*@*/ ;
215extern bool ctype_isRealSU (ctype p_c) /*@*/ ;
216extern bool ctype_isRealVoid (ctype p_c) /*@*/ ;
217extern bool ctype_isStruct (ctype p_c) /*@*/ ;
218extern bool ctype_isStructorUnion(ctype p_c) /*@*/ ;
219extern bool ctype_isUA (ctype p_c) /*@*/ ;
220extern bool ctype_isUnion (ctype p_c) /*@*/ ;
885824d3 221extern bool ctype_isVoid (ctype p_c) /*@*/ ;
222extern bool ctype_isVoidPointer (ctype p_c) /*@*/ ;
223
224extern bool ctype_isVisiblySharable (ctype p_t) /*@*/ ;
225extern bool ctype_match (ctype p_c1, ctype p_c2) /*@*/ ;
226extern bool ctype_matchArg (ctype p_c1, ctype p_c2) /*@*/ ;
227extern bool ctype_sameName (ctype p_c1, ctype p_c2) /*@*/ ;
228
229extern /*@only@*/ cstring ctype_dump (ctype p_c) /*@*/ ;
230extern /*@observer@*/ cstring ctype_enumTag (ctype p_c) /*@*/ ;
231extern /*@observer@*/ cstring ctype_unparse (ctype p_c) /*@*/ ;
232extern /*@observer@*/ cstring ctype_unparseDeep (ctype p_c) /*@*/ ;
233extern /*@unused@*/ /*@observer@*/ cstring ctype_unparseSafe (ctype p_c) /*@*/ ;
234
235extern ctkind ctkind_fromInt (int p_i) /*@*/ ;
236
237extern bool ctype_matchDef (ctype p_c1, ctype p_c2) /*@*/ ;
238extern ctype ctype_undump (char **p_c);
239extern ctype ctype_adjustPointers(int p_np, ctype p_c);
240extern ctype ctype_baseArrayPtr (ctype p_c) /*@*/ ;
241extern ctype ctype_combine (ctype p_dominant, ctype p_modifier) ;
242
243extern ctype ctype_createAbstract (typeId p_u) /*@*/ ;
244extern ctype
245 ctype_createEnum (/*@keep@*/ cstring p_tag, /*@keep@*/ enumNameList p_el);
246extern ctype ctype_createForwardStruct (/*@only@*/ cstring p_n) /*@*/ ;
247extern ctype ctype_createForwardUnion (/*@only@*/ cstring p_n) /*@*/ ;
248extern ctype ctype_createStruct (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
249extern ctype ctype_createUnion (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
250
251extern ctype ctype_createUnnamedStruct (/*@only@*/ uentryList p_f) ;
252extern ctype ctype_createUnnamedUnion (/*@only@*/ uentryList p_f) ;
253extern ctype ctype_createUser (typeId p_u) ;
254
28bf4b0b 255extern bool ctype_isUnnamedSU (ctype p_c) /*@*/ ;
885824d3 256extern bool ctype_isUser (ctype p_c) /*@*/ ;
e8b84478 257
885824d3 258extern ctype ctype_expectFunction(ctype p_c) ;
e8b84478 259extern ctype ctype_dontExpectFunction (ctype p_c) ;
885824d3 260
261extern ctype ctype_fixArrayPtr (ctype p_c);
262
263extern ctype ctype_getBaseType (ctype p_c) /*@*/ ;
264
265extern ctype ctype_makeArray (ctype p_c);
266extern ctype ctype_makeFixedArray (ctype p_c, long p_size);
393e573f 267extern ctype ctype_makeInnerArray (ctype p_c);
077d4458 268extern ctype ctype_makeInnerFixedArray (ctype p_c, long p_size);
393e573f 269
885824d3 270extern ctype ctype_makeConj (ctype p_c1, ctype p_c2);
271extern ctype ctype_makeParamsFunction (ctype p_base, /*@only@*/ uentryList p_p);
272extern ctype ctype_makeFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
273extern ctype ctype_makeNFParamsFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
274extern ctype ctype_makePointer (ctype p_c);
28bf4b0b 275extern ctype ctype_makeRawFunction (ctype p_base, /*@only@*/ uentryList p_p);
e0b363ad 276extern ctype ctype_makeWideString (void) /*@modifies internalState@*/ ;
277extern bool ctype_isWideString (ctype p_c) /*@*/ ;
885824d3 278
279extern ctype ctype_newBase (ctype p_c, ctype p_p) /*@*/ ;
280extern ctype ctype_realType (ctype p_c) /*@*/ ;
281extern ctype ctype_realishType (ctype p_c) /*@*/ ;
282extern ctype ctype_removePointers (ctype p_c) /*@*/ ;
283extern ctype ctype_resolve (ctype p_c) /*@*/ ;
284extern ctype ctype_resolveNumerics (ctype p_c1, ctype p_c2) /*@*/ ;
28bf4b0b 285extern ctype ctype_getReturnType (ctype p_c) /*@*/ ;
885824d3 286
287extern bool ctype_isRefCounted (ctype p_t) /*@*/ ;
288extern /*@observer@*/ uentryList ctype_argsFunction (ctype p_c) /*@*/ ;
289extern /*@observer@*/ uentryList ctype_getParams (ctype p_c) /*@*/ ;
290# define ctype_getParams(c) ctype_argsFunction(c)
291
292extern /*@observer@*/ enumNameList ctype_elist (ctype p_c) /*@*/ ;
293extern /*@observer@*/ uentryList ctype_getFields (ctype p_c) /*@*/ ;
294
295/*
296** could do some run-time checks...
297*/
298
299extern cprim ctype_toCprim (ctype p_c) /*@*/ ;
300/*@access cprim@*/
301# define ctype_toCprim(c) ((cprim) (c))
302/*@noaccess cprim@*/
303
304extern int ctype_compare (ctype p_c1, ctype p_c2) /*@*/ ;
305extern /*@unused@*/ int ctype_count (void);
306
307extern ctype ctype_makeExplicitConj (ctype p_c1, ctype p_c2);
308
309extern typeId ctype_typeId (ctype p_c);
310
311extern ctype ctype_fromQual (qual p_q);
312extern bool ctype_isAnyFloat (ctype p_c);
313extern bool ctype_isStackAllocated (ctype p_c);
314
315/*@constant ctype ctype_missingParamsMarker; @*/
316# define ctype_missingParamsMarker ((ctype)CTK_MISSINGPARAMS)
317
318extern bool ctype_isMissingParamsMarker (ctype p_ct) /*@*/ ;
319# define ctype_isMissingParamsMarker(ct) ((ct) == ctype_missingParamsMarker)
320
321extern bool ctype_equal (ctype p_c1, ctype p_c2);
322# define ctype_equal(c1,c2) ((c1) == (c2))
323
324extern bool ctype_almostEqual (ctype p_c1, ctype p_c2);
325
326/*@constant ctype ctype_elipsMarker; @*/
327# define ctype_elipsMarker ((ctype) CTK_ELIPS)
328
329extern bool ctype_isElips (ctype p_ct) /*@*/;
330# define ctype_isElips(ct) ((ct) == ctype_elipsMarker)
331
332extern bool ctype_isAP (ctype p_c) /*@*/ ;
333# define ctype_isAP(c) ctype_isArrayPtr(c)
334
335extern bool ctype_isDefined (ctype p_c) /*@*/ ;
336# define ctype_isDefined(c) ((c) != ctype_undefined)
337
338extern bool ctype_isKnown (ctype p_c) /*@*/ ;
339# define ctype_isKnown(c) ((c) != CTX_UNKNOWN)
340
341extern bool ctype_isSU (ctype p_c) /*@*/ ;
342# define ctype_isSU(c) ctype_isStructorUnion(c)
343
344extern bool ctype_isUndefined (ctype p_c) /*@*/ ;
345# define ctype_isUndefined(c) ((c) == ctype_undefined)
346
347extern bool ctype_isUnknown (ctype p_c) /*@*/;
348# define ctype_isUnknown(c) ((c) == CTX_UNKNOWN)
349
02b84d4b 350extern bool ctype_isAnytype (ctype p_c) /*@*/;
351# define ctype_isAnytype(c) ((c) == ctype_anytype)
352
885824d3 353extern bool ctype_isBogus (/*@sef@*/ ctype p_c) /*@*/ ;
354# define ctype_isBogus(c) (ctype_isUndefined(c) || ctype_isUnknown(c))
355
356extern cstring
357 ctype_unparseDeclaration (ctype p_c, /*@only@*/ cstring p_name);
358
359extern bool ctype_sameAltTypes (ctype p_c1, ctype p_c2) /*@*/ ;
360
361extern void ctype_dumpTable (FILE *p_f);
362extern void ctype_loadTable (FILE *p_f);
363extern void ctype_destroyMod (void);
364extern void ctype_initTable (void);
365extern /*@only@*/ cstring ctype_unparseTable (void);
366extern /*@unused@*/ void ctype_printTable (void);
367
368extern ctype ctype_widest (ctype, ctype) /*@*/ ;
369
7534721d 370/* drl modified */
371extern long int ctype_getArraySize (ctype p_c);
ef2aa32a 372/*end drl add functions */
373
a0a162cd 374/* Should only be used in uentry.c */
375extern bool ctype_isUserBool (ctype p_ct) /*@*/ ;
376
885824d3 377# else
378# error "Multiple include"
379# endif
This page took 0.136167 seconds and 5 git commands to generate.