]> andersk Git - splint.git/blame - src/Headers/lctype.h
Updating to use the LEnsures and LRequires instead of the ensures requires so
[splint.git] / src / Headers / lctype.h
CommitLineData
885824d3 1/*
2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000.
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{
76 CTK_UNKNOWN = -3,
77 CTK_INVALID = -2,
78 CTK_DNE = -1,
79 CTK_PLAIN = 0, /* these must be in order */
80 CTK_PTR = 1,
81 CTK_ARRAY = 2,
82 CTK_COMPLEX = 3
83 } ctkind ;
84
85extern int ctkind_toInt (ctkind p_x);
86# define ctkind_toInt(x) ((int)(x))
87
88/*
89** ctypes are integer indexes into ctype table
90**
91** the most common ctypes are hard wired (see cprim.h)
92*/
93
94/*@constant ctype ctype_undefined; @*/
95# define ctype_undefined ((ctype) CTK_INVALID)
96
97/*@constant ctype ctype_dne; @*/
98# define ctype_dne ((ctype) CTK_DNE)
99
100/*@constant ctype ctype_unknown; @*/
101# define ctype_unknown CTX_UNKNOWN
102
103/*@constant ctype ctype_void; @*/
104# define ctype_void CTX_VOID
105
106/*@constant ctype ctype_char; @*/
107# define ctype_char CTX_CHAR
108
109/*@constant ctype ctype_uchar; @*/
110# define ctype_uchar CTX_UCHAR
111
112/*@constant ctype ctype_double; @*/
113# define ctype_double CTX_DOUBLE
114
115/*@constant ctype ctype_ldouble; @*/
116# define ctype_ldouble CTX_LDOUBLE
117
118/*@constant ctype ctype_float; @*/
119# define ctype_float CTX_FLOAT
120
121/*@constant ctype ctype_int; @*/
122# define ctype_int CTX_INT
123
124/*@constant ctype ctype_uint; @*/
125# define ctype_uint CTX_UINT
126
127/*@constant ctype ctype_sint; @*/
128# define ctype_sint CTX_SINT
129
130/*@constant ctype ctype_lint; @*/
131# define ctype_lint CTX_LINT
132
133/*@constant ctype ctype_usint; @*/
134# define ctype_usint CTX_USINT
135
136/*@constant ctype ctype_ulint; @*/
137# define ctype_ulint CTX_ULINT
138
139/*@constant ctype ctype_llint; @*/
140# define ctype_llint CTX_LLINT
141
142/*@constant ctype ctype_ullint; @*/
143# define ctype_ullint CTX_ULLINT
144
145/*@constant ctype ctype_bool; @*/
146# define ctype_bool CTX_BOOL
147
148/*@constant ctype ctype_string; @*/
149# define ctype_string CTP_CHAR
150
151/*@constant ctype ctype_anyintegral @*/
152# define ctype_anyintegral CTX_ANYINTEGRAL
153
154/*@constant ctype ctype_unsignedintegral @*/
155# define ctype_unsignedintegral CTX_UNSIGNEDINTEGRAL
156
157/*@constant ctype ctype_signedintegral @*/
158# define ctype_signedintegral CTX_SIGNEDINTEGRAL
159
160/*@constant ctype ctype_voidPointer; @*/
161# define ctype_voidPointer CTP_VOID
162
163extern ctype ctype_forceRealType (ctype p_c);
164extern bool ctype_forceMatch (ctype p_c1, ctype p_c2);
a0a162cd 165extern bool ctype_genMatch (ctype p_c1, ctype p_c2, bool p_force, bool p_arg, bool p_def, bool p_deep);
885824d3 166
167extern bool ctype_isSimple (ctype p_c) /*@*/ ;
168extern bool ctype_isAbstract (ctype p_c) /*@*/ ;
169extern bool ctype_isArray (ctype p_c) /*@*/ ;
170extern bool ctype_isFixedArray (ctype p_c) /*@*/ ;
171extern bool ctype_isIncompleteArray (ctype p_c) /*@*/ ;
172extern bool ctype_isArrayPtr (ctype p_c) /*@*/ ;
a0a162cd 173extern bool ctype_isBool (ctype p_c) /*@*/ ; /* matches type bool */
174extern bool ctype_isManifestBool (ctype p_c) /*@*/ ; /* declared as type bool */
885824d3 175extern bool ctype_isChar (ctype p_c) /*@*/ ;
176extern bool ctype_isUnsignedChar (ctype p_c) /*@*/ ;
177extern bool ctype_isSignedChar (ctype p_c) /*@*/ ;
178extern bool ctype_isString (ctype p_c) /*@*/ ;
179extern bool ctype_isConj (ctype p_c) /*@*/ ;
180extern bool ctype_isDirectBool (ctype p_c) /*@*/ ;
181extern bool ctype_isDirectInt(ctype p_c) /*@*/ ;
182extern bool ctype_isEnum(ctype p_c) /*@*/ ;
183extern bool ctype_isExpFcn (ctype p_c) /*@*/ ;
184extern bool ctype_isFirstVoid (ctype p_c) /*@*/ ;
185extern bool ctype_isForceRealBool (ctype *p_c) /*@*/ ;
186extern bool ctype_isForceRealInt (ctype *p_c) /*@*/ ;
187extern bool ctype_isForceRealNumeric (ctype *p_c) /*@*/ ;
188extern bool ctype_isFunction (ctype p_c) /*@*/ ;
189extern bool ctype_isArbitraryIntegral (ctype p_c) /*@*/ ;
190extern bool ctype_isUnsignedIntegral (ctype p_c) /*@*/ ;
191extern bool ctype_isSignedIntegral (ctype p_c) /*@*/ ;
192extern bool ctype_isInt (ctype p_c) /*@*/ ;
193extern bool ctype_isRegularInt (ctype p_c) /*@*/ ;
194extern bool ctype_isMutable (ctype p_t) /*@*/ ;
195extern bool ctype_isNumeric (ctype p_c) /*@*/ ;
196extern bool ctype_isPointer (ctype p_c) /*@*/ ;
197extern bool ctype_isReal (ctype p_c) /*@*/ ;
198extern /*@unused@*/ bool ctype_isFloat (ctype p_c) /*@*/ ;
199extern bool ctype_isDouble (ctype p_c) /*@*/ ;
200extern bool ctype_isSigned (ctype p_c) /*@*/ ;
201extern bool ctype_isUnsigned (ctype p_c) /*@*/ ;
202extern bool ctype_isRealAP (ctype p_c) /*@*/ ;
203extern bool ctype_isRealAbstract(ctype p_c) /*@*/ ;
204extern bool ctype_isRealArray (ctype p_c) /*@*/ ;
205extern bool ctype_isRealBool (ctype p_c) /*@*/ ;
206extern bool ctype_isRealFunction (ctype p_c) /*@*/ ;
207extern bool ctype_isRealInt (ctype p_c) /*@*/ ;
208extern bool ctype_isRealNumeric (ctype p_c) /*@*/ ;
209extern bool ctype_isRealPointer (ctype p_c) /*@*/ ;
210extern bool ctype_isRealSU (ctype p_c) /*@*/ ;
211extern bool ctype_isRealVoid (ctype p_c) /*@*/ ;
212extern bool ctype_isStruct (ctype p_c) /*@*/ ;
213extern bool ctype_isStructorUnion(ctype p_c) /*@*/ ;
214extern bool ctype_isUA (ctype p_c) /*@*/ ;
215extern bool ctype_isUnion (ctype p_c) /*@*/ ;
885824d3 216extern bool ctype_isVoid (ctype p_c) /*@*/ ;
217extern bool ctype_isVoidPointer (ctype p_c) /*@*/ ;
218
219extern bool ctype_isVisiblySharable (ctype p_t) /*@*/ ;
220extern bool ctype_match (ctype p_c1, ctype p_c2) /*@*/ ;
221extern bool ctype_matchArg (ctype p_c1, ctype p_c2) /*@*/ ;
222extern bool ctype_sameName (ctype p_c1, ctype p_c2) /*@*/ ;
223
224extern /*@only@*/ cstring ctype_dump (ctype p_c) /*@*/ ;
225extern /*@observer@*/ cstring ctype_enumTag (ctype p_c) /*@*/ ;
226extern /*@observer@*/ cstring ctype_unparse (ctype p_c) /*@*/ ;
227extern /*@observer@*/ cstring ctype_unparseDeep (ctype p_c) /*@*/ ;
228extern /*@unused@*/ /*@observer@*/ cstring ctype_unparseSafe (ctype p_c) /*@*/ ;
229
230extern ctkind ctkind_fromInt (int p_i) /*@*/ ;
231
232extern bool ctype_matchDef (ctype p_c1, ctype p_c2) /*@*/ ;
233extern ctype ctype_undump (char **p_c);
234extern ctype ctype_adjustPointers(int p_np, ctype p_c);
235extern ctype ctype_baseArrayPtr (ctype p_c) /*@*/ ;
236extern ctype ctype_combine (ctype p_dominant, ctype p_modifier) ;
237
238extern ctype ctype_createAbstract (typeId p_u) /*@*/ ;
239extern ctype
240 ctype_createEnum (/*@keep@*/ cstring p_tag, /*@keep@*/ enumNameList p_el);
241extern ctype ctype_createForwardStruct (/*@only@*/ cstring p_n) /*@*/ ;
242extern ctype ctype_createForwardUnion (/*@only@*/ cstring p_n) /*@*/ ;
243extern ctype ctype_createStruct (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
244extern ctype ctype_createUnion (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
245
246extern ctype ctype_createUnnamedStruct (/*@only@*/ uentryList p_f) ;
247extern ctype ctype_createUnnamedUnion (/*@only@*/ uentryList p_f) ;
248extern ctype ctype_createUser (typeId p_u) ;
249
250extern bool ctype_isUser (ctype p_c) /*@*/ ;
251extern ctype ctype_expectFunction(ctype p_c) ;
252
253extern ctype ctype_fixArrayPtr (ctype p_c);
254
255extern ctype ctype_getBaseType (ctype p_c) /*@*/ ;
256
257extern ctype ctype_makeArray (ctype p_c);
258extern ctype ctype_makeFixedArray (ctype p_c, long p_size);
259extern ctype ctype_makeConj (ctype p_c1, ctype p_c2);
260extern ctype ctype_makeParamsFunction (ctype p_base, /*@only@*/ uentryList p_p);
261extern ctype ctype_makeFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
262extern ctype ctype_makeNFParamsFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
263extern ctype ctype_makePointer (ctype p_c);
264extern ctype ctype_makeRealFunction (ctype p_base, /*@dependent@*/ uentryList p_p);
265
266extern ctype ctype_newBase (ctype p_c, ctype p_p) /*@*/ ;
267extern ctype ctype_realType (ctype p_c) /*@*/ ;
268extern ctype ctype_realishType (ctype p_c) /*@*/ ;
269extern ctype ctype_removePointers (ctype p_c) /*@*/ ;
270extern ctype ctype_resolve (ctype p_c) /*@*/ ;
271extern ctype ctype_resolveNumerics (ctype p_c1, ctype p_c2) /*@*/ ;
272extern ctype ctype_returnValue (ctype p_c) /*@*/ ;
273
274extern bool ctype_isRefCounted (ctype p_t) /*@*/ ;
275extern /*@observer@*/ uentryList ctype_argsFunction (ctype p_c) /*@*/ ;
276extern /*@observer@*/ uentryList ctype_getParams (ctype p_c) /*@*/ ;
277# define ctype_getParams(c) ctype_argsFunction(c)
278
279extern /*@observer@*/ enumNameList ctype_elist (ctype p_c) /*@*/ ;
280extern /*@observer@*/ uentryList ctype_getFields (ctype p_c) /*@*/ ;
281
282/*
283** could do some run-time checks...
284*/
285
286extern cprim ctype_toCprim (ctype p_c) /*@*/ ;
287/*@access cprim@*/
288# define ctype_toCprim(c) ((cprim) (c))
289/*@noaccess cprim@*/
290
291extern int ctype_compare (ctype p_c1, ctype p_c2) /*@*/ ;
292extern /*@unused@*/ int ctype_count (void);
293
294extern ctype ctype_makeExplicitConj (ctype p_c1, ctype p_c2);
295
296extern typeId ctype_typeId (ctype p_c);
297
298extern ctype ctype_fromQual (qual p_q);
299extern bool ctype_isAnyFloat (ctype p_c);
300extern bool ctype_isStackAllocated (ctype p_c);
301
302/*@constant ctype ctype_missingParamsMarker; @*/
303# define ctype_missingParamsMarker ((ctype)CTK_MISSINGPARAMS)
304
305extern bool ctype_isMissingParamsMarker (ctype p_ct) /*@*/ ;
306# define ctype_isMissingParamsMarker(ct) ((ct) == ctype_missingParamsMarker)
307
308extern bool ctype_equal (ctype p_c1, ctype p_c2);
309# define ctype_equal(c1,c2) ((c1) == (c2))
310
311extern bool ctype_almostEqual (ctype p_c1, ctype p_c2);
312
313/*@constant ctype ctype_elipsMarker; @*/
314# define ctype_elipsMarker ((ctype) CTK_ELIPS)
315
316extern bool ctype_isElips (ctype p_ct) /*@*/;
317# define ctype_isElips(ct) ((ct) == ctype_elipsMarker)
318
319extern bool ctype_isAP (ctype p_c) /*@*/ ;
320# define ctype_isAP(c) ctype_isArrayPtr(c)
321
322extern bool ctype_isDefined (ctype p_c) /*@*/ ;
323# define ctype_isDefined(c) ((c) != ctype_undefined)
324
325extern bool ctype_isKnown (ctype p_c) /*@*/ ;
326# define ctype_isKnown(c) ((c) != CTX_UNKNOWN)
327
328extern bool ctype_isSU (ctype p_c) /*@*/ ;
329# define ctype_isSU(c) ctype_isStructorUnion(c)
330
331extern bool ctype_isUndefined (ctype p_c) /*@*/ ;
332# define ctype_isUndefined(c) ((c) == ctype_undefined)
333
334extern bool ctype_isUnknown (ctype p_c) /*@*/;
335# define ctype_isUnknown(c) ((c) == CTX_UNKNOWN)
336
337extern bool ctype_isBogus (/*@sef@*/ ctype p_c) /*@*/ ;
338# define ctype_isBogus(c) (ctype_isUndefined(c) || ctype_isUnknown(c))
339
340extern cstring
341 ctype_unparseDeclaration (ctype p_c, /*@only@*/ cstring p_name);
342
343extern bool ctype_sameAltTypes (ctype p_c1, ctype p_c2) /*@*/ ;
344
345extern void ctype_dumpTable (FILE *p_f);
346extern void ctype_loadTable (FILE *p_f);
347extern void ctype_destroyMod (void);
348extern void ctype_initTable (void);
349extern /*@only@*/ cstring ctype_unparseTable (void);
350extern /*@unused@*/ void ctype_printTable (void);
351
352extern ctype ctype_widest (ctype, ctype) /*@*/ ;
353
ef2aa32a 354/*
355 drl
356 modified */
357long int ctype_getArraySize (ctype c);
358/*end drl add functions */
359
a0a162cd 360/* Should only be used in uentry.c */
361extern bool ctype_isUserBool (ctype p_ct) /*@*/ ;
362
885824d3 363# else
364# error "Multiple include"
365# endif
This page took 0.125447 seconds and 5 git commands to generate.