- reworked handling environments and struct, union, enum namespace
[cparser] / type.h
1 #ifndef TYPE_H
2 #define TYPE_H
3
4 #include <stdio.h>
5 #include <stdbool.h>
6 #include "symbol.h"
7
8 typedef struct type_t              type_t;
9 typedef struct atomic_type_t       atomic_type_t;
10 typedef struct pointer_type_t      pointer_type_t;
11 typedef struct method_parameter_t  method_parameter_t;
12 typedef struct method_type_t       method_type_t;
13 typedef struct compound_type_t     compound_type_t;
14 typedef struct enum_type_t         enum_type_t;
15 typedef struct builtin_type_t      builtin_type_t;
16 typedef struct array_type_t        array_type_t;
17 typedef struct typedef_type_t      typedef_type_t;
18 typedef struct typeof_type_t       typeof_type_t;
19
20 void init_types(void);
21 void exit_types(void);
22
23 void print_type(type_t *type);
24
25 /**
26  * prints a human readable form of @p type. prints an abstract typename
27  * if symbol is NULL
28  */
29 void print_type_ext(type_t *type, const symbol_t *symbol,
30                     const context_t *context);
31
32 void print_enum_definition(const declaration_t *declaration);
33 void print_compound_definition(const declaration_t *declaration);
34
35 /**
36  * set output stream for the type printer
37  */
38 void type_set_output(FILE *out);
39
40 void inc_type_visited(void);
41
42 void set_print_compound_entries(bool enabled);
43
44
45 /**
46  * returns true if type contains integer numbers
47  */
48 bool is_type_integer(const type_t *type);
49
50 /**
51  * returns true if type contains floating point numbers
52  */
53 bool is_type_floating(const type_t *type);
54
55 /**
56  * returns true if the type is valid. A type is valid if it contains no
57  * unresolved references anymore and is not of TYPE_INVALID.
58  */
59 bool type_valid(const type_t *type);
60
61 /**
62  * returns true if the type is an arithmetic type (6.2.18)
63  */
64 bool is_type_arithmetic(const type_t *type);
65
66 /**
67  * returns true if the type is a scalar type (6.2.21)
68  */
69 bool is_type_scalar(const type_t *type);
70
71 #endif