author | mjsousa |
Sat, 27 Sep 2014 20:09:19 +0100 | |
changeset 932 | 061824c45a5b |
parent 930 | 96f3928ebd96 |
child 945 | 477393b00f95 |
permissions | -rw-r--r-- |
70 | 1 |
/* |
279
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
3 |
* |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
6 |
* |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
10 |
* (at your option) any later version. |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
11 |
* |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
15 |
* GNU General Public License for more details. |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
16 |
* |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
221
diff
changeset
|
19 |
* |
70 | 20 |
* |
21 |
* This code is made available on the understanding that it will not be |
|
22 |
* used in safety-critical situations without a full and competent review. |
|
23 |
*/ |
|
139
668a54686827
added missing includes on some platform (gentoo/gcc-4.3.1)
etisserant
parents:
123
diff
changeset
|
24 |
#include <stdlib.h> |
70 | 25 |
|
26 |
class generate_c_typedecl_c: public generate_c_base_c { |
|
27 |
||
121 | 28 |
protected: |
29 |
stage4out_c &s4o_incl; |
|
30 |
||
98 | 31 |
private: |
32 |
symbol_c* current_type_name; |
|
309
f93bcada0f51
Fix bug when declaring data type directly derived from array type
laurent
parents:
307
diff
changeset
|
33 |
bool array_is_derived; |
121 | 34 |
generate_c_base_c *basedecl; |
35 |
||
70 | 36 |
public: |
121 | 37 |
generate_c_typedecl_c(stage4out_c *s4o_ptr): generate_c_base_c(s4o_ptr), s4o_incl(*s4o_ptr) { |
38 |
current_typedefinition = none_td; |
|
39 |
current_basetypedeclaration = none_bd; |
|
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
40 |
current_type_name = NULL; |
121 | 41 |
basedecl = new generate_c_base_c(&s4o_incl); |
42 |
} |
|
43 |
~generate_c_typedecl_c(void) { |
|
44 |
delete basedecl; |
|
45 |
} |
|
70 | 46 |
|
98 | 47 |
typedef enum { |
48 |
none_td, |
|
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
49 |
enumerated_td, |
98 | 50 |
subrange_td, |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
51 |
array_td, |
661
f537c3315f83
Minor changes needed to build with pedantic flag.
Manuele Conti <conti.ma@alice.it>
parents:
594
diff
changeset
|
52 |
struct_td |
98 | 53 |
} typedefinition_t; |
54 |
||
55 |
typedefinition_t current_typedefinition; |
|
56 |
||
57 |
typedef enum { |
|
58 |
none_bd, |
|
59 |
subrangebasetype_bd, |
|
60 |
subrangetest_bd, |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
350
diff
changeset
|
61 |
arraysubrange_bd |
98 | 62 |
} basetypedeclaration_t; |
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
350
diff
changeset
|
63 |
|
98 | 64 |
basetypedeclaration_t current_basetypedeclaration; |
65 |
||
121 | 66 |
void *print_list_incl(list_c *list, |
67 |
std::string pre_elem_str = "", |
|
68 |
std::string inter_elem_str = "", |
|
69 |
std::string post_elem_str = "", |
|
70 |
visitor_c *visitor = NULL) { |
|
71 |
if (visitor == NULL) visitor = this; |
|
72 |
||
73 |
if (list->n > 0) { |
|
74 |
//std::cout << "generate_c_base_c::print_list(n = " << list->n << ") 000\n"; |
|
75 |
s4o_incl.print(pre_elem_str); |
|
76 |
list->elements[0]->accept(*visitor); |
|
77 |
} |
|
78 |
||
79 |
for(int i = 1; i < list->n; i++) { |
|
80 |
//std::cout << "generate_c_base_c::print_list " << i << "\n"; |
|
81 |
s4o_incl.print(inter_elem_str); |
|
82 |
list->elements[i]->accept(*visitor); |
|
83 |
} |
|
84 |
||
85 |
if (list->n > 0) |
|
86 |
s4o_incl.print(post_elem_str); |
|
87 |
||
88 |
return NULL; |
|
89 |
} |
|
90 |
||
91 |
||
70 | 92 |
/***************************/ |
93 |
/* B 0 - Programming Model */ |
|
94 |
/***************************/ |
|
95 |
/* leave for derived classes... */ |
|
96 |
||
97 |
/*************************/ |
|
98 |
/* B.1 - Common elements */ |
|
99 |
/*************************/ |
|
100 |
/*******************************************/ |
|
101 |
/* B 1.1 - Letters, digits and identifiers */ |
|
102 |
/*******************************************/ |
|
103 |
/* done in base class(es) */ |
|
104 |
||
105 |
/*********************/ |
|
106 |
/* B 1.2 - Constants */ |
|
107 |
/*********************/ |
|
108 |
/* originally empty... */ |
|
109 |
||
110 |
/******************************/ |
|
111 |
/* B 1.2.1 - Numeric Literals */ |
|
112 |
/******************************/ |
|
113 |
/* done in base class(es) */ |
|
114 |
||
115 |
/*******************************/ |
|
116 |
/* B.1.2.2 Character Strings */ |
|
117 |
/*******************************/ |
|
118 |
/* done in base class(es) */ |
|
119 |
||
120 |
/***************************/ |
|
121 |
/* B 1.2.3 - Time Literals */ |
|
122 |
/***************************/ |
|
123 |
/************************/ |
|
124 |
/* B 1.2.3.1 - Duration */ |
|
125 |
/************************/ |
|
126 |
/* done in base class(es) */ |
|
127 |
||
128 |
/************************************/ |
|
129 |
/* B 1.2.3.2 - Time of day and Date */ |
|
130 |
/************************************/ |
|
131 |
/* done in base class(es) */ |
|
132 |
||
133 |
/**********************/ |
|
134 |
/* B.1.3 - Data types */ |
|
135 |
/**********************/ |
|
136 |
/***********************************/ |
|
137 |
/* B 1.3.1 - Elementary Data Types */ |
|
138 |
/***********************************/ |
|
139 |
/* done in base class(es) */ |
|
140 |
||
141 |
/********************************/ |
|
142 |
/* B.1.3.2 - Generic data types */ |
|
143 |
/********************************/ |
|
144 |
/* originally empty... */ |
|
145 |
||
146 |
/********************************/ |
|
147 |
/* B 1.3.3 - Derived data types */ |
|
148 |
/********************************/ |
|
98 | 149 |
/* subrange_type_name ':' subrange_spec_init */ |
150 |
void *visit(subrange_type_declaration_c *symbol) { |
|
151 |
TRACE("subrange_type_declaration_c"); |
|
152 |
||
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
153 |
current_typedefinition = subrange_td; |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
154 |
current_type_name = symbol->subrange_type_name; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
155 |
|
221
c6aed7e5f070
Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents:
178
diff
changeset
|
156 |
s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
157 |
current_type_name->accept(*basedecl); |
327 | 158 |
s4o_incl.print(","); |
98 | 159 |
current_basetypedeclaration = subrangebasetype_bd; |
160 |
symbol->subrange_spec_init->accept(*this); |
|
161 |
current_basetypedeclaration = none_bd; |
|
221
c6aed7e5f070
Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents:
178
diff
changeset
|
162 |
s4o_incl.print(")\n"); |
98 | 163 |
|
164 |
current_basetypedeclaration = subrangetest_bd; |
|
165 |
symbol->subrange_spec_init->accept(*this); |
|
166 |
current_basetypedeclaration = none_bd; |
|
167 |
||
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
168 |
current_type_name = NULL; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
169 |
current_typedefinition = none_td; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
170 |
|
98 | 171 |
return NULL; |
172 |
} |
|
173 |
||
174 |
/* subrange_specification ASSIGN signed_integer */ |
|
70 | 175 |
void *visit(subrange_spec_init_c *symbol) { |
176 |
TRACE("subrange_spec_init_c"); |
|
98 | 177 |
symbol->subrange_specification->accept(*this); |
178 |
return NULL; |
|
179 |
} |
|
180 |
||
181 |
/* integer_type_name '(' subrange')' */ |
|
182 |
void *visit(subrange_specification_c *symbol) { |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
183 |
TRACE("subrange_specification_c"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
184 |
if (current_typedefinition == subrange_td) { |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
185 |
switch (current_basetypedeclaration) { |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
186 |
case subrangebasetype_bd: |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
187 |
symbol->integer_type_name->accept(*basedecl); |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
188 |
break; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
189 |
case subrangetest_bd: |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
190 |
if (symbol->subrange != NULL) { |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
191 |
s4o_incl.print("static inline "); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
192 |
current_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
193 |
s4o_incl.print(" __CHECK_"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
194 |
current_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
195 |
s4o_incl.print("("); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
196 |
current_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
197 |
s4o_incl.print(" value) {\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
198 |
s4o_incl.indent_right(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
199 |
|
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
200 |
/* NOTE: IEC 61131-3 v2 syntax mandates that the integer type name be one of SINT, ..., LINT, USINT, ... ULIT */ |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
201 |
/* For this reason, the following condition will always be false, and therefore this is a block |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
202 |
* of dead code. However, let's not delete it for now. It might come in useful for IEC 61131-3 v3. |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
203 |
* For the moment, we just comment it out! |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
204 |
*/ |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
205 |
/* |
854
13d0b67de111
Code cleanup: move datatype analysis to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents:
793
diff
changeset
|
206 |
if (get_datatype_info_c::is_subrange(symbol->integer_type_name)) { |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
207 |
s4o_incl.print(s4o_incl.indent_spaces + "value = __CHECK_"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
208 |
symbol->integer_type_name->accept(*this); |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
209 |
s4o_incl.print("(value);\n"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
210 |
} |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
211 |
*/ |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
212 |
|
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
213 |
symbol->subrange->accept(*this); |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
214 |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
215 |
s4o_incl.indent_left(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
216 |
s4o_incl.print("}\n"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
217 |
} |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
218 |
else { |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
219 |
s4o_incl.print("#define __CHECK_"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
220 |
current_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
221 |
s4o_incl.print(" __CHECK_"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
222 |
symbol->integer_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
223 |
s4o_incl.print("\n"); |
98 | 224 |
} |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
225 |
break; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
226 |
default: |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
227 |
break; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
228 |
} |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
229 |
} |
860
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
230 |
return NULL; |
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
231 |
} |
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
232 |
|
98 | 233 |
|
234 |
/* signed_integer DOTDOT signed_integer */ |
|
235 |
void *visit(subrange_c *symbol) { |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
236 |
TRACE("subrange_c"); |
98 | 237 |
int dimension; |
238 |
switch (current_typedefinition) { |
|
239 |
case array_td: |
|
240 |
if (current_basetypedeclaration == arraysubrange_bd) { |
|
121 | 241 |
s4o_incl.print("["); |
594
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
592
diff
changeset
|
242 |
s4o_incl.print(symbol->dimension); |
121 | 243 |
s4o_incl.print("]"); |
98 | 244 |
} |
245 |
else |
|
246 |
symbol->lower_limit->accept(*this); |
|
247 |
break; |
|
248 |
case subrange_td: |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
249 |
s4o_incl.print(s4o_incl.indent_spaces + "if (value < "); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
250 |
symbol->lower_limit->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
251 |
s4o_incl.print(")\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
252 |
s4o_incl.indent_right(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
253 |
s4o_incl.print(s4o_incl.indent_spaces + "return "); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
254 |
symbol->lower_limit->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
255 |
s4o_incl.print(";\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
256 |
s4o_incl.indent_left(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
257 |
s4o_incl.print(s4o_incl.indent_spaces + "else if (value > "); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
258 |
symbol->upper_limit->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
259 |
s4o_incl.print(")\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
260 |
s4o_incl.indent_right(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
261 |
s4o_incl.print(s4o_incl.indent_spaces + "return "); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
262 |
symbol->upper_limit->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
263 |
s4o_incl.print(";\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
264 |
s4o_incl.indent_left(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
265 |
s4o_incl.print(s4o_incl.indent_spaces + "else\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
266 |
s4o_incl.indent_right(); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
267 |
s4o_incl.print(s4o_incl.indent_spaces + "return value;\n"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
268 |
s4o_incl.indent_left(); |
98 | 269 |
default: |
270 |
break; |
|
271 |
} |
|
272 |
return NULL; |
|
273 |
} |
|
274 |
||
275 |
/* enumerated_type_name ':' enumerated_spec_init */ |
|
276 |
void *visit(enumerated_type_declaration_c *symbol) { |
|
277 |
TRACE("enumerated_type_declaration_c"); |
|
278 |
||
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
279 |
current_typedefinition = enumerated_td; |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
280 |
current_type_name = symbol->enumerated_type_name; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
281 |
|
327 | 282 |
s4o_incl.print("__DECLARE_ENUMERATED_TYPE("); |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
283 |
current_type_name->accept(*basedecl); |
327 | 284 |
s4o_incl.print(",\n"); |
121 | 285 |
s4o_incl.indent_right(); |
98 | 286 |
symbol->enumerated_spec_init->accept(*this); |
121 | 287 |
s4o_incl.indent_left(); |
327 | 288 |
s4o_incl.print(")\n"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
289 |
|
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
290 |
current_type_name = NULL; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
291 |
current_typedefinition = none_td; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
292 |
|
70 | 293 |
return NULL; |
294 |
} |
|
295 |
||
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
296 |
/* enumerated_specification ASSIGN enumerated_value */ |
70 | 297 |
void *visit(enumerated_spec_init_c *symbol) { |
298 |
TRACE("enumerated_spec_init_c"); |
|
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
299 |
if (current_typedefinition == enumerated_td) |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
300 |
symbol->enumerated_specification->accept(*this); |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
301 |
else |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
302 |
symbol->enumerated_specification->accept(*basedecl); |
98 | 303 |
return NULL; |
304 |
} |
|
305 |
||
306 |
/* helper symbol for enumerated_specification->enumerated_spec_init */ |
|
307 |
/* enumerated_value_list ',' enumerated_value */ |
|
308 |
void *visit(enumerated_value_list_c *symbol) { |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
309 |
TRACE("enumerated_value_list_c"); |
121 | 310 |
print_list_incl(symbol, s4o_incl.indent_spaces, ",\n"+s4o_incl.indent_spaces, "\n"); |
98 | 311 |
return NULL; |
312 |
} |
|
313 |
||
314 |
/* enumerated_type_name '#' identifier */ |
|
860
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
315 |
/* Handled by generate_c_base_c class!! |
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
316 |
void *visit(enumerated_value_c *symbol) {} |
7669a8d43c11
Code cleanup (part 2): generate_typedecl_c now only prints to POUS.h !
mjsousa
parents:
859
diff
changeset
|
317 |
*/ |
98 | 318 |
|
319 |
/* identifier ':' array_spec_init */ |
|
320 |
void *visit(array_type_declaration_c *symbol) { |
|
321 |
TRACE("array_type_declaration_c"); |
|
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
322 |
current_typedefinition = array_td; |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
323 |
current_type_name = symbol->identifier; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
324 |
|
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
325 |
int implicit_id_count = symbol->array_spec_init->anotations_map.count("generate_c_annotaton__implicit_type_id"); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
326 |
if (implicit_id_count > 1) ERROR; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
327 |
if (implicit_id_count == 1) |
706
31553c22f318
Adding support for declaring function block instances as global and external variables
Laurent Bessard
parents:
594
diff
changeset
|
328 |
s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
309
f93bcada0f51
Fix bug when declaring data type directly derived from array type
laurent
parents:
307
diff
changeset
|
329 |
else |
706
31553c22f318
Adding support for declaring function block instances as global and external variables
Laurent Bessard
parents:
594
diff
changeset
|
330 |
s4o_incl.print("__DECLARE_ARRAY_TYPE("); |
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
331 |
current_type_name->accept(*basedecl); |
327 | 332 |
s4o_incl.print(","); |
98 | 333 |
symbol->array_spec_init->accept(*this); |
221
c6aed7e5f070
Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents:
178
diff
changeset
|
334 |
s4o_incl.print(")\n"); |
322
293967b9277d
Fix bug with array attribute in structure declaration
laurent
parents:
310
diff
changeset
|
335 |
|
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
327
diff
changeset
|
336 |
current_type_name = NULL; |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
337 |
current_typedefinition = none_td; |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
338 |
return NULL; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
339 |
} |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
340 |
|
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
341 |
|
98 | 342 |
|
160 | 343 |
/* array_specification [ASSIGN array_initialization] */ |
98 | 344 |
/* array_initialization may be NULL ! */ |
345 |
void *visit(array_spec_init_c *symbol) { |
|
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
346 |
TRACE("array_spec_init_c"); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
347 |
int implicit_id_count = symbol->anotations_map.count("generate_c_annotaton__implicit_type_id"); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
348 |
if (implicit_id_count > 1) ERROR; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
349 |
if (implicit_id_count == 1) { |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
350 |
/* this is part of an implicitly declared datatype (i.e. inside a variable decaration), for which an equivalent C datatype |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
351 |
* has already been defined. So, we simly print out the id of that C datatpe... |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
352 |
*/ |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
353 |
symbol->anotations_map["generate_c_annotaton__implicit_type_id"]->accept(*basedecl); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
354 |
return NULL; |
322
293967b9277d
Fix bug with array attribute in structure declaration
laurent
parents:
310
diff
changeset
|
355 |
} |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
356 |
// if (current_typedefinition != array_td) {debug_c::print(symbol); ERROR;} |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
357 |
symbol->array_specification->accept(*this); |
98 | 358 |
return NULL; |
359 |
} |
|
360 |
||
361 |
/* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
|
362 |
void *visit(array_specification_c *symbol) { |
|
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
363 |
TRACE("array_specification_c"); |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
364 |
int implicit_id_count = symbol->anotations_map.count("generate_c_annotaton__implicit_type_id"); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
365 |
if (implicit_id_count > 1) ERROR; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
366 |
if (implicit_id_count == 1) { |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
367 |
/* this is part of an implicitly declared datatype (i.e. inside a variable decaration), for which an equivalent C datatype |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
368 |
* has already been defined. So, we simly print out the id of that C datatpe... |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
369 |
*/ |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
370 |
symbol->anotations_map["generate_c_annotaton__implicit_type_id"]->accept(*basedecl); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
371 |
return NULL; |
98 | 372 |
} |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
373 |
// The 2nd and 3rd argument of a call to the __DECLARE_ARRAY_TYPE macro! |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
374 |
symbol->non_generic_type_name->accept(*this); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
375 |
s4o_incl.print(","); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
376 |
current_basetypedeclaration = arraysubrange_bd; |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
377 |
symbol->array_subrange_list->accept(*this); |
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
378 |
current_basetypedeclaration = none_bd; |
98 | 379 |
return NULL; |
380 |
} |
|
381 |
||
70 | 382 |
|
383 |
/* TYPE type_declaration_list END_TYPE */ |
|
384 |
void *visit(data_type_declaration_c *symbol) { |
|
385 |
TRACE("data_type_declaration_c"); |
|
386 |
symbol->type_declaration_list->accept(*this); |
|
857 | 387 |
s4o_incl.print("\n\n"); |
70 | 388 |
return NULL; |
389 |
} |
|
390 |
||
391 |
/* helper symbol for data_type_declaration */ |
|
392 |
void *visit(type_declaration_list_c *symbol) { |
|
393 |
TRACE("type_declaration_list_c"); |
|
160 | 394 |
return print_list_incl(symbol, "", "\n", "\n"); |
70 | 395 |
} |
396 |
||
397 |
/* simple_type_name ':' simple_spec_init */ |
|
398 |
void *visit(simple_type_declaration_c *symbol) { |
|
399 |
TRACE("simple_type_declaration_c"); |
|
400 |
||
307
6ea381792f59
Fix missing '(' when declaring new simple derived data type.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
401 |
s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
327 | 402 |
symbol->simple_type_name->accept(*basedecl); |
403 |
s4o_incl.print(","); |
|
70 | 404 |
symbol->simple_spec_init->accept(*this); |
309
f93bcada0f51
Fix bug when declaring data type directly derived from array type
laurent
parents:
307
diff
changeset
|
405 |
s4o_incl.print(")\n"); |
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
350
diff
changeset
|
406 |
|
854
13d0b67de111
Code cleanup: move datatype analysis to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents:
793
diff
changeset
|
407 |
if (get_datatype_info_c::is_subrange(symbol->simple_type_name)) { |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
408 |
s4o_incl.print("#define __CHECK_"); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
409 |
current_type_name->accept(*basedecl); |
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
410 |
s4o_incl.print(" __CHECK_"); |
706
31553c22f318
Adding support for declaring function block instances as global and external variables
Laurent Bessard
parents:
594
diff
changeset
|
411 |
symbol->simple_spec_init->accept(*this); |
859
41d11bacfc9b
Code cleanup (part 1): subrange check functions are now declared in POUS.h (as static inline functions or #define)
mjsousa
parents:
857
diff
changeset
|
412 |
s4o_incl.print("\n"); |
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
350
diff
changeset
|
413 |
} |
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
350
diff
changeset
|
414 |
|
70 | 415 |
return NULL; |
416 |
} |
|
417 |
||
418 |
/* simple_specification [ASSIGN constant] */ |
|
419 |
//SYM_REF2(simple_spec_init_c, simple_specification, constant) |
|
420 |
// <constant> may be NULL |
|
421 |
void *visit(simple_spec_init_c *symbol) { |
|
422 |
TRACE("simple_spec_init_c"); |
|
121 | 423 |
symbol->simple_specification->accept(*basedecl); |
70 | 424 |
return NULL; |
425 |
} |
|
426 |
||
427 |
#if 0 |
|
428 |
/* subrange_type_name ':' subrange_spec_init */ |
|
429 |
SYM_REF2(subrange_type_declaration_c, subrange_type_name, subrange_spec_init) |
|
430 |
||
431 |
/* subrange_specification ASSIGN signed_integer */ |
|
432 |
SYM_REF2(subrange_spec_init_c, subrange_specification, signed_integer) |
|
433 |
||
434 |
/* integer_type_name '(' subrange')' */ |
|
435 |
SYM_REF2(subrange_specification_c, integer_type_name, subrange) |
|
436 |
||
437 |
/* signed_integer DOTDOT signed_integer */ |
|
438 |
SYM_REF2(subrange_c, lower_limit, upper_limit) |
|
439 |
||
440 |
/* enumerated_type_name ':' enumerated_spec_init */ |
|
441 |
SYM_REF2(enumerated_type_declaration_c, enumerated_type_name, enumerated_spec_init) |
|
442 |
||
443 |
/* enumerated_specification ASSIGN enumerated_value */ |
|
444 |
SYM_REF2(enumerated_spec_init_c, enumerated_specification, enumerated_value) |
|
445 |
||
446 |
/* helper symbol for enumerated_specification->enumerated_spec_init */ |
|
447 |
/* enumerated_value_list ',' enumerated_value */ |
|
448 |
SYM_LIST(enumerated_value_list_c) |
|
449 |
||
450 |
/* enumerated_type_name '#' identifier */ |
|
451 |
SYM_REF2(enumerated_value_c, type, value) |
|
452 |
||
453 |
/* identifier ':' array_spec_init */ |
|
454 |
SYM_REF2(array_type_declaration_c, identifier, array_spec_init) |
|
455 |
||
456 |
/* array_specification [ASSIGN array_initialization} */ |
|
457 |
/* array_initialization may be NULL ! */ |
|
458 |
SYM_REF2(array_spec_init_c, array_specification, array_initialization) |
|
459 |
||
460 |
/* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
|
461 |
SYM_REF2(array_specification_c, array_subrange_list, non_generic_type_name) |
|
462 |
||
463 |
/* helper symbol for array_specification */ |
|
464 |
/* array_subrange_list ',' subrange */ |
|
465 |
SYM_LIST(array_subrange_list_c) |
|
466 |
||
467 |
/* array_initialization: '[' array_initial_elements_list ']' */ |
|
468 |
/* helper symbol for array_initialization */ |
|
469 |
/* array_initial_elements_list ',' array_initial_elements */ |
|
470 |
SYM_LIST(array_initial_elements_list_c) |
|
471 |
||
472 |
/* integer '(' [array_initial_element] ')' */ |
|
473 |
/* array_initial_element may be NULL ! */ |
|
474 |
SYM_REF2(array_initial_elements_c, integer, array_initial_element) |
|
475 |
#endif |
|
476 |
||
477 |
/* structure_type_name ':' structure_specification */ |
|
478 |
//SYM_REF2(structure_type_declaration_c, structure_type_name, structure_specification) |
|
479 |
void *visit(structure_type_declaration_c *symbol) { |
|
480 |
TRACE("structure_type_declaration_c"); |
|
481 |
||
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
482 |
current_typedefinition = struct_td; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
483 |
|
221
c6aed7e5f070
Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents:
178
diff
changeset
|
484 |
s4o_incl.print("__DECLARE_STRUCT_TYPE("); |
327 | 485 |
symbol->structure_type_name->accept(*basedecl); |
486 |
s4o_incl.print(","); |
|
70 | 487 |
symbol->structure_specification->accept(*this); |
327 | 488 |
s4o_incl.print(")\n"); |
310
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
489 |
|
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
490 |
current_typedefinition = none_td; |
f111a6986c22
Fix bug when using an enumerated or subrange type to define a structure element
laurent
parents:
309
diff
changeset
|
491 |
|
70 | 492 |
return NULL; |
493 |
} |
|
494 |
||
495 |
/* structure_type_name ASSIGN structure_initialization */ |
|
496 |
/* structure_initialization may be NULL ! */ |
|
497 |
//SYM_REF2(initialized_structure_c, structure_type_name, structure_initialization) |
|
498 |
void *visit(initialized_structure_c *symbol) { |
|
499 |
TRACE("initialized_structure_c"); |
|
164 | 500 |
|
501 |
symbol->structure_type_name->accept(*basedecl); |
|
502 |
||
70 | 503 |
return NULL; |
504 |
} |
|
505 |
||
506 |
/* helper symbol for structure_declaration */ |
|
507 |
/* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
|
508 |
/* structure_element_declaration_list structure_element_declaration ';' */ |
|
509 |
//SYM_LIST(structure_element_declaration_list_c) |
|
510 |
void *visit(structure_element_declaration_list_c *symbol) { |
|
511 |
TRACE("structure_element_declaration_list_c"); |
|
327 | 512 |
s4o_incl.print("\n"); |
160 | 513 |
s4o_incl.indent_right(); |
514 |
s4o_incl.print(s4o_incl.indent_spaces); |
|
515 |
||
516 |
print_list_incl(symbol, "", s4o_incl.indent_spaces, ""); |
|
517 |
||
518 |
s4o_incl.indent_left(); |
|
519 |
s4o_incl.print(s4o_incl.indent_spaces); |
|
70 | 520 |
return NULL; |
521 |
} |
|
522 |
||
523 |
/* structure_element_name ':' spec_init */ |
|
524 |
//SYM_REF2(structure_element_declaration_c, structure_element_name, spec_init) |
|
525 |
void *visit(structure_element_declaration_c *symbol) { |
|
526 |
TRACE("structure_element_declaration_c"); |
|
527 |
||
528 |
symbol->spec_init->accept(*this); |
|
160 | 529 |
s4o_incl.print(" "); |
530 |
symbol->structure_element_name->accept(*basedecl); |
|
531 |
s4o_incl.print(";\n"); |
|
857 | 532 |
s4o_incl.print(s4o_incl.indent_spaces); |
70 | 533 |
|
534 |
return NULL; |
|
535 |
} |
|
536 |
||
537 |
/* helper symbol for structure_initialization */ |
|
538 |
/* structure_initialization: '(' structure_element_initialization_list ')' */ |
|
539 |
/* structure_element_initialization_list ',' structure_element_initialization */ |
|
540 |
//SYM_LIST(structure_element_initialization_list_c) |
|
541 |
void *visit(structure_element_initialization_list_c *symbol) { |
|
542 |
TRACE("structure_element_initialization_list_c"); |
|
543 |
||
544 |
// TODO ??? |
|
160 | 545 |
//ERROR; |
70 | 546 |
return NULL; |
547 |
} |
|
548 |
||
549 |
/* structure_element_name ASSIGN value */ |
|
550 |
//SYM_REF2(structure_element_initialization_c, structure_element_name, value) |
|
551 |
void *visit(structure_element_initialization_c *symbol) { |
|
552 |
TRACE("structure_element_initialization_c"); |
|
553 |
||
554 |
// TODO ??? |
|
160 | 555 |
//ERROR; |
70 | 556 |
return NULL; |
557 |
} |
|
558 |
||
559 |
#if 0 |
|
560 |
/* string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */ |
|
561 |
/* |
|
562 |
* NOTE: |
|
563 |
* (Summary: Contrary to what is expected, the |
|
564 |
* string_type_declaration_c is not used to store |
|
565 |
* simple string type declarations that do not include |
|
566 |
* size limits. |
|
567 |
* For e.g.: |
|
568 |
* str1_type: STRING := "hello!" |
|
569 |
* will be stored in a simple_type_declaration_c |
|
570 |
* instead of a string_type_declaration_c. |
|
571 |
* The following: |
|
572 |
* str2_type: STRING [64] := "hello!" |
|
573 |
* will be stored in a sring_type_declaration_c |
|
574 |
* |
|
575 |
* Read on for why this is done... |
|
576 |
* End Summary) |
|
577 |
* |
|
578 |
* According to the spec, the valid construct |
|
579 |
* TYPE new_str_type : STRING := "hello!"; END_TYPE |
|
580 |
* has two possible routes to type_declaration... |
|
581 |
* |
|
582 |
* Route 1: |
|
583 |
* type_declaration: single_element_type_declaration |
|
584 |
* single_element_type_declaration: simple_type_declaration |
|
585 |
* simple_type_declaration: identifier ':' simple_spec_init |
|
586 |
* simple_spec_init: simple_specification ASSIGN constant |
|
587 |
* (shift: identifier <- 'new_str_type') |
|
588 |
* simple_specification: elementary_type_name |
|
589 |
* elementary_type_name: STRING |
|
590 |
* (shift: elementary_type_name <- STRING) |
|
591 |
* (reduce: simple_specification <- elementary_type_name) |
|
592 |
* (shift: constant <- "hello!") |
|
593 |
* (reduce: simple_spec_init: simple_specification ASSIGN constant) |
|
594 |
* (reduce: ...) |
|
595 |
* |
|
596 |
* |
|
597 |
* Route 2: |
|
598 |
* type_declaration: string_type_declaration |
|
599 |
* string_type_declaration: identifier ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init |
|
600 |
* (shift: identifier <- 'new_str_type') |
|
601 |
* elementary_string_type_name: STRING |
|
602 |
* (shift: elementary_string_type_name <- STRING) |
|
603 |
* (shift: string_type_declaration_size <- empty ) |
|
604 |
* string_type_declaration_init: ASSIGN character_string |
|
605 |
* (shift: character_string <- "hello!") |
|
606 |
* (reduce: string_type_declaration_init <- ASSIGN character_string) |
|
607 |
* (reduce: string_type_declaration <- identifier ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init ) |
|
608 |
* (reduce: type_declaration <- string_type_declaration) |
|
609 |
* |
|
610 |
* |
|
611 |
* At first glance it seems that removing route 1 would make |
|
612 |
* the most sense. Unfortunately the construct 'simple_spec_init' |
|
613 |
* shows up multiple times in other rules, so changing this construct |
|
614 |
* would also mean changing all the rules in which it appears. |
|
615 |
* I (Mario) therefore chose to remove route 2 instead. This means |
|
616 |
* that the above declaration gets stored in a |
|
617 |
* simple_type_declaration_c, and not in a string_type_declaration_c |
|
618 |
* as would be expected! |
|
619 |
*/ |
|
620 |
/* string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */ |
|
621 |
SYM_REF4(string_type_declaration_c, string_type_name, |
|
622 |
elementary_string_type_name, |
|
623 |
string_type_declaration_size, |
|
624 |
string_type_declaration_init) /* may be == NULL! */ |
|
625 |
#endif |
|
626 |
||
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
627 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
628 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
629 |
/* ref_spec: REF_TO (non_generic_type_name | function_block_type_name) */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
630 |
// SYM_REF1(ref_spec_c, type_name) |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
631 |
void *visit(ref_spec_c *symbol) { |
916
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
632 |
int implicit_id_count = symbol->anotations_map.count("generate_c_annotaton__implicit_type_id"); |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
633 |
if (implicit_id_count > 1) ERROR; |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
634 |
if (implicit_id_count == 1) { |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
635 |
/* this is part of an implicitly declared datatype (i.e. inside a variable decaration), for which an equivalent C datatype |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
636 |
* has already been defined. So, we simly print out the id of that C datatpe... |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
637 |
*/ |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
638 |
symbol->anotations_map["generate_c_annotaton__implicit_type_id"]->accept(*basedecl); |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
639 |
return NULL; |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
640 |
} |
930 | 641 |
/* This is NOT part of an implicitly declared datatype (i.e. we are being called from an visit(ref_type_decl_c *), |
642 |
* through the visit(ref_spec_init_c*)), so we need to simply print out the name of the datatype we reference to. |
|
643 |
*/ |
|
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
930
diff
changeset
|
644 |
symbol->type_name->accept(*this); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
930
diff
changeset
|
645 |
s4o_incl.print("*"); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
930
diff
changeset
|
646 |
return NULL; |
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
647 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
648 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
649 |
/* For the moment, we do not support initialising reference data types */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
650 |
/* ref_spec_init: ref_spec [ ASSIGN ref_initialization ] */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
651 |
/* NOTE: ref_initialization may be NULL!! */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
652 |
// SYM_REF2(ref_spec_init_c, ref_spec, ref_initialization) |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
653 |
void *visit(ref_spec_init_c *symbol) { |
916
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
654 |
int implicit_id_count = symbol->anotations_map.count("generate_c_annotaton__implicit_type_id"); |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
655 |
if (implicit_id_count > 1) ERROR; |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
656 |
if (implicit_id_count == 1) { |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
657 |
/* this is part of an implicitly declared datatype (i.e. inside a variable decaration), for which an equivalent C datatype |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
658 |
* has already been defined. So, we simly print out the id of that C datatpe... |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
659 |
*/ |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
660 |
symbol->anotations_map["generate_c_annotaton__implicit_type_id"]->accept(*basedecl); |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
661 |
return NULL; |
e14cb81bc310
Add support for implicitly declared REF_TO datatypes.
mjsousa
parents:
913
diff
changeset
|
662 |
} |
930 | 663 |
/* This is NOT part of an implicitly declared datatype (i.e. we are being called from an visit(ref_type_decl_c *)), |
664 |
* so we need to simply print out the name of the datatype we reference to. |
|
665 |
*/ |
|
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
666 |
return symbol->ref_spec->accept(*this); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
667 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
668 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
669 |
/* ref_type_decl: identifier ':' ref_spec_init */ |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
670 |
// SYM_REF2(ref_type_decl_c, ref_type_name, ref_spec_init) |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
671 |
void *visit(ref_type_decl_c *symbol) { |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
672 |
TRACE("ref_type_decl_c"); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
673 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
674 |
current_type_name = NULL; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
675 |
current_typedefinition = none_td; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
676 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
677 |
s4o_incl.print("__DECLARE_REFTO_TYPE("); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
678 |
symbol->ref_type_name->accept(*basedecl); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
679 |
s4o_incl.print(", "); |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
680 |
symbol->ref_spec_init->accept(*this); |
913
1c74da17cb61
Implicitly defined array datatypes use new naming method (greatly simplifies stage 4 code).
mjsousa
parents:
909
diff
changeset
|
681 |
s4o_incl.print(")\n"); |
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
682 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
683 |
current_type_name = NULL; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
684 |
current_typedefinition = none_td; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
685 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
686 |
return NULL; |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
687 |
} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
688 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
689 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
690 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
691 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
692 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
693 |
|
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
860
diff
changeset
|
694 |
|
70 | 695 |
/*********************/ |
696 |
/* B 1.4 - Variables */ |
|
697 |
/*********************/ |
|
698 |
/* done in base class(es) */ |
|
699 |
||
700 |
/********************************************/ |
|
701 |
/* B.1.4.1 Directly Represented Variables */ |
|
702 |
/********************************************/ |
|
703 |
// direct_variable: direct_variable_token {$$ = new direct_variable_c($1);}; |
|
704 |
void *visit(direct_variable_c *symbol) { |
|
705 |
TRACE("direct_variable_c"); |
|
706 |
/* Do not use print_token() as it will change everything into uppercase */ |
|
707 |
if (strlen(symbol->value) == 0) ERROR; |
|
708 |
return s4o.printlocation(symbol->value + 1); |
|
709 |
} |
|
710 |
||
711 |
||
712 |
/*************************************/ |
|
713 |
/* B.1.4.2 Multi-element Variables */ |
|
714 |
/*************************************/ |
|
715 |
/* done in base class(es) */ |
|
716 |
||
717 |
/******************************************/ |
|
718 |
/* B 1.4.3 - Declaration & Initialisation */ |
|
719 |
/******************************************/ |
|
720 |
/* leave for derived classes... */ |
|
721 |
||
722 |
/**************************************/ |
|
723 |
/* B.1.5 - Program organization units */ |
|
724 |
/**************************************/ |
|
725 |
/***********************/ |
|
726 |
/* B 1.5.1 - Functions */ |
|
727 |
/***********************/ |
|
728 |
/* leave for derived classes... */ |
|
729 |
||
730 |
/*****************************/ |
|
731 |
/* B 1.5.2 - Function Blocks */ |
|
732 |
/*****************************/ |
|
733 |
/* leave for derived classes... */ |
|
734 |
||
735 |
/**********************/ |
|
736 |
/* B 1.5.3 - Programs */ |
|
737 |
/**********************/ |
|
738 |
/* leave for derived classes... */ |
|
739 |
||
740 |
/*********************************************/ |
|
741 |
/* B.1.6 Sequential function chart elements */ |
|
742 |
/*********************************************/ |
|
743 |
||
744 |
/********************************/ |
|
745 |
/* B 1.7 Configuration elements */ |
|
746 |
/********************************/ |
|
747 |
/* leave for derived classes... */ |
|
748 |
||
749 |
/****************************************/ |
|
750 |
/* B.2 - Language IL (Instruction List) */ |
|
751 |
/****************************************/ |
|
752 |
/***********************************/ |
|
753 |
/* B 2.1 Instructions and Operands */ |
|
754 |
/***********************************/ |
|
755 |
/* leave for derived classes... */ |
|
756 |
||
757 |
/*******************/ |
|
758 |
/* B 2.2 Operators */ |
|
759 |
/*******************/ |
|
760 |
/* leave for derived classes... */ |
|
761 |
||
762 |
||
763 |
/***************************************/ |
|
764 |
/* B.3 - Language ST (Structured Text) */ |
|
765 |
/***************************************/ |
|
766 |
/***********************/ |
|
767 |
/* B 3.1 - Expressions */ |
|
768 |
/***********************/ |
|
769 |
/* leave for derived classes... */ |
|
770 |
||
771 |
/********************/ |
|
772 |
/* B 3.2 Statements */ |
|
773 |
/********************/ |
|
774 |
/* leave for derived classes... */ |
|
775 |
||
776 |
/*********************************/ |
|
777 |
/* B 3.2.1 Assignment Statements */ |
|
778 |
/*********************************/ |
|
779 |
/* leave for derived classes... */ |
|
780 |
||
781 |
/*****************************************/ |
|
782 |
/* B 3.2.2 Subprogram Control Statements */ |
|
783 |
/*****************************************/ |
|
784 |
/* leave for derived classes... */ |
|
785 |
||
786 |
/********************************/ |
|
787 |
/* B 3.2.3 Selection Statements */ |
|
788 |
/********************************/ |
|
789 |
/* leave for derived classes... */ |
|
790 |
||
791 |
/********************************/ |
|
792 |
/* B 3.2.4 Iteration Statements */ |
|
793 |
/********************************/ |
|
794 |
/* leave for derived classes... */ |
|
795 |
||
796 |
||
797 |
||
798 |
||
799 |
}; /* generate_c_typedecl_c */ |
|
800 |
||
801 |
||
802 |