+Wed Feb 24 07:41:15 1993 Fred Fish (fnf@cygnus.com)
+
+ **** start-sanitize-chill ****
+ * ch-typeprint.c (chill_print_type_base): Name changed to
+ chill_type_print_base to match pattern for C and C++ names.
+ * ch-typeprint.c (chill_print_type): Change "char" to "CHAR"
+ to be consistent with other usages.
+ * ch-typeprint.c (chill_type_print_base): Add support for
+ printing Chill STRUCT types.
+ * ch-valprint.c: Include values.h.
+ * ch-valprint.c (chill_print_value_fields): New function and
+ prototype for printing Chill STRUCT values.
+ * ch-valprint.c (chill_val_print): Fix call to val_print_string
+ that was being called with two args instead of three.
+ * ch-valprint.c (chill_val_print): Call chill_print_value_fields
+ to print Chill STRUCT values.
+ **** end-sanitize-chill ****
+
Tue Feb 23 18:58:11 1993 Mike Werner (mtw@poseidon.cygnus.com)
* configure.in: added testsuite to configdirs.
#include <string.h>
#include <errno.h>
-void
-chill_print_type_base PARAMS ((struct type *, FILE *, int, int));
+static void
+chill_type_print_base PARAMS ((struct type *, FILE *, int, int));
void
chill_print_type (type, varstring, stream, show, level)
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 ("CHAR (", stream);
print_type_scalar (index_type, high_bound + 1, stream);
- fputs_filtered (") ", stream);
+ fputs_filtered (")", stream);
break;
default:
- chill_print_type_base (type, stream, show, level);
+ chill_type_print_base (type, stream, show, level);
break;
}
}
LEVEL is the depth to indent by.
We increase it for some recursive calls. */
-void
-chill_print_type_base (type, stream, show, level)
+static void
+chill_type_print_base (type, stream, show, level)
struct type *type;
FILE *stream;
int show;
int level;
{
+ char *name;
+ register int len;
+ register int i;
+
QUIT;
wrap_here (" ");
case TYPE_CODE_MEMBER:
case TYPE_CODE_REF:
case TYPE_CODE_FUNC:
- chill_print_type_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ break;
+
+ case TYPE_CODE_STRUCT:
+ fprintf_filtered (stream, "STRUCT ");
+ if ((name = type_name_no_tag (type)) != NULL)
+ {
+ fputs_filtered (name, stream);
+ fputs_filtered (" ", stream);
+ wrap_here (" ");
+ }
+ if (show < 0)
+ {
+ fprintf_filtered (stream, "(...)");
+ }
+ else
+ {
+ check_stub_type (type);
+ fprintf_filtered (stream, "(\n");
+ if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
+ {
+ if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
+ {
+ fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
+ }
+ else
+ {
+ fprintfi_filtered (level + 4, stream, "<no data fields>\n");
+ }
+ }
+ else
+ {
+ len = TYPE_NFIELDS (type);
+ for (i = TYPE_N_BASECLASSES (type); i < len; i++)
+ {
+ QUIT;
+ print_spaces_filtered (level + 4, stream);
+ chill_print_type (TYPE_FIELD_TYPE (type, i),
+ TYPE_FIELD_NAME (type, i),
+ stream, show - 1, level + 4);
+ if (i < (len - 1))
+ {
+ fputs_filtered (",", stream);
+ }
+ fputs_filtered ("\n", stream);
+ }
+ }
+ fprintfi_filtered (level, stream, ")");
+ }
break;
case TYPE_CODE_VOID:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
case TYPE_CODE_UNION:
- case TYPE_CODE_STRUCT:
case TYPE_CODE_METHOD:
- error ("missing language support in chill_print_type_base");
+ error ("missing language support in chill_type_print_base");
break;
default:
#include "gdbtypes.h"
#include "valprint.h"
#include "expression.h"
+#include "value.h"
#include "language.h"
+static void
+chill_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
+ enum val_prettyprint, struct type **));
+
\f
/* Print data of type TYPE located at VALADDR (within GDB), which came from
the inferior at address ADDRESS, onto stdio stream STREAM according to
In that case don't try to print the string. */
print_max < UINT_MAX)
{
- i = val_print_string (addr, stream);
+ i = val_print_string (addr, 0, stream);
}
/* Return number of characters printed, plus one for the
terminating null if we have "reached the end". */
return (i + (print_max && i != print_max));
break;
+ case TYPE_CODE_STRUCT:
+ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
+ 0);
+ break;
+
case TYPE_CODE_MEMBER:
case TYPE_CODE_REF:
case TYPE_CODE_UNION:
- case TYPE_CODE_STRUCT:
case TYPE_CODE_ENUM:
case TYPE_CODE_FUNC:
case TYPE_CODE_VOID:
fflush (stream);
return (0);
}
+
+/* Mutually recursive subroutines of cplus_print_value and c_val_print to
+ print out a structure's fields: cp_print_value_fields and cplus_print_value.
+
+ TYPE, VALADDR, STREAM, RECURSE, and PRETTY have the
+ same meanings as in cplus_print_value and c_val_print.
+
+ DONT_PRINT is an array of baseclass types that we
+ should not print, or zero if called from top level. */
+
+static void
+chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
+ dont_print)
+ struct type *type;
+ char *valaddr;
+ FILE *stream;
+ int format;
+ int recurse;
+ enum val_prettyprint pretty;
+ struct type **dont_print;
+{
+ int i, len;
+ int fields_seen = 0;
+
+ check_stub_type (type);
+
+ fprintf_filtered (stream, "(");
+ len = TYPE_NFIELDS (type);
+ if (len == 0)
+ {
+ fprintf_filtered (stream, "<No data fields>");
+ }
+ else
+ {
+ for (i = 0; i < len; i++)
+ {
+ if (fields_seen)
+ {
+ fprintf_filtered (stream, ", ");
+ }
+ fields_seen = 1;
+ if (pretty)
+ {
+ fprintf_filtered (stream, "\n");
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ else
+ {
+ wrap_here (n_spaces (2 + 2 * recurse));
+ }
+ fprint_symbol (stream, TYPE_FIELD_NAME (type, i));
+ fputs_filtered (" = ", stream);
+ if (TYPE_FIELD_PACKED (type, i))
+ {
+ value v;
+
+ /* Bitfields require special handling, especially due to byte
+ order problems. */
+ v = value_from_longest (TYPE_FIELD_TYPE (type, i),
+ unpack_field_as_long (type, valaddr, i));
+
+ chill_val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0,
+ stream, format, 0, recurse + 1, pretty);
+ }
+ else
+ {
+ chill_val_print (TYPE_FIELD_TYPE (type, i),
+ valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
+ 0, stream, format, 0, recurse + 1, pretty);
+ }
+ }
+ if (pretty)
+ {
+ fprintf_filtered (stream, "\n");
+ print_spaces_filtered (2 * recurse, stream);
+ }
+ }
+ fprintf_filtered (stream, ")");
+}
+