* f-exp.y: Symbol '%' is not used as the modulus operator in

Fortran.  Delete this from Fortran expression.
	It is now used by Fortran 90 and later to access the member
	of derived type.  Add this into Fortran expression.
	* f-valprint.c (f_val_print): Add code to handle TYPE_CODE_STRUCT.
	Print each elements in the derived type.
	* f-typeprint.c (print_equivalent_f77_float_type): Add a parameter
	level into the function definition to do indented printing.  And
	call fprintfi_filtered instead to do indented printing.
	(f_type_print_base): Replace fprintf_filtered with the indented
	version (fprintfi_filtered).
	(f_type_print_base): Call indented print_equivalent_f77_float_type.
	(f_type_print_base): Add code to handle TYPE_CODE_STRUCT.  Print
	the definition of the derived type.
This commit is contained in:
Wu Zhou
2006-02-24 07:26:10 +00:00
parent 4e219700c3
commit 2a5e440cb4
4 changed files with 81 additions and 21 deletions

View File

@ -366,6 +366,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
struct type *elttype;
LONGEST val;
CORE_ADDR addr;
int index;
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
@ -583,6 +584,22 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
fprintf_filtered (stream, "<incomplete type>");
break;
case TYPE_CODE_STRUCT:
/* Starting from the Fortran 90 standard, Fortran supports derived
types. */
fprintf_filtered (stream, "{ ");
for (index = 0; index < TYPE_NFIELDS (type); index++)
{
int offset = TYPE_FIELD_BITPOS (type, index) / 8;
f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset,
embedded_offset, address, stream,
format, deref_ref, recurse, pretty);
if (index != TYPE_NFIELDS (type) - 1)
fputs_filtered (", ", stream);
}
fprintf_filtered (stream, "}");
break;
default:
error (_("Invalid F77 type code %d in symbol table."), TYPE_CODE (type));
}