* ch-typeprint.c (chill_type_print_base): Get names of PTR and

BOOL from TYPE_NAME.
	* ch-valprint.c (chill_print_type_scalar):  New function, to handle
	TYPE_CODE_RANGE better than print_type_scalar does.
	(chill_val_print_array_elements):  Use above new function.
This commit is contained in:
Per Bothner 1995-01-04 01:04:15 +00:00
parent cb527fd504
commit 3bcf418186
3 changed files with 41 additions and 6 deletions

View File

@ -1,3 +1,11 @@
Tue Jan 3 16:52:03 1995 Per Bothner <bothner@kalessin.cygnus.com>
* ch-typeprint.c (chill_type_print_base): Get names of PTR and
BOOL from TYPE_NAME.
* ch-valprint.c (chill_print_type_scalar): New function, to handle
TYPE_CODE_RANGE better than print_type_scalar does.
(chill_val_print_array_elements): Use above new function.
Mon Jan 2 15:02:51 1995 Stan Shebs <shebs@andros.cygnus.com> Mon Jan 2 15:02:51 1995 Stan Shebs <shebs@andros.cygnus.com>
* remote-udi.c (udi_load): Tell symbol_file_add that the * remote-udi.c (udi_load): Tell symbol_file_add that the

View File

@ -106,7 +106,8 @@ chill_type_print_base (type, stream, show, level)
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID) 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; break;
} }
fprintf_filtered (stream, "REF "); fprintf_filtered (stream, "REF ");
@ -118,7 +119,8 @@ chill_type_print_base (type, stream, show, level)
anyone ever fixes the compiler to give us the real names anyone ever fixes the compiler to give us the real names
in the presence of the chill equivalent of typedef (assuming in the presence of the chill equivalent of typedef (assuming
there is one). */ there is one). */
fprintf_filtered (stream, "BOOL"); fprintf_filtered (stream,
TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
break; break;
case TYPE_CODE_ARRAY: case TYPE_CODE_ARRAY:

View File

@ -35,6 +35,30 @@ static void
chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int, chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
enum val_prettyprint, struct type **)); enum val_prettyprint, struct type **));
/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
Used to print data from type structures in a specified type. For example,
array bounds may be characters or booleans in some languages, and this
allows the ranges to be printed in their "natural" form rather than as
decimal integer values. */
void
chill_print_type_scalar (type, val, stream)
struct type *type;
LONGEST val;
GDB_FILE *stream;
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE:
if (TYPE_TARGET_TYPE (type))
{
chill_print_type_scalar (TYPE_TARGET_TYPE (type), val, stream);
return;
}
}
print_type_scalar (type, val, stream);
}
/* Print the elements of an array. /* Print the elements of an array.
Similar to val_print_array_elements, but prints Similar to val_print_array_elements, but prints
@ -99,11 +123,12 @@ chill_val_print_array_elements (type, valaddr, address, stream,
} }
fputs_filtered ("(", stream); fputs_filtered ("(", stream);
print_type_scalar (index_type, low_bound + i, stream); chill_print_type_scalar (index_type, low_bound + i, stream);
if (reps > 1) if (reps > 1)
{ {
fputs_filtered (":", stream); fputs_filtered (":", stream);
print_type_scalar (index_type, low_bound + i + reps - 1, stream); chill_print_type_scalar (index_type, low_bound + i + reps - 1,
stream);
fputs_filtered ("): ", stream); fputs_filtered ("): ", stream);
val_print (elttype, valaddr + i * eltlen, 0, stream, format, val_print (elttype, valaddr + i * eltlen, 0, stream, format,
deref_ref, recurse + 1, pretty); deref_ref, recurse + 1, pretty);
@ -323,7 +348,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{ {
if (need_comma) if (need_comma)
fputs_filtered (", ", stream); fputs_filtered (", ", stream);
print_type_scalar (range, i, stream); chill_print_type_scalar (range, i, stream);
need_comma = 1; need_comma = 1;
/* Look for a continuous range of true elements. */ /* Look for a continuous range of true elements. */
@ -334,7 +359,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
while (i+1 <= high_bound while (i+1 <= high_bound
&& value_bit_index (type, valaddr, ++i)) && value_bit_index (type, valaddr, ++i))
j = i; j = i;
print_type_scalar (range, j, stream); chill_print_type_scalar (range, j, stream);
} }
} }
} }