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