static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeFixedArray (ctype p_b, size_t p_size) /*@*/ ;
static bool ctbase_isAnytype (/*@notnull@*/ ctbase p_b) /*@*/ ;
+cstring ctbase_unparseFunctionPointer (ctbase c, /*@only@*/ cstring name) /*@*/ ;
/*
** These are file-static macros (used in ctype.c). No way to
** declare them as static in C.
# define ctentry_setPtr(c,b) ((c)->ptr = (b))
# define ctbase_fixUser(c) (c = ctbase_realType(c))
+
+/*drl added 04/14/2002 */
+# define ctentry_getCtbase(c) ((c)->ctbase)
/*@=allmacros@*/ /*@=macrospec@*/ /*@=namechecks@*/
static ctype cttable_addComplex (/*@notnull@*/ /*@only@*/ ctbase p_cnew);
return (message ("%t *", c->contents.base));
}
case CT_FIXEDARRAY:
- return (message ("%t [%d]",
- c->contents.farray->base,
- (int) c->contents.farray->size));
+ if (ctype_isFixedArray ( c->contents.farray->base ) &&(willOutputCode) )
+
+ {
+ cstring tmp, tmp2, ret;
+
+ tmp = ctype_unparse( c->contents.farray->base);
+ tmp2 = cstring_beforeChar(tmp, '[');
+
+ ret = message("%q [%d] %s ",
+ tmp2,
+ c->contents.farray->size,
+ cstring_afterChar(tmp, '[')
+ );
+ return ret;
+ }
+
+ else
+ {
+ return (message ("%t [%d]",
+ c->contents.farray->base,
+ (int) c->contents.farray->size));
+ }
+
case CT_ARRAY:
return (message ("%t []", c->contents.base));
case CT_FCN:
else
{
return (message ("struct { %q }",
- uentryList_unparseAbbrev (c->contents.su->fields)));
+ uentryList_unparse (c->contents.su->fields)));
}
case CT_UNION:
if (cstring_isDefined (c->contents.su->name) &&
uentryList_unparse (c->contents.fcn->params),
c->contents.fcn->rval));
case CT_STRUCT:
+ if (context_getFlag(FLG_GENERATECODE) )
+ {
+ DPRINTF( (message("struct %s { %s }", c->contents.su->name, uentryList_unparse(c->contents.su->fields) ) ));
+ }
return (message ("struct %s { ... } ", c->contents.su->name));
case CT_UNION:
return (message ("union %s { ... }", c->contents.su->name));
case CT_PTR:
if (ctype_isFunction (c->contents.base))
{
- return ctbase_unparseDeclaration (ctype_getCtbase (c->contents.base), name);
+ return ctbase_unparseFunctionPointer (ctype_getCtbase (c->contents.base), name);
}
else
{
BADEXIT;
}
+
+
+/*drl added 04/22/2002*/
+ /*@only@*/ cstring
+ctbase_doUnparseFunctionPointer (ctbase c, /*@only@*/ cstring name, cstring quals) /*@*/
+{
+ cstring s;
+
+ if (ctbase_isUndefined (c))
+ {
+ return name;
+ }
+
+ if (c->type == CT_FCN)
+ {
+ s = message ("%s (*%q)(%q)", quals, name,
+ uentryList_unparseParamsComplete (c->contents.fcn->params));
+
+ return (ctbase_unparseDeclaration
+ (ctype_getCtbase (c->contents.fcn->rval), s));
+ }
+ else
+ {
+ llassert (c->type == CT_PTR);
+ llassert(FALSE);
+ // s = message("%q", ctype_unparseFunction ( c->contents.base, name) );
+
+ s = message("%q", ctbase_unparse /*Declaration*/ (c) /* name)*/ );
+ return s;
+
+ }
+}
+
+
+/*drl added 04/22/2002*/
+ /*@only@*/ cstring
+ctbase_unparseFunctionPointer (ctbase c, /*@only@*/ cstring name) /*@*/
+{
+ cstring s;
+
+ if (ctbase_isUndefined (c))
+ {
+ return name;
+ }
+
+ if (c->type == CT_FCN)
+ {
+ // llassert(FALSE);
+ s = message ("(*%q)(%q)", name,
+ uentryList_unparseParamsComplete (c->contents.fcn->params));
+
+ return (ctbase_unparseDeclaration
+ (ctype_getCtbase (c->contents.fcn->rval), s));
+ }
+ else
+ {
+ llassert (c->type == CT_PTR);
+ s = message("%q", ctype_unparseFunction ( c->contents.base, name) );
+
+ // s = message("%q", ctbase_unparse /*Declaration*/ (c) /* name)*/ );
+ return s;
+
+ }
+}
+
+
+/*drl added 3/10/2002*/
+
+ /*@only@*/ cstring
+ctbase_unparseFunction (ctbase c, /*@only@*/ cstring name) /*@*/
+{
+ cstring s;
+
+ if (ctbase_isUndefined (c))
+ {
+ return name;
+ }
+
+ if (c->type == CT_FCN)
+ {
+ s = message ("%q(%q)", name,
+ uentryList_unparseParamsComplete (c->contents.fcn->params));
+
+ return (ctbase_unparseDeclaration
+ (ctype_getCtbase (c->contents.fcn->rval), s));
+ }
+ else
+ {
+
+ llassert (c->type == CT_PTR);
+
+
+ s = message("%q", ctbase_unparse /*Declaration*/ (c) /* name)*/ );
+ return s;
+
+ }
+}
+
+
static ctbase ctbase_undump (d_char *c) /*@requires maxRead(*c) >= 2 @*/
{
ctbase res;