31 * TYPE new_subr_t : INT (4..5); END_TYPE; |
31 * TYPE new_subr_t : INT (4..5); END_TYPE; |
32 * |
32 * |
33 * new_int_t is really an INT!! |
33 * new_int_t is really an INT!! |
34 * new_int2_t is also really an INT!! |
34 * new_int2_t is also really an INT!! |
35 * new_subr_t is also really an INT!! |
35 * new_subr_t is also really an INT!! |
|
36 * |
|
37 * Note that a FB declaration is also considered a base type, as |
|
38 * we may have FB instances declared of a specific FB type. |
36 */ |
39 */ |
37 #include "absyntax_utils.hh" |
40 #include "absyntax_utils.hh" |
38 |
41 |
39 #define ERROR error_exit(__FILE__,__LINE__) |
42 #define ERROR error_exit(__FILE__,__LINE__) |
40 /* function defined in main.cc */ |
43 /* function defined in main.cc */ |
64 bool search_base_type_c::type_is_enumerated(symbol_c* type_decl) { |
67 bool search_base_type_c::type_is_enumerated(symbol_c* type_decl) { |
65 this->is_enumerated = false; |
68 this->is_enumerated = false; |
66 type_decl->accept(*this); |
69 type_decl->accept(*this); |
67 return this->is_enumerated; |
70 return this->is_enumerated; |
68 } |
71 } |
|
72 |
|
73 /*********************/ |
|
74 /* B 1.2 - Constants */ |
|
75 /*********************/ |
|
76 |
|
77 /******************************/ |
|
78 /* B 1.2.1 - Numeric Literals */ |
|
79 /******************************/ |
|
80 /* Numeric literals without any explicit type cast have unknown data type, |
|
81 * so we continue considering them as their own basic data types until |
|
82 * they can be resolved (for example, when using '30+x' where 'x' is a LINT variable, the |
|
83 * numeric literal '30' must then be considered a LINT so the ADD function may be called |
|
84 * with all inputs of the same data type. |
|
85 * If 'x' were a SINT, then the '30' would have to be a SINT too! |
|
86 */ |
|
87 void *search_base_type_c::visit(real_c *symbol) {return (void *)symbol;} |
|
88 void *search_base_type_c::visit(integer_c *symbol) {return (void *)symbol;} |
|
89 void *search_base_type_c::visit(binary_integer_c *symbol) {return (void *)symbol;} |
|
90 void *search_base_type_c::visit(octal_integer_c *symbol) {return (void *)symbol;} |
|
91 void *search_base_type_c::visit(hex_integer_c *symbol) {return (void *)symbol;} |
|
92 |
69 |
93 |
70 /***********************************/ |
94 /***********************************/ |
71 /* B 1.3.1 - Elementary Data Types */ |
95 /* B 1.3.1 - Elementary Data Types */ |
72 /***********************************/ |
96 /***********************************/ |
73 void *search_base_type_c::visit(time_type_name_c *symbol) {return (void *)symbol;} |
97 void *search_base_type_c::visit(time_type_name_c *symbol) {return (void *)symbol;} |
89 void *search_base_type_c::visit(word_type_name_c *symbol) {return (void *)symbol;} |
113 void *search_base_type_c::visit(word_type_name_c *symbol) {return (void *)symbol;} |
90 void *search_base_type_c::visit(dword_type_name_c *symbol) {return (void *)symbol;} |
114 void *search_base_type_c::visit(dword_type_name_c *symbol) {return (void *)symbol;} |
91 void *search_base_type_c::visit(lword_type_name_c *symbol) {return (void *)symbol;} |
115 void *search_base_type_c::visit(lword_type_name_c *symbol) {return (void *)symbol;} |
92 void *search_base_type_c::visit(string_type_name_c *symbol) {return (void *)symbol;} |
116 void *search_base_type_c::visit(string_type_name_c *symbol) {return (void *)symbol;} |
93 void *search_base_type_c::visit(wstring_type_name_c *symbol) {return (void *)symbol;} |
117 void *search_base_type_c::visit(wstring_type_name_c *symbol) {return (void *)symbol;} |
94 void *search_base_type_c::visit(constant_int_type_name_c *symbol) {return (void *)symbol;} |
118 /* |
95 void *search_base_type_c::visit(constant_real_type_name_c *symbol) {return (void *)symbol;} |
119 void *search_base_type_c::visit(constant_int_type_name_c *symbol) {return (void *)symbol;} |
|
120 void *search_base_type_c::visit(constant_real_type_name_c *symbol) {return (void *)symbol;} |
|
121 */ |
96 /******************************************************/ |
122 /******************************************************/ |
97 /* Extensions to the base standard as defined in */ |
123 /* Extensions to the base standard as defined in */ |
98 /* "Safety Software Technical Specification, */ |
124 /* "Safety Software Technical Specification, */ |
99 /* Part 1: Concepts and Function Blocks, */ |
125 /* Part 1: Concepts and Function Blocks, */ |
100 /* Version 1.0 – Official Release" */ |
126 /* Version 1.0 – Official Release" */ |
230 string_type_declaration_size, |
256 string_type_declaration_size, |
231 string_type_declaration_init) // may be == NULL! |
257 string_type_declaration_init) // may be == NULL! |
232 */ |
258 */ |
233 void *search_base_type_c::visit(string_type_declaration_c *symbol) {return symbol;} |
259 void *search_base_type_c::visit(string_type_declaration_c *symbol) {return symbol;} |
234 |
260 |
|
261 |
|
262 |
|
263 /*****************************/ |
|
264 /* B 1.5.2 - Function Blocks */ |
|
265 /*****************************/ |
|
266 /* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
|
267 // SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body) |
|
268 void *search_base_type_c::visit(function_block_declaration_c *symbol) { |
|
269 return symbol; |
|
270 } |
|
271 |