author | Edouard Tisserant |
Wed, 16 Nov 2011 17:48:22 +0100 | |
changeset 389 | 94b67e38188a |
parent 350 | 2c3c4dc34979 |
child 424 | 43d73e28eca8 |
permissions | -rwxr-xr-x |
181 | 1 |
/* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
3 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
279
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
265
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
6 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
10 |
* (at your option) any later version. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
11 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
15 |
* GNU General Public License for more details. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
16 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
19 |
* |
181 | 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 |
*/ |
|
24 |
||
25 |
/* |
|
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
233
diff
changeset
|
26 |
* An IEC 61131-3 compiler. |
181 | 27 |
* |
28 |
* Based on the |
|
29 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
30 |
* |
|
31 |
*/ |
|
32 |
||
33 |
||
34 |
/* |
|
35 |
* Function parameter iterator. |
|
36 |
* Iterate through the in/out parameters of a function declaration. |
|
37 |
* Function blocks are also suported. |
|
38 |
* |
|
39 |
* This is part of the 4th stage that generates |
|
40 |
* a c++ source program equivalent to the IL and ST |
|
41 |
* code. |
|
42 |
*/ |
|
43 |
||
44 |
/* Given a function_declaration_c, iterate through each |
|
45 |
* function in/out/inout parameter, returning the name |
|
46 |
* of each parameter...function_param_iterator_c |
|
47 |
*/ |
|
48 |
||
49 |
||
50 |
#include "../absyntax/visitor.hh" |
|
51 |
||
52 |
||
53 |
class function_param_iterator_c : public null_visitor_c { |
|
54 |
public: |
|
55 |
/* A type to specify the type of parameter. |
|
56 |
* VAR_INPUT => direction_in |
|
57 |
* VAR_OUTPUT => direction_out |
|
58 |
* VAR_IN_OUT => direction_inout |
|
59 |
* VAR_EXTERNAL => direction_extref |
|
60 |
* |
|
61 |
* Note that VAR_EXTERNAL declares variables that are in reality references |
|
62 |
* to global variables. This is used only inside programs! |
|
63 |
* These references to external variables must be correctly initialised to refer |
|
64 |
* to the correct global variable. Note that the user may define which variable is to be |
|
65 |
* referenced in a CONFIGURATION, and that different instantiations of a program |
|
66 |
* may have the same external variable reference diffenrent global variables! |
|
67 |
* The references must therefore be correctly initialised when the program instance |
|
68 |
* is created. This may be done by the PROGRAM class constructor since the ST and IL |
|
69 |
* languages do not allow the VAR_EXTERNAL reference to change at runtime |
|
70 |
* for a specific instance. |
|
71 |
* |
|
72 |
* We therefore need to call a PROGRAM class constructor with the variables |
|
73 |
* that should be refernced by the VAR_EXTERNAL variables. The direction_extref will |
|
74 |
* be used to identify these parameters! |
|
75 |
*/ |
|
76 |
typedef enum {direction_in, direction_out, direction_inout, direction_extref} param_direction_t ; |
|
77 |
||
78 |
||
79 |
private: |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
80 |
/* a pointer to the function_block_declaration_c |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
81 |
* or function_declaration_c currently being analysed. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
82 |
*/ |
181 | 83 |
symbol_c *f_decl; |
84 |
int next_param, param_count; |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
85 |
/* used when called to search() for a parameter by name */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
86 |
identifier_c *search_param_name; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
87 |
/* used when called to iterate() for a parameter */ |
181 | 88 |
identifier_c *current_param_name; |
89 |
symbol_c *current_param_type; |
|
90 |
symbol_c *current_param_default_value; |
|
91 |
param_direction_t current_param_direction; |
|
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
202
diff
changeset
|
92 |
bool en_eno_param_implicit; |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
93 |
/* used when we reach an extensible parameter in the function declaration */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
94 |
/* NOTE: this will handle syntax that is not in the standard. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
95 |
* It is used to handle the extensible standard functions |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
96 |
* (e.g. AND(word#3, word#55, word#44); ) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
97 |
* See absyntax.def or iec.y for more details. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
98 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
99 |
bool current_param_is_extensible; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
100 |
int current_extensible_param_index; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
101 |
int _first_extensible_param_index; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
102 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
103 |
/* Which operation of the class was called... |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
104 |
* Search a parameter, or iterate to the next parameter. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
105 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
106 |
typedef enum {iterate_op, search_op} operation_t; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
107 |
operation_t current_operation; |
181 | 108 |
|
109 |
private: |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
110 |
int cmp_extparam_names(const char* s1, const char* s2); |
181 | 111 |
void* handle_param_list(list_c *list); |
112 |
void* handle_single_param(symbol_c *var_name); |
|
113 |
||
114 |
void* iterate_list(list_c *list); |
|
115 |
||
116 |
public: |
|
117 |
/* start off at the first parameter once again... */ |
|
118 |
void reset(void); |
|
119 |
||
120 |
/* initialise the iterator object. |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
121 |
* We must be given a reference to one of the following |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
122 |
* - function_declaration_c |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
123 |
* - function_block_declaration_c |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
124 |
* - program_declaration_c |
181 | 125 |
* that will be analysed... |
126 |
*/ |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
127 |
function_param_iterator_c(symbol_c *pou_decl); |
181 | 128 |
|
129 |
/* Skip to the next parameter. After object creation, |
|
130 |
* the object references on parameter _before_ the first, so |
|
131 |
* this function must be called once to get the object to |
|
132 |
* reference the first parameter... |
|
133 |
* |
|
134 |
* Returns the parameter's name! |
|
135 |
*/ |
|
136 |
identifier_c *next(void); |
|
137 |
||
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
138 |
/* Search for the parameter named <param_name>... */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
139 |
/* The seach() function does not in any way affect the internal state related |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
140 |
* to the iterate() function. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
141 |
* It will, however, affect the internal state necessary to correctly |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
142 |
* return the param_type(), default_value() and is_en_eno_param_implicit() |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
143 |
* of the found parameter. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
144 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
145 |
identifier_c *search(symbol_c *param_name); |
181 | 146 |
|
147 |
/* Returns the currently referenced parameter's default value, |
|
148 |
* or NULL if none is specified in the function declrataion itself. |
|
149 |
*/ |
|
150 |
symbol_c *default_value(void); |
|
151 |
||
152 |
/* Returns the currently referenced parameter's type name. */ |
|
153 |
symbol_c *param_type(void); |
|
154 |
||
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
202
diff
changeset
|
155 |
/* Returns if currently referenced parameter is an implicit defined EN/ENO parameter. */ |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
202
diff
changeset
|
156 |
bool is_en_eno_param_implicit(void); |
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
202
diff
changeset
|
157 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
158 |
/* Returns if currently referenced parameter is an extensible parameter. */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
159 |
/* extensible paramters only occur in some standard functions, e.g. AND(word#34, word#44, word#65); */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
160 |
bool is_extensible_param(void); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
161 |
/* Returns the index of the current extensible parameter. */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
162 |
/* If the current parameter is not an extensible paramter, returns -1 */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
163 |
int extensible_param_index(void); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
164 |
/* Returns the index of the first extensible parameter, or -1 if no extensible parameter found. */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
165 |
/* WARNING: Will only return the correct value _after_ an extensible parameter has been found! */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
166 |
int first_extensible_param_index(void); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
167 |
|
181 | 168 |
/* Returns the currently referenced parameter's data passing direction. |
169 |
* i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT |
|
170 |
*/ |
|
171 |
param_direction_t param_direction(void); |
|
172 |
||
173 |
private: |
|
233
3d23a68183d3
Bug on standard functions called with literals fixed
laurent
parents:
202
diff
changeset
|
174 |
void *visit(implicit_definition_c *symbol); |
181 | 175 |
/******************************************/ |
176 |
/* B 1.4.3 - Declaration & Initialisation */ |
|
177 |
/******************************************/ |
|
178 |
void *visit(input_declarations_c *symbol); |
|
179 |
||
180 |
void *visit(input_declaration_list_c *symbol); |
|
181 |
||
182 |
void *visit(edge_declaration_c *symbol); |
|
183 |
void *visit(en_param_declaration_c *symbol); |
|
184 |
/* var1_list ':' array_spec_init */ |
|
185 |
//SYM_REF2(array_var_init_decl_c, var1_list, array_spec_init) |
|
186 |
void *visit(array_var_init_decl_c *symbol); |
|
187 |
||
188 |
/* var1_list ':' initialized_structure */ |
|
189 |
//SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure) |
|
190 |
void *visit(structured_var_init_decl_c *symbol); |
|
191 |
||
192 |
#if 0 |
|
193 |
/* name_list ':' function_block_type_name ASSIGN structure_initialization */ |
|
194 |
/* structure_initialization -> may be NULL ! */ |
|
195 |
SYM_REF4(fb_name_decl_c, fb_name_list, function_block_type_name, structure_initialization, unused) |
|
196 |
||
197 |
/* name_list ',' fb_name */ |
|
198 |
SYM_LIST(fb_name_list_c) |
|
199 |
#endif |
|
200 |
||
201 |
void *visit(output_declarations_c *symbol); |
|
202 |
void *visit(eno_param_declaration_c *symbol); |
|
203 |
void *visit(input_output_declarations_c *symbol); |
|
204 |
void *visit(var_declaration_list_c *symbol); |
|
205 |
||
206 |
||
207 |
/* var1_list ':' array_specification */ |
|
208 |
//SYM_REF2(array_var_declaration_c, var1_list, array_specification) |
|
209 |
void *visit(array_var_declaration_c *symbol); |
|
210 |
||
211 |
/* var1_list ':' structure_type_name */ |
|
212 |
//SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name) |
|
213 |
void *visit(structured_var_declaration_c *symbol); |
|
214 |
||
215 |
/* VAR [CONSTANT] var_init_decl_list END_VAR */ |
|
216 |
void *visit(var_declarations_c *symbol); |
|
217 |
||
218 |
#if 0 |
|
219 |
/* VAR RETAIN var_init_decl_list END_VAR */ |
|
220 |
SYM_REF2(retentive_var_declarations_c, var_init_decl_list, unused) |
|
221 |
||
222 |
/* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
|
223 |
/* option -> may be NULL ! */ |
|
224 |
SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
|
225 |
||
226 |
/* helper symbol for located_var_declarations */ |
|
227 |
/* located_var_decl_list located_var_decl ';' */ |
|
228 |
SYM_LIST(located_var_decl_list_c) |
|
229 |
||
230 |
/* [variable_name] location ':' located_var_spec_init */ |
|
231 |
/* variable_name -> may be NULL ! */ |
|
232 |
SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
233 |
#endif |
|
234 |
||
235 |
/*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
|
236 |
/* option -> may be NULL ! */ |
|
237 |
// SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
|
238 |
void *visit(external_var_declarations_c *symbol); |
|
239 |
||
240 |
/* helper symbol for external_var_declarations */ |
|
241 |
/*| external_declaration_list external_declaration';' */ |
|
242 |
// SYM_LIST(external_declaration_list_c) |
|
243 |
void *visit(external_declaration_list_c *symbol); |
|
244 |
||
245 |
/* global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|function_block_type_name */ |
|
246 |
//SYM_REF2(external_declaration_c, global_var_name, specification) |
|
247 |
void *visit(external_declaration_c *symbol); |
|
248 |
||
249 |
||
250 |
#if 0 |
|
251 |
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
|
252 |
/* option -> may be NULL ! */ |
|
253 |
SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
|
254 |
||
255 |
/* helper symbol for global_var_declarations */ |
|
256 |
/*| global_var_decl_list global_var_decl ';' */ |
|
257 |
SYM_LIST(global_var_decl_list_c) |
|
258 |
||
259 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
260 |
/* type_specification ->may be NULL ! */ |
|
261 |
SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
262 |
||
263 |
/*| global_var_name location */ |
|
264 |
SYM_REF2(global_var_spec_c, global_var_name, location) |
|
265 |
||
266 |
/* AT direct_variable */ |
|
267 |
SYM_REF2(location_c, direct_variable, unused) |
|
268 |
||
269 |
/*| global_var_list ',' global_var_name */ |
|
270 |
SYM_LIST(global_var_list_c) |
|
271 |
||
272 |
/* var1_list ':' single_byte_string_spec */ |
|
273 |
SYM_REF2(single_byte_string_var_declaration_c, var1_list, single_byte_string_spec) |
|
274 |
||
275 |
/* STRING ['[' integer ']'] [ASSIGN single_byte_character_string] */ |
|
276 |
/* integer ->may be NULL ! */ |
|
277 |
/* single_byte_character_string ->may be NULL ! */ |
|
278 |
SYM_REF2(single_byte_string_spec_c, integer, single_byte_character_string) |
|
279 |
||
280 |
/* var1_list ':' double_byte_string_spec */ |
|
281 |
SYM_REF2(double_byte_string_var_declaration_c, var1_list, double_byte_string_spec) |
|
282 |
||
283 |
/* WSTRING ['[' integer ']'] [ASSIGN double_byte_character_string] */ |
|
284 |
/* integer ->may be NULL ! */ |
|
285 |
/* double_byte_character_string ->may be NULL ! */ |
|
286 |
SYM_REF2(double_byte_string_spec_c, integer, double_byte_character_string) |
|
287 |
||
288 |
/*| VAR [RETAIN|NON_RETAIN] incompl_located_var_decl_list END_VAR */ |
|
289 |
/* option ->may be NULL ! */ |
|
290 |
SYM_REF2(incompl_located_var_declarations_c, option, incompl_located_var_decl_list) |
|
291 |
||
292 |
/* helper symbol for incompl_located_var_declarations */ |
|
293 |
/*| incompl_located_var_decl_list incompl_located_var_decl ';' */ |
|
294 |
SYM_LIST(incompl_located_var_decl_list_c) |
|
295 |
||
296 |
/* variable_name incompl_location ':' var_spec */ |
|
297 |
SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused) |
|
298 |
||
299 |
/* AT incompl_location_token */ |
|
300 |
SYM_TOKEN(incompl_location_c) |
|
301 |
#endif |
|
302 |
||
303 |
||
304 |
void *visit(var1_init_decl_c *symbol); |
|
305 |
void *visit(var1_list_c *symbol); |
|
306 |
void *visit(var_init_decl_list_c *symbol); |
|
307 |
||
308 |
||
309 |
/***********************/ |
|
310 |
/* B 1.5.1 - Functions */ |
|
311 |
/***********************/ |
|
312 |
void *visit(function_declaration_c *symbol); |
|
313 |
/* intermediate helper symbol for function_declaration */ |
|
314 |
void *visit(var_declarations_list_c *symbol); |
|
315 |
void *visit(function_var_decls_c *symbol); |
|
316 |
||
317 |
||
318 |
/*****************************/ |
|
319 |
/* B 1.5.2 - Function Blocks */ |
|
320 |
/*****************************/ |
|
321 |
/* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
|
322 |
void *visit(function_block_declaration_c *symbol); |
|
323 |
||
324 |
/* intermediate helper symbol for function_declaration */ |
|
325 |
/* { io_var_declarations | other_var_declarations } */ |
|
326 |
/* |
|
327 |
* NOTE: we re-use the var_declarations_list_c |
|
328 |
*/ |
|
329 |
||
330 |
/* VAR_TEMP temp_var_decl_list END_VAR */ |
|
331 |
void *visit(temp_var_decls_c *symbol); |
|
332 |
void *visit(temp_var_decls_list_c *symbol); |
|
333 |
||
334 |
/* VAR NON_RETAIN var_init_decl_list END_VAR */ |
|
335 |
void *visit(non_retentive_var_decls_c *symbol); |
|
336 |
||
337 |
||
338 |
/**********************/ |
|
339 |
/* B 1.5.3 - Programs */ |
|
340 |
/**********************/ |
|
341 |
/* PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */ |
|
342 |
// SYM_REF4(program_declaration_c, program_type_name, var_declarations, function_block_body, unused) |
|
343 |
void *visit(program_declaration_c *symbol); |
|
344 |
||
345 |
/* intermediate helper symbol for program_declaration_c */ |
|
346 |
/* { io_var_declarations | other_var_declarations } */ |
|
347 |
/* |
|
348 |
* NOTE: we re-use the var_declarations_list_c |
|
349 |
*/ |
|
350 |
||
351 |
}; // function_param_iterator_c |
|
352 |
||
353 |
||
354 |
||
355 |
||
356 |
||
357 |
||
358 |