replaced the different type types by one union type saving a lot of casts (and adding...
[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 function_parameter_t  function_parameter_t;
10
11 void init_types(void);
12 void exit_types(void);
13
14 void print_type(type_t *type);
15
16 /**
17  * prints a human readable form of @p type. prints an abstract typename
18  * if symbol is NULL
19  */
20 void print_type_ext(type_t *type, const symbol_t *symbol,
21                     const context_t *context);
22
23 void print_type_qualifiers(unsigned qualifiers);
24
25 void print_enum_definition(const declaration_t *declaration);
26 void print_compound_definition(const declaration_t *declaration);
27
28 /**
29  * set output stream for the type printer
30  */
31 void type_set_output(FILE *out);
32
33 void inc_type_visited(void);
34
35 void set_print_compound_entries(bool enabled);
36
37 /**
38  * returns true if type contains integer numbers
39  */
40 bool is_type_integer(const type_t *type);
41
42 /**
43  * return true if type contains signed numbers
44  */
45 bool is_type_signed(const type_t *type);
46
47 /**
48  * returns true if type contains floating point numbers
49  */
50 bool is_type_floating(const type_t *type);
51
52 /**
53  * returns true if the type is valid. A type is valid if it contains no
54  * unresolved references anymore and is not of TYPE_INVALID.
55  */
56 bool type_valid(const type_t *type);
57
58 /**
59  * returns true if the type is an arithmetic type (6.2.18)
60  */
61 bool is_type_arithmetic(const type_t *type);
62
63 /**
64  * returns true if the type is a scalar type (6.2.21)
65  */
66 bool is_type_scalar(const type_t *type);
67
68 bool is_type_incomplete(const type_t *type);
69
70 bool types_compatible(const type_t *type1, const type_t *type2);
71
72 bool pointers_compatible(const type_t *type1, const type_t *type2);
73
74 type_t *skip_typeref(type_t *type);
75
76 #endif