type.str 2.4 KB

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