* ch-typeprint.c (chill_type_print_base): Get names of PTR and
authorPer Bothner <per@bothner.com>
Wed, 4 Jan 1995 01:04:15 +0000 (01:04 +0000)
committerPer Bothner <per@bothner.com>
Wed, 4 Jan 1995 01:04:15 +0000 (01:04 +0000)
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.

gdb/ChangeLog
gdb/ch-typeprint.c
gdb/ch-valprint.c

index b06c33c9f7ce8e792d290577344078b501a934b1..745e2ea17c92fd3485d1bbf619e3efefd6f0146b 100644 (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>
 
        * remote-udi.c (udi_load): Tell symbol_file_add that the
index 41a7d6fb4ea0a4c1fee462e90e8ea4faefaf5a0f..88d994d849d7df9bfbe1a0d1a2b5f0313037f08c 100644 (file)
@@ -106,7 +106,8 @@ chill_type_print_base (type, stream, show, level)
       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 ");
@@ -118,7 +119,8 @@ chill_type_print_base (type, stream, show, level)
           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, "BOOL");
+       fprintf_filtered (stream,
+                         TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL");
        break;
 
       case TYPE_CODE_ARRAY:
index 11d1a22204f46c6edf919f9b9eaab5007f98e27b..91fe4596f1995c39bcaf048ec0d0c1fc010d7443 100644 (file)
@@ -35,6 +35,30 @@ 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
@@ -99,11 +123,12 @@ chill_val_print_array_elements (type, valaddr, address, 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)
        {
          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);
@@ -323,7 +348,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
              {
                if (need_comma)
                  fputs_filtered (", ", stream);
-               print_type_scalar (range, i, stream);
+               chill_print_type_scalar (range, i, stream);
                need_comma = 1;
 
                /* 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
                           && value_bit_index (type, valaddr, ++i))
                      j = i;
-                   print_type_scalar (range, j, stream);
+                   chill_print_type_scalar (range, j, stream);
                  }
              }
          }
This page took 0.028522 seconds and 4 git commands to generate.