type.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* $Header$ */
  2. /* TYPE DESCRIPTOR */
  3. #include "nobitfield.h"
  4. struct type {
  5. struct type *next; /* used only with ARRAY */
  6. short tp_fund; /* fundamental type */
  7. char tp_unsigned;
  8. int tp_align;
  9. arith tp_size; /* -1 if declared but not defined */
  10. struct idf *tp_idf; /* name of STRUCT, UNION or ENUM */
  11. struct sdef *tp_sdef; /* to first selector */
  12. struct type *tp_up; /* from FIELD, POINTER, ARRAY
  13. or FUNCTION to fund. */
  14. struct field *tp_field; /* field descriptor if fund == FIELD */
  15. struct type *tp_pointer;/* to POINTER */
  16. struct type *tp_array; /* to ARRAY */
  17. struct type *tp_function;/* to FUNCTION */
  18. };
  19. extern struct type
  20. *create_type(), *standard_type(), *construct_type(), *pointer_to(),
  21. *array_of(), *function_of();
  22. #ifndef NOBITFIELD
  23. extern struct type *field_of();
  24. #endif NOBITFIELD
  25. extern struct type
  26. *char_type, *uchar_type,
  27. *short_type, *ushort_type,
  28. *word_type, *uword_type,
  29. *int_type, *uint_type,
  30. *long_type, *ulong_type,
  31. *float_type, *double_type,
  32. *void_type, *label_type,
  33. *string_type, *funint_type, *error_type;
  34. extern struct type *pa_type; /* type.c */
  35. extern arith size_of_type(), align();
  36. /* allocation definitions of struct type */
  37. /* ALLOCDEF "type" */
  38. extern char *st_alloc();
  39. extern struct type *h_type;
  40. #define new_type() ((struct type *) \
  41. st_alloc((char **)&h_type, sizeof(struct type)))
  42. #define free_type(p) st_free(p, h_type, sizeof(struct type))