2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
3 ** See ../LICENSE for license information.
9 ** renamed from ctype.h to avoid confusion with standard
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.
21 /* in forwardTypes: typedef int ctype; */
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 */
48 /*@constant int CTK_ELIPS;@*/
49 # define CTK_ELIPS -23
51 /*@constant int CTK_MISSINGPARAMS;@*/
52 # define CTK_MISSINGPARAMS -37
54 /*@constant int CT_FIRST;@*/
57 /*@constant int CTK_PREDEFINED;@*/
58 # define CTK_PREDEFINED (CTX_LAST + 1)
60 /*@constant int CTK_PREDEFINED2;@*/
61 # define CTK_PREDEFINED2 (CTK_PREDEFINED + CTK_PREDEFINED)
63 /*@constant int LAST_PREDEFINED;@*/
64 # define LAST_PREDEFINED (CTK_PREDEFINED + CTK_PREDEFINED2)
66 /*@constant int CTP_VOID;@*/
67 # define CTP_VOID (CTX_VOID + CTK_PREDEFINED)
69 /*@constant int CTP_CHAR;@*/
70 # define CTP_CHAR (CTX_CHAR + CTK_PREDEFINED)
72 /*@constant int CTK_BASESIZE;@*/
73 # define CTK_BASESIZE BIGBASESIZE
80 CTK_PLAIN = 0, /* these must be in order */
86 extern int ctkind_toInt (ctkind p_x);
87 # define ctkind_toInt(x) ((int)(x))
90 ** ctypes are integer indexes into ctype table
92 ** the most common ctypes are hard wired (see cprim.h)
95 /*@constant ctype ctype_undefined; @*/
96 # define ctype_undefined ((ctype) CTK_INVALID)
98 /*@constant ctype ctype_dne; @*/
99 # define ctype_dne ((ctype) CTK_DNE)
101 /*@constant ctype ctype_unknown; @*/
102 # define ctype_unknown CTX_UNKNOWN
104 /*@constant ctype ctype_void; @*/
105 # define ctype_void CTX_VOID
107 /*@constant ctype ctype_char; @*/
108 # define ctype_char CTX_CHAR
110 /*@constant ctype ctype_uchar; @*/
111 # define ctype_uchar CTX_UCHAR
113 /*@constant ctype ctype_double; @*/
114 # define ctype_double CTX_DOUBLE
116 /*@constant ctype ctype_ldouble; @*/
117 # define ctype_ldouble CTX_LDOUBLE
119 /*@constant ctype ctype_float; @*/
120 # define ctype_float CTX_FLOAT
122 /*@constant ctype ctype_int; @*/
123 # define ctype_int CTX_INT
125 /*@constant ctype ctype_uint; @*/
126 # define ctype_uint CTX_UINT
128 /*@constant ctype ctype_sint; @*/
129 # define ctype_sint CTX_SINT
131 /*@constant ctype ctype_lint; @*/
132 # define ctype_lint CTX_LINT
134 /*@constant ctype ctype_usint; @*/
135 # define ctype_usint CTX_USINT
137 /*@constant ctype ctype_ulint; @*/
138 # define ctype_ulint CTX_ULINT
140 /*@constant ctype ctype_llint; @*/
141 # define ctype_llint CTX_LLINT
143 /*@constant ctype ctype_ullint; @*/
144 # define ctype_ullint CTX_ULLINT
146 /*@constant ctype ctype_bool; @*/
147 # define ctype_bool CTX_BOOL
149 /*@constant ctype ctype_string; @*/
150 # define ctype_string CTP_CHAR
152 /*@constant ctype ctype_anyintegral @*/
153 # define ctype_anyintegral CTX_ANYINTEGRAL
155 /*@constant ctype ctype_unsignedintegral @*/
156 # define ctype_unsignedintegral CTX_UNSIGNEDINTEGRAL
158 /*@constant ctype ctype_signedintegral @*/
159 # define ctype_signedintegral CTX_SIGNEDINTEGRAL
161 /*@constant ctype ctype_voidPointer; @*/
162 # define ctype_voidPointer CTP_VOID
164 extern ctype ctype_forceRealType (ctype p_c);
165 extern bool ctype_forceMatch (ctype p_c1, ctype p_c2);
166 extern bool ctype_genMatch (ctype p_c1, ctype p_c2, bool p_force, bool p_arg, bool p_def, bool p_deep);
168 extern bool ctype_isSimple (ctype p_c) /*@*/ ;
169 extern bool ctype_isAbstract (ctype p_c) /*@*/ ;
170 extern bool ctype_isNumAbstract (ctype p_c) /*@*/ ;
171 extern bool ctype_isArray (ctype p_c) /*@*/ ;
172 extern bool ctype_isFixedArray (ctype p_c) /*@*/ ;
173 extern bool ctype_isIncompleteArray (ctype p_c) /*@*/ ;
174 extern bool ctype_isArrayPtr (ctype p_c) /*@*/ ;
175 extern bool ctype_isBool (ctype p_c) /*@*/ ; /* matches type bool */
176 extern bool ctype_isManifestBool (ctype p_c) /*@*/ ; /* declared as type bool */
177 extern bool ctype_isChar (ctype p_c) /*@*/ ;
178 extern bool ctype_isUnsignedChar (ctype p_c) /*@*/ ;
179 extern bool ctype_isSignedChar (ctype p_c) /*@*/ ;
180 extern bool ctype_isString (ctype p_c) /*@*/ ;
181 extern bool ctype_isConj (ctype p_c) /*@*/ ;
182 extern bool ctype_isDirectBool (ctype p_c) /*@*/ ;
183 extern bool ctype_isDirectInt(ctype p_c) /*@*/ ;
184 extern bool ctype_isEnum(ctype p_c) /*@*/ ;
185 extern bool ctype_isExpFcn (ctype p_c) /*@*/ ;
186 extern bool ctype_isFirstVoid (ctype p_c) /*@*/ ;
187 extern bool ctype_isForceRealBool (ctype *p_c) /*@*/ ;
188 extern bool ctype_isForceRealInt (ctype *p_c) /*@*/ ;
189 extern bool ctype_isForceRealNumeric (ctype *p_c) /*@*/ ;
190 extern bool ctype_isFunction (ctype p_c) /*@*/ ;
191 extern bool ctype_isArbitraryIntegral (ctype p_c) /*@*/ ;
192 extern bool ctype_isUnsignedIntegral (ctype p_c) /*@*/ ;
193 extern bool ctype_isSignedIntegral (ctype p_c) /*@*/ ;
194 extern bool ctype_isInt (ctype p_c) /*@*/ ;
195 extern bool ctype_isRegularInt (ctype p_c) /*@*/ ;
196 extern bool ctype_isMutable (ctype p_t) /*@*/ ;
197 extern bool ctype_isImmutableAbstract (ctype p_t) /*@*/ ;
198 extern bool ctype_isNumeric (ctype p_c) /*@*/ ;
199 extern bool ctype_isPointer (ctype p_c) /*@*/ ;
200 extern bool ctype_isReal (ctype p_c) /*@*/ ;
201 extern /*@unused@*/ bool ctype_isFloat (ctype p_c) /*@*/ ;
202 extern bool ctype_isDouble (ctype p_c) /*@*/ ;
203 extern bool ctype_isSigned (ctype p_c) /*@*/ ;
204 extern bool ctype_isUnsigned (ctype p_c) /*@*/ ;
205 extern bool ctype_isRealAP (ctype p_c) /*@*/ ;
206 extern bool ctype_isRealAbstract(ctype p_c) /*@*/ ;
207 extern bool ctype_isRealNumAbstract(ctype p_c) /*@*/ ;
208 extern bool ctype_isRealArray (ctype p_c) /*@*/ ;
209 extern bool ctype_isRealBool (ctype p_c) /*@*/ ;
210 extern bool ctype_isRealFunction (ctype p_c) /*@*/ ;
211 extern bool ctype_isRealInt (ctype p_c) /*@*/ ;
212 extern bool ctype_isRealNumeric (ctype p_c) /*@*/ ;
213 extern bool ctype_isRealPointer (ctype p_c) /*@*/ ;
214 extern bool ctype_isRealSU (ctype p_c) /*@*/ ;
215 extern bool ctype_isRealVoid (ctype p_c) /*@*/ ;
216 extern bool ctype_isStruct (ctype p_c) /*@*/ ;
217 extern bool ctype_isStructorUnion(ctype p_c) /*@*/ ;
218 extern bool ctype_isUA (ctype p_c) /*@*/ ;
219 extern bool ctype_isUnion (ctype p_c) /*@*/ ;
220 extern bool ctype_isVoid (ctype p_c) /*@*/ ;
221 extern bool ctype_isVoidPointer (ctype p_c) /*@*/ ;
223 extern bool ctype_isVisiblySharable (ctype p_t) /*@*/ ;
224 extern bool ctype_match (ctype p_c1, ctype p_c2) /*@*/ ;
225 extern bool ctype_matchArg (ctype p_c1, ctype p_c2) /*@*/ ;
226 extern bool ctype_sameName (ctype p_c1, ctype p_c2) /*@*/ ;
228 extern /*@only@*/ cstring ctype_dump (ctype p_c) /*@*/ ;
229 extern /*@observer@*/ cstring ctype_enumTag (ctype p_c) /*@*/ ;
230 extern /*@observer@*/ cstring ctype_unparse (ctype p_c) /*@*/ ;
231 extern /*@observer@*/ cstring ctype_unparseDeep (ctype p_c) /*@*/ ;
232 extern /*@unused@*/ /*@observer@*/ cstring ctype_unparseSafe (ctype p_c) /*@*/ ;
234 extern ctkind ctkind_fromInt (int p_i) /*@*/ ;
236 extern bool ctype_matchDef (ctype p_c1, ctype p_c2) /*@*/ ;
237 extern ctype ctype_undump (char **p_c);
238 extern ctype ctype_adjustPointers (pointers p_p, ctype p_c);
239 extern ctype ctype_baseArrayPtr (ctype p_c) /*@*/ ;
240 extern ctype ctype_combine (ctype p_dominant, ctype p_modifier) ;
242 extern ctype ctype_createAbstract (typeId p_u) /*@*/ ;
243 extern ctype ctype_createNumAbstract (typeId p_u) /*@*/ ;
245 extern ctype ctype_createForwardStruct (/*@only@*/ cstring p_n) /*@*/ ;
246 extern ctype ctype_createForwardUnion (/*@only@*/ cstring p_n) /*@*/ ;
247 extern ctype ctype_createForwardEnum (/*@only@*/ cstring p_n) /*@*/ ;
249 extern ctype ctype_createStruct (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
250 extern ctype ctype_createUnion (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f);
251 extern ctype ctype_createEnum (/*@keep@*/ cstring p_tag, /*@keep@*/ enumNameList p_el);
253 extern ctype ctype_createUnnamedStruct (/*@only@*/ uentryList p_f) ;
254 extern ctype ctype_createUnnamedUnion (/*@only@*/ uentryList p_f) ;
255 extern ctype ctype_createUser (typeId p_u) ;
257 extern bool ctype_isUnnamedSU (ctype p_c) /*@*/ ;
258 extern bool ctype_isUser (ctype p_c) /*@*/ ;
260 extern ctype ctype_biggerType (ctype p_c1, ctype p_c2)
261 /* EFFECTS: returns whichever of c1 or c2 is bigger (storage requirements).
262 If they are equal, returns c1. */
265 extern ctype ctype_expectFunction(ctype p_c) ;
266 extern ctype ctype_dontExpectFunction (ctype p_c) ;
268 extern ctype ctype_fixArrayPtr (ctype p_c);
270 extern ctype ctype_getBaseType (ctype p_c) /*@*/ ;
272 extern ctype ctype_makeAnytype (void) /*@*/ ;
273 extern bool ctype_isAnytype (ctype) /*@*/ ;
275 extern ctype ctype_makeArray (ctype p_c);
276 extern ctype ctype_makeFixedArray (ctype p_c, size_t p_size);
277 extern ctype ctype_makeInnerFixedArray (ctype p_c, size_t p_size);
278 extern ctype ctype_makeInnerArray (ctype p_c);
279 extern ctype ctype_makeConj (ctype p_c1, ctype p_c2) /*@modifies internalState@*/ ;
280 extern ctype ctype_makeParamsFunction (ctype p_base, /*@only@*/ uentryList p_p);
281 extern ctype ctype_makeFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
282 extern ctype ctype_makeNFParamsFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ;
283 extern ctype ctype_makePointer (ctype p_c);
284 extern ctype ctype_makeRawFunction (ctype p_base, /*@only@*/ uentryList p_p);
285 extern ctype ctype_makeWideString (void) /*@modifies internalState@*/ ;
286 extern bool ctype_isWideString (ctype p_c) /*@*/ ;
288 extern ctype ctype_newBase (ctype p_c, ctype p_p) /*@*/ ;
289 extern ctype ctype_realType (ctype p_c) /*@*/ ;
290 extern ctype ctype_realishType (ctype p_c) /*@*/ ;
291 extern ctype ctype_removePointers (ctype p_c) /*@*/ ;
292 extern ctype ctype_resolve (ctype p_c) /*@*/ ;
293 extern ctype ctype_resolveNumerics (ctype p_c1, ctype p_c2) /*@*/ ;
294 extern ctype ctype_getReturnType (ctype p_c) /*@*/ ;
296 extern bool ctype_isRefCounted (ctype p_t) /*@*/ ;
297 extern /*@observer@*/ uentryList ctype_argsFunction (ctype p_c) /*@*/ ;
298 extern /*@observer@*/ uentryList ctype_getParams (ctype p_c) /*@*/ ;
299 # define ctype_getParams(c) ctype_argsFunction(c)
301 extern /*@observer@*/ enumNameList ctype_elist (ctype p_c) /*@*/ ;
302 extern /*@observer@*/ uentryList ctype_getFields (ctype p_c) /*@*/ ;
305 ** could do some run-time checks...
308 extern cprim ctype_toCprim (ctype p_c) /*@*/ ;
310 # define ctype_toCprim(c) ((cprim) (c))
313 extern int ctype_compare (ctype p_c1, ctype p_c2) /*@*/ ;
314 extern /*@unused@*/ int ctype_count (void);
316 extern ctype ctype_makeExplicitConj (ctype p_c1, ctype p_c2);
318 extern typeId ctype_typeId (ctype p_c);
320 extern ctype ctype_fromQual (qual p_q);
321 extern bool ctype_isAnyFloat (ctype p_c);
322 extern bool ctype_isStackAllocated (ctype p_c);
324 /*@constant ctype ctype_missingParamsMarker; @*/
325 # define ctype_missingParamsMarker ((ctype)CTK_MISSINGPARAMS)
327 extern bool ctype_isMissingParamsMarker (ctype p_ct) /*@*/ ;
328 # define ctype_isMissingParamsMarker(ct) ((ct) == ctype_missingParamsMarker)
330 extern bool ctype_equal (ctype p_c1, ctype p_c2);
331 # define ctype_equal(c1,c2) ((c1) == (c2))
333 extern bool ctype_almostEqual (ctype p_c1, ctype p_c2);
335 /*@constant ctype ctype_elipsMarker; @*/
336 # define ctype_elipsMarker ((ctype) CTK_ELIPS)
338 extern bool ctype_isElips (ctype p_ct) /*@*/;
339 # define ctype_isElips(ct) ((ct) == ctype_elipsMarker)
341 extern bool ctype_isAP (ctype p_c) /*@*/ ;
342 # define ctype_isAP(c) ctype_isArrayPtr(c)
344 extern bool ctype_isDefined (ctype p_c) /*@*/ ;
345 # define ctype_isDefined(c) ((c) != ctype_undefined)
347 extern bool ctype_isKnown (ctype p_c) /*@*/ ;
348 # define ctype_isKnown(c) ((c) != CTX_UNKNOWN)
350 extern bool ctype_isSU (ctype p_c) /*@*/ ;
351 # define ctype_isSU(c) ctype_isStructorUnion(c)
353 extern bool ctype_isUndefined (ctype p_c) /*@*/ ;
354 # define ctype_isUndefined(c) ((c) == ctype_undefined)
356 extern bool ctype_isUnknown (ctype p_c) /*@*/;
357 # define ctype_isUnknown(c) ((c) == CTX_UNKNOWN)
359 extern bool ctype_isBogus (/*@sef@*/ ctype p_c) /*@*/ ;
360 # define ctype_isBogus(c) (ctype_isUndefined(c) || ctype_isUnknown(c))
363 ctype_unparseDeclaration (ctype p_c, /*@only@*/ cstring p_name);
365 extern bool ctype_sameAltTypes (ctype p_c1, ctype p_c2) /*@*/ ;
367 extern void ctype_dumpTable (FILE *p_f);
368 extern void ctype_loadTable (FILE *p_f);
369 extern void ctype_destroyMod (void);
370 extern void ctype_initTable (void);
371 extern /*@only@*/ cstring ctype_unparseTable (void);
372 extern /*@unused@*/ void ctype_printTable (void);
374 extern ctype ctype_widest (ctype, ctype) /*@*/ ;
377 extern size_t ctype_getArraySize (ctype p_c);
378 /*end drl add functions */
380 /* Should only be used in uentry.c */
381 extern bool ctype_isUserBool (ctype p_ct) /*@*/ ;
384 # error "Multiple include"