fix stabs.texinfo xref bugs
[deliverable/binutils-gdb.git] / gdb / gdbtypes.h
index fa1eb73bd9ff8d11d51ab5e39f4cdbbc54f88b69..a28bf900ecb3ba5d15c27f3a93d04e6babc19faf 100644 (file)
@@ -51,8 +51,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define FT_STRING              23
 #define FT_FIXED_DECIMAL       24
 #define FT_FLOAT_DECIMAL       25
+#define FT_BYTE                        26
+#define FT_UNSIGNED_BYTE       27
 
-#define FT_NUM_MEMBERS         26
+#define FT_NUM_MEMBERS         28      /* Highest FT_* above, plus one. */
+
+/* Some macros for char-based bitfields.  */
+
+#define B_SET(a,x)     ((a)[(x)>>3] |= (1 << ((x)&7)))
+#define B_CLR(a,x)     ((a)[(x)>>3] &= ~(1 << ((x)&7)))
+#define B_TST(a,x)     ((a)[(x)>>3] & (1 << ((x)&7)))
+#define B_TYPE         unsigned char
+#define        B_BYTES(x)      ( 1 + ((x)>>3) )
+#define        B_CLRALL(a,x)   memset ((a), 0, B_BYTES(x))
 
 /* Different kinds of data types are distinguished by the `code' field.  */
 
@@ -60,7 +71,7 @@ enum type_code
 {
   TYPE_CODE_UNDEF,             /* Not used; catches errors */
   TYPE_CODE_PTR,               /* Pointer type */
-  TYPE_CODE_ARRAY,             /* Array type, lower bound zero */
+  TYPE_CODE_ARRAY,             /* Array type with lower & upper bounds. */
   TYPE_CODE_STRUCT,            /* C struct or Pascal record */
   TYPE_CODE_UNION,             /* C union or Pascal variant part */
   TYPE_CODE_ENUM,              /* Enumeration type */
@@ -70,7 +81,8 @@ enum type_code
   TYPE_CODE_VOID,              /* Void type (values zero length) */
   TYPE_CODE_SET,               /* Pascal sets */
   TYPE_CODE_RANGE,             /* Range (integers within spec'd bounds) */
-  TYPE_CODE_PASCAL_ARRAY,      /* Array with explicit type of index */
+  TYPE_CODE_STRING,            /* String types, distinct from array of char */
+  TYPE_CODE_BITSTRING,         /* String of bits, distinct from bool array */
   TYPE_CODE_ERROR,              /* Unknown type */
 
   /* C++ */
@@ -80,9 +92,15 @@ enum type_code
 
   /* Modula-2 */
   TYPE_CODE_CHAR,              /* *real* character type */
-  TYPE_CODE_BOOL               /* Builtin Modula-2 BOOLEAN */
+  TYPE_CODE_BOOL               /* BOOLEAN type */
 };
 
+/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
+   alias for TYPE_CODE_STRUCT.  Eventually these should probably be
+   officially distinct types within gdb. */
+
+#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
+
 /* Some bits for the type's flags word. */
 
 /* Explicitly unsigned integer type */
@@ -171,6 +189,9 @@ struct type
      For range types, there are two "fields",
      the minimum and maximum values (both inclusive).
      For enum types, each possible value is described by one "field".
+     For C++ classes, there is one field for each base class (if it is
+     a derived class) plus one field for each class data member.  Member
+     functions are recorded elsewhere.
 
      Using a pointer to a separate array of fields
      allows all types to have the same size, which is useful
@@ -184,6 +205,7 @@ struct type
         containing structure.  For a function type, this is the
         position in the argument list of this argument.
         For a range bound or enum value, this is the value itself.
+        (FIXME:  What about ranges larger than host int size?)
         For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB.
         For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB. */
 
@@ -260,10 +282,17 @@ struct cplus_struct_type
 
   int nfn_fields_total;
 
-  /* For derived classes, the number of base classes is given by
-     n_baseclasses and virtual_field_bits is a bit vector containing one bit
-     per base class.
-     If the base class is virtual, the corresponding bit will be set. */
+  /* For derived classes, the number of base classes is given by n_baseclasses
+     and virtual_field_bits is a bit vector containing one bit per base class.
+     If the base class is virtual, the corresponding bit will be set.
+     I.E, given:
+
+       class A{};
+       class B{};
+       class C : public B, public virtual A {};
+
+     B is a baseclass of C; A is a virtual baseclass for C.
+     This is a C++ 2.0 language feature. */
 
   B_TYPE *virtual_field_bits;
 
@@ -456,6 +485,7 @@ extern struct type *builtin_type_double;
 extern struct type *builtin_type_long_double;
 extern struct type *builtin_type_complex;
 extern struct type *builtin_type_double_complex;
+extern struct type *builtin_type_string;
 
 /* This type represents a type that was unrecognized in symbol
    read-in.  */
@@ -473,6 +503,14 @@ extern struct type *builtin_type_m2_card;
 extern struct type *builtin_type_m2_real;
 extern struct type *builtin_type_m2_bool;
 
+/* Chill types */
+
+extern struct type *builtin_type_chill_bool;
+extern struct type *builtin_type_chill_char;
+extern struct type *builtin_type_chill_long;
+extern struct type *builtin_type_chill_ulong;
+extern struct type *builtin_type_chill_real;
+
 /* LONG_LONG is defined if the host has "long long".  */
 
 #ifdef LONG_LONG
@@ -497,6 +535,20 @@ extern struct type *builtin_type_m2_bool;
    TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
     : MIN_OF_SIZE(TYPE_LENGTH(t))
 
+/* Allocate space for storing data associated with a particular type.
+   We ensure that the space is allocated using the same mechanism that
+   was used to allocate the space for the type structure itself.  I.E.
+   if the type is on an objfile's type_obstack, then the space for data
+   associated with that type will also be allocated on the type_obstack.
+   If the type is not associated with any particular objfile (such as
+   builtin types), then the data space will be allocated with xmalloc,
+   the same as for the type structure. */
+
+#define TYPE_ALLOC(t,size)  \
+   (TYPE_OBJFILE (t) != NULL  \
+    ? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \
+    : xmalloc (size))
+
 extern struct type *
 alloc_type PARAMS ((struct objfile *));
 
@@ -541,7 +593,13 @@ extern struct type *
 lookup_function_type PARAMS ((struct type *));
 
 extern struct type *
-create_array_type PARAMS ((struct type *, int));
+create_range_type PARAMS ((struct type *, struct type *, int, int));
+
+extern struct type *
+create_array_type PARAMS ((struct type *, struct type *, struct type *));
+
+extern struct type *
+create_string_type PARAMS ((struct type *, struct type *));
 
 extern struct type *
 lookup_unsigned_typename PARAMS ((char *));
This page took 0.027206 seconds and 4 git commands to generate.