#include "c-lang.h" /* For c_val_print */
#include "typeprint.h"
#include "ch-lang.h"
+#include "annotate.h"
static void
chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
enum val_prettyprint, struct type **));
+\f
+/* 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);
+}
\f
/* Print the elements of an array.
Similar to val_print_array_elements, but prints
}
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)
{
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);
val_print (elttype, valaddr + i * eltlen, 0, stream, format,
deref_ref, recurse + 1, pretty);
break;
case TYPE_CODE_STRING:
- if (format && format != 's')
- {
- print_scalar_formatted (valaddr, type, format, 0, stream);
- break;
- }
i = TYPE_LENGTH (type);
LA_PRINT_STRING (stream, valaddr, i, 0);
/* Return number of characters printed, plus one for the terminating
case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
- elttype = TYPE_FIELD_TYPE (type, 0);
+ elttype = TYPE_INDEX_TYPE (type);
check_stub_type (elttype);
if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
{
{
if (need_comma)
fputs_filtered (", ", stream);
- print_type_scalar (TYPE_TARGET_TYPE (range), i, stream);
+ chill_print_type_scalar (range, i, stream);
need_comma = 1;
/* Look for a continuous range of true elements. */
while (i+1 <= high_bound
&& value_bit_index (type, valaddr, ++i))
j = i;
- print_type_scalar (TYPE_TARGET_TYPE (range), j, stream);
+ chill_print_type_scalar (range, j, stream);
}
}
}
break;
case TYPE_CODE_STRUCT:
- if (chill_is_varying_struct (type))
+ if (chill_varying_type (type))
{
struct type *inner = TYPE_FIELD_TYPE (type, 1);
long length = unpack_long (TYPE_FIELD_TYPE (type, 0), valaddr);