type.str 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. /* TYPE DESCRIPTOR */
  7. #include "nobitfield.h"
  8. #include "dbsymtab.h"
  9. struct type {
  10. struct type *next; /* used for ARRAY and for qualifiers */
  11. short tp_fund; /* fundamental type */
  12. char tp_unsigned;
  13. char tp_typequal; /* type qualifier */
  14. int tp_align;
  15. arith tp_size; /* -1 if declared but not defined */
  16. struct type *tp_pointer; /* to POINTER */
  17. struct type *tp_array; /* to ARRAY */
  18. #ifdef DBSYMTAB
  19. int tp_dbindex;
  20. #endif
  21. #if 0
  22. /* This field is not needed now; see comment in function_of() routine. */
  23. struct type *tp_function; /* to FUNCTION */
  24. #endif
  25. union {
  26. struct {
  27. struct idf *tp__idf; /* name of STRUCT, UNION or ENUM */
  28. struct sdef *tp__sdef; /* to first selector */
  29. } tp_istagged; /* used with STRUCT, UNION & ENUM */
  30. struct {
  31. /* tp__up: from FIELD, POINTER, ARRAY or FUNCTION to fund. */
  32. struct type *tp__up;
  33. union {
  34. arith tp__nel; /* # of elements for array */
  35. /* tp__field: field descriptor if fund == FIELD */
  36. struct field *tp__field;
  37. struct {
  38. /* prototype list (pseudoproto for old_style def) */
  39. struct proto *tp__proto;
  40. struct proto *tp__pseudoproto;
  41. } tp_isfunc;
  42. } tp_f; /* FIELD or FUNCTION */
  43. } tp_nottagged; /* used with POINTER, FIELD, ARRAY & FUNCTION */
  44. } tp_union;
  45. };
  46. #define tp_idf tp_union.tp_istagged.tp__idf
  47. #define tp_sdef tp_union.tp_istagged.tp__sdef
  48. #define tp_up tp_union.tp_nottagged.tp__up
  49. #define tp_field tp_union.tp_nottagged.tp_f.tp__field
  50. #define tp_nel tp_union.tp_nottagged.tp_f.tp__nel
  51. #define tp_proto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__proto
  52. #define tp_pseudoproto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__pseudoproto
  53. /* Type qualifiers. Note: TQ_VOLATILE and TQ_CONST can be
  54. 'ored' to specify: extern const volatile int a;
  55. */
  56. #define TQ_VOLATILE 0x01
  57. #define TQ_CONST 0x02
  58. extern struct type
  59. *create_type(), *standard_type(), *construct_type(), *pointer_to(),
  60. *array_of(), *function_of(), *promoted_type();
  61. #ifndef NOBITFIELD
  62. extern struct type *field_of();
  63. #endif /* NOBITFIELD */
  64. extern struct type
  65. *schar_type, *uchar_type,
  66. *short_type, *ushort_type,
  67. *word_type, *uword_type,
  68. *int_type, *uint_type,
  69. *long_type, *ulong_type,
  70. *float_type, *double_type, *lngdbl_type,
  71. *void_type,
  72. *string_type, *funint_type, *error_type;
  73. extern struct type *pa_type; /* type.c */
  74. extern arith size_of_type(), align();
  75. /* ALLOCDEF "type" 50 */