static void ctype_recordConj (ctype p_c);
+
/*
** ctbase file
*/
void
ctype_dumpTable (FILE *f)
{
+ DPRINTF (("Dumping cttable!"));
cttable_dump (f);
}
r = uentry_getRealType (usymtab_getTypeEntry (ctype_typeId (c)));
}
- if (ctype_isDirectBool (r))
+ if (ctype_isManifestBool (r))
{
- if (context_canAccessBool ())
+ if (context_canAccessBool ())
{
- r = ctype_int;
+ r = context_boolImplementationType ();
}
}
{
if (ctype_isUA (c))
{
- if (ctype_isUserBool (c))
+ if (ctype_isManifestBool (c))
{
return ctype_bool;
}
ctentry ce1;
ctentry ce2;
+ /* Can't get entries for special ctypes (elips marker) */
+
+ if (ctype_isElips (c1) || ctype_isElips (c2)
+ || ctype_isMissingParamsMarker (c1) || ctype_isMissingParamsMarker (c2)) {
+ return int_compare (c1, c2);
+ }
+
ce1 = ctype_getCtentry (c1);
ce2 = ctype_getCtentry (c2);
return ((c == ctype_unknown) || (cprim_isSignedChar (ctype_toCprim (c))));
}
+/*
+** Returns true if c matches the name -booltype <bool>
+*/
+
+bool
+ctype_isManifestBool (ctype c)
+{
+ /*
+ ** Changed the meaning of ctype_isBool - evs 2000-07-24
+ ** The old meaning was very convoluted!
+ **
+ ** c is a bool if:
+ ** c == CTX_BOOL - its a direct bool
+ ** c is a user/abstract type matching the bool name
+ ** (should never occur?)
+ */
+
+ if (ctype_isDirectBool (c)) {
+ return TRUE;
+ } else if (ctype_isUA (c)) {
+ return ctype_isUserBool (c);
+ } else {
+ return FALSE;
+ }
+}
+
bool
ctype_isBool (ctype c)
{
- /*@unchecked@*/ static typeId boolType = typeId_invalid;
+ /*
+ ** Changed the meaning of ctype_isBool - evs 2000-07-24
+ ** The old meaning was very convoluted!
+ **
+ ** c is a bool if:
+ ** its a manifest bool
+ ** +boolint and ctype_isInt (c)
+ */
+ if (ctype_isManifestBool (c)) {
+ return TRUE;
+ } else if (context_msgBoolInt ()) {
+ return ctype_isInt (c);
+ } else {
+ return FALSE;
+ }
+
+# if 0
if (context_getFlag (FLG_ABSTRACTBOOL))
{
if (typeId_isInvalid (boolType))
return ((c == CTX_UNKNOWN) || (c == CTX_BOOL)
|| (context_msgBoolInt ()
&& (c == CTX_INT || (c == CTX_CHAR && context_msgCharInt ()))));
+# endif
}
bool
}
else
{
- if (ctype_isUserBool (c1))
+ if (ctype_isManifestBool (c1))
{
c1 = ctype_bool;
}
- if (ctype_isUserBool (c2))
+ if (ctype_isManifestBool (c2))
{
c2 = ctype_bool;
}
{
ctype ct;
+ DPRINTF (("Creating a struct: %s / %s",
+ n, uentryList_unparse (f)));
+
ct = cttable_addComplex (ctbase_createStruct (n, f));
+ DPRINTF (("ct: %s", ctype_unparse (ct)));
return (ct);
}
}
bool
-ctype_genMatch (ctype c1, ctype c2, bool force, bool arg, bool def)
+ctype_genMatch (ctype c1, ctype c2, bool force, bool arg, bool def, bool deep)
{
bool match;
+ DPRINTF (("Gen match: %s / %s arg: %s", ctype_unparse (c1), ctype_unparse (c2), bool_unparse (arg)));
+
if (quickMatch (c1, c2))
{
return TRUE;
}
else
{
- match = ctbase_genMatch (ctype_getCtbase (c1), ctype_getCtbase (c2), force, arg, def);
+ match = ctbase_genMatch (ctype_getCtbase (c1), ctype_getCtbase (c2), force, arg, def, deep);
return (match);
}
}
bool
ctype_matchDef (ctype c1, ctype c2)
{
+ DPRINTF (("Match def: %s / %s", ctype_unparse (c1), ctype_unparse (c2)));
+
if (quickMatch (c1, c2))
return TRUE;
if (ctype_isElips (c2))
return FALSE;
+ /*@-modobserver@*/
+ /* The call forceMatch may modify the observer params, but, we don't care. */
return (ctbase_forceMatch (ctype_getCtbase (c1), ctype_getCtbase (c2)));
+ /*@=modobserver@*/
}
bool
cstring
ctype_dump (ctype c)
{
+ DPRINTF (("Ctype dump: %s", ctype_unparse (c)));
+
if (c < 0)
{
/* Handle invalid types in a kludgey way. */
cstring_free (tname);
}
+ DPRINTF (("Returning: %d", c));
return (message ("%d", c));
}
if (dominant == ctype_lint) return ctype_ulint;
if (dominant == ctype_sint) return ctype_usint;
if (dominant == ctype_char) return ctype_uchar;
+
+ /* evs 2000-07-28: added this line */
+ if (dominant == ctype_llint) return ctype_ullint;
+
if ((dominant == ctype_uint) || dominant == ctype_uchar)
{
voptgenerror (FLG_DUPLICATEQUALS,
return c1;
}
}
+
+/*drl 11/28/2000 */
+/* requires that the type is an fixed array */
+/* return the size of the array */
+
+long int ctype_getArraySize (ctype c)
+{
+ ctentry cte = ctype_getCtentry (c);
+ ctbase ctb;
+ llassert ( (ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind(cte) == CTK_ARRAY) );
+
+ ctb = cte->ctbase;
+
+ llassert (ctbase_isDefined (ctb) );
+
+ llassert (ctb->type == CT_FIXEDARRAY);
+
+ return (ctb->contents.farray->size);
+}