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