Initial import of c parser
[cparser] / type_t.h
1 #ifndef TYPE_T_H
2 #define TYPE_T_H
3
4 #include "type.h"
5 #include "symbol.h"
6 #include "lexer_t.h"
7 #include "adt/obst.h"
8
9 struct obstack *type_obst;
10
11 typedef enum {
12         TYPE_INVALID,
13         TYPE_ATOMIC,
14         TYPE_COMPOUND_STRUCT,
15         TYPE_COMPOUND_UNION,
16         TYPE_ENUM,
17         TYPE_TYPEDEF,
18         TYPE_METHOD,
19         TYPE_POINTER
20 } type_type_t;
21
22 typedef enum {
23         ATOMIC_TYPE_INVALID,
24         ATOMIC_TYPE_VOID,
25         ATOMIC_TYPE_CHAR,
26         ATOMIC_TYPE_SCHAR,
27         ATOMIC_TYPE_UCHAR,
28         ATOMIC_TYPE_SHORT,
29         ATOMIC_TYPE_USHORT,
30         ATOMIC_TYPE_INT,
31         ATOMIC_TYPE_UINT,
32         ATOMIC_TYPE_LONG,
33         ATOMIC_TYPE_ULONG,
34         ATOMIC_TYPE_LONGLONG,
35         ATOMIC_TYPE_ULONGLONG,
36         ATOMIC_TYPE_FLOAT,
37         ATOMIC_TYPE_DOUBLE,
38         ATOMIC_TYPE_LONG_DOUBLE,
39         ATOMIC_TYPE_BOOL,
40 #ifdef PROVIDE_COMPLEX
41         ATOMIC_TYPE_FLOAT_COMPLEX,
42         ATOMIC_TYPE_DOUBLE_COMPLEX,
43         ATOMIC_TYPE_LONG_DOUBLE_COMPLEX,
44 #endif
45 #ifdef PROVIDE_IMAGINARY
46         ATOMIC_TYPE_FLOAT_IMAGINARY,
47         ATOMIC_TYPE_DOUBLE_IMAGINARY,
48         ATOMIC_TYPE_LONG_DOUBLE_IMAGINARY,
49 #endif
50 } atomic_type_type_t;
51
52 struct type_t {
53         type_type_t  type;
54 };
55
56 struct atomic_type_t {
57         type_t              type;
58         atomic_type_type_t  atype;
59 };
60
61 struct pointer_type_t {
62         type_t   type;
63         type_t  *points_to;
64 };
65
66 struct method_parameter_type_t {
67         type_t                  *type;
68         method_parameter_type_t *next;
69 };
70
71 struct method_type_t {
72         type_t                   type;
73         type_t                  *result_type;
74         method_parameter_type_t *parameter_types;
75         const char              *abi_style;
76 };
77
78 struct compound_entry_t {
79         type_t            *type;
80         symbol_t          *symbol;
81         compound_entry_t  *next;
82         source_position_t  source_position;
83 };
84
85 struct compound_type_t {
86         type_t             type;
87         compound_entry_t  *entries;
88         symbol_t          *symbol;
89         source_position_t  source_position;
90 };
91
92 #endif