X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/11db3170da99e22aa0acea76debd6c7b590a629c..bb7c2085a0088f4a6b3fb68dcd0ce331f67e9a2d:/src/ctype.c diff --git a/src/ctype.c b/src/ctype.c index 0c5778c..1423bbd 100644 --- a/src/ctype.c +++ b/src/ctype.c @@ -1,6 +1,6 @@ /* ** Splint - annotation-assisted static program checker -** Copyright (C) 1994-2001 University of Virginia, +** Copyright (C) 1994-2002 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it @@ -52,12 +52,12 @@ static ctype ctype_getConjB (ctype p_c) /*@*/ ; static bool ctype_isComplex (ctype c) { - return (ctentry_isComplex (ctype_getCtentry(c))); + return (ctentry_isComplex (ctype_getCtentry (c))); } static bool ctype_isPlain (ctype c) { - return (ctentry_isPlain (ctype_getCtentry(c))); + return (ctentry_isPlain (ctype_getCtentry (c))); } static bool ctype_isBroken (ctype c) @@ -194,7 +194,7 @@ ctype_realType (ctype c) bool ctype_isSimple (ctype c) { - return (!(ctype_isPointer (c) + return (! (ctype_isPointer (c) || ctype_isArray (c) || ctype_isFunction (c))); } @@ -224,7 +224,7 @@ ctype_realishType (ctype c) else { ctype r = uentry_getRealType (usymtab_getTypeEntry - (ctype_typeId (c))); + (ctype_typeId (c))); return (r); } } @@ -381,6 +381,56 @@ ctype_baseArrayPtr (ctype c) } } +/* +** wchar_t * +*/ + +ctype +ctype_makeWideString () +{ + static ctype res = ctype_unknown; + + if (ctype_isUnknown (res)) + { + ctype wchart; + + if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t"))) + { + wchart = uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t"))); + } + else + { + wchart = ctype_char; + } + + res = ctype_makePointer (wchart); + } + + return res; +} + +bool +ctype_isWideString (ctype c) +{ + if (ctype_isPointer (c)) + { + ctype ct = ctype_baseArrayPtr (c); + + if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t"))) + { + return (ct == uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t")))); + } + else + { + return FALSE; + } + } + else + { + return FALSE; + } +} + ctype ctype_getReturnType (ctype c) { @@ -1260,7 +1310,7 @@ ctype_makeConj (ctype c1, ctype c2) if (iv == ctype_unknown) { iv = cttable_addComplex - (ctbase_makeConj (ctype_int, + (ctbase_makeConj (ctype_int, ctype_voidPointer, FALSE)); } @@ -1675,7 +1725,7 @@ ctype_typeId (ctype c) cstring ctype_unparseDeclaration (ctype c, /*@only@*/ cstring name) { - llassert (!(ctype_isElips (c) || ctype_isMissingParamsMarker (c))); + llassert (! (ctype_isElips (c) || ctype_isMissingParamsMarker (c))); if (ctype_isUnknown (c)) { @@ -1776,7 +1826,7 @@ ctype_dump (ctype c) if (ctype_isUA (c)) { cstring tname = usymtab_getTypeEntryName - (usymtab_convertId (ctype_typeId (c))); + (usymtab_convertId (ctype_typeId (c))); if (cstring_equal (tname, context_getBoolName ())) { @@ -1855,7 +1905,7 @@ ctype_adjustPointers (int np, ctype c) if (ctype_isFunction (c)) { c = ctype_makeParamsFunction - (ctype_adjustPointers (np, ctype_getReturnType (c)), + (ctype_adjustPointers (np, ctype_getReturnType (c)), uentryList_copy (ctype_argsFunction (c))); } else @@ -2612,7 +2662,7 @@ long int ctype_getArraySize (ctype c) ctbase ctb; llassert (ctype_isFixedArray (c)); - llassert ((ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind(cte) == CTK_ARRAY)); + llassert ((ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind (cte) == CTK_ARRAY)); ctb = cte->ctbase; size = ctbase_getArraySize (ctb);