int show;
int level;
{
- char *name;
register int len;
register int i;
struct type *index_type;
case TYPE_CODE_PTR:
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
{
- fprintf_filtered (stream, "PTR");
+ fprintf_filtered (stream,
+ TYPE_NAME (type) ? TYPE_NAME (type) : "PTR");
break;
}
fprintf_filtered (stream, "REF ");
break;
case TYPE_CODE_BOOL:
- fprintf_filtered (stream, "BOOL");
+ /* FIXME: we should probably just print the TYPE_NAME, in case
+ anyone ever fixes the compiler to give us the real names
+ in the presence of the chill equivalent of typedef (assuming
+ there is one). */
+ fprintf_filtered (stream,
+ TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
break;
case TYPE_CODE_ARRAY:
chill_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
break;
+ case TYPE_CODE_BITSTRING:
+ fprintf_filtered (stream, "BOOLS (%d)",
+ TYPE_FIELD_BITPOS (TYPE_FIELD_TYPE(type,0), 1) + 1);
+ break;
+
case TYPE_CODE_SET:
fputs_filtered ("POWERSET ", stream);
- chill_print_type (TYPE_FIELD_TYPE (type, 0), "", stream, show, level);
+ chill_print_type (TYPE_INDEX_TYPE (type), "", stream,
+ show - 1, level);
break;
case TYPE_CODE_STRING:
range_type = TYPE_FIELD_TYPE (type, 0);
index_type = TYPE_TARGET_TYPE (range_type);
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
- fputs_filtered ("CHAR (", stream);
+ fputs_filtered ("CHARS (", stream);
print_type_scalar (index_type, high_bound + 1, stream);
fputs_filtered (")", stream);
break;
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_FUNC:
- fprintf_filtered (stream, "PROC (?)");
- chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ fprintf_filtered (stream, "PROC (");
+ len = TYPE_NFIELDS (type);
+ for (i = 0; i < len; i++)
+ {
+ struct type *param_type = TYPE_FIELD_TYPE (type, i);
+ if (i > 0)
+ {
+ fputs_filtered (", ", stream);
+ wrap_here (" ");
+ }
+ if (TYPE_CODE (param_type) == TYPE_CODE_REF)
+ {
+ chill_type_print_base (TYPE_TARGET_TYPE (param_type),
+ stream, show, level);
+ fputs_filtered (" LOC", stream);
+ }
+ else
+ chill_type_print_base (param_type, stream, show, level);
+ }
+ fprintf_filtered (stream, ")");
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ {
+ fputs_filtered (" RETURNS (", stream);
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ fputs_filtered (")", stream);
+ }
break;
case TYPE_CODE_STRUCT:
- fprintf_filtered (stream, "STRUCT ");
- if ((name = type_name_no_tag (type)) != NULL)
+ if (chill_varying_type (type))
{
- fputs_filtered (name, stream);
- fputs_filtered (" ", stream);
- wrap_here (" ");
- }
- if (show < 0)
- {
- fprintf_filtered (stream, "(...)");
+ chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
+ stream, show, level);
+ fputs_filtered (" VARYING", stream);
}
else
{
+ fprintf_filtered (stream, "STRUCT ");
+
fprintf_filtered (stream, "(\n");
if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
{
break;
case TYPE_CODE_RANGE:
- if (TYPE_TARGET_TYPE (type))
+ if (TYPE_DUMMY_RANGE (type) > 0)
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ else
{
- chill_type_print_base (TYPE_TARGET_TYPE (type),
- stream, show, level);
+ struct type *target = TYPE_TARGET_TYPE (type);
+ if (target && TYPE_NAME (target))
+ fputs_filtered (TYPE_NAME (target), stream);
+ else
+ fputs_filtered ("RANGE", stream);
+ if (target == NULL)
+ target = builtin_type_long;
fputs_filtered (" (", stream);
- print_type_scalar (TYPE_TARGET_TYPE (type),
- TYPE_FIELD_BITPOS (type, 0), stream);
+ print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
fputs_filtered (":", stream);
- print_type_scalar (TYPE_TARGET_TYPE (type),
- TYPE_FIELD_BITPOS (type, 1), stream);
+ print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
fputs_filtered (")", stream);
}
- else
- fprintf_filtered (stream, "RANGE? (%s : %d)",
- TYPE_FIELD_BITPOS (type, 0),
- TYPE_FIELD_BITPOS (type, 1));
+ break;
+
+ case TYPE_CODE_ENUM:
+ {
+ register int lastval = 0;
+ fprintf_filtered (stream, "SET (");
+ len = TYPE_NFIELDS (type);
+ for (i = 0; i < len; i++)
+ {
+ QUIT;
+ if (i) fprintf_filtered (stream, ", ");
+ wrap_here (" ");
+ fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
+ if (lastval != TYPE_FIELD_BITPOS (type, i))
+ {
+ fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
+ lastval = TYPE_FIELD_BITPOS (type, i);
+ }
+ lastval++;
+ }
+ fprintf_filtered (stream, ")");
+ }
break;
case TYPE_CODE_VOID:
case TYPE_CODE_UNDEF:
case TYPE_CODE_ERROR:
- case TYPE_CODE_ENUM:
case TYPE_CODE_UNION:
case TYPE_CODE_METHOD:
error ("missing language support in chill_type_print_base");