1 /* |
|
2 * (c) 2003 Mario de Sousa |
|
3 * |
|
4 * Offered to the public under the terms of the GNU General Public License |
|
5 * as published by the Free Software Foundation; either version 2 of the |
|
6 * License, or (at your option) any later version. |
|
7 * |
|
8 * This program is distributed in the hope that it will be useful, but |
|
9 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
11 * Public License for more details. |
|
12 * |
|
13 * This code is made available on the understanding that it will not be |
|
14 * used in safety-critical situations without a full and competent review. |
|
15 */ |
|
16 |
|
17 /* |
|
18 * An IEC 61131-3 IL and ST compiler. |
|
19 * |
|
20 * Based on the |
|
21 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
22 * |
|
23 */ |
|
24 |
|
25 |
|
26 /**** |
|
27 * IEC 61131-3 standard function lib |
|
28 * generated code, do not edit by hand |
|
29 */ |
|
30 switch(current_function_type){ |
|
31 |
|
32 /**** |
|
33 *BOOL_TO_SINT |
|
34 */ |
|
35 case function_bool_to_sint : |
|
36 { |
|
37 symbol_c *last_type_symbol = NULL; |
|
38 |
|
39 { |
|
40 identifier_c param_name("IN"); |
|
41 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
42 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
43 |
|
44 /* Get the value from a foo(<param_value>) style call */ |
|
45 if (IN_param_value == NULL) |
|
46 IN_param_value = function_call_param_iterator.next(); |
|
47 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
48 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
49 |
|
50 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
51 { |
|
52 |
|
53 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
54 s4o.print("("); |
|
55 return_type_symbol->accept(*this); |
|
56 s4o.print(")"); |
|
57 IN_param_value->accept(*this); |
|
58 return NULL; |
|
59 |
|
60 } |
|
61 |
|
62 ERROR; |
|
63 } |
|
64 |
|
65 }/*function_bool_to_sint*/ |
|
66 break; |
|
67 |
|
68 /**** |
|
69 *BOOL_TO_INT |
|
70 */ |
|
71 case function_bool_to_int : |
|
72 { |
|
73 symbol_c *last_type_symbol = NULL; |
|
74 |
|
75 { |
|
76 identifier_c param_name("IN"); |
|
77 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
78 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
79 |
|
80 /* Get the value from a foo(<param_value>) style call */ |
|
81 if (IN_param_value == NULL) |
|
82 IN_param_value = function_call_param_iterator.next(); |
|
83 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
84 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
85 |
|
86 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
87 { |
|
88 |
|
89 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
90 s4o.print("("); |
|
91 return_type_symbol->accept(*this); |
|
92 s4o.print(")"); |
|
93 IN_param_value->accept(*this); |
|
94 return NULL; |
|
95 |
|
96 } |
|
97 |
|
98 ERROR; |
|
99 } |
|
100 |
|
101 }/*function_bool_to_int*/ |
|
102 break; |
|
103 |
|
104 /**** |
|
105 *BOOL_TO_DINT |
|
106 */ |
|
107 case function_bool_to_dint : |
|
108 { |
|
109 symbol_c *last_type_symbol = NULL; |
|
110 |
|
111 { |
|
112 identifier_c param_name("IN"); |
|
113 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
114 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
115 |
|
116 /* Get the value from a foo(<param_value>) style call */ |
|
117 if (IN_param_value == NULL) |
|
118 IN_param_value = function_call_param_iterator.next(); |
|
119 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
120 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
121 |
|
122 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
123 { |
|
124 |
|
125 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
126 s4o.print("("); |
|
127 return_type_symbol->accept(*this); |
|
128 s4o.print(")"); |
|
129 IN_param_value->accept(*this); |
|
130 return NULL; |
|
131 |
|
132 } |
|
133 |
|
134 ERROR; |
|
135 } |
|
136 |
|
137 }/*function_bool_to_dint*/ |
|
138 break; |
|
139 |
|
140 /**** |
|
141 *BOOL_TO_LINT |
|
142 */ |
|
143 case function_bool_to_lint : |
|
144 { |
|
145 symbol_c *last_type_symbol = NULL; |
|
146 |
|
147 { |
|
148 identifier_c param_name("IN"); |
|
149 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
150 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
151 |
|
152 /* Get the value from a foo(<param_value>) style call */ |
|
153 if (IN_param_value == NULL) |
|
154 IN_param_value = function_call_param_iterator.next(); |
|
155 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
156 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
157 |
|
158 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
159 { |
|
160 |
|
161 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
162 s4o.print("("); |
|
163 return_type_symbol->accept(*this); |
|
164 s4o.print(")"); |
|
165 IN_param_value->accept(*this); |
|
166 return NULL; |
|
167 |
|
168 } |
|
169 |
|
170 ERROR; |
|
171 } |
|
172 |
|
173 }/*function_bool_to_lint*/ |
|
174 break; |
|
175 |
|
176 /**** |
|
177 *BOOL_TO_USINT |
|
178 */ |
|
179 case function_bool_to_usint : |
|
180 { |
|
181 symbol_c *last_type_symbol = NULL; |
|
182 |
|
183 { |
|
184 identifier_c param_name("IN"); |
|
185 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
186 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
187 |
|
188 /* Get the value from a foo(<param_value>) style call */ |
|
189 if (IN_param_value == NULL) |
|
190 IN_param_value = function_call_param_iterator.next(); |
|
191 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
192 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
193 |
|
194 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
195 { |
|
196 |
|
197 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
198 s4o.print("("); |
|
199 return_type_symbol->accept(*this); |
|
200 s4o.print(")"); |
|
201 IN_param_value->accept(*this); |
|
202 return NULL; |
|
203 |
|
204 } |
|
205 |
|
206 ERROR; |
|
207 } |
|
208 |
|
209 }/*function_bool_to_usint*/ |
|
210 break; |
|
211 |
|
212 /**** |
|
213 *BOOL_TO_UINT |
|
214 */ |
|
215 case function_bool_to_uint : |
|
216 { |
|
217 symbol_c *last_type_symbol = NULL; |
|
218 |
|
219 { |
|
220 identifier_c param_name("IN"); |
|
221 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
222 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
223 |
|
224 /* Get the value from a foo(<param_value>) style call */ |
|
225 if (IN_param_value == NULL) |
|
226 IN_param_value = function_call_param_iterator.next(); |
|
227 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
228 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
229 |
|
230 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
231 { |
|
232 |
|
233 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
234 s4o.print("("); |
|
235 return_type_symbol->accept(*this); |
|
236 s4o.print(")"); |
|
237 IN_param_value->accept(*this); |
|
238 return NULL; |
|
239 |
|
240 } |
|
241 |
|
242 ERROR; |
|
243 } |
|
244 |
|
245 }/*function_bool_to_uint*/ |
|
246 break; |
|
247 |
|
248 /**** |
|
249 *BOOL_TO_UDINT |
|
250 */ |
|
251 case function_bool_to_udint : |
|
252 { |
|
253 symbol_c *last_type_symbol = NULL; |
|
254 |
|
255 { |
|
256 identifier_c param_name("IN"); |
|
257 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
258 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
259 |
|
260 /* Get the value from a foo(<param_value>) style call */ |
|
261 if (IN_param_value == NULL) |
|
262 IN_param_value = function_call_param_iterator.next(); |
|
263 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
264 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
265 |
|
266 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
267 { |
|
268 |
|
269 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
270 s4o.print("("); |
|
271 return_type_symbol->accept(*this); |
|
272 s4o.print(")"); |
|
273 IN_param_value->accept(*this); |
|
274 return NULL; |
|
275 |
|
276 } |
|
277 |
|
278 ERROR; |
|
279 } |
|
280 |
|
281 }/*function_bool_to_udint*/ |
|
282 break; |
|
283 |
|
284 /**** |
|
285 *BOOL_TO_ULINT |
|
286 */ |
|
287 case function_bool_to_ulint : |
|
288 { |
|
289 symbol_c *last_type_symbol = NULL; |
|
290 |
|
291 { |
|
292 identifier_c param_name("IN"); |
|
293 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
294 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
295 |
|
296 /* Get the value from a foo(<param_value>) style call */ |
|
297 if (IN_param_value == NULL) |
|
298 IN_param_value = function_call_param_iterator.next(); |
|
299 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
300 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
301 |
|
302 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
303 { |
|
304 |
|
305 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
306 s4o.print("("); |
|
307 return_type_symbol->accept(*this); |
|
308 s4o.print(")"); |
|
309 IN_param_value->accept(*this); |
|
310 return NULL; |
|
311 |
|
312 } |
|
313 |
|
314 ERROR; |
|
315 } |
|
316 |
|
317 }/*function_bool_to_ulint*/ |
|
318 break; |
|
319 |
|
320 /**** |
|
321 *BOOL_TO_REAL |
|
322 */ |
|
323 case function_bool_to_real : |
|
324 { |
|
325 symbol_c *last_type_symbol = NULL; |
|
326 |
|
327 { |
|
328 identifier_c param_name("IN"); |
|
329 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
330 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
331 |
|
332 /* Get the value from a foo(<param_value>) style call */ |
|
333 if (IN_param_value == NULL) |
|
334 IN_param_value = function_call_param_iterator.next(); |
|
335 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
336 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
337 |
|
338 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
339 { |
|
340 |
|
341 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
342 s4o.print("("); |
|
343 return_type_symbol->accept(*this); |
|
344 s4o.print(")"); |
|
345 IN_param_value->accept(*this); |
|
346 return NULL; |
|
347 |
|
348 } |
|
349 |
|
350 ERROR; |
|
351 } |
|
352 |
|
353 }/*function_bool_to_real*/ |
|
354 break; |
|
355 |
|
356 /**** |
|
357 *BOOL_TO_LREAL |
|
358 */ |
|
359 case function_bool_to_lreal : |
|
360 { |
|
361 symbol_c *last_type_symbol = NULL; |
|
362 |
|
363 { |
|
364 identifier_c param_name("IN"); |
|
365 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
366 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
367 |
|
368 /* Get the value from a foo(<param_value>) style call */ |
|
369 if (IN_param_value == NULL) |
|
370 IN_param_value = function_call_param_iterator.next(); |
|
371 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
372 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
373 |
|
374 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
375 { |
|
376 |
|
377 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
378 s4o.print("("); |
|
379 return_type_symbol->accept(*this); |
|
380 s4o.print(")"); |
|
381 IN_param_value->accept(*this); |
|
382 return NULL; |
|
383 |
|
384 } |
|
385 |
|
386 ERROR; |
|
387 } |
|
388 |
|
389 }/*function_bool_to_lreal*/ |
|
390 break; |
|
391 |
|
392 /**** |
|
393 *BOOL_TO_TIME |
|
394 */ |
|
395 case function_bool_to_time : |
|
396 { |
|
397 symbol_c *last_type_symbol = NULL; |
|
398 |
|
399 { |
|
400 identifier_c param_name("IN"); |
|
401 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
402 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
403 |
|
404 /* Get the value from a foo(<param_value>) style call */ |
|
405 if (IN_param_value == NULL) |
|
406 IN_param_value = function_call_param_iterator.next(); |
|
407 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
408 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
409 |
|
410 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
411 { |
|
412 |
|
413 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
414 s4o.print("("); |
|
415 return_type_symbol->accept(*this); |
|
416 s4o.print(")__int_to_time("); |
|
417 IN_param_value->accept(*this); |
|
418 s4o.print(")"); |
|
419 return NULL; |
|
420 |
|
421 } |
|
422 |
|
423 ERROR; |
|
424 } |
|
425 |
|
426 }/*function_bool_to_time*/ |
|
427 break; |
|
428 |
|
429 /**** |
|
430 *BOOL_TO_DATE |
|
431 */ |
|
432 case function_bool_to_date : |
|
433 { |
|
434 symbol_c *last_type_symbol = NULL; |
|
435 |
|
436 { |
|
437 identifier_c param_name("IN"); |
|
438 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
439 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
440 |
|
441 /* Get the value from a foo(<param_value>) style call */ |
|
442 if (IN_param_value == NULL) |
|
443 IN_param_value = function_call_param_iterator.next(); |
|
444 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
445 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
446 |
|
447 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
448 { |
|
449 |
|
450 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
451 s4o.print("("); |
|
452 return_type_symbol->accept(*this); |
|
453 s4o.print(")__int_to_time("); |
|
454 IN_param_value->accept(*this); |
|
455 s4o.print(")"); |
|
456 return NULL; |
|
457 |
|
458 } |
|
459 |
|
460 ERROR; |
|
461 } |
|
462 |
|
463 }/*function_bool_to_date*/ |
|
464 break; |
|
465 |
|
466 /**** |
|
467 *BOOL_TO_TOD |
|
468 */ |
|
469 case function_bool_to_tod : |
|
470 { |
|
471 symbol_c *last_type_symbol = NULL; |
|
472 |
|
473 { |
|
474 identifier_c param_name("IN"); |
|
475 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
476 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
477 |
|
478 /* Get the value from a foo(<param_value>) style call */ |
|
479 if (IN_param_value == NULL) |
|
480 IN_param_value = function_call_param_iterator.next(); |
|
481 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
482 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
483 |
|
484 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
485 { |
|
486 |
|
487 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
488 s4o.print("("); |
|
489 return_type_symbol->accept(*this); |
|
490 s4o.print(")__int_to_time("); |
|
491 IN_param_value->accept(*this); |
|
492 s4o.print(")"); |
|
493 return NULL; |
|
494 |
|
495 } |
|
496 |
|
497 ERROR; |
|
498 } |
|
499 |
|
500 }/*function_bool_to_tod*/ |
|
501 break; |
|
502 |
|
503 /**** |
|
504 *BOOL_TO_DT |
|
505 */ |
|
506 case function_bool_to_dt : |
|
507 { |
|
508 symbol_c *last_type_symbol = NULL; |
|
509 |
|
510 { |
|
511 identifier_c param_name("IN"); |
|
512 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
513 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
514 |
|
515 /* Get the value from a foo(<param_value>) style call */ |
|
516 if (IN_param_value == NULL) |
|
517 IN_param_value = function_call_param_iterator.next(); |
|
518 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
519 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
520 |
|
521 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
522 { |
|
523 |
|
524 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
525 s4o.print("("); |
|
526 return_type_symbol->accept(*this); |
|
527 s4o.print(")__int_to_time("); |
|
528 IN_param_value->accept(*this); |
|
529 s4o.print(")"); |
|
530 return NULL; |
|
531 |
|
532 } |
|
533 |
|
534 ERROR; |
|
535 } |
|
536 |
|
537 }/*function_bool_to_dt*/ |
|
538 break; |
|
539 |
|
540 /**** |
|
541 *BOOL_TO_STRING |
|
542 */ |
|
543 case function_bool_to_string : |
|
544 { |
|
545 symbol_c *last_type_symbol = NULL; |
|
546 |
|
547 { |
|
548 identifier_c param_name("IN"); |
|
549 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
550 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
551 |
|
552 /* Get the value from a foo(<param_value>) style call */ |
|
553 if (IN_param_value == NULL) |
|
554 IN_param_value = function_call_param_iterator.next(); |
|
555 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
556 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
557 |
|
558 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
559 { |
|
560 |
|
561 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
562 s4o.print("("); |
|
563 return_type_symbol->accept(*this); |
|
564 s4o.print(")__bool_to_string("); |
|
565 IN_param_value->accept(*this); |
|
566 s4o.print(")"); |
|
567 return NULL; |
|
568 |
|
569 } |
|
570 |
|
571 ERROR; |
|
572 } |
|
573 |
|
574 }/*function_bool_to_string*/ |
|
575 break; |
|
576 |
|
577 /**** |
|
578 *BOOL_TO_BYTE |
|
579 */ |
|
580 case function_bool_to_byte : |
|
581 { |
|
582 symbol_c *last_type_symbol = NULL; |
|
583 |
|
584 { |
|
585 identifier_c param_name("IN"); |
|
586 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
587 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
588 |
|
589 /* Get the value from a foo(<param_value>) style call */ |
|
590 if (IN_param_value == NULL) |
|
591 IN_param_value = function_call_param_iterator.next(); |
|
592 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
593 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
594 |
|
595 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
596 { |
|
597 |
|
598 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
599 s4o.print("("); |
|
600 return_type_symbol->accept(*this); |
|
601 s4o.print(")"); |
|
602 IN_param_value->accept(*this); |
|
603 return NULL; |
|
604 |
|
605 } |
|
606 |
|
607 ERROR; |
|
608 } |
|
609 |
|
610 }/*function_bool_to_byte*/ |
|
611 break; |
|
612 |
|
613 /**** |
|
614 *BOOL_TO_WORD |
|
615 */ |
|
616 case function_bool_to_word : |
|
617 { |
|
618 symbol_c *last_type_symbol = NULL; |
|
619 |
|
620 { |
|
621 identifier_c param_name("IN"); |
|
622 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
623 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
624 |
|
625 /* Get the value from a foo(<param_value>) style call */ |
|
626 if (IN_param_value == NULL) |
|
627 IN_param_value = function_call_param_iterator.next(); |
|
628 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
629 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
630 |
|
631 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
632 { |
|
633 |
|
634 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
635 s4o.print("("); |
|
636 return_type_symbol->accept(*this); |
|
637 s4o.print(")"); |
|
638 IN_param_value->accept(*this); |
|
639 return NULL; |
|
640 |
|
641 } |
|
642 |
|
643 ERROR; |
|
644 } |
|
645 |
|
646 }/*function_bool_to_word*/ |
|
647 break; |
|
648 |
|
649 /**** |
|
650 *BOOL_TO_DWORD |
|
651 */ |
|
652 case function_bool_to_dword : |
|
653 { |
|
654 symbol_c *last_type_symbol = NULL; |
|
655 |
|
656 { |
|
657 identifier_c param_name("IN"); |
|
658 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
659 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
660 |
|
661 /* Get the value from a foo(<param_value>) style call */ |
|
662 if (IN_param_value == NULL) |
|
663 IN_param_value = function_call_param_iterator.next(); |
|
664 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
665 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
666 |
|
667 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
668 { |
|
669 |
|
670 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
671 s4o.print("("); |
|
672 return_type_symbol->accept(*this); |
|
673 s4o.print(")"); |
|
674 IN_param_value->accept(*this); |
|
675 return NULL; |
|
676 |
|
677 } |
|
678 |
|
679 ERROR; |
|
680 } |
|
681 |
|
682 }/*function_bool_to_dword*/ |
|
683 break; |
|
684 |
|
685 /**** |
|
686 *BOOL_TO_LWORD |
|
687 */ |
|
688 case function_bool_to_lword : |
|
689 { |
|
690 symbol_c *last_type_symbol = NULL; |
|
691 |
|
692 { |
|
693 identifier_c param_name("IN"); |
|
694 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
695 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
696 |
|
697 /* Get the value from a foo(<param_value>) style call */ |
|
698 if (IN_param_value == NULL) |
|
699 IN_param_value = function_call_param_iterator.next(); |
|
700 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
701 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
702 |
|
703 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
704 { |
|
705 |
|
706 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
707 s4o.print("("); |
|
708 return_type_symbol->accept(*this); |
|
709 s4o.print(")"); |
|
710 IN_param_value->accept(*this); |
|
711 return NULL; |
|
712 |
|
713 } |
|
714 |
|
715 ERROR; |
|
716 } |
|
717 |
|
718 }/*function_bool_to_lword*/ |
|
719 break; |
|
720 |
|
721 /**** |
|
722 *SINT_TO_BOOL |
|
723 */ |
|
724 case function_sint_to_bool : |
|
725 { |
|
726 symbol_c *last_type_symbol = NULL; |
|
727 |
|
728 { |
|
729 identifier_c param_name("IN"); |
|
730 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
731 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
732 |
|
733 /* Get the value from a foo(<param_value>) style call */ |
|
734 if (IN_param_value == NULL) |
|
735 IN_param_value = function_call_param_iterator.next(); |
|
736 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
737 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
738 |
|
739 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
740 { |
|
741 |
|
742 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
743 s4o.print("("); |
|
744 return_type_symbol->accept(*this); |
|
745 s4o.print(")"); |
|
746 IN_param_value->accept(*this); |
|
747 return NULL; |
|
748 |
|
749 } |
|
750 |
|
751 ERROR; |
|
752 } |
|
753 |
|
754 }/*function_sint_to_bool*/ |
|
755 break; |
|
756 |
|
757 /**** |
|
758 *SINT_TO_INT |
|
759 */ |
|
760 case function_sint_to_int : |
|
761 { |
|
762 symbol_c *last_type_symbol = NULL; |
|
763 |
|
764 { |
|
765 identifier_c param_name("IN"); |
|
766 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
767 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
768 |
|
769 /* Get the value from a foo(<param_value>) style call */ |
|
770 if (IN_param_value == NULL) |
|
771 IN_param_value = function_call_param_iterator.next(); |
|
772 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
773 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
774 |
|
775 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
776 { |
|
777 |
|
778 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
779 s4o.print("("); |
|
780 return_type_symbol->accept(*this); |
|
781 s4o.print(")"); |
|
782 IN_param_value->accept(*this); |
|
783 return NULL; |
|
784 |
|
785 } |
|
786 |
|
787 ERROR; |
|
788 } |
|
789 |
|
790 }/*function_sint_to_int*/ |
|
791 break; |
|
792 |
|
793 /**** |
|
794 *SINT_TO_DINT |
|
795 */ |
|
796 case function_sint_to_dint : |
|
797 { |
|
798 symbol_c *last_type_symbol = NULL; |
|
799 |
|
800 { |
|
801 identifier_c param_name("IN"); |
|
802 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
803 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
804 |
|
805 /* Get the value from a foo(<param_value>) style call */ |
|
806 if (IN_param_value == NULL) |
|
807 IN_param_value = function_call_param_iterator.next(); |
|
808 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
809 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
810 |
|
811 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
812 { |
|
813 |
|
814 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
815 s4o.print("("); |
|
816 return_type_symbol->accept(*this); |
|
817 s4o.print(")"); |
|
818 IN_param_value->accept(*this); |
|
819 return NULL; |
|
820 |
|
821 } |
|
822 |
|
823 ERROR; |
|
824 } |
|
825 |
|
826 }/*function_sint_to_dint*/ |
|
827 break; |
|
828 |
|
829 /**** |
|
830 *SINT_TO_LINT |
|
831 */ |
|
832 case function_sint_to_lint : |
|
833 { |
|
834 symbol_c *last_type_symbol = NULL; |
|
835 |
|
836 { |
|
837 identifier_c param_name("IN"); |
|
838 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
839 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
840 |
|
841 /* Get the value from a foo(<param_value>) style call */ |
|
842 if (IN_param_value == NULL) |
|
843 IN_param_value = function_call_param_iterator.next(); |
|
844 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
845 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
846 |
|
847 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
848 { |
|
849 |
|
850 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
851 s4o.print("("); |
|
852 return_type_symbol->accept(*this); |
|
853 s4o.print(")"); |
|
854 IN_param_value->accept(*this); |
|
855 return NULL; |
|
856 |
|
857 } |
|
858 |
|
859 ERROR; |
|
860 } |
|
861 |
|
862 }/*function_sint_to_lint*/ |
|
863 break; |
|
864 |
|
865 /**** |
|
866 *SINT_TO_USINT |
|
867 */ |
|
868 case function_sint_to_usint : |
|
869 { |
|
870 symbol_c *last_type_symbol = NULL; |
|
871 |
|
872 { |
|
873 identifier_c param_name("IN"); |
|
874 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
875 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
876 |
|
877 /* Get the value from a foo(<param_value>) style call */ |
|
878 if (IN_param_value == NULL) |
|
879 IN_param_value = function_call_param_iterator.next(); |
|
880 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
881 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
882 |
|
883 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
884 { |
|
885 |
|
886 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
887 s4o.print("("); |
|
888 return_type_symbol->accept(*this); |
|
889 s4o.print(")"); |
|
890 IN_param_value->accept(*this); |
|
891 return NULL; |
|
892 |
|
893 } |
|
894 |
|
895 ERROR; |
|
896 } |
|
897 |
|
898 }/*function_sint_to_usint*/ |
|
899 break; |
|
900 |
|
901 /**** |
|
902 *SINT_TO_UINT |
|
903 */ |
|
904 case function_sint_to_uint : |
|
905 { |
|
906 symbol_c *last_type_symbol = NULL; |
|
907 |
|
908 { |
|
909 identifier_c param_name("IN"); |
|
910 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
911 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
912 |
|
913 /* Get the value from a foo(<param_value>) style call */ |
|
914 if (IN_param_value == NULL) |
|
915 IN_param_value = function_call_param_iterator.next(); |
|
916 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
917 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
918 |
|
919 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
920 { |
|
921 |
|
922 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
923 s4o.print("("); |
|
924 return_type_symbol->accept(*this); |
|
925 s4o.print(")"); |
|
926 IN_param_value->accept(*this); |
|
927 return NULL; |
|
928 |
|
929 } |
|
930 |
|
931 ERROR; |
|
932 } |
|
933 |
|
934 }/*function_sint_to_uint*/ |
|
935 break; |
|
936 |
|
937 /**** |
|
938 *SINT_TO_UDINT |
|
939 */ |
|
940 case function_sint_to_udint : |
|
941 { |
|
942 symbol_c *last_type_symbol = NULL; |
|
943 |
|
944 { |
|
945 identifier_c param_name("IN"); |
|
946 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
947 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
948 |
|
949 /* Get the value from a foo(<param_value>) style call */ |
|
950 if (IN_param_value == NULL) |
|
951 IN_param_value = function_call_param_iterator.next(); |
|
952 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
953 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
954 |
|
955 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
956 { |
|
957 |
|
958 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
959 s4o.print("("); |
|
960 return_type_symbol->accept(*this); |
|
961 s4o.print(")"); |
|
962 IN_param_value->accept(*this); |
|
963 return NULL; |
|
964 |
|
965 } |
|
966 |
|
967 ERROR; |
|
968 } |
|
969 |
|
970 }/*function_sint_to_udint*/ |
|
971 break; |
|
972 |
|
973 /**** |
|
974 *SINT_TO_ULINT |
|
975 */ |
|
976 case function_sint_to_ulint : |
|
977 { |
|
978 symbol_c *last_type_symbol = NULL; |
|
979 |
|
980 { |
|
981 identifier_c param_name("IN"); |
|
982 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
983 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
984 |
|
985 /* Get the value from a foo(<param_value>) style call */ |
|
986 if (IN_param_value == NULL) |
|
987 IN_param_value = function_call_param_iterator.next(); |
|
988 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
989 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
990 |
|
991 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
992 { |
|
993 |
|
994 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
995 s4o.print("("); |
|
996 return_type_symbol->accept(*this); |
|
997 s4o.print(")"); |
|
998 IN_param_value->accept(*this); |
|
999 return NULL; |
|
1000 |
|
1001 } |
|
1002 |
|
1003 ERROR; |
|
1004 } |
|
1005 |
|
1006 }/*function_sint_to_ulint*/ |
|
1007 break; |
|
1008 |
|
1009 /**** |
|
1010 *SINT_TO_REAL |
|
1011 */ |
|
1012 case function_sint_to_real : |
|
1013 { |
|
1014 symbol_c *last_type_symbol = NULL; |
|
1015 |
|
1016 { |
|
1017 identifier_c param_name("IN"); |
|
1018 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1019 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1020 |
|
1021 /* Get the value from a foo(<param_value>) style call */ |
|
1022 if (IN_param_value == NULL) |
|
1023 IN_param_value = function_call_param_iterator.next(); |
|
1024 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1025 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1026 |
|
1027 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1028 { |
|
1029 |
|
1030 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
1031 s4o.print("("); |
|
1032 return_type_symbol->accept(*this); |
|
1033 s4o.print(")"); |
|
1034 IN_param_value->accept(*this); |
|
1035 return NULL; |
|
1036 |
|
1037 } |
|
1038 |
|
1039 ERROR; |
|
1040 } |
|
1041 |
|
1042 }/*function_sint_to_real*/ |
|
1043 break; |
|
1044 |
|
1045 /**** |
|
1046 *SINT_TO_LREAL |
|
1047 */ |
|
1048 case function_sint_to_lreal : |
|
1049 { |
|
1050 symbol_c *last_type_symbol = NULL; |
|
1051 |
|
1052 { |
|
1053 identifier_c param_name("IN"); |
|
1054 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1055 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1056 |
|
1057 /* Get the value from a foo(<param_value>) style call */ |
|
1058 if (IN_param_value == NULL) |
|
1059 IN_param_value = function_call_param_iterator.next(); |
|
1060 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1061 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1062 |
|
1063 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1064 { |
|
1065 |
|
1066 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
1067 s4o.print("("); |
|
1068 return_type_symbol->accept(*this); |
|
1069 s4o.print(")"); |
|
1070 IN_param_value->accept(*this); |
|
1071 return NULL; |
|
1072 |
|
1073 } |
|
1074 |
|
1075 ERROR; |
|
1076 } |
|
1077 |
|
1078 }/*function_sint_to_lreal*/ |
|
1079 break; |
|
1080 |
|
1081 /**** |
|
1082 *SINT_TO_TIME |
|
1083 */ |
|
1084 case function_sint_to_time : |
|
1085 { |
|
1086 symbol_c *last_type_symbol = NULL; |
|
1087 |
|
1088 { |
|
1089 identifier_c param_name("IN"); |
|
1090 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1091 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1092 |
|
1093 /* Get the value from a foo(<param_value>) style call */ |
|
1094 if (IN_param_value == NULL) |
|
1095 IN_param_value = function_call_param_iterator.next(); |
|
1096 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1097 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1098 |
|
1099 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1100 { |
|
1101 |
|
1102 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
1103 s4o.print("("); |
|
1104 return_type_symbol->accept(*this); |
|
1105 s4o.print(")__int_to_time("); |
|
1106 IN_param_value->accept(*this); |
|
1107 s4o.print(")"); |
|
1108 return NULL; |
|
1109 |
|
1110 } |
|
1111 |
|
1112 ERROR; |
|
1113 } |
|
1114 |
|
1115 }/*function_sint_to_time*/ |
|
1116 break; |
|
1117 |
|
1118 /**** |
|
1119 *SINT_TO_DATE |
|
1120 */ |
|
1121 case function_sint_to_date : |
|
1122 { |
|
1123 symbol_c *last_type_symbol = NULL; |
|
1124 |
|
1125 { |
|
1126 identifier_c param_name("IN"); |
|
1127 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1128 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1129 |
|
1130 /* Get the value from a foo(<param_value>) style call */ |
|
1131 if (IN_param_value == NULL) |
|
1132 IN_param_value = function_call_param_iterator.next(); |
|
1133 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1134 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1135 |
|
1136 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1137 { |
|
1138 |
|
1139 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
1140 s4o.print("("); |
|
1141 return_type_symbol->accept(*this); |
|
1142 s4o.print(")__int_to_time("); |
|
1143 IN_param_value->accept(*this); |
|
1144 s4o.print(")"); |
|
1145 return NULL; |
|
1146 |
|
1147 } |
|
1148 |
|
1149 ERROR; |
|
1150 } |
|
1151 |
|
1152 }/*function_sint_to_date*/ |
|
1153 break; |
|
1154 |
|
1155 /**** |
|
1156 *SINT_TO_TOD |
|
1157 */ |
|
1158 case function_sint_to_tod : |
|
1159 { |
|
1160 symbol_c *last_type_symbol = NULL; |
|
1161 |
|
1162 { |
|
1163 identifier_c param_name("IN"); |
|
1164 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1165 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1166 |
|
1167 /* Get the value from a foo(<param_value>) style call */ |
|
1168 if (IN_param_value == NULL) |
|
1169 IN_param_value = function_call_param_iterator.next(); |
|
1170 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1171 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1172 |
|
1173 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1174 { |
|
1175 |
|
1176 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
1177 s4o.print("("); |
|
1178 return_type_symbol->accept(*this); |
|
1179 s4o.print(")__int_to_time("); |
|
1180 IN_param_value->accept(*this); |
|
1181 s4o.print(")"); |
|
1182 return NULL; |
|
1183 |
|
1184 } |
|
1185 |
|
1186 ERROR; |
|
1187 } |
|
1188 |
|
1189 }/*function_sint_to_tod*/ |
|
1190 break; |
|
1191 |
|
1192 /**** |
|
1193 *SINT_TO_DT |
|
1194 */ |
|
1195 case function_sint_to_dt : |
|
1196 { |
|
1197 symbol_c *last_type_symbol = NULL; |
|
1198 |
|
1199 { |
|
1200 identifier_c param_name("IN"); |
|
1201 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1202 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1203 |
|
1204 /* Get the value from a foo(<param_value>) style call */ |
|
1205 if (IN_param_value == NULL) |
|
1206 IN_param_value = function_call_param_iterator.next(); |
|
1207 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1208 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1209 |
|
1210 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1211 { |
|
1212 |
|
1213 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
1214 s4o.print("("); |
|
1215 return_type_symbol->accept(*this); |
|
1216 s4o.print(")__int_to_time("); |
|
1217 IN_param_value->accept(*this); |
|
1218 s4o.print(")"); |
|
1219 return NULL; |
|
1220 |
|
1221 } |
|
1222 |
|
1223 ERROR; |
|
1224 } |
|
1225 |
|
1226 }/*function_sint_to_dt*/ |
|
1227 break; |
|
1228 |
|
1229 /**** |
|
1230 *SINT_TO_STRING |
|
1231 */ |
|
1232 case function_sint_to_string : |
|
1233 { |
|
1234 symbol_c *last_type_symbol = NULL; |
|
1235 |
|
1236 { |
|
1237 identifier_c param_name("IN"); |
|
1238 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1239 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1240 |
|
1241 /* Get the value from a foo(<param_value>) style call */ |
|
1242 if (IN_param_value == NULL) |
|
1243 IN_param_value = function_call_param_iterator.next(); |
|
1244 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1245 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1246 |
|
1247 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1248 { |
|
1249 |
|
1250 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
1251 s4o.print("("); |
|
1252 return_type_symbol->accept(*this); |
|
1253 s4o.print(")__sint_to_string("); |
|
1254 IN_param_value->accept(*this); |
|
1255 s4o.print(")"); |
|
1256 return NULL; |
|
1257 |
|
1258 } |
|
1259 |
|
1260 ERROR; |
|
1261 } |
|
1262 |
|
1263 }/*function_sint_to_string*/ |
|
1264 break; |
|
1265 |
|
1266 /**** |
|
1267 *SINT_TO_BYTE |
|
1268 */ |
|
1269 case function_sint_to_byte : |
|
1270 { |
|
1271 symbol_c *last_type_symbol = NULL; |
|
1272 |
|
1273 { |
|
1274 identifier_c param_name("IN"); |
|
1275 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1276 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1277 |
|
1278 /* Get the value from a foo(<param_value>) style call */ |
|
1279 if (IN_param_value == NULL) |
|
1280 IN_param_value = function_call_param_iterator.next(); |
|
1281 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1282 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1283 |
|
1284 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1285 { |
|
1286 |
|
1287 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
1288 s4o.print("("); |
|
1289 return_type_symbol->accept(*this); |
|
1290 s4o.print(")"); |
|
1291 IN_param_value->accept(*this); |
|
1292 return NULL; |
|
1293 |
|
1294 } |
|
1295 |
|
1296 ERROR; |
|
1297 } |
|
1298 |
|
1299 }/*function_sint_to_byte*/ |
|
1300 break; |
|
1301 |
|
1302 /**** |
|
1303 *SINT_TO_WORD |
|
1304 */ |
|
1305 case function_sint_to_word : |
|
1306 { |
|
1307 symbol_c *last_type_symbol = NULL; |
|
1308 |
|
1309 { |
|
1310 identifier_c param_name("IN"); |
|
1311 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1312 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1313 |
|
1314 /* Get the value from a foo(<param_value>) style call */ |
|
1315 if (IN_param_value == NULL) |
|
1316 IN_param_value = function_call_param_iterator.next(); |
|
1317 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1318 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1319 |
|
1320 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1321 { |
|
1322 |
|
1323 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
1324 s4o.print("("); |
|
1325 return_type_symbol->accept(*this); |
|
1326 s4o.print(")"); |
|
1327 IN_param_value->accept(*this); |
|
1328 return NULL; |
|
1329 |
|
1330 } |
|
1331 |
|
1332 ERROR; |
|
1333 } |
|
1334 |
|
1335 }/*function_sint_to_word*/ |
|
1336 break; |
|
1337 |
|
1338 /**** |
|
1339 *SINT_TO_DWORD |
|
1340 */ |
|
1341 case function_sint_to_dword : |
|
1342 { |
|
1343 symbol_c *last_type_symbol = NULL; |
|
1344 |
|
1345 { |
|
1346 identifier_c param_name("IN"); |
|
1347 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1348 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1349 |
|
1350 /* Get the value from a foo(<param_value>) style call */ |
|
1351 if (IN_param_value == NULL) |
|
1352 IN_param_value = function_call_param_iterator.next(); |
|
1353 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1354 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1355 |
|
1356 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1357 { |
|
1358 |
|
1359 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
1360 s4o.print("("); |
|
1361 return_type_symbol->accept(*this); |
|
1362 s4o.print(")"); |
|
1363 IN_param_value->accept(*this); |
|
1364 return NULL; |
|
1365 |
|
1366 } |
|
1367 |
|
1368 ERROR; |
|
1369 } |
|
1370 |
|
1371 }/*function_sint_to_dword*/ |
|
1372 break; |
|
1373 |
|
1374 /**** |
|
1375 *SINT_TO_LWORD |
|
1376 */ |
|
1377 case function_sint_to_lword : |
|
1378 { |
|
1379 symbol_c *last_type_symbol = NULL; |
|
1380 |
|
1381 { |
|
1382 identifier_c param_name("IN"); |
|
1383 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1384 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1385 |
|
1386 /* Get the value from a foo(<param_value>) style call */ |
|
1387 if (IN_param_value == NULL) |
|
1388 IN_param_value = function_call_param_iterator.next(); |
|
1389 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1390 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1391 |
|
1392 if(search_expression_type->is_same_type(&search_constant_type_c::sint_type_name, last_type_symbol)) |
|
1393 { |
|
1394 |
|
1395 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
1396 s4o.print("("); |
|
1397 return_type_symbol->accept(*this); |
|
1398 s4o.print(")"); |
|
1399 IN_param_value->accept(*this); |
|
1400 return NULL; |
|
1401 |
|
1402 } |
|
1403 |
|
1404 ERROR; |
|
1405 } |
|
1406 |
|
1407 }/*function_sint_to_lword*/ |
|
1408 break; |
|
1409 |
|
1410 /**** |
|
1411 *INT_TO_BOOL |
|
1412 */ |
|
1413 case function_int_to_bool : |
|
1414 { |
|
1415 symbol_c *last_type_symbol = NULL; |
|
1416 |
|
1417 { |
|
1418 identifier_c param_name("IN"); |
|
1419 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1420 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1421 |
|
1422 /* Get the value from a foo(<param_value>) style call */ |
|
1423 if (IN_param_value == NULL) |
|
1424 IN_param_value = function_call_param_iterator.next(); |
|
1425 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1426 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1427 |
|
1428 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1429 { |
|
1430 |
|
1431 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
1432 s4o.print("("); |
|
1433 return_type_symbol->accept(*this); |
|
1434 s4o.print(")"); |
|
1435 IN_param_value->accept(*this); |
|
1436 return NULL; |
|
1437 |
|
1438 } |
|
1439 |
|
1440 ERROR; |
|
1441 } |
|
1442 |
|
1443 }/*function_int_to_bool*/ |
|
1444 break; |
|
1445 |
|
1446 /**** |
|
1447 *INT_TO_SINT |
|
1448 */ |
|
1449 case function_int_to_sint : |
|
1450 { |
|
1451 symbol_c *last_type_symbol = NULL; |
|
1452 |
|
1453 { |
|
1454 identifier_c param_name("IN"); |
|
1455 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1456 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1457 |
|
1458 /* Get the value from a foo(<param_value>) style call */ |
|
1459 if (IN_param_value == NULL) |
|
1460 IN_param_value = function_call_param_iterator.next(); |
|
1461 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1462 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1463 |
|
1464 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1465 { |
|
1466 |
|
1467 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
1468 s4o.print("("); |
|
1469 return_type_symbol->accept(*this); |
|
1470 s4o.print(")"); |
|
1471 IN_param_value->accept(*this); |
|
1472 return NULL; |
|
1473 |
|
1474 } |
|
1475 |
|
1476 ERROR; |
|
1477 } |
|
1478 |
|
1479 }/*function_int_to_sint*/ |
|
1480 break; |
|
1481 |
|
1482 /**** |
|
1483 *INT_TO_DINT |
|
1484 */ |
|
1485 case function_int_to_dint : |
|
1486 { |
|
1487 symbol_c *last_type_symbol = NULL; |
|
1488 |
|
1489 { |
|
1490 identifier_c param_name("IN"); |
|
1491 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1492 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1493 |
|
1494 /* Get the value from a foo(<param_value>) style call */ |
|
1495 if (IN_param_value == NULL) |
|
1496 IN_param_value = function_call_param_iterator.next(); |
|
1497 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1498 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1499 |
|
1500 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1501 { |
|
1502 |
|
1503 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
1504 s4o.print("("); |
|
1505 return_type_symbol->accept(*this); |
|
1506 s4o.print(")"); |
|
1507 IN_param_value->accept(*this); |
|
1508 return NULL; |
|
1509 |
|
1510 } |
|
1511 |
|
1512 ERROR; |
|
1513 } |
|
1514 |
|
1515 }/*function_int_to_dint*/ |
|
1516 break; |
|
1517 |
|
1518 /**** |
|
1519 *INT_TO_LINT |
|
1520 */ |
|
1521 case function_int_to_lint : |
|
1522 { |
|
1523 symbol_c *last_type_symbol = NULL; |
|
1524 |
|
1525 { |
|
1526 identifier_c param_name("IN"); |
|
1527 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1528 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1529 |
|
1530 /* Get the value from a foo(<param_value>) style call */ |
|
1531 if (IN_param_value == NULL) |
|
1532 IN_param_value = function_call_param_iterator.next(); |
|
1533 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1534 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1535 |
|
1536 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1537 { |
|
1538 |
|
1539 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
1540 s4o.print("("); |
|
1541 return_type_symbol->accept(*this); |
|
1542 s4o.print(")"); |
|
1543 IN_param_value->accept(*this); |
|
1544 return NULL; |
|
1545 |
|
1546 } |
|
1547 |
|
1548 ERROR; |
|
1549 } |
|
1550 |
|
1551 }/*function_int_to_lint*/ |
|
1552 break; |
|
1553 |
|
1554 /**** |
|
1555 *INT_TO_USINT |
|
1556 */ |
|
1557 case function_int_to_usint : |
|
1558 { |
|
1559 symbol_c *last_type_symbol = NULL; |
|
1560 |
|
1561 { |
|
1562 identifier_c param_name("IN"); |
|
1563 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1564 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1565 |
|
1566 /* Get the value from a foo(<param_value>) style call */ |
|
1567 if (IN_param_value == NULL) |
|
1568 IN_param_value = function_call_param_iterator.next(); |
|
1569 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1570 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1571 |
|
1572 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1573 { |
|
1574 |
|
1575 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
1576 s4o.print("("); |
|
1577 return_type_symbol->accept(*this); |
|
1578 s4o.print(")"); |
|
1579 IN_param_value->accept(*this); |
|
1580 return NULL; |
|
1581 |
|
1582 } |
|
1583 |
|
1584 ERROR; |
|
1585 } |
|
1586 |
|
1587 }/*function_int_to_usint*/ |
|
1588 break; |
|
1589 |
|
1590 /**** |
|
1591 *INT_TO_UINT |
|
1592 */ |
|
1593 case function_int_to_uint : |
|
1594 { |
|
1595 symbol_c *last_type_symbol = NULL; |
|
1596 |
|
1597 { |
|
1598 identifier_c param_name("IN"); |
|
1599 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1600 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1601 |
|
1602 /* Get the value from a foo(<param_value>) style call */ |
|
1603 if (IN_param_value == NULL) |
|
1604 IN_param_value = function_call_param_iterator.next(); |
|
1605 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1606 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1607 |
|
1608 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1609 { |
|
1610 |
|
1611 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
1612 s4o.print("("); |
|
1613 return_type_symbol->accept(*this); |
|
1614 s4o.print(")"); |
|
1615 IN_param_value->accept(*this); |
|
1616 return NULL; |
|
1617 |
|
1618 } |
|
1619 |
|
1620 ERROR; |
|
1621 } |
|
1622 |
|
1623 }/*function_int_to_uint*/ |
|
1624 break; |
|
1625 |
|
1626 /**** |
|
1627 *INT_TO_UDINT |
|
1628 */ |
|
1629 case function_int_to_udint : |
|
1630 { |
|
1631 symbol_c *last_type_symbol = NULL; |
|
1632 |
|
1633 { |
|
1634 identifier_c param_name("IN"); |
|
1635 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1636 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1637 |
|
1638 /* Get the value from a foo(<param_value>) style call */ |
|
1639 if (IN_param_value == NULL) |
|
1640 IN_param_value = function_call_param_iterator.next(); |
|
1641 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1642 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1643 |
|
1644 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1645 { |
|
1646 |
|
1647 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
1648 s4o.print("("); |
|
1649 return_type_symbol->accept(*this); |
|
1650 s4o.print(")"); |
|
1651 IN_param_value->accept(*this); |
|
1652 return NULL; |
|
1653 |
|
1654 } |
|
1655 |
|
1656 ERROR; |
|
1657 } |
|
1658 |
|
1659 }/*function_int_to_udint*/ |
|
1660 break; |
|
1661 |
|
1662 /**** |
|
1663 *INT_TO_ULINT |
|
1664 */ |
|
1665 case function_int_to_ulint : |
|
1666 { |
|
1667 symbol_c *last_type_symbol = NULL; |
|
1668 |
|
1669 { |
|
1670 identifier_c param_name("IN"); |
|
1671 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1672 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1673 |
|
1674 /* Get the value from a foo(<param_value>) style call */ |
|
1675 if (IN_param_value == NULL) |
|
1676 IN_param_value = function_call_param_iterator.next(); |
|
1677 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1678 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1679 |
|
1680 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1681 { |
|
1682 |
|
1683 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
1684 s4o.print("("); |
|
1685 return_type_symbol->accept(*this); |
|
1686 s4o.print(")"); |
|
1687 IN_param_value->accept(*this); |
|
1688 return NULL; |
|
1689 |
|
1690 } |
|
1691 |
|
1692 ERROR; |
|
1693 } |
|
1694 |
|
1695 }/*function_int_to_ulint*/ |
|
1696 break; |
|
1697 |
|
1698 /**** |
|
1699 *INT_TO_REAL |
|
1700 */ |
|
1701 case function_int_to_real : |
|
1702 { |
|
1703 symbol_c *last_type_symbol = NULL; |
|
1704 |
|
1705 { |
|
1706 identifier_c param_name("IN"); |
|
1707 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1708 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1709 |
|
1710 /* Get the value from a foo(<param_value>) style call */ |
|
1711 if (IN_param_value == NULL) |
|
1712 IN_param_value = function_call_param_iterator.next(); |
|
1713 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1714 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1715 |
|
1716 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1717 { |
|
1718 |
|
1719 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
1720 s4o.print("("); |
|
1721 return_type_symbol->accept(*this); |
|
1722 s4o.print(")"); |
|
1723 IN_param_value->accept(*this); |
|
1724 return NULL; |
|
1725 |
|
1726 } |
|
1727 |
|
1728 ERROR; |
|
1729 } |
|
1730 |
|
1731 }/*function_int_to_real*/ |
|
1732 break; |
|
1733 |
|
1734 /**** |
|
1735 *INT_TO_LREAL |
|
1736 */ |
|
1737 case function_int_to_lreal : |
|
1738 { |
|
1739 symbol_c *last_type_symbol = NULL; |
|
1740 |
|
1741 { |
|
1742 identifier_c param_name("IN"); |
|
1743 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1744 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1745 |
|
1746 /* Get the value from a foo(<param_value>) style call */ |
|
1747 if (IN_param_value == NULL) |
|
1748 IN_param_value = function_call_param_iterator.next(); |
|
1749 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1750 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1751 |
|
1752 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1753 { |
|
1754 |
|
1755 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
1756 s4o.print("("); |
|
1757 return_type_symbol->accept(*this); |
|
1758 s4o.print(")"); |
|
1759 IN_param_value->accept(*this); |
|
1760 return NULL; |
|
1761 |
|
1762 } |
|
1763 |
|
1764 ERROR; |
|
1765 } |
|
1766 |
|
1767 }/*function_int_to_lreal*/ |
|
1768 break; |
|
1769 |
|
1770 /**** |
|
1771 *INT_TO_TIME |
|
1772 */ |
|
1773 case function_int_to_time : |
|
1774 { |
|
1775 symbol_c *last_type_symbol = NULL; |
|
1776 |
|
1777 { |
|
1778 identifier_c param_name("IN"); |
|
1779 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1780 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1781 |
|
1782 /* Get the value from a foo(<param_value>) style call */ |
|
1783 if (IN_param_value == NULL) |
|
1784 IN_param_value = function_call_param_iterator.next(); |
|
1785 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1786 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1787 |
|
1788 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1789 { |
|
1790 |
|
1791 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
1792 s4o.print("("); |
|
1793 return_type_symbol->accept(*this); |
|
1794 s4o.print(")__int_to_time("); |
|
1795 IN_param_value->accept(*this); |
|
1796 s4o.print(")"); |
|
1797 return NULL; |
|
1798 |
|
1799 } |
|
1800 |
|
1801 ERROR; |
|
1802 } |
|
1803 |
|
1804 }/*function_int_to_time*/ |
|
1805 break; |
|
1806 |
|
1807 /**** |
|
1808 *INT_TO_DATE |
|
1809 */ |
|
1810 case function_int_to_date : |
|
1811 { |
|
1812 symbol_c *last_type_symbol = NULL; |
|
1813 |
|
1814 { |
|
1815 identifier_c param_name("IN"); |
|
1816 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1817 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1818 |
|
1819 /* Get the value from a foo(<param_value>) style call */ |
|
1820 if (IN_param_value == NULL) |
|
1821 IN_param_value = function_call_param_iterator.next(); |
|
1822 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1823 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1824 |
|
1825 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1826 { |
|
1827 |
|
1828 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
1829 s4o.print("("); |
|
1830 return_type_symbol->accept(*this); |
|
1831 s4o.print(")__int_to_time("); |
|
1832 IN_param_value->accept(*this); |
|
1833 s4o.print(")"); |
|
1834 return NULL; |
|
1835 |
|
1836 } |
|
1837 |
|
1838 ERROR; |
|
1839 } |
|
1840 |
|
1841 }/*function_int_to_date*/ |
|
1842 break; |
|
1843 |
|
1844 /**** |
|
1845 *INT_TO_TOD |
|
1846 */ |
|
1847 case function_int_to_tod : |
|
1848 { |
|
1849 symbol_c *last_type_symbol = NULL; |
|
1850 |
|
1851 { |
|
1852 identifier_c param_name("IN"); |
|
1853 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1854 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1855 |
|
1856 /* Get the value from a foo(<param_value>) style call */ |
|
1857 if (IN_param_value == NULL) |
|
1858 IN_param_value = function_call_param_iterator.next(); |
|
1859 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1860 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1861 |
|
1862 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1863 { |
|
1864 |
|
1865 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
1866 s4o.print("("); |
|
1867 return_type_symbol->accept(*this); |
|
1868 s4o.print(")__int_to_time("); |
|
1869 IN_param_value->accept(*this); |
|
1870 s4o.print(")"); |
|
1871 return NULL; |
|
1872 |
|
1873 } |
|
1874 |
|
1875 ERROR; |
|
1876 } |
|
1877 |
|
1878 }/*function_int_to_tod*/ |
|
1879 break; |
|
1880 |
|
1881 /**** |
|
1882 *INT_TO_DT |
|
1883 */ |
|
1884 case function_int_to_dt : |
|
1885 { |
|
1886 symbol_c *last_type_symbol = NULL; |
|
1887 |
|
1888 { |
|
1889 identifier_c param_name("IN"); |
|
1890 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1891 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1892 |
|
1893 /* Get the value from a foo(<param_value>) style call */ |
|
1894 if (IN_param_value == NULL) |
|
1895 IN_param_value = function_call_param_iterator.next(); |
|
1896 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1897 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1898 |
|
1899 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1900 { |
|
1901 |
|
1902 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
1903 s4o.print("("); |
|
1904 return_type_symbol->accept(*this); |
|
1905 s4o.print(")__int_to_time("); |
|
1906 IN_param_value->accept(*this); |
|
1907 s4o.print(")"); |
|
1908 return NULL; |
|
1909 |
|
1910 } |
|
1911 |
|
1912 ERROR; |
|
1913 } |
|
1914 |
|
1915 }/*function_int_to_dt*/ |
|
1916 break; |
|
1917 |
|
1918 /**** |
|
1919 *INT_TO_STRING |
|
1920 */ |
|
1921 case function_int_to_string : |
|
1922 { |
|
1923 symbol_c *last_type_symbol = NULL; |
|
1924 |
|
1925 { |
|
1926 identifier_c param_name("IN"); |
|
1927 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1928 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1929 |
|
1930 /* Get the value from a foo(<param_value>) style call */ |
|
1931 if (IN_param_value == NULL) |
|
1932 IN_param_value = function_call_param_iterator.next(); |
|
1933 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1934 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1935 |
|
1936 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1937 { |
|
1938 |
|
1939 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
1940 s4o.print("("); |
|
1941 return_type_symbol->accept(*this); |
|
1942 s4o.print(")__sint_to_string("); |
|
1943 IN_param_value->accept(*this); |
|
1944 s4o.print(")"); |
|
1945 return NULL; |
|
1946 |
|
1947 } |
|
1948 |
|
1949 ERROR; |
|
1950 } |
|
1951 |
|
1952 }/*function_int_to_string*/ |
|
1953 break; |
|
1954 |
|
1955 /**** |
|
1956 *INT_TO_BYTE |
|
1957 */ |
|
1958 case function_int_to_byte : |
|
1959 { |
|
1960 symbol_c *last_type_symbol = NULL; |
|
1961 |
|
1962 { |
|
1963 identifier_c param_name("IN"); |
|
1964 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
1965 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
1966 |
|
1967 /* Get the value from a foo(<param_value>) style call */ |
|
1968 if (IN_param_value == NULL) |
|
1969 IN_param_value = function_call_param_iterator.next(); |
|
1970 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
1971 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
1972 |
|
1973 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
1974 { |
|
1975 |
|
1976 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
1977 s4o.print("("); |
|
1978 return_type_symbol->accept(*this); |
|
1979 s4o.print(")"); |
|
1980 IN_param_value->accept(*this); |
|
1981 return NULL; |
|
1982 |
|
1983 } |
|
1984 |
|
1985 ERROR; |
|
1986 } |
|
1987 |
|
1988 }/*function_int_to_byte*/ |
|
1989 break; |
|
1990 |
|
1991 /**** |
|
1992 *INT_TO_WORD |
|
1993 */ |
|
1994 case function_int_to_word : |
|
1995 { |
|
1996 symbol_c *last_type_symbol = NULL; |
|
1997 |
|
1998 { |
|
1999 identifier_c param_name("IN"); |
|
2000 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2001 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2002 |
|
2003 /* Get the value from a foo(<param_value>) style call */ |
|
2004 if (IN_param_value == NULL) |
|
2005 IN_param_value = function_call_param_iterator.next(); |
|
2006 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2007 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2008 |
|
2009 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
2010 { |
|
2011 |
|
2012 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
2013 s4o.print("("); |
|
2014 return_type_symbol->accept(*this); |
|
2015 s4o.print(")"); |
|
2016 IN_param_value->accept(*this); |
|
2017 return NULL; |
|
2018 |
|
2019 } |
|
2020 |
|
2021 ERROR; |
|
2022 } |
|
2023 |
|
2024 }/*function_int_to_word*/ |
|
2025 break; |
|
2026 |
|
2027 /**** |
|
2028 *INT_TO_DWORD |
|
2029 */ |
|
2030 case function_int_to_dword : |
|
2031 { |
|
2032 symbol_c *last_type_symbol = NULL; |
|
2033 |
|
2034 { |
|
2035 identifier_c param_name("IN"); |
|
2036 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2037 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2038 |
|
2039 /* Get the value from a foo(<param_value>) style call */ |
|
2040 if (IN_param_value == NULL) |
|
2041 IN_param_value = function_call_param_iterator.next(); |
|
2042 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2043 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2044 |
|
2045 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
2046 { |
|
2047 |
|
2048 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
2049 s4o.print("("); |
|
2050 return_type_symbol->accept(*this); |
|
2051 s4o.print(")"); |
|
2052 IN_param_value->accept(*this); |
|
2053 return NULL; |
|
2054 |
|
2055 } |
|
2056 |
|
2057 ERROR; |
|
2058 } |
|
2059 |
|
2060 }/*function_int_to_dword*/ |
|
2061 break; |
|
2062 |
|
2063 /**** |
|
2064 *INT_TO_LWORD |
|
2065 */ |
|
2066 case function_int_to_lword : |
|
2067 { |
|
2068 symbol_c *last_type_symbol = NULL; |
|
2069 |
|
2070 { |
|
2071 identifier_c param_name("IN"); |
|
2072 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2073 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2074 |
|
2075 /* Get the value from a foo(<param_value>) style call */ |
|
2076 if (IN_param_value == NULL) |
|
2077 IN_param_value = function_call_param_iterator.next(); |
|
2078 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2079 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2080 |
|
2081 if(search_expression_type->is_same_type(&search_constant_type_c::int_type_name, last_type_symbol)) |
|
2082 { |
|
2083 |
|
2084 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
2085 s4o.print("("); |
|
2086 return_type_symbol->accept(*this); |
|
2087 s4o.print(")"); |
|
2088 IN_param_value->accept(*this); |
|
2089 return NULL; |
|
2090 |
|
2091 } |
|
2092 |
|
2093 ERROR; |
|
2094 } |
|
2095 |
|
2096 }/*function_int_to_lword*/ |
|
2097 break; |
|
2098 |
|
2099 /**** |
|
2100 *DINT_TO_BOOL |
|
2101 */ |
|
2102 case function_dint_to_bool : |
|
2103 { |
|
2104 symbol_c *last_type_symbol = NULL; |
|
2105 |
|
2106 { |
|
2107 identifier_c param_name("IN"); |
|
2108 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2109 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2110 |
|
2111 /* Get the value from a foo(<param_value>) style call */ |
|
2112 if (IN_param_value == NULL) |
|
2113 IN_param_value = function_call_param_iterator.next(); |
|
2114 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2115 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2116 |
|
2117 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2118 { |
|
2119 |
|
2120 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
2121 s4o.print("("); |
|
2122 return_type_symbol->accept(*this); |
|
2123 s4o.print(")"); |
|
2124 IN_param_value->accept(*this); |
|
2125 return NULL; |
|
2126 |
|
2127 } |
|
2128 |
|
2129 ERROR; |
|
2130 } |
|
2131 |
|
2132 }/*function_dint_to_bool*/ |
|
2133 break; |
|
2134 |
|
2135 /**** |
|
2136 *DINT_TO_SINT |
|
2137 */ |
|
2138 case function_dint_to_sint : |
|
2139 { |
|
2140 symbol_c *last_type_symbol = NULL; |
|
2141 |
|
2142 { |
|
2143 identifier_c param_name("IN"); |
|
2144 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2145 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2146 |
|
2147 /* Get the value from a foo(<param_value>) style call */ |
|
2148 if (IN_param_value == NULL) |
|
2149 IN_param_value = function_call_param_iterator.next(); |
|
2150 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2151 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2152 |
|
2153 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2154 { |
|
2155 |
|
2156 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
2157 s4o.print("("); |
|
2158 return_type_symbol->accept(*this); |
|
2159 s4o.print(")"); |
|
2160 IN_param_value->accept(*this); |
|
2161 return NULL; |
|
2162 |
|
2163 } |
|
2164 |
|
2165 ERROR; |
|
2166 } |
|
2167 |
|
2168 }/*function_dint_to_sint*/ |
|
2169 break; |
|
2170 |
|
2171 /**** |
|
2172 *DINT_TO_INT |
|
2173 */ |
|
2174 case function_dint_to_int : |
|
2175 { |
|
2176 symbol_c *last_type_symbol = NULL; |
|
2177 |
|
2178 { |
|
2179 identifier_c param_name("IN"); |
|
2180 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2181 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2182 |
|
2183 /* Get the value from a foo(<param_value>) style call */ |
|
2184 if (IN_param_value == NULL) |
|
2185 IN_param_value = function_call_param_iterator.next(); |
|
2186 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2187 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2188 |
|
2189 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2190 { |
|
2191 |
|
2192 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
2193 s4o.print("("); |
|
2194 return_type_symbol->accept(*this); |
|
2195 s4o.print(")"); |
|
2196 IN_param_value->accept(*this); |
|
2197 return NULL; |
|
2198 |
|
2199 } |
|
2200 |
|
2201 ERROR; |
|
2202 } |
|
2203 |
|
2204 }/*function_dint_to_int*/ |
|
2205 break; |
|
2206 |
|
2207 /**** |
|
2208 *DINT_TO_LINT |
|
2209 */ |
|
2210 case function_dint_to_lint : |
|
2211 { |
|
2212 symbol_c *last_type_symbol = NULL; |
|
2213 |
|
2214 { |
|
2215 identifier_c param_name("IN"); |
|
2216 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2217 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2218 |
|
2219 /* Get the value from a foo(<param_value>) style call */ |
|
2220 if (IN_param_value == NULL) |
|
2221 IN_param_value = function_call_param_iterator.next(); |
|
2222 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2223 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2224 |
|
2225 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2226 { |
|
2227 |
|
2228 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
2229 s4o.print("("); |
|
2230 return_type_symbol->accept(*this); |
|
2231 s4o.print(")"); |
|
2232 IN_param_value->accept(*this); |
|
2233 return NULL; |
|
2234 |
|
2235 } |
|
2236 |
|
2237 ERROR; |
|
2238 } |
|
2239 |
|
2240 }/*function_dint_to_lint*/ |
|
2241 break; |
|
2242 |
|
2243 /**** |
|
2244 *DINT_TO_USINT |
|
2245 */ |
|
2246 case function_dint_to_usint : |
|
2247 { |
|
2248 symbol_c *last_type_symbol = NULL; |
|
2249 |
|
2250 { |
|
2251 identifier_c param_name("IN"); |
|
2252 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2253 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2254 |
|
2255 /* Get the value from a foo(<param_value>) style call */ |
|
2256 if (IN_param_value == NULL) |
|
2257 IN_param_value = function_call_param_iterator.next(); |
|
2258 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2259 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2260 |
|
2261 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2262 { |
|
2263 |
|
2264 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
2265 s4o.print("("); |
|
2266 return_type_symbol->accept(*this); |
|
2267 s4o.print(")"); |
|
2268 IN_param_value->accept(*this); |
|
2269 return NULL; |
|
2270 |
|
2271 } |
|
2272 |
|
2273 ERROR; |
|
2274 } |
|
2275 |
|
2276 }/*function_dint_to_usint*/ |
|
2277 break; |
|
2278 |
|
2279 /**** |
|
2280 *DINT_TO_UINT |
|
2281 */ |
|
2282 case function_dint_to_uint : |
|
2283 { |
|
2284 symbol_c *last_type_symbol = NULL; |
|
2285 |
|
2286 { |
|
2287 identifier_c param_name("IN"); |
|
2288 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2289 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2290 |
|
2291 /* Get the value from a foo(<param_value>) style call */ |
|
2292 if (IN_param_value == NULL) |
|
2293 IN_param_value = function_call_param_iterator.next(); |
|
2294 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2295 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2296 |
|
2297 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2298 { |
|
2299 |
|
2300 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
2301 s4o.print("("); |
|
2302 return_type_symbol->accept(*this); |
|
2303 s4o.print(")"); |
|
2304 IN_param_value->accept(*this); |
|
2305 return NULL; |
|
2306 |
|
2307 } |
|
2308 |
|
2309 ERROR; |
|
2310 } |
|
2311 |
|
2312 }/*function_dint_to_uint*/ |
|
2313 break; |
|
2314 |
|
2315 /**** |
|
2316 *DINT_TO_UDINT |
|
2317 */ |
|
2318 case function_dint_to_udint : |
|
2319 { |
|
2320 symbol_c *last_type_symbol = NULL; |
|
2321 |
|
2322 { |
|
2323 identifier_c param_name("IN"); |
|
2324 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2325 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2326 |
|
2327 /* Get the value from a foo(<param_value>) style call */ |
|
2328 if (IN_param_value == NULL) |
|
2329 IN_param_value = function_call_param_iterator.next(); |
|
2330 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2331 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2332 |
|
2333 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2334 { |
|
2335 |
|
2336 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
2337 s4o.print("("); |
|
2338 return_type_symbol->accept(*this); |
|
2339 s4o.print(")"); |
|
2340 IN_param_value->accept(*this); |
|
2341 return NULL; |
|
2342 |
|
2343 } |
|
2344 |
|
2345 ERROR; |
|
2346 } |
|
2347 |
|
2348 }/*function_dint_to_udint*/ |
|
2349 break; |
|
2350 |
|
2351 /**** |
|
2352 *DINT_TO_ULINT |
|
2353 */ |
|
2354 case function_dint_to_ulint : |
|
2355 { |
|
2356 symbol_c *last_type_symbol = NULL; |
|
2357 |
|
2358 { |
|
2359 identifier_c param_name("IN"); |
|
2360 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2361 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2362 |
|
2363 /* Get the value from a foo(<param_value>) style call */ |
|
2364 if (IN_param_value == NULL) |
|
2365 IN_param_value = function_call_param_iterator.next(); |
|
2366 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2367 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2368 |
|
2369 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2370 { |
|
2371 |
|
2372 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
2373 s4o.print("("); |
|
2374 return_type_symbol->accept(*this); |
|
2375 s4o.print(")"); |
|
2376 IN_param_value->accept(*this); |
|
2377 return NULL; |
|
2378 |
|
2379 } |
|
2380 |
|
2381 ERROR; |
|
2382 } |
|
2383 |
|
2384 }/*function_dint_to_ulint*/ |
|
2385 break; |
|
2386 |
|
2387 /**** |
|
2388 *DINT_TO_REAL |
|
2389 */ |
|
2390 case function_dint_to_real : |
|
2391 { |
|
2392 symbol_c *last_type_symbol = NULL; |
|
2393 |
|
2394 { |
|
2395 identifier_c param_name("IN"); |
|
2396 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2397 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2398 |
|
2399 /* Get the value from a foo(<param_value>) style call */ |
|
2400 if (IN_param_value == NULL) |
|
2401 IN_param_value = function_call_param_iterator.next(); |
|
2402 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2403 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2404 |
|
2405 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2406 { |
|
2407 |
|
2408 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
2409 s4o.print("("); |
|
2410 return_type_symbol->accept(*this); |
|
2411 s4o.print(")"); |
|
2412 IN_param_value->accept(*this); |
|
2413 return NULL; |
|
2414 |
|
2415 } |
|
2416 |
|
2417 ERROR; |
|
2418 } |
|
2419 |
|
2420 }/*function_dint_to_real*/ |
|
2421 break; |
|
2422 |
|
2423 /**** |
|
2424 *DINT_TO_LREAL |
|
2425 */ |
|
2426 case function_dint_to_lreal : |
|
2427 { |
|
2428 symbol_c *last_type_symbol = NULL; |
|
2429 |
|
2430 { |
|
2431 identifier_c param_name("IN"); |
|
2432 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2433 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2434 |
|
2435 /* Get the value from a foo(<param_value>) style call */ |
|
2436 if (IN_param_value == NULL) |
|
2437 IN_param_value = function_call_param_iterator.next(); |
|
2438 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2439 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2440 |
|
2441 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2442 { |
|
2443 |
|
2444 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
2445 s4o.print("("); |
|
2446 return_type_symbol->accept(*this); |
|
2447 s4o.print(")"); |
|
2448 IN_param_value->accept(*this); |
|
2449 return NULL; |
|
2450 |
|
2451 } |
|
2452 |
|
2453 ERROR; |
|
2454 } |
|
2455 |
|
2456 }/*function_dint_to_lreal*/ |
|
2457 break; |
|
2458 |
|
2459 /**** |
|
2460 *DINT_TO_TIME |
|
2461 */ |
|
2462 case function_dint_to_time : |
|
2463 { |
|
2464 symbol_c *last_type_symbol = NULL; |
|
2465 |
|
2466 { |
|
2467 identifier_c param_name("IN"); |
|
2468 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2469 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2470 |
|
2471 /* Get the value from a foo(<param_value>) style call */ |
|
2472 if (IN_param_value == NULL) |
|
2473 IN_param_value = function_call_param_iterator.next(); |
|
2474 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2475 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2476 |
|
2477 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2478 { |
|
2479 |
|
2480 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
2481 s4o.print("("); |
|
2482 return_type_symbol->accept(*this); |
|
2483 s4o.print(")__int_to_time("); |
|
2484 IN_param_value->accept(*this); |
|
2485 s4o.print(")"); |
|
2486 return NULL; |
|
2487 |
|
2488 } |
|
2489 |
|
2490 ERROR; |
|
2491 } |
|
2492 |
|
2493 }/*function_dint_to_time*/ |
|
2494 break; |
|
2495 |
|
2496 /**** |
|
2497 *DINT_TO_DATE |
|
2498 */ |
|
2499 case function_dint_to_date : |
|
2500 { |
|
2501 symbol_c *last_type_symbol = NULL; |
|
2502 |
|
2503 { |
|
2504 identifier_c param_name("IN"); |
|
2505 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2506 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2507 |
|
2508 /* Get the value from a foo(<param_value>) style call */ |
|
2509 if (IN_param_value == NULL) |
|
2510 IN_param_value = function_call_param_iterator.next(); |
|
2511 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2512 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2513 |
|
2514 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2515 { |
|
2516 |
|
2517 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
2518 s4o.print("("); |
|
2519 return_type_symbol->accept(*this); |
|
2520 s4o.print(")__int_to_time("); |
|
2521 IN_param_value->accept(*this); |
|
2522 s4o.print(")"); |
|
2523 return NULL; |
|
2524 |
|
2525 } |
|
2526 |
|
2527 ERROR; |
|
2528 } |
|
2529 |
|
2530 }/*function_dint_to_date*/ |
|
2531 break; |
|
2532 |
|
2533 /**** |
|
2534 *DINT_TO_TOD |
|
2535 */ |
|
2536 case function_dint_to_tod : |
|
2537 { |
|
2538 symbol_c *last_type_symbol = NULL; |
|
2539 |
|
2540 { |
|
2541 identifier_c param_name("IN"); |
|
2542 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2543 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2544 |
|
2545 /* Get the value from a foo(<param_value>) style call */ |
|
2546 if (IN_param_value == NULL) |
|
2547 IN_param_value = function_call_param_iterator.next(); |
|
2548 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2549 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2550 |
|
2551 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2552 { |
|
2553 |
|
2554 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
2555 s4o.print("("); |
|
2556 return_type_symbol->accept(*this); |
|
2557 s4o.print(")__int_to_time("); |
|
2558 IN_param_value->accept(*this); |
|
2559 s4o.print(")"); |
|
2560 return NULL; |
|
2561 |
|
2562 } |
|
2563 |
|
2564 ERROR; |
|
2565 } |
|
2566 |
|
2567 }/*function_dint_to_tod*/ |
|
2568 break; |
|
2569 |
|
2570 /**** |
|
2571 *DINT_TO_DT |
|
2572 */ |
|
2573 case function_dint_to_dt : |
|
2574 { |
|
2575 symbol_c *last_type_symbol = NULL; |
|
2576 |
|
2577 { |
|
2578 identifier_c param_name("IN"); |
|
2579 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2580 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2581 |
|
2582 /* Get the value from a foo(<param_value>) style call */ |
|
2583 if (IN_param_value == NULL) |
|
2584 IN_param_value = function_call_param_iterator.next(); |
|
2585 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2586 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2587 |
|
2588 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2589 { |
|
2590 |
|
2591 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
2592 s4o.print("("); |
|
2593 return_type_symbol->accept(*this); |
|
2594 s4o.print(")__int_to_time("); |
|
2595 IN_param_value->accept(*this); |
|
2596 s4o.print(")"); |
|
2597 return NULL; |
|
2598 |
|
2599 } |
|
2600 |
|
2601 ERROR; |
|
2602 } |
|
2603 |
|
2604 }/*function_dint_to_dt*/ |
|
2605 break; |
|
2606 |
|
2607 /**** |
|
2608 *DINT_TO_STRING |
|
2609 */ |
|
2610 case function_dint_to_string : |
|
2611 { |
|
2612 symbol_c *last_type_symbol = NULL; |
|
2613 |
|
2614 { |
|
2615 identifier_c param_name("IN"); |
|
2616 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2617 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2618 |
|
2619 /* Get the value from a foo(<param_value>) style call */ |
|
2620 if (IN_param_value == NULL) |
|
2621 IN_param_value = function_call_param_iterator.next(); |
|
2622 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2623 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2624 |
|
2625 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2626 { |
|
2627 |
|
2628 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
2629 s4o.print("("); |
|
2630 return_type_symbol->accept(*this); |
|
2631 s4o.print(")__sint_to_string("); |
|
2632 IN_param_value->accept(*this); |
|
2633 s4o.print(")"); |
|
2634 return NULL; |
|
2635 |
|
2636 } |
|
2637 |
|
2638 ERROR; |
|
2639 } |
|
2640 |
|
2641 }/*function_dint_to_string*/ |
|
2642 break; |
|
2643 |
|
2644 /**** |
|
2645 *DINT_TO_BYTE |
|
2646 */ |
|
2647 case function_dint_to_byte : |
|
2648 { |
|
2649 symbol_c *last_type_symbol = NULL; |
|
2650 |
|
2651 { |
|
2652 identifier_c param_name("IN"); |
|
2653 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2654 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2655 |
|
2656 /* Get the value from a foo(<param_value>) style call */ |
|
2657 if (IN_param_value == NULL) |
|
2658 IN_param_value = function_call_param_iterator.next(); |
|
2659 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2660 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2661 |
|
2662 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2663 { |
|
2664 |
|
2665 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
2666 s4o.print("("); |
|
2667 return_type_symbol->accept(*this); |
|
2668 s4o.print(")"); |
|
2669 IN_param_value->accept(*this); |
|
2670 return NULL; |
|
2671 |
|
2672 } |
|
2673 |
|
2674 ERROR; |
|
2675 } |
|
2676 |
|
2677 }/*function_dint_to_byte*/ |
|
2678 break; |
|
2679 |
|
2680 /**** |
|
2681 *DINT_TO_WORD |
|
2682 */ |
|
2683 case function_dint_to_word : |
|
2684 { |
|
2685 symbol_c *last_type_symbol = NULL; |
|
2686 |
|
2687 { |
|
2688 identifier_c param_name("IN"); |
|
2689 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2690 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2691 |
|
2692 /* Get the value from a foo(<param_value>) style call */ |
|
2693 if (IN_param_value == NULL) |
|
2694 IN_param_value = function_call_param_iterator.next(); |
|
2695 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2696 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2697 |
|
2698 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2699 { |
|
2700 |
|
2701 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
2702 s4o.print("("); |
|
2703 return_type_symbol->accept(*this); |
|
2704 s4o.print(")"); |
|
2705 IN_param_value->accept(*this); |
|
2706 return NULL; |
|
2707 |
|
2708 } |
|
2709 |
|
2710 ERROR; |
|
2711 } |
|
2712 |
|
2713 }/*function_dint_to_word*/ |
|
2714 break; |
|
2715 |
|
2716 /**** |
|
2717 *DINT_TO_DWORD |
|
2718 */ |
|
2719 case function_dint_to_dword : |
|
2720 { |
|
2721 symbol_c *last_type_symbol = NULL; |
|
2722 |
|
2723 { |
|
2724 identifier_c param_name("IN"); |
|
2725 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2726 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2727 |
|
2728 /* Get the value from a foo(<param_value>) style call */ |
|
2729 if (IN_param_value == NULL) |
|
2730 IN_param_value = function_call_param_iterator.next(); |
|
2731 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2732 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2733 |
|
2734 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2735 { |
|
2736 |
|
2737 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
2738 s4o.print("("); |
|
2739 return_type_symbol->accept(*this); |
|
2740 s4o.print(")"); |
|
2741 IN_param_value->accept(*this); |
|
2742 return NULL; |
|
2743 |
|
2744 } |
|
2745 |
|
2746 ERROR; |
|
2747 } |
|
2748 |
|
2749 }/*function_dint_to_dword*/ |
|
2750 break; |
|
2751 |
|
2752 /**** |
|
2753 *DINT_TO_LWORD |
|
2754 */ |
|
2755 case function_dint_to_lword : |
|
2756 { |
|
2757 symbol_c *last_type_symbol = NULL; |
|
2758 |
|
2759 { |
|
2760 identifier_c param_name("IN"); |
|
2761 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2762 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2763 |
|
2764 /* Get the value from a foo(<param_value>) style call */ |
|
2765 if (IN_param_value == NULL) |
|
2766 IN_param_value = function_call_param_iterator.next(); |
|
2767 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2768 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2769 |
|
2770 if(search_expression_type->is_same_type(&search_constant_type_c::dint_type_name, last_type_symbol)) |
|
2771 { |
|
2772 |
|
2773 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
2774 s4o.print("("); |
|
2775 return_type_symbol->accept(*this); |
|
2776 s4o.print(")"); |
|
2777 IN_param_value->accept(*this); |
|
2778 return NULL; |
|
2779 |
|
2780 } |
|
2781 |
|
2782 ERROR; |
|
2783 } |
|
2784 |
|
2785 }/*function_dint_to_lword*/ |
|
2786 break; |
|
2787 |
|
2788 /**** |
|
2789 *LINT_TO_BOOL |
|
2790 */ |
|
2791 case function_lint_to_bool : |
|
2792 { |
|
2793 symbol_c *last_type_symbol = NULL; |
|
2794 |
|
2795 { |
|
2796 identifier_c param_name("IN"); |
|
2797 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2798 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2799 |
|
2800 /* Get the value from a foo(<param_value>) style call */ |
|
2801 if (IN_param_value == NULL) |
|
2802 IN_param_value = function_call_param_iterator.next(); |
|
2803 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2804 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2805 |
|
2806 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2807 { |
|
2808 |
|
2809 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
2810 s4o.print("("); |
|
2811 return_type_symbol->accept(*this); |
|
2812 s4o.print(")"); |
|
2813 IN_param_value->accept(*this); |
|
2814 return NULL; |
|
2815 |
|
2816 } |
|
2817 |
|
2818 ERROR; |
|
2819 } |
|
2820 |
|
2821 }/*function_lint_to_bool*/ |
|
2822 break; |
|
2823 |
|
2824 /**** |
|
2825 *LINT_TO_SINT |
|
2826 */ |
|
2827 case function_lint_to_sint : |
|
2828 { |
|
2829 symbol_c *last_type_symbol = NULL; |
|
2830 |
|
2831 { |
|
2832 identifier_c param_name("IN"); |
|
2833 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2834 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2835 |
|
2836 /* Get the value from a foo(<param_value>) style call */ |
|
2837 if (IN_param_value == NULL) |
|
2838 IN_param_value = function_call_param_iterator.next(); |
|
2839 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2840 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2841 |
|
2842 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2843 { |
|
2844 |
|
2845 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
2846 s4o.print("("); |
|
2847 return_type_symbol->accept(*this); |
|
2848 s4o.print(")"); |
|
2849 IN_param_value->accept(*this); |
|
2850 return NULL; |
|
2851 |
|
2852 } |
|
2853 |
|
2854 ERROR; |
|
2855 } |
|
2856 |
|
2857 }/*function_lint_to_sint*/ |
|
2858 break; |
|
2859 |
|
2860 /**** |
|
2861 *LINT_TO_INT |
|
2862 */ |
|
2863 case function_lint_to_int : |
|
2864 { |
|
2865 symbol_c *last_type_symbol = NULL; |
|
2866 |
|
2867 { |
|
2868 identifier_c param_name("IN"); |
|
2869 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2870 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2871 |
|
2872 /* Get the value from a foo(<param_value>) style call */ |
|
2873 if (IN_param_value == NULL) |
|
2874 IN_param_value = function_call_param_iterator.next(); |
|
2875 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2876 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2877 |
|
2878 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2879 { |
|
2880 |
|
2881 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
2882 s4o.print("("); |
|
2883 return_type_symbol->accept(*this); |
|
2884 s4o.print(")"); |
|
2885 IN_param_value->accept(*this); |
|
2886 return NULL; |
|
2887 |
|
2888 } |
|
2889 |
|
2890 ERROR; |
|
2891 } |
|
2892 |
|
2893 }/*function_lint_to_int*/ |
|
2894 break; |
|
2895 |
|
2896 /**** |
|
2897 *LINT_TO_DINT |
|
2898 */ |
|
2899 case function_lint_to_dint : |
|
2900 { |
|
2901 symbol_c *last_type_symbol = NULL; |
|
2902 |
|
2903 { |
|
2904 identifier_c param_name("IN"); |
|
2905 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2906 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2907 |
|
2908 /* Get the value from a foo(<param_value>) style call */ |
|
2909 if (IN_param_value == NULL) |
|
2910 IN_param_value = function_call_param_iterator.next(); |
|
2911 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2912 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2913 |
|
2914 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2915 { |
|
2916 |
|
2917 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
2918 s4o.print("("); |
|
2919 return_type_symbol->accept(*this); |
|
2920 s4o.print(")"); |
|
2921 IN_param_value->accept(*this); |
|
2922 return NULL; |
|
2923 |
|
2924 } |
|
2925 |
|
2926 ERROR; |
|
2927 } |
|
2928 |
|
2929 }/*function_lint_to_dint*/ |
|
2930 break; |
|
2931 |
|
2932 /**** |
|
2933 *LINT_TO_USINT |
|
2934 */ |
|
2935 case function_lint_to_usint : |
|
2936 { |
|
2937 symbol_c *last_type_symbol = NULL; |
|
2938 |
|
2939 { |
|
2940 identifier_c param_name("IN"); |
|
2941 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2942 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2943 |
|
2944 /* Get the value from a foo(<param_value>) style call */ |
|
2945 if (IN_param_value == NULL) |
|
2946 IN_param_value = function_call_param_iterator.next(); |
|
2947 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2948 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2949 |
|
2950 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2951 { |
|
2952 |
|
2953 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
2954 s4o.print("("); |
|
2955 return_type_symbol->accept(*this); |
|
2956 s4o.print(")"); |
|
2957 IN_param_value->accept(*this); |
|
2958 return NULL; |
|
2959 |
|
2960 } |
|
2961 |
|
2962 ERROR; |
|
2963 } |
|
2964 |
|
2965 }/*function_lint_to_usint*/ |
|
2966 break; |
|
2967 |
|
2968 /**** |
|
2969 *LINT_TO_UINT |
|
2970 */ |
|
2971 case function_lint_to_uint : |
|
2972 { |
|
2973 symbol_c *last_type_symbol = NULL; |
|
2974 |
|
2975 { |
|
2976 identifier_c param_name("IN"); |
|
2977 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
2978 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
2979 |
|
2980 /* Get the value from a foo(<param_value>) style call */ |
|
2981 if (IN_param_value == NULL) |
|
2982 IN_param_value = function_call_param_iterator.next(); |
|
2983 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
2984 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
2985 |
|
2986 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
2987 { |
|
2988 |
|
2989 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
2990 s4o.print("("); |
|
2991 return_type_symbol->accept(*this); |
|
2992 s4o.print(")"); |
|
2993 IN_param_value->accept(*this); |
|
2994 return NULL; |
|
2995 |
|
2996 } |
|
2997 |
|
2998 ERROR; |
|
2999 } |
|
3000 |
|
3001 }/*function_lint_to_uint*/ |
|
3002 break; |
|
3003 |
|
3004 /**** |
|
3005 *LINT_TO_UDINT |
|
3006 */ |
|
3007 case function_lint_to_udint : |
|
3008 { |
|
3009 symbol_c *last_type_symbol = NULL; |
|
3010 |
|
3011 { |
|
3012 identifier_c param_name("IN"); |
|
3013 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3014 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3015 |
|
3016 /* Get the value from a foo(<param_value>) style call */ |
|
3017 if (IN_param_value == NULL) |
|
3018 IN_param_value = function_call_param_iterator.next(); |
|
3019 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3020 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3021 |
|
3022 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3023 { |
|
3024 |
|
3025 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
3026 s4o.print("("); |
|
3027 return_type_symbol->accept(*this); |
|
3028 s4o.print(")"); |
|
3029 IN_param_value->accept(*this); |
|
3030 return NULL; |
|
3031 |
|
3032 } |
|
3033 |
|
3034 ERROR; |
|
3035 } |
|
3036 |
|
3037 }/*function_lint_to_udint*/ |
|
3038 break; |
|
3039 |
|
3040 /**** |
|
3041 *LINT_TO_ULINT |
|
3042 */ |
|
3043 case function_lint_to_ulint : |
|
3044 { |
|
3045 symbol_c *last_type_symbol = NULL; |
|
3046 |
|
3047 { |
|
3048 identifier_c param_name("IN"); |
|
3049 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3050 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3051 |
|
3052 /* Get the value from a foo(<param_value>) style call */ |
|
3053 if (IN_param_value == NULL) |
|
3054 IN_param_value = function_call_param_iterator.next(); |
|
3055 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3056 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3057 |
|
3058 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3059 { |
|
3060 |
|
3061 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
3062 s4o.print("("); |
|
3063 return_type_symbol->accept(*this); |
|
3064 s4o.print(")"); |
|
3065 IN_param_value->accept(*this); |
|
3066 return NULL; |
|
3067 |
|
3068 } |
|
3069 |
|
3070 ERROR; |
|
3071 } |
|
3072 |
|
3073 }/*function_lint_to_ulint*/ |
|
3074 break; |
|
3075 |
|
3076 /**** |
|
3077 *LINT_TO_REAL |
|
3078 */ |
|
3079 case function_lint_to_real : |
|
3080 { |
|
3081 symbol_c *last_type_symbol = NULL; |
|
3082 |
|
3083 { |
|
3084 identifier_c param_name("IN"); |
|
3085 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3086 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3087 |
|
3088 /* Get the value from a foo(<param_value>) style call */ |
|
3089 if (IN_param_value == NULL) |
|
3090 IN_param_value = function_call_param_iterator.next(); |
|
3091 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3092 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3093 |
|
3094 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3095 { |
|
3096 |
|
3097 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
3098 s4o.print("("); |
|
3099 return_type_symbol->accept(*this); |
|
3100 s4o.print(")"); |
|
3101 IN_param_value->accept(*this); |
|
3102 return NULL; |
|
3103 |
|
3104 } |
|
3105 |
|
3106 ERROR; |
|
3107 } |
|
3108 |
|
3109 }/*function_lint_to_real*/ |
|
3110 break; |
|
3111 |
|
3112 /**** |
|
3113 *LINT_TO_LREAL |
|
3114 */ |
|
3115 case function_lint_to_lreal : |
|
3116 { |
|
3117 symbol_c *last_type_symbol = NULL; |
|
3118 |
|
3119 { |
|
3120 identifier_c param_name("IN"); |
|
3121 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3122 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3123 |
|
3124 /* Get the value from a foo(<param_value>) style call */ |
|
3125 if (IN_param_value == NULL) |
|
3126 IN_param_value = function_call_param_iterator.next(); |
|
3127 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3128 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3129 |
|
3130 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3131 { |
|
3132 |
|
3133 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
3134 s4o.print("("); |
|
3135 return_type_symbol->accept(*this); |
|
3136 s4o.print(")"); |
|
3137 IN_param_value->accept(*this); |
|
3138 return NULL; |
|
3139 |
|
3140 } |
|
3141 |
|
3142 ERROR; |
|
3143 } |
|
3144 |
|
3145 }/*function_lint_to_lreal*/ |
|
3146 break; |
|
3147 |
|
3148 /**** |
|
3149 *LINT_TO_TIME |
|
3150 */ |
|
3151 case function_lint_to_time : |
|
3152 { |
|
3153 symbol_c *last_type_symbol = NULL; |
|
3154 |
|
3155 { |
|
3156 identifier_c param_name("IN"); |
|
3157 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3158 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3159 |
|
3160 /* Get the value from a foo(<param_value>) style call */ |
|
3161 if (IN_param_value == NULL) |
|
3162 IN_param_value = function_call_param_iterator.next(); |
|
3163 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3164 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3165 |
|
3166 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3167 { |
|
3168 |
|
3169 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
3170 s4o.print("("); |
|
3171 return_type_symbol->accept(*this); |
|
3172 s4o.print(")__int_to_time("); |
|
3173 IN_param_value->accept(*this); |
|
3174 s4o.print(")"); |
|
3175 return NULL; |
|
3176 |
|
3177 } |
|
3178 |
|
3179 ERROR; |
|
3180 } |
|
3181 |
|
3182 }/*function_lint_to_time*/ |
|
3183 break; |
|
3184 |
|
3185 /**** |
|
3186 *LINT_TO_DATE |
|
3187 */ |
|
3188 case function_lint_to_date : |
|
3189 { |
|
3190 symbol_c *last_type_symbol = NULL; |
|
3191 |
|
3192 { |
|
3193 identifier_c param_name("IN"); |
|
3194 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3195 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3196 |
|
3197 /* Get the value from a foo(<param_value>) style call */ |
|
3198 if (IN_param_value == NULL) |
|
3199 IN_param_value = function_call_param_iterator.next(); |
|
3200 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3201 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3202 |
|
3203 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3204 { |
|
3205 |
|
3206 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
3207 s4o.print("("); |
|
3208 return_type_symbol->accept(*this); |
|
3209 s4o.print(")__int_to_time("); |
|
3210 IN_param_value->accept(*this); |
|
3211 s4o.print(")"); |
|
3212 return NULL; |
|
3213 |
|
3214 } |
|
3215 |
|
3216 ERROR; |
|
3217 } |
|
3218 |
|
3219 }/*function_lint_to_date*/ |
|
3220 break; |
|
3221 |
|
3222 /**** |
|
3223 *LINT_TO_TOD |
|
3224 */ |
|
3225 case function_lint_to_tod : |
|
3226 { |
|
3227 symbol_c *last_type_symbol = NULL; |
|
3228 |
|
3229 { |
|
3230 identifier_c param_name("IN"); |
|
3231 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3232 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3233 |
|
3234 /* Get the value from a foo(<param_value>) style call */ |
|
3235 if (IN_param_value == NULL) |
|
3236 IN_param_value = function_call_param_iterator.next(); |
|
3237 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3238 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3239 |
|
3240 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3241 { |
|
3242 |
|
3243 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
3244 s4o.print("("); |
|
3245 return_type_symbol->accept(*this); |
|
3246 s4o.print(")__int_to_time("); |
|
3247 IN_param_value->accept(*this); |
|
3248 s4o.print(")"); |
|
3249 return NULL; |
|
3250 |
|
3251 } |
|
3252 |
|
3253 ERROR; |
|
3254 } |
|
3255 |
|
3256 }/*function_lint_to_tod*/ |
|
3257 break; |
|
3258 |
|
3259 /**** |
|
3260 *LINT_TO_DT |
|
3261 */ |
|
3262 case function_lint_to_dt : |
|
3263 { |
|
3264 symbol_c *last_type_symbol = NULL; |
|
3265 |
|
3266 { |
|
3267 identifier_c param_name("IN"); |
|
3268 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3269 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3270 |
|
3271 /* Get the value from a foo(<param_value>) style call */ |
|
3272 if (IN_param_value == NULL) |
|
3273 IN_param_value = function_call_param_iterator.next(); |
|
3274 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3275 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3276 |
|
3277 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3278 { |
|
3279 |
|
3280 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
3281 s4o.print("("); |
|
3282 return_type_symbol->accept(*this); |
|
3283 s4o.print(")__int_to_time("); |
|
3284 IN_param_value->accept(*this); |
|
3285 s4o.print(")"); |
|
3286 return NULL; |
|
3287 |
|
3288 } |
|
3289 |
|
3290 ERROR; |
|
3291 } |
|
3292 |
|
3293 }/*function_lint_to_dt*/ |
|
3294 break; |
|
3295 |
|
3296 /**** |
|
3297 *LINT_TO_STRING |
|
3298 */ |
|
3299 case function_lint_to_string : |
|
3300 { |
|
3301 symbol_c *last_type_symbol = NULL; |
|
3302 |
|
3303 { |
|
3304 identifier_c param_name("IN"); |
|
3305 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3306 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3307 |
|
3308 /* Get the value from a foo(<param_value>) style call */ |
|
3309 if (IN_param_value == NULL) |
|
3310 IN_param_value = function_call_param_iterator.next(); |
|
3311 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3312 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3313 |
|
3314 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3315 { |
|
3316 |
|
3317 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
3318 s4o.print("("); |
|
3319 return_type_symbol->accept(*this); |
|
3320 s4o.print(")__sint_to_string("); |
|
3321 IN_param_value->accept(*this); |
|
3322 s4o.print(")"); |
|
3323 return NULL; |
|
3324 |
|
3325 } |
|
3326 |
|
3327 ERROR; |
|
3328 } |
|
3329 |
|
3330 }/*function_lint_to_string*/ |
|
3331 break; |
|
3332 |
|
3333 /**** |
|
3334 *LINT_TO_BYTE |
|
3335 */ |
|
3336 case function_lint_to_byte : |
|
3337 { |
|
3338 symbol_c *last_type_symbol = NULL; |
|
3339 |
|
3340 { |
|
3341 identifier_c param_name("IN"); |
|
3342 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3343 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3344 |
|
3345 /* Get the value from a foo(<param_value>) style call */ |
|
3346 if (IN_param_value == NULL) |
|
3347 IN_param_value = function_call_param_iterator.next(); |
|
3348 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3349 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3350 |
|
3351 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3352 { |
|
3353 |
|
3354 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
3355 s4o.print("("); |
|
3356 return_type_symbol->accept(*this); |
|
3357 s4o.print(")"); |
|
3358 IN_param_value->accept(*this); |
|
3359 return NULL; |
|
3360 |
|
3361 } |
|
3362 |
|
3363 ERROR; |
|
3364 } |
|
3365 |
|
3366 }/*function_lint_to_byte*/ |
|
3367 break; |
|
3368 |
|
3369 /**** |
|
3370 *LINT_TO_WORD |
|
3371 */ |
|
3372 case function_lint_to_word : |
|
3373 { |
|
3374 symbol_c *last_type_symbol = NULL; |
|
3375 |
|
3376 { |
|
3377 identifier_c param_name("IN"); |
|
3378 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3379 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3380 |
|
3381 /* Get the value from a foo(<param_value>) style call */ |
|
3382 if (IN_param_value == NULL) |
|
3383 IN_param_value = function_call_param_iterator.next(); |
|
3384 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3385 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3386 |
|
3387 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3388 { |
|
3389 |
|
3390 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
3391 s4o.print("("); |
|
3392 return_type_symbol->accept(*this); |
|
3393 s4o.print(")"); |
|
3394 IN_param_value->accept(*this); |
|
3395 return NULL; |
|
3396 |
|
3397 } |
|
3398 |
|
3399 ERROR; |
|
3400 } |
|
3401 |
|
3402 }/*function_lint_to_word*/ |
|
3403 break; |
|
3404 |
|
3405 /**** |
|
3406 *LINT_TO_DWORD |
|
3407 */ |
|
3408 case function_lint_to_dword : |
|
3409 { |
|
3410 symbol_c *last_type_symbol = NULL; |
|
3411 |
|
3412 { |
|
3413 identifier_c param_name("IN"); |
|
3414 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3415 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3416 |
|
3417 /* Get the value from a foo(<param_value>) style call */ |
|
3418 if (IN_param_value == NULL) |
|
3419 IN_param_value = function_call_param_iterator.next(); |
|
3420 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3421 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3422 |
|
3423 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3424 { |
|
3425 |
|
3426 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
3427 s4o.print("("); |
|
3428 return_type_symbol->accept(*this); |
|
3429 s4o.print(")"); |
|
3430 IN_param_value->accept(*this); |
|
3431 return NULL; |
|
3432 |
|
3433 } |
|
3434 |
|
3435 ERROR; |
|
3436 } |
|
3437 |
|
3438 }/*function_lint_to_dword*/ |
|
3439 break; |
|
3440 |
|
3441 /**** |
|
3442 *LINT_TO_LWORD |
|
3443 */ |
|
3444 case function_lint_to_lword : |
|
3445 { |
|
3446 symbol_c *last_type_symbol = NULL; |
|
3447 |
|
3448 { |
|
3449 identifier_c param_name("IN"); |
|
3450 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3451 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3452 |
|
3453 /* Get the value from a foo(<param_value>) style call */ |
|
3454 if (IN_param_value == NULL) |
|
3455 IN_param_value = function_call_param_iterator.next(); |
|
3456 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3457 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3458 |
|
3459 if(search_expression_type->is_same_type(&search_constant_type_c::lint_type_name, last_type_symbol)) |
|
3460 { |
|
3461 |
|
3462 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
3463 s4o.print("("); |
|
3464 return_type_symbol->accept(*this); |
|
3465 s4o.print(")"); |
|
3466 IN_param_value->accept(*this); |
|
3467 return NULL; |
|
3468 |
|
3469 } |
|
3470 |
|
3471 ERROR; |
|
3472 } |
|
3473 |
|
3474 }/*function_lint_to_lword*/ |
|
3475 break; |
|
3476 |
|
3477 /**** |
|
3478 *USINT_TO_BOOL |
|
3479 */ |
|
3480 case function_usint_to_bool : |
|
3481 { |
|
3482 symbol_c *last_type_symbol = NULL; |
|
3483 |
|
3484 { |
|
3485 identifier_c param_name("IN"); |
|
3486 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3487 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3488 |
|
3489 /* Get the value from a foo(<param_value>) style call */ |
|
3490 if (IN_param_value == NULL) |
|
3491 IN_param_value = function_call_param_iterator.next(); |
|
3492 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3493 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3494 |
|
3495 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3496 { |
|
3497 |
|
3498 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
3499 s4o.print("("); |
|
3500 return_type_symbol->accept(*this); |
|
3501 s4o.print(")"); |
|
3502 IN_param_value->accept(*this); |
|
3503 return NULL; |
|
3504 |
|
3505 } |
|
3506 |
|
3507 ERROR; |
|
3508 } |
|
3509 |
|
3510 }/*function_usint_to_bool*/ |
|
3511 break; |
|
3512 |
|
3513 /**** |
|
3514 *USINT_TO_SINT |
|
3515 */ |
|
3516 case function_usint_to_sint : |
|
3517 { |
|
3518 symbol_c *last_type_symbol = NULL; |
|
3519 |
|
3520 { |
|
3521 identifier_c param_name("IN"); |
|
3522 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3523 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3524 |
|
3525 /* Get the value from a foo(<param_value>) style call */ |
|
3526 if (IN_param_value == NULL) |
|
3527 IN_param_value = function_call_param_iterator.next(); |
|
3528 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3529 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3530 |
|
3531 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3532 { |
|
3533 |
|
3534 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
3535 s4o.print("("); |
|
3536 return_type_symbol->accept(*this); |
|
3537 s4o.print(")"); |
|
3538 IN_param_value->accept(*this); |
|
3539 return NULL; |
|
3540 |
|
3541 } |
|
3542 |
|
3543 ERROR; |
|
3544 } |
|
3545 |
|
3546 }/*function_usint_to_sint*/ |
|
3547 break; |
|
3548 |
|
3549 /**** |
|
3550 *USINT_TO_INT |
|
3551 */ |
|
3552 case function_usint_to_int : |
|
3553 { |
|
3554 symbol_c *last_type_symbol = NULL; |
|
3555 |
|
3556 { |
|
3557 identifier_c param_name("IN"); |
|
3558 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3559 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3560 |
|
3561 /* Get the value from a foo(<param_value>) style call */ |
|
3562 if (IN_param_value == NULL) |
|
3563 IN_param_value = function_call_param_iterator.next(); |
|
3564 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3565 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3566 |
|
3567 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3568 { |
|
3569 |
|
3570 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
3571 s4o.print("("); |
|
3572 return_type_symbol->accept(*this); |
|
3573 s4o.print(")"); |
|
3574 IN_param_value->accept(*this); |
|
3575 return NULL; |
|
3576 |
|
3577 } |
|
3578 |
|
3579 ERROR; |
|
3580 } |
|
3581 |
|
3582 }/*function_usint_to_int*/ |
|
3583 break; |
|
3584 |
|
3585 /**** |
|
3586 *USINT_TO_DINT |
|
3587 */ |
|
3588 case function_usint_to_dint : |
|
3589 { |
|
3590 symbol_c *last_type_symbol = NULL; |
|
3591 |
|
3592 { |
|
3593 identifier_c param_name("IN"); |
|
3594 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3595 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3596 |
|
3597 /* Get the value from a foo(<param_value>) style call */ |
|
3598 if (IN_param_value == NULL) |
|
3599 IN_param_value = function_call_param_iterator.next(); |
|
3600 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3601 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3602 |
|
3603 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3604 { |
|
3605 |
|
3606 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
3607 s4o.print("("); |
|
3608 return_type_symbol->accept(*this); |
|
3609 s4o.print(")"); |
|
3610 IN_param_value->accept(*this); |
|
3611 return NULL; |
|
3612 |
|
3613 } |
|
3614 |
|
3615 ERROR; |
|
3616 } |
|
3617 |
|
3618 }/*function_usint_to_dint*/ |
|
3619 break; |
|
3620 |
|
3621 /**** |
|
3622 *USINT_TO_LINT |
|
3623 */ |
|
3624 case function_usint_to_lint : |
|
3625 { |
|
3626 symbol_c *last_type_symbol = NULL; |
|
3627 |
|
3628 { |
|
3629 identifier_c param_name("IN"); |
|
3630 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3631 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3632 |
|
3633 /* Get the value from a foo(<param_value>) style call */ |
|
3634 if (IN_param_value == NULL) |
|
3635 IN_param_value = function_call_param_iterator.next(); |
|
3636 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3637 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3638 |
|
3639 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3640 { |
|
3641 |
|
3642 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
3643 s4o.print("("); |
|
3644 return_type_symbol->accept(*this); |
|
3645 s4o.print(")"); |
|
3646 IN_param_value->accept(*this); |
|
3647 return NULL; |
|
3648 |
|
3649 } |
|
3650 |
|
3651 ERROR; |
|
3652 } |
|
3653 |
|
3654 }/*function_usint_to_lint*/ |
|
3655 break; |
|
3656 |
|
3657 /**** |
|
3658 *USINT_TO_UINT |
|
3659 */ |
|
3660 case function_usint_to_uint : |
|
3661 { |
|
3662 symbol_c *last_type_symbol = NULL; |
|
3663 |
|
3664 { |
|
3665 identifier_c param_name("IN"); |
|
3666 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3667 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3668 |
|
3669 /* Get the value from a foo(<param_value>) style call */ |
|
3670 if (IN_param_value == NULL) |
|
3671 IN_param_value = function_call_param_iterator.next(); |
|
3672 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3673 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3674 |
|
3675 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3676 { |
|
3677 |
|
3678 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
3679 s4o.print("("); |
|
3680 return_type_symbol->accept(*this); |
|
3681 s4o.print(")"); |
|
3682 IN_param_value->accept(*this); |
|
3683 return NULL; |
|
3684 |
|
3685 } |
|
3686 |
|
3687 ERROR; |
|
3688 } |
|
3689 |
|
3690 }/*function_usint_to_uint*/ |
|
3691 break; |
|
3692 |
|
3693 /**** |
|
3694 *USINT_TO_UDINT |
|
3695 */ |
|
3696 case function_usint_to_udint : |
|
3697 { |
|
3698 symbol_c *last_type_symbol = NULL; |
|
3699 |
|
3700 { |
|
3701 identifier_c param_name("IN"); |
|
3702 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3703 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3704 |
|
3705 /* Get the value from a foo(<param_value>) style call */ |
|
3706 if (IN_param_value == NULL) |
|
3707 IN_param_value = function_call_param_iterator.next(); |
|
3708 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3709 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3710 |
|
3711 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3712 { |
|
3713 |
|
3714 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
3715 s4o.print("("); |
|
3716 return_type_symbol->accept(*this); |
|
3717 s4o.print(")"); |
|
3718 IN_param_value->accept(*this); |
|
3719 return NULL; |
|
3720 |
|
3721 } |
|
3722 |
|
3723 ERROR; |
|
3724 } |
|
3725 |
|
3726 }/*function_usint_to_udint*/ |
|
3727 break; |
|
3728 |
|
3729 /**** |
|
3730 *USINT_TO_ULINT |
|
3731 */ |
|
3732 case function_usint_to_ulint : |
|
3733 { |
|
3734 symbol_c *last_type_symbol = NULL; |
|
3735 |
|
3736 { |
|
3737 identifier_c param_name("IN"); |
|
3738 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3739 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3740 |
|
3741 /* Get the value from a foo(<param_value>) style call */ |
|
3742 if (IN_param_value == NULL) |
|
3743 IN_param_value = function_call_param_iterator.next(); |
|
3744 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3745 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3746 |
|
3747 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3748 { |
|
3749 |
|
3750 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
3751 s4o.print("("); |
|
3752 return_type_symbol->accept(*this); |
|
3753 s4o.print(")"); |
|
3754 IN_param_value->accept(*this); |
|
3755 return NULL; |
|
3756 |
|
3757 } |
|
3758 |
|
3759 ERROR; |
|
3760 } |
|
3761 |
|
3762 }/*function_usint_to_ulint*/ |
|
3763 break; |
|
3764 |
|
3765 /**** |
|
3766 *USINT_TO_REAL |
|
3767 */ |
|
3768 case function_usint_to_real : |
|
3769 { |
|
3770 symbol_c *last_type_symbol = NULL; |
|
3771 |
|
3772 { |
|
3773 identifier_c param_name("IN"); |
|
3774 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3775 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3776 |
|
3777 /* Get the value from a foo(<param_value>) style call */ |
|
3778 if (IN_param_value == NULL) |
|
3779 IN_param_value = function_call_param_iterator.next(); |
|
3780 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3781 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3782 |
|
3783 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3784 { |
|
3785 |
|
3786 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
3787 s4o.print("("); |
|
3788 return_type_symbol->accept(*this); |
|
3789 s4o.print(")"); |
|
3790 IN_param_value->accept(*this); |
|
3791 return NULL; |
|
3792 |
|
3793 } |
|
3794 |
|
3795 ERROR; |
|
3796 } |
|
3797 |
|
3798 }/*function_usint_to_real*/ |
|
3799 break; |
|
3800 |
|
3801 /**** |
|
3802 *USINT_TO_LREAL |
|
3803 */ |
|
3804 case function_usint_to_lreal : |
|
3805 { |
|
3806 symbol_c *last_type_symbol = NULL; |
|
3807 |
|
3808 { |
|
3809 identifier_c param_name("IN"); |
|
3810 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3811 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3812 |
|
3813 /* Get the value from a foo(<param_value>) style call */ |
|
3814 if (IN_param_value == NULL) |
|
3815 IN_param_value = function_call_param_iterator.next(); |
|
3816 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3817 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3818 |
|
3819 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3820 { |
|
3821 |
|
3822 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
3823 s4o.print("("); |
|
3824 return_type_symbol->accept(*this); |
|
3825 s4o.print(")"); |
|
3826 IN_param_value->accept(*this); |
|
3827 return NULL; |
|
3828 |
|
3829 } |
|
3830 |
|
3831 ERROR; |
|
3832 } |
|
3833 |
|
3834 }/*function_usint_to_lreal*/ |
|
3835 break; |
|
3836 |
|
3837 /**** |
|
3838 *USINT_TO_TIME |
|
3839 */ |
|
3840 case function_usint_to_time : |
|
3841 { |
|
3842 symbol_c *last_type_symbol = NULL; |
|
3843 |
|
3844 { |
|
3845 identifier_c param_name("IN"); |
|
3846 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3847 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3848 |
|
3849 /* Get the value from a foo(<param_value>) style call */ |
|
3850 if (IN_param_value == NULL) |
|
3851 IN_param_value = function_call_param_iterator.next(); |
|
3852 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3853 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3854 |
|
3855 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3856 { |
|
3857 |
|
3858 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
3859 s4o.print("("); |
|
3860 return_type_symbol->accept(*this); |
|
3861 s4o.print(")__int_to_time("); |
|
3862 IN_param_value->accept(*this); |
|
3863 s4o.print(")"); |
|
3864 return NULL; |
|
3865 |
|
3866 } |
|
3867 |
|
3868 ERROR; |
|
3869 } |
|
3870 |
|
3871 }/*function_usint_to_time*/ |
|
3872 break; |
|
3873 |
|
3874 /**** |
|
3875 *USINT_TO_DATE |
|
3876 */ |
|
3877 case function_usint_to_date : |
|
3878 { |
|
3879 symbol_c *last_type_symbol = NULL; |
|
3880 |
|
3881 { |
|
3882 identifier_c param_name("IN"); |
|
3883 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3884 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3885 |
|
3886 /* Get the value from a foo(<param_value>) style call */ |
|
3887 if (IN_param_value == NULL) |
|
3888 IN_param_value = function_call_param_iterator.next(); |
|
3889 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3890 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3891 |
|
3892 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3893 { |
|
3894 |
|
3895 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
3896 s4o.print("("); |
|
3897 return_type_symbol->accept(*this); |
|
3898 s4o.print(")__int_to_time("); |
|
3899 IN_param_value->accept(*this); |
|
3900 s4o.print(")"); |
|
3901 return NULL; |
|
3902 |
|
3903 } |
|
3904 |
|
3905 ERROR; |
|
3906 } |
|
3907 |
|
3908 }/*function_usint_to_date*/ |
|
3909 break; |
|
3910 |
|
3911 /**** |
|
3912 *USINT_TO_TOD |
|
3913 */ |
|
3914 case function_usint_to_tod : |
|
3915 { |
|
3916 symbol_c *last_type_symbol = NULL; |
|
3917 |
|
3918 { |
|
3919 identifier_c param_name("IN"); |
|
3920 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3921 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3922 |
|
3923 /* Get the value from a foo(<param_value>) style call */ |
|
3924 if (IN_param_value == NULL) |
|
3925 IN_param_value = function_call_param_iterator.next(); |
|
3926 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3927 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3928 |
|
3929 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3930 { |
|
3931 |
|
3932 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
3933 s4o.print("("); |
|
3934 return_type_symbol->accept(*this); |
|
3935 s4o.print(")__int_to_time("); |
|
3936 IN_param_value->accept(*this); |
|
3937 s4o.print(")"); |
|
3938 return NULL; |
|
3939 |
|
3940 } |
|
3941 |
|
3942 ERROR; |
|
3943 } |
|
3944 |
|
3945 }/*function_usint_to_tod*/ |
|
3946 break; |
|
3947 |
|
3948 /**** |
|
3949 *USINT_TO_DT |
|
3950 */ |
|
3951 case function_usint_to_dt : |
|
3952 { |
|
3953 symbol_c *last_type_symbol = NULL; |
|
3954 |
|
3955 { |
|
3956 identifier_c param_name("IN"); |
|
3957 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3958 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3959 |
|
3960 /* Get the value from a foo(<param_value>) style call */ |
|
3961 if (IN_param_value == NULL) |
|
3962 IN_param_value = function_call_param_iterator.next(); |
|
3963 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
3964 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
3965 |
|
3966 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
3967 { |
|
3968 |
|
3969 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
3970 s4o.print("("); |
|
3971 return_type_symbol->accept(*this); |
|
3972 s4o.print(")__int_to_time("); |
|
3973 IN_param_value->accept(*this); |
|
3974 s4o.print(")"); |
|
3975 return NULL; |
|
3976 |
|
3977 } |
|
3978 |
|
3979 ERROR; |
|
3980 } |
|
3981 |
|
3982 }/*function_usint_to_dt*/ |
|
3983 break; |
|
3984 |
|
3985 /**** |
|
3986 *USINT_TO_STRING |
|
3987 */ |
|
3988 case function_usint_to_string : |
|
3989 { |
|
3990 symbol_c *last_type_symbol = NULL; |
|
3991 |
|
3992 { |
|
3993 identifier_c param_name("IN"); |
|
3994 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
3995 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
3996 |
|
3997 /* Get the value from a foo(<param_value>) style call */ |
|
3998 if (IN_param_value == NULL) |
|
3999 IN_param_value = function_call_param_iterator.next(); |
|
4000 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4001 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4002 |
|
4003 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
4004 { |
|
4005 |
|
4006 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
4007 s4o.print("("); |
|
4008 return_type_symbol->accept(*this); |
|
4009 s4o.print(")__uint_to_string("); |
|
4010 IN_param_value->accept(*this); |
|
4011 s4o.print(")"); |
|
4012 return NULL; |
|
4013 |
|
4014 } |
|
4015 |
|
4016 ERROR; |
|
4017 } |
|
4018 |
|
4019 }/*function_usint_to_string*/ |
|
4020 break; |
|
4021 |
|
4022 /**** |
|
4023 *USINT_TO_BYTE |
|
4024 */ |
|
4025 case function_usint_to_byte : |
|
4026 { |
|
4027 symbol_c *last_type_symbol = NULL; |
|
4028 |
|
4029 { |
|
4030 identifier_c param_name("IN"); |
|
4031 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4032 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4033 |
|
4034 /* Get the value from a foo(<param_value>) style call */ |
|
4035 if (IN_param_value == NULL) |
|
4036 IN_param_value = function_call_param_iterator.next(); |
|
4037 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4038 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4039 |
|
4040 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
4041 { |
|
4042 |
|
4043 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
4044 s4o.print("("); |
|
4045 return_type_symbol->accept(*this); |
|
4046 s4o.print(")"); |
|
4047 IN_param_value->accept(*this); |
|
4048 return NULL; |
|
4049 |
|
4050 } |
|
4051 |
|
4052 ERROR; |
|
4053 } |
|
4054 |
|
4055 }/*function_usint_to_byte*/ |
|
4056 break; |
|
4057 |
|
4058 /**** |
|
4059 *USINT_TO_WORD |
|
4060 */ |
|
4061 case function_usint_to_word : |
|
4062 { |
|
4063 symbol_c *last_type_symbol = NULL; |
|
4064 |
|
4065 { |
|
4066 identifier_c param_name("IN"); |
|
4067 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4068 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4069 |
|
4070 /* Get the value from a foo(<param_value>) style call */ |
|
4071 if (IN_param_value == NULL) |
|
4072 IN_param_value = function_call_param_iterator.next(); |
|
4073 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4074 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4075 |
|
4076 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
4077 { |
|
4078 |
|
4079 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
4080 s4o.print("("); |
|
4081 return_type_symbol->accept(*this); |
|
4082 s4o.print(")"); |
|
4083 IN_param_value->accept(*this); |
|
4084 return NULL; |
|
4085 |
|
4086 } |
|
4087 |
|
4088 ERROR; |
|
4089 } |
|
4090 |
|
4091 }/*function_usint_to_word*/ |
|
4092 break; |
|
4093 |
|
4094 /**** |
|
4095 *USINT_TO_DWORD |
|
4096 */ |
|
4097 case function_usint_to_dword : |
|
4098 { |
|
4099 symbol_c *last_type_symbol = NULL; |
|
4100 |
|
4101 { |
|
4102 identifier_c param_name("IN"); |
|
4103 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4104 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4105 |
|
4106 /* Get the value from a foo(<param_value>) style call */ |
|
4107 if (IN_param_value == NULL) |
|
4108 IN_param_value = function_call_param_iterator.next(); |
|
4109 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4110 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4111 |
|
4112 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
4113 { |
|
4114 |
|
4115 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
4116 s4o.print("("); |
|
4117 return_type_symbol->accept(*this); |
|
4118 s4o.print(")"); |
|
4119 IN_param_value->accept(*this); |
|
4120 return NULL; |
|
4121 |
|
4122 } |
|
4123 |
|
4124 ERROR; |
|
4125 } |
|
4126 |
|
4127 }/*function_usint_to_dword*/ |
|
4128 break; |
|
4129 |
|
4130 /**** |
|
4131 *USINT_TO_LWORD |
|
4132 */ |
|
4133 case function_usint_to_lword : |
|
4134 { |
|
4135 symbol_c *last_type_symbol = NULL; |
|
4136 |
|
4137 { |
|
4138 identifier_c param_name("IN"); |
|
4139 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4140 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4141 |
|
4142 /* Get the value from a foo(<param_value>) style call */ |
|
4143 if (IN_param_value == NULL) |
|
4144 IN_param_value = function_call_param_iterator.next(); |
|
4145 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4146 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4147 |
|
4148 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
4149 { |
|
4150 |
|
4151 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
4152 s4o.print("("); |
|
4153 return_type_symbol->accept(*this); |
|
4154 s4o.print(")"); |
|
4155 IN_param_value->accept(*this); |
|
4156 return NULL; |
|
4157 |
|
4158 } |
|
4159 |
|
4160 ERROR; |
|
4161 } |
|
4162 |
|
4163 }/*function_usint_to_lword*/ |
|
4164 break; |
|
4165 |
|
4166 /**** |
|
4167 *UINT_TO_BOOL |
|
4168 */ |
|
4169 case function_uint_to_bool : |
|
4170 { |
|
4171 symbol_c *last_type_symbol = NULL; |
|
4172 |
|
4173 { |
|
4174 identifier_c param_name("IN"); |
|
4175 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4176 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4177 |
|
4178 /* Get the value from a foo(<param_value>) style call */ |
|
4179 if (IN_param_value == NULL) |
|
4180 IN_param_value = function_call_param_iterator.next(); |
|
4181 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4182 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4183 |
|
4184 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4185 { |
|
4186 |
|
4187 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
4188 s4o.print("("); |
|
4189 return_type_symbol->accept(*this); |
|
4190 s4o.print(")"); |
|
4191 IN_param_value->accept(*this); |
|
4192 return NULL; |
|
4193 |
|
4194 } |
|
4195 |
|
4196 ERROR; |
|
4197 } |
|
4198 |
|
4199 }/*function_uint_to_bool*/ |
|
4200 break; |
|
4201 |
|
4202 /**** |
|
4203 *UINT_TO_SINT |
|
4204 */ |
|
4205 case function_uint_to_sint : |
|
4206 { |
|
4207 symbol_c *last_type_symbol = NULL; |
|
4208 |
|
4209 { |
|
4210 identifier_c param_name("IN"); |
|
4211 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4212 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4213 |
|
4214 /* Get the value from a foo(<param_value>) style call */ |
|
4215 if (IN_param_value == NULL) |
|
4216 IN_param_value = function_call_param_iterator.next(); |
|
4217 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4218 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4219 |
|
4220 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4221 { |
|
4222 |
|
4223 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
4224 s4o.print("("); |
|
4225 return_type_symbol->accept(*this); |
|
4226 s4o.print(")"); |
|
4227 IN_param_value->accept(*this); |
|
4228 return NULL; |
|
4229 |
|
4230 } |
|
4231 |
|
4232 ERROR; |
|
4233 } |
|
4234 |
|
4235 }/*function_uint_to_sint*/ |
|
4236 break; |
|
4237 |
|
4238 /**** |
|
4239 *UINT_TO_INT |
|
4240 */ |
|
4241 case function_uint_to_int : |
|
4242 { |
|
4243 symbol_c *last_type_symbol = NULL; |
|
4244 |
|
4245 { |
|
4246 identifier_c param_name("IN"); |
|
4247 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4248 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4249 |
|
4250 /* Get the value from a foo(<param_value>) style call */ |
|
4251 if (IN_param_value == NULL) |
|
4252 IN_param_value = function_call_param_iterator.next(); |
|
4253 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4254 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4255 |
|
4256 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4257 { |
|
4258 |
|
4259 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
4260 s4o.print("("); |
|
4261 return_type_symbol->accept(*this); |
|
4262 s4o.print(")"); |
|
4263 IN_param_value->accept(*this); |
|
4264 return NULL; |
|
4265 |
|
4266 } |
|
4267 |
|
4268 ERROR; |
|
4269 } |
|
4270 |
|
4271 }/*function_uint_to_int*/ |
|
4272 break; |
|
4273 |
|
4274 /**** |
|
4275 *UINT_TO_DINT |
|
4276 */ |
|
4277 case function_uint_to_dint : |
|
4278 { |
|
4279 symbol_c *last_type_symbol = NULL; |
|
4280 |
|
4281 { |
|
4282 identifier_c param_name("IN"); |
|
4283 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4284 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4285 |
|
4286 /* Get the value from a foo(<param_value>) style call */ |
|
4287 if (IN_param_value == NULL) |
|
4288 IN_param_value = function_call_param_iterator.next(); |
|
4289 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4290 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4291 |
|
4292 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4293 { |
|
4294 |
|
4295 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
4296 s4o.print("("); |
|
4297 return_type_symbol->accept(*this); |
|
4298 s4o.print(")"); |
|
4299 IN_param_value->accept(*this); |
|
4300 return NULL; |
|
4301 |
|
4302 } |
|
4303 |
|
4304 ERROR; |
|
4305 } |
|
4306 |
|
4307 }/*function_uint_to_dint*/ |
|
4308 break; |
|
4309 |
|
4310 /**** |
|
4311 *UINT_TO_LINT |
|
4312 */ |
|
4313 case function_uint_to_lint : |
|
4314 { |
|
4315 symbol_c *last_type_symbol = NULL; |
|
4316 |
|
4317 { |
|
4318 identifier_c param_name("IN"); |
|
4319 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4320 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4321 |
|
4322 /* Get the value from a foo(<param_value>) style call */ |
|
4323 if (IN_param_value == NULL) |
|
4324 IN_param_value = function_call_param_iterator.next(); |
|
4325 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4326 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4327 |
|
4328 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4329 { |
|
4330 |
|
4331 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
4332 s4o.print("("); |
|
4333 return_type_symbol->accept(*this); |
|
4334 s4o.print(")"); |
|
4335 IN_param_value->accept(*this); |
|
4336 return NULL; |
|
4337 |
|
4338 } |
|
4339 |
|
4340 ERROR; |
|
4341 } |
|
4342 |
|
4343 }/*function_uint_to_lint*/ |
|
4344 break; |
|
4345 |
|
4346 /**** |
|
4347 *UINT_TO_USINT |
|
4348 */ |
|
4349 case function_uint_to_usint : |
|
4350 { |
|
4351 symbol_c *last_type_symbol = NULL; |
|
4352 |
|
4353 { |
|
4354 identifier_c param_name("IN"); |
|
4355 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4356 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4357 |
|
4358 /* Get the value from a foo(<param_value>) style call */ |
|
4359 if (IN_param_value == NULL) |
|
4360 IN_param_value = function_call_param_iterator.next(); |
|
4361 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4362 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4363 |
|
4364 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4365 { |
|
4366 |
|
4367 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
4368 s4o.print("("); |
|
4369 return_type_symbol->accept(*this); |
|
4370 s4o.print(")"); |
|
4371 IN_param_value->accept(*this); |
|
4372 return NULL; |
|
4373 |
|
4374 } |
|
4375 |
|
4376 ERROR; |
|
4377 } |
|
4378 |
|
4379 }/*function_uint_to_usint*/ |
|
4380 break; |
|
4381 |
|
4382 /**** |
|
4383 *UINT_TO_UDINT |
|
4384 */ |
|
4385 case function_uint_to_udint : |
|
4386 { |
|
4387 symbol_c *last_type_symbol = NULL; |
|
4388 |
|
4389 { |
|
4390 identifier_c param_name("IN"); |
|
4391 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4392 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4393 |
|
4394 /* Get the value from a foo(<param_value>) style call */ |
|
4395 if (IN_param_value == NULL) |
|
4396 IN_param_value = function_call_param_iterator.next(); |
|
4397 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4398 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4399 |
|
4400 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4401 { |
|
4402 |
|
4403 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
4404 s4o.print("("); |
|
4405 return_type_symbol->accept(*this); |
|
4406 s4o.print(")"); |
|
4407 IN_param_value->accept(*this); |
|
4408 return NULL; |
|
4409 |
|
4410 } |
|
4411 |
|
4412 ERROR; |
|
4413 } |
|
4414 |
|
4415 }/*function_uint_to_udint*/ |
|
4416 break; |
|
4417 |
|
4418 /**** |
|
4419 *UINT_TO_ULINT |
|
4420 */ |
|
4421 case function_uint_to_ulint : |
|
4422 { |
|
4423 symbol_c *last_type_symbol = NULL; |
|
4424 |
|
4425 { |
|
4426 identifier_c param_name("IN"); |
|
4427 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4428 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4429 |
|
4430 /* Get the value from a foo(<param_value>) style call */ |
|
4431 if (IN_param_value == NULL) |
|
4432 IN_param_value = function_call_param_iterator.next(); |
|
4433 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4434 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4435 |
|
4436 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4437 { |
|
4438 |
|
4439 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
4440 s4o.print("("); |
|
4441 return_type_symbol->accept(*this); |
|
4442 s4o.print(")"); |
|
4443 IN_param_value->accept(*this); |
|
4444 return NULL; |
|
4445 |
|
4446 } |
|
4447 |
|
4448 ERROR; |
|
4449 } |
|
4450 |
|
4451 }/*function_uint_to_ulint*/ |
|
4452 break; |
|
4453 |
|
4454 /**** |
|
4455 *UINT_TO_REAL |
|
4456 */ |
|
4457 case function_uint_to_real : |
|
4458 { |
|
4459 symbol_c *last_type_symbol = NULL; |
|
4460 |
|
4461 { |
|
4462 identifier_c param_name("IN"); |
|
4463 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4464 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4465 |
|
4466 /* Get the value from a foo(<param_value>) style call */ |
|
4467 if (IN_param_value == NULL) |
|
4468 IN_param_value = function_call_param_iterator.next(); |
|
4469 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4470 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4471 |
|
4472 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4473 { |
|
4474 |
|
4475 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
4476 s4o.print("("); |
|
4477 return_type_symbol->accept(*this); |
|
4478 s4o.print(")"); |
|
4479 IN_param_value->accept(*this); |
|
4480 return NULL; |
|
4481 |
|
4482 } |
|
4483 |
|
4484 ERROR; |
|
4485 } |
|
4486 |
|
4487 }/*function_uint_to_real*/ |
|
4488 break; |
|
4489 |
|
4490 /**** |
|
4491 *UINT_TO_LREAL |
|
4492 */ |
|
4493 case function_uint_to_lreal : |
|
4494 { |
|
4495 symbol_c *last_type_symbol = NULL; |
|
4496 |
|
4497 { |
|
4498 identifier_c param_name("IN"); |
|
4499 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4500 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4501 |
|
4502 /* Get the value from a foo(<param_value>) style call */ |
|
4503 if (IN_param_value == NULL) |
|
4504 IN_param_value = function_call_param_iterator.next(); |
|
4505 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4506 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4507 |
|
4508 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4509 { |
|
4510 |
|
4511 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
4512 s4o.print("("); |
|
4513 return_type_symbol->accept(*this); |
|
4514 s4o.print(")"); |
|
4515 IN_param_value->accept(*this); |
|
4516 return NULL; |
|
4517 |
|
4518 } |
|
4519 |
|
4520 ERROR; |
|
4521 } |
|
4522 |
|
4523 }/*function_uint_to_lreal*/ |
|
4524 break; |
|
4525 |
|
4526 /**** |
|
4527 *UINT_TO_TIME |
|
4528 */ |
|
4529 case function_uint_to_time : |
|
4530 { |
|
4531 symbol_c *last_type_symbol = NULL; |
|
4532 |
|
4533 { |
|
4534 identifier_c param_name("IN"); |
|
4535 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4536 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4537 |
|
4538 /* Get the value from a foo(<param_value>) style call */ |
|
4539 if (IN_param_value == NULL) |
|
4540 IN_param_value = function_call_param_iterator.next(); |
|
4541 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4542 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4543 |
|
4544 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4545 { |
|
4546 |
|
4547 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
4548 s4o.print("("); |
|
4549 return_type_symbol->accept(*this); |
|
4550 s4o.print(")__int_to_time("); |
|
4551 IN_param_value->accept(*this); |
|
4552 s4o.print(")"); |
|
4553 return NULL; |
|
4554 |
|
4555 } |
|
4556 |
|
4557 ERROR; |
|
4558 } |
|
4559 |
|
4560 }/*function_uint_to_time*/ |
|
4561 break; |
|
4562 |
|
4563 /**** |
|
4564 *UINT_TO_DATE |
|
4565 */ |
|
4566 case function_uint_to_date : |
|
4567 { |
|
4568 symbol_c *last_type_symbol = NULL; |
|
4569 |
|
4570 { |
|
4571 identifier_c param_name("IN"); |
|
4572 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4573 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4574 |
|
4575 /* Get the value from a foo(<param_value>) style call */ |
|
4576 if (IN_param_value == NULL) |
|
4577 IN_param_value = function_call_param_iterator.next(); |
|
4578 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4579 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4580 |
|
4581 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4582 { |
|
4583 |
|
4584 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
4585 s4o.print("("); |
|
4586 return_type_symbol->accept(*this); |
|
4587 s4o.print(")__int_to_time("); |
|
4588 IN_param_value->accept(*this); |
|
4589 s4o.print(")"); |
|
4590 return NULL; |
|
4591 |
|
4592 } |
|
4593 |
|
4594 ERROR; |
|
4595 } |
|
4596 |
|
4597 }/*function_uint_to_date*/ |
|
4598 break; |
|
4599 |
|
4600 /**** |
|
4601 *UINT_TO_TOD |
|
4602 */ |
|
4603 case function_uint_to_tod : |
|
4604 { |
|
4605 symbol_c *last_type_symbol = NULL; |
|
4606 |
|
4607 { |
|
4608 identifier_c param_name("IN"); |
|
4609 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4610 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4611 |
|
4612 /* Get the value from a foo(<param_value>) style call */ |
|
4613 if (IN_param_value == NULL) |
|
4614 IN_param_value = function_call_param_iterator.next(); |
|
4615 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4616 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4617 |
|
4618 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4619 { |
|
4620 |
|
4621 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
4622 s4o.print("("); |
|
4623 return_type_symbol->accept(*this); |
|
4624 s4o.print(")__int_to_time("); |
|
4625 IN_param_value->accept(*this); |
|
4626 s4o.print(")"); |
|
4627 return NULL; |
|
4628 |
|
4629 } |
|
4630 |
|
4631 ERROR; |
|
4632 } |
|
4633 |
|
4634 }/*function_uint_to_tod*/ |
|
4635 break; |
|
4636 |
|
4637 /**** |
|
4638 *UINT_TO_DT |
|
4639 */ |
|
4640 case function_uint_to_dt : |
|
4641 { |
|
4642 symbol_c *last_type_symbol = NULL; |
|
4643 |
|
4644 { |
|
4645 identifier_c param_name("IN"); |
|
4646 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4647 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4648 |
|
4649 /* Get the value from a foo(<param_value>) style call */ |
|
4650 if (IN_param_value == NULL) |
|
4651 IN_param_value = function_call_param_iterator.next(); |
|
4652 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4653 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4654 |
|
4655 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4656 { |
|
4657 |
|
4658 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
4659 s4o.print("("); |
|
4660 return_type_symbol->accept(*this); |
|
4661 s4o.print(")__int_to_time("); |
|
4662 IN_param_value->accept(*this); |
|
4663 s4o.print(")"); |
|
4664 return NULL; |
|
4665 |
|
4666 } |
|
4667 |
|
4668 ERROR; |
|
4669 } |
|
4670 |
|
4671 }/*function_uint_to_dt*/ |
|
4672 break; |
|
4673 |
|
4674 /**** |
|
4675 *UINT_TO_STRING |
|
4676 */ |
|
4677 case function_uint_to_string : |
|
4678 { |
|
4679 symbol_c *last_type_symbol = NULL; |
|
4680 |
|
4681 { |
|
4682 identifier_c param_name("IN"); |
|
4683 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4684 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4685 |
|
4686 /* Get the value from a foo(<param_value>) style call */ |
|
4687 if (IN_param_value == NULL) |
|
4688 IN_param_value = function_call_param_iterator.next(); |
|
4689 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4690 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4691 |
|
4692 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4693 { |
|
4694 |
|
4695 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
4696 s4o.print("("); |
|
4697 return_type_symbol->accept(*this); |
|
4698 s4o.print(")__uint_to_string("); |
|
4699 IN_param_value->accept(*this); |
|
4700 s4o.print(")"); |
|
4701 return NULL; |
|
4702 |
|
4703 } |
|
4704 |
|
4705 ERROR; |
|
4706 } |
|
4707 |
|
4708 }/*function_uint_to_string*/ |
|
4709 break; |
|
4710 |
|
4711 /**** |
|
4712 *UINT_TO_BYTE |
|
4713 */ |
|
4714 case function_uint_to_byte : |
|
4715 { |
|
4716 symbol_c *last_type_symbol = NULL; |
|
4717 |
|
4718 { |
|
4719 identifier_c param_name("IN"); |
|
4720 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4721 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4722 |
|
4723 /* Get the value from a foo(<param_value>) style call */ |
|
4724 if (IN_param_value == NULL) |
|
4725 IN_param_value = function_call_param_iterator.next(); |
|
4726 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4727 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4728 |
|
4729 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4730 { |
|
4731 |
|
4732 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
4733 s4o.print("("); |
|
4734 return_type_symbol->accept(*this); |
|
4735 s4o.print(")"); |
|
4736 IN_param_value->accept(*this); |
|
4737 return NULL; |
|
4738 |
|
4739 } |
|
4740 |
|
4741 ERROR; |
|
4742 } |
|
4743 |
|
4744 }/*function_uint_to_byte*/ |
|
4745 break; |
|
4746 |
|
4747 /**** |
|
4748 *UINT_TO_WORD |
|
4749 */ |
|
4750 case function_uint_to_word : |
|
4751 { |
|
4752 symbol_c *last_type_symbol = NULL; |
|
4753 |
|
4754 { |
|
4755 identifier_c param_name("IN"); |
|
4756 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4757 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4758 |
|
4759 /* Get the value from a foo(<param_value>) style call */ |
|
4760 if (IN_param_value == NULL) |
|
4761 IN_param_value = function_call_param_iterator.next(); |
|
4762 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4763 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4764 |
|
4765 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4766 { |
|
4767 |
|
4768 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
4769 s4o.print("("); |
|
4770 return_type_symbol->accept(*this); |
|
4771 s4o.print(")"); |
|
4772 IN_param_value->accept(*this); |
|
4773 return NULL; |
|
4774 |
|
4775 } |
|
4776 |
|
4777 ERROR; |
|
4778 } |
|
4779 |
|
4780 }/*function_uint_to_word*/ |
|
4781 break; |
|
4782 |
|
4783 /**** |
|
4784 *UINT_TO_DWORD |
|
4785 */ |
|
4786 case function_uint_to_dword : |
|
4787 { |
|
4788 symbol_c *last_type_symbol = NULL; |
|
4789 |
|
4790 { |
|
4791 identifier_c param_name("IN"); |
|
4792 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4793 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4794 |
|
4795 /* Get the value from a foo(<param_value>) style call */ |
|
4796 if (IN_param_value == NULL) |
|
4797 IN_param_value = function_call_param_iterator.next(); |
|
4798 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4799 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4800 |
|
4801 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4802 { |
|
4803 |
|
4804 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
4805 s4o.print("("); |
|
4806 return_type_symbol->accept(*this); |
|
4807 s4o.print(")"); |
|
4808 IN_param_value->accept(*this); |
|
4809 return NULL; |
|
4810 |
|
4811 } |
|
4812 |
|
4813 ERROR; |
|
4814 } |
|
4815 |
|
4816 }/*function_uint_to_dword*/ |
|
4817 break; |
|
4818 |
|
4819 /**** |
|
4820 *UINT_TO_LWORD |
|
4821 */ |
|
4822 case function_uint_to_lword : |
|
4823 { |
|
4824 symbol_c *last_type_symbol = NULL; |
|
4825 |
|
4826 { |
|
4827 identifier_c param_name("IN"); |
|
4828 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4829 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4830 |
|
4831 /* Get the value from a foo(<param_value>) style call */ |
|
4832 if (IN_param_value == NULL) |
|
4833 IN_param_value = function_call_param_iterator.next(); |
|
4834 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4835 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4836 |
|
4837 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
4838 { |
|
4839 |
|
4840 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
4841 s4o.print("("); |
|
4842 return_type_symbol->accept(*this); |
|
4843 s4o.print(")"); |
|
4844 IN_param_value->accept(*this); |
|
4845 return NULL; |
|
4846 |
|
4847 } |
|
4848 |
|
4849 ERROR; |
|
4850 } |
|
4851 |
|
4852 }/*function_uint_to_lword*/ |
|
4853 break; |
|
4854 |
|
4855 /**** |
|
4856 *UDINT_TO_BOOL |
|
4857 */ |
|
4858 case function_udint_to_bool : |
|
4859 { |
|
4860 symbol_c *last_type_symbol = NULL; |
|
4861 |
|
4862 { |
|
4863 identifier_c param_name("IN"); |
|
4864 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4865 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4866 |
|
4867 /* Get the value from a foo(<param_value>) style call */ |
|
4868 if (IN_param_value == NULL) |
|
4869 IN_param_value = function_call_param_iterator.next(); |
|
4870 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4871 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4872 |
|
4873 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
4874 { |
|
4875 |
|
4876 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
4877 s4o.print("("); |
|
4878 return_type_symbol->accept(*this); |
|
4879 s4o.print(")"); |
|
4880 IN_param_value->accept(*this); |
|
4881 return NULL; |
|
4882 |
|
4883 } |
|
4884 |
|
4885 ERROR; |
|
4886 } |
|
4887 |
|
4888 }/*function_udint_to_bool*/ |
|
4889 break; |
|
4890 |
|
4891 /**** |
|
4892 *UDINT_TO_SINT |
|
4893 */ |
|
4894 case function_udint_to_sint : |
|
4895 { |
|
4896 symbol_c *last_type_symbol = NULL; |
|
4897 |
|
4898 { |
|
4899 identifier_c param_name("IN"); |
|
4900 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4901 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4902 |
|
4903 /* Get the value from a foo(<param_value>) style call */ |
|
4904 if (IN_param_value == NULL) |
|
4905 IN_param_value = function_call_param_iterator.next(); |
|
4906 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4907 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4908 |
|
4909 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
4910 { |
|
4911 |
|
4912 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
4913 s4o.print("("); |
|
4914 return_type_symbol->accept(*this); |
|
4915 s4o.print(")"); |
|
4916 IN_param_value->accept(*this); |
|
4917 return NULL; |
|
4918 |
|
4919 } |
|
4920 |
|
4921 ERROR; |
|
4922 } |
|
4923 |
|
4924 }/*function_udint_to_sint*/ |
|
4925 break; |
|
4926 |
|
4927 /**** |
|
4928 *UDINT_TO_INT |
|
4929 */ |
|
4930 case function_udint_to_int : |
|
4931 { |
|
4932 symbol_c *last_type_symbol = NULL; |
|
4933 |
|
4934 { |
|
4935 identifier_c param_name("IN"); |
|
4936 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4937 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4938 |
|
4939 /* Get the value from a foo(<param_value>) style call */ |
|
4940 if (IN_param_value == NULL) |
|
4941 IN_param_value = function_call_param_iterator.next(); |
|
4942 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4943 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4944 |
|
4945 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
4946 { |
|
4947 |
|
4948 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
4949 s4o.print("("); |
|
4950 return_type_symbol->accept(*this); |
|
4951 s4o.print(")"); |
|
4952 IN_param_value->accept(*this); |
|
4953 return NULL; |
|
4954 |
|
4955 } |
|
4956 |
|
4957 ERROR; |
|
4958 } |
|
4959 |
|
4960 }/*function_udint_to_int*/ |
|
4961 break; |
|
4962 |
|
4963 /**** |
|
4964 *UDINT_TO_DINT |
|
4965 */ |
|
4966 case function_udint_to_dint : |
|
4967 { |
|
4968 symbol_c *last_type_symbol = NULL; |
|
4969 |
|
4970 { |
|
4971 identifier_c param_name("IN"); |
|
4972 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
4973 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
4974 |
|
4975 /* Get the value from a foo(<param_value>) style call */ |
|
4976 if (IN_param_value == NULL) |
|
4977 IN_param_value = function_call_param_iterator.next(); |
|
4978 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
4979 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
4980 |
|
4981 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
4982 { |
|
4983 |
|
4984 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
4985 s4o.print("("); |
|
4986 return_type_symbol->accept(*this); |
|
4987 s4o.print(")"); |
|
4988 IN_param_value->accept(*this); |
|
4989 return NULL; |
|
4990 |
|
4991 } |
|
4992 |
|
4993 ERROR; |
|
4994 } |
|
4995 |
|
4996 }/*function_udint_to_dint*/ |
|
4997 break; |
|
4998 |
|
4999 /**** |
|
5000 *UDINT_TO_LINT |
|
5001 */ |
|
5002 case function_udint_to_lint : |
|
5003 { |
|
5004 symbol_c *last_type_symbol = NULL; |
|
5005 |
|
5006 { |
|
5007 identifier_c param_name("IN"); |
|
5008 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5009 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5010 |
|
5011 /* Get the value from a foo(<param_value>) style call */ |
|
5012 if (IN_param_value == NULL) |
|
5013 IN_param_value = function_call_param_iterator.next(); |
|
5014 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5015 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5016 |
|
5017 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5018 { |
|
5019 |
|
5020 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
5021 s4o.print("("); |
|
5022 return_type_symbol->accept(*this); |
|
5023 s4o.print(")"); |
|
5024 IN_param_value->accept(*this); |
|
5025 return NULL; |
|
5026 |
|
5027 } |
|
5028 |
|
5029 ERROR; |
|
5030 } |
|
5031 |
|
5032 }/*function_udint_to_lint*/ |
|
5033 break; |
|
5034 |
|
5035 /**** |
|
5036 *UDINT_TO_USINT |
|
5037 */ |
|
5038 case function_udint_to_usint : |
|
5039 { |
|
5040 symbol_c *last_type_symbol = NULL; |
|
5041 |
|
5042 { |
|
5043 identifier_c param_name("IN"); |
|
5044 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5045 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5046 |
|
5047 /* Get the value from a foo(<param_value>) style call */ |
|
5048 if (IN_param_value == NULL) |
|
5049 IN_param_value = function_call_param_iterator.next(); |
|
5050 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5051 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5052 |
|
5053 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5054 { |
|
5055 |
|
5056 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
5057 s4o.print("("); |
|
5058 return_type_symbol->accept(*this); |
|
5059 s4o.print(")"); |
|
5060 IN_param_value->accept(*this); |
|
5061 return NULL; |
|
5062 |
|
5063 } |
|
5064 |
|
5065 ERROR; |
|
5066 } |
|
5067 |
|
5068 }/*function_udint_to_usint*/ |
|
5069 break; |
|
5070 |
|
5071 /**** |
|
5072 *UDINT_TO_UINT |
|
5073 */ |
|
5074 case function_udint_to_uint : |
|
5075 { |
|
5076 symbol_c *last_type_symbol = NULL; |
|
5077 |
|
5078 { |
|
5079 identifier_c param_name("IN"); |
|
5080 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5081 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5082 |
|
5083 /* Get the value from a foo(<param_value>) style call */ |
|
5084 if (IN_param_value == NULL) |
|
5085 IN_param_value = function_call_param_iterator.next(); |
|
5086 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5087 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5088 |
|
5089 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5090 { |
|
5091 |
|
5092 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
5093 s4o.print("("); |
|
5094 return_type_symbol->accept(*this); |
|
5095 s4o.print(")"); |
|
5096 IN_param_value->accept(*this); |
|
5097 return NULL; |
|
5098 |
|
5099 } |
|
5100 |
|
5101 ERROR; |
|
5102 } |
|
5103 |
|
5104 }/*function_udint_to_uint*/ |
|
5105 break; |
|
5106 |
|
5107 /**** |
|
5108 *UDINT_TO_ULINT |
|
5109 */ |
|
5110 case function_udint_to_ulint : |
|
5111 { |
|
5112 symbol_c *last_type_symbol = NULL; |
|
5113 |
|
5114 { |
|
5115 identifier_c param_name("IN"); |
|
5116 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5117 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5118 |
|
5119 /* Get the value from a foo(<param_value>) style call */ |
|
5120 if (IN_param_value == NULL) |
|
5121 IN_param_value = function_call_param_iterator.next(); |
|
5122 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5123 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5124 |
|
5125 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5126 { |
|
5127 |
|
5128 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
5129 s4o.print("("); |
|
5130 return_type_symbol->accept(*this); |
|
5131 s4o.print(")"); |
|
5132 IN_param_value->accept(*this); |
|
5133 return NULL; |
|
5134 |
|
5135 } |
|
5136 |
|
5137 ERROR; |
|
5138 } |
|
5139 |
|
5140 }/*function_udint_to_ulint*/ |
|
5141 break; |
|
5142 |
|
5143 /**** |
|
5144 *UDINT_TO_REAL |
|
5145 */ |
|
5146 case function_udint_to_real : |
|
5147 { |
|
5148 symbol_c *last_type_symbol = NULL; |
|
5149 |
|
5150 { |
|
5151 identifier_c param_name("IN"); |
|
5152 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5153 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5154 |
|
5155 /* Get the value from a foo(<param_value>) style call */ |
|
5156 if (IN_param_value == NULL) |
|
5157 IN_param_value = function_call_param_iterator.next(); |
|
5158 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5159 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5160 |
|
5161 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5162 { |
|
5163 |
|
5164 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
5165 s4o.print("("); |
|
5166 return_type_symbol->accept(*this); |
|
5167 s4o.print(")"); |
|
5168 IN_param_value->accept(*this); |
|
5169 return NULL; |
|
5170 |
|
5171 } |
|
5172 |
|
5173 ERROR; |
|
5174 } |
|
5175 |
|
5176 }/*function_udint_to_real*/ |
|
5177 break; |
|
5178 |
|
5179 /**** |
|
5180 *UDINT_TO_LREAL |
|
5181 */ |
|
5182 case function_udint_to_lreal : |
|
5183 { |
|
5184 symbol_c *last_type_symbol = NULL; |
|
5185 |
|
5186 { |
|
5187 identifier_c param_name("IN"); |
|
5188 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5189 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5190 |
|
5191 /* Get the value from a foo(<param_value>) style call */ |
|
5192 if (IN_param_value == NULL) |
|
5193 IN_param_value = function_call_param_iterator.next(); |
|
5194 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5195 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5196 |
|
5197 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5198 { |
|
5199 |
|
5200 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
5201 s4o.print("("); |
|
5202 return_type_symbol->accept(*this); |
|
5203 s4o.print(")"); |
|
5204 IN_param_value->accept(*this); |
|
5205 return NULL; |
|
5206 |
|
5207 } |
|
5208 |
|
5209 ERROR; |
|
5210 } |
|
5211 |
|
5212 }/*function_udint_to_lreal*/ |
|
5213 break; |
|
5214 |
|
5215 /**** |
|
5216 *UDINT_TO_TIME |
|
5217 */ |
|
5218 case function_udint_to_time : |
|
5219 { |
|
5220 symbol_c *last_type_symbol = NULL; |
|
5221 |
|
5222 { |
|
5223 identifier_c param_name("IN"); |
|
5224 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5225 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5226 |
|
5227 /* Get the value from a foo(<param_value>) style call */ |
|
5228 if (IN_param_value == NULL) |
|
5229 IN_param_value = function_call_param_iterator.next(); |
|
5230 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5231 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5232 |
|
5233 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5234 { |
|
5235 |
|
5236 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
5237 s4o.print("("); |
|
5238 return_type_symbol->accept(*this); |
|
5239 s4o.print(")__int_to_time("); |
|
5240 IN_param_value->accept(*this); |
|
5241 s4o.print(")"); |
|
5242 return NULL; |
|
5243 |
|
5244 } |
|
5245 |
|
5246 ERROR; |
|
5247 } |
|
5248 |
|
5249 }/*function_udint_to_time*/ |
|
5250 break; |
|
5251 |
|
5252 /**** |
|
5253 *UDINT_TO_DATE |
|
5254 */ |
|
5255 case function_udint_to_date : |
|
5256 { |
|
5257 symbol_c *last_type_symbol = NULL; |
|
5258 |
|
5259 { |
|
5260 identifier_c param_name("IN"); |
|
5261 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5262 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5263 |
|
5264 /* Get the value from a foo(<param_value>) style call */ |
|
5265 if (IN_param_value == NULL) |
|
5266 IN_param_value = function_call_param_iterator.next(); |
|
5267 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5268 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5269 |
|
5270 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5271 { |
|
5272 |
|
5273 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
5274 s4o.print("("); |
|
5275 return_type_symbol->accept(*this); |
|
5276 s4o.print(")__int_to_time("); |
|
5277 IN_param_value->accept(*this); |
|
5278 s4o.print(")"); |
|
5279 return NULL; |
|
5280 |
|
5281 } |
|
5282 |
|
5283 ERROR; |
|
5284 } |
|
5285 |
|
5286 }/*function_udint_to_date*/ |
|
5287 break; |
|
5288 |
|
5289 /**** |
|
5290 *UDINT_TO_TOD |
|
5291 */ |
|
5292 case function_udint_to_tod : |
|
5293 { |
|
5294 symbol_c *last_type_symbol = NULL; |
|
5295 |
|
5296 { |
|
5297 identifier_c param_name("IN"); |
|
5298 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5299 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5300 |
|
5301 /* Get the value from a foo(<param_value>) style call */ |
|
5302 if (IN_param_value == NULL) |
|
5303 IN_param_value = function_call_param_iterator.next(); |
|
5304 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5305 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5306 |
|
5307 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5308 { |
|
5309 |
|
5310 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
5311 s4o.print("("); |
|
5312 return_type_symbol->accept(*this); |
|
5313 s4o.print(")__int_to_time("); |
|
5314 IN_param_value->accept(*this); |
|
5315 s4o.print(")"); |
|
5316 return NULL; |
|
5317 |
|
5318 } |
|
5319 |
|
5320 ERROR; |
|
5321 } |
|
5322 |
|
5323 }/*function_udint_to_tod*/ |
|
5324 break; |
|
5325 |
|
5326 /**** |
|
5327 *UDINT_TO_DT |
|
5328 */ |
|
5329 case function_udint_to_dt : |
|
5330 { |
|
5331 symbol_c *last_type_symbol = NULL; |
|
5332 |
|
5333 { |
|
5334 identifier_c param_name("IN"); |
|
5335 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5336 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5337 |
|
5338 /* Get the value from a foo(<param_value>) style call */ |
|
5339 if (IN_param_value == NULL) |
|
5340 IN_param_value = function_call_param_iterator.next(); |
|
5341 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5342 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5343 |
|
5344 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5345 { |
|
5346 |
|
5347 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
5348 s4o.print("("); |
|
5349 return_type_symbol->accept(*this); |
|
5350 s4o.print(")__int_to_time("); |
|
5351 IN_param_value->accept(*this); |
|
5352 s4o.print(")"); |
|
5353 return NULL; |
|
5354 |
|
5355 } |
|
5356 |
|
5357 ERROR; |
|
5358 } |
|
5359 |
|
5360 }/*function_udint_to_dt*/ |
|
5361 break; |
|
5362 |
|
5363 /**** |
|
5364 *UDINT_TO_STRING |
|
5365 */ |
|
5366 case function_udint_to_string : |
|
5367 { |
|
5368 symbol_c *last_type_symbol = NULL; |
|
5369 |
|
5370 { |
|
5371 identifier_c param_name("IN"); |
|
5372 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5373 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5374 |
|
5375 /* Get the value from a foo(<param_value>) style call */ |
|
5376 if (IN_param_value == NULL) |
|
5377 IN_param_value = function_call_param_iterator.next(); |
|
5378 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5379 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5380 |
|
5381 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5382 { |
|
5383 |
|
5384 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
5385 s4o.print("("); |
|
5386 return_type_symbol->accept(*this); |
|
5387 s4o.print(")__uint_to_string("); |
|
5388 IN_param_value->accept(*this); |
|
5389 s4o.print(")"); |
|
5390 return NULL; |
|
5391 |
|
5392 } |
|
5393 |
|
5394 ERROR; |
|
5395 } |
|
5396 |
|
5397 }/*function_udint_to_string*/ |
|
5398 break; |
|
5399 |
|
5400 /**** |
|
5401 *UDINT_TO_BYTE |
|
5402 */ |
|
5403 case function_udint_to_byte : |
|
5404 { |
|
5405 symbol_c *last_type_symbol = NULL; |
|
5406 |
|
5407 { |
|
5408 identifier_c param_name("IN"); |
|
5409 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5410 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5411 |
|
5412 /* Get the value from a foo(<param_value>) style call */ |
|
5413 if (IN_param_value == NULL) |
|
5414 IN_param_value = function_call_param_iterator.next(); |
|
5415 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5416 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5417 |
|
5418 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5419 { |
|
5420 |
|
5421 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
5422 s4o.print("("); |
|
5423 return_type_symbol->accept(*this); |
|
5424 s4o.print(")"); |
|
5425 IN_param_value->accept(*this); |
|
5426 return NULL; |
|
5427 |
|
5428 } |
|
5429 |
|
5430 ERROR; |
|
5431 } |
|
5432 |
|
5433 }/*function_udint_to_byte*/ |
|
5434 break; |
|
5435 |
|
5436 /**** |
|
5437 *UDINT_TO_WORD |
|
5438 */ |
|
5439 case function_udint_to_word : |
|
5440 { |
|
5441 symbol_c *last_type_symbol = NULL; |
|
5442 |
|
5443 { |
|
5444 identifier_c param_name("IN"); |
|
5445 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5446 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5447 |
|
5448 /* Get the value from a foo(<param_value>) style call */ |
|
5449 if (IN_param_value == NULL) |
|
5450 IN_param_value = function_call_param_iterator.next(); |
|
5451 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5452 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5453 |
|
5454 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5455 { |
|
5456 |
|
5457 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
5458 s4o.print("("); |
|
5459 return_type_symbol->accept(*this); |
|
5460 s4o.print(")"); |
|
5461 IN_param_value->accept(*this); |
|
5462 return NULL; |
|
5463 |
|
5464 } |
|
5465 |
|
5466 ERROR; |
|
5467 } |
|
5468 |
|
5469 }/*function_udint_to_word*/ |
|
5470 break; |
|
5471 |
|
5472 /**** |
|
5473 *UDINT_TO_DWORD |
|
5474 */ |
|
5475 case function_udint_to_dword : |
|
5476 { |
|
5477 symbol_c *last_type_symbol = NULL; |
|
5478 |
|
5479 { |
|
5480 identifier_c param_name("IN"); |
|
5481 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5482 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5483 |
|
5484 /* Get the value from a foo(<param_value>) style call */ |
|
5485 if (IN_param_value == NULL) |
|
5486 IN_param_value = function_call_param_iterator.next(); |
|
5487 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5488 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5489 |
|
5490 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5491 { |
|
5492 |
|
5493 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
5494 s4o.print("("); |
|
5495 return_type_symbol->accept(*this); |
|
5496 s4o.print(")"); |
|
5497 IN_param_value->accept(*this); |
|
5498 return NULL; |
|
5499 |
|
5500 } |
|
5501 |
|
5502 ERROR; |
|
5503 } |
|
5504 |
|
5505 }/*function_udint_to_dword*/ |
|
5506 break; |
|
5507 |
|
5508 /**** |
|
5509 *UDINT_TO_LWORD |
|
5510 */ |
|
5511 case function_udint_to_lword : |
|
5512 { |
|
5513 symbol_c *last_type_symbol = NULL; |
|
5514 |
|
5515 { |
|
5516 identifier_c param_name("IN"); |
|
5517 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5518 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5519 |
|
5520 /* Get the value from a foo(<param_value>) style call */ |
|
5521 if (IN_param_value == NULL) |
|
5522 IN_param_value = function_call_param_iterator.next(); |
|
5523 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5524 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5525 |
|
5526 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
5527 { |
|
5528 |
|
5529 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
5530 s4o.print("("); |
|
5531 return_type_symbol->accept(*this); |
|
5532 s4o.print(")"); |
|
5533 IN_param_value->accept(*this); |
|
5534 return NULL; |
|
5535 |
|
5536 } |
|
5537 |
|
5538 ERROR; |
|
5539 } |
|
5540 |
|
5541 }/*function_udint_to_lword*/ |
|
5542 break; |
|
5543 |
|
5544 /**** |
|
5545 *ULINT_TO_BOOL |
|
5546 */ |
|
5547 case function_ulint_to_bool : |
|
5548 { |
|
5549 symbol_c *last_type_symbol = NULL; |
|
5550 |
|
5551 { |
|
5552 identifier_c param_name("IN"); |
|
5553 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5554 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5555 |
|
5556 /* Get the value from a foo(<param_value>) style call */ |
|
5557 if (IN_param_value == NULL) |
|
5558 IN_param_value = function_call_param_iterator.next(); |
|
5559 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5560 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5561 |
|
5562 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5563 { |
|
5564 |
|
5565 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
5566 s4o.print("("); |
|
5567 return_type_symbol->accept(*this); |
|
5568 s4o.print(")"); |
|
5569 IN_param_value->accept(*this); |
|
5570 return NULL; |
|
5571 |
|
5572 } |
|
5573 |
|
5574 ERROR; |
|
5575 } |
|
5576 |
|
5577 }/*function_ulint_to_bool*/ |
|
5578 break; |
|
5579 |
|
5580 /**** |
|
5581 *ULINT_TO_SINT |
|
5582 */ |
|
5583 case function_ulint_to_sint : |
|
5584 { |
|
5585 symbol_c *last_type_symbol = NULL; |
|
5586 |
|
5587 { |
|
5588 identifier_c param_name("IN"); |
|
5589 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5590 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5591 |
|
5592 /* Get the value from a foo(<param_value>) style call */ |
|
5593 if (IN_param_value == NULL) |
|
5594 IN_param_value = function_call_param_iterator.next(); |
|
5595 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5596 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5597 |
|
5598 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5599 { |
|
5600 |
|
5601 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
5602 s4o.print("("); |
|
5603 return_type_symbol->accept(*this); |
|
5604 s4o.print(")"); |
|
5605 IN_param_value->accept(*this); |
|
5606 return NULL; |
|
5607 |
|
5608 } |
|
5609 |
|
5610 ERROR; |
|
5611 } |
|
5612 |
|
5613 }/*function_ulint_to_sint*/ |
|
5614 break; |
|
5615 |
|
5616 /**** |
|
5617 *ULINT_TO_INT |
|
5618 */ |
|
5619 case function_ulint_to_int : |
|
5620 { |
|
5621 symbol_c *last_type_symbol = NULL; |
|
5622 |
|
5623 { |
|
5624 identifier_c param_name("IN"); |
|
5625 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5626 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5627 |
|
5628 /* Get the value from a foo(<param_value>) style call */ |
|
5629 if (IN_param_value == NULL) |
|
5630 IN_param_value = function_call_param_iterator.next(); |
|
5631 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5632 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5633 |
|
5634 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5635 { |
|
5636 |
|
5637 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
5638 s4o.print("("); |
|
5639 return_type_symbol->accept(*this); |
|
5640 s4o.print(")"); |
|
5641 IN_param_value->accept(*this); |
|
5642 return NULL; |
|
5643 |
|
5644 } |
|
5645 |
|
5646 ERROR; |
|
5647 } |
|
5648 |
|
5649 }/*function_ulint_to_int*/ |
|
5650 break; |
|
5651 |
|
5652 /**** |
|
5653 *ULINT_TO_DINT |
|
5654 */ |
|
5655 case function_ulint_to_dint : |
|
5656 { |
|
5657 symbol_c *last_type_symbol = NULL; |
|
5658 |
|
5659 { |
|
5660 identifier_c param_name("IN"); |
|
5661 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5662 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5663 |
|
5664 /* Get the value from a foo(<param_value>) style call */ |
|
5665 if (IN_param_value == NULL) |
|
5666 IN_param_value = function_call_param_iterator.next(); |
|
5667 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5668 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5669 |
|
5670 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5671 { |
|
5672 |
|
5673 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
5674 s4o.print("("); |
|
5675 return_type_symbol->accept(*this); |
|
5676 s4o.print(")"); |
|
5677 IN_param_value->accept(*this); |
|
5678 return NULL; |
|
5679 |
|
5680 } |
|
5681 |
|
5682 ERROR; |
|
5683 } |
|
5684 |
|
5685 }/*function_ulint_to_dint*/ |
|
5686 break; |
|
5687 |
|
5688 /**** |
|
5689 *ULINT_TO_LINT |
|
5690 */ |
|
5691 case function_ulint_to_lint : |
|
5692 { |
|
5693 symbol_c *last_type_symbol = NULL; |
|
5694 |
|
5695 { |
|
5696 identifier_c param_name("IN"); |
|
5697 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5698 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5699 |
|
5700 /* Get the value from a foo(<param_value>) style call */ |
|
5701 if (IN_param_value == NULL) |
|
5702 IN_param_value = function_call_param_iterator.next(); |
|
5703 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5704 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5705 |
|
5706 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5707 { |
|
5708 |
|
5709 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
5710 s4o.print("("); |
|
5711 return_type_symbol->accept(*this); |
|
5712 s4o.print(")"); |
|
5713 IN_param_value->accept(*this); |
|
5714 return NULL; |
|
5715 |
|
5716 } |
|
5717 |
|
5718 ERROR; |
|
5719 } |
|
5720 |
|
5721 }/*function_ulint_to_lint*/ |
|
5722 break; |
|
5723 |
|
5724 /**** |
|
5725 *ULINT_TO_USINT |
|
5726 */ |
|
5727 case function_ulint_to_usint : |
|
5728 { |
|
5729 symbol_c *last_type_symbol = NULL; |
|
5730 |
|
5731 { |
|
5732 identifier_c param_name("IN"); |
|
5733 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5734 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5735 |
|
5736 /* Get the value from a foo(<param_value>) style call */ |
|
5737 if (IN_param_value == NULL) |
|
5738 IN_param_value = function_call_param_iterator.next(); |
|
5739 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5740 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5741 |
|
5742 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5743 { |
|
5744 |
|
5745 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
5746 s4o.print("("); |
|
5747 return_type_symbol->accept(*this); |
|
5748 s4o.print(")"); |
|
5749 IN_param_value->accept(*this); |
|
5750 return NULL; |
|
5751 |
|
5752 } |
|
5753 |
|
5754 ERROR; |
|
5755 } |
|
5756 |
|
5757 }/*function_ulint_to_usint*/ |
|
5758 break; |
|
5759 |
|
5760 /**** |
|
5761 *ULINT_TO_UINT |
|
5762 */ |
|
5763 case function_ulint_to_uint : |
|
5764 { |
|
5765 symbol_c *last_type_symbol = NULL; |
|
5766 |
|
5767 { |
|
5768 identifier_c param_name("IN"); |
|
5769 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5770 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5771 |
|
5772 /* Get the value from a foo(<param_value>) style call */ |
|
5773 if (IN_param_value == NULL) |
|
5774 IN_param_value = function_call_param_iterator.next(); |
|
5775 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5776 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5777 |
|
5778 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5779 { |
|
5780 |
|
5781 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
5782 s4o.print("("); |
|
5783 return_type_symbol->accept(*this); |
|
5784 s4o.print(")"); |
|
5785 IN_param_value->accept(*this); |
|
5786 return NULL; |
|
5787 |
|
5788 } |
|
5789 |
|
5790 ERROR; |
|
5791 } |
|
5792 |
|
5793 }/*function_ulint_to_uint*/ |
|
5794 break; |
|
5795 |
|
5796 /**** |
|
5797 *ULINT_TO_UDINT |
|
5798 */ |
|
5799 case function_ulint_to_udint : |
|
5800 { |
|
5801 symbol_c *last_type_symbol = NULL; |
|
5802 |
|
5803 { |
|
5804 identifier_c param_name("IN"); |
|
5805 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5806 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5807 |
|
5808 /* Get the value from a foo(<param_value>) style call */ |
|
5809 if (IN_param_value == NULL) |
|
5810 IN_param_value = function_call_param_iterator.next(); |
|
5811 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5812 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5813 |
|
5814 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5815 { |
|
5816 |
|
5817 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
5818 s4o.print("("); |
|
5819 return_type_symbol->accept(*this); |
|
5820 s4o.print(")"); |
|
5821 IN_param_value->accept(*this); |
|
5822 return NULL; |
|
5823 |
|
5824 } |
|
5825 |
|
5826 ERROR; |
|
5827 } |
|
5828 |
|
5829 }/*function_ulint_to_udint*/ |
|
5830 break; |
|
5831 |
|
5832 /**** |
|
5833 *ULINT_TO_REAL |
|
5834 */ |
|
5835 case function_ulint_to_real : |
|
5836 { |
|
5837 symbol_c *last_type_symbol = NULL; |
|
5838 |
|
5839 { |
|
5840 identifier_c param_name("IN"); |
|
5841 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5842 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5843 |
|
5844 /* Get the value from a foo(<param_value>) style call */ |
|
5845 if (IN_param_value == NULL) |
|
5846 IN_param_value = function_call_param_iterator.next(); |
|
5847 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5848 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5849 |
|
5850 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5851 { |
|
5852 |
|
5853 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
5854 s4o.print("("); |
|
5855 return_type_symbol->accept(*this); |
|
5856 s4o.print(")"); |
|
5857 IN_param_value->accept(*this); |
|
5858 return NULL; |
|
5859 |
|
5860 } |
|
5861 |
|
5862 ERROR; |
|
5863 } |
|
5864 |
|
5865 }/*function_ulint_to_real*/ |
|
5866 break; |
|
5867 |
|
5868 /**** |
|
5869 *ULINT_TO_LREAL |
|
5870 */ |
|
5871 case function_ulint_to_lreal : |
|
5872 { |
|
5873 symbol_c *last_type_symbol = NULL; |
|
5874 |
|
5875 { |
|
5876 identifier_c param_name("IN"); |
|
5877 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5878 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5879 |
|
5880 /* Get the value from a foo(<param_value>) style call */ |
|
5881 if (IN_param_value == NULL) |
|
5882 IN_param_value = function_call_param_iterator.next(); |
|
5883 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5884 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5885 |
|
5886 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5887 { |
|
5888 |
|
5889 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
5890 s4o.print("("); |
|
5891 return_type_symbol->accept(*this); |
|
5892 s4o.print(")"); |
|
5893 IN_param_value->accept(*this); |
|
5894 return NULL; |
|
5895 |
|
5896 } |
|
5897 |
|
5898 ERROR; |
|
5899 } |
|
5900 |
|
5901 }/*function_ulint_to_lreal*/ |
|
5902 break; |
|
5903 |
|
5904 /**** |
|
5905 *ULINT_TO_TIME |
|
5906 */ |
|
5907 case function_ulint_to_time : |
|
5908 { |
|
5909 symbol_c *last_type_symbol = NULL; |
|
5910 |
|
5911 { |
|
5912 identifier_c param_name("IN"); |
|
5913 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5914 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5915 |
|
5916 /* Get the value from a foo(<param_value>) style call */ |
|
5917 if (IN_param_value == NULL) |
|
5918 IN_param_value = function_call_param_iterator.next(); |
|
5919 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5920 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5921 |
|
5922 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5923 { |
|
5924 |
|
5925 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
5926 s4o.print("("); |
|
5927 return_type_symbol->accept(*this); |
|
5928 s4o.print(")__int_to_time("); |
|
5929 IN_param_value->accept(*this); |
|
5930 s4o.print(")"); |
|
5931 return NULL; |
|
5932 |
|
5933 } |
|
5934 |
|
5935 ERROR; |
|
5936 } |
|
5937 |
|
5938 }/*function_ulint_to_time*/ |
|
5939 break; |
|
5940 |
|
5941 /**** |
|
5942 *ULINT_TO_DATE |
|
5943 */ |
|
5944 case function_ulint_to_date : |
|
5945 { |
|
5946 symbol_c *last_type_symbol = NULL; |
|
5947 |
|
5948 { |
|
5949 identifier_c param_name("IN"); |
|
5950 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5951 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5952 |
|
5953 /* Get the value from a foo(<param_value>) style call */ |
|
5954 if (IN_param_value == NULL) |
|
5955 IN_param_value = function_call_param_iterator.next(); |
|
5956 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5957 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5958 |
|
5959 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5960 { |
|
5961 |
|
5962 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
5963 s4o.print("("); |
|
5964 return_type_symbol->accept(*this); |
|
5965 s4o.print(")__int_to_time("); |
|
5966 IN_param_value->accept(*this); |
|
5967 s4o.print(")"); |
|
5968 return NULL; |
|
5969 |
|
5970 } |
|
5971 |
|
5972 ERROR; |
|
5973 } |
|
5974 |
|
5975 }/*function_ulint_to_date*/ |
|
5976 break; |
|
5977 |
|
5978 /**** |
|
5979 *ULINT_TO_TOD |
|
5980 */ |
|
5981 case function_ulint_to_tod : |
|
5982 { |
|
5983 symbol_c *last_type_symbol = NULL; |
|
5984 |
|
5985 { |
|
5986 identifier_c param_name("IN"); |
|
5987 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
5988 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
5989 |
|
5990 /* Get the value from a foo(<param_value>) style call */ |
|
5991 if (IN_param_value == NULL) |
|
5992 IN_param_value = function_call_param_iterator.next(); |
|
5993 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
5994 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
5995 |
|
5996 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
5997 { |
|
5998 |
|
5999 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
6000 s4o.print("("); |
|
6001 return_type_symbol->accept(*this); |
|
6002 s4o.print(")__int_to_time("); |
|
6003 IN_param_value->accept(*this); |
|
6004 s4o.print(")"); |
|
6005 return NULL; |
|
6006 |
|
6007 } |
|
6008 |
|
6009 ERROR; |
|
6010 } |
|
6011 |
|
6012 }/*function_ulint_to_tod*/ |
|
6013 break; |
|
6014 |
|
6015 /**** |
|
6016 *ULINT_TO_DT |
|
6017 */ |
|
6018 case function_ulint_to_dt : |
|
6019 { |
|
6020 symbol_c *last_type_symbol = NULL; |
|
6021 |
|
6022 { |
|
6023 identifier_c param_name("IN"); |
|
6024 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6025 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6026 |
|
6027 /* Get the value from a foo(<param_value>) style call */ |
|
6028 if (IN_param_value == NULL) |
|
6029 IN_param_value = function_call_param_iterator.next(); |
|
6030 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6031 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6032 |
|
6033 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6034 { |
|
6035 |
|
6036 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
6037 s4o.print("("); |
|
6038 return_type_symbol->accept(*this); |
|
6039 s4o.print(")__int_to_time("); |
|
6040 IN_param_value->accept(*this); |
|
6041 s4o.print(")"); |
|
6042 return NULL; |
|
6043 |
|
6044 } |
|
6045 |
|
6046 ERROR; |
|
6047 } |
|
6048 |
|
6049 }/*function_ulint_to_dt*/ |
|
6050 break; |
|
6051 |
|
6052 /**** |
|
6053 *ULINT_TO_STRING |
|
6054 */ |
|
6055 case function_ulint_to_string : |
|
6056 { |
|
6057 symbol_c *last_type_symbol = NULL; |
|
6058 |
|
6059 { |
|
6060 identifier_c param_name("IN"); |
|
6061 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6062 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6063 |
|
6064 /* Get the value from a foo(<param_value>) style call */ |
|
6065 if (IN_param_value == NULL) |
|
6066 IN_param_value = function_call_param_iterator.next(); |
|
6067 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6068 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6069 |
|
6070 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6071 { |
|
6072 |
|
6073 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
6074 s4o.print("("); |
|
6075 return_type_symbol->accept(*this); |
|
6076 s4o.print(")__uint_to_string("); |
|
6077 IN_param_value->accept(*this); |
|
6078 s4o.print(")"); |
|
6079 return NULL; |
|
6080 |
|
6081 } |
|
6082 |
|
6083 ERROR; |
|
6084 } |
|
6085 |
|
6086 }/*function_ulint_to_string*/ |
|
6087 break; |
|
6088 |
|
6089 /**** |
|
6090 *ULINT_TO_BYTE |
|
6091 */ |
|
6092 case function_ulint_to_byte : |
|
6093 { |
|
6094 symbol_c *last_type_symbol = NULL; |
|
6095 |
|
6096 { |
|
6097 identifier_c param_name("IN"); |
|
6098 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6099 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6100 |
|
6101 /* Get the value from a foo(<param_value>) style call */ |
|
6102 if (IN_param_value == NULL) |
|
6103 IN_param_value = function_call_param_iterator.next(); |
|
6104 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6105 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6106 |
|
6107 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6108 { |
|
6109 |
|
6110 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
6111 s4o.print("("); |
|
6112 return_type_symbol->accept(*this); |
|
6113 s4o.print(")"); |
|
6114 IN_param_value->accept(*this); |
|
6115 return NULL; |
|
6116 |
|
6117 } |
|
6118 |
|
6119 ERROR; |
|
6120 } |
|
6121 |
|
6122 }/*function_ulint_to_byte*/ |
|
6123 break; |
|
6124 |
|
6125 /**** |
|
6126 *ULINT_TO_WORD |
|
6127 */ |
|
6128 case function_ulint_to_word : |
|
6129 { |
|
6130 symbol_c *last_type_symbol = NULL; |
|
6131 |
|
6132 { |
|
6133 identifier_c param_name("IN"); |
|
6134 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6135 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6136 |
|
6137 /* Get the value from a foo(<param_value>) style call */ |
|
6138 if (IN_param_value == NULL) |
|
6139 IN_param_value = function_call_param_iterator.next(); |
|
6140 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6141 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6142 |
|
6143 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6144 { |
|
6145 |
|
6146 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
6147 s4o.print("("); |
|
6148 return_type_symbol->accept(*this); |
|
6149 s4o.print(")"); |
|
6150 IN_param_value->accept(*this); |
|
6151 return NULL; |
|
6152 |
|
6153 } |
|
6154 |
|
6155 ERROR; |
|
6156 } |
|
6157 |
|
6158 }/*function_ulint_to_word*/ |
|
6159 break; |
|
6160 |
|
6161 /**** |
|
6162 *ULINT_TO_DWORD |
|
6163 */ |
|
6164 case function_ulint_to_dword : |
|
6165 { |
|
6166 symbol_c *last_type_symbol = NULL; |
|
6167 |
|
6168 { |
|
6169 identifier_c param_name("IN"); |
|
6170 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6171 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6172 |
|
6173 /* Get the value from a foo(<param_value>) style call */ |
|
6174 if (IN_param_value == NULL) |
|
6175 IN_param_value = function_call_param_iterator.next(); |
|
6176 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6177 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6178 |
|
6179 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6180 { |
|
6181 |
|
6182 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
6183 s4o.print("("); |
|
6184 return_type_symbol->accept(*this); |
|
6185 s4o.print(")"); |
|
6186 IN_param_value->accept(*this); |
|
6187 return NULL; |
|
6188 |
|
6189 } |
|
6190 |
|
6191 ERROR; |
|
6192 } |
|
6193 |
|
6194 }/*function_ulint_to_dword*/ |
|
6195 break; |
|
6196 |
|
6197 /**** |
|
6198 *ULINT_TO_LWORD |
|
6199 */ |
|
6200 case function_ulint_to_lword : |
|
6201 { |
|
6202 symbol_c *last_type_symbol = NULL; |
|
6203 |
|
6204 { |
|
6205 identifier_c param_name("IN"); |
|
6206 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6207 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6208 |
|
6209 /* Get the value from a foo(<param_value>) style call */ |
|
6210 if (IN_param_value == NULL) |
|
6211 IN_param_value = function_call_param_iterator.next(); |
|
6212 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6213 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6214 |
|
6215 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
6216 { |
|
6217 |
|
6218 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
6219 s4o.print("("); |
|
6220 return_type_symbol->accept(*this); |
|
6221 s4o.print(")"); |
|
6222 IN_param_value->accept(*this); |
|
6223 return NULL; |
|
6224 |
|
6225 } |
|
6226 |
|
6227 ERROR; |
|
6228 } |
|
6229 |
|
6230 }/*function_ulint_to_lword*/ |
|
6231 break; |
|
6232 |
|
6233 /**** |
|
6234 *REAL_TO_BOOL |
|
6235 */ |
|
6236 case function_real_to_bool : |
|
6237 { |
|
6238 symbol_c *last_type_symbol = NULL; |
|
6239 |
|
6240 { |
|
6241 identifier_c param_name("IN"); |
|
6242 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6243 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6244 |
|
6245 /* Get the value from a foo(<param_value>) style call */ |
|
6246 if (IN_param_value == NULL) |
|
6247 IN_param_value = function_call_param_iterator.next(); |
|
6248 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6249 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6250 |
|
6251 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6252 { |
|
6253 |
|
6254 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
6255 s4o.print("("); |
|
6256 return_type_symbol->accept(*this); |
|
6257 s4o.print(")"); |
|
6258 IN_param_value->accept(*this); |
|
6259 return NULL; |
|
6260 |
|
6261 } |
|
6262 |
|
6263 ERROR; |
|
6264 } |
|
6265 |
|
6266 }/*function_real_to_bool*/ |
|
6267 break; |
|
6268 |
|
6269 /**** |
|
6270 *REAL_TO_SINT |
|
6271 */ |
|
6272 case function_real_to_sint : |
|
6273 { |
|
6274 symbol_c *last_type_symbol = NULL; |
|
6275 |
|
6276 { |
|
6277 identifier_c param_name("IN"); |
|
6278 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6279 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6280 |
|
6281 /* Get the value from a foo(<param_value>) style call */ |
|
6282 if (IN_param_value == NULL) |
|
6283 IN_param_value = function_call_param_iterator.next(); |
|
6284 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6285 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6286 |
|
6287 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6288 { |
|
6289 |
|
6290 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
6291 s4o.print("("); |
|
6292 return_type_symbol->accept(*this); |
|
6293 s4o.print(")"); |
|
6294 IN_param_value->accept(*this); |
|
6295 return NULL; |
|
6296 |
|
6297 } |
|
6298 |
|
6299 ERROR; |
|
6300 } |
|
6301 |
|
6302 }/*function_real_to_sint*/ |
|
6303 break; |
|
6304 |
|
6305 /**** |
|
6306 *REAL_TO_INT |
|
6307 */ |
|
6308 case function_real_to_int : |
|
6309 { |
|
6310 symbol_c *last_type_symbol = NULL; |
|
6311 |
|
6312 { |
|
6313 identifier_c param_name("IN"); |
|
6314 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6315 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6316 |
|
6317 /* Get the value from a foo(<param_value>) style call */ |
|
6318 if (IN_param_value == NULL) |
|
6319 IN_param_value = function_call_param_iterator.next(); |
|
6320 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6321 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6322 |
|
6323 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6324 { |
|
6325 |
|
6326 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
6327 s4o.print("("); |
|
6328 return_type_symbol->accept(*this); |
|
6329 s4o.print(")"); |
|
6330 IN_param_value->accept(*this); |
|
6331 return NULL; |
|
6332 |
|
6333 } |
|
6334 |
|
6335 ERROR; |
|
6336 } |
|
6337 |
|
6338 }/*function_real_to_int*/ |
|
6339 break; |
|
6340 |
|
6341 /**** |
|
6342 *REAL_TO_DINT |
|
6343 */ |
|
6344 case function_real_to_dint : |
|
6345 { |
|
6346 symbol_c *last_type_symbol = NULL; |
|
6347 |
|
6348 { |
|
6349 identifier_c param_name("IN"); |
|
6350 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6351 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6352 |
|
6353 /* Get the value from a foo(<param_value>) style call */ |
|
6354 if (IN_param_value == NULL) |
|
6355 IN_param_value = function_call_param_iterator.next(); |
|
6356 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6357 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6358 |
|
6359 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6360 { |
|
6361 |
|
6362 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
6363 s4o.print("("); |
|
6364 return_type_symbol->accept(*this); |
|
6365 s4o.print(")"); |
|
6366 IN_param_value->accept(*this); |
|
6367 return NULL; |
|
6368 |
|
6369 } |
|
6370 |
|
6371 ERROR; |
|
6372 } |
|
6373 |
|
6374 }/*function_real_to_dint*/ |
|
6375 break; |
|
6376 |
|
6377 /**** |
|
6378 *REAL_TO_LINT |
|
6379 */ |
|
6380 case function_real_to_lint : |
|
6381 { |
|
6382 symbol_c *last_type_symbol = NULL; |
|
6383 |
|
6384 { |
|
6385 identifier_c param_name("IN"); |
|
6386 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6387 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6388 |
|
6389 /* Get the value from a foo(<param_value>) style call */ |
|
6390 if (IN_param_value == NULL) |
|
6391 IN_param_value = function_call_param_iterator.next(); |
|
6392 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6393 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6394 |
|
6395 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6396 { |
|
6397 |
|
6398 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
6399 s4o.print("("); |
|
6400 return_type_symbol->accept(*this); |
|
6401 s4o.print(")"); |
|
6402 IN_param_value->accept(*this); |
|
6403 return NULL; |
|
6404 |
|
6405 } |
|
6406 |
|
6407 ERROR; |
|
6408 } |
|
6409 |
|
6410 }/*function_real_to_lint*/ |
|
6411 break; |
|
6412 |
|
6413 /**** |
|
6414 *REAL_TO_USINT |
|
6415 */ |
|
6416 case function_real_to_usint : |
|
6417 { |
|
6418 symbol_c *last_type_symbol = NULL; |
|
6419 |
|
6420 { |
|
6421 identifier_c param_name("IN"); |
|
6422 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6423 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6424 |
|
6425 /* Get the value from a foo(<param_value>) style call */ |
|
6426 if (IN_param_value == NULL) |
|
6427 IN_param_value = function_call_param_iterator.next(); |
|
6428 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6429 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6430 |
|
6431 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6432 { |
|
6433 |
|
6434 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
6435 s4o.print("("); |
|
6436 return_type_symbol->accept(*this); |
|
6437 s4o.print(")"); |
|
6438 IN_param_value->accept(*this); |
|
6439 return NULL; |
|
6440 |
|
6441 } |
|
6442 |
|
6443 ERROR; |
|
6444 } |
|
6445 |
|
6446 }/*function_real_to_usint*/ |
|
6447 break; |
|
6448 |
|
6449 /**** |
|
6450 *REAL_TO_UINT |
|
6451 */ |
|
6452 case function_real_to_uint : |
|
6453 { |
|
6454 symbol_c *last_type_symbol = NULL; |
|
6455 |
|
6456 { |
|
6457 identifier_c param_name("IN"); |
|
6458 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6459 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6460 |
|
6461 /* Get the value from a foo(<param_value>) style call */ |
|
6462 if (IN_param_value == NULL) |
|
6463 IN_param_value = function_call_param_iterator.next(); |
|
6464 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6465 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6466 |
|
6467 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6468 { |
|
6469 |
|
6470 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
6471 s4o.print("("); |
|
6472 return_type_symbol->accept(*this); |
|
6473 s4o.print(")"); |
|
6474 IN_param_value->accept(*this); |
|
6475 return NULL; |
|
6476 |
|
6477 } |
|
6478 |
|
6479 ERROR; |
|
6480 } |
|
6481 |
|
6482 }/*function_real_to_uint*/ |
|
6483 break; |
|
6484 |
|
6485 /**** |
|
6486 *REAL_TO_UDINT |
|
6487 */ |
|
6488 case function_real_to_udint : |
|
6489 { |
|
6490 symbol_c *last_type_symbol = NULL; |
|
6491 |
|
6492 { |
|
6493 identifier_c param_name("IN"); |
|
6494 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6495 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6496 |
|
6497 /* Get the value from a foo(<param_value>) style call */ |
|
6498 if (IN_param_value == NULL) |
|
6499 IN_param_value = function_call_param_iterator.next(); |
|
6500 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6501 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6502 |
|
6503 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6504 { |
|
6505 |
|
6506 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
6507 s4o.print("("); |
|
6508 return_type_symbol->accept(*this); |
|
6509 s4o.print(")"); |
|
6510 IN_param_value->accept(*this); |
|
6511 return NULL; |
|
6512 |
|
6513 } |
|
6514 |
|
6515 ERROR; |
|
6516 } |
|
6517 |
|
6518 }/*function_real_to_udint*/ |
|
6519 break; |
|
6520 |
|
6521 /**** |
|
6522 *REAL_TO_ULINT |
|
6523 */ |
|
6524 case function_real_to_ulint : |
|
6525 { |
|
6526 symbol_c *last_type_symbol = NULL; |
|
6527 |
|
6528 { |
|
6529 identifier_c param_name("IN"); |
|
6530 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6531 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6532 |
|
6533 /* Get the value from a foo(<param_value>) style call */ |
|
6534 if (IN_param_value == NULL) |
|
6535 IN_param_value = function_call_param_iterator.next(); |
|
6536 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6537 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6538 |
|
6539 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6540 { |
|
6541 |
|
6542 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
6543 s4o.print("("); |
|
6544 return_type_symbol->accept(*this); |
|
6545 s4o.print(")"); |
|
6546 IN_param_value->accept(*this); |
|
6547 return NULL; |
|
6548 |
|
6549 } |
|
6550 |
|
6551 ERROR; |
|
6552 } |
|
6553 |
|
6554 }/*function_real_to_ulint*/ |
|
6555 break; |
|
6556 |
|
6557 /**** |
|
6558 *REAL_TO_LREAL |
|
6559 */ |
|
6560 case function_real_to_lreal : |
|
6561 { |
|
6562 symbol_c *last_type_symbol = NULL; |
|
6563 |
|
6564 { |
|
6565 identifier_c param_name("IN"); |
|
6566 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6567 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6568 |
|
6569 /* Get the value from a foo(<param_value>) style call */ |
|
6570 if (IN_param_value == NULL) |
|
6571 IN_param_value = function_call_param_iterator.next(); |
|
6572 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6573 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6574 |
|
6575 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6576 { |
|
6577 |
|
6578 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
6579 s4o.print("("); |
|
6580 return_type_symbol->accept(*this); |
|
6581 s4o.print(")"); |
|
6582 IN_param_value->accept(*this); |
|
6583 return NULL; |
|
6584 |
|
6585 } |
|
6586 |
|
6587 ERROR; |
|
6588 } |
|
6589 |
|
6590 }/*function_real_to_lreal*/ |
|
6591 break; |
|
6592 |
|
6593 /**** |
|
6594 *REAL_TO_TIME |
|
6595 */ |
|
6596 case function_real_to_time : |
|
6597 { |
|
6598 symbol_c *last_type_symbol = NULL; |
|
6599 |
|
6600 { |
|
6601 identifier_c param_name("IN"); |
|
6602 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6603 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6604 |
|
6605 /* Get the value from a foo(<param_value>) style call */ |
|
6606 if (IN_param_value == NULL) |
|
6607 IN_param_value = function_call_param_iterator.next(); |
|
6608 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6609 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6610 |
|
6611 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6612 { |
|
6613 |
|
6614 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
6615 s4o.print("("); |
|
6616 return_type_symbol->accept(*this); |
|
6617 s4o.print(")__real_to_time("); |
|
6618 IN_param_value->accept(*this); |
|
6619 s4o.print(")"); |
|
6620 return NULL; |
|
6621 |
|
6622 } |
|
6623 |
|
6624 ERROR; |
|
6625 } |
|
6626 |
|
6627 }/*function_real_to_time*/ |
|
6628 break; |
|
6629 |
|
6630 /**** |
|
6631 *REAL_TO_DATE |
|
6632 */ |
|
6633 case function_real_to_date : |
|
6634 { |
|
6635 symbol_c *last_type_symbol = NULL; |
|
6636 |
|
6637 { |
|
6638 identifier_c param_name("IN"); |
|
6639 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6640 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6641 |
|
6642 /* Get the value from a foo(<param_value>) style call */ |
|
6643 if (IN_param_value == NULL) |
|
6644 IN_param_value = function_call_param_iterator.next(); |
|
6645 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6646 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6647 |
|
6648 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6649 { |
|
6650 |
|
6651 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
6652 s4o.print("("); |
|
6653 return_type_symbol->accept(*this); |
|
6654 s4o.print(")__real_to_time("); |
|
6655 IN_param_value->accept(*this); |
|
6656 s4o.print(")"); |
|
6657 return NULL; |
|
6658 |
|
6659 } |
|
6660 |
|
6661 ERROR; |
|
6662 } |
|
6663 |
|
6664 }/*function_real_to_date*/ |
|
6665 break; |
|
6666 |
|
6667 /**** |
|
6668 *REAL_TO_TOD |
|
6669 */ |
|
6670 case function_real_to_tod : |
|
6671 { |
|
6672 symbol_c *last_type_symbol = NULL; |
|
6673 |
|
6674 { |
|
6675 identifier_c param_name("IN"); |
|
6676 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6677 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6678 |
|
6679 /* Get the value from a foo(<param_value>) style call */ |
|
6680 if (IN_param_value == NULL) |
|
6681 IN_param_value = function_call_param_iterator.next(); |
|
6682 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6683 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6684 |
|
6685 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6686 { |
|
6687 |
|
6688 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
6689 s4o.print("("); |
|
6690 return_type_symbol->accept(*this); |
|
6691 s4o.print(")__real_to_time("); |
|
6692 IN_param_value->accept(*this); |
|
6693 s4o.print(")"); |
|
6694 return NULL; |
|
6695 |
|
6696 } |
|
6697 |
|
6698 ERROR; |
|
6699 } |
|
6700 |
|
6701 }/*function_real_to_tod*/ |
|
6702 break; |
|
6703 |
|
6704 /**** |
|
6705 *REAL_TO_DT |
|
6706 */ |
|
6707 case function_real_to_dt : |
|
6708 { |
|
6709 symbol_c *last_type_symbol = NULL; |
|
6710 |
|
6711 { |
|
6712 identifier_c param_name("IN"); |
|
6713 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6714 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6715 |
|
6716 /* Get the value from a foo(<param_value>) style call */ |
|
6717 if (IN_param_value == NULL) |
|
6718 IN_param_value = function_call_param_iterator.next(); |
|
6719 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6720 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6721 |
|
6722 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6723 { |
|
6724 |
|
6725 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
6726 s4o.print("("); |
|
6727 return_type_symbol->accept(*this); |
|
6728 s4o.print(")__real_to_time("); |
|
6729 IN_param_value->accept(*this); |
|
6730 s4o.print(")"); |
|
6731 return NULL; |
|
6732 |
|
6733 } |
|
6734 |
|
6735 ERROR; |
|
6736 } |
|
6737 |
|
6738 }/*function_real_to_dt*/ |
|
6739 break; |
|
6740 |
|
6741 /**** |
|
6742 *REAL_TO_STRING |
|
6743 */ |
|
6744 case function_real_to_string : |
|
6745 { |
|
6746 symbol_c *last_type_symbol = NULL; |
|
6747 |
|
6748 { |
|
6749 identifier_c param_name("IN"); |
|
6750 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6751 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6752 |
|
6753 /* Get the value from a foo(<param_value>) style call */ |
|
6754 if (IN_param_value == NULL) |
|
6755 IN_param_value = function_call_param_iterator.next(); |
|
6756 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6757 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6758 |
|
6759 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6760 { |
|
6761 |
|
6762 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
6763 s4o.print("("); |
|
6764 return_type_symbol->accept(*this); |
|
6765 s4o.print(")__real_to_string("); |
|
6766 IN_param_value->accept(*this); |
|
6767 s4o.print(")"); |
|
6768 return NULL; |
|
6769 |
|
6770 } |
|
6771 |
|
6772 ERROR; |
|
6773 } |
|
6774 |
|
6775 }/*function_real_to_string*/ |
|
6776 break; |
|
6777 |
|
6778 /**** |
|
6779 *REAL_TO_BYTE |
|
6780 */ |
|
6781 case function_real_to_byte : |
|
6782 { |
|
6783 symbol_c *last_type_symbol = NULL; |
|
6784 |
|
6785 { |
|
6786 identifier_c param_name("IN"); |
|
6787 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6788 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6789 |
|
6790 /* Get the value from a foo(<param_value>) style call */ |
|
6791 if (IN_param_value == NULL) |
|
6792 IN_param_value = function_call_param_iterator.next(); |
|
6793 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6794 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6795 |
|
6796 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6797 { |
|
6798 |
|
6799 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
6800 s4o.print("("); |
|
6801 return_type_symbol->accept(*this); |
|
6802 s4o.print(")"); |
|
6803 IN_param_value->accept(*this); |
|
6804 return NULL; |
|
6805 |
|
6806 } |
|
6807 |
|
6808 ERROR; |
|
6809 } |
|
6810 |
|
6811 }/*function_real_to_byte*/ |
|
6812 break; |
|
6813 |
|
6814 /**** |
|
6815 *REAL_TO_WORD |
|
6816 */ |
|
6817 case function_real_to_word : |
|
6818 { |
|
6819 symbol_c *last_type_symbol = NULL; |
|
6820 |
|
6821 { |
|
6822 identifier_c param_name("IN"); |
|
6823 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6824 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6825 |
|
6826 /* Get the value from a foo(<param_value>) style call */ |
|
6827 if (IN_param_value == NULL) |
|
6828 IN_param_value = function_call_param_iterator.next(); |
|
6829 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6830 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6831 |
|
6832 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6833 { |
|
6834 |
|
6835 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
6836 s4o.print("("); |
|
6837 return_type_symbol->accept(*this); |
|
6838 s4o.print(")"); |
|
6839 IN_param_value->accept(*this); |
|
6840 return NULL; |
|
6841 |
|
6842 } |
|
6843 |
|
6844 ERROR; |
|
6845 } |
|
6846 |
|
6847 }/*function_real_to_word*/ |
|
6848 break; |
|
6849 |
|
6850 /**** |
|
6851 *REAL_TO_DWORD |
|
6852 */ |
|
6853 case function_real_to_dword : |
|
6854 { |
|
6855 symbol_c *last_type_symbol = NULL; |
|
6856 |
|
6857 { |
|
6858 identifier_c param_name("IN"); |
|
6859 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6860 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6861 |
|
6862 /* Get the value from a foo(<param_value>) style call */ |
|
6863 if (IN_param_value == NULL) |
|
6864 IN_param_value = function_call_param_iterator.next(); |
|
6865 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6866 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6867 |
|
6868 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6869 { |
|
6870 |
|
6871 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
6872 s4o.print("("); |
|
6873 return_type_symbol->accept(*this); |
|
6874 s4o.print(")"); |
|
6875 IN_param_value->accept(*this); |
|
6876 return NULL; |
|
6877 |
|
6878 } |
|
6879 |
|
6880 ERROR; |
|
6881 } |
|
6882 |
|
6883 }/*function_real_to_dword*/ |
|
6884 break; |
|
6885 |
|
6886 /**** |
|
6887 *REAL_TO_LWORD |
|
6888 */ |
|
6889 case function_real_to_lword : |
|
6890 { |
|
6891 symbol_c *last_type_symbol = NULL; |
|
6892 |
|
6893 { |
|
6894 identifier_c param_name("IN"); |
|
6895 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6896 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6897 |
|
6898 /* Get the value from a foo(<param_value>) style call */ |
|
6899 if (IN_param_value == NULL) |
|
6900 IN_param_value = function_call_param_iterator.next(); |
|
6901 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6902 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6903 |
|
6904 if(search_expression_type->is_same_type(&search_constant_type_c::real_type_name, last_type_symbol)) |
|
6905 { |
|
6906 |
|
6907 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
6908 s4o.print("("); |
|
6909 return_type_symbol->accept(*this); |
|
6910 s4o.print(")"); |
|
6911 IN_param_value->accept(*this); |
|
6912 return NULL; |
|
6913 |
|
6914 } |
|
6915 |
|
6916 ERROR; |
|
6917 } |
|
6918 |
|
6919 }/*function_real_to_lword*/ |
|
6920 break; |
|
6921 |
|
6922 /**** |
|
6923 *LREAL_TO_BOOL |
|
6924 */ |
|
6925 case function_lreal_to_bool : |
|
6926 { |
|
6927 symbol_c *last_type_symbol = NULL; |
|
6928 |
|
6929 { |
|
6930 identifier_c param_name("IN"); |
|
6931 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6932 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6933 |
|
6934 /* Get the value from a foo(<param_value>) style call */ |
|
6935 if (IN_param_value == NULL) |
|
6936 IN_param_value = function_call_param_iterator.next(); |
|
6937 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6938 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6939 |
|
6940 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
6941 { |
|
6942 |
|
6943 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
6944 s4o.print("("); |
|
6945 return_type_symbol->accept(*this); |
|
6946 s4o.print(")"); |
|
6947 IN_param_value->accept(*this); |
|
6948 return NULL; |
|
6949 |
|
6950 } |
|
6951 |
|
6952 ERROR; |
|
6953 } |
|
6954 |
|
6955 }/*function_lreal_to_bool*/ |
|
6956 break; |
|
6957 |
|
6958 /**** |
|
6959 *LREAL_TO_SINT |
|
6960 */ |
|
6961 case function_lreal_to_sint : |
|
6962 { |
|
6963 symbol_c *last_type_symbol = NULL; |
|
6964 |
|
6965 { |
|
6966 identifier_c param_name("IN"); |
|
6967 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
6968 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
6969 |
|
6970 /* Get the value from a foo(<param_value>) style call */ |
|
6971 if (IN_param_value == NULL) |
|
6972 IN_param_value = function_call_param_iterator.next(); |
|
6973 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
6974 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
6975 |
|
6976 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
6977 { |
|
6978 |
|
6979 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
6980 s4o.print("("); |
|
6981 return_type_symbol->accept(*this); |
|
6982 s4o.print(")"); |
|
6983 IN_param_value->accept(*this); |
|
6984 return NULL; |
|
6985 |
|
6986 } |
|
6987 |
|
6988 ERROR; |
|
6989 } |
|
6990 |
|
6991 }/*function_lreal_to_sint*/ |
|
6992 break; |
|
6993 |
|
6994 /**** |
|
6995 *LREAL_TO_INT |
|
6996 */ |
|
6997 case function_lreal_to_int : |
|
6998 { |
|
6999 symbol_c *last_type_symbol = NULL; |
|
7000 |
|
7001 { |
|
7002 identifier_c param_name("IN"); |
|
7003 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7004 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7005 |
|
7006 /* Get the value from a foo(<param_value>) style call */ |
|
7007 if (IN_param_value == NULL) |
|
7008 IN_param_value = function_call_param_iterator.next(); |
|
7009 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7010 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7011 |
|
7012 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7013 { |
|
7014 |
|
7015 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
7016 s4o.print("("); |
|
7017 return_type_symbol->accept(*this); |
|
7018 s4o.print(")"); |
|
7019 IN_param_value->accept(*this); |
|
7020 return NULL; |
|
7021 |
|
7022 } |
|
7023 |
|
7024 ERROR; |
|
7025 } |
|
7026 |
|
7027 }/*function_lreal_to_int*/ |
|
7028 break; |
|
7029 |
|
7030 /**** |
|
7031 *LREAL_TO_DINT |
|
7032 */ |
|
7033 case function_lreal_to_dint : |
|
7034 { |
|
7035 symbol_c *last_type_symbol = NULL; |
|
7036 |
|
7037 { |
|
7038 identifier_c param_name("IN"); |
|
7039 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7040 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7041 |
|
7042 /* Get the value from a foo(<param_value>) style call */ |
|
7043 if (IN_param_value == NULL) |
|
7044 IN_param_value = function_call_param_iterator.next(); |
|
7045 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7046 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7047 |
|
7048 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7049 { |
|
7050 |
|
7051 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
7052 s4o.print("("); |
|
7053 return_type_symbol->accept(*this); |
|
7054 s4o.print(")"); |
|
7055 IN_param_value->accept(*this); |
|
7056 return NULL; |
|
7057 |
|
7058 } |
|
7059 |
|
7060 ERROR; |
|
7061 } |
|
7062 |
|
7063 }/*function_lreal_to_dint*/ |
|
7064 break; |
|
7065 |
|
7066 /**** |
|
7067 *LREAL_TO_LINT |
|
7068 */ |
|
7069 case function_lreal_to_lint : |
|
7070 { |
|
7071 symbol_c *last_type_symbol = NULL; |
|
7072 |
|
7073 { |
|
7074 identifier_c param_name("IN"); |
|
7075 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7076 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7077 |
|
7078 /* Get the value from a foo(<param_value>) style call */ |
|
7079 if (IN_param_value == NULL) |
|
7080 IN_param_value = function_call_param_iterator.next(); |
|
7081 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7082 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7083 |
|
7084 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7085 { |
|
7086 |
|
7087 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
7088 s4o.print("("); |
|
7089 return_type_symbol->accept(*this); |
|
7090 s4o.print(")"); |
|
7091 IN_param_value->accept(*this); |
|
7092 return NULL; |
|
7093 |
|
7094 } |
|
7095 |
|
7096 ERROR; |
|
7097 } |
|
7098 |
|
7099 }/*function_lreal_to_lint*/ |
|
7100 break; |
|
7101 |
|
7102 /**** |
|
7103 *LREAL_TO_USINT |
|
7104 */ |
|
7105 case function_lreal_to_usint : |
|
7106 { |
|
7107 symbol_c *last_type_symbol = NULL; |
|
7108 |
|
7109 { |
|
7110 identifier_c param_name("IN"); |
|
7111 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7112 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7113 |
|
7114 /* Get the value from a foo(<param_value>) style call */ |
|
7115 if (IN_param_value == NULL) |
|
7116 IN_param_value = function_call_param_iterator.next(); |
|
7117 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7118 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7119 |
|
7120 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7121 { |
|
7122 |
|
7123 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
7124 s4o.print("("); |
|
7125 return_type_symbol->accept(*this); |
|
7126 s4o.print(")"); |
|
7127 IN_param_value->accept(*this); |
|
7128 return NULL; |
|
7129 |
|
7130 } |
|
7131 |
|
7132 ERROR; |
|
7133 } |
|
7134 |
|
7135 }/*function_lreal_to_usint*/ |
|
7136 break; |
|
7137 |
|
7138 /**** |
|
7139 *LREAL_TO_UINT |
|
7140 */ |
|
7141 case function_lreal_to_uint : |
|
7142 { |
|
7143 symbol_c *last_type_symbol = NULL; |
|
7144 |
|
7145 { |
|
7146 identifier_c param_name("IN"); |
|
7147 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7148 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7149 |
|
7150 /* Get the value from a foo(<param_value>) style call */ |
|
7151 if (IN_param_value == NULL) |
|
7152 IN_param_value = function_call_param_iterator.next(); |
|
7153 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7154 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7155 |
|
7156 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7157 { |
|
7158 |
|
7159 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
7160 s4o.print("("); |
|
7161 return_type_symbol->accept(*this); |
|
7162 s4o.print(")"); |
|
7163 IN_param_value->accept(*this); |
|
7164 return NULL; |
|
7165 |
|
7166 } |
|
7167 |
|
7168 ERROR; |
|
7169 } |
|
7170 |
|
7171 }/*function_lreal_to_uint*/ |
|
7172 break; |
|
7173 |
|
7174 /**** |
|
7175 *LREAL_TO_UDINT |
|
7176 */ |
|
7177 case function_lreal_to_udint : |
|
7178 { |
|
7179 symbol_c *last_type_symbol = NULL; |
|
7180 |
|
7181 { |
|
7182 identifier_c param_name("IN"); |
|
7183 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7184 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7185 |
|
7186 /* Get the value from a foo(<param_value>) style call */ |
|
7187 if (IN_param_value == NULL) |
|
7188 IN_param_value = function_call_param_iterator.next(); |
|
7189 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7190 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7191 |
|
7192 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7193 { |
|
7194 |
|
7195 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
7196 s4o.print("("); |
|
7197 return_type_symbol->accept(*this); |
|
7198 s4o.print(")"); |
|
7199 IN_param_value->accept(*this); |
|
7200 return NULL; |
|
7201 |
|
7202 } |
|
7203 |
|
7204 ERROR; |
|
7205 } |
|
7206 |
|
7207 }/*function_lreal_to_udint*/ |
|
7208 break; |
|
7209 |
|
7210 /**** |
|
7211 *LREAL_TO_ULINT |
|
7212 */ |
|
7213 case function_lreal_to_ulint : |
|
7214 { |
|
7215 symbol_c *last_type_symbol = NULL; |
|
7216 |
|
7217 { |
|
7218 identifier_c param_name("IN"); |
|
7219 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7220 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7221 |
|
7222 /* Get the value from a foo(<param_value>) style call */ |
|
7223 if (IN_param_value == NULL) |
|
7224 IN_param_value = function_call_param_iterator.next(); |
|
7225 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7226 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7227 |
|
7228 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7229 { |
|
7230 |
|
7231 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
7232 s4o.print("("); |
|
7233 return_type_symbol->accept(*this); |
|
7234 s4o.print(")"); |
|
7235 IN_param_value->accept(*this); |
|
7236 return NULL; |
|
7237 |
|
7238 } |
|
7239 |
|
7240 ERROR; |
|
7241 } |
|
7242 |
|
7243 }/*function_lreal_to_ulint*/ |
|
7244 break; |
|
7245 |
|
7246 /**** |
|
7247 *LREAL_TO_REAL |
|
7248 */ |
|
7249 case function_lreal_to_real : |
|
7250 { |
|
7251 symbol_c *last_type_symbol = NULL; |
|
7252 |
|
7253 { |
|
7254 identifier_c param_name("IN"); |
|
7255 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7256 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7257 |
|
7258 /* Get the value from a foo(<param_value>) style call */ |
|
7259 if (IN_param_value == NULL) |
|
7260 IN_param_value = function_call_param_iterator.next(); |
|
7261 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7262 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7263 |
|
7264 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7265 { |
|
7266 |
|
7267 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
7268 s4o.print("("); |
|
7269 return_type_symbol->accept(*this); |
|
7270 s4o.print(")"); |
|
7271 IN_param_value->accept(*this); |
|
7272 return NULL; |
|
7273 |
|
7274 } |
|
7275 |
|
7276 ERROR; |
|
7277 } |
|
7278 |
|
7279 }/*function_lreal_to_real*/ |
|
7280 break; |
|
7281 |
|
7282 /**** |
|
7283 *LREAL_TO_TIME |
|
7284 */ |
|
7285 case function_lreal_to_time : |
|
7286 { |
|
7287 symbol_c *last_type_symbol = NULL; |
|
7288 |
|
7289 { |
|
7290 identifier_c param_name("IN"); |
|
7291 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7292 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7293 |
|
7294 /* Get the value from a foo(<param_value>) style call */ |
|
7295 if (IN_param_value == NULL) |
|
7296 IN_param_value = function_call_param_iterator.next(); |
|
7297 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7298 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7299 |
|
7300 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7301 { |
|
7302 |
|
7303 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
7304 s4o.print("("); |
|
7305 return_type_symbol->accept(*this); |
|
7306 s4o.print(")__real_to_time("); |
|
7307 IN_param_value->accept(*this); |
|
7308 s4o.print(")"); |
|
7309 return NULL; |
|
7310 |
|
7311 } |
|
7312 |
|
7313 ERROR; |
|
7314 } |
|
7315 |
|
7316 }/*function_lreal_to_time*/ |
|
7317 break; |
|
7318 |
|
7319 /**** |
|
7320 *LREAL_TO_DATE |
|
7321 */ |
|
7322 case function_lreal_to_date : |
|
7323 { |
|
7324 symbol_c *last_type_symbol = NULL; |
|
7325 |
|
7326 { |
|
7327 identifier_c param_name("IN"); |
|
7328 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7329 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7330 |
|
7331 /* Get the value from a foo(<param_value>) style call */ |
|
7332 if (IN_param_value == NULL) |
|
7333 IN_param_value = function_call_param_iterator.next(); |
|
7334 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7335 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7336 |
|
7337 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7338 { |
|
7339 |
|
7340 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
7341 s4o.print("("); |
|
7342 return_type_symbol->accept(*this); |
|
7343 s4o.print(")__real_to_time("); |
|
7344 IN_param_value->accept(*this); |
|
7345 s4o.print(")"); |
|
7346 return NULL; |
|
7347 |
|
7348 } |
|
7349 |
|
7350 ERROR; |
|
7351 } |
|
7352 |
|
7353 }/*function_lreal_to_date*/ |
|
7354 break; |
|
7355 |
|
7356 /**** |
|
7357 *LREAL_TO_TOD |
|
7358 */ |
|
7359 case function_lreal_to_tod : |
|
7360 { |
|
7361 symbol_c *last_type_symbol = NULL; |
|
7362 |
|
7363 { |
|
7364 identifier_c param_name("IN"); |
|
7365 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7366 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7367 |
|
7368 /* Get the value from a foo(<param_value>) style call */ |
|
7369 if (IN_param_value == NULL) |
|
7370 IN_param_value = function_call_param_iterator.next(); |
|
7371 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7372 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7373 |
|
7374 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7375 { |
|
7376 |
|
7377 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
7378 s4o.print("("); |
|
7379 return_type_symbol->accept(*this); |
|
7380 s4o.print(")__real_to_time("); |
|
7381 IN_param_value->accept(*this); |
|
7382 s4o.print(")"); |
|
7383 return NULL; |
|
7384 |
|
7385 } |
|
7386 |
|
7387 ERROR; |
|
7388 } |
|
7389 |
|
7390 }/*function_lreal_to_tod*/ |
|
7391 break; |
|
7392 |
|
7393 /**** |
|
7394 *LREAL_TO_DT |
|
7395 */ |
|
7396 case function_lreal_to_dt : |
|
7397 { |
|
7398 symbol_c *last_type_symbol = NULL; |
|
7399 |
|
7400 { |
|
7401 identifier_c param_name("IN"); |
|
7402 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7403 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7404 |
|
7405 /* Get the value from a foo(<param_value>) style call */ |
|
7406 if (IN_param_value == NULL) |
|
7407 IN_param_value = function_call_param_iterator.next(); |
|
7408 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7409 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7410 |
|
7411 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7412 { |
|
7413 |
|
7414 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
7415 s4o.print("("); |
|
7416 return_type_symbol->accept(*this); |
|
7417 s4o.print(")__real_to_time("); |
|
7418 IN_param_value->accept(*this); |
|
7419 s4o.print(")"); |
|
7420 return NULL; |
|
7421 |
|
7422 } |
|
7423 |
|
7424 ERROR; |
|
7425 } |
|
7426 |
|
7427 }/*function_lreal_to_dt*/ |
|
7428 break; |
|
7429 |
|
7430 /**** |
|
7431 *LREAL_TO_STRING |
|
7432 */ |
|
7433 case function_lreal_to_string : |
|
7434 { |
|
7435 symbol_c *last_type_symbol = NULL; |
|
7436 |
|
7437 { |
|
7438 identifier_c param_name("IN"); |
|
7439 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7440 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7441 |
|
7442 /* Get the value from a foo(<param_value>) style call */ |
|
7443 if (IN_param_value == NULL) |
|
7444 IN_param_value = function_call_param_iterator.next(); |
|
7445 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7446 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7447 |
|
7448 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7449 { |
|
7450 |
|
7451 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
7452 s4o.print("("); |
|
7453 return_type_symbol->accept(*this); |
|
7454 s4o.print(")__real_to_string("); |
|
7455 IN_param_value->accept(*this); |
|
7456 s4o.print(")"); |
|
7457 return NULL; |
|
7458 |
|
7459 } |
|
7460 |
|
7461 ERROR; |
|
7462 } |
|
7463 |
|
7464 }/*function_lreal_to_string*/ |
|
7465 break; |
|
7466 |
|
7467 /**** |
|
7468 *LREAL_TO_BYTE |
|
7469 */ |
|
7470 case function_lreal_to_byte : |
|
7471 { |
|
7472 symbol_c *last_type_symbol = NULL; |
|
7473 |
|
7474 { |
|
7475 identifier_c param_name("IN"); |
|
7476 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7477 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7478 |
|
7479 /* Get the value from a foo(<param_value>) style call */ |
|
7480 if (IN_param_value == NULL) |
|
7481 IN_param_value = function_call_param_iterator.next(); |
|
7482 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7483 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7484 |
|
7485 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7486 { |
|
7487 |
|
7488 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
7489 s4o.print("("); |
|
7490 return_type_symbol->accept(*this); |
|
7491 s4o.print(")"); |
|
7492 IN_param_value->accept(*this); |
|
7493 return NULL; |
|
7494 |
|
7495 } |
|
7496 |
|
7497 ERROR; |
|
7498 } |
|
7499 |
|
7500 }/*function_lreal_to_byte*/ |
|
7501 break; |
|
7502 |
|
7503 /**** |
|
7504 *LREAL_TO_WORD |
|
7505 */ |
|
7506 case function_lreal_to_word : |
|
7507 { |
|
7508 symbol_c *last_type_symbol = NULL; |
|
7509 |
|
7510 { |
|
7511 identifier_c param_name("IN"); |
|
7512 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7513 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7514 |
|
7515 /* Get the value from a foo(<param_value>) style call */ |
|
7516 if (IN_param_value == NULL) |
|
7517 IN_param_value = function_call_param_iterator.next(); |
|
7518 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7519 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7520 |
|
7521 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7522 { |
|
7523 |
|
7524 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
7525 s4o.print("("); |
|
7526 return_type_symbol->accept(*this); |
|
7527 s4o.print(")"); |
|
7528 IN_param_value->accept(*this); |
|
7529 return NULL; |
|
7530 |
|
7531 } |
|
7532 |
|
7533 ERROR; |
|
7534 } |
|
7535 |
|
7536 }/*function_lreal_to_word*/ |
|
7537 break; |
|
7538 |
|
7539 /**** |
|
7540 *LREAL_TO_DWORD |
|
7541 */ |
|
7542 case function_lreal_to_dword : |
|
7543 { |
|
7544 symbol_c *last_type_symbol = NULL; |
|
7545 |
|
7546 { |
|
7547 identifier_c param_name("IN"); |
|
7548 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7549 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7550 |
|
7551 /* Get the value from a foo(<param_value>) style call */ |
|
7552 if (IN_param_value == NULL) |
|
7553 IN_param_value = function_call_param_iterator.next(); |
|
7554 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7555 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7556 |
|
7557 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7558 { |
|
7559 |
|
7560 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
7561 s4o.print("("); |
|
7562 return_type_symbol->accept(*this); |
|
7563 s4o.print(")"); |
|
7564 IN_param_value->accept(*this); |
|
7565 return NULL; |
|
7566 |
|
7567 } |
|
7568 |
|
7569 ERROR; |
|
7570 } |
|
7571 |
|
7572 }/*function_lreal_to_dword*/ |
|
7573 break; |
|
7574 |
|
7575 /**** |
|
7576 *LREAL_TO_LWORD |
|
7577 */ |
|
7578 case function_lreal_to_lword : |
|
7579 { |
|
7580 symbol_c *last_type_symbol = NULL; |
|
7581 |
|
7582 { |
|
7583 identifier_c param_name("IN"); |
|
7584 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7585 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7586 |
|
7587 /* Get the value from a foo(<param_value>) style call */ |
|
7588 if (IN_param_value == NULL) |
|
7589 IN_param_value = function_call_param_iterator.next(); |
|
7590 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7591 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7592 |
|
7593 if(search_expression_type->is_same_type(&search_constant_type_c::lreal_type_name, last_type_symbol)) |
|
7594 { |
|
7595 |
|
7596 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
7597 s4o.print("("); |
|
7598 return_type_symbol->accept(*this); |
|
7599 s4o.print(")"); |
|
7600 IN_param_value->accept(*this); |
|
7601 return NULL; |
|
7602 |
|
7603 } |
|
7604 |
|
7605 ERROR; |
|
7606 } |
|
7607 |
|
7608 }/*function_lreal_to_lword*/ |
|
7609 break; |
|
7610 |
|
7611 /**** |
|
7612 *TIME_TO_SINT |
|
7613 */ |
|
7614 case function_time_to_sint : |
|
7615 { |
|
7616 symbol_c *last_type_symbol = NULL; |
|
7617 |
|
7618 { |
|
7619 identifier_c param_name("IN"); |
|
7620 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7621 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7622 |
|
7623 /* Get the value from a foo(<param_value>) style call */ |
|
7624 if (IN_param_value == NULL) |
|
7625 IN_param_value = function_call_param_iterator.next(); |
|
7626 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7627 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7628 |
|
7629 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7630 { |
|
7631 |
|
7632 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
7633 s4o.print("("); |
|
7634 return_type_symbol->accept(*this); |
|
7635 s4o.print(")__time_to_int("); |
|
7636 IN_param_value->accept(*this); |
|
7637 s4o.print(")"); |
|
7638 return NULL; |
|
7639 |
|
7640 } |
|
7641 |
|
7642 ERROR; |
|
7643 } |
|
7644 |
|
7645 }/*function_time_to_sint*/ |
|
7646 break; |
|
7647 |
|
7648 /**** |
|
7649 *TIME_TO_INT |
|
7650 */ |
|
7651 case function_time_to_int : |
|
7652 { |
|
7653 symbol_c *last_type_symbol = NULL; |
|
7654 |
|
7655 { |
|
7656 identifier_c param_name("IN"); |
|
7657 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7658 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7659 |
|
7660 /* Get the value from a foo(<param_value>) style call */ |
|
7661 if (IN_param_value == NULL) |
|
7662 IN_param_value = function_call_param_iterator.next(); |
|
7663 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7664 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7665 |
|
7666 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7667 { |
|
7668 |
|
7669 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
7670 s4o.print("("); |
|
7671 return_type_symbol->accept(*this); |
|
7672 s4o.print(")__time_to_int("); |
|
7673 IN_param_value->accept(*this); |
|
7674 s4o.print(")"); |
|
7675 return NULL; |
|
7676 |
|
7677 } |
|
7678 |
|
7679 ERROR; |
|
7680 } |
|
7681 |
|
7682 }/*function_time_to_int*/ |
|
7683 break; |
|
7684 |
|
7685 /**** |
|
7686 *TIME_TO_DINT |
|
7687 */ |
|
7688 case function_time_to_dint : |
|
7689 { |
|
7690 symbol_c *last_type_symbol = NULL; |
|
7691 |
|
7692 { |
|
7693 identifier_c param_name("IN"); |
|
7694 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7695 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7696 |
|
7697 /* Get the value from a foo(<param_value>) style call */ |
|
7698 if (IN_param_value == NULL) |
|
7699 IN_param_value = function_call_param_iterator.next(); |
|
7700 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7701 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7702 |
|
7703 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7704 { |
|
7705 |
|
7706 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
7707 s4o.print("("); |
|
7708 return_type_symbol->accept(*this); |
|
7709 s4o.print(")__time_to_int("); |
|
7710 IN_param_value->accept(*this); |
|
7711 s4o.print(")"); |
|
7712 return NULL; |
|
7713 |
|
7714 } |
|
7715 |
|
7716 ERROR; |
|
7717 } |
|
7718 |
|
7719 }/*function_time_to_dint*/ |
|
7720 break; |
|
7721 |
|
7722 /**** |
|
7723 *TIME_TO_LINT |
|
7724 */ |
|
7725 case function_time_to_lint : |
|
7726 { |
|
7727 symbol_c *last_type_symbol = NULL; |
|
7728 |
|
7729 { |
|
7730 identifier_c param_name("IN"); |
|
7731 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7732 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7733 |
|
7734 /* Get the value from a foo(<param_value>) style call */ |
|
7735 if (IN_param_value == NULL) |
|
7736 IN_param_value = function_call_param_iterator.next(); |
|
7737 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7738 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7739 |
|
7740 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7741 { |
|
7742 |
|
7743 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
7744 s4o.print("("); |
|
7745 return_type_symbol->accept(*this); |
|
7746 s4o.print(")__time_to_int("); |
|
7747 IN_param_value->accept(*this); |
|
7748 s4o.print(")"); |
|
7749 return NULL; |
|
7750 |
|
7751 } |
|
7752 |
|
7753 ERROR; |
|
7754 } |
|
7755 |
|
7756 }/*function_time_to_lint*/ |
|
7757 break; |
|
7758 |
|
7759 /**** |
|
7760 *TIME_TO_USINT |
|
7761 */ |
|
7762 case function_time_to_usint : |
|
7763 { |
|
7764 symbol_c *last_type_symbol = NULL; |
|
7765 |
|
7766 { |
|
7767 identifier_c param_name("IN"); |
|
7768 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7769 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7770 |
|
7771 /* Get the value from a foo(<param_value>) style call */ |
|
7772 if (IN_param_value == NULL) |
|
7773 IN_param_value = function_call_param_iterator.next(); |
|
7774 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7775 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7776 |
|
7777 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7778 { |
|
7779 |
|
7780 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
7781 s4o.print("("); |
|
7782 return_type_symbol->accept(*this); |
|
7783 s4o.print(")__time_to_int("); |
|
7784 IN_param_value->accept(*this); |
|
7785 s4o.print(")"); |
|
7786 return NULL; |
|
7787 |
|
7788 } |
|
7789 |
|
7790 ERROR; |
|
7791 } |
|
7792 |
|
7793 }/*function_time_to_usint*/ |
|
7794 break; |
|
7795 |
|
7796 /**** |
|
7797 *TIME_TO_UINT |
|
7798 */ |
|
7799 case function_time_to_uint : |
|
7800 { |
|
7801 symbol_c *last_type_symbol = NULL; |
|
7802 |
|
7803 { |
|
7804 identifier_c param_name("IN"); |
|
7805 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7806 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7807 |
|
7808 /* Get the value from a foo(<param_value>) style call */ |
|
7809 if (IN_param_value == NULL) |
|
7810 IN_param_value = function_call_param_iterator.next(); |
|
7811 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7812 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7813 |
|
7814 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7815 { |
|
7816 |
|
7817 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
7818 s4o.print("("); |
|
7819 return_type_symbol->accept(*this); |
|
7820 s4o.print(")__time_to_int("); |
|
7821 IN_param_value->accept(*this); |
|
7822 s4o.print(")"); |
|
7823 return NULL; |
|
7824 |
|
7825 } |
|
7826 |
|
7827 ERROR; |
|
7828 } |
|
7829 |
|
7830 }/*function_time_to_uint*/ |
|
7831 break; |
|
7832 |
|
7833 /**** |
|
7834 *TIME_TO_UDINT |
|
7835 */ |
|
7836 case function_time_to_udint : |
|
7837 { |
|
7838 symbol_c *last_type_symbol = NULL; |
|
7839 |
|
7840 { |
|
7841 identifier_c param_name("IN"); |
|
7842 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7843 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7844 |
|
7845 /* Get the value from a foo(<param_value>) style call */ |
|
7846 if (IN_param_value == NULL) |
|
7847 IN_param_value = function_call_param_iterator.next(); |
|
7848 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7849 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7850 |
|
7851 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7852 { |
|
7853 |
|
7854 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
7855 s4o.print("("); |
|
7856 return_type_symbol->accept(*this); |
|
7857 s4o.print(")__time_to_int("); |
|
7858 IN_param_value->accept(*this); |
|
7859 s4o.print(")"); |
|
7860 return NULL; |
|
7861 |
|
7862 } |
|
7863 |
|
7864 ERROR; |
|
7865 } |
|
7866 |
|
7867 }/*function_time_to_udint*/ |
|
7868 break; |
|
7869 |
|
7870 /**** |
|
7871 *TIME_TO_ULINT |
|
7872 */ |
|
7873 case function_time_to_ulint : |
|
7874 { |
|
7875 symbol_c *last_type_symbol = NULL; |
|
7876 |
|
7877 { |
|
7878 identifier_c param_name("IN"); |
|
7879 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7880 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7881 |
|
7882 /* Get the value from a foo(<param_value>) style call */ |
|
7883 if (IN_param_value == NULL) |
|
7884 IN_param_value = function_call_param_iterator.next(); |
|
7885 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7886 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7887 |
|
7888 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7889 { |
|
7890 |
|
7891 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
7892 s4o.print("("); |
|
7893 return_type_symbol->accept(*this); |
|
7894 s4o.print(")__time_to_int("); |
|
7895 IN_param_value->accept(*this); |
|
7896 s4o.print(")"); |
|
7897 return NULL; |
|
7898 |
|
7899 } |
|
7900 |
|
7901 ERROR; |
|
7902 } |
|
7903 |
|
7904 }/*function_time_to_ulint*/ |
|
7905 break; |
|
7906 |
|
7907 /**** |
|
7908 *TIME_TO_REAL |
|
7909 */ |
|
7910 case function_time_to_real : |
|
7911 { |
|
7912 symbol_c *last_type_symbol = NULL; |
|
7913 |
|
7914 { |
|
7915 identifier_c param_name("IN"); |
|
7916 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7917 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7918 |
|
7919 /* Get the value from a foo(<param_value>) style call */ |
|
7920 if (IN_param_value == NULL) |
|
7921 IN_param_value = function_call_param_iterator.next(); |
|
7922 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7923 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7924 |
|
7925 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7926 { |
|
7927 |
|
7928 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
7929 s4o.print("("); |
|
7930 return_type_symbol->accept(*this); |
|
7931 s4o.print(")__time_to_real("); |
|
7932 IN_param_value->accept(*this); |
|
7933 s4o.print(")"); |
|
7934 return NULL; |
|
7935 |
|
7936 } |
|
7937 |
|
7938 ERROR; |
|
7939 } |
|
7940 |
|
7941 }/*function_time_to_real*/ |
|
7942 break; |
|
7943 |
|
7944 /**** |
|
7945 *TIME_TO_LREAL |
|
7946 */ |
|
7947 case function_time_to_lreal : |
|
7948 { |
|
7949 symbol_c *last_type_symbol = NULL; |
|
7950 |
|
7951 { |
|
7952 identifier_c param_name("IN"); |
|
7953 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7954 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7955 |
|
7956 /* Get the value from a foo(<param_value>) style call */ |
|
7957 if (IN_param_value == NULL) |
|
7958 IN_param_value = function_call_param_iterator.next(); |
|
7959 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7960 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7961 |
|
7962 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
7963 { |
|
7964 |
|
7965 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
7966 s4o.print("("); |
|
7967 return_type_symbol->accept(*this); |
|
7968 s4o.print(")__time_to_real("); |
|
7969 IN_param_value->accept(*this); |
|
7970 s4o.print(")"); |
|
7971 return NULL; |
|
7972 |
|
7973 } |
|
7974 |
|
7975 ERROR; |
|
7976 } |
|
7977 |
|
7978 }/*function_time_to_lreal*/ |
|
7979 break; |
|
7980 |
|
7981 /**** |
|
7982 *TIME_TO_STRING |
|
7983 */ |
|
7984 case function_time_to_string : |
|
7985 { |
|
7986 symbol_c *last_type_symbol = NULL; |
|
7987 |
|
7988 { |
|
7989 identifier_c param_name("IN"); |
|
7990 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
7991 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
7992 |
|
7993 /* Get the value from a foo(<param_value>) style call */ |
|
7994 if (IN_param_value == NULL) |
|
7995 IN_param_value = function_call_param_iterator.next(); |
|
7996 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
7997 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
7998 |
|
7999 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
8000 { |
|
8001 |
|
8002 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
8003 s4o.print("("); |
|
8004 return_type_symbol->accept(*this); |
|
8005 s4o.print(")__time_to_string("); |
|
8006 IN_param_value->accept(*this); |
|
8007 s4o.print(")"); |
|
8008 return NULL; |
|
8009 |
|
8010 } |
|
8011 |
|
8012 ERROR; |
|
8013 } |
|
8014 |
|
8015 }/*function_time_to_string*/ |
|
8016 break; |
|
8017 |
|
8018 /**** |
|
8019 *TIME_TO_BYTE |
|
8020 */ |
|
8021 case function_time_to_byte : |
|
8022 { |
|
8023 symbol_c *last_type_symbol = NULL; |
|
8024 |
|
8025 { |
|
8026 identifier_c param_name("IN"); |
|
8027 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8028 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8029 |
|
8030 /* Get the value from a foo(<param_value>) style call */ |
|
8031 if (IN_param_value == NULL) |
|
8032 IN_param_value = function_call_param_iterator.next(); |
|
8033 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8034 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8035 |
|
8036 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
8037 { |
|
8038 |
|
8039 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
8040 s4o.print("("); |
|
8041 return_type_symbol->accept(*this); |
|
8042 s4o.print(")__time_to_int("); |
|
8043 IN_param_value->accept(*this); |
|
8044 s4o.print(")"); |
|
8045 return NULL; |
|
8046 |
|
8047 } |
|
8048 |
|
8049 ERROR; |
|
8050 } |
|
8051 |
|
8052 }/*function_time_to_byte*/ |
|
8053 break; |
|
8054 |
|
8055 /**** |
|
8056 *TIME_TO_WORD |
|
8057 */ |
|
8058 case function_time_to_word : |
|
8059 { |
|
8060 symbol_c *last_type_symbol = NULL; |
|
8061 |
|
8062 { |
|
8063 identifier_c param_name("IN"); |
|
8064 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8065 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8066 |
|
8067 /* Get the value from a foo(<param_value>) style call */ |
|
8068 if (IN_param_value == NULL) |
|
8069 IN_param_value = function_call_param_iterator.next(); |
|
8070 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8071 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8072 |
|
8073 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
8074 { |
|
8075 |
|
8076 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
8077 s4o.print("("); |
|
8078 return_type_symbol->accept(*this); |
|
8079 s4o.print(")__time_to_int("); |
|
8080 IN_param_value->accept(*this); |
|
8081 s4o.print(")"); |
|
8082 return NULL; |
|
8083 |
|
8084 } |
|
8085 |
|
8086 ERROR; |
|
8087 } |
|
8088 |
|
8089 }/*function_time_to_word*/ |
|
8090 break; |
|
8091 |
|
8092 /**** |
|
8093 *TIME_TO_DWORD |
|
8094 */ |
|
8095 case function_time_to_dword : |
|
8096 { |
|
8097 symbol_c *last_type_symbol = NULL; |
|
8098 |
|
8099 { |
|
8100 identifier_c param_name("IN"); |
|
8101 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8102 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8103 |
|
8104 /* Get the value from a foo(<param_value>) style call */ |
|
8105 if (IN_param_value == NULL) |
|
8106 IN_param_value = function_call_param_iterator.next(); |
|
8107 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8108 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8109 |
|
8110 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
8111 { |
|
8112 |
|
8113 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
8114 s4o.print("("); |
|
8115 return_type_symbol->accept(*this); |
|
8116 s4o.print(")__time_to_int("); |
|
8117 IN_param_value->accept(*this); |
|
8118 s4o.print(")"); |
|
8119 return NULL; |
|
8120 |
|
8121 } |
|
8122 |
|
8123 ERROR; |
|
8124 } |
|
8125 |
|
8126 }/*function_time_to_dword*/ |
|
8127 break; |
|
8128 |
|
8129 /**** |
|
8130 *TIME_TO_LWORD |
|
8131 */ |
|
8132 case function_time_to_lword : |
|
8133 { |
|
8134 symbol_c *last_type_symbol = NULL; |
|
8135 |
|
8136 { |
|
8137 identifier_c param_name("IN"); |
|
8138 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8139 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8140 |
|
8141 /* Get the value from a foo(<param_value>) style call */ |
|
8142 if (IN_param_value == NULL) |
|
8143 IN_param_value = function_call_param_iterator.next(); |
|
8144 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8145 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8146 |
|
8147 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
8148 { |
|
8149 |
|
8150 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
8151 s4o.print("("); |
|
8152 return_type_symbol->accept(*this); |
|
8153 s4o.print(")__time_to_int("); |
|
8154 IN_param_value->accept(*this); |
|
8155 s4o.print(")"); |
|
8156 return NULL; |
|
8157 |
|
8158 } |
|
8159 |
|
8160 ERROR; |
|
8161 } |
|
8162 |
|
8163 }/*function_time_to_lword*/ |
|
8164 break; |
|
8165 |
|
8166 /**** |
|
8167 *DATE_TO_SINT |
|
8168 */ |
|
8169 case function_date_to_sint : |
|
8170 { |
|
8171 symbol_c *last_type_symbol = NULL; |
|
8172 |
|
8173 { |
|
8174 identifier_c param_name("IN"); |
|
8175 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8176 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8177 |
|
8178 /* Get the value from a foo(<param_value>) style call */ |
|
8179 if (IN_param_value == NULL) |
|
8180 IN_param_value = function_call_param_iterator.next(); |
|
8181 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8182 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8183 |
|
8184 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8185 { |
|
8186 |
|
8187 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
8188 s4o.print("("); |
|
8189 return_type_symbol->accept(*this); |
|
8190 s4o.print(")__time_to_int("); |
|
8191 IN_param_value->accept(*this); |
|
8192 s4o.print(")"); |
|
8193 return NULL; |
|
8194 |
|
8195 } |
|
8196 |
|
8197 ERROR; |
|
8198 } |
|
8199 |
|
8200 }/*function_date_to_sint*/ |
|
8201 break; |
|
8202 |
|
8203 /**** |
|
8204 *DATE_TO_INT |
|
8205 */ |
|
8206 case function_date_to_int : |
|
8207 { |
|
8208 symbol_c *last_type_symbol = NULL; |
|
8209 |
|
8210 { |
|
8211 identifier_c param_name("IN"); |
|
8212 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8213 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8214 |
|
8215 /* Get the value from a foo(<param_value>) style call */ |
|
8216 if (IN_param_value == NULL) |
|
8217 IN_param_value = function_call_param_iterator.next(); |
|
8218 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8219 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8220 |
|
8221 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8222 { |
|
8223 |
|
8224 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
8225 s4o.print("("); |
|
8226 return_type_symbol->accept(*this); |
|
8227 s4o.print(")__time_to_int("); |
|
8228 IN_param_value->accept(*this); |
|
8229 s4o.print(")"); |
|
8230 return NULL; |
|
8231 |
|
8232 } |
|
8233 |
|
8234 ERROR; |
|
8235 } |
|
8236 |
|
8237 }/*function_date_to_int*/ |
|
8238 break; |
|
8239 |
|
8240 /**** |
|
8241 *DATE_TO_DINT |
|
8242 */ |
|
8243 case function_date_to_dint : |
|
8244 { |
|
8245 symbol_c *last_type_symbol = NULL; |
|
8246 |
|
8247 { |
|
8248 identifier_c param_name("IN"); |
|
8249 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8250 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8251 |
|
8252 /* Get the value from a foo(<param_value>) style call */ |
|
8253 if (IN_param_value == NULL) |
|
8254 IN_param_value = function_call_param_iterator.next(); |
|
8255 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8256 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8257 |
|
8258 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8259 { |
|
8260 |
|
8261 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
8262 s4o.print("("); |
|
8263 return_type_symbol->accept(*this); |
|
8264 s4o.print(")__time_to_int("); |
|
8265 IN_param_value->accept(*this); |
|
8266 s4o.print(")"); |
|
8267 return NULL; |
|
8268 |
|
8269 } |
|
8270 |
|
8271 ERROR; |
|
8272 } |
|
8273 |
|
8274 }/*function_date_to_dint*/ |
|
8275 break; |
|
8276 |
|
8277 /**** |
|
8278 *DATE_TO_LINT |
|
8279 */ |
|
8280 case function_date_to_lint : |
|
8281 { |
|
8282 symbol_c *last_type_symbol = NULL; |
|
8283 |
|
8284 { |
|
8285 identifier_c param_name("IN"); |
|
8286 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8287 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8288 |
|
8289 /* Get the value from a foo(<param_value>) style call */ |
|
8290 if (IN_param_value == NULL) |
|
8291 IN_param_value = function_call_param_iterator.next(); |
|
8292 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8293 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8294 |
|
8295 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8296 { |
|
8297 |
|
8298 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
8299 s4o.print("("); |
|
8300 return_type_symbol->accept(*this); |
|
8301 s4o.print(")__time_to_int("); |
|
8302 IN_param_value->accept(*this); |
|
8303 s4o.print(")"); |
|
8304 return NULL; |
|
8305 |
|
8306 } |
|
8307 |
|
8308 ERROR; |
|
8309 } |
|
8310 |
|
8311 }/*function_date_to_lint*/ |
|
8312 break; |
|
8313 |
|
8314 /**** |
|
8315 *DATE_TO_USINT |
|
8316 */ |
|
8317 case function_date_to_usint : |
|
8318 { |
|
8319 symbol_c *last_type_symbol = NULL; |
|
8320 |
|
8321 { |
|
8322 identifier_c param_name("IN"); |
|
8323 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8324 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8325 |
|
8326 /* Get the value from a foo(<param_value>) style call */ |
|
8327 if (IN_param_value == NULL) |
|
8328 IN_param_value = function_call_param_iterator.next(); |
|
8329 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8330 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8331 |
|
8332 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8333 { |
|
8334 |
|
8335 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
8336 s4o.print("("); |
|
8337 return_type_symbol->accept(*this); |
|
8338 s4o.print(")__time_to_int("); |
|
8339 IN_param_value->accept(*this); |
|
8340 s4o.print(")"); |
|
8341 return NULL; |
|
8342 |
|
8343 } |
|
8344 |
|
8345 ERROR; |
|
8346 } |
|
8347 |
|
8348 }/*function_date_to_usint*/ |
|
8349 break; |
|
8350 |
|
8351 /**** |
|
8352 *DATE_TO_UINT |
|
8353 */ |
|
8354 case function_date_to_uint : |
|
8355 { |
|
8356 symbol_c *last_type_symbol = NULL; |
|
8357 |
|
8358 { |
|
8359 identifier_c param_name("IN"); |
|
8360 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8361 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8362 |
|
8363 /* Get the value from a foo(<param_value>) style call */ |
|
8364 if (IN_param_value == NULL) |
|
8365 IN_param_value = function_call_param_iterator.next(); |
|
8366 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8367 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8368 |
|
8369 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8370 { |
|
8371 |
|
8372 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
8373 s4o.print("("); |
|
8374 return_type_symbol->accept(*this); |
|
8375 s4o.print(")__time_to_int("); |
|
8376 IN_param_value->accept(*this); |
|
8377 s4o.print(")"); |
|
8378 return NULL; |
|
8379 |
|
8380 } |
|
8381 |
|
8382 ERROR; |
|
8383 } |
|
8384 |
|
8385 }/*function_date_to_uint*/ |
|
8386 break; |
|
8387 |
|
8388 /**** |
|
8389 *DATE_TO_UDINT |
|
8390 */ |
|
8391 case function_date_to_udint : |
|
8392 { |
|
8393 symbol_c *last_type_symbol = NULL; |
|
8394 |
|
8395 { |
|
8396 identifier_c param_name("IN"); |
|
8397 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8398 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8399 |
|
8400 /* Get the value from a foo(<param_value>) style call */ |
|
8401 if (IN_param_value == NULL) |
|
8402 IN_param_value = function_call_param_iterator.next(); |
|
8403 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8404 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8405 |
|
8406 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8407 { |
|
8408 |
|
8409 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
8410 s4o.print("("); |
|
8411 return_type_symbol->accept(*this); |
|
8412 s4o.print(")__time_to_int("); |
|
8413 IN_param_value->accept(*this); |
|
8414 s4o.print(")"); |
|
8415 return NULL; |
|
8416 |
|
8417 } |
|
8418 |
|
8419 ERROR; |
|
8420 } |
|
8421 |
|
8422 }/*function_date_to_udint*/ |
|
8423 break; |
|
8424 |
|
8425 /**** |
|
8426 *DATE_TO_ULINT |
|
8427 */ |
|
8428 case function_date_to_ulint : |
|
8429 { |
|
8430 symbol_c *last_type_symbol = NULL; |
|
8431 |
|
8432 { |
|
8433 identifier_c param_name("IN"); |
|
8434 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8435 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8436 |
|
8437 /* Get the value from a foo(<param_value>) style call */ |
|
8438 if (IN_param_value == NULL) |
|
8439 IN_param_value = function_call_param_iterator.next(); |
|
8440 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8441 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8442 |
|
8443 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8444 { |
|
8445 |
|
8446 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
8447 s4o.print("("); |
|
8448 return_type_symbol->accept(*this); |
|
8449 s4o.print(")__time_to_int("); |
|
8450 IN_param_value->accept(*this); |
|
8451 s4o.print(")"); |
|
8452 return NULL; |
|
8453 |
|
8454 } |
|
8455 |
|
8456 ERROR; |
|
8457 } |
|
8458 |
|
8459 }/*function_date_to_ulint*/ |
|
8460 break; |
|
8461 |
|
8462 /**** |
|
8463 *DATE_TO_REAL |
|
8464 */ |
|
8465 case function_date_to_real : |
|
8466 { |
|
8467 symbol_c *last_type_symbol = NULL; |
|
8468 |
|
8469 { |
|
8470 identifier_c param_name("IN"); |
|
8471 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8472 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8473 |
|
8474 /* Get the value from a foo(<param_value>) style call */ |
|
8475 if (IN_param_value == NULL) |
|
8476 IN_param_value = function_call_param_iterator.next(); |
|
8477 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8478 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8479 |
|
8480 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8481 { |
|
8482 |
|
8483 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
8484 s4o.print("("); |
|
8485 return_type_symbol->accept(*this); |
|
8486 s4o.print(")__time_to_real("); |
|
8487 IN_param_value->accept(*this); |
|
8488 s4o.print(")"); |
|
8489 return NULL; |
|
8490 |
|
8491 } |
|
8492 |
|
8493 ERROR; |
|
8494 } |
|
8495 |
|
8496 }/*function_date_to_real*/ |
|
8497 break; |
|
8498 |
|
8499 /**** |
|
8500 *DATE_TO_LREAL |
|
8501 */ |
|
8502 case function_date_to_lreal : |
|
8503 { |
|
8504 symbol_c *last_type_symbol = NULL; |
|
8505 |
|
8506 { |
|
8507 identifier_c param_name("IN"); |
|
8508 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8509 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8510 |
|
8511 /* Get the value from a foo(<param_value>) style call */ |
|
8512 if (IN_param_value == NULL) |
|
8513 IN_param_value = function_call_param_iterator.next(); |
|
8514 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8515 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8516 |
|
8517 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8518 { |
|
8519 |
|
8520 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
8521 s4o.print("("); |
|
8522 return_type_symbol->accept(*this); |
|
8523 s4o.print(")__time_to_real("); |
|
8524 IN_param_value->accept(*this); |
|
8525 s4o.print(")"); |
|
8526 return NULL; |
|
8527 |
|
8528 } |
|
8529 |
|
8530 ERROR; |
|
8531 } |
|
8532 |
|
8533 }/*function_date_to_lreal*/ |
|
8534 break; |
|
8535 |
|
8536 /**** |
|
8537 *DATE_TO_STRING |
|
8538 */ |
|
8539 case function_date_to_string : |
|
8540 { |
|
8541 symbol_c *last_type_symbol = NULL; |
|
8542 |
|
8543 { |
|
8544 identifier_c param_name("IN"); |
|
8545 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8546 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8547 |
|
8548 /* Get the value from a foo(<param_value>) style call */ |
|
8549 if (IN_param_value == NULL) |
|
8550 IN_param_value = function_call_param_iterator.next(); |
|
8551 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8552 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8553 |
|
8554 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8555 { |
|
8556 |
|
8557 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
8558 s4o.print("("); |
|
8559 return_type_symbol->accept(*this); |
|
8560 s4o.print(")__date_to_string("); |
|
8561 IN_param_value->accept(*this); |
|
8562 s4o.print(")"); |
|
8563 return NULL; |
|
8564 |
|
8565 } |
|
8566 |
|
8567 ERROR; |
|
8568 } |
|
8569 |
|
8570 }/*function_date_to_string*/ |
|
8571 break; |
|
8572 |
|
8573 /**** |
|
8574 *DATE_TO_BYTE |
|
8575 */ |
|
8576 case function_date_to_byte : |
|
8577 { |
|
8578 symbol_c *last_type_symbol = NULL; |
|
8579 |
|
8580 { |
|
8581 identifier_c param_name("IN"); |
|
8582 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8583 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8584 |
|
8585 /* Get the value from a foo(<param_value>) style call */ |
|
8586 if (IN_param_value == NULL) |
|
8587 IN_param_value = function_call_param_iterator.next(); |
|
8588 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8589 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8590 |
|
8591 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8592 { |
|
8593 |
|
8594 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
8595 s4o.print("("); |
|
8596 return_type_symbol->accept(*this); |
|
8597 s4o.print(")__time_to_int("); |
|
8598 IN_param_value->accept(*this); |
|
8599 s4o.print(")"); |
|
8600 return NULL; |
|
8601 |
|
8602 } |
|
8603 |
|
8604 ERROR; |
|
8605 } |
|
8606 |
|
8607 }/*function_date_to_byte*/ |
|
8608 break; |
|
8609 |
|
8610 /**** |
|
8611 *DATE_TO_WORD |
|
8612 */ |
|
8613 case function_date_to_word : |
|
8614 { |
|
8615 symbol_c *last_type_symbol = NULL; |
|
8616 |
|
8617 { |
|
8618 identifier_c param_name("IN"); |
|
8619 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8620 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8621 |
|
8622 /* Get the value from a foo(<param_value>) style call */ |
|
8623 if (IN_param_value == NULL) |
|
8624 IN_param_value = function_call_param_iterator.next(); |
|
8625 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8626 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8627 |
|
8628 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8629 { |
|
8630 |
|
8631 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
8632 s4o.print("("); |
|
8633 return_type_symbol->accept(*this); |
|
8634 s4o.print(")__time_to_int("); |
|
8635 IN_param_value->accept(*this); |
|
8636 s4o.print(")"); |
|
8637 return NULL; |
|
8638 |
|
8639 } |
|
8640 |
|
8641 ERROR; |
|
8642 } |
|
8643 |
|
8644 }/*function_date_to_word*/ |
|
8645 break; |
|
8646 |
|
8647 /**** |
|
8648 *DATE_TO_DWORD |
|
8649 */ |
|
8650 case function_date_to_dword : |
|
8651 { |
|
8652 symbol_c *last_type_symbol = NULL; |
|
8653 |
|
8654 { |
|
8655 identifier_c param_name("IN"); |
|
8656 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8657 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8658 |
|
8659 /* Get the value from a foo(<param_value>) style call */ |
|
8660 if (IN_param_value == NULL) |
|
8661 IN_param_value = function_call_param_iterator.next(); |
|
8662 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8663 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8664 |
|
8665 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8666 { |
|
8667 |
|
8668 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
8669 s4o.print("("); |
|
8670 return_type_symbol->accept(*this); |
|
8671 s4o.print(")__time_to_int("); |
|
8672 IN_param_value->accept(*this); |
|
8673 s4o.print(")"); |
|
8674 return NULL; |
|
8675 |
|
8676 } |
|
8677 |
|
8678 ERROR; |
|
8679 } |
|
8680 |
|
8681 }/*function_date_to_dword*/ |
|
8682 break; |
|
8683 |
|
8684 /**** |
|
8685 *DATE_TO_LWORD |
|
8686 */ |
|
8687 case function_date_to_lword : |
|
8688 { |
|
8689 symbol_c *last_type_symbol = NULL; |
|
8690 |
|
8691 { |
|
8692 identifier_c param_name("IN"); |
|
8693 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8694 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8695 |
|
8696 /* Get the value from a foo(<param_value>) style call */ |
|
8697 if (IN_param_value == NULL) |
|
8698 IN_param_value = function_call_param_iterator.next(); |
|
8699 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8700 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8701 |
|
8702 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
8703 { |
|
8704 |
|
8705 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
8706 s4o.print("("); |
|
8707 return_type_symbol->accept(*this); |
|
8708 s4o.print(")__time_to_int("); |
|
8709 IN_param_value->accept(*this); |
|
8710 s4o.print(")"); |
|
8711 return NULL; |
|
8712 |
|
8713 } |
|
8714 |
|
8715 ERROR; |
|
8716 } |
|
8717 |
|
8718 }/*function_date_to_lword*/ |
|
8719 break; |
|
8720 |
|
8721 /**** |
|
8722 *TOD_TO_SINT |
|
8723 */ |
|
8724 case function_tod_to_sint : |
|
8725 { |
|
8726 symbol_c *last_type_symbol = NULL; |
|
8727 |
|
8728 { |
|
8729 identifier_c param_name("IN"); |
|
8730 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8731 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8732 |
|
8733 /* Get the value from a foo(<param_value>) style call */ |
|
8734 if (IN_param_value == NULL) |
|
8735 IN_param_value = function_call_param_iterator.next(); |
|
8736 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8737 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8738 |
|
8739 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8740 { |
|
8741 |
|
8742 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
8743 s4o.print("("); |
|
8744 return_type_symbol->accept(*this); |
|
8745 s4o.print(")__time_to_int("); |
|
8746 IN_param_value->accept(*this); |
|
8747 s4o.print(")"); |
|
8748 return NULL; |
|
8749 |
|
8750 } |
|
8751 |
|
8752 ERROR; |
|
8753 } |
|
8754 |
|
8755 }/*function_tod_to_sint*/ |
|
8756 break; |
|
8757 |
|
8758 /**** |
|
8759 *TOD_TO_INT |
|
8760 */ |
|
8761 case function_tod_to_int : |
|
8762 { |
|
8763 symbol_c *last_type_symbol = NULL; |
|
8764 |
|
8765 { |
|
8766 identifier_c param_name("IN"); |
|
8767 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8768 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8769 |
|
8770 /* Get the value from a foo(<param_value>) style call */ |
|
8771 if (IN_param_value == NULL) |
|
8772 IN_param_value = function_call_param_iterator.next(); |
|
8773 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8774 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8775 |
|
8776 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8777 { |
|
8778 |
|
8779 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
8780 s4o.print("("); |
|
8781 return_type_symbol->accept(*this); |
|
8782 s4o.print(")__time_to_int("); |
|
8783 IN_param_value->accept(*this); |
|
8784 s4o.print(")"); |
|
8785 return NULL; |
|
8786 |
|
8787 } |
|
8788 |
|
8789 ERROR; |
|
8790 } |
|
8791 |
|
8792 }/*function_tod_to_int*/ |
|
8793 break; |
|
8794 |
|
8795 /**** |
|
8796 *TOD_TO_DINT |
|
8797 */ |
|
8798 case function_tod_to_dint : |
|
8799 { |
|
8800 symbol_c *last_type_symbol = NULL; |
|
8801 |
|
8802 { |
|
8803 identifier_c param_name("IN"); |
|
8804 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8805 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8806 |
|
8807 /* Get the value from a foo(<param_value>) style call */ |
|
8808 if (IN_param_value == NULL) |
|
8809 IN_param_value = function_call_param_iterator.next(); |
|
8810 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8811 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8812 |
|
8813 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8814 { |
|
8815 |
|
8816 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
8817 s4o.print("("); |
|
8818 return_type_symbol->accept(*this); |
|
8819 s4o.print(")__time_to_int("); |
|
8820 IN_param_value->accept(*this); |
|
8821 s4o.print(")"); |
|
8822 return NULL; |
|
8823 |
|
8824 } |
|
8825 |
|
8826 ERROR; |
|
8827 } |
|
8828 |
|
8829 }/*function_tod_to_dint*/ |
|
8830 break; |
|
8831 |
|
8832 /**** |
|
8833 *TOD_TO_LINT |
|
8834 */ |
|
8835 case function_tod_to_lint : |
|
8836 { |
|
8837 symbol_c *last_type_symbol = NULL; |
|
8838 |
|
8839 { |
|
8840 identifier_c param_name("IN"); |
|
8841 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8842 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8843 |
|
8844 /* Get the value from a foo(<param_value>) style call */ |
|
8845 if (IN_param_value == NULL) |
|
8846 IN_param_value = function_call_param_iterator.next(); |
|
8847 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8848 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8849 |
|
8850 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8851 { |
|
8852 |
|
8853 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
8854 s4o.print("("); |
|
8855 return_type_symbol->accept(*this); |
|
8856 s4o.print(")__time_to_int("); |
|
8857 IN_param_value->accept(*this); |
|
8858 s4o.print(")"); |
|
8859 return NULL; |
|
8860 |
|
8861 } |
|
8862 |
|
8863 ERROR; |
|
8864 } |
|
8865 |
|
8866 }/*function_tod_to_lint*/ |
|
8867 break; |
|
8868 |
|
8869 /**** |
|
8870 *TOD_TO_USINT |
|
8871 */ |
|
8872 case function_tod_to_usint : |
|
8873 { |
|
8874 symbol_c *last_type_symbol = NULL; |
|
8875 |
|
8876 { |
|
8877 identifier_c param_name("IN"); |
|
8878 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8879 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8880 |
|
8881 /* Get the value from a foo(<param_value>) style call */ |
|
8882 if (IN_param_value == NULL) |
|
8883 IN_param_value = function_call_param_iterator.next(); |
|
8884 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8885 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8886 |
|
8887 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8888 { |
|
8889 |
|
8890 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
8891 s4o.print("("); |
|
8892 return_type_symbol->accept(*this); |
|
8893 s4o.print(")__time_to_int("); |
|
8894 IN_param_value->accept(*this); |
|
8895 s4o.print(")"); |
|
8896 return NULL; |
|
8897 |
|
8898 } |
|
8899 |
|
8900 ERROR; |
|
8901 } |
|
8902 |
|
8903 }/*function_tod_to_usint*/ |
|
8904 break; |
|
8905 |
|
8906 /**** |
|
8907 *TOD_TO_UINT |
|
8908 */ |
|
8909 case function_tod_to_uint : |
|
8910 { |
|
8911 symbol_c *last_type_symbol = NULL; |
|
8912 |
|
8913 { |
|
8914 identifier_c param_name("IN"); |
|
8915 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8916 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8917 |
|
8918 /* Get the value from a foo(<param_value>) style call */ |
|
8919 if (IN_param_value == NULL) |
|
8920 IN_param_value = function_call_param_iterator.next(); |
|
8921 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8922 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8923 |
|
8924 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8925 { |
|
8926 |
|
8927 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
8928 s4o.print("("); |
|
8929 return_type_symbol->accept(*this); |
|
8930 s4o.print(")__time_to_int("); |
|
8931 IN_param_value->accept(*this); |
|
8932 s4o.print(")"); |
|
8933 return NULL; |
|
8934 |
|
8935 } |
|
8936 |
|
8937 ERROR; |
|
8938 } |
|
8939 |
|
8940 }/*function_tod_to_uint*/ |
|
8941 break; |
|
8942 |
|
8943 /**** |
|
8944 *TOD_TO_UDINT |
|
8945 */ |
|
8946 case function_tod_to_udint : |
|
8947 { |
|
8948 symbol_c *last_type_symbol = NULL; |
|
8949 |
|
8950 { |
|
8951 identifier_c param_name("IN"); |
|
8952 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8953 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8954 |
|
8955 /* Get the value from a foo(<param_value>) style call */ |
|
8956 if (IN_param_value == NULL) |
|
8957 IN_param_value = function_call_param_iterator.next(); |
|
8958 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8959 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8960 |
|
8961 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8962 { |
|
8963 |
|
8964 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
8965 s4o.print("("); |
|
8966 return_type_symbol->accept(*this); |
|
8967 s4o.print(")__time_to_int("); |
|
8968 IN_param_value->accept(*this); |
|
8969 s4o.print(")"); |
|
8970 return NULL; |
|
8971 |
|
8972 } |
|
8973 |
|
8974 ERROR; |
|
8975 } |
|
8976 |
|
8977 }/*function_tod_to_udint*/ |
|
8978 break; |
|
8979 |
|
8980 /**** |
|
8981 *TOD_TO_ULINT |
|
8982 */ |
|
8983 case function_tod_to_ulint : |
|
8984 { |
|
8985 symbol_c *last_type_symbol = NULL; |
|
8986 |
|
8987 { |
|
8988 identifier_c param_name("IN"); |
|
8989 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
8990 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
8991 |
|
8992 /* Get the value from a foo(<param_value>) style call */ |
|
8993 if (IN_param_value == NULL) |
|
8994 IN_param_value = function_call_param_iterator.next(); |
|
8995 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
8996 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
8997 |
|
8998 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
8999 { |
|
9000 |
|
9001 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
9002 s4o.print("("); |
|
9003 return_type_symbol->accept(*this); |
|
9004 s4o.print(")__time_to_int("); |
|
9005 IN_param_value->accept(*this); |
|
9006 s4o.print(")"); |
|
9007 return NULL; |
|
9008 |
|
9009 } |
|
9010 |
|
9011 ERROR; |
|
9012 } |
|
9013 |
|
9014 }/*function_tod_to_ulint*/ |
|
9015 break; |
|
9016 |
|
9017 /**** |
|
9018 *TOD_TO_REAL |
|
9019 */ |
|
9020 case function_tod_to_real : |
|
9021 { |
|
9022 symbol_c *last_type_symbol = NULL; |
|
9023 |
|
9024 { |
|
9025 identifier_c param_name("IN"); |
|
9026 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9027 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9028 |
|
9029 /* Get the value from a foo(<param_value>) style call */ |
|
9030 if (IN_param_value == NULL) |
|
9031 IN_param_value = function_call_param_iterator.next(); |
|
9032 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9033 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9034 |
|
9035 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9036 { |
|
9037 |
|
9038 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
9039 s4o.print("("); |
|
9040 return_type_symbol->accept(*this); |
|
9041 s4o.print(")__time_to_real("); |
|
9042 IN_param_value->accept(*this); |
|
9043 s4o.print(")"); |
|
9044 return NULL; |
|
9045 |
|
9046 } |
|
9047 |
|
9048 ERROR; |
|
9049 } |
|
9050 |
|
9051 }/*function_tod_to_real*/ |
|
9052 break; |
|
9053 |
|
9054 /**** |
|
9055 *TOD_TO_LREAL |
|
9056 */ |
|
9057 case function_tod_to_lreal : |
|
9058 { |
|
9059 symbol_c *last_type_symbol = NULL; |
|
9060 |
|
9061 { |
|
9062 identifier_c param_name("IN"); |
|
9063 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9064 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9065 |
|
9066 /* Get the value from a foo(<param_value>) style call */ |
|
9067 if (IN_param_value == NULL) |
|
9068 IN_param_value = function_call_param_iterator.next(); |
|
9069 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9070 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9071 |
|
9072 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9073 { |
|
9074 |
|
9075 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
9076 s4o.print("("); |
|
9077 return_type_symbol->accept(*this); |
|
9078 s4o.print(")__time_to_real("); |
|
9079 IN_param_value->accept(*this); |
|
9080 s4o.print(")"); |
|
9081 return NULL; |
|
9082 |
|
9083 } |
|
9084 |
|
9085 ERROR; |
|
9086 } |
|
9087 |
|
9088 }/*function_tod_to_lreal*/ |
|
9089 break; |
|
9090 |
|
9091 /**** |
|
9092 *TOD_TO_STRING |
|
9093 */ |
|
9094 case function_tod_to_string : |
|
9095 { |
|
9096 symbol_c *last_type_symbol = NULL; |
|
9097 |
|
9098 { |
|
9099 identifier_c param_name("IN"); |
|
9100 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9101 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9102 |
|
9103 /* Get the value from a foo(<param_value>) style call */ |
|
9104 if (IN_param_value == NULL) |
|
9105 IN_param_value = function_call_param_iterator.next(); |
|
9106 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9107 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9108 |
|
9109 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9110 { |
|
9111 |
|
9112 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
9113 s4o.print("("); |
|
9114 return_type_symbol->accept(*this); |
|
9115 s4o.print(")__tod_to_string("); |
|
9116 IN_param_value->accept(*this); |
|
9117 s4o.print(")"); |
|
9118 return NULL; |
|
9119 |
|
9120 } |
|
9121 |
|
9122 ERROR; |
|
9123 } |
|
9124 |
|
9125 }/*function_tod_to_string*/ |
|
9126 break; |
|
9127 |
|
9128 /**** |
|
9129 *TOD_TO_BYTE |
|
9130 */ |
|
9131 case function_tod_to_byte : |
|
9132 { |
|
9133 symbol_c *last_type_symbol = NULL; |
|
9134 |
|
9135 { |
|
9136 identifier_c param_name("IN"); |
|
9137 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9138 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9139 |
|
9140 /* Get the value from a foo(<param_value>) style call */ |
|
9141 if (IN_param_value == NULL) |
|
9142 IN_param_value = function_call_param_iterator.next(); |
|
9143 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9144 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9145 |
|
9146 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9147 { |
|
9148 |
|
9149 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
9150 s4o.print("("); |
|
9151 return_type_symbol->accept(*this); |
|
9152 s4o.print(")__time_to_int("); |
|
9153 IN_param_value->accept(*this); |
|
9154 s4o.print(")"); |
|
9155 return NULL; |
|
9156 |
|
9157 } |
|
9158 |
|
9159 ERROR; |
|
9160 } |
|
9161 |
|
9162 }/*function_tod_to_byte*/ |
|
9163 break; |
|
9164 |
|
9165 /**** |
|
9166 *TOD_TO_WORD |
|
9167 */ |
|
9168 case function_tod_to_word : |
|
9169 { |
|
9170 symbol_c *last_type_symbol = NULL; |
|
9171 |
|
9172 { |
|
9173 identifier_c param_name("IN"); |
|
9174 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9175 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9176 |
|
9177 /* Get the value from a foo(<param_value>) style call */ |
|
9178 if (IN_param_value == NULL) |
|
9179 IN_param_value = function_call_param_iterator.next(); |
|
9180 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9181 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9182 |
|
9183 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9184 { |
|
9185 |
|
9186 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
9187 s4o.print("("); |
|
9188 return_type_symbol->accept(*this); |
|
9189 s4o.print(")__time_to_int("); |
|
9190 IN_param_value->accept(*this); |
|
9191 s4o.print(")"); |
|
9192 return NULL; |
|
9193 |
|
9194 } |
|
9195 |
|
9196 ERROR; |
|
9197 } |
|
9198 |
|
9199 }/*function_tod_to_word*/ |
|
9200 break; |
|
9201 |
|
9202 /**** |
|
9203 *TOD_TO_DWORD |
|
9204 */ |
|
9205 case function_tod_to_dword : |
|
9206 { |
|
9207 symbol_c *last_type_symbol = NULL; |
|
9208 |
|
9209 { |
|
9210 identifier_c param_name("IN"); |
|
9211 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9212 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9213 |
|
9214 /* Get the value from a foo(<param_value>) style call */ |
|
9215 if (IN_param_value == NULL) |
|
9216 IN_param_value = function_call_param_iterator.next(); |
|
9217 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9218 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9219 |
|
9220 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9221 { |
|
9222 |
|
9223 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
9224 s4o.print("("); |
|
9225 return_type_symbol->accept(*this); |
|
9226 s4o.print(")__time_to_int("); |
|
9227 IN_param_value->accept(*this); |
|
9228 s4o.print(")"); |
|
9229 return NULL; |
|
9230 |
|
9231 } |
|
9232 |
|
9233 ERROR; |
|
9234 } |
|
9235 |
|
9236 }/*function_tod_to_dword*/ |
|
9237 break; |
|
9238 |
|
9239 /**** |
|
9240 *TOD_TO_LWORD |
|
9241 */ |
|
9242 case function_tod_to_lword : |
|
9243 { |
|
9244 symbol_c *last_type_symbol = NULL; |
|
9245 |
|
9246 { |
|
9247 identifier_c param_name("IN"); |
|
9248 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9249 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9250 |
|
9251 /* Get the value from a foo(<param_value>) style call */ |
|
9252 if (IN_param_value == NULL) |
|
9253 IN_param_value = function_call_param_iterator.next(); |
|
9254 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9255 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9256 |
|
9257 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
9258 { |
|
9259 |
|
9260 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
9261 s4o.print("("); |
|
9262 return_type_symbol->accept(*this); |
|
9263 s4o.print(")__time_to_int("); |
|
9264 IN_param_value->accept(*this); |
|
9265 s4o.print(")"); |
|
9266 return NULL; |
|
9267 |
|
9268 } |
|
9269 |
|
9270 ERROR; |
|
9271 } |
|
9272 |
|
9273 }/*function_tod_to_lword*/ |
|
9274 break; |
|
9275 |
|
9276 /**** |
|
9277 *DT_TO_SINT |
|
9278 */ |
|
9279 case function_dt_to_sint : |
|
9280 { |
|
9281 symbol_c *last_type_symbol = NULL; |
|
9282 |
|
9283 { |
|
9284 identifier_c param_name("IN"); |
|
9285 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9286 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9287 |
|
9288 /* Get the value from a foo(<param_value>) style call */ |
|
9289 if (IN_param_value == NULL) |
|
9290 IN_param_value = function_call_param_iterator.next(); |
|
9291 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9292 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9293 |
|
9294 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9295 { |
|
9296 |
|
9297 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
9298 s4o.print("("); |
|
9299 return_type_symbol->accept(*this); |
|
9300 s4o.print(")__time_to_int("); |
|
9301 IN_param_value->accept(*this); |
|
9302 s4o.print(")"); |
|
9303 return NULL; |
|
9304 |
|
9305 } |
|
9306 |
|
9307 ERROR; |
|
9308 } |
|
9309 |
|
9310 }/*function_dt_to_sint*/ |
|
9311 break; |
|
9312 |
|
9313 /**** |
|
9314 *DT_TO_INT |
|
9315 */ |
|
9316 case function_dt_to_int : |
|
9317 { |
|
9318 symbol_c *last_type_symbol = NULL; |
|
9319 |
|
9320 { |
|
9321 identifier_c param_name("IN"); |
|
9322 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9323 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9324 |
|
9325 /* Get the value from a foo(<param_value>) style call */ |
|
9326 if (IN_param_value == NULL) |
|
9327 IN_param_value = function_call_param_iterator.next(); |
|
9328 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9329 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9330 |
|
9331 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9332 { |
|
9333 |
|
9334 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
9335 s4o.print("("); |
|
9336 return_type_symbol->accept(*this); |
|
9337 s4o.print(")__time_to_int("); |
|
9338 IN_param_value->accept(*this); |
|
9339 s4o.print(")"); |
|
9340 return NULL; |
|
9341 |
|
9342 } |
|
9343 |
|
9344 ERROR; |
|
9345 } |
|
9346 |
|
9347 }/*function_dt_to_int*/ |
|
9348 break; |
|
9349 |
|
9350 /**** |
|
9351 *DT_TO_DINT |
|
9352 */ |
|
9353 case function_dt_to_dint : |
|
9354 { |
|
9355 symbol_c *last_type_symbol = NULL; |
|
9356 |
|
9357 { |
|
9358 identifier_c param_name("IN"); |
|
9359 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9360 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9361 |
|
9362 /* Get the value from a foo(<param_value>) style call */ |
|
9363 if (IN_param_value == NULL) |
|
9364 IN_param_value = function_call_param_iterator.next(); |
|
9365 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9366 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9367 |
|
9368 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9369 { |
|
9370 |
|
9371 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
9372 s4o.print("("); |
|
9373 return_type_symbol->accept(*this); |
|
9374 s4o.print(")__time_to_int("); |
|
9375 IN_param_value->accept(*this); |
|
9376 s4o.print(")"); |
|
9377 return NULL; |
|
9378 |
|
9379 } |
|
9380 |
|
9381 ERROR; |
|
9382 } |
|
9383 |
|
9384 }/*function_dt_to_dint*/ |
|
9385 break; |
|
9386 |
|
9387 /**** |
|
9388 *DT_TO_LINT |
|
9389 */ |
|
9390 case function_dt_to_lint : |
|
9391 { |
|
9392 symbol_c *last_type_symbol = NULL; |
|
9393 |
|
9394 { |
|
9395 identifier_c param_name("IN"); |
|
9396 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9397 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9398 |
|
9399 /* Get the value from a foo(<param_value>) style call */ |
|
9400 if (IN_param_value == NULL) |
|
9401 IN_param_value = function_call_param_iterator.next(); |
|
9402 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9403 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9404 |
|
9405 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9406 { |
|
9407 |
|
9408 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
9409 s4o.print("("); |
|
9410 return_type_symbol->accept(*this); |
|
9411 s4o.print(")__time_to_int("); |
|
9412 IN_param_value->accept(*this); |
|
9413 s4o.print(")"); |
|
9414 return NULL; |
|
9415 |
|
9416 } |
|
9417 |
|
9418 ERROR; |
|
9419 } |
|
9420 |
|
9421 }/*function_dt_to_lint*/ |
|
9422 break; |
|
9423 |
|
9424 /**** |
|
9425 *DT_TO_USINT |
|
9426 */ |
|
9427 case function_dt_to_usint : |
|
9428 { |
|
9429 symbol_c *last_type_symbol = NULL; |
|
9430 |
|
9431 { |
|
9432 identifier_c param_name("IN"); |
|
9433 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9434 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9435 |
|
9436 /* Get the value from a foo(<param_value>) style call */ |
|
9437 if (IN_param_value == NULL) |
|
9438 IN_param_value = function_call_param_iterator.next(); |
|
9439 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9440 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9441 |
|
9442 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9443 { |
|
9444 |
|
9445 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
9446 s4o.print("("); |
|
9447 return_type_symbol->accept(*this); |
|
9448 s4o.print(")__time_to_int("); |
|
9449 IN_param_value->accept(*this); |
|
9450 s4o.print(")"); |
|
9451 return NULL; |
|
9452 |
|
9453 } |
|
9454 |
|
9455 ERROR; |
|
9456 } |
|
9457 |
|
9458 }/*function_dt_to_usint*/ |
|
9459 break; |
|
9460 |
|
9461 /**** |
|
9462 *DT_TO_UINT |
|
9463 */ |
|
9464 case function_dt_to_uint : |
|
9465 { |
|
9466 symbol_c *last_type_symbol = NULL; |
|
9467 |
|
9468 { |
|
9469 identifier_c param_name("IN"); |
|
9470 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9471 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9472 |
|
9473 /* Get the value from a foo(<param_value>) style call */ |
|
9474 if (IN_param_value == NULL) |
|
9475 IN_param_value = function_call_param_iterator.next(); |
|
9476 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9477 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9478 |
|
9479 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9480 { |
|
9481 |
|
9482 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
9483 s4o.print("("); |
|
9484 return_type_symbol->accept(*this); |
|
9485 s4o.print(")__time_to_int("); |
|
9486 IN_param_value->accept(*this); |
|
9487 s4o.print(")"); |
|
9488 return NULL; |
|
9489 |
|
9490 } |
|
9491 |
|
9492 ERROR; |
|
9493 } |
|
9494 |
|
9495 }/*function_dt_to_uint*/ |
|
9496 break; |
|
9497 |
|
9498 /**** |
|
9499 *DT_TO_UDINT |
|
9500 */ |
|
9501 case function_dt_to_udint : |
|
9502 { |
|
9503 symbol_c *last_type_symbol = NULL; |
|
9504 |
|
9505 { |
|
9506 identifier_c param_name("IN"); |
|
9507 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9508 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9509 |
|
9510 /* Get the value from a foo(<param_value>) style call */ |
|
9511 if (IN_param_value == NULL) |
|
9512 IN_param_value = function_call_param_iterator.next(); |
|
9513 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9514 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9515 |
|
9516 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9517 { |
|
9518 |
|
9519 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
9520 s4o.print("("); |
|
9521 return_type_symbol->accept(*this); |
|
9522 s4o.print(")__time_to_int("); |
|
9523 IN_param_value->accept(*this); |
|
9524 s4o.print(")"); |
|
9525 return NULL; |
|
9526 |
|
9527 } |
|
9528 |
|
9529 ERROR; |
|
9530 } |
|
9531 |
|
9532 }/*function_dt_to_udint*/ |
|
9533 break; |
|
9534 |
|
9535 /**** |
|
9536 *DT_TO_ULINT |
|
9537 */ |
|
9538 case function_dt_to_ulint : |
|
9539 { |
|
9540 symbol_c *last_type_symbol = NULL; |
|
9541 |
|
9542 { |
|
9543 identifier_c param_name("IN"); |
|
9544 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9545 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9546 |
|
9547 /* Get the value from a foo(<param_value>) style call */ |
|
9548 if (IN_param_value == NULL) |
|
9549 IN_param_value = function_call_param_iterator.next(); |
|
9550 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9551 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9552 |
|
9553 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9554 { |
|
9555 |
|
9556 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
9557 s4o.print("("); |
|
9558 return_type_symbol->accept(*this); |
|
9559 s4o.print(")__time_to_int("); |
|
9560 IN_param_value->accept(*this); |
|
9561 s4o.print(")"); |
|
9562 return NULL; |
|
9563 |
|
9564 } |
|
9565 |
|
9566 ERROR; |
|
9567 } |
|
9568 |
|
9569 }/*function_dt_to_ulint*/ |
|
9570 break; |
|
9571 |
|
9572 /**** |
|
9573 *DT_TO_REAL |
|
9574 */ |
|
9575 case function_dt_to_real : |
|
9576 { |
|
9577 symbol_c *last_type_symbol = NULL; |
|
9578 |
|
9579 { |
|
9580 identifier_c param_name("IN"); |
|
9581 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9582 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9583 |
|
9584 /* Get the value from a foo(<param_value>) style call */ |
|
9585 if (IN_param_value == NULL) |
|
9586 IN_param_value = function_call_param_iterator.next(); |
|
9587 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9588 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9589 |
|
9590 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9591 { |
|
9592 |
|
9593 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
9594 s4o.print("("); |
|
9595 return_type_symbol->accept(*this); |
|
9596 s4o.print(")__time_to_real("); |
|
9597 IN_param_value->accept(*this); |
|
9598 s4o.print(")"); |
|
9599 return NULL; |
|
9600 |
|
9601 } |
|
9602 |
|
9603 ERROR; |
|
9604 } |
|
9605 |
|
9606 }/*function_dt_to_real*/ |
|
9607 break; |
|
9608 |
|
9609 /**** |
|
9610 *DT_TO_LREAL |
|
9611 */ |
|
9612 case function_dt_to_lreal : |
|
9613 { |
|
9614 symbol_c *last_type_symbol = NULL; |
|
9615 |
|
9616 { |
|
9617 identifier_c param_name("IN"); |
|
9618 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9619 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9620 |
|
9621 /* Get the value from a foo(<param_value>) style call */ |
|
9622 if (IN_param_value == NULL) |
|
9623 IN_param_value = function_call_param_iterator.next(); |
|
9624 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9625 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9626 |
|
9627 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9628 { |
|
9629 |
|
9630 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
9631 s4o.print("("); |
|
9632 return_type_symbol->accept(*this); |
|
9633 s4o.print(")__time_to_real("); |
|
9634 IN_param_value->accept(*this); |
|
9635 s4o.print(")"); |
|
9636 return NULL; |
|
9637 |
|
9638 } |
|
9639 |
|
9640 ERROR; |
|
9641 } |
|
9642 |
|
9643 }/*function_dt_to_lreal*/ |
|
9644 break; |
|
9645 |
|
9646 /**** |
|
9647 *DT_TO_STRING |
|
9648 */ |
|
9649 case function_dt_to_string : |
|
9650 { |
|
9651 symbol_c *last_type_symbol = NULL; |
|
9652 |
|
9653 { |
|
9654 identifier_c param_name("IN"); |
|
9655 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9656 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9657 |
|
9658 /* Get the value from a foo(<param_value>) style call */ |
|
9659 if (IN_param_value == NULL) |
|
9660 IN_param_value = function_call_param_iterator.next(); |
|
9661 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9662 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9663 |
|
9664 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9665 { |
|
9666 |
|
9667 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
9668 s4o.print("("); |
|
9669 return_type_symbol->accept(*this); |
|
9670 s4o.print(")__dt_to_string("); |
|
9671 IN_param_value->accept(*this); |
|
9672 s4o.print(")"); |
|
9673 return NULL; |
|
9674 |
|
9675 } |
|
9676 |
|
9677 ERROR; |
|
9678 } |
|
9679 |
|
9680 }/*function_dt_to_string*/ |
|
9681 break; |
|
9682 |
|
9683 /**** |
|
9684 *DT_TO_BYTE |
|
9685 */ |
|
9686 case function_dt_to_byte : |
|
9687 { |
|
9688 symbol_c *last_type_symbol = NULL; |
|
9689 |
|
9690 { |
|
9691 identifier_c param_name("IN"); |
|
9692 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9693 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9694 |
|
9695 /* Get the value from a foo(<param_value>) style call */ |
|
9696 if (IN_param_value == NULL) |
|
9697 IN_param_value = function_call_param_iterator.next(); |
|
9698 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9699 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9700 |
|
9701 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9702 { |
|
9703 |
|
9704 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
9705 s4o.print("("); |
|
9706 return_type_symbol->accept(*this); |
|
9707 s4o.print(")__time_to_int("); |
|
9708 IN_param_value->accept(*this); |
|
9709 s4o.print(")"); |
|
9710 return NULL; |
|
9711 |
|
9712 } |
|
9713 |
|
9714 ERROR; |
|
9715 } |
|
9716 |
|
9717 }/*function_dt_to_byte*/ |
|
9718 break; |
|
9719 |
|
9720 /**** |
|
9721 *DT_TO_WORD |
|
9722 */ |
|
9723 case function_dt_to_word : |
|
9724 { |
|
9725 symbol_c *last_type_symbol = NULL; |
|
9726 |
|
9727 { |
|
9728 identifier_c param_name("IN"); |
|
9729 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9730 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9731 |
|
9732 /* Get the value from a foo(<param_value>) style call */ |
|
9733 if (IN_param_value == NULL) |
|
9734 IN_param_value = function_call_param_iterator.next(); |
|
9735 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9736 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9737 |
|
9738 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9739 { |
|
9740 |
|
9741 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
9742 s4o.print("("); |
|
9743 return_type_symbol->accept(*this); |
|
9744 s4o.print(")__time_to_int("); |
|
9745 IN_param_value->accept(*this); |
|
9746 s4o.print(")"); |
|
9747 return NULL; |
|
9748 |
|
9749 } |
|
9750 |
|
9751 ERROR; |
|
9752 } |
|
9753 |
|
9754 }/*function_dt_to_word*/ |
|
9755 break; |
|
9756 |
|
9757 /**** |
|
9758 *DT_TO_DWORD |
|
9759 */ |
|
9760 case function_dt_to_dword : |
|
9761 { |
|
9762 symbol_c *last_type_symbol = NULL; |
|
9763 |
|
9764 { |
|
9765 identifier_c param_name("IN"); |
|
9766 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9767 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9768 |
|
9769 /* Get the value from a foo(<param_value>) style call */ |
|
9770 if (IN_param_value == NULL) |
|
9771 IN_param_value = function_call_param_iterator.next(); |
|
9772 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9773 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9774 |
|
9775 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9776 { |
|
9777 |
|
9778 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
9779 s4o.print("("); |
|
9780 return_type_symbol->accept(*this); |
|
9781 s4o.print(")__time_to_int("); |
|
9782 IN_param_value->accept(*this); |
|
9783 s4o.print(")"); |
|
9784 return NULL; |
|
9785 |
|
9786 } |
|
9787 |
|
9788 ERROR; |
|
9789 } |
|
9790 |
|
9791 }/*function_dt_to_dword*/ |
|
9792 break; |
|
9793 |
|
9794 /**** |
|
9795 *DT_TO_LWORD |
|
9796 */ |
|
9797 case function_dt_to_lword : |
|
9798 { |
|
9799 symbol_c *last_type_symbol = NULL; |
|
9800 |
|
9801 { |
|
9802 identifier_c param_name("IN"); |
|
9803 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9804 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9805 |
|
9806 /* Get the value from a foo(<param_value>) style call */ |
|
9807 if (IN_param_value == NULL) |
|
9808 IN_param_value = function_call_param_iterator.next(); |
|
9809 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9810 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9811 |
|
9812 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
9813 { |
|
9814 |
|
9815 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
9816 s4o.print("("); |
|
9817 return_type_symbol->accept(*this); |
|
9818 s4o.print(")__time_to_int("); |
|
9819 IN_param_value->accept(*this); |
|
9820 s4o.print(")"); |
|
9821 return NULL; |
|
9822 |
|
9823 } |
|
9824 |
|
9825 ERROR; |
|
9826 } |
|
9827 |
|
9828 }/*function_dt_to_lword*/ |
|
9829 break; |
|
9830 |
|
9831 /**** |
|
9832 *STRING_TO_BOOL |
|
9833 */ |
|
9834 case function_string_to_bool : |
|
9835 { |
|
9836 symbol_c *last_type_symbol = NULL; |
|
9837 |
|
9838 { |
|
9839 identifier_c param_name("IN"); |
|
9840 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9841 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9842 |
|
9843 /* Get the value from a foo(<param_value>) style call */ |
|
9844 if (IN_param_value == NULL) |
|
9845 IN_param_value = function_call_param_iterator.next(); |
|
9846 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9847 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9848 |
|
9849 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
9850 { |
|
9851 |
|
9852 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
9853 s4o.print("("); |
|
9854 return_type_symbol->accept(*this); |
|
9855 s4o.print(")__string_to_bool("); |
|
9856 IN_param_value->accept(*this); |
|
9857 s4o.print(")"); |
|
9858 return NULL; |
|
9859 |
|
9860 } |
|
9861 |
|
9862 ERROR; |
|
9863 } |
|
9864 |
|
9865 }/*function_string_to_bool*/ |
|
9866 break; |
|
9867 |
|
9868 /**** |
|
9869 *STRING_TO_SINT |
|
9870 */ |
|
9871 case function_string_to_sint : |
|
9872 { |
|
9873 symbol_c *last_type_symbol = NULL; |
|
9874 |
|
9875 { |
|
9876 identifier_c param_name("IN"); |
|
9877 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9878 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9879 |
|
9880 /* Get the value from a foo(<param_value>) style call */ |
|
9881 if (IN_param_value == NULL) |
|
9882 IN_param_value = function_call_param_iterator.next(); |
|
9883 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9884 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9885 |
|
9886 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
9887 { |
|
9888 |
|
9889 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
9890 s4o.print("("); |
|
9891 return_type_symbol->accept(*this); |
|
9892 s4o.print(")__string_to_sint("); |
|
9893 IN_param_value->accept(*this); |
|
9894 s4o.print(")"); |
|
9895 return NULL; |
|
9896 |
|
9897 } |
|
9898 |
|
9899 ERROR; |
|
9900 } |
|
9901 |
|
9902 }/*function_string_to_sint*/ |
|
9903 break; |
|
9904 |
|
9905 /**** |
|
9906 *STRING_TO_INT |
|
9907 */ |
|
9908 case function_string_to_int : |
|
9909 { |
|
9910 symbol_c *last_type_symbol = NULL; |
|
9911 |
|
9912 { |
|
9913 identifier_c param_name("IN"); |
|
9914 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9915 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9916 |
|
9917 /* Get the value from a foo(<param_value>) style call */ |
|
9918 if (IN_param_value == NULL) |
|
9919 IN_param_value = function_call_param_iterator.next(); |
|
9920 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9921 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9922 |
|
9923 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
9924 { |
|
9925 |
|
9926 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
9927 s4o.print("("); |
|
9928 return_type_symbol->accept(*this); |
|
9929 s4o.print(")__string_to_sint("); |
|
9930 IN_param_value->accept(*this); |
|
9931 s4o.print(")"); |
|
9932 return NULL; |
|
9933 |
|
9934 } |
|
9935 |
|
9936 ERROR; |
|
9937 } |
|
9938 |
|
9939 }/*function_string_to_int*/ |
|
9940 break; |
|
9941 |
|
9942 /**** |
|
9943 *STRING_TO_DINT |
|
9944 */ |
|
9945 case function_string_to_dint : |
|
9946 { |
|
9947 symbol_c *last_type_symbol = NULL; |
|
9948 |
|
9949 { |
|
9950 identifier_c param_name("IN"); |
|
9951 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9952 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9953 |
|
9954 /* Get the value from a foo(<param_value>) style call */ |
|
9955 if (IN_param_value == NULL) |
|
9956 IN_param_value = function_call_param_iterator.next(); |
|
9957 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9958 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9959 |
|
9960 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
9961 { |
|
9962 |
|
9963 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
9964 s4o.print("("); |
|
9965 return_type_symbol->accept(*this); |
|
9966 s4o.print(")__string_to_sint("); |
|
9967 IN_param_value->accept(*this); |
|
9968 s4o.print(")"); |
|
9969 return NULL; |
|
9970 |
|
9971 } |
|
9972 |
|
9973 ERROR; |
|
9974 } |
|
9975 |
|
9976 }/*function_string_to_dint*/ |
|
9977 break; |
|
9978 |
|
9979 /**** |
|
9980 *STRING_TO_LINT |
|
9981 */ |
|
9982 case function_string_to_lint : |
|
9983 { |
|
9984 symbol_c *last_type_symbol = NULL; |
|
9985 |
|
9986 { |
|
9987 identifier_c param_name("IN"); |
|
9988 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
9989 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
9990 |
|
9991 /* Get the value from a foo(<param_value>) style call */ |
|
9992 if (IN_param_value == NULL) |
|
9993 IN_param_value = function_call_param_iterator.next(); |
|
9994 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
9995 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
9996 |
|
9997 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
9998 { |
|
9999 |
|
10000 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
10001 s4o.print("("); |
|
10002 return_type_symbol->accept(*this); |
|
10003 s4o.print(")__string_to_sint("); |
|
10004 IN_param_value->accept(*this); |
|
10005 s4o.print(")"); |
|
10006 return NULL; |
|
10007 |
|
10008 } |
|
10009 |
|
10010 ERROR; |
|
10011 } |
|
10012 |
|
10013 }/*function_string_to_lint*/ |
|
10014 break; |
|
10015 |
|
10016 /**** |
|
10017 *STRING_TO_USINT |
|
10018 */ |
|
10019 case function_string_to_usint : |
|
10020 { |
|
10021 symbol_c *last_type_symbol = NULL; |
|
10022 |
|
10023 { |
|
10024 identifier_c param_name("IN"); |
|
10025 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10026 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10027 |
|
10028 /* Get the value from a foo(<param_value>) style call */ |
|
10029 if (IN_param_value == NULL) |
|
10030 IN_param_value = function_call_param_iterator.next(); |
|
10031 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10032 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10033 |
|
10034 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10035 { |
|
10036 |
|
10037 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
10038 s4o.print("("); |
|
10039 return_type_symbol->accept(*this); |
|
10040 s4o.print(")__string_to_uint("); |
|
10041 IN_param_value->accept(*this); |
|
10042 s4o.print(")"); |
|
10043 return NULL; |
|
10044 |
|
10045 } |
|
10046 |
|
10047 ERROR; |
|
10048 } |
|
10049 |
|
10050 }/*function_string_to_usint*/ |
|
10051 break; |
|
10052 |
|
10053 /**** |
|
10054 *STRING_TO_UINT |
|
10055 */ |
|
10056 case function_string_to_uint : |
|
10057 { |
|
10058 symbol_c *last_type_symbol = NULL; |
|
10059 |
|
10060 { |
|
10061 identifier_c param_name("IN"); |
|
10062 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10063 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10064 |
|
10065 /* Get the value from a foo(<param_value>) style call */ |
|
10066 if (IN_param_value == NULL) |
|
10067 IN_param_value = function_call_param_iterator.next(); |
|
10068 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10069 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10070 |
|
10071 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10072 { |
|
10073 |
|
10074 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
10075 s4o.print("("); |
|
10076 return_type_symbol->accept(*this); |
|
10077 s4o.print(")__string_to_uint("); |
|
10078 IN_param_value->accept(*this); |
|
10079 s4o.print(")"); |
|
10080 return NULL; |
|
10081 |
|
10082 } |
|
10083 |
|
10084 ERROR; |
|
10085 } |
|
10086 |
|
10087 }/*function_string_to_uint*/ |
|
10088 break; |
|
10089 |
|
10090 /**** |
|
10091 *STRING_TO_UDINT |
|
10092 */ |
|
10093 case function_string_to_udint : |
|
10094 { |
|
10095 symbol_c *last_type_symbol = NULL; |
|
10096 |
|
10097 { |
|
10098 identifier_c param_name("IN"); |
|
10099 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10100 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10101 |
|
10102 /* Get the value from a foo(<param_value>) style call */ |
|
10103 if (IN_param_value == NULL) |
|
10104 IN_param_value = function_call_param_iterator.next(); |
|
10105 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10106 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10107 |
|
10108 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10109 { |
|
10110 |
|
10111 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
10112 s4o.print("("); |
|
10113 return_type_symbol->accept(*this); |
|
10114 s4o.print(")__string_to_uint("); |
|
10115 IN_param_value->accept(*this); |
|
10116 s4o.print(")"); |
|
10117 return NULL; |
|
10118 |
|
10119 } |
|
10120 |
|
10121 ERROR; |
|
10122 } |
|
10123 |
|
10124 }/*function_string_to_udint*/ |
|
10125 break; |
|
10126 |
|
10127 /**** |
|
10128 *STRING_TO_ULINT |
|
10129 */ |
|
10130 case function_string_to_ulint : |
|
10131 { |
|
10132 symbol_c *last_type_symbol = NULL; |
|
10133 |
|
10134 { |
|
10135 identifier_c param_name("IN"); |
|
10136 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10137 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10138 |
|
10139 /* Get the value from a foo(<param_value>) style call */ |
|
10140 if (IN_param_value == NULL) |
|
10141 IN_param_value = function_call_param_iterator.next(); |
|
10142 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10143 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10144 |
|
10145 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10146 { |
|
10147 |
|
10148 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
10149 s4o.print("("); |
|
10150 return_type_symbol->accept(*this); |
|
10151 s4o.print(")__string_to_uint("); |
|
10152 IN_param_value->accept(*this); |
|
10153 s4o.print(")"); |
|
10154 return NULL; |
|
10155 |
|
10156 } |
|
10157 |
|
10158 ERROR; |
|
10159 } |
|
10160 |
|
10161 }/*function_string_to_ulint*/ |
|
10162 break; |
|
10163 |
|
10164 /**** |
|
10165 *STRING_TO_REAL |
|
10166 */ |
|
10167 case function_string_to_real : |
|
10168 { |
|
10169 symbol_c *last_type_symbol = NULL; |
|
10170 |
|
10171 { |
|
10172 identifier_c param_name("IN"); |
|
10173 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10174 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10175 |
|
10176 /* Get the value from a foo(<param_value>) style call */ |
|
10177 if (IN_param_value == NULL) |
|
10178 IN_param_value = function_call_param_iterator.next(); |
|
10179 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10180 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10181 |
|
10182 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10183 { |
|
10184 |
|
10185 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
10186 s4o.print("("); |
|
10187 return_type_symbol->accept(*this); |
|
10188 s4o.print(")__string_to_real("); |
|
10189 IN_param_value->accept(*this); |
|
10190 s4o.print(")"); |
|
10191 return NULL; |
|
10192 |
|
10193 } |
|
10194 |
|
10195 ERROR; |
|
10196 } |
|
10197 |
|
10198 }/*function_string_to_real*/ |
|
10199 break; |
|
10200 |
|
10201 /**** |
|
10202 *STRING_TO_LREAL |
|
10203 */ |
|
10204 case function_string_to_lreal : |
|
10205 { |
|
10206 symbol_c *last_type_symbol = NULL; |
|
10207 |
|
10208 { |
|
10209 identifier_c param_name("IN"); |
|
10210 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10211 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10212 |
|
10213 /* Get the value from a foo(<param_value>) style call */ |
|
10214 if (IN_param_value == NULL) |
|
10215 IN_param_value = function_call_param_iterator.next(); |
|
10216 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10217 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10218 |
|
10219 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10220 { |
|
10221 |
|
10222 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
10223 s4o.print("("); |
|
10224 return_type_symbol->accept(*this); |
|
10225 s4o.print(")__string_to_real("); |
|
10226 IN_param_value->accept(*this); |
|
10227 s4o.print(")"); |
|
10228 return NULL; |
|
10229 |
|
10230 } |
|
10231 |
|
10232 ERROR; |
|
10233 } |
|
10234 |
|
10235 }/*function_string_to_lreal*/ |
|
10236 break; |
|
10237 |
|
10238 /**** |
|
10239 *STRING_TO_TIME |
|
10240 */ |
|
10241 case function_string_to_time : |
|
10242 { |
|
10243 symbol_c *last_type_symbol = NULL; |
|
10244 |
|
10245 { |
|
10246 identifier_c param_name("IN"); |
|
10247 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10248 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10249 |
|
10250 /* Get the value from a foo(<param_value>) style call */ |
|
10251 if (IN_param_value == NULL) |
|
10252 IN_param_value = function_call_param_iterator.next(); |
|
10253 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10254 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10255 |
|
10256 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10257 { |
|
10258 |
|
10259 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
10260 s4o.print("("); |
|
10261 return_type_symbol->accept(*this); |
|
10262 s4o.print(")__string_to_time("); |
|
10263 IN_param_value->accept(*this); |
|
10264 s4o.print(")"); |
|
10265 return NULL; |
|
10266 |
|
10267 } |
|
10268 |
|
10269 ERROR; |
|
10270 } |
|
10271 |
|
10272 }/*function_string_to_time*/ |
|
10273 break; |
|
10274 |
|
10275 /**** |
|
10276 *STRING_TO_DATE |
|
10277 */ |
|
10278 case function_string_to_date : |
|
10279 { |
|
10280 symbol_c *last_type_symbol = NULL; |
|
10281 |
|
10282 { |
|
10283 identifier_c param_name("IN"); |
|
10284 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10285 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10286 |
|
10287 /* Get the value from a foo(<param_value>) style call */ |
|
10288 if (IN_param_value == NULL) |
|
10289 IN_param_value = function_call_param_iterator.next(); |
|
10290 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10291 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10292 |
|
10293 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10294 { |
|
10295 |
|
10296 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
10297 s4o.print("("); |
|
10298 return_type_symbol->accept(*this); |
|
10299 s4o.print(")__string_to_time("); |
|
10300 IN_param_value->accept(*this); |
|
10301 s4o.print(")"); |
|
10302 return NULL; |
|
10303 |
|
10304 } |
|
10305 |
|
10306 ERROR; |
|
10307 } |
|
10308 |
|
10309 }/*function_string_to_date*/ |
|
10310 break; |
|
10311 |
|
10312 /**** |
|
10313 *STRING_TO_TOD |
|
10314 */ |
|
10315 case function_string_to_tod : |
|
10316 { |
|
10317 symbol_c *last_type_symbol = NULL; |
|
10318 |
|
10319 { |
|
10320 identifier_c param_name("IN"); |
|
10321 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10322 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10323 |
|
10324 /* Get the value from a foo(<param_value>) style call */ |
|
10325 if (IN_param_value == NULL) |
|
10326 IN_param_value = function_call_param_iterator.next(); |
|
10327 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10328 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10329 |
|
10330 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10331 { |
|
10332 |
|
10333 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
10334 s4o.print("("); |
|
10335 return_type_symbol->accept(*this); |
|
10336 s4o.print(")__string_to_time("); |
|
10337 IN_param_value->accept(*this); |
|
10338 s4o.print(")"); |
|
10339 return NULL; |
|
10340 |
|
10341 } |
|
10342 |
|
10343 ERROR; |
|
10344 } |
|
10345 |
|
10346 }/*function_string_to_tod*/ |
|
10347 break; |
|
10348 |
|
10349 /**** |
|
10350 *STRING_TO_DT |
|
10351 */ |
|
10352 case function_string_to_dt : |
|
10353 { |
|
10354 symbol_c *last_type_symbol = NULL; |
|
10355 |
|
10356 { |
|
10357 identifier_c param_name("IN"); |
|
10358 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10359 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10360 |
|
10361 /* Get the value from a foo(<param_value>) style call */ |
|
10362 if (IN_param_value == NULL) |
|
10363 IN_param_value = function_call_param_iterator.next(); |
|
10364 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10365 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10366 |
|
10367 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10368 { |
|
10369 |
|
10370 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
10371 s4o.print("("); |
|
10372 return_type_symbol->accept(*this); |
|
10373 s4o.print(")__string_to_time("); |
|
10374 IN_param_value->accept(*this); |
|
10375 s4o.print(")"); |
|
10376 return NULL; |
|
10377 |
|
10378 } |
|
10379 |
|
10380 ERROR; |
|
10381 } |
|
10382 |
|
10383 }/*function_string_to_dt*/ |
|
10384 break; |
|
10385 |
|
10386 /**** |
|
10387 *STRING_TO_BYTE |
|
10388 */ |
|
10389 case function_string_to_byte : |
|
10390 { |
|
10391 symbol_c *last_type_symbol = NULL; |
|
10392 |
|
10393 { |
|
10394 identifier_c param_name("IN"); |
|
10395 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10396 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10397 |
|
10398 /* Get the value from a foo(<param_value>) style call */ |
|
10399 if (IN_param_value == NULL) |
|
10400 IN_param_value = function_call_param_iterator.next(); |
|
10401 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10402 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10403 |
|
10404 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10405 { |
|
10406 |
|
10407 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
10408 s4o.print("("); |
|
10409 return_type_symbol->accept(*this); |
|
10410 s4o.print(")__string_to_bit("); |
|
10411 IN_param_value->accept(*this); |
|
10412 s4o.print(")"); |
|
10413 return NULL; |
|
10414 |
|
10415 } |
|
10416 |
|
10417 ERROR; |
|
10418 } |
|
10419 |
|
10420 }/*function_string_to_byte*/ |
|
10421 break; |
|
10422 |
|
10423 /**** |
|
10424 *STRING_TO_WORD |
|
10425 */ |
|
10426 case function_string_to_word : |
|
10427 { |
|
10428 symbol_c *last_type_symbol = NULL; |
|
10429 |
|
10430 { |
|
10431 identifier_c param_name("IN"); |
|
10432 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10433 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10434 |
|
10435 /* Get the value from a foo(<param_value>) style call */ |
|
10436 if (IN_param_value == NULL) |
|
10437 IN_param_value = function_call_param_iterator.next(); |
|
10438 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10439 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10440 |
|
10441 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10442 { |
|
10443 |
|
10444 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
10445 s4o.print("("); |
|
10446 return_type_symbol->accept(*this); |
|
10447 s4o.print(")__string_to_bit("); |
|
10448 IN_param_value->accept(*this); |
|
10449 s4o.print(")"); |
|
10450 return NULL; |
|
10451 |
|
10452 } |
|
10453 |
|
10454 ERROR; |
|
10455 } |
|
10456 |
|
10457 }/*function_string_to_word*/ |
|
10458 break; |
|
10459 |
|
10460 /**** |
|
10461 *STRING_TO_DWORD |
|
10462 */ |
|
10463 case function_string_to_dword : |
|
10464 { |
|
10465 symbol_c *last_type_symbol = NULL; |
|
10466 |
|
10467 { |
|
10468 identifier_c param_name("IN"); |
|
10469 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10470 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10471 |
|
10472 /* Get the value from a foo(<param_value>) style call */ |
|
10473 if (IN_param_value == NULL) |
|
10474 IN_param_value = function_call_param_iterator.next(); |
|
10475 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10476 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10477 |
|
10478 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10479 { |
|
10480 |
|
10481 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
10482 s4o.print("("); |
|
10483 return_type_symbol->accept(*this); |
|
10484 s4o.print(")__string_to_bit("); |
|
10485 IN_param_value->accept(*this); |
|
10486 s4o.print(")"); |
|
10487 return NULL; |
|
10488 |
|
10489 } |
|
10490 |
|
10491 ERROR; |
|
10492 } |
|
10493 |
|
10494 }/*function_string_to_dword*/ |
|
10495 break; |
|
10496 |
|
10497 /**** |
|
10498 *STRING_TO_LWORD |
|
10499 */ |
|
10500 case function_string_to_lword : |
|
10501 { |
|
10502 symbol_c *last_type_symbol = NULL; |
|
10503 |
|
10504 { |
|
10505 identifier_c param_name("IN"); |
|
10506 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10507 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10508 |
|
10509 /* Get the value from a foo(<param_value>) style call */ |
|
10510 if (IN_param_value == NULL) |
|
10511 IN_param_value = function_call_param_iterator.next(); |
|
10512 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10513 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10514 |
|
10515 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
10516 { |
|
10517 |
|
10518 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
10519 s4o.print("("); |
|
10520 return_type_symbol->accept(*this); |
|
10521 s4o.print(")__string_to_bit("); |
|
10522 IN_param_value->accept(*this); |
|
10523 s4o.print(")"); |
|
10524 return NULL; |
|
10525 |
|
10526 } |
|
10527 |
|
10528 ERROR; |
|
10529 } |
|
10530 |
|
10531 }/*function_string_to_lword*/ |
|
10532 break; |
|
10533 |
|
10534 /**** |
|
10535 *BYTE_TO_BOOL |
|
10536 */ |
|
10537 case function_byte_to_bool : |
|
10538 { |
|
10539 symbol_c *last_type_symbol = NULL; |
|
10540 |
|
10541 { |
|
10542 identifier_c param_name("IN"); |
|
10543 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10544 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10545 |
|
10546 /* Get the value from a foo(<param_value>) style call */ |
|
10547 if (IN_param_value == NULL) |
|
10548 IN_param_value = function_call_param_iterator.next(); |
|
10549 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10550 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10551 |
|
10552 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10553 { |
|
10554 |
|
10555 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
10556 s4o.print("("); |
|
10557 return_type_symbol->accept(*this); |
|
10558 s4o.print(")"); |
|
10559 IN_param_value->accept(*this); |
|
10560 return NULL; |
|
10561 |
|
10562 } |
|
10563 |
|
10564 ERROR; |
|
10565 } |
|
10566 |
|
10567 }/*function_byte_to_bool*/ |
|
10568 break; |
|
10569 |
|
10570 /**** |
|
10571 *BYTE_TO_SINT |
|
10572 */ |
|
10573 case function_byte_to_sint : |
|
10574 { |
|
10575 symbol_c *last_type_symbol = NULL; |
|
10576 |
|
10577 { |
|
10578 identifier_c param_name("IN"); |
|
10579 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10580 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10581 |
|
10582 /* Get the value from a foo(<param_value>) style call */ |
|
10583 if (IN_param_value == NULL) |
|
10584 IN_param_value = function_call_param_iterator.next(); |
|
10585 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10586 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10587 |
|
10588 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10589 { |
|
10590 |
|
10591 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
10592 s4o.print("("); |
|
10593 return_type_symbol->accept(*this); |
|
10594 s4o.print(")"); |
|
10595 IN_param_value->accept(*this); |
|
10596 return NULL; |
|
10597 |
|
10598 } |
|
10599 |
|
10600 ERROR; |
|
10601 } |
|
10602 |
|
10603 }/*function_byte_to_sint*/ |
|
10604 break; |
|
10605 |
|
10606 /**** |
|
10607 *BYTE_TO_INT |
|
10608 */ |
|
10609 case function_byte_to_int : |
|
10610 { |
|
10611 symbol_c *last_type_symbol = NULL; |
|
10612 |
|
10613 { |
|
10614 identifier_c param_name("IN"); |
|
10615 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10616 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10617 |
|
10618 /* Get the value from a foo(<param_value>) style call */ |
|
10619 if (IN_param_value == NULL) |
|
10620 IN_param_value = function_call_param_iterator.next(); |
|
10621 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10622 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10623 |
|
10624 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10625 { |
|
10626 |
|
10627 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
10628 s4o.print("("); |
|
10629 return_type_symbol->accept(*this); |
|
10630 s4o.print(")"); |
|
10631 IN_param_value->accept(*this); |
|
10632 return NULL; |
|
10633 |
|
10634 } |
|
10635 |
|
10636 ERROR; |
|
10637 } |
|
10638 |
|
10639 }/*function_byte_to_int*/ |
|
10640 break; |
|
10641 |
|
10642 /**** |
|
10643 *BYTE_TO_DINT |
|
10644 */ |
|
10645 case function_byte_to_dint : |
|
10646 { |
|
10647 symbol_c *last_type_symbol = NULL; |
|
10648 |
|
10649 { |
|
10650 identifier_c param_name("IN"); |
|
10651 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10652 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10653 |
|
10654 /* Get the value from a foo(<param_value>) style call */ |
|
10655 if (IN_param_value == NULL) |
|
10656 IN_param_value = function_call_param_iterator.next(); |
|
10657 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10658 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10659 |
|
10660 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10661 { |
|
10662 |
|
10663 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
10664 s4o.print("("); |
|
10665 return_type_symbol->accept(*this); |
|
10666 s4o.print(")"); |
|
10667 IN_param_value->accept(*this); |
|
10668 return NULL; |
|
10669 |
|
10670 } |
|
10671 |
|
10672 ERROR; |
|
10673 } |
|
10674 |
|
10675 }/*function_byte_to_dint*/ |
|
10676 break; |
|
10677 |
|
10678 /**** |
|
10679 *BYTE_TO_LINT |
|
10680 */ |
|
10681 case function_byte_to_lint : |
|
10682 { |
|
10683 symbol_c *last_type_symbol = NULL; |
|
10684 |
|
10685 { |
|
10686 identifier_c param_name("IN"); |
|
10687 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10688 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10689 |
|
10690 /* Get the value from a foo(<param_value>) style call */ |
|
10691 if (IN_param_value == NULL) |
|
10692 IN_param_value = function_call_param_iterator.next(); |
|
10693 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10694 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10695 |
|
10696 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10697 { |
|
10698 |
|
10699 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
10700 s4o.print("("); |
|
10701 return_type_symbol->accept(*this); |
|
10702 s4o.print(")"); |
|
10703 IN_param_value->accept(*this); |
|
10704 return NULL; |
|
10705 |
|
10706 } |
|
10707 |
|
10708 ERROR; |
|
10709 } |
|
10710 |
|
10711 }/*function_byte_to_lint*/ |
|
10712 break; |
|
10713 |
|
10714 /**** |
|
10715 *BYTE_TO_USINT |
|
10716 */ |
|
10717 case function_byte_to_usint : |
|
10718 { |
|
10719 symbol_c *last_type_symbol = NULL; |
|
10720 |
|
10721 { |
|
10722 identifier_c param_name("IN"); |
|
10723 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10724 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10725 |
|
10726 /* Get the value from a foo(<param_value>) style call */ |
|
10727 if (IN_param_value == NULL) |
|
10728 IN_param_value = function_call_param_iterator.next(); |
|
10729 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10730 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10731 |
|
10732 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10733 { |
|
10734 |
|
10735 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
10736 s4o.print("("); |
|
10737 return_type_symbol->accept(*this); |
|
10738 s4o.print(")"); |
|
10739 IN_param_value->accept(*this); |
|
10740 return NULL; |
|
10741 |
|
10742 } |
|
10743 |
|
10744 ERROR; |
|
10745 } |
|
10746 |
|
10747 }/*function_byte_to_usint*/ |
|
10748 break; |
|
10749 |
|
10750 /**** |
|
10751 *BYTE_TO_UINT |
|
10752 */ |
|
10753 case function_byte_to_uint : |
|
10754 { |
|
10755 symbol_c *last_type_symbol = NULL; |
|
10756 |
|
10757 { |
|
10758 identifier_c param_name("IN"); |
|
10759 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10760 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10761 |
|
10762 /* Get the value from a foo(<param_value>) style call */ |
|
10763 if (IN_param_value == NULL) |
|
10764 IN_param_value = function_call_param_iterator.next(); |
|
10765 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10766 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10767 |
|
10768 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10769 { |
|
10770 |
|
10771 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
10772 s4o.print("("); |
|
10773 return_type_symbol->accept(*this); |
|
10774 s4o.print(")"); |
|
10775 IN_param_value->accept(*this); |
|
10776 return NULL; |
|
10777 |
|
10778 } |
|
10779 |
|
10780 ERROR; |
|
10781 } |
|
10782 |
|
10783 }/*function_byte_to_uint*/ |
|
10784 break; |
|
10785 |
|
10786 /**** |
|
10787 *BYTE_TO_UDINT |
|
10788 */ |
|
10789 case function_byte_to_udint : |
|
10790 { |
|
10791 symbol_c *last_type_symbol = NULL; |
|
10792 |
|
10793 { |
|
10794 identifier_c param_name("IN"); |
|
10795 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10796 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10797 |
|
10798 /* Get the value from a foo(<param_value>) style call */ |
|
10799 if (IN_param_value == NULL) |
|
10800 IN_param_value = function_call_param_iterator.next(); |
|
10801 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10802 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10803 |
|
10804 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10805 { |
|
10806 |
|
10807 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
10808 s4o.print("("); |
|
10809 return_type_symbol->accept(*this); |
|
10810 s4o.print(")"); |
|
10811 IN_param_value->accept(*this); |
|
10812 return NULL; |
|
10813 |
|
10814 } |
|
10815 |
|
10816 ERROR; |
|
10817 } |
|
10818 |
|
10819 }/*function_byte_to_udint*/ |
|
10820 break; |
|
10821 |
|
10822 /**** |
|
10823 *BYTE_TO_ULINT |
|
10824 */ |
|
10825 case function_byte_to_ulint : |
|
10826 { |
|
10827 symbol_c *last_type_symbol = NULL; |
|
10828 |
|
10829 { |
|
10830 identifier_c param_name("IN"); |
|
10831 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10832 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10833 |
|
10834 /* Get the value from a foo(<param_value>) style call */ |
|
10835 if (IN_param_value == NULL) |
|
10836 IN_param_value = function_call_param_iterator.next(); |
|
10837 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10838 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10839 |
|
10840 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10841 { |
|
10842 |
|
10843 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
10844 s4o.print("("); |
|
10845 return_type_symbol->accept(*this); |
|
10846 s4o.print(")"); |
|
10847 IN_param_value->accept(*this); |
|
10848 return NULL; |
|
10849 |
|
10850 } |
|
10851 |
|
10852 ERROR; |
|
10853 } |
|
10854 |
|
10855 }/*function_byte_to_ulint*/ |
|
10856 break; |
|
10857 |
|
10858 /**** |
|
10859 *BYTE_TO_REAL |
|
10860 */ |
|
10861 case function_byte_to_real : |
|
10862 { |
|
10863 symbol_c *last_type_symbol = NULL; |
|
10864 |
|
10865 { |
|
10866 identifier_c param_name("IN"); |
|
10867 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10868 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10869 |
|
10870 /* Get the value from a foo(<param_value>) style call */ |
|
10871 if (IN_param_value == NULL) |
|
10872 IN_param_value = function_call_param_iterator.next(); |
|
10873 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10874 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10875 |
|
10876 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10877 { |
|
10878 |
|
10879 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
10880 s4o.print("("); |
|
10881 return_type_symbol->accept(*this); |
|
10882 s4o.print(")"); |
|
10883 IN_param_value->accept(*this); |
|
10884 return NULL; |
|
10885 |
|
10886 } |
|
10887 |
|
10888 ERROR; |
|
10889 } |
|
10890 |
|
10891 }/*function_byte_to_real*/ |
|
10892 break; |
|
10893 |
|
10894 /**** |
|
10895 *BYTE_TO_LREAL |
|
10896 */ |
|
10897 case function_byte_to_lreal : |
|
10898 { |
|
10899 symbol_c *last_type_symbol = NULL; |
|
10900 |
|
10901 { |
|
10902 identifier_c param_name("IN"); |
|
10903 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10904 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10905 |
|
10906 /* Get the value from a foo(<param_value>) style call */ |
|
10907 if (IN_param_value == NULL) |
|
10908 IN_param_value = function_call_param_iterator.next(); |
|
10909 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10910 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10911 |
|
10912 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10913 { |
|
10914 |
|
10915 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
10916 s4o.print("("); |
|
10917 return_type_symbol->accept(*this); |
|
10918 s4o.print(")"); |
|
10919 IN_param_value->accept(*this); |
|
10920 return NULL; |
|
10921 |
|
10922 } |
|
10923 |
|
10924 ERROR; |
|
10925 } |
|
10926 |
|
10927 }/*function_byte_to_lreal*/ |
|
10928 break; |
|
10929 |
|
10930 /**** |
|
10931 *BYTE_TO_TIME |
|
10932 */ |
|
10933 case function_byte_to_time : |
|
10934 { |
|
10935 symbol_c *last_type_symbol = NULL; |
|
10936 |
|
10937 { |
|
10938 identifier_c param_name("IN"); |
|
10939 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10940 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10941 |
|
10942 /* Get the value from a foo(<param_value>) style call */ |
|
10943 if (IN_param_value == NULL) |
|
10944 IN_param_value = function_call_param_iterator.next(); |
|
10945 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10946 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10947 |
|
10948 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10949 { |
|
10950 |
|
10951 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
10952 s4o.print("("); |
|
10953 return_type_symbol->accept(*this); |
|
10954 s4o.print(")__int_to_time("); |
|
10955 IN_param_value->accept(*this); |
|
10956 s4o.print(")"); |
|
10957 return NULL; |
|
10958 |
|
10959 } |
|
10960 |
|
10961 ERROR; |
|
10962 } |
|
10963 |
|
10964 }/*function_byte_to_time*/ |
|
10965 break; |
|
10966 |
|
10967 /**** |
|
10968 *BYTE_TO_DATE |
|
10969 */ |
|
10970 case function_byte_to_date : |
|
10971 { |
|
10972 symbol_c *last_type_symbol = NULL; |
|
10973 |
|
10974 { |
|
10975 identifier_c param_name("IN"); |
|
10976 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
10977 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
10978 |
|
10979 /* Get the value from a foo(<param_value>) style call */ |
|
10980 if (IN_param_value == NULL) |
|
10981 IN_param_value = function_call_param_iterator.next(); |
|
10982 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
10983 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
10984 |
|
10985 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
10986 { |
|
10987 |
|
10988 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
10989 s4o.print("("); |
|
10990 return_type_symbol->accept(*this); |
|
10991 s4o.print(")__int_to_time("); |
|
10992 IN_param_value->accept(*this); |
|
10993 s4o.print(")"); |
|
10994 return NULL; |
|
10995 |
|
10996 } |
|
10997 |
|
10998 ERROR; |
|
10999 } |
|
11000 |
|
11001 }/*function_byte_to_date*/ |
|
11002 break; |
|
11003 |
|
11004 /**** |
|
11005 *BYTE_TO_TOD |
|
11006 */ |
|
11007 case function_byte_to_tod : |
|
11008 { |
|
11009 symbol_c *last_type_symbol = NULL; |
|
11010 |
|
11011 { |
|
11012 identifier_c param_name("IN"); |
|
11013 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11014 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11015 |
|
11016 /* Get the value from a foo(<param_value>) style call */ |
|
11017 if (IN_param_value == NULL) |
|
11018 IN_param_value = function_call_param_iterator.next(); |
|
11019 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11020 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11021 |
|
11022 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11023 { |
|
11024 |
|
11025 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
11026 s4o.print("("); |
|
11027 return_type_symbol->accept(*this); |
|
11028 s4o.print(")__int_to_time("); |
|
11029 IN_param_value->accept(*this); |
|
11030 s4o.print(")"); |
|
11031 return NULL; |
|
11032 |
|
11033 } |
|
11034 |
|
11035 ERROR; |
|
11036 } |
|
11037 |
|
11038 }/*function_byte_to_tod*/ |
|
11039 break; |
|
11040 |
|
11041 /**** |
|
11042 *BYTE_TO_DT |
|
11043 */ |
|
11044 case function_byte_to_dt : |
|
11045 { |
|
11046 symbol_c *last_type_symbol = NULL; |
|
11047 |
|
11048 { |
|
11049 identifier_c param_name("IN"); |
|
11050 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11051 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11052 |
|
11053 /* Get the value from a foo(<param_value>) style call */ |
|
11054 if (IN_param_value == NULL) |
|
11055 IN_param_value = function_call_param_iterator.next(); |
|
11056 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11057 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11058 |
|
11059 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11060 { |
|
11061 |
|
11062 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
11063 s4o.print("("); |
|
11064 return_type_symbol->accept(*this); |
|
11065 s4o.print(")__int_to_time("); |
|
11066 IN_param_value->accept(*this); |
|
11067 s4o.print(")"); |
|
11068 return NULL; |
|
11069 |
|
11070 } |
|
11071 |
|
11072 ERROR; |
|
11073 } |
|
11074 |
|
11075 }/*function_byte_to_dt*/ |
|
11076 break; |
|
11077 |
|
11078 /**** |
|
11079 *BYTE_TO_STRING |
|
11080 */ |
|
11081 case function_byte_to_string : |
|
11082 { |
|
11083 symbol_c *last_type_symbol = NULL; |
|
11084 |
|
11085 { |
|
11086 identifier_c param_name("IN"); |
|
11087 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11088 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11089 |
|
11090 /* Get the value from a foo(<param_value>) style call */ |
|
11091 if (IN_param_value == NULL) |
|
11092 IN_param_value = function_call_param_iterator.next(); |
|
11093 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11094 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11095 |
|
11096 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11097 { |
|
11098 |
|
11099 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
11100 s4o.print("("); |
|
11101 return_type_symbol->accept(*this); |
|
11102 s4o.print(")__bit_to_string("); |
|
11103 IN_param_value->accept(*this); |
|
11104 s4o.print(")"); |
|
11105 return NULL; |
|
11106 |
|
11107 } |
|
11108 |
|
11109 ERROR; |
|
11110 } |
|
11111 |
|
11112 }/*function_byte_to_string*/ |
|
11113 break; |
|
11114 |
|
11115 /**** |
|
11116 *BYTE_TO_WORD |
|
11117 */ |
|
11118 case function_byte_to_word : |
|
11119 { |
|
11120 symbol_c *last_type_symbol = NULL; |
|
11121 |
|
11122 { |
|
11123 identifier_c param_name("IN"); |
|
11124 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11125 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11126 |
|
11127 /* Get the value from a foo(<param_value>) style call */ |
|
11128 if (IN_param_value == NULL) |
|
11129 IN_param_value = function_call_param_iterator.next(); |
|
11130 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11131 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11132 |
|
11133 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11134 { |
|
11135 |
|
11136 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
11137 s4o.print("("); |
|
11138 return_type_symbol->accept(*this); |
|
11139 s4o.print(")"); |
|
11140 IN_param_value->accept(*this); |
|
11141 return NULL; |
|
11142 |
|
11143 } |
|
11144 |
|
11145 ERROR; |
|
11146 } |
|
11147 |
|
11148 }/*function_byte_to_word*/ |
|
11149 break; |
|
11150 |
|
11151 /**** |
|
11152 *BYTE_TO_DWORD |
|
11153 */ |
|
11154 case function_byte_to_dword : |
|
11155 { |
|
11156 symbol_c *last_type_symbol = NULL; |
|
11157 |
|
11158 { |
|
11159 identifier_c param_name("IN"); |
|
11160 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11161 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11162 |
|
11163 /* Get the value from a foo(<param_value>) style call */ |
|
11164 if (IN_param_value == NULL) |
|
11165 IN_param_value = function_call_param_iterator.next(); |
|
11166 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11167 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11168 |
|
11169 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11170 { |
|
11171 |
|
11172 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
11173 s4o.print("("); |
|
11174 return_type_symbol->accept(*this); |
|
11175 s4o.print(")"); |
|
11176 IN_param_value->accept(*this); |
|
11177 return NULL; |
|
11178 |
|
11179 } |
|
11180 |
|
11181 ERROR; |
|
11182 } |
|
11183 |
|
11184 }/*function_byte_to_dword*/ |
|
11185 break; |
|
11186 |
|
11187 /**** |
|
11188 *BYTE_TO_LWORD |
|
11189 */ |
|
11190 case function_byte_to_lword : |
|
11191 { |
|
11192 symbol_c *last_type_symbol = NULL; |
|
11193 |
|
11194 { |
|
11195 identifier_c param_name("IN"); |
|
11196 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11197 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11198 |
|
11199 /* Get the value from a foo(<param_value>) style call */ |
|
11200 if (IN_param_value == NULL) |
|
11201 IN_param_value = function_call_param_iterator.next(); |
|
11202 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11203 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11204 |
|
11205 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
11206 { |
|
11207 |
|
11208 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
11209 s4o.print("("); |
|
11210 return_type_symbol->accept(*this); |
|
11211 s4o.print(")"); |
|
11212 IN_param_value->accept(*this); |
|
11213 return NULL; |
|
11214 |
|
11215 } |
|
11216 |
|
11217 ERROR; |
|
11218 } |
|
11219 |
|
11220 }/*function_byte_to_lword*/ |
|
11221 break; |
|
11222 |
|
11223 /**** |
|
11224 *WORD_TO_BOOL |
|
11225 */ |
|
11226 case function_word_to_bool : |
|
11227 { |
|
11228 symbol_c *last_type_symbol = NULL; |
|
11229 |
|
11230 { |
|
11231 identifier_c param_name("IN"); |
|
11232 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11233 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11234 |
|
11235 /* Get the value from a foo(<param_value>) style call */ |
|
11236 if (IN_param_value == NULL) |
|
11237 IN_param_value = function_call_param_iterator.next(); |
|
11238 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11239 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11240 |
|
11241 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11242 { |
|
11243 |
|
11244 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
11245 s4o.print("("); |
|
11246 return_type_symbol->accept(*this); |
|
11247 s4o.print(")"); |
|
11248 IN_param_value->accept(*this); |
|
11249 return NULL; |
|
11250 |
|
11251 } |
|
11252 |
|
11253 ERROR; |
|
11254 } |
|
11255 |
|
11256 }/*function_word_to_bool*/ |
|
11257 break; |
|
11258 |
|
11259 /**** |
|
11260 *WORD_TO_SINT |
|
11261 */ |
|
11262 case function_word_to_sint : |
|
11263 { |
|
11264 symbol_c *last_type_symbol = NULL; |
|
11265 |
|
11266 { |
|
11267 identifier_c param_name("IN"); |
|
11268 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11269 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11270 |
|
11271 /* Get the value from a foo(<param_value>) style call */ |
|
11272 if (IN_param_value == NULL) |
|
11273 IN_param_value = function_call_param_iterator.next(); |
|
11274 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11275 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11276 |
|
11277 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11278 { |
|
11279 |
|
11280 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
11281 s4o.print("("); |
|
11282 return_type_symbol->accept(*this); |
|
11283 s4o.print(")"); |
|
11284 IN_param_value->accept(*this); |
|
11285 return NULL; |
|
11286 |
|
11287 } |
|
11288 |
|
11289 ERROR; |
|
11290 } |
|
11291 |
|
11292 }/*function_word_to_sint*/ |
|
11293 break; |
|
11294 |
|
11295 /**** |
|
11296 *WORD_TO_INT |
|
11297 */ |
|
11298 case function_word_to_int : |
|
11299 { |
|
11300 symbol_c *last_type_symbol = NULL; |
|
11301 |
|
11302 { |
|
11303 identifier_c param_name("IN"); |
|
11304 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11305 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11306 |
|
11307 /* Get the value from a foo(<param_value>) style call */ |
|
11308 if (IN_param_value == NULL) |
|
11309 IN_param_value = function_call_param_iterator.next(); |
|
11310 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11311 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11312 |
|
11313 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11314 { |
|
11315 |
|
11316 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
11317 s4o.print("("); |
|
11318 return_type_symbol->accept(*this); |
|
11319 s4o.print(")"); |
|
11320 IN_param_value->accept(*this); |
|
11321 return NULL; |
|
11322 |
|
11323 } |
|
11324 |
|
11325 ERROR; |
|
11326 } |
|
11327 |
|
11328 }/*function_word_to_int*/ |
|
11329 break; |
|
11330 |
|
11331 /**** |
|
11332 *WORD_TO_DINT |
|
11333 */ |
|
11334 case function_word_to_dint : |
|
11335 { |
|
11336 symbol_c *last_type_symbol = NULL; |
|
11337 |
|
11338 { |
|
11339 identifier_c param_name("IN"); |
|
11340 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11341 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11342 |
|
11343 /* Get the value from a foo(<param_value>) style call */ |
|
11344 if (IN_param_value == NULL) |
|
11345 IN_param_value = function_call_param_iterator.next(); |
|
11346 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11347 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11348 |
|
11349 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11350 { |
|
11351 |
|
11352 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
11353 s4o.print("("); |
|
11354 return_type_symbol->accept(*this); |
|
11355 s4o.print(")"); |
|
11356 IN_param_value->accept(*this); |
|
11357 return NULL; |
|
11358 |
|
11359 } |
|
11360 |
|
11361 ERROR; |
|
11362 } |
|
11363 |
|
11364 }/*function_word_to_dint*/ |
|
11365 break; |
|
11366 |
|
11367 /**** |
|
11368 *WORD_TO_LINT |
|
11369 */ |
|
11370 case function_word_to_lint : |
|
11371 { |
|
11372 symbol_c *last_type_symbol = NULL; |
|
11373 |
|
11374 { |
|
11375 identifier_c param_name("IN"); |
|
11376 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11377 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11378 |
|
11379 /* Get the value from a foo(<param_value>) style call */ |
|
11380 if (IN_param_value == NULL) |
|
11381 IN_param_value = function_call_param_iterator.next(); |
|
11382 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11383 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11384 |
|
11385 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11386 { |
|
11387 |
|
11388 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
11389 s4o.print("("); |
|
11390 return_type_symbol->accept(*this); |
|
11391 s4o.print(")"); |
|
11392 IN_param_value->accept(*this); |
|
11393 return NULL; |
|
11394 |
|
11395 } |
|
11396 |
|
11397 ERROR; |
|
11398 } |
|
11399 |
|
11400 }/*function_word_to_lint*/ |
|
11401 break; |
|
11402 |
|
11403 /**** |
|
11404 *WORD_TO_USINT |
|
11405 */ |
|
11406 case function_word_to_usint : |
|
11407 { |
|
11408 symbol_c *last_type_symbol = NULL; |
|
11409 |
|
11410 { |
|
11411 identifier_c param_name("IN"); |
|
11412 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11413 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11414 |
|
11415 /* Get the value from a foo(<param_value>) style call */ |
|
11416 if (IN_param_value == NULL) |
|
11417 IN_param_value = function_call_param_iterator.next(); |
|
11418 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11419 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11420 |
|
11421 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11422 { |
|
11423 |
|
11424 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
11425 s4o.print("("); |
|
11426 return_type_symbol->accept(*this); |
|
11427 s4o.print(")"); |
|
11428 IN_param_value->accept(*this); |
|
11429 return NULL; |
|
11430 |
|
11431 } |
|
11432 |
|
11433 ERROR; |
|
11434 } |
|
11435 |
|
11436 }/*function_word_to_usint*/ |
|
11437 break; |
|
11438 |
|
11439 /**** |
|
11440 *WORD_TO_UINT |
|
11441 */ |
|
11442 case function_word_to_uint : |
|
11443 { |
|
11444 symbol_c *last_type_symbol = NULL; |
|
11445 |
|
11446 { |
|
11447 identifier_c param_name("IN"); |
|
11448 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11449 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11450 |
|
11451 /* Get the value from a foo(<param_value>) style call */ |
|
11452 if (IN_param_value == NULL) |
|
11453 IN_param_value = function_call_param_iterator.next(); |
|
11454 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11455 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11456 |
|
11457 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11458 { |
|
11459 |
|
11460 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
11461 s4o.print("("); |
|
11462 return_type_symbol->accept(*this); |
|
11463 s4o.print(")"); |
|
11464 IN_param_value->accept(*this); |
|
11465 return NULL; |
|
11466 |
|
11467 } |
|
11468 |
|
11469 ERROR; |
|
11470 } |
|
11471 |
|
11472 }/*function_word_to_uint*/ |
|
11473 break; |
|
11474 |
|
11475 /**** |
|
11476 *WORD_TO_UDINT |
|
11477 */ |
|
11478 case function_word_to_udint : |
|
11479 { |
|
11480 symbol_c *last_type_symbol = NULL; |
|
11481 |
|
11482 { |
|
11483 identifier_c param_name("IN"); |
|
11484 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11485 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11486 |
|
11487 /* Get the value from a foo(<param_value>) style call */ |
|
11488 if (IN_param_value == NULL) |
|
11489 IN_param_value = function_call_param_iterator.next(); |
|
11490 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11491 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11492 |
|
11493 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11494 { |
|
11495 |
|
11496 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
11497 s4o.print("("); |
|
11498 return_type_symbol->accept(*this); |
|
11499 s4o.print(")"); |
|
11500 IN_param_value->accept(*this); |
|
11501 return NULL; |
|
11502 |
|
11503 } |
|
11504 |
|
11505 ERROR; |
|
11506 } |
|
11507 |
|
11508 }/*function_word_to_udint*/ |
|
11509 break; |
|
11510 |
|
11511 /**** |
|
11512 *WORD_TO_ULINT |
|
11513 */ |
|
11514 case function_word_to_ulint : |
|
11515 { |
|
11516 symbol_c *last_type_symbol = NULL; |
|
11517 |
|
11518 { |
|
11519 identifier_c param_name("IN"); |
|
11520 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11521 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11522 |
|
11523 /* Get the value from a foo(<param_value>) style call */ |
|
11524 if (IN_param_value == NULL) |
|
11525 IN_param_value = function_call_param_iterator.next(); |
|
11526 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11527 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11528 |
|
11529 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11530 { |
|
11531 |
|
11532 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
11533 s4o.print("("); |
|
11534 return_type_symbol->accept(*this); |
|
11535 s4o.print(")"); |
|
11536 IN_param_value->accept(*this); |
|
11537 return NULL; |
|
11538 |
|
11539 } |
|
11540 |
|
11541 ERROR; |
|
11542 } |
|
11543 |
|
11544 }/*function_word_to_ulint*/ |
|
11545 break; |
|
11546 |
|
11547 /**** |
|
11548 *WORD_TO_REAL |
|
11549 */ |
|
11550 case function_word_to_real : |
|
11551 { |
|
11552 symbol_c *last_type_symbol = NULL; |
|
11553 |
|
11554 { |
|
11555 identifier_c param_name("IN"); |
|
11556 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11557 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11558 |
|
11559 /* Get the value from a foo(<param_value>) style call */ |
|
11560 if (IN_param_value == NULL) |
|
11561 IN_param_value = function_call_param_iterator.next(); |
|
11562 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11563 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11564 |
|
11565 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11566 { |
|
11567 |
|
11568 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
11569 s4o.print("("); |
|
11570 return_type_symbol->accept(*this); |
|
11571 s4o.print(")"); |
|
11572 IN_param_value->accept(*this); |
|
11573 return NULL; |
|
11574 |
|
11575 } |
|
11576 |
|
11577 ERROR; |
|
11578 } |
|
11579 |
|
11580 }/*function_word_to_real*/ |
|
11581 break; |
|
11582 |
|
11583 /**** |
|
11584 *WORD_TO_LREAL |
|
11585 */ |
|
11586 case function_word_to_lreal : |
|
11587 { |
|
11588 symbol_c *last_type_symbol = NULL; |
|
11589 |
|
11590 { |
|
11591 identifier_c param_name("IN"); |
|
11592 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11593 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11594 |
|
11595 /* Get the value from a foo(<param_value>) style call */ |
|
11596 if (IN_param_value == NULL) |
|
11597 IN_param_value = function_call_param_iterator.next(); |
|
11598 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11599 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11600 |
|
11601 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11602 { |
|
11603 |
|
11604 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
11605 s4o.print("("); |
|
11606 return_type_symbol->accept(*this); |
|
11607 s4o.print(")"); |
|
11608 IN_param_value->accept(*this); |
|
11609 return NULL; |
|
11610 |
|
11611 } |
|
11612 |
|
11613 ERROR; |
|
11614 } |
|
11615 |
|
11616 }/*function_word_to_lreal*/ |
|
11617 break; |
|
11618 |
|
11619 /**** |
|
11620 *WORD_TO_TIME |
|
11621 */ |
|
11622 case function_word_to_time : |
|
11623 { |
|
11624 symbol_c *last_type_symbol = NULL; |
|
11625 |
|
11626 { |
|
11627 identifier_c param_name("IN"); |
|
11628 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11629 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11630 |
|
11631 /* Get the value from a foo(<param_value>) style call */ |
|
11632 if (IN_param_value == NULL) |
|
11633 IN_param_value = function_call_param_iterator.next(); |
|
11634 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11635 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11636 |
|
11637 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11638 { |
|
11639 |
|
11640 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
11641 s4o.print("("); |
|
11642 return_type_symbol->accept(*this); |
|
11643 s4o.print(")__int_to_time("); |
|
11644 IN_param_value->accept(*this); |
|
11645 s4o.print(")"); |
|
11646 return NULL; |
|
11647 |
|
11648 } |
|
11649 |
|
11650 ERROR; |
|
11651 } |
|
11652 |
|
11653 }/*function_word_to_time*/ |
|
11654 break; |
|
11655 |
|
11656 /**** |
|
11657 *WORD_TO_DATE |
|
11658 */ |
|
11659 case function_word_to_date : |
|
11660 { |
|
11661 symbol_c *last_type_symbol = NULL; |
|
11662 |
|
11663 { |
|
11664 identifier_c param_name("IN"); |
|
11665 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11666 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11667 |
|
11668 /* Get the value from a foo(<param_value>) style call */ |
|
11669 if (IN_param_value == NULL) |
|
11670 IN_param_value = function_call_param_iterator.next(); |
|
11671 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11672 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11673 |
|
11674 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11675 { |
|
11676 |
|
11677 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
11678 s4o.print("("); |
|
11679 return_type_symbol->accept(*this); |
|
11680 s4o.print(")__int_to_time("); |
|
11681 IN_param_value->accept(*this); |
|
11682 s4o.print(")"); |
|
11683 return NULL; |
|
11684 |
|
11685 } |
|
11686 |
|
11687 ERROR; |
|
11688 } |
|
11689 |
|
11690 }/*function_word_to_date*/ |
|
11691 break; |
|
11692 |
|
11693 /**** |
|
11694 *WORD_TO_TOD |
|
11695 */ |
|
11696 case function_word_to_tod : |
|
11697 { |
|
11698 symbol_c *last_type_symbol = NULL; |
|
11699 |
|
11700 { |
|
11701 identifier_c param_name("IN"); |
|
11702 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11703 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11704 |
|
11705 /* Get the value from a foo(<param_value>) style call */ |
|
11706 if (IN_param_value == NULL) |
|
11707 IN_param_value = function_call_param_iterator.next(); |
|
11708 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11709 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11710 |
|
11711 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11712 { |
|
11713 |
|
11714 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
11715 s4o.print("("); |
|
11716 return_type_symbol->accept(*this); |
|
11717 s4o.print(")__int_to_time("); |
|
11718 IN_param_value->accept(*this); |
|
11719 s4o.print(")"); |
|
11720 return NULL; |
|
11721 |
|
11722 } |
|
11723 |
|
11724 ERROR; |
|
11725 } |
|
11726 |
|
11727 }/*function_word_to_tod*/ |
|
11728 break; |
|
11729 |
|
11730 /**** |
|
11731 *WORD_TO_DT |
|
11732 */ |
|
11733 case function_word_to_dt : |
|
11734 { |
|
11735 symbol_c *last_type_symbol = NULL; |
|
11736 |
|
11737 { |
|
11738 identifier_c param_name("IN"); |
|
11739 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11740 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11741 |
|
11742 /* Get the value from a foo(<param_value>) style call */ |
|
11743 if (IN_param_value == NULL) |
|
11744 IN_param_value = function_call_param_iterator.next(); |
|
11745 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11746 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11747 |
|
11748 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11749 { |
|
11750 |
|
11751 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
11752 s4o.print("("); |
|
11753 return_type_symbol->accept(*this); |
|
11754 s4o.print(")__int_to_time("); |
|
11755 IN_param_value->accept(*this); |
|
11756 s4o.print(")"); |
|
11757 return NULL; |
|
11758 |
|
11759 } |
|
11760 |
|
11761 ERROR; |
|
11762 } |
|
11763 |
|
11764 }/*function_word_to_dt*/ |
|
11765 break; |
|
11766 |
|
11767 /**** |
|
11768 *WORD_TO_STRING |
|
11769 */ |
|
11770 case function_word_to_string : |
|
11771 { |
|
11772 symbol_c *last_type_symbol = NULL; |
|
11773 |
|
11774 { |
|
11775 identifier_c param_name("IN"); |
|
11776 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11777 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11778 |
|
11779 /* Get the value from a foo(<param_value>) style call */ |
|
11780 if (IN_param_value == NULL) |
|
11781 IN_param_value = function_call_param_iterator.next(); |
|
11782 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11783 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11784 |
|
11785 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11786 { |
|
11787 |
|
11788 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
11789 s4o.print("("); |
|
11790 return_type_symbol->accept(*this); |
|
11791 s4o.print(")__bit_to_string("); |
|
11792 IN_param_value->accept(*this); |
|
11793 s4o.print(")"); |
|
11794 return NULL; |
|
11795 |
|
11796 } |
|
11797 |
|
11798 ERROR; |
|
11799 } |
|
11800 |
|
11801 }/*function_word_to_string*/ |
|
11802 break; |
|
11803 |
|
11804 /**** |
|
11805 *WORD_TO_BYTE |
|
11806 */ |
|
11807 case function_word_to_byte : |
|
11808 { |
|
11809 symbol_c *last_type_symbol = NULL; |
|
11810 |
|
11811 { |
|
11812 identifier_c param_name("IN"); |
|
11813 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11814 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11815 |
|
11816 /* Get the value from a foo(<param_value>) style call */ |
|
11817 if (IN_param_value == NULL) |
|
11818 IN_param_value = function_call_param_iterator.next(); |
|
11819 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11820 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11821 |
|
11822 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11823 { |
|
11824 |
|
11825 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
11826 s4o.print("("); |
|
11827 return_type_symbol->accept(*this); |
|
11828 s4o.print(")"); |
|
11829 IN_param_value->accept(*this); |
|
11830 return NULL; |
|
11831 |
|
11832 } |
|
11833 |
|
11834 ERROR; |
|
11835 } |
|
11836 |
|
11837 }/*function_word_to_byte*/ |
|
11838 break; |
|
11839 |
|
11840 /**** |
|
11841 *WORD_TO_DWORD |
|
11842 */ |
|
11843 case function_word_to_dword : |
|
11844 { |
|
11845 symbol_c *last_type_symbol = NULL; |
|
11846 |
|
11847 { |
|
11848 identifier_c param_name("IN"); |
|
11849 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11850 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11851 |
|
11852 /* Get the value from a foo(<param_value>) style call */ |
|
11853 if (IN_param_value == NULL) |
|
11854 IN_param_value = function_call_param_iterator.next(); |
|
11855 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11856 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11857 |
|
11858 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11859 { |
|
11860 |
|
11861 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
11862 s4o.print("("); |
|
11863 return_type_symbol->accept(*this); |
|
11864 s4o.print(")"); |
|
11865 IN_param_value->accept(*this); |
|
11866 return NULL; |
|
11867 |
|
11868 } |
|
11869 |
|
11870 ERROR; |
|
11871 } |
|
11872 |
|
11873 }/*function_word_to_dword*/ |
|
11874 break; |
|
11875 |
|
11876 /**** |
|
11877 *WORD_TO_LWORD |
|
11878 */ |
|
11879 case function_word_to_lword : |
|
11880 { |
|
11881 symbol_c *last_type_symbol = NULL; |
|
11882 |
|
11883 { |
|
11884 identifier_c param_name("IN"); |
|
11885 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11886 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11887 |
|
11888 /* Get the value from a foo(<param_value>) style call */ |
|
11889 if (IN_param_value == NULL) |
|
11890 IN_param_value = function_call_param_iterator.next(); |
|
11891 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11892 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11893 |
|
11894 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
11895 { |
|
11896 |
|
11897 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
11898 s4o.print("("); |
|
11899 return_type_symbol->accept(*this); |
|
11900 s4o.print(")"); |
|
11901 IN_param_value->accept(*this); |
|
11902 return NULL; |
|
11903 |
|
11904 } |
|
11905 |
|
11906 ERROR; |
|
11907 } |
|
11908 |
|
11909 }/*function_word_to_lword*/ |
|
11910 break; |
|
11911 |
|
11912 /**** |
|
11913 *DWORD_TO_BOOL |
|
11914 */ |
|
11915 case function_dword_to_bool : |
|
11916 { |
|
11917 symbol_c *last_type_symbol = NULL; |
|
11918 |
|
11919 { |
|
11920 identifier_c param_name("IN"); |
|
11921 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11922 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11923 |
|
11924 /* Get the value from a foo(<param_value>) style call */ |
|
11925 if (IN_param_value == NULL) |
|
11926 IN_param_value = function_call_param_iterator.next(); |
|
11927 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11928 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11929 |
|
11930 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
11931 { |
|
11932 |
|
11933 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
11934 s4o.print("("); |
|
11935 return_type_symbol->accept(*this); |
|
11936 s4o.print(")"); |
|
11937 IN_param_value->accept(*this); |
|
11938 return NULL; |
|
11939 |
|
11940 } |
|
11941 |
|
11942 ERROR; |
|
11943 } |
|
11944 |
|
11945 }/*function_dword_to_bool*/ |
|
11946 break; |
|
11947 |
|
11948 /**** |
|
11949 *DWORD_TO_SINT |
|
11950 */ |
|
11951 case function_dword_to_sint : |
|
11952 { |
|
11953 symbol_c *last_type_symbol = NULL; |
|
11954 |
|
11955 { |
|
11956 identifier_c param_name("IN"); |
|
11957 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11958 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11959 |
|
11960 /* Get the value from a foo(<param_value>) style call */ |
|
11961 if (IN_param_value == NULL) |
|
11962 IN_param_value = function_call_param_iterator.next(); |
|
11963 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
11964 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
11965 |
|
11966 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
11967 { |
|
11968 |
|
11969 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
11970 s4o.print("("); |
|
11971 return_type_symbol->accept(*this); |
|
11972 s4o.print(")"); |
|
11973 IN_param_value->accept(*this); |
|
11974 return NULL; |
|
11975 |
|
11976 } |
|
11977 |
|
11978 ERROR; |
|
11979 } |
|
11980 |
|
11981 }/*function_dword_to_sint*/ |
|
11982 break; |
|
11983 |
|
11984 /**** |
|
11985 *DWORD_TO_INT |
|
11986 */ |
|
11987 case function_dword_to_int : |
|
11988 { |
|
11989 symbol_c *last_type_symbol = NULL; |
|
11990 |
|
11991 { |
|
11992 identifier_c param_name("IN"); |
|
11993 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
11994 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
11995 |
|
11996 /* Get the value from a foo(<param_value>) style call */ |
|
11997 if (IN_param_value == NULL) |
|
11998 IN_param_value = function_call_param_iterator.next(); |
|
11999 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12000 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12001 |
|
12002 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12003 { |
|
12004 |
|
12005 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
12006 s4o.print("("); |
|
12007 return_type_symbol->accept(*this); |
|
12008 s4o.print(")"); |
|
12009 IN_param_value->accept(*this); |
|
12010 return NULL; |
|
12011 |
|
12012 } |
|
12013 |
|
12014 ERROR; |
|
12015 } |
|
12016 |
|
12017 }/*function_dword_to_int*/ |
|
12018 break; |
|
12019 |
|
12020 /**** |
|
12021 *DWORD_TO_DINT |
|
12022 */ |
|
12023 case function_dword_to_dint : |
|
12024 { |
|
12025 symbol_c *last_type_symbol = NULL; |
|
12026 |
|
12027 { |
|
12028 identifier_c param_name("IN"); |
|
12029 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12030 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12031 |
|
12032 /* Get the value from a foo(<param_value>) style call */ |
|
12033 if (IN_param_value == NULL) |
|
12034 IN_param_value = function_call_param_iterator.next(); |
|
12035 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12036 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12037 |
|
12038 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12039 { |
|
12040 |
|
12041 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
12042 s4o.print("("); |
|
12043 return_type_symbol->accept(*this); |
|
12044 s4o.print(")"); |
|
12045 IN_param_value->accept(*this); |
|
12046 return NULL; |
|
12047 |
|
12048 } |
|
12049 |
|
12050 ERROR; |
|
12051 } |
|
12052 |
|
12053 }/*function_dword_to_dint*/ |
|
12054 break; |
|
12055 |
|
12056 /**** |
|
12057 *DWORD_TO_LINT |
|
12058 */ |
|
12059 case function_dword_to_lint : |
|
12060 { |
|
12061 symbol_c *last_type_symbol = NULL; |
|
12062 |
|
12063 { |
|
12064 identifier_c param_name("IN"); |
|
12065 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12066 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12067 |
|
12068 /* Get the value from a foo(<param_value>) style call */ |
|
12069 if (IN_param_value == NULL) |
|
12070 IN_param_value = function_call_param_iterator.next(); |
|
12071 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12072 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12073 |
|
12074 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12075 { |
|
12076 |
|
12077 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
12078 s4o.print("("); |
|
12079 return_type_symbol->accept(*this); |
|
12080 s4o.print(")"); |
|
12081 IN_param_value->accept(*this); |
|
12082 return NULL; |
|
12083 |
|
12084 } |
|
12085 |
|
12086 ERROR; |
|
12087 } |
|
12088 |
|
12089 }/*function_dword_to_lint*/ |
|
12090 break; |
|
12091 |
|
12092 /**** |
|
12093 *DWORD_TO_USINT |
|
12094 */ |
|
12095 case function_dword_to_usint : |
|
12096 { |
|
12097 symbol_c *last_type_symbol = NULL; |
|
12098 |
|
12099 { |
|
12100 identifier_c param_name("IN"); |
|
12101 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12102 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12103 |
|
12104 /* Get the value from a foo(<param_value>) style call */ |
|
12105 if (IN_param_value == NULL) |
|
12106 IN_param_value = function_call_param_iterator.next(); |
|
12107 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12108 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12109 |
|
12110 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12111 { |
|
12112 |
|
12113 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
12114 s4o.print("("); |
|
12115 return_type_symbol->accept(*this); |
|
12116 s4o.print(")"); |
|
12117 IN_param_value->accept(*this); |
|
12118 return NULL; |
|
12119 |
|
12120 } |
|
12121 |
|
12122 ERROR; |
|
12123 } |
|
12124 |
|
12125 }/*function_dword_to_usint*/ |
|
12126 break; |
|
12127 |
|
12128 /**** |
|
12129 *DWORD_TO_UINT |
|
12130 */ |
|
12131 case function_dword_to_uint : |
|
12132 { |
|
12133 symbol_c *last_type_symbol = NULL; |
|
12134 |
|
12135 { |
|
12136 identifier_c param_name("IN"); |
|
12137 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12138 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12139 |
|
12140 /* Get the value from a foo(<param_value>) style call */ |
|
12141 if (IN_param_value == NULL) |
|
12142 IN_param_value = function_call_param_iterator.next(); |
|
12143 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12144 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12145 |
|
12146 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12147 { |
|
12148 |
|
12149 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
12150 s4o.print("("); |
|
12151 return_type_symbol->accept(*this); |
|
12152 s4o.print(")"); |
|
12153 IN_param_value->accept(*this); |
|
12154 return NULL; |
|
12155 |
|
12156 } |
|
12157 |
|
12158 ERROR; |
|
12159 } |
|
12160 |
|
12161 }/*function_dword_to_uint*/ |
|
12162 break; |
|
12163 |
|
12164 /**** |
|
12165 *DWORD_TO_UDINT |
|
12166 */ |
|
12167 case function_dword_to_udint : |
|
12168 { |
|
12169 symbol_c *last_type_symbol = NULL; |
|
12170 |
|
12171 { |
|
12172 identifier_c param_name("IN"); |
|
12173 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12174 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12175 |
|
12176 /* Get the value from a foo(<param_value>) style call */ |
|
12177 if (IN_param_value == NULL) |
|
12178 IN_param_value = function_call_param_iterator.next(); |
|
12179 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12180 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12181 |
|
12182 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12183 { |
|
12184 |
|
12185 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
12186 s4o.print("("); |
|
12187 return_type_symbol->accept(*this); |
|
12188 s4o.print(")"); |
|
12189 IN_param_value->accept(*this); |
|
12190 return NULL; |
|
12191 |
|
12192 } |
|
12193 |
|
12194 ERROR; |
|
12195 } |
|
12196 |
|
12197 }/*function_dword_to_udint*/ |
|
12198 break; |
|
12199 |
|
12200 /**** |
|
12201 *DWORD_TO_ULINT |
|
12202 */ |
|
12203 case function_dword_to_ulint : |
|
12204 { |
|
12205 symbol_c *last_type_symbol = NULL; |
|
12206 |
|
12207 { |
|
12208 identifier_c param_name("IN"); |
|
12209 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12210 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12211 |
|
12212 /* Get the value from a foo(<param_value>) style call */ |
|
12213 if (IN_param_value == NULL) |
|
12214 IN_param_value = function_call_param_iterator.next(); |
|
12215 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12216 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12217 |
|
12218 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12219 { |
|
12220 |
|
12221 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
12222 s4o.print("("); |
|
12223 return_type_symbol->accept(*this); |
|
12224 s4o.print(")"); |
|
12225 IN_param_value->accept(*this); |
|
12226 return NULL; |
|
12227 |
|
12228 } |
|
12229 |
|
12230 ERROR; |
|
12231 } |
|
12232 |
|
12233 }/*function_dword_to_ulint*/ |
|
12234 break; |
|
12235 |
|
12236 /**** |
|
12237 *DWORD_TO_REAL |
|
12238 */ |
|
12239 case function_dword_to_real : |
|
12240 { |
|
12241 symbol_c *last_type_symbol = NULL; |
|
12242 |
|
12243 { |
|
12244 identifier_c param_name("IN"); |
|
12245 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12246 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12247 |
|
12248 /* Get the value from a foo(<param_value>) style call */ |
|
12249 if (IN_param_value == NULL) |
|
12250 IN_param_value = function_call_param_iterator.next(); |
|
12251 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12252 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12253 |
|
12254 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12255 { |
|
12256 |
|
12257 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
12258 s4o.print("("); |
|
12259 return_type_symbol->accept(*this); |
|
12260 s4o.print(")"); |
|
12261 IN_param_value->accept(*this); |
|
12262 return NULL; |
|
12263 |
|
12264 } |
|
12265 |
|
12266 ERROR; |
|
12267 } |
|
12268 |
|
12269 }/*function_dword_to_real*/ |
|
12270 break; |
|
12271 |
|
12272 /**** |
|
12273 *DWORD_TO_LREAL |
|
12274 */ |
|
12275 case function_dword_to_lreal : |
|
12276 { |
|
12277 symbol_c *last_type_symbol = NULL; |
|
12278 |
|
12279 { |
|
12280 identifier_c param_name("IN"); |
|
12281 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12282 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12283 |
|
12284 /* Get the value from a foo(<param_value>) style call */ |
|
12285 if (IN_param_value == NULL) |
|
12286 IN_param_value = function_call_param_iterator.next(); |
|
12287 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12288 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12289 |
|
12290 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12291 { |
|
12292 |
|
12293 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
12294 s4o.print("("); |
|
12295 return_type_symbol->accept(*this); |
|
12296 s4o.print(")"); |
|
12297 IN_param_value->accept(*this); |
|
12298 return NULL; |
|
12299 |
|
12300 } |
|
12301 |
|
12302 ERROR; |
|
12303 } |
|
12304 |
|
12305 }/*function_dword_to_lreal*/ |
|
12306 break; |
|
12307 |
|
12308 /**** |
|
12309 *DWORD_TO_TIME |
|
12310 */ |
|
12311 case function_dword_to_time : |
|
12312 { |
|
12313 symbol_c *last_type_symbol = NULL; |
|
12314 |
|
12315 { |
|
12316 identifier_c param_name("IN"); |
|
12317 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12318 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12319 |
|
12320 /* Get the value from a foo(<param_value>) style call */ |
|
12321 if (IN_param_value == NULL) |
|
12322 IN_param_value = function_call_param_iterator.next(); |
|
12323 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12324 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12325 |
|
12326 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12327 { |
|
12328 |
|
12329 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
12330 s4o.print("("); |
|
12331 return_type_symbol->accept(*this); |
|
12332 s4o.print(")__int_to_time("); |
|
12333 IN_param_value->accept(*this); |
|
12334 s4o.print(")"); |
|
12335 return NULL; |
|
12336 |
|
12337 } |
|
12338 |
|
12339 ERROR; |
|
12340 } |
|
12341 |
|
12342 }/*function_dword_to_time*/ |
|
12343 break; |
|
12344 |
|
12345 /**** |
|
12346 *DWORD_TO_DATE |
|
12347 */ |
|
12348 case function_dword_to_date : |
|
12349 { |
|
12350 symbol_c *last_type_symbol = NULL; |
|
12351 |
|
12352 { |
|
12353 identifier_c param_name("IN"); |
|
12354 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12355 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12356 |
|
12357 /* Get the value from a foo(<param_value>) style call */ |
|
12358 if (IN_param_value == NULL) |
|
12359 IN_param_value = function_call_param_iterator.next(); |
|
12360 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12361 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12362 |
|
12363 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12364 { |
|
12365 |
|
12366 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
12367 s4o.print("("); |
|
12368 return_type_symbol->accept(*this); |
|
12369 s4o.print(")__int_to_time("); |
|
12370 IN_param_value->accept(*this); |
|
12371 s4o.print(")"); |
|
12372 return NULL; |
|
12373 |
|
12374 } |
|
12375 |
|
12376 ERROR; |
|
12377 } |
|
12378 |
|
12379 }/*function_dword_to_date*/ |
|
12380 break; |
|
12381 |
|
12382 /**** |
|
12383 *DWORD_TO_TOD |
|
12384 */ |
|
12385 case function_dword_to_tod : |
|
12386 { |
|
12387 symbol_c *last_type_symbol = NULL; |
|
12388 |
|
12389 { |
|
12390 identifier_c param_name("IN"); |
|
12391 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12392 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12393 |
|
12394 /* Get the value from a foo(<param_value>) style call */ |
|
12395 if (IN_param_value == NULL) |
|
12396 IN_param_value = function_call_param_iterator.next(); |
|
12397 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12398 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12399 |
|
12400 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12401 { |
|
12402 |
|
12403 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
12404 s4o.print("("); |
|
12405 return_type_symbol->accept(*this); |
|
12406 s4o.print(")__int_to_time("); |
|
12407 IN_param_value->accept(*this); |
|
12408 s4o.print(")"); |
|
12409 return NULL; |
|
12410 |
|
12411 } |
|
12412 |
|
12413 ERROR; |
|
12414 } |
|
12415 |
|
12416 }/*function_dword_to_tod*/ |
|
12417 break; |
|
12418 |
|
12419 /**** |
|
12420 *DWORD_TO_DT |
|
12421 */ |
|
12422 case function_dword_to_dt : |
|
12423 { |
|
12424 symbol_c *last_type_symbol = NULL; |
|
12425 |
|
12426 { |
|
12427 identifier_c param_name("IN"); |
|
12428 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12429 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12430 |
|
12431 /* Get the value from a foo(<param_value>) style call */ |
|
12432 if (IN_param_value == NULL) |
|
12433 IN_param_value = function_call_param_iterator.next(); |
|
12434 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12435 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12436 |
|
12437 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12438 { |
|
12439 |
|
12440 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
12441 s4o.print("("); |
|
12442 return_type_symbol->accept(*this); |
|
12443 s4o.print(")__int_to_time("); |
|
12444 IN_param_value->accept(*this); |
|
12445 s4o.print(")"); |
|
12446 return NULL; |
|
12447 |
|
12448 } |
|
12449 |
|
12450 ERROR; |
|
12451 } |
|
12452 |
|
12453 }/*function_dword_to_dt*/ |
|
12454 break; |
|
12455 |
|
12456 /**** |
|
12457 *DWORD_TO_STRING |
|
12458 */ |
|
12459 case function_dword_to_string : |
|
12460 { |
|
12461 symbol_c *last_type_symbol = NULL; |
|
12462 |
|
12463 { |
|
12464 identifier_c param_name("IN"); |
|
12465 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12466 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12467 |
|
12468 /* Get the value from a foo(<param_value>) style call */ |
|
12469 if (IN_param_value == NULL) |
|
12470 IN_param_value = function_call_param_iterator.next(); |
|
12471 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12472 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12473 |
|
12474 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12475 { |
|
12476 |
|
12477 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
12478 s4o.print("("); |
|
12479 return_type_symbol->accept(*this); |
|
12480 s4o.print(")__bit_to_string("); |
|
12481 IN_param_value->accept(*this); |
|
12482 s4o.print(")"); |
|
12483 return NULL; |
|
12484 |
|
12485 } |
|
12486 |
|
12487 ERROR; |
|
12488 } |
|
12489 |
|
12490 }/*function_dword_to_string*/ |
|
12491 break; |
|
12492 |
|
12493 /**** |
|
12494 *DWORD_TO_BYTE |
|
12495 */ |
|
12496 case function_dword_to_byte : |
|
12497 { |
|
12498 symbol_c *last_type_symbol = NULL; |
|
12499 |
|
12500 { |
|
12501 identifier_c param_name("IN"); |
|
12502 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12503 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12504 |
|
12505 /* Get the value from a foo(<param_value>) style call */ |
|
12506 if (IN_param_value == NULL) |
|
12507 IN_param_value = function_call_param_iterator.next(); |
|
12508 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12509 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12510 |
|
12511 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12512 { |
|
12513 |
|
12514 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
12515 s4o.print("("); |
|
12516 return_type_symbol->accept(*this); |
|
12517 s4o.print(")"); |
|
12518 IN_param_value->accept(*this); |
|
12519 return NULL; |
|
12520 |
|
12521 } |
|
12522 |
|
12523 ERROR; |
|
12524 } |
|
12525 |
|
12526 }/*function_dword_to_byte*/ |
|
12527 break; |
|
12528 |
|
12529 /**** |
|
12530 *DWORD_TO_WORD |
|
12531 */ |
|
12532 case function_dword_to_word : |
|
12533 { |
|
12534 symbol_c *last_type_symbol = NULL; |
|
12535 |
|
12536 { |
|
12537 identifier_c param_name("IN"); |
|
12538 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12539 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12540 |
|
12541 /* Get the value from a foo(<param_value>) style call */ |
|
12542 if (IN_param_value == NULL) |
|
12543 IN_param_value = function_call_param_iterator.next(); |
|
12544 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12545 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12546 |
|
12547 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12548 { |
|
12549 |
|
12550 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
12551 s4o.print("("); |
|
12552 return_type_symbol->accept(*this); |
|
12553 s4o.print(")"); |
|
12554 IN_param_value->accept(*this); |
|
12555 return NULL; |
|
12556 |
|
12557 } |
|
12558 |
|
12559 ERROR; |
|
12560 } |
|
12561 |
|
12562 }/*function_dword_to_word*/ |
|
12563 break; |
|
12564 |
|
12565 /**** |
|
12566 *DWORD_TO_LWORD |
|
12567 */ |
|
12568 case function_dword_to_lword : |
|
12569 { |
|
12570 symbol_c *last_type_symbol = NULL; |
|
12571 |
|
12572 { |
|
12573 identifier_c param_name("IN"); |
|
12574 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12575 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12576 |
|
12577 /* Get the value from a foo(<param_value>) style call */ |
|
12578 if (IN_param_value == NULL) |
|
12579 IN_param_value = function_call_param_iterator.next(); |
|
12580 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12581 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12582 |
|
12583 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
12584 { |
|
12585 |
|
12586 symbol_c * return_type_symbol = &search_constant_type_c::lword_type_name; |
|
12587 s4o.print("("); |
|
12588 return_type_symbol->accept(*this); |
|
12589 s4o.print(")"); |
|
12590 IN_param_value->accept(*this); |
|
12591 return NULL; |
|
12592 |
|
12593 } |
|
12594 |
|
12595 ERROR; |
|
12596 } |
|
12597 |
|
12598 }/*function_dword_to_lword*/ |
|
12599 break; |
|
12600 |
|
12601 /**** |
|
12602 *LWORD_TO_BOOL |
|
12603 */ |
|
12604 case function_lword_to_bool : |
|
12605 { |
|
12606 symbol_c *last_type_symbol = NULL; |
|
12607 |
|
12608 { |
|
12609 identifier_c param_name("IN"); |
|
12610 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12611 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12612 |
|
12613 /* Get the value from a foo(<param_value>) style call */ |
|
12614 if (IN_param_value == NULL) |
|
12615 IN_param_value = function_call_param_iterator.next(); |
|
12616 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12617 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12618 |
|
12619 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12620 { |
|
12621 |
|
12622 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
12623 s4o.print("("); |
|
12624 return_type_symbol->accept(*this); |
|
12625 s4o.print(")"); |
|
12626 IN_param_value->accept(*this); |
|
12627 return NULL; |
|
12628 |
|
12629 } |
|
12630 |
|
12631 ERROR; |
|
12632 } |
|
12633 |
|
12634 }/*function_lword_to_bool*/ |
|
12635 break; |
|
12636 |
|
12637 /**** |
|
12638 *LWORD_TO_SINT |
|
12639 */ |
|
12640 case function_lword_to_sint : |
|
12641 { |
|
12642 symbol_c *last_type_symbol = NULL; |
|
12643 |
|
12644 { |
|
12645 identifier_c param_name("IN"); |
|
12646 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12647 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12648 |
|
12649 /* Get the value from a foo(<param_value>) style call */ |
|
12650 if (IN_param_value == NULL) |
|
12651 IN_param_value = function_call_param_iterator.next(); |
|
12652 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12653 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12654 |
|
12655 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12656 { |
|
12657 |
|
12658 symbol_c * return_type_symbol = &search_constant_type_c::sint_type_name; |
|
12659 s4o.print("("); |
|
12660 return_type_symbol->accept(*this); |
|
12661 s4o.print(")"); |
|
12662 IN_param_value->accept(*this); |
|
12663 return NULL; |
|
12664 |
|
12665 } |
|
12666 |
|
12667 ERROR; |
|
12668 } |
|
12669 |
|
12670 }/*function_lword_to_sint*/ |
|
12671 break; |
|
12672 |
|
12673 /**** |
|
12674 *LWORD_TO_INT |
|
12675 */ |
|
12676 case function_lword_to_int : |
|
12677 { |
|
12678 symbol_c *last_type_symbol = NULL; |
|
12679 |
|
12680 { |
|
12681 identifier_c param_name("IN"); |
|
12682 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12683 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12684 |
|
12685 /* Get the value from a foo(<param_value>) style call */ |
|
12686 if (IN_param_value == NULL) |
|
12687 IN_param_value = function_call_param_iterator.next(); |
|
12688 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12689 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12690 |
|
12691 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12692 { |
|
12693 |
|
12694 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
12695 s4o.print("("); |
|
12696 return_type_symbol->accept(*this); |
|
12697 s4o.print(")"); |
|
12698 IN_param_value->accept(*this); |
|
12699 return NULL; |
|
12700 |
|
12701 } |
|
12702 |
|
12703 ERROR; |
|
12704 } |
|
12705 |
|
12706 }/*function_lword_to_int*/ |
|
12707 break; |
|
12708 |
|
12709 /**** |
|
12710 *LWORD_TO_DINT |
|
12711 */ |
|
12712 case function_lword_to_dint : |
|
12713 { |
|
12714 symbol_c *last_type_symbol = NULL; |
|
12715 |
|
12716 { |
|
12717 identifier_c param_name("IN"); |
|
12718 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12719 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12720 |
|
12721 /* Get the value from a foo(<param_value>) style call */ |
|
12722 if (IN_param_value == NULL) |
|
12723 IN_param_value = function_call_param_iterator.next(); |
|
12724 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12725 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12726 |
|
12727 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12728 { |
|
12729 |
|
12730 symbol_c * return_type_symbol = &search_constant_type_c::dint_type_name; |
|
12731 s4o.print("("); |
|
12732 return_type_symbol->accept(*this); |
|
12733 s4o.print(")"); |
|
12734 IN_param_value->accept(*this); |
|
12735 return NULL; |
|
12736 |
|
12737 } |
|
12738 |
|
12739 ERROR; |
|
12740 } |
|
12741 |
|
12742 }/*function_lword_to_dint*/ |
|
12743 break; |
|
12744 |
|
12745 /**** |
|
12746 *LWORD_TO_LINT |
|
12747 */ |
|
12748 case function_lword_to_lint : |
|
12749 { |
|
12750 symbol_c *last_type_symbol = NULL; |
|
12751 |
|
12752 { |
|
12753 identifier_c param_name("IN"); |
|
12754 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12755 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12756 |
|
12757 /* Get the value from a foo(<param_value>) style call */ |
|
12758 if (IN_param_value == NULL) |
|
12759 IN_param_value = function_call_param_iterator.next(); |
|
12760 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12761 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12762 |
|
12763 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12764 { |
|
12765 |
|
12766 symbol_c * return_type_symbol = &search_constant_type_c::lint_type_name; |
|
12767 s4o.print("("); |
|
12768 return_type_symbol->accept(*this); |
|
12769 s4o.print(")"); |
|
12770 IN_param_value->accept(*this); |
|
12771 return NULL; |
|
12772 |
|
12773 } |
|
12774 |
|
12775 ERROR; |
|
12776 } |
|
12777 |
|
12778 }/*function_lword_to_lint*/ |
|
12779 break; |
|
12780 |
|
12781 /**** |
|
12782 *LWORD_TO_USINT |
|
12783 */ |
|
12784 case function_lword_to_usint : |
|
12785 { |
|
12786 symbol_c *last_type_symbol = NULL; |
|
12787 |
|
12788 { |
|
12789 identifier_c param_name("IN"); |
|
12790 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12791 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12792 |
|
12793 /* Get the value from a foo(<param_value>) style call */ |
|
12794 if (IN_param_value == NULL) |
|
12795 IN_param_value = function_call_param_iterator.next(); |
|
12796 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12797 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12798 |
|
12799 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12800 { |
|
12801 |
|
12802 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
12803 s4o.print("("); |
|
12804 return_type_symbol->accept(*this); |
|
12805 s4o.print(")"); |
|
12806 IN_param_value->accept(*this); |
|
12807 return NULL; |
|
12808 |
|
12809 } |
|
12810 |
|
12811 ERROR; |
|
12812 } |
|
12813 |
|
12814 }/*function_lword_to_usint*/ |
|
12815 break; |
|
12816 |
|
12817 /**** |
|
12818 *LWORD_TO_UINT |
|
12819 */ |
|
12820 case function_lword_to_uint : |
|
12821 { |
|
12822 symbol_c *last_type_symbol = NULL; |
|
12823 |
|
12824 { |
|
12825 identifier_c param_name("IN"); |
|
12826 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12827 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12828 |
|
12829 /* Get the value from a foo(<param_value>) style call */ |
|
12830 if (IN_param_value == NULL) |
|
12831 IN_param_value = function_call_param_iterator.next(); |
|
12832 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12833 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12834 |
|
12835 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12836 { |
|
12837 |
|
12838 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
12839 s4o.print("("); |
|
12840 return_type_symbol->accept(*this); |
|
12841 s4o.print(")"); |
|
12842 IN_param_value->accept(*this); |
|
12843 return NULL; |
|
12844 |
|
12845 } |
|
12846 |
|
12847 ERROR; |
|
12848 } |
|
12849 |
|
12850 }/*function_lword_to_uint*/ |
|
12851 break; |
|
12852 |
|
12853 /**** |
|
12854 *LWORD_TO_UDINT |
|
12855 */ |
|
12856 case function_lword_to_udint : |
|
12857 { |
|
12858 symbol_c *last_type_symbol = NULL; |
|
12859 |
|
12860 { |
|
12861 identifier_c param_name("IN"); |
|
12862 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12863 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12864 |
|
12865 /* Get the value from a foo(<param_value>) style call */ |
|
12866 if (IN_param_value == NULL) |
|
12867 IN_param_value = function_call_param_iterator.next(); |
|
12868 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12869 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12870 |
|
12871 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12872 { |
|
12873 |
|
12874 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
12875 s4o.print("("); |
|
12876 return_type_symbol->accept(*this); |
|
12877 s4o.print(")"); |
|
12878 IN_param_value->accept(*this); |
|
12879 return NULL; |
|
12880 |
|
12881 } |
|
12882 |
|
12883 ERROR; |
|
12884 } |
|
12885 |
|
12886 }/*function_lword_to_udint*/ |
|
12887 break; |
|
12888 |
|
12889 /**** |
|
12890 *LWORD_TO_ULINT |
|
12891 */ |
|
12892 case function_lword_to_ulint : |
|
12893 { |
|
12894 symbol_c *last_type_symbol = NULL; |
|
12895 |
|
12896 { |
|
12897 identifier_c param_name("IN"); |
|
12898 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12899 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12900 |
|
12901 /* Get the value from a foo(<param_value>) style call */ |
|
12902 if (IN_param_value == NULL) |
|
12903 IN_param_value = function_call_param_iterator.next(); |
|
12904 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12905 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12906 |
|
12907 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12908 { |
|
12909 |
|
12910 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
12911 s4o.print("("); |
|
12912 return_type_symbol->accept(*this); |
|
12913 s4o.print(")"); |
|
12914 IN_param_value->accept(*this); |
|
12915 return NULL; |
|
12916 |
|
12917 } |
|
12918 |
|
12919 ERROR; |
|
12920 } |
|
12921 |
|
12922 }/*function_lword_to_ulint*/ |
|
12923 break; |
|
12924 |
|
12925 /**** |
|
12926 *LWORD_TO_REAL |
|
12927 */ |
|
12928 case function_lword_to_real : |
|
12929 { |
|
12930 symbol_c *last_type_symbol = NULL; |
|
12931 |
|
12932 { |
|
12933 identifier_c param_name("IN"); |
|
12934 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12935 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12936 |
|
12937 /* Get the value from a foo(<param_value>) style call */ |
|
12938 if (IN_param_value == NULL) |
|
12939 IN_param_value = function_call_param_iterator.next(); |
|
12940 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12941 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12942 |
|
12943 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12944 { |
|
12945 |
|
12946 symbol_c * return_type_symbol = &search_constant_type_c::real_type_name; |
|
12947 s4o.print("("); |
|
12948 return_type_symbol->accept(*this); |
|
12949 s4o.print(")"); |
|
12950 IN_param_value->accept(*this); |
|
12951 return NULL; |
|
12952 |
|
12953 } |
|
12954 |
|
12955 ERROR; |
|
12956 } |
|
12957 |
|
12958 }/*function_lword_to_real*/ |
|
12959 break; |
|
12960 |
|
12961 /**** |
|
12962 *LWORD_TO_LREAL |
|
12963 */ |
|
12964 case function_lword_to_lreal : |
|
12965 { |
|
12966 symbol_c *last_type_symbol = NULL; |
|
12967 |
|
12968 { |
|
12969 identifier_c param_name("IN"); |
|
12970 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
12971 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
12972 |
|
12973 /* Get the value from a foo(<param_value>) style call */ |
|
12974 if (IN_param_value == NULL) |
|
12975 IN_param_value = function_call_param_iterator.next(); |
|
12976 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
12977 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
12978 |
|
12979 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
12980 { |
|
12981 |
|
12982 symbol_c * return_type_symbol = &search_constant_type_c::lreal_type_name; |
|
12983 s4o.print("("); |
|
12984 return_type_symbol->accept(*this); |
|
12985 s4o.print(")"); |
|
12986 IN_param_value->accept(*this); |
|
12987 return NULL; |
|
12988 |
|
12989 } |
|
12990 |
|
12991 ERROR; |
|
12992 } |
|
12993 |
|
12994 }/*function_lword_to_lreal*/ |
|
12995 break; |
|
12996 |
|
12997 /**** |
|
12998 *LWORD_TO_TIME |
|
12999 */ |
|
13000 case function_lword_to_time : |
|
13001 { |
|
13002 symbol_c *last_type_symbol = NULL; |
|
13003 |
|
13004 { |
|
13005 identifier_c param_name("IN"); |
|
13006 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13007 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13008 |
|
13009 /* Get the value from a foo(<param_value>) style call */ |
|
13010 if (IN_param_value == NULL) |
|
13011 IN_param_value = function_call_param_iterator.next(); |
|
13012 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13013 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13014 |
|
13015 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13016 { |
|
13017 |
|
13018 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
13019 s4o.print("("); |
|
13020 return_type_symbol->accept(*this); |
|
13021 s4o.print(")__int_to_time("); |
|
13022 IN_param_value->accept(*this); |
|
13023 s4o.print(")"); |
|
13024 return NULL; |
|
13025 |
|
13026 } |
|
13027 |
|
13028 ERROR; |
|
13029 } |
|
13030 |
|
13031 }/*function_lword_to_time*/ |
|
13032 break; |
|
13033 |
|
13034 /**** |
|
13035 *LWORD_TO_DATE |
|
13036 */ |
|
13037 case function_lword_to_date : |
|
13038 { |
|
13039 symbol_c *last_type_symbol = NULL; |
|
13040 |
|
13041 { |
|
13042 identifier_c param_name("IN"); |
|
13043 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13044 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13045 |
|
13046 /* Get the value from a foo(<param_value>) style call */ |
|
13047 if (IN_param_value == NULL) |
|
13048 IN_param_value = function_call_param_iterator.next(); |
|
13049 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13050 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13051 |
|
13052 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13053 { |
|
13054 |
|
13055 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
13056 s4o.print("("); |
|
13057 return_type_symbol->accept(*this); |
|
13058 s4o.print(")__int_to_time("); |
|
13059 IN_param_value->accept(*this); |
|
13060 s4o.print(")"); |
|
13061 return NULL; |
|
13062 |
|
13063 } |
|
13064 |
|
13065 ERROR; |
|
13066 } |
|
13067 |
|
13068 }/*function_lword_to_date*/ |
|
13069 break; |
|
13070 |
|
13071 /**** |
|
13072 *LWORD_TO_TOD |
|
13073 */ |
|
13074 case function_lword_to_tod : |
|
13075 { |
|
13076 symbol_c *last_type_symbol = NULL; |
|
13077 |
|
13078 { |
|
13079 identifier_c param_name("IN"); |
|
13080 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13081 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13082 |
|
13083 /* Get the value from a foo(<param_value>) style call */ |
|
13084 if (IN_param_value == NULL) |
|
13085 IN_param_value = function_call_param_iterator.next(); |
|
13086 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13087 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13088 |
|
13089 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13090 { |
|
13091 |
|
13092 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
13093 s4o.print("("); |
|
13094 return_type_symbol->accept(*this); |
|
13095 s4o.print(")__int_to_time("); |
|
13096 IN_param_value->accept(*this); |
|
13097 s4o.print(")"); |
|
13098 return NULL; |
|
13099 |
|
13100 } |
|
13101 |
|
13102 ERROR; |
|
13103 } |
|
13104 |
|
13105 }/*function_lword_to_tod*/ |
|
13106 break; |
|
13107 |
|
13108 /**** |
|
13109 *LWORD_TO_DT |
|
13110 */ |
|
13111 case function_lword_to_dt : |
|
13112 { |
|
13113 symbol_c *last_type_symbol = NULL; |
|
13114 |
|
13115 { |
|
13116 identifier_c param_name("IN"); |
|
13117 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13118 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13119 |
|
13120 /* Get the value from a foo(<param_value>) style call */ |
|
13121 if (IN_param_value == NULL) |
|
13122 IN_param_value = function_call_param_iterator.next(); |
|
13123 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13124 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13125 |
|
13126 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13127 { |
|
13128 |
|
13129 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
13130 s4o.print("("); |
|
13131 return_type_symbol->accept(*this); |
|
13132 s4o.print(")__int_to_time("); |
|
13133 IN_param_value->accept(*this); |
|
13134 s4o.print(")"); |
|
13135 return NULL; |
|
13136 |
|
13137 } |
|
13138 |
|
13139 ERROR; |
|
13140 } |
|
13141 |
|
13142 }/*function_lword_to_dt*/ |
|
13143 break; |
|
13144 |
|
13145 /**** |
|
13146 *LWORD_TO_STRING |
|
13147 */ |
|
13148 case function_lword_to_string : |
|
13149 { |
|
13150 symbol_c *last_type_symbol = NULL; |
|
13151 |
|
13152 { |
|
13153 identifier_c param_name("IN"); |
|
13154 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13155 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13156 |
|
13157 /* Get the value from a foo(<param_value>) style call */ |
|
13158 if (IN_param_value == NULL) |
|
13159 IN_param_value = function_call_param_iterator.next(); |
|
13160 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13161 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13162 |
|
13163 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13164 { |
|
13165 |
|
13166 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
13167 s4o.print("("); |
|
13168 return_type_symbol->accept(*this); |
|
13169 s4o.print(")__bit_to_string("); |
|
13170 IN_param_value->accept(*this); |
|
13171 s4o.print(")"); |
|
13172 return NULL; |
|
13173 |
|
13174 } |
|
13175 |
|
13176 ERROR; |
|
13177 } |
|
13178 |
|
13179 }/*function_lword_to_string*/ |
|
13180 break; |
|
13181 |
|
13182 /**** |
|
13183 *LWORD_TO_BYTE |
|
13184 */ |
|
13185 case function_lword_to_byte : |
|
13186 { |
|
13187 symbol_c *last_type_symbol = NULL; |
|
13188 |
|
13189 { |
|
13190 identifier_c param_name("IN"); |
|
13191 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13192 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13193 |
|
13194 /* Get the value from a foo(<param_value>) style call */ |
|
13195 if (IN_param_value == NULL) |
|
13196 IN_param_value = function_call_param_iterator.next(); |
|
13197 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13198 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13199 |
|
13200 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13201 { |
|
13202 |
|
13203 symbol_c * return_type_symbol = &search_constant_type_c::byte_type_name; |
|
13204 s4o.print("("); |
|
13205 return_type_symbol->accept(*this); |
|
13206 s4o.print(")"); |
|
13207 IN_param_value->accept(*this); |
|
13208 return NULL; |
|
13209 |
|
13210 } |
|
13211 |
|
13212 ERROR; |
|
13213 } |
|
13214 |
|
13215 }/*function_lword_to_byte*/ |
|
13216 break; |
|
13217 |
|
13218 /**** |
|
13219 *LWORD_TO_WORD |
|
13220 */ |
|
13221 case function_lword_to_word : |
|
13222 { |
|
13223 symbol_c *last_type_symbol = NULL; |
|
13224 |
|
13225 { |
|
13226 identifier_c param_name("IN"); |
|
13227 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13228 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13229 |
|
13230 /* Get the value from a foo(<param_value>) style call */ |
|
13231 if (IN_param_value == NULL) |
|
13232 IN_param_value = function_call_param_iterator.next(); |
|
13233 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13234 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13235 |
|
13236 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13237 { |
|
13238 |
|
13239 symbol_c * return_type_symbol = &search_constant_type_c::word_type_name; |
|
13240 s4o.print("("); |
|
13241 return_type_symbol->accept(*this); |
|
13242 s4o.print(")"); |
|
13243 IN_param_value->accept(*this); |
|
13244 return NULL; |
|
13245 |
|
13246 } |
|
13247 |
|
13248 ERROR; |
|
13249 } |
|
13250 |
|
13251 }/*function_lword_to_word*/ |
|
13252 break; |
|
13253 |
|
13254 /**** |
|
13255 *LWORD_TO_DWORD |
|
13256 */ |
|
13257 case function_lword_to_dword : |
|
13258 { |
|
13259 symbol_c *last_type_symbol = NULL; |
|
13260 |
|
13261 { |
|
13262 identifier_c param_name("IN"); |
|
13263 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13264 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13265 |
|
13266 /* Get the value from a foo(<param_value>) style call */ |
|
13267 if (IN_param_value == NULL) |
|
13268 IN_param_value = function_call_param_iterator.next(); |
|
13269 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13270 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13271 |
|
13272 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13273 { |
|
13274 |
|
13275 symbol_c * return_type_symbol = &search_constant_type_c::dword_type_name; |
|
13276 s4o.print("("); |
|
13277 return_type_symbol->accept(*this); |
|
13278 s4o.print(")"); |
|
13279 IN_param_value->accept(*this); |
|
13280 return NULL; |
|
13281 |
|
13282 } |
|
13283 |
|
13284 ERROR; |
|
13285 } |
|
13286 |
|
13287 }/*function_lword_to_dword*/ |
|
13288 break; |
|
13289 |
|
13290 /**** |
|
13291 *TRUNC |
|
13292 */ |
|
13293 case function_trunc : |
|
13294 { |
|
13295 symbol_c *last_type_symbol = NULL; |
|
13296 |
|
13297 { |
|
13298 identifier_c param_name("IN"); |
|
13299 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13300 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13301 |
|
13302 /* Get the value from a foo(<param_value>) style call */ |
|
13303 if (IN_param_value == NULL) |
|
13304 IN_param_value = function_call_param_iterator.next(); |
|
13305 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13306 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13307 |
|
13308 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13309 { |
|
13310 |
|
13311 symbol_c * return_type_symbol = &search_constant_type_c::constant_int_type_name; |
|
13312 s4o.print("(int)"); |
|
13313 IN_param_value->accept(*this); |
|
13314 return NULL; |
|
13315 |
|
13316 } |
|
13317 |
|
13318 ERROR; |
|
13319 } |
|
13320 |
|
13321 }/*function_trunc*/ |
|
13322 break; |
|
13323 |
|
13324 /**** |
|
13325 *BCD_TO_USINT |
|
13326 */ |
|
13327 case function_bcd_to_usint : |
|
13328 { |
|
13329 symbol_c *last_type_symbol = NULL; |
|
13330 |
|
13331 { |
|
13332 identifier_c param_name("IN"); |
|
13333 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13334 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13335 |
|
13336 /* Get the value from a foo(<param_value>) style call */ |
|
13337 if (IN_param_value == NULL) |
|
13338 IN_param_value = function_call_param_iterator.next(); |
|
13339 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13340 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13341 |
|
13342 if(search_expression_type->is_same_type(&search_constant_type_c::byte_type_name, last_type_symbol)) |
|
13343 { |
|
13344 |
|
13345 symbol_c * return_type_symbol = &search_constant_type_c::usint_type_name; |
|
13346 s4o.print("("); |
|
13347 return_type_symbol->accept(*this); |
|
13348 s4o.print(")__bcd_to_uint("); |
|
13349 IN_param_value->accept(*this); |
|
13350 s4o.print(")"); |
|
13351 return NULL; |
|
13352 |
|
13353 } |
|
13354 |
|
13355 ERROR; |
|
13356 } |
|
13357 |
|
13358 }/*function_bcd_to_usint*/ |
|
13359 break; |
|
13360 |
|
13361 /**** |
|
13362 *BCD_TO_UINT |
|
13363 */ |
|
13364 case function_bcd_to_uint : |
|
13365 { |
|
13366 symbol_c *last_type_symbol = NULL; |
|
13367 |
|
13368 { |
|
13369 identifier_c param_name("IN"); |
|
13370 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13371 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13372 |
|
13373 /* Get the value from a foo(<param_value>) style call */ |
|
13374 if (IN_param_value == NULL) |
|
13375 IN_param_value = function_call_param_iterator.next(); |
|
13376 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13377 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13378 |
|
13379 if(search_expression_type->is_same_type(&search_constant_type_c::word_type_name, last_type_symbol)) |
|
13380 { |
|
13381 |
|
13382 symbol_c * return_type_symbol = &search_constant_type_c::uint_type_name; |
|
13383 s4o.print("("); |
|
13384 return_type_symbol->accept(*this); |
|
13385 s4o.print(")__bcd_to_uint("); |
|
13386 IN_param_value->accept(*this); |
|
13387 s4o.print(")"); |
|
13388 return NULL; |
|
13389 |
|
13390 } |
|
13391 |
|
13392 ERROR; |
|
13393 } |
|
13394 |
|
13395 }/*function_bcd_to_uint*/ |
|
13396 break; |
|
13397 |
|
13398 /**** |
|
13399 *BCD_TO_UDINT |
|
13400 */ |
|
13401 case function_bcd_to_udint : |
|
13402 { |
|
13403 symbol_c *last_type_symbol = NULL; |
|
13404 |
|
13405 { |
|
13406 identifier_c param_name("IN"); |
|
13407 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13408 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13409 |
|
13410 /* Get the value from a foo(<param_value>) style call */ |
|
13411 if (IN_param_value == NULL) |
|
13412 IN_param_value = function_call_param_iterator.next(); |
|
13413 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13414 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13415 |
|
13416 if(search_expression_type->is_same_type(&search_constant_type_c::dword_type_name, last_type_symbol)) |
|
13417 { |
|
13418 |
|
13419 symbol_c * return_type_symbol = &search_constant_type_c::udint_type_name; |
|
13420 s4o.print("("); |
|
13421 return_type_symbol->accept(*this); |
|
13422 s4o.print(")__bcd_to_uint("); |
|
13423 IN_param_value->accept(*this); |
|
13424 s4o.print(")"); |
|
13425 return NULL; |
|
13426 |
|
13427 } |
|
13428 |
|
13429 ERROR; |
|
13430 } |
|
13431 |
|
13432 }/*function_bcd_to_udint*/ |
|
13433 break; |
|
13434 |
|
13435 /**** |
|
13436 *BCD_TO_ULINT |
|
13437 */ |
|
13438 case function_bcd_to_ulint : |
|
13439 { |
|
13440 symbol_c *last_type_symbol = NULL; |
|
13441 |
|
13442 { |
|
13443 identifier_c param_name("IN"); |
|
13444 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13445 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13446 |
|
13447 /* Get the value from a foo(<param_value>) style call */ |
|
13448 if (IN_param_value == NULL) |
|
13449 IN_param_value = function_call_param_iterator.next(); |
|
13450 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13451 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13452 |
|
13453 if(search_expression_type->is_same_type(&search_constant_type_c::lword_type_name, last_type_symbol)) |
|
13454 { |
|
13455 |
|
13456 symbol_c * return_type_symbol = &search_constant_type_c::ulint_type_name; |
|
13457 s4o.print("("); |
|
13458 return_type_symbol->accept(*this); |
|
13459 s4o.print(")__bcd_to_uint("); |
|
13460 IN_param_value->accept(*this); |
|
13461 s4o.print(")"); |
|
13462 return NULL; |
|
13463 |
|
13464 } |
|
13465 |
|
13466 ERROR; |
|
13467 } |
|
13468 |
|
13469 }/*function_bcd_to_ulint*/ |
|
13470 break; |
|
13471 |
|
13472 /**** |
|
13473 *USINT_TO_BCD |
|
13474 */ |
|
13475 case function_usint_to_bcd : |
|
13476 { |
|
13477 symbol_c *last_type_symbol = NULL; |
|
13478 |
|
13479 { |
|
13480 identifier_c param_name("IN"); |
|
13481 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13482 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13483 |
|
13484 /* Get the value from a foo(<param_value>) style call */ |
|
13485 if (IN_param_value == NULL) |
|
13486 IN_param_value = function_call_param_iterator.next(); |
|
13487 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13488 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13489 |
|
13490 if(search_expression_type->is_same_type(&search_constant_type_c::usint_type_name, last_type_symbol)) |
|
13491 { |
|
13492 |
|
13493 symbol_c * return_type_symbol = &search_constant_type_c::constant_int_type_name; |
|
13494 s4o.print("("); |
|
13495 return_type_symbol->accept(*this); |
|
13496 s4o.print(")__uint_to_bcd("); |
|
13497 IN_param_value->accept(*this); |
|
13498 s4o.print(")"); |
|
13499 return NULL; |
|
13500 |
|
13501 } |
|
13502 |
|
13503 ERROR; |
|
13504 } |
|
13505 |
|
13506 }/*function_usint_to_bcd*/ |
|
13507 break; |
|
13508 |
|
13509 /**** |
|
13510 *UINT_TO_BCD |
|
13511 */ |
|
13512 case function_uint_to_bcd : |
|
13513 { |
|
13514 symbol_c *last_type_symbol = NULL; |
|
13515 |
|
13516 { |
|
13517 identifier_c param_name("IN"); |
|
13518 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13519 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13520 |
|
13521 /* Get the value from a foo(<param_value>) style call */ |
|
13522 if (IN_param_value == NULL) |
|
13523 IN_param_value = function_call_param_iterator.next(); |
|
13524 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13525 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13526 |
|
13527 if(search_expression_type->is_same_type(&search_constant_type_c::uint_type_name, last_type_symbol)) |
|
13528 { |
|
13529 |
|
13530 symbol_c * return_type_symbol = &search_constant_type_c::constant_int_type_name; |
|
13531 s4o.print("("); |
|
13532 return_type_symbol->accept(*this); |
|
13533 s4o.print(")__uint_to_bcd("); |
|
13534 IN_param_value->accept(*this); |
|
13535 s4o.print(")"); |
|
13536 return NULL; |
|
13537 |
|
13538 } |
|
13539 |
|
13540 ERROR; |
|
13541 } |
|
13542 |
|
13543 }/*function_uint_to_bcd*/ |
|
13544 break; |
|
13545 |
|
13546 /**** |
|
13547 *UDINT_TO_BCD |
|
13548 */ |
|
13549 case function_udint_to_bcd : |
|
13550 { |
|
13551 symbol_c *last_type_symbol = NULL; |
|
13552 |
|
13553 { |
|
13554 identifier_c param_name("IN"); |
|
13555 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13556 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13557 |
|
13558 /* Get the value from a foo(<param_value>) style call */ |
|
13559 if (IN_param_value == NULL) |
|
13560 IN_param_value = function_call_param_iterator.next(); |
|
13561 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13562 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13563 |
|
13564 if(search_expression_type->is_same_type(&search_constant_type_c::udint_type_name, last_type_symbol)) |
|
13565 { |
|
13566 |
|
13567 symbol_c * return_type_symbol = &search_constant_type_c::constant_int_type_name; |
|
13568 s4o.print("("); |
|
13569 return_type_symbol->accept(*this); |
|
13570 s4o.print(")__uint_to_bcd("); |
|
13571 IN_param_value->accept(*this); |
|
13572 s4o.print(")"); |
|
13573 return NULL; |
|
13574 |
|
13575 } |
|
13576 |
|
13577 ERROR; |
|
13578 } |
|
13579 |
|
13580 }/*function_udint_to_bcd*/ |
|
13581 break; |
|
13582 |
|
13583 /**** |
|
13584 *ULINT_TO_BCD |
|
13585 */ |
|
13586 case function_ulint_to_bcd : |
|
13587 { |
|
13588 symbol_c *last_type_symbol = NULL; |
|
13589 |
|
13590 { |
|
13591 identifier_c param_name("IN"); |
|
13592 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13593 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13594 |
|
13595 /* Get the value from a foo(<param_value>) style call */ |
|
13596 if (IN_param_value == NULL) |
|
13597 IN_param_value = function_call_param_iterator.next(); |
|
13598 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13599 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13600 |
|
13601 if(search_expression_type->is_same_type(&search_constant_type_c::ulint_type_name, last_type_symbol)) |
|
13602 { |
|
13603 |
|
13604 symbol_c * return_type_symbol = &search_constant_type_c::constant_int_type_name; |
|
13605 s4o.print("("); |
|
13606 return_type_symbol->accept(*this); |
|
13607 s4o.print(")__uint_to_bcd("); |
|
13608 IN_param_value->accept(*this); |
|
13609 s4o.print(")"); |
|
13610 return NULL; |
|
13611 |
|
13612 } |
|
13613 |
|
13614 ERROR; |
|
13615 } |
|
13616 |
|
13617 }/*function_ulint_to_bcd*/ |
|
13618 break; |
|
13619 |
|
13620 /**** |
|
13621 *DATE_AND_TIME_TO_TIME_OF_DAY |
|
13622 */ |
|
13623 case function_date_and_time_to_time_of_day : |
|
13624 { |
|
13625 symbol_c *last_type_symbol = NULL; |
|
13626 |
|
13627 { |
|
13628 identifier_c param_name("IN"); |
|
13629 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13630 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13631 |
|
13632 /* Get the value from a foo(<param_value>) style call */ |
|
13633 if (IN_param_value == NULL) |
|
13634 IN_param_value = function_call_param_iterator.next(); |
|
13635 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13636 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13637 |
|
13638 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
13639 { |
|
13640 |
|
13641 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
13642 s4o.print("__date_and_time_to_time_of_day("); |
|
13643 IN_param_value->accept(*this); |
|
13644 s4o.print(")"); |
|
13645 return NULL; |
|
13646 |
|
13647 } |
|
13648 |
|
13649 ERROR; |
|
13650 } |
|
13651 |
|
13652 }/*function_date_and_time_to_time_of_day*/ |
|
13653 break; |
|
13654 |
|
13655 /**** |
|
13656 *DATE_AND_TIME_TO_DATE |
|
13657 */ |
|
13658 case function_date_and_time_to_date : |
|
13659 { |
|
13660 symbol_c *last_type_symbol = NULL; |
|
13661 |
|
13662 { |
|
13663 identifier_c param_name("IN"); |
|
13664 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13665 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13666 |
|
13667 /* Get the value from a foo(<param_value>) style call */ |
|
13668 if (IN_param_value == NULL) |
|
13669 IN_param_value = function_call_param_iterator.next(); |
|
13670 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13671 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13672 |
|
13673 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
13674 { |
|
13675 |
|
13676 symbol_c * return_type_symbol = &search_constant_type_c::date_type_name; |
|
13677 s4o.print("__date_and_time_to_date("); |
|
13678 IN_param_value->accept(*this); |
|
13679 s4o.print(")"); |
|
13680 return NULL; |
|
13681 |
|
13682 } |
|
13683 |
|
13684 ERROR; |
|
13685 } |
|
13686 |
|
13687 }/*function_date_and_time_to_date*/ |
|
13688 break; |
|
13689 |
|
13690 /**** |
|
13691 *ABS |
|
13692 */ |
|
13693 case function_abs : |
|
13694 { |
|
13695 symbol_c *last_type_symbol = NULL; |
|
13696 |
|
13697 { |
|
13698 identifier_c param_name("IN"); |
|
13699 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13700 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13701 |
|
13702 /* Get the value from a foo(<param_value>) style call */ |
|
13703 if (IN_param_value == NULL) |
|
13704 IN_param_value = function_call_param_iterator.next(); |
|
13705 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13706 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13707 |
|
13708 if(search_expression_type->is_num_type(IN_type_symbol)) |
|
13709 { |
|
13710 |
|
13711 symbol_c * return_type_symbol = IN_type_symbol; |
|
13712 s4o.print("__abs_"); |
|
13713 IN_type_symbol->accept(*this); |
|
13714 s4o.print("("); |
|
13715 IN_param_value->accept(*this); |
|
13716 s4o.print(")"); |
|
13717 return NULL; |
|
13718 |
|
13719 } |
|
13720 |
|
13721 ERROR; |
|
13722 } |
|
13723 |
|
13724 }/*function_abs*/ |
|
13725 break; |
|
13726 |
|
13727 /**** |
|
13728 *SQRT |
|
13729 */ |
|
13730 case function_sqrt : |
|
13731 { |
|
13732 symbol_c *last_type_symbol = NULL; |
|
13733 |
|
13734 { |
|
13735 identifier_c param_name("IN"); |
|
13736 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13737 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13738 |
|
13739 /* Get the value from a foo(<param_value>) style call */ |
|
13740 if (IN_param_value == NULL) |
|
13741 IN_param_value = function_call_param_iterator.next(); |
|
13742 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13743 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13744 |
|
13745 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13746 { |
|
13747 |
|
13748 symbol_c * return_type_symbol = IN_type_symbol; |
|
13749 s4o.print("sqrt("); |
|
13750 IN_param_value->accept(*this); |
|
13751 s4o.print(")"); |
|
13752 return NULL; |
|
13753 |
|
13754 } |
|
13755 |
|
13756 ERROR; |
|
13757 } |
|
13758 |
|
13759 }/*function_sqrt*/ |
|
13760 break; |
|
13761 |
|
13762 /**** |
|
13763 *LN |
|
13764 */ |
|
13765 case function_ln : |
|
13766 { |
|
13767 symbol_c *last_type_symbol = NULL; |
|
13768 |
|
13769 { |
|
13770 identifier_c param_name("IN"); |
|
13771 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13772 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13773 |
|
13774 /* Get the value from a foo(<param_value>) style call */ |
|
13775 if (IN_param_value == NULL) |
|
13776 IN_param_value = function_call_param_iterator.next(); |
|
13777 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13778 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13779 |
|
13780 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13781 { |
|
13782 |
|
13783 symbol_c * return_type_symbol = IN_type_symbol; |
|
13784 s4o.print("ln("); |
|
13785 IN_param_value->accept(*this); |
|
13786 s4o.print(")"); |
|
13787 return NULL; |
|
13788 |
|
13789 } |
|
13790 |
|
13791 ERROR; |
|
13792 } |
|
13793 |
|
13794 }/*function_ln*/ |
|
13795 break; |
|
13796 |
|
13797 /**** |
|
13798 *LOG |
|
13799 */ |
|
13800 case function_log : |
|
13801 { |
|
13802 symbol_c *last_type_symbol = NULL; |
|
13803 |
|
13804 { |
|
13805 identifier_c param_name("IN"); |
|
13806 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13807 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13808 |
|
13809 /* Get the value from a foo(<param_value>) style call */ |
|
13810 if (IN_param_value == NULL) |
|
13811 IN_param_value = function_call_param_iterator.next(); |
|
13812 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13813 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13814 |
|
13815 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13816 { |
|
13817 |
|
13818 symbol_c * return_type_symbol = IN_type_symbol; |
|
13819 s4o.print("log("); |
|
13820 IN_param_value->accept(*this); |
|
13821 s4o.print(")"); |
|
13822 return NULL; |
|
13823 |
|
13824 } |
|
13825 |
|
13826 ERROR; |
|
13827 } |
|
13828 |
|
13829 }/*function_log*/ |
|
13830 break; |
|
13831 |
|
13832 /**** |
|
13833 *EXP |
|
13834 */ |
|
13835 case function_exp : |
|
13836 { |
|
13837 symbol_c *last_type_symbol = NULL; |
|
13838 |
|
13839 { |
|
13840 identifier_c param_name("IN"); |
|
13841 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13842 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13843 |
|
13844 /* Get the value from a foo(<param_value>) style call */ |
|
13845 if (IN_param_value == NULL) |
|
13846 IN_param_value = function_call_param_iterator.next(); |
|
13847 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13848 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13849 |
|
13850 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13851 { |
|
13852 |
|
13853 symbol_c * return_type_symbol = IN_type_symbol; |
|
13854 s4o.print("exp("); |
|
13855 IN_param_value->accept(*this); |
|
13856 s4o.print(")"); |
|
13857 return NULL; |
|
13858 |
|
13859 } |
|
13860 |
|
13861 ERROR; |
|
13862 } |
|
13863 |
|
13864 }/*function_exp*/ |
|
13865 break; |
|
13866 |
|
13867 /**** |
|
13868 *SIN |
|
13869 */ |
|
13870 case function_sin : |
|
13871 { |
|
13872 symbol_c *last_type_symbol = NULL; |
|
13873 |
|
13874 { |
|
13875 identifier_c param_name("IN"); |
|
13876 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13877 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13878 |
|
13879 /* Get the value from a foo(<param_value>) style call */ |
|
13880 if (IN_param_value == NULL) |
|
13881 IN_param_value = function_call_param_iterator.next(); |
|
13882 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13883 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13884 |
|
13885 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13886 { |
|
13887 |
|
13888 symbol_c * return_type_symbol = IN_type_symbol; |
|
13889 s4o.print("sin("); |
|
13890 IN_param_value->accept(*this); |
|
13891 s4o.print(")"); |
|
13892 return NULL; |
|
13893 |
|
13894 } |
|
13895 |
|
13896 ERROR; |
|
13897 } |
|
13898 |
|
13899 }/*function_sin*/ |
|
13900 break; |
|
13901 |
|
13902 /**** |
|
13903 *COS |
|
13904 */ |
|
13905 case function_cos : |
|
13906 { |
|
13907 symbol_c *last_type_symbol = NULL; |
|
13908 |
|
13909 { |
|
13910 identifier_c param_name("IN"); |
|
13911 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13912 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13913 |
|
13914 /* Get the value from a foo(<param_value>) style call */ |
|
13915 if (IN_param_value == NULL) |
|
13916 IN_param_value = function_call_param_iterator.next(); |
|
13917 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13918 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13919 |
|
13920 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13921 { |
|
13922 |
|
13923 symbol_c * return_type_symbol = IN_type_symbol; |
|
13924 s4o.print("cos("); |
|
13925 IN_param_value->accept(*this); |
|
13926 s4o.print(")"); |
|
13927 return NULL; |
|
13928 |
|
13929 } |
|
13930 |
|
13931 ERROR; |
|
13932 } |
|
13933 |
|
13934 }/*function_cos*/ |
|
13935 break; |
|
13936 |
|
13937 /**** |
|
13938 *TAN |
|
13939 */ |
|
13940 case function_tan : |
|
13941 { |
|
13942 symbol_c *last_type_symbol = NULL; |
|
13943 |
|
13944 { |
|
13945 identifier_c param_name("IN"); |
|
13946 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13947 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13948 |
|
13949 /* Get the value from a foo(<param_value>) style call */ |
|
13950 if (IN_param_value == NULL) |
|
13951 IN_param_value = function_call_param_iterator.next(); |
|
13952 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13953 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13954 |
|
13955 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13956 { |
|
13957 |
|
13958 symbol_c * return_type_symbol = IN_type_symbol; |
|
13959 s4o.print("tan("); |
|
13960 IN_param_value->accept(*this); |
|
13961 s4o.print(")"); |
|
13962 return NULL; |
|
13963 |
|
13964 } |
|
13965 |
|
13966 ERROR; |
|
13967 } |
|
13968 |
|
13969 }/*function_tan*/ |
|
13970 break; |
|
13971 |
|
13972 /**** |
|
13973 *ASIN |
|
13974 */ |
|
13975 case function_asin : |
|
13976 { |
|
13977 symbol_c *last_type_symbol = NULL; |
|
13978 |
|
13979 { |
|
13980 identifier_c param_name("IN"); |
|
13981 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
13982 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
13983 |
|
13984 /* Get the value from a foo(<param_value>) style call */ |
|
13985 if (IN_param_value == NULL) |
|
13986 IN_param_value = function_call_param_iterator.next(); |
|
13987 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
13988 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
13989 |
|
13990 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
13991 { |
|
13992 |
|
13993 symbol_c * return_type_symbol = IN_type_symbol; |
|
13994 s4o.print("asin("); |
|
13995 IN_param_value->accept(*this); |
|
13996 s4o.print(")"); |
|
13997 return NULL; |
|
13998 |
|
13999 } |
|
14000 |
|
14001 ERROR; |
|
14002 } |
|
14003 |
|
14004 }/*function_asin*/ |
|
14005 break; |
|
14006 |
|
14007 /**** |
|
14008 *ACOS |
|
14009 */ |
|
14010 case function_acos : |
|
14011 { |
|
14012 symbol_c *last_type_symbol = NULL; |
|
14013 |
|
14014 { |
|
14015 identifier_c param_name("IN"); |
|
14016 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14017 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14018 |
|
14019 /* Get the value from a foo(<param_value>) style call */ |
|
14020 if (IN_param_value == NULL) |
|
14021 IN_param_value = function_call_param_iterator.next(); |
|
14022 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14023 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14024 |
|
14025 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
14026 { |
|
14027 |
|
14028 symbol_c * return_type_symbol = IN_type_symbol; |
|
14029 s4o.print("acos("); |
|
14030 IN_param_value->accept(*this); |
|
14031 s4o.print(")"); |
|
14032 return NULL; |
|
14033 |
|
14034 } |
|
14035 |
|
14036 ERROR; |
|
14037 } |
|
14038 |
|
14039 }/*function_acos*/ |
|
14040 break; |
|
14041 |
|
14042 /**** |
|
14043 *ATAN |
|
14044 */ |
|
14045 case function_atan : |
|
14046 { |
|
14047 symbol_c *last_type_symbol = NULL; |
|
14048 |
|
14049 { |
|
14050 identifier_c param_name("IN"); |
|
14051 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14052 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14053 |
|
14054 /* Get the value from a foo(<param_value>) style call */ |
|
14055 if (IN_param_value == NULL) |
|
14056 IN_param_value = function_call_param_iterator.next(); |
|
14057 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14058 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14059 |
|
14060 if(search_expression_type->is_real_type(IN_type_symbol)) |
|
14061 { |
|
14062 |
|
14063 symbol_c * return_type_symbol = IN_type_symbol; |
|
14064 s4o.print("atan("); |
|
14065 IN_param_value->accept(*this); |
|
14066 s4o.print(")"); |
|
14067 return NULL; |
|
14068 |
|
14069 } |
|
14070 |
|
14071 ERROR; |
|
14072 } |
|
14073 |
|
14074 }/*function_atan*/ |
|
14075 break; |
|
14076 |
|
14077 /**** |
|
14078 *ADD |
|
14079 */ |
|
14080 case function_add : |
|
14081 { |
|
14082 symbol_c *last_type_symbol = NULL; |
|
14083 |
|
14084 { |
|
14085 identifier_c param_name("IN1"); |
|
14086 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14087 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14088 |
|
14089 /* Get the value from a foo(<param_value>) style call */ |
|
14090 if (IN1_param_value == NULL) |
|
14091 IN1_param_value = function_call_param_iterator.next(); |
|
14092 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14093 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14094 |
|
14095 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14096 { |
|
14097 |
|
14098 { |
|
14099 identifier_c param_name("IN2"); |
|
14100 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14101 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14102 |
|
14103 /* Get the value from a foo(<param_value>) style call */ |
|
14104 if (IN2_param_value == NULL) |
|
14105 IN2_param_value = function_call_param_iterator.next(); |
|
14106 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14107 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14108 |
|
14109 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14110 { |
|
14111 |
|
14112 symbol_c * return_type_symbol = last_type_symbol; |
|
14113 s4o.indent_right(); |
|
14114 s4o.print("(\n" + s4o.indent_spaces); |
|
14115 IN1_param_value->accept(*this); |
|
14116 s4o.print("+\n" + s4o.indent_spaces); |
|
14117 IN2_param_value->accept(*this); |
|
14118 |
|
14119 int base_num = 3; |
|
14120 symbol_c *param_value = NULL; |
|
14121 do{ |
|
14122 char my_name[10]; |
|
14123 sprintf(my_name, "IN%d", base_num++); |
|
14124 identifier_c param_name(my_name); |
|
14125 |
|
14126 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14127 param_value = function_call_param_iterator.search(¶m_name); |
|
14128 |
|
14129 /* Get the value from a foo(<param_value>) style call */ |
|
14130 if (param_value == NULL) |
|
14131 param_value = function_call_param_iterator.next(); |
|
14132 if (param_value != NULL){ |
|
14133 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
14134 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
14135 |
|
14136 /*Function specific CODE */ |
|
14137 s4o.print("+\n" + s4o.indent_spaces); |
|
14138 param_value->accept(*this); |
|
14139 |
|
14140 } |
|
14141 |
|
14142 }while(param_value != NULL); |
|
14143 s4o.print(")"); |
|
14144 s4o.indent_left(); |
|
14145 return NULL; |
|
14146 |
|
14147 |
|
14148 } |
|
14149 |
|
14150 ERROR; |
|
14151 } |
|
14152 |
|
14153 } |
|
14154 |
|
14155 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
14156 { |
|
14157 |
|
14158 { |
|
14159 identifier_c param_name("IN2"); |
|
14160 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14161 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14162 |
|
14163 /* Get the value from a foo(<param_value>) style call */ |
|
14164 if (IN2_param_value == NULL) |
|
14165 IN2_param_value = function_call_param_iterator.next(); |
|
14166 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14167 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14168 |
|
14169 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14170 { |
|
14171 |
|
14172 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
14173 s4o.print("__time_add("); |
|
14174 IN1_param_value->accept(*this); |
|
14175 s4o.print(", "); |
|
14176 IN2_param_value->accept(*this); |
|
14177 s4o.print(")"); |
|
14178 return NULL; |
|
14179 |
|
14180 } |
|
14181 |
|
14182 ERROR; |
|
14183 } |
|
14184 |
|
14185 } |
|
14186 |
|
14187 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
14188 { |
|
14189 |
|
14190 { |
|
14191 identifier_c param_name("IN2"); |
|
14192 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14193 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14194 |
|
14195 /* Get the value from a foo(<param_value>) style call */ |
|
14196 if (IN2_param_value == NULL) |
|
14197 IN2_param_value = function_call_param_iterator.next(); |
|
14198 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14199 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14200 |
|
14201 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14202 { |
|
14203 |
|
14204 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
14205 s4o.print("__time_add("); |
|
14206 IN1_param_value->accept(*this); |
|
14207 s4o.print(", "); |
|
14208 IN2_param_value->accept(*this); |
|
14209 s4o.print(")"); |
|
14210 return NULL; |
|
14211 |
|
14212 } |
|
14213 |
|
14214 ERROR; |
|
14215 } |
|
14216 |
|
14217 } |
|
14218 |
|
14219 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14220 { |
|
14221 |
|
14222 { |
|
14223 identifier_c param_name("IN2"); |
|
14224 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14225 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14226 |
|
14227 /* Get the value from a foo(<param_value>) style call */ |
|
14228 if (IN2_param_value == NULL) |
|
14229 IN2_param_value = function_call_param_iterator.next(); |
|
14230 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14231 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14232 |
|
14233 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14234 { |
|
14235 |
|
14236 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14237 s4o.print("__time_add("); |
|
14238 IN1_param_value->accept(*this); |
|
14239 s4o.print(", "); |
|
14240 IN2_param_value->accept(*this); |
|
14241 s4o.print(")"); |
|
14242 return NULL; |
|
14243 |
|
14244 } |
|
14245 |
|
14246 ERROR; |
|
14247 } |
|
14248 |
|
14249 } |
|
14250 |
|
14251 ERROR; |
|
14252 } |
|
14253 |
|
14254 }/*function_add*/ |
|
14255 break; |
|
14256 |
|
14257 /**** |
|
14258 *MUL |
|
14259 */ |
|
14260 case function_mul : |
|
14261 { |
|
14262 symbol_c *last_type_symbol = NULL; |
|
14263 |
|
14264 { |
|
14265 identifier_c param_name("IN1"); |
|
14266 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14267 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14268 |
|
14269 /* Get the value from a foo(<param_value>) style call */ |
|
14270 if (IN1_param_value == NULL) |
|
14271 IN1_param_value = function_call_param_iterator.next(); |
|
14272 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14273 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14274 |
|
14275 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14276 { |
|
14277 |
|
14278 { |
|
14279 identifier_c param_name("IN2"); |
|
14280 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14281 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14282 |
|
14283 /* Get the value from a foo(<param_value>) style call */ |
|
14284 if (IN2_param_value == NULL) |
|
14285 IN2_param_value = function_call_param_iterator.next(); |
|
14286 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14287 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14288 |
|
14289 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14290 { |
|
14291 |
|
14292 symbol_c * return_type_symbol = last_type_symbol; |
|
14293 s4o.indent_right(); |
|
14294 s4o.print("(\n" + s4o.indent_spaces); |
|
14295 IN1_param_value->accept(*this); |
|
14296 s4o.print("*\n" + s4o.indent_spaces); |
|
14297 IN2_param_value->accept(*this); |
|
14298 |
|
14299 int base_num = 3; |
|
14300 symbol_c *param_value = NULL; |
|
14301 do{ |
|
14302 char my_name[10]; |
|
14303 sprintf(my_name, "IN%d", base_num++); |
|
14304 identifier_c param_name(my_name); |
|
14305 |
|
14306 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14307 param_value = function_call_param_iterator.search(¶m_name); |
|
14308 |
|
14309 /* Get the value from a foo(<param_value>) style call */ |
|
14310 if (param_value == NULL) |
|
14311 param_value = function_call_param_iterator.next(); |
|
14312 if (param_value != NULL){ |
|
14313 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
14314 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
14315 |
|
14316 /*Function specific CODE */ |
|
14317 s4o.print("*\n" + s4o.indent_spaces); |
|
14318 param_value->accept(*this); |
|
14319 |
|
14320 } |
|
14321 |
|
14322 }while(param_value != NULL); |
|
14323 s4o.print(")"); |
|
14324 s4o.indent_left(); |
|
14325 return NULL; |
|
14326 |
|
14327 |
|
14328 } |
|
14329 |
|
14330 ERROR; |
|
14331 } |
|
14332 |
|
14333 } |
|
14334 |
|
14335 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14336 { |
|
14337 |
|
14338 { |
|
14339 identifier_c param_name("IN2"); |
|
14340 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14341 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14342 |
|
14343 /* Get the value from a foo(<param_value>) style call */ |
|
14344 if (IN2_param_value == NULL) |
|
14345 IN2_param_value = function_call_param_iterator.next(); |
|
14346 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14347 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14348 |
|
14349 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14350 { |
|
14351 |
|
14352 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14353 s4o.print("__time_mul("); |
|
14354 IN1_param_value->accept(*this); |
|
14355 s4o.print(", "); |
|
14356 IN2_param_value->accept(*this); |
|
14357 s4o.print(")"); |
|
14358 return NULL; |
|
14359 |
|
14360 } |
|
14361 |
|
14362 ERROR; |
|
14363 } |
|
14364 |
|
14365 } |
|
14366 |
|
14367 ERROR; |
|
14368 } |
|
14369 |
|
14370 }/*function_mul*/ |
|
14371 break; |
|
14372 |
|
14373 /**** |
|
14374 *SUB |
|
14375 */ |
|
14376 case function_sub : |
|
14377 { |
|
14378 symbol_c *last_type_symbol = NULL; |
|
14379 |
|
14380 { |
|
14381 identifier_c param_name("IN1"); |
|
14382 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14383 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14384 |
|
14385 /* Get the value from a foo(<param_value>) style call */ |
|
14386 if (IN1_param_value == NULL) |
|
14387 IN1_param_value = function_call_param_iterator.next(); |
|
14388 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14389 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14390 |
|
14391 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14392 { |
|
14393 |
|
14394 { |
|
14395 identifier_c param_name("IN2"); |
|
14396 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14397 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14398 |
|
14399 /* Get the value from a foo(<param_value>) style call */ |
|
14400 if (IN2_param_value == NULL) |
|
14401 IN2_param_value = function_call_param_iterator.next(); |
|
14402 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14403 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14404 |
|
14405 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14406 { |
|
14407 |
|
14408 symbol_c * return_type_symbol = last_type_symbol; |
|
14409 s4o.indent_right(); |
|
14410 s4o.print("(\n" + s4o.indent_spaces); |
|
14411 IN1_param_value->accept(*this); |
|
14412 s4o.print("-\n" + s4o.indent_spaces); |
|
14413 IN2_param_value->accept(*this); |
|
14414 s4o.print(")"); |
|
14415 s4o.indent_left(); |
|
14416 return NULL; |
|
14417 |
|
14418 } |
|
14419 |
|
14420 ERROR; |
|
14421 } |
|
14422 |
|
14423 } |
|
14424 |
|
14425 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
14426 { |
|
14427 |
|
14428 { |
|
14429 identifier_c param_name("IN2"); |
|
14430 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14431 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14432 |
|
14433 /* Get the value from a foo(<param_value>) style call */ |
|
14434 if (IN2_param_value == NULL) |
|
14435 IN2_param_value = function_call_param_iterator.next(); |
|
14436 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14437 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14438 |
|
14439 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
14440 { |
|
14441 |
|
14442 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14443 s4o.print("__time_sub("); |
|
14444 IN1_param_value->accept(*this); |
|
14445 s4o.print(", "); |
|
14446 IN2_param_value->accept(*this); |
|
14447 s4o.print(")"); |
|
14448 return NULL; |
|
14449 |
|
14450 } |
|
14451 |
|
14452 ERROR; |
|
14453 } |
|
14454 |
|
14455 } |
|
14456 |
|
14457 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
14458 { |
|
14459 |
|
14460 { |
|
14461 identifier_c param_name("IN2"); |
|
14462 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14463 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14464 |
|
14465 /* Get the value from a foo(<param_value>) style call */ |
|
14466 if (IN2_param_value == NULL) |
|
14467 IN2_param_value = function_call_param_iterator.next(); |
|
14468 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14469 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14470 |
|
14471 if(search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol)) |
|
14472 { |
|
14473 |
|
14474 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14475 s4o.print("__time_sub("); |
|
14476 IN1_param_value->accept(*this); |
|
14477 s4o.print(", "); |
|
14478 IN2_param_value->accept(*this); |
|
14479 s4o.print(")"); |
|
14480 return NULL; |
|
14481 |
|
14482 } |
|
14483 |
|
14484 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14485 { |
|
14486 |
|
14487 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
14488 s4o.print("__time_sub("); |
|
14489 IN1_param_value->accept(*this); |
|
14490 s4o.print(", "); |
|
14491 IN2_param_value->accept(*this); |
|
14492 s4o.print(")"); |
|
14493 return NULL; |
|
14494 |
|
14495 } |
|
14496 |
|
14497 ERROR; |
|
14498 } |
|
14499 |
|
14500 } |
|
14501 |
|
14502 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
14503 { |
|
14504 |
|
14505 { |
|
14506 identifier_c param_name("IN2"); |
|
14507 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14508 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14509 |
|
14510 /* Get the value from a foo(<param_value>) style call */ |
|
14511 if (IN2_param_value == NULL) |
|
14512 IN2_param_value = function_call_param_iterator.next(); |
|
14513 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14514 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14515 |
|
14516 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
14517 { |
|
14518 |
|
14519 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14520 s4o.print("__time_sub("); |
|
14521 IN1_param_value->accept(*this); |
|
14522 s4o.print(", "); |
|
14523 IN2_param_value->accept(*this); |
|
14524 s4o.print(")"); |
|
14525 return NULL; |
|
14526 |
|
14527 } |
|
14528 |
|
14529 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14530 { |
|
14531 |
|
14532 symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name; |
|
14533 s4o.print("__time_sub("); |
|
14534 IN1_param_value->accept(*this); |
|
14535 s4o.print(", "); |
|
14536 IN2_param_value->accept(*this); |
|
14537 s4o.print(")"); |
|
14538 return NULL; |
|
14539 |
|
14540 } |
|
14541 |
|
14542 ERROR; |
|
14543 } |
|
14544 |
|
14545 } |
|
14546 |
|
14547 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14548 { |
|
14549 |
|
14550 { |
|
14551 identifier_c param_name("IN2"); |
|
14552 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14553 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14554 |
|
14555 /* Get the value from a foo(<param_value>) style call */ |
|
14556 if (IN2_param_value == NULL) |
|
14557 IN2_param_value = function_call_param_iterator.next(); |
|
14558 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14559 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14560 |
|
14561 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14562 { |
|
14563 |
|
14564 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14565 s4o.print("__time_sub("); |
|
14566 IN1_param_value->accept(*this); |
|
14567 s4o.print(", "); |
|
14568 IN2_param_value->accept(*this); |
|
14569 s4o.print(")"); |
|
14570 return NULL; |
|
14571 |
|
14572 } |
|
14573 |
|
14574 ERROR; |
|
14575 } |
|
14576 |
|
14577 } |
|
14578 |
|
14579 ERROR; |
|
14580 } |
|
14581 |
|
14582 }/*function_sub*/ |
|
14583 break; |
|
14584 |
|
14585 /**** |
|
14586 *DIV |
|
14587 */ |
|
14588 case function_div : |
|
14589 { |
|
14590 symbol_c *last_type_symbol = NULL; |
|
14591 |
|
14592 { |
|
14593 identifier_c param_name("IN1"); |
|
14594 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14595 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14596 |
|
14597 /* Get the value from a foo(<param_value>) style call */ |
|
14598 if (IN1_param_value == NULL) |
|
14599 IN1_param_value = function_call_param_iterator.next(); |
|
14600 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14601 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14602 |
|
14603 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14604 { |
|
14605 |
|
14606 { |
|
14607 identifier_c param_name("IN2"); |
|
14608 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14609 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14610 |
|
14611 /* Get the value from a foo(<param_value>) style call */ |
|
14612 if (IN2_param_value == NULL) |
|
14613 IN2_param_value = function_call_param_iterator.next(); |
|
14614 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14615 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14616 |
|
14617 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14618 { |
|
14619 |
|
14620 symbol_c * return_type_symbol = last_type_symbol; |
|
14621 s4o.indent_right(); |
|
14622 s4o.print("(\n" + s4o.indent_spaces); |
|
14623 IN1_param_value->accept(*this); |
|
14624 s4o.print("/\n" + s4o.indent_spaces); |
|
14625 IN2_param_value->accept(*this); |
|
14626 s4o.print(")"); |
|
14627 s4o.indent_left(); |
|
14628 return NULL; |
|
14629 |
|
14630 } |
|
14631 |
|
14632 ERROR; |
|
14633 } |
|
14634 |
|
14635 } |
|
14636 |
|
14637 if(search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol)) |
|
14638 { |
|
14639 |
|
14640 { |
|
14641 identifier_c param_name("IN2"); |
|
14642 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14643 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14644 |
|
14645 /* Get the value from a foo(<param_value>) style call */ |
|
14646 if (IN2_param_value == NULL) |
|
14647 IN2_param_value = function_call_param_iterator.next(); |
|
14648 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14649 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14650 |
|
14651 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14652 { |
|
14653 |
|
14654 symbol_c * return_type_symbol = &search_constant_type_c::time_type_name; |
|
14655 s4o.print("__time_div("); |
|
14656 IN1_param_value->accept(*this); |
|
14657 s4o.print(", "); |
|
14658 IN2_param_value->accept(*this); |
|
14659 s4o.print(")"); |
|
14660 return NULL; |
|
14661 |
|
14662 } |
|
14663 |
|
14664 ERROR; |
|
14665 } |
|
14666 |
|
14667 } |
|
14668 |
|
14669 ERROR; |
|
14670 } |
|
14671 |
|
14672 }/*function_div*/ |
|
14673 break; |
|
14674 |
|
14675 /**** |
|
14676 *MOD |
|
14677 */ |
|
14678 case function_mod : |
|
14679 { |
|
14680 symbol_c *last_type_symbol = NULL; |
|
14681 |
|
14682 { |
|
14683 identifier_c param_name("IN1"); |
|
14684 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14685 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14686 |
|
14687 /* Get the value from a foo(<param_value>) style call */ |
|
14688 if (IN1_param_value == NULL) |
|
14689 IN1_param_value = function_call_param_iterator.next(); |
|
14690 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14691 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14692 |
|
14693 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14694 { |
|
14695 |
|
14696 { |
|
14697 identifier_c param_name("IN2"); |
|
14698 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14699 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14700 |
|
14701 /* Get the value from a foo(<param_value>) style call */ |
|
14702 if (IN2_param_value == NULL) |
|
14703 IN2_param_value = function_call_param_iterator.next(); |
|
14704 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14705 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14706 |
|
14707 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14708 { |
|
14709 |
|
14710 symbol_c * return_type_symbol = last_type_symbol; |
|
14711 s4o.indent_right(); |
|
14712 s4o.print("(\n" + s4o.indent_spaces); |
|
14713 IN1_param_value->accept(*this); |
|
14714 s4o.print("%\n" + s4o.indent_spaces); |
|
14715 IN2_param_value->accept(*this); |
|
14716 s4o.print(")"); |
|
14717 s4o.indent_left(); |
|
14718 return NULL; |
|
14719 |
|
14720 } |
|
14721 |
|
14722 ERROR; |
|
14723 } |
|
14724 |
|
14725 } |
|
14726 |
|
14727 ERROR; |
|
14728 } |
|
14729 |
|
14730 }/*function_mod*/ |
|
14731 break; |
|
14732 |
|
14733 /**** |
|
14734 *EXPT |
|
14735 */ |
|
14736 case function_expt : |
|
14737 { |
|
14738 symbol_c *last_type_symbol = NULL; |
|
14739 |
|
14740 { |
|
14741 identifier_c param_name("IN1"); |
|
14742 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14743 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
14744 |
|
14745 /* Get the value from a foo(<param_value>) style call */ |
|
14746 if (IN1_param_value == NULL) |
|
14747 IN1_param_value = function_call_param_iterator.next(); |
|
14748 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
14749 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
14750 |
|
14751 if(search_expression_type->is_num_type(IN1_type_symbol)) |
|
14752 { |
|
14753 |
|
14754 { |
|
14755 identifier_c param_name("IN2"); |
|
14756 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14757 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
14758 |
|
14759 /* Get the value from a foo(<param_value>) style call */ |
|
14760 if (IN2_param_value == NULL) |
|
14761 IN2_param_value = function_call_param_iterator.next(); |
|
14762 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
14763 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
14764 |
|
14765 if(search_expression_type->is_num_type(IN2_type_symbol)) |
|
14766 { |
|
14767 |
|
14768 symbol_c * return_type_symbol = last_type_symbol; |
|
14769 s4o.print("pow("); |
|
14770 IN1_param_value->accept(*this); |
|
14771 s4o.print(", "); |
|
14772 IN2_param_value->accept(*this); |
|
14773 s4o.print(")"); |
|
14774 return NULL; |
|
14775 |
|
14776 } |
|
14777 |
|
14778 ERROR; |
|
14779 } |
|
14780 |
|
14781 } |
|
14782 |
|
14783 ERROR; |
|
14784 } |
|
14785 |
|
14786 }/*function_expt*/ |
|
14787 break; |
|
14788 |
|
14789 /**** |
|
14790 *MOVE |
|
14791 */ |
|
14792 case function_move : |
|
14793 { |
|
14794 symbol_c *last_type_symbol = NULL; |
|
14795 |
|
14796 { |
|
14797 identifier_c param_name("IN"); |
|
14798 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14799 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14800 |
|
14801 /* Get the value from a foo(<param_value>) style call */ |
|
14802 if (IN_param_value == NULL) |
|
14803 IN_param_value = function_call_param_iterator.next(); |
|
14804 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14805 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14806 |
|
14807 if(search_expression_type->is_num_type(IN_type_symbol)) |
|
14808 { |
|
14809 |
|
14810 symbol_c * return_type_symbol = last_type_symbol; |
|
14811 IN_param_value->accept(*this); |
|
14812 return NULL; |
|
14813 |
|
14814 } |
|
14815 |
|
14816 ERROR; |
|
14817 } |
|
14818 |
|
14819 }/*function_move*/ |
|
14820 break; |
|
14821 |
|
14822 /**** |
|
14823 *SHL |
|
14824 */ |
|
14825 case function_shl : |
|
14826 { |
|
14827 symbol_c *last_type_symbol = NULL; |
|
14828 |
|
14829 { |
|
14830 identifier_c param_name("IN"); |
|
14831 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14832 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14833 |
|
14834 /* Get the value from a foo(<param_value>) style call */ |
|
14835 if (IN_param_value == NULL) |
|
14836 IN_param_value = function_call_param_iterator.next(); |
|
14837 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14838 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14839 |
|
14840 if(search_expression_type->is_binary_type(IN_type_symbol)) |
|
14841 { |
|
14842 |
|
14843 { |
|
14844 identifier_c param_name("N"); |
|
14845 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14846 symbol_c *N_param_value = function_call_param_iterator.search(¶m_name); |
|
14847 |
|
14848 /* Get the value from a foo(<param_value>) style call */ |
|
14849 if (N_param_value == NULL) |
|
14850 N_param_value = function_call_param_iterator.next(); |
|
14851 symbol_c *N_type_symbol = search_expression_type->get_type(N_param_value); |
|
14852 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(N_type_symbol, last_type_symbol) ? search_expression_type->common_type(N_type_symbol, last_type_symbol) : N_type_symbol ; |
|
14853 |
|
14854 if(search_expression_type->is_integer_type(N_type_symbol)) |
|
14855 { |
|
14856 |
|
14857 symbol_c * return_type_symbol = IN_type_symbol; |
|
14858 IN_param_value->accept(*this); |
|
14859 s4o.print("<<"); |
|
14860 N_param_value->accept(*this); |
|
14861 return NULL; |
|
14862 |
|
14863 } |
|
14864 |
|
14865 ERROR; |
|
14866 } |
|
14867 |
|
14868 } |
|
14869 |
|
14870 ERROR; |
|
14871 } |
|
14872 |
|
14873 }/*function_shl*/ |
|
14874 break; |
|
14875 |
|
14876 /**** |
|
14877 *SHR |
|
14878 */ |
|
14879 case function_shr : |
|
14880 { |
|
14881 symbol_c *last_type_symbol = NULL; |
|
14882 |
|
14883 { |
|
14884 identifier_c param_name("IN"); |
|
14885 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14886 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14887 |
|
14888 /* Get the value from a foo(<param_value>) style call */ |
|
14889 if (IN_param_value == NULL) |
|
14890 IN_param_value = function_call_param_iterator.next(); |
|
14891 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14892 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14893 |
|
14894 if(search_expression_type->is_binary_type(IN_type_symbol)) |
|
14895 { |
|
14896 |
|
14897 { |
|
14898 identifier_c param_name("N"); |
|
14899 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14900 symbol_c *N_param_value = function_call_param_iterator.search(¶m_name); |
|
14901 |
|
14902 /* Get the value from a foo(<param_value>) style call */ |
|
14903 if (N_param_value == NULL) |
|
14904 N_param_value = function_call_param_iterator.next(); |
|
14905 symbol_c *N_type_symbol = search_expression_type->get_type(N_param_value); |
|
14906 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(N_type_symbol, last_type_symbol) ? search_expression_type->common_type(N_type_symbol, last_type_symbol) : N_type_symbol ; |
|
14907 |
|
14908 if(search_expression_type->is_integer_type(N_type_symbol)) |
|
14909 { |
|
14910 |
|
14911 symbol_c * return_type_symbol = IN_type_symbol; |
|
14912 IN_param_value->accept(*this); |
|
14913 s4o.print(">>"); |
|
14914 N_param_value->accept(*this); |
|
14915 return NULL; |
|
14916 |
|
14917 } |
|
14918 |
|
14919 ERROR; |
|
14920 } |
|
14921 |
|
14922 } |
|
14923 |
|
14924 ERROR; |
|
14925 } |
|
14926 |
|
14927 }/*function_shr*/ |
|
14928 break; |
|
14929 |
|
14930 /**** |
|
14931 *ROR |
|
14932 */ |
|
14933 case function_ror : |
|
14934 { |
|
14935 symbol_c *last_type_symbol = NULL; |
|
14936 |
|
14937 { |
|
14938 identifier_c param_name("IN"); |
|
14939 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14940 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14941 |
|
14942 /* Get the value from a foo(<param_value>) style call */ |
|
14943 if (IN_param_value == NULL) |
|
14944 IN_param_value = function_call_param_iterator.next(); |
|
14945 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
14946 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
14947 |
|
14948 if(search_expression_type->is_nbinary_type(IN_type_symbol)) |
|
14949 { |
|
14950 |
|
14951 { |
|
14952 identifier_c param_name("N"); |
|
14953 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14954 symbol_c *N_param_value = function_call_param_iterator.search(¶m_name); |
|
14955 |
|
14956 /* Get the value from a foo(<param_value>) style call */ |
|
14957 if (N_param_value == NULL) |
|
14958 N_param_value = function_call_param_iterator.next(); |
|
14959 symbol_c *N_type_symbol = search_expression_type->get_type(N_param_value); |
|
14960 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(N_type_symbol, last_type_symbol) ? search_expression_type->common_type(N_type_symbol, last_type_symbol) : N_type_symbol ; |
|
14961 |
|
14962 if(search_expression_type->is_integer_type(N_type_symbol)) |
|
14963 { |
|
14964 |
|
14965 symbol_c * return_type_symbol = IN_type_symbol; |
|
14966 s4o.print("__ror_"); |
|
14967 IN_type_symbol->accept(*this); |
|
14968 s4o.print("("); |
|
14969 IN_param_value->accept(*this); |
|
14970 s4o.print(", "); |
|
14971 N_param_value->accept(*this); |
|
14972 s4o.print(")"); |
|
14973 return NULL; |
|
14974 |
|
14975 } |
|
14976 |
|
14977 ERROR; |
|
14978 } |
|
14979 |
|
14980 } |
|
14981 |
|
14982 ERROR; |
|
14983 } |
|
14984 |
|
14985 }/*function_ror*/ |
|
14986 break; |
|
14987 |
|
14988 /**** |
|
14989 *ROL |
|
14990 */ |
|
14991 case function_rol : |
|
14992 { |
|
14993 symbol_c *last_type_symbol = NULL; |
|
14994 |
|
14995 { |
|
14996 identifier_c param_name("IN"); |
|
14997 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
14998 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
14999 |
|
15000 /* Get the value from a foo(<param_value>) style call */ |
|
15001 if (IN_param_value == NULL) |
|
15002 IN_param_value = function_call_param_iterator.next(); |
|
15003 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
15004 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
15005 |
|
15006 if(search_expression_type->is_nbinary_type(IN_type_symbol)) |
|
15007 { |
|
15008 |
|
15009 { |
|
15010 identifier_c param_name("N"); |
|
15011 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15012 symbol_c *N_param_value = function_call_param_iterator.search(¶m_name); |
|
15013 |
|
15014 /* Get the value from a foo(<param_value>) style call */ |
|
15015 if (N_param_value == NULL) |
|
15016 N_param_value = function_call_param_iterator.next(); |
|
15017 symbol_c *N_type_symbol = search_expression_type->get_type(N_param_value); |
|
15018 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(N_type_symbol, last_type_symbol) ? search_expression_type->common_type(N_type_symbol, last_type_symbol) : N_type_symbol ; |
|
15019 |
|
15020 if(search_expression_type->is_integer_type(N_type_symbol)) |
|
15021 { |
|
15022 |
|
15023 symbol_c * return_type_symbol = IN_type_symbol; |
|
15024 s4o.print("__rol_"); |
|
15025 IN_type_symbol->accept(*this); |
|
15026 s4o.print("("); |
|
15027 IN_param_value->accept(*this); |
|
15028 s4o.print(", "); |
|
15029 N_param_value->accept(*this); |
|
15030 s4o.print(")"); |
|
15031 return NULL; |
|
15032 |
|
15033 } |
|
15034 |
|
15035 ERROR; |
|
15036 } |
|
15037 |
|
15038 } |
|
15039 |
|
15040 ERROR; |
|
15041 } |
|
15042 |
|
15043 }/*function_rol*/ |
|
15044 break; |
|
15045 |
|
15046 /**** |
|
15047 *AND |
|
15048 */ |
|
15049 case function_and : |
|
15050 { |
|
15051 symbol_c *last_type_symbol = NULL; |
|
15052 |
|
15053 { |
|
15054 identifier_c param_name("IN1"); |
|
15055 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15056 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15057 |
|
15058 /* Get the value from a foo(<param_value>) style call */ |
|
15059 if (IN1_param_value == NULL) |
|
15060 IN1_param_value = function_call_param_iterator.next(); |
|
15061 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15062 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15063 |
|
15064 if(search_expression_type->is_binary_type(IN1_type_symbol)) |
|
15065 { |
|
15066 |
|
15067 { |
|
15068 identifier_c param_name("IN2"); |
|
15069 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15070 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15071 |
|
15072 /* Get the value from a foo(<param_value>) style call */ |
|
15073 if (IN2_param_value == NULL) |
|
15074 IN2_param_value = function_call_param_iterator.next(); |
|
15075 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15076 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15077 |
|
15078 if(search_expression_type->is_binary_type(IN2_type_symbol)) |
|
15079 { |
|
15080 |
|
15081 symbol_c * return_type_symbol = last_type_symbol; |
|
15082 s4o.indent_right(); |
|
15083 s4o.print("("); |
|
15084 if (search_expression_type->is_bool_type(last_type_symbol)) |
|
15085 s4o.print("(\n" + s4o.indent_spaces); |
|
15086 IN1_param_value->accept(*this); |
|
15087 s4o.print("&\n" + s4o.indent_spaces); |
|
15088 IN2_param_value->accept(*this); |
|
15089 |
|
15090 int base_num = 3; |
|
15091 symbol_c *param_value = NULL; |
|
15092 do{ |
|
15093 char my_name[10]; |
|
15094 sprintf(my_name, "IN%d", base_num++); |
|
15095 identifier_c param_name(my_name); |
|
15096 |
|
15097 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15098 param_value = function_call_param_iterator.search(¶m_name); |
|
15099 |
|
15100 /* Get the value from a foo(<param_value>) style call */ |
|
15101 if (param_value == NULL) |
|
15102 param_value = function_call_param_iterator.next(); |
|
15103 if (param_value != NULL){ |
|
15104 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15105 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15106 |
|
15107 /*Function specific CODE */ |
|
15108 s4o.print("&\n" + s4o.indent_spaces); |
|
15109 param_value->accept(*this); |
|
15110 |
|
15111 } |
|
15112 |
|
15113 }while(param_value != NULL); |
|
15114 s4o.print(")"); |
|
15115 if (search_expression_type->is_bool_type(last_type_symbol)) { |
|
15116 s4o.print("&1"); |
|
15117 s4o.print(")"); |
|
15118 } |
|
15119 s4o.print(""); |
|
15120 s4o.indent_left(); |
|
15121 return NULL; |
|
15122 |
|
15123 |
|
15124 } |
|
15125 |
|
15126 ERROR; |
|
15127 } |
|
15128 |
|
15129 } |
|
15130 |
|
15131 ERROR; |
|
15132 } |
|
15133 |
|
15134 }/*function_and*/ |
|
15135 break; |
|
15136 |
|
15137 /**** |
|
15138 *OR |
|
15139 */ |
|
15140 case function_or : |
|
15141 { |
|
15142 symbol_c *last_type_symbol = NULL; |
|
15143 |
|
15144 { |
|
15145 identifier_c param_name("IN1"); |
|
15146 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15147 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15148 |
|
15149 /* Get the value from a foo(<param_value>) style call */ |
|
15150 if (IN1_param_value == NULL) |
|
15151 IN1_param_value = function_call_param_iterator.next(); |
|
15152 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15153 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15154 |
|
15155 if(search_expression_type->is_binary_type(IN1_type_symbol)) |
|
15156 { |
|
15157 |
|
15158 { |
|
15159 identifier_c param_name("IN2"); |
|
15160 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15161 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15162 |
|
15163 /* Get the value from a foo(<param_value>) style call */ |
|
15164 if (IN2_param_value == NULL) |
|
15165 IN2_param_value = function_call_param_iterator.next(); |
|
15166 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15167 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15168 |
|
15169 if(search_expression_type->is_binary_type(IN2_type_symbol)) |
|
15170 { |
|
15171 |
|
15172 symbol_c * return_type_symbol = last_type_symbol; |
|
15173 s4o.indent_right(); |
|
15174 s4o.print("("); |
|
15175 if (search_expression_type->is_bool_type(last_type_symbol)) |
|
15176 s4o.print("(\n" + s4o.indent_spaces); |
|
15177 IN1_param_value->accept(*this); |
|
15178 s4o.print("|\n" + s4o.indent_spaces); |
|
15179 IN2_param_value->accept(*this); |
|
15180 |
|
15181 int base_num = 3; |
|
15182 symbol_c *param_value = NULL; |
|
15183 do{ |
|
15184 char my_name[10]; |
|
15185 sprintf(my_name, "IN%d", base_num++); |
|
15186 identifier_c param_name(my_name); |
|
15187 |
|
15188 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15189 param_value = function_call_param_iterator.search(¶m_name); |
|
15190 |
|
15191 /* Get the value from a foo(<param_value>) style call */ |
|
15192 if (param_value == NULL) |
|
15193 param_value = function_call_param_iterator.next(); |
|
15194 if (param_value != NULL){ |
|
15195 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15196 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15197 |
|
15198 /*Function specific CODE */ |
|
15199 s4o.print("|\n" + s4o.indent_spaces); |
|
15200 param_value->accept(*this); |
|
15201 |
|
15202 } |
|
15203 |
|
15204 }while(param_value != NULL); |
|
15205 s4o.print(")"); |
|
15206 if (search_expression_type->is_bool_type(last_type_symbol)) { |
|
15207 s4o.print("&1"); |
|
15208 s4o.print(")"); |
|
15209 } |
|
15210 s4o.print(""); |
|
15211 s4o.indent_left(); |
|
15212 return NULL; |
|
15213 |
|
15214 |
|
15215 } |
|
15216 |
|
15217 ERROR; |
|
15218 } |
|
15219 |
|
15220 } |
|
15221 |
|
15222 ERROR; |
|
15223 } |
|
15224 |
|
15225 }/*function_or*/ |
|
15226 break; |
|
15227 |
|
15228 /**** |
|
15229 *XOR |
|
15230 */ |
|
15231 case function_xor : |
|
15232 { |
|
15233 symbol_c *last_type_symbol = NULL; |
|
15234 |
|
15235 { |
|
15236 identifier_c param_name("IN1"); |
|
15237 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15238 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15239 |
|
15240 /* Get the value from a foo(<param_value>) style call */ |
|
15241 if (IN1_param_value == NULL) |
|
15242 IN1_param_value = function_call_param_iterator.next(); |
|
15243 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15244 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15245 |
|
15246 if(search_expression_type->is_binary_type(IN1_type_symbol)) |
|
15247 { |
|
15248 |
|
15249 { |
|
15250 identifier_c param_name("IN2"); |
|
15251 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15252 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15253 |
|
15254 /* Get the value from a foo(<param_value>) style call */ |
|
15255 if (IN2_param_value == NULL) |
|
15256 IN2_param_value = function_call_param_iterator.next(); |
|
15257 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15258 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15259 |
|
15260 if(search_expression_type->is_binary_type(IN2_type_symbol)) |
|
15261 { |
|
15262 |
|
15263 symbol_c * return_type_symbol = last_type_symbol; |
|
15264 s4o.indent_right(); |
|
15265 s4o.print("("); |
|
15266 if (search_expression_type->is_bool_type(last_type_symbol)) |
|
15267 s4o.print("(\n" + s4o.indent_spaces); |
|
15268 IN1_param_value->accept(*this); |
|
15269 s4o.print("^\n" + s4o.indent_spaces); |
|
15270 IN2_param_value->accept(*this); |
|
15271 |
|
15272 int base_num = 3; |
|
15273 symbol_c *param_value = NULL; |
|
15274 do{ |
|
15275 char my_name[10]; |
|
15276 sprintf(my_name, "IN%d", base_num++); |
|
15277 identifier_c param_name(my_name); |
|
15278 |
|
15279 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15280 param_value = function_call_param_iterator.search(¶m_name); |
|
15281 |
|
15282 /* Get the value from a foo(<param_value>) style call */ |
|
15283 if (param_value == NULL) |
|
15284 param_value = function_call_param_iterator.next(); |
|
15285 if (param_value != NULL){ |
|
15286 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15287 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15288 |
|
15289 /*Function specific CODE */ |
|
15290 s4o.print("^\n" + s4o.indent_spaces); |
|
15291 param_value->accept(*this); |
|
15292 |
|
15293 } |
|
15294 |
|
15295 }while(param_value != NULL); |
|
15296 s4o.print(")"); |
|
15297 if (search_expression_type->is_bool_type(last_type_symbol)) { |
|
15298 s4o.print("&1"); |
|
15299 s4o.print(")"); |
|
15300 } |
|
15301 s4o.print(""); |
|
15302 s4o.indent_left(); |
|
15303 return NULL; |
|
15304 |
|
15305 |
|
15306 } |
|
15307 |
|
15308 ERROR; |
|
15309 } |
|
15310 |
|
15311 } |
|
15312 |
|
15313 ERROR; |
|
15314 } |
|
15315 |
|
15316 }/*function_xor*/ |
|
15317 break; |
|
15318 |
|
15319 /**** |
|
15320 *NOT |
|
15321 */ |
|
15322 case function_not : |
|
15323 { |
|
15324 symbol_c *last_type_symbol = NULL; |
|
15325 |
|
15326 { |
|
15327 identifier_c param_name("IN"); |
|
15328 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15329 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
15330 |
|
15331 /* Get the value from a foo(<param_value>) style call */ |
|
15332 if (IN_param_value == NULL) |
|
15333 IN_param_value = function_call_param_iterator.next(); |
|
15334 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
15335 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
15336 |
|
15337 if(search_expression_type->is_binary_type(IN_type_symbol)) |
|
15338 { |
|
15339 |
|
15340 symbol_c * return_type_symbol = IN_type_symbol; |
|
15341 s4o.print("~"); |
|
15342 IN_param_value->accept(*this); |
|
15343 return NULL; |
|
15344 |
|
15345 } |
|
15346 |
|
15347 ERROR; |
|
15348 } |
|
15349 |
|
15350 }/*function_not*/ |
|
15351 break; |
|
15352 |
|
15353 /**** |
|
15354 *SEL |
|
15355 */ |
|
15356 case function_sel : |
|
15357 { |
|
15358 symbol_c *last_type_symbol = NULL; |
|
15359 |
|
15360 { |
|
15361 identifier_c param_name("G"); |
|
15362 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15363 symbol_c *G_param_value = function_call_param_iterator.search(¶m_name); |
|
15364 |
|
15365 /* Get the value from a foo(<param_value>) style call */ |
|
15366 if (G_param_value == NULL) |
|
15367 G_param_value = function_call_param_iterator.next(); |
|
15368 symbol_c *G_type_symbol = search_expression_type->get_type(G_param_value); |
|
15369 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(G_type_symbol, last_type_symbol) ? search_expression_type->common_type(G_type_symbol, last_type_symbol) : G_type_symbol ; |
|
15370 |
|
15371 if(search_expression_type->is_same_type(&search_constant_type_c::bool_type_name, last_type_symbol)) |
|
15372 { |
|
15373 |
|
15374 { |
|
15375 identifier_c param_name("IN0"); |
|
15376 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15377 symbol_c *IN0_param_value = function_call_param_iterator.search(¶m_name); |
|
15378 |
|
15379 /* Get the value from a foo(<param_value>) style call */ |
|
15380 if (IN0_param_value == NULL) |
|
15381 IN0_param_value = function_call_param_iterator.next(); |
|
15382 symbol_c *IN0_type_symbol = search_expression_type->get_type(IN0_param_value); |
|
15383 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN0_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN0_type_symbol, last_type_symbol) : IN0_type_symbol ; |
|
15384 |
|
15385 |
|
15386 { |
|
15387 |
|
15388 { |
|
15389 identifier_c param_name("IN1"); |
|
15390 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15391 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15392 |
|
15393 /* Get the value from a foo(<param_value>) style call */ |
|
15394 if (IN1_param_value == NULL) |
|
15395 IN1_param_value = function_call_param_iterator.next(); |
|
15396 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15397 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15398 |
|
15399 |
|
15400 { |
|
15401 |
|
15402 symbol_c * return_type_symbol = last_type_symbol; |
|
15403 G_param_value->accept(*this); |
|
15404 s4o.print(" ? "); |
|
15405 IN1_param_value->accept(*this); |
|
15406 s4o.print(" : "); |
|
15407 IN0_param_value->accept(*this); |
|
15408 return NULL; |
|
15409 |
|
15410 } |
|
15411 |
|
15412 ERROR; |
|
15413 } |
|
15414 |
|
15415 } |
|
15416 |
|
15417 ERROR; |
|
15418 } |
|
15419 |
|
15420 } |
|
15421 |
|
15422 ERROR; |
|
15423 } |
|
15424 |
|
15425 }/*function_sel*/ |
|
15426 break; |
|
15427 |
|
15428 /**** |
|
15429 *MAX |
|
15430 */ |
|
15431 case function_max : |
|
15432 { |
|
15433 symbol_c *last_type_symbol = NULL; |
|
15434 |
|
15435 { |
|
15436 identifier_c param_name("IN1"); |
|
15437 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15438 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15439 |
|
15440 /* Get the value from a foo(<param_value>) style call */ |
|
15441 if (IN1_param_value == NULL) |
|
15442 IN1_param_value = function_call_param_iterator.next(); |
|
15443 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15444 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15445 |
|
15446 |
|
15447 { |
|
15448 |
|
15449 { |
|
15450 identifier_c param_name("IN2"); |
|
15451 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15452 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15453 |
|
15454 /* Get the value from a foo(<param_value>) style call */ |
|
15455 if (IN2_param_value == NULL) |
|
15456 IN2_param_value = function_call_param_iterator.next(); |
|
15457 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15458 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15459 |
|
15460 |
|
15461 { |
|
15462 |
|
15463 symbol_c * return_type_symbol = last_type_symbol; |
|
15464 s4o.indent_right(); |
|
15465 s4o.print("__max_"); |
|
15466 return_type_symbol->accept(*this); |
|
15467 s4o.print("("); |
|
15468 s4o.print_integer(nb_param); |
|
15469 s4o.print(",\n" + s4o.indent_spaces); |
|
15470 IN1_param_value->accept(*this); |
|
15471 s4o.print(",\n" + s4o.indent_spaces); |
|
15472 IN2_param_value->accept(*this); |
|
15473 |
|
15474 int base_num = 3; |
|
15475 symbol_c *param_value = NULL; |
|
15476 do{ |
|
15477 char my_name[10]; |
|
15478 sprintf(my_name, "IN%d", base_num++); |
|
15479 identifier_c param_name(my_name); |
|
15480 |
|
15481 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15482 param_value = function_call_param_iterator.search(¶m_name); |
|
15483 |
|
15484 /* Get the value from a foo(<param_value>) style call */ |
|
15485 if (param_value == NULL) |
|
15486 param_value = function_call_param_iterator.next(); |
|
15487 if (param_value != NULL){ |
|
15488 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15489 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15490 |
|
15491 /*Function specific CODE */ |
|
15492 s4o.print(",\n" + s4o.indent_spaces); |
|
15493 param_value->accept(*this); |
|
15494 |
|
15495 } |
|
15496 |
|
15497 }while(param_value != NULL); |
|
15498 s4o.print(")"); |
|
15499 s4o.indent_left(); |
|
15500 return NULL; |
|
15501 |
|
15502 |
|
15503 } |
|
15504 |
|
15505 ERROR; |
|
15506 } |
|
15507 |
|
15508 } |
|
15509 |
|
15510 ERROR; |
|
15511 } |
|
15512 |
|
15513 }/*function_max*/ |
|
15514 break; |
|
15515 |
|
15516 /**** |
|
15517 *MIN |
|
15518 */ |
|
15519 case function_min : |
|
15520 { |
|
15521 symbol_c *last_type_symbol = NULL; |
|
15522 |
|
15523 { |
|
15524 identifier_c param_name("IN1"); |
|
15525 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15526 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15527 |
|
15528 /* Get the value from a foo(<param_value>) style call */ |
|
15529 if (IN1_param_value == NULL) |
|
15530 IN1_param_value = function_call_param_iterator.next(); |
|
15531 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15532 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15533 |
|
15534 |
|
15535 { |
|
15536 |
|
15537 { |
|
15538 identifier_c param_name("IN2"); |
|
15539 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15540 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15541 |
|
15542 /* Get the value from a foo(<param_value>) style call */ |
|
15543 if (IN2_param_value == NULL) |
|
15544 IN2_param_value = function_call_param_iterator.next(); |
|
15545 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15546 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15547 |
|
15548 |
|
15549 { |
|
15550 |
|
15551 symbol_c * return_type_symbol = last_type_symbol; |
|
15552 s4o.indent_right(); |
|
15553 s4o.print("__min_"); |
|
15554 return_type_symbol->accept(*this); |
|
15555 s4o.print("("); |
|
15556 s4o.print_integer(nb_param); |
|
15557 s4o.print(",\n" + s4o.indent_spaces); |
|
15558 IN1_param_value->accept(*this); |
|
15559 s4o.print(",\n" + s4o.indent_spaces); |
|
15560 IN2_param_value->accept(*this); |
|
15561 |
|
15562 int base_num = 3; |
|
15563 symbol_c *param_value = NULL; |
|
15564 do{ |
|
15565 char my_name[10]; |
|
15566 sprintf(my_name, "IN%d", base_num++); |
|
15567 identifier_c param_name(my_name); |
|
15568 |
|
15569 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15570 param_value = function_call_param_iterator.search(¶m_name); |
|
15571 |
|
15572 /* Get the value from a foo(<param_value>) style call */ |
|
15573 if (param_value == NULL) |
|
15574 param_value = function_call_param_iterator.next(); |
|
15575 if (param_value != NULL){ |
|
15576 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15577 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15578 |
|
15579 /*Function specific CODE */ |
|
15580 s4o.print(",\n" + s4o.indent_spaces); |
|
15581 param_value->accept(*this); |
|
15582 |
|
15583 } |
|
15584 |
|
15585 }while(param_value != NULL); |
|
15586 s4o.print(")"); |
|
15587 s4o.indent_left(); |
|
15588 return NULL; |
|
15589 |
|
15590 |
|
15591 } |
|
15592 |
|
15593 ERROR; |
|
15594 } |
|
15595 |
|
15596 } |
|
15597 |
|
15598 ERROR; |
|
15599 } |
|
15600 |
|
15601 }/*function_min*/ |
|
15602 break; |
|
15603 |
|
15604 /**** |
|
15605 *LIMIT |
|
15606 */ |
|
15607 case function_limit : |
|
15608 { |
|
15609 symbol_c *last_type_symbol = NULL; |
|
15610 |
|
15611 { |
|
15612 identifier_c param_name("MN"); |
|
15613 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15614 symbol_c *MN_param_value = function_call_param_iterator.search(¶m_name); |
|
15615 |
|
15616 /* Get the value from a foo(<param_value>) style call */ |
|
15617 if (MN_param_value == NULL) |
|
15618 MN_param_value = function_call_param_iterator.next(); |
|
15619 symbol_c *MN_type_symbol = search_expression_type->get_type(MN_param_value); |
|
15620 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(MN_type_symbol, last_type_symbol) ? search_expression_type->common_type(MN_type_symbol, last_type_symbol) : MN_type_symbol ; |
|
15621 |
|
15622 |
|
15623 { |
|
15624 |
|
15625 { |
|
15626 identifier_c param_name("IN"); |
|
15627 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15628 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
15629 |
|
15630 /* Get the value from a foo(<param_value>) style call */ |
|
15631 if (IN_param_value == NULL) |
|
15632 IN_param_value = function_call_param_iterator.next(); |
|
15633 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
15634 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
15635 |
|
15636 |
|
15637 { |
|
15638 |
|
15639 { |
|
15640 identifier_c param_name("MX"); |
|
15641 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15642 symbol_c *MX_param_value = function_call_param_iterator.search(¶m_name); |
|
15643 |
|
15644 /* Get the value from a foo(<param_value>) style call */ |
|
15645 if (MX_param_value == NULL) |
|
15646 MX_param_value = function_call_param_iterator.next(); |
|
15647 symbol_c *MX_type_symbol = search_expression_type->get_type(MX_param_value); |
|
15648 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(MX_type_symbol, last_type_symbol) ? search_expression_type->common_type(MX_type_symbol, last_type_symbol) : MX_type_symbol ; |
|
15649 |
|
15650 |
|
15651 { |
|
15652 |
|
15653 symbol_c * return_type_symbol = IN_type_symbol; |
|
15654 s4o.print("__limit_"); |
|
15655 IN_type_symbol->accept(*this); |
|
15656 s4o.print("("); |
|
15657 MN_param_value->accept(*this); |
|
15658 s4o.print(", "); |
|
15659 IN_param_value->accept(*this); |
|
15660 s4o.print(", "); |
|
15661 MX_param_value->accept(*this); |
|
15662 s4o.print(")"); |
|
15663 return NULL; |
|
15664 |
|
15665 } |
|
15666 |
|
15667 ERROR; |
|
15668 } |
|
15669 |
|
15670 } |
|
15671 |
|
15672 ERROR; |
|
15673 } |
|
15674 |
|
15675 } |
|
15676 |
|
15677 ERROR; |
|
15678 } |
|
15679 |
|
15680 }/*function_limit*/ |
|
15681 break; |
|
15682 |
|
15683 /**** |
|
15684 *MUX |
|
15685 */ |
|
15686 case function_mux : |
|
15687 { |
|
15688 symbol_c *last_type_symbol = NULL; |
|
15689 |
|
15690 { |
|
15691 identifier_c param_name("K"); |
|
15692 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15693 symbol_c *K_param_value = function_call_param_iterator.search(¶m_name); |
|
15694 |
|
15695 /* Get the value from a foo(<param_value>) style call */ |
|
15696 if (K_param_value == NULL) |
|
15697 K_param_value = function_call_param_iterator.next(); |
|
15698 symbol_c *K_type_symbol = search_expression_type->get_type(K_param_value); |
|
15699 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(K_type_symbol, last_type_symbol) ? search_expression_type->common_type(K_type_symbol, last_type_symbol) : K_type_symbol ; |
|
15700 |
|
15701 if(search_expression_type->is_integer_type(K_type_symbol)) |
|
15702 { |
|
15703 |
|
15704 { |
|
15705 identifier_c param_name("IN0"); |
|
15706 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15707 symbol_c *IN0_param_value = function_call_param_iterator.search(¶m_name); |
|
15708 |
|
15709 /* Get the value from a foo(<param_value>) style call */ |
|
15710 if (IN0_param_value == NULL) |
|
15711 IN0_param_value = function_call_param_iterator.next(); |
|
15712 symbol_c *IN0_type_symbol = search_expression_type->get_type(IN0_param_value); |
|
15713 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN0_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN0_type_symbol, last_type_symbol) : IN0_type_symbol ; |
|
15714 |
|
15715 |
|
15716 { |
|
15717 |
|
15718 { |
|
15719 identifier_c param_name("IN1"); |
|
15720 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15721 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15722 |
|
15723 /* Get the value from a foo(<param_value>) style call */ |
|
15724 if (IN1_param_value == NULL) |
|
15725 IN1_param_value = function_call_param_iterator.next(); |
|
15726 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15727 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15728 |
|
15729 |
|
15730 { |
|
15731 |
|
15732 symbol_c * return_type_symbol = last_type_symbol; |
|
15733 s4o.indent_right(); |
|
15734 s4o.print("__mux_"); |
|
15735 return_type_symbol->accept(*this); |
|
15736 s4o.print("("); |
|
15737 s4o.print_integer(nb_param); |
|
15738 s4o.print(",\n" + s4o.indent_spaces); |
|
15739 K_param_value->accept(*this); |
|
15740 s4o.print(",\n" + s4o.indent_spaces); |
|
15741 IN0_param_value->accept(*this); |
|
15742 s4o.print(",\n" + s4o.indent_spaces); |
|
15743 IN1_param_value->accept(*this); |
|
15744 |
|
15745 int base_num = 2; |
|
15746 symbol_c *param_value = NULL; |
|
15747 do{ |
|
15748 char my_name[10]; |
|
15749 sprintf(my_name, "IN%d", base_num++); |
|
15750 identifier_c param_name(my_name); |
|
15751 |
|
15752 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15753 param_value = function_call_param_iterator.search(¶m_name); |
|
15754 |
|
15755 /* Get the value from a foo(<param_value>) style call */ |
|
15756 if (param_value == NULL) |
|
15757 param_value = function_call_param_iterator.next(); |
|
15758 if (param_value != NULL){ |
|
15759 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15760 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15761 |
|
15762 /*Function specific CODE */ |
|
15763 s4o.print(",\n" + s4o.indent_spaces); |
|
15764 param_value->accept(*this); |
|
15765 |
|
15766 } |
|
15767 |
|
15768 }while(param_value != NULL); |
|
15769 s4o.print(")"); |
|
15770 s4o.indent_left(); |
|
15771 return NULL; |
|
15772 |
|
15773 |
|
15774 } |
|
15775 |
|
15776 ERROR; |
|
15777 } |
|
15778 |
|
15779 } |
|
15780 |
|
15781 ERROR; |
|
15782 } |
|
15783 |
|
15784 } |
|
15785 |
|
15786 ERROR; |
|
15787 } |
|
15788 |
|
15789 }/*function_mux*/ |
|
15790 break; |
|
15791 |
|
15792 /**** |
|
15793 *GT |
|
15794 */ |
|
15795 case function_gt : |
|
15796 { |
|
15797 symbol_c *last_type_symbol = NULL; |
|
15798 |
|
15799 { |
|
15800 identifier_c param_name("IN1"); |
|
15801 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15802 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15803 |
|
15804 /* Get the value from a foo(<param_value>) style call */ |
|
15805 if (IN1_param_value == NULL) |
|
15806 IN1_param_value = function_call_param_iterator.next(); |
|
15807 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15808 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15809 |
|
15810 |
|
15811 { |
|
15812 |
|
15813 { |
|
15814 identifier_c param_name("IN2"); |
|
15815 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15816 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15817 |
|
15818 /* Get the value from a foo(<param_value>) style call */ |
|
15819 if (IN2_param_value == NULL) |
|
15820 IN2_param_value = function_call_param_iterator.next(); |
|
15821 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15822 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15823 |
|
15824 |
|
15825 { |
|
15826 |
|
15827 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
15828 s4o.indent_right(); |
|
15829 s4o.print("__gt_"); |
|
15830 last_type_symbol->accept(*this); |
|
15831 s4o.print("("); |
|
15832 s4o.print_integer(nb_param); |
|
15833 s4o.print(",\n" + s4o.indent_spaces); |
|
15834 IN1_param_value->accept(*this); |
|
15835 s4o.print(",\n" + s4o.indent_spaces); |
|
15836 IN2_param_value->accept(*this); |
|
15837 |
|
15838 int base_num = 3; |
|
15839 symbol_c *param_value = NULL; |
|
15840 do{ |
|
15841 char my_name[10]; |
|
15842 sprintf(my_name, "IN%d", base_num++); |
|
15843 identifier_c param_name(my_name); |
|
15844 |
|
15845 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15846 param_value = function_call_param_iterator.search(¶m_name); |
|
15847 |
|
15848 /* Get the value from a foo(<param_value>) style call */ |
|
15849 if (param_value == NULL) |
|
15850 param_value = function_call_param_iterator.next(); |
|
15851 if (param_value != NULL){ |
|
15852 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15853 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15854 |
|
15855 /*Function specific CODE */ |
|
15856 s4o.print(",\n" + s4o.indent_spaces); |
|
15857 param_value->accept(*this); |
|
15858 |
|
15859 } |
|
15860 |
|
15861 }while(param_value != NULL); |
|
15862 s4o.print(")"); |
|
15863 s4o.indent_left(); |
|
15864 return NULL; |
|
15865 |
|
15866 |
|
15867 } |
|
15868 |
|
15869 ERROR; |
|
15870 } |
|
15871 |
|
15872 } |
|
15873 |
|
15874 ERROR; |
|
15875 } |
|
15876 |
|
15877 }/*function_gt*/ |
|
15878 break; |
|
15879 |
|
15880 /**** |
|
15881 *GE |
|
15882 */ |
|
15883 case function_ge : |
|
15884 { |
|
15885 symbol_c *last_type_symbol = NULL; |
|
15886 |
|
15887 { |
|
15888 identifier_c param_name("IN1"); |
|
15889 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15890 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15891 |
|
15892 /* Get the value from a foo(<param_value>) style call */ |
|
15893 if (IN1_param_value == NULL) |
|
15894 IN1_param_value = function_call_param_iterator.next(); |
|
15895 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15896 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15897 |
|
15898 |
|
15899 { |
|
15900 |
|
15901 { |
|
15902 identifier_c param_name("IN2"); |
|
15903 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15904 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15905 |
|
15906 /* Get the value from a foo(<param_value>) style call */ |
|
15907 if (IN2_param_value == NULL) |
|
15908 IN2_param_value = function_call_param_iterator.next(); |
|
15909 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15910 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15911 |
|
15912 |
|
15913 { |
|
15914 |
|
15915 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
15916 s4o.indent_right(); |
|
15917 s4o.print("__ge_"); |
|
15918 last_type_symbol->accept(*this); |
|
15919 s4o.print("("); |
|
15920 s4o.print_integer(nb_param); |
|
15921 s4o.print(",\n" + s4o.indent_spaces); |
|
15922 IN1_param_value->accept(*this); |
|
15923 s4o.print(",\n" + s4o.indent_spaces); |
|
15924 IN2_param_value->accept(*this); |
|
15925 |
|
15926 int base_num = 3; |
|
15927 symbol_c *param_value = NULL; |
|
15928 do{ |
|
15929 char my_name[10]; |
|
15930 sprintf(my_name, "IN%d", base_num++); |
|
15931 identifier_c param_name(my_name); |
|
15932 |
|
15933 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15934 param_value = function_call_param_iterator.search(¶m_name); |
|
15935 |
|
15936 /* Get the value from a foo(<param_value>) style call */ |
|
15937 if (param_value == NULL) |
|
15938 param_value = function_call_param_iterator.next(); |
|
15939 if (param_value != NULL){ |
|
15940 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
15941 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
15942 |
|
15943 /*Function specific CODE */ |
|
15944 s4o.print(",\n" + s4o.indent_spaces); |
|
15945 param_value->accept(*this); |
|
15946 |
|
15947 } |
|
15948 |
|
15949 }while(param_value != NULL); |
|
15950 s4o.print(")"); |
|
15951 s4o.indent_left(); |
|
15952 return NULL; |
|
15953 |
|
15954 |
|
15955 } |
|
15956 |
|
15957 ERROR; |
|
15958 } |
|
15959 |
|
15960 } |
|
15961 |
|
15962 ERROR; |
|
15963 } |
|
15964 |
|
15965 }/*function_ge*/ |
|
15966 break; |
|
15967 |
|
15968 /**** |
|
15969 *EQ |
|
15970 */ |
|
15971 case function_eq : |
|
15972 { |
|
15973 symbol_c *last_type_symbol = NULL; |
|
15974 |
|
15975 { |
|
15976 identifier_c param_name("IN1"); |
|
15977 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15978 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
15979 |
|
15980 /* Get the value from a foo(<param_value>) style call */ |
|
15981 if (IN1_param_value == NULL) |
|
15982 IN1_param_value = function_call_param_iterator.next(); |
|
15983 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
15984 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
15985 |
|
15986 |
|
15987 { |
|
15988 |
|
15989 { |
|
15990 identifier_c param_name("IN2"); |
|
15991 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
15992 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
15993 |
|
15994 /* Get the value from a foo(<param_value>) style call */ |
|
15995 if (IN2_param_value == NULL) |
|
15996 IN2_param_value = function_call_param_iterator.next(); |
|
15997 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
15998 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
15999 |
|
16000 |
|
16001 { |
|
16002 |
|
16003 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
16004 s4o.indent_right(); |
|
16005 s4o.print("__eq_"); |
|
16006 last_type_symbol->accept(*this); |
|
16007 s4o.print("("); |
|
16008 s4o.print_integer(nb_param); |
|
16009 s4o.print(",\n" + s4o.indent_spaces); |
|
16010 IN1_param_value->accept(*this); |
|
16011 s4o.print(",\n" + s4o.indent_spaces); |
|
16012 IN2_param_value->accept(*this); |
|
16013 |
|
16014 int base_num = 3; |
|
16015 symbol_c *param_value = NULL; |
|
16016 do{ |
|
16017 char my_name[10]; |
|
16018 sprintf(my_name, "IN%d", base_num++); |
|
16019 identifier_c param_name(my_name); |
|
16020 |
|
16021 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16022 param_value = function_call_param_iterator.search(¶m_name); |
|
16023 |
|
16024 /* Get the value from a foo(<param_value>) style call */ |
|
16025 if (param_value == NULL) |
|
16026 param_value = function_call_param_iterator.next(); |
|
16027 if (param_value != NULL){ |
|
16028 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
16029 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
16030 |
|
16031 /*Function specific CODE */ |
|
16032 s4o.print(",\n" + s4o.indent_spaces); |
|
16033 param_value->accept(*this); |
|
16034 |
|
16035 } |
|
16036 |
|
16037 }while(param_value != NULL); |
|
16038 s4o.print(")"); |
|
16039 s4o.indent_left(); |
|
16040 return NULL; |
|
16041 |
|
16042 |
|
16043 } |
|
16044 |
|
16045 ERROR; |
|
16046 } |
|
16047 |
|
16048 } |
|
16049 |
|
16050 ERROR; |
|
16051 } |
|
16052 |
|
16053 }/*function_eq*/ |
|
16054 break; |
|
16055 |
|
16056 /**** |
|
16057 *LT |
|
16058 */ |
|
16059 case function_lt : |
|
16060 { |
|
16061 symbol_c *last_type_symbol = NULL; |
|
16062 |
|
16063 { |
|
16064 identifier_c param_name("IN1"); |
|
16065 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16066 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16067 |
|
16068 /* Get the value from a foo(<param_value>) style call */ |
|
16069 if (IN1_param_value == NULL) |
|
16070 IN1_param_value = function_call_param_iterator.next(); |
|
16071 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16072 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16073 |
|
16074 |
|
16075 { |
|
16076 |
|
16077 { |
|
16078 identifier_c param_name("IN2"); |
|
16079 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16080 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16081 |
|
16082 /* Get the value from a foo(<param_value>) style call */ |
|
16083 if (IN2_param_value == NULL) |
|
16084 IN2_param_value = function_call_param_iterator.next(); |
|
16085 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16086 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16087 |
|
16088 |
|
16089 { |
|
16090 |
|
16091 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
16092 s4o.indent_right(); |
|
16093 s4o.print("__lt_"); |
|
16094 last_type_symbol->accept(*this); |
|
16095 s4o.print("("); |
|
16096 s4o.print_integer(nb_param); |
|
16097 s4o.print(",\n" + s4o.indent_spaces); |
|
16098 IN1_param_value->accept(*this); |
|
16099 s4o.print(",\n" + s4o.indent_spaces); |
|
16100 IN2_param_value->accept(*this); |
|
16101 |
|
16102 int base_num = 3; |
|
16103 symbol_c *param_value = NULL; |
|
16104 do{ |
|
16105 char my_name[10]; |
|
16106 sprintf(my_name, "IN%d", base_num++); |
|
16107 identifier_c param_name(my_name); |
|
16108 |
|
16109 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16110 param_value = function_call_param_iterator.search(¶m_name); |
|
16111 |
|
16112 /* Get the value from a foo(<param_value>) style call */ |
|
16113 if (param_value == NULL) |
|
16114 param_value = function_call_param_iterator.next(); |
|
16115 if (param_value != NULL){ |
|
16116 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
16117 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
16118 |
|
16119 /*Function specific CODE */ |
|
16120 s4o.print(",\n" + s4o.indent_spaces); |
|
16121 param_value->accept(*this); |
|
16122 |
|
16123 } |
|
16124 |
|
16125 }while(param_value != NULL); |
|
16126 s4o.print(")"); |
|
16127 s4o.indent_left(); |
|
16128 return NULL; |
|
16129 |
|
16130 |
|
16131 } |
|
16132 |
|
16133 ERROR; |
|
16134 } |
|
16135 |
|
16136 } |
|
16137 |
|
16138 ERROR; |
|
16139 } |
|
16140 |
|
16141 }/*function_lt*/ |
|
16142 break; |
|
16143 |
|
16144 /**** |
|
16145 *LE |
|
16146 */ |
|
16147 case function_le : |
|
16148 { |
|
16149 symbol_c *last_type_symbol = NULL; |
|
16150 |
|
16151 { |
|
16152 identifier_c param_name("IN1"); |
|
16153 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16154 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16155 |
|
16156 /* Get the value from a foo(<param_value>) style call */ |
|
16157 if (IN1_param_value == NULL) |
|
16158 IN1_param_value = function_call_param_iterator.next(); |
|
16159 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16160 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16161 |
|
16162 |
|
16163 { |
|
16164 |
|
16165 { |
|
16166 identifier_c param_name("IN2"); |
|
16167 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16168 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16169 |
|
16170 /* Get the value from a foo(<param_value>) style call */ |
|
16171 if (IN2_param_value == NULL) |
|
16172 IN2_param_value = function_call_param_iterator.next(); |
|
16173 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16174 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16175 |
|
16176 |
|
16177 { |
|
16178 |
|
16179 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
16180 s4o.indent_right(); |
|
16181 s4o.print("__le_"); |
|
16182 last_type_symbol->accept(*this); |
|
16183 s4o.print("("); |
|
16184 s4o.print_integer(nb_param); |
|
16185 s4o.print(",\n" + s4o.indent_spaces); |
|
16186 IN1_param_value->accept(*this); |
|
16187 s4o.print(",\n" + s4o.indent_spaces); |
|
16188 IN2_param_value->accept(*this); |
|
16189 |
|
16190 int base_num = 3; |
|
16191 symbol_c *param_value = NULL; |
|
16192 do{ |
|
16193 char my_name[10]; |
|
16194 sprintf(my_name, "IN%d", base_num++); |
|
16195 identifier_c param_name(my_name); |
|
16196 |
|
16197 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16198 param_value = function_call_param_iterator.search(¶m_name); |
|
16199 |
|
16200 /* Get the value from a foo(<param_value>) style call */ |
|
16201 if (param_value == NULL) |
|
16202 param_value = function_call_param_iterator.next(); |
|
16203 if (param_value != NULL){ |
|
16204 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
16205 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
16206 |
|
16207 /*Function specific CODE */ |
|
16208 s4o.print(",\n" + s4o.indent_spaces); |
|
16209 param_value->accept(*this); |
|
16210 |
|
16211 } |
|
16212 |
|
16213 }while(param_value != NULL); |
|
16214 s4o.print(")"); |
|
16215 s4o.indent_left(); |
|
16216 return NULL; |
|
16217 |
|
16218 |
|
16219 } |
|
16220 |
|
16221 ERROR; |
|
16222 } |
|
16223 |
|
16224 } |
|
16225 |
|
16226 ERROR; |
|
16227 } |
|
16228 |
|
16229 }/*function_le*/ |
|
16230 break; |
|
16231 |
|
16232 /**** |
|
16233 *NE |
|
16234 */ |
|
16235 case function_ne : |
|
16236 { |
|
16237 symbol_c *last_type_symbol = NULL; |
|
16238 |
|
16239 { |
|
16240 identifier_c param_name("IN1"); |
|
16241 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16242 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16243 |
|
16244 /* Get the value from a foo(<param_value>) style call */ |
|
16245 if (IN1_param_value == NULL) |
|
16246 IN1_param_value = function_call_param_iterator.next(); |
|
16247 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16248 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16249 |
|
16250 |
|
16251 { |
|
16252 |
|
16253 { |
|
16254 identifier_c param_name("IN2"); |
|
16255 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16256 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16257 |
|
16258 /* Get the value from a foo(<param_value>) style call */ |
|
16259 if (IN2_param_value == NULL) |
|
16260 IN2_param_value = function_call_param_iterator.next(); |
|
16261 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16262 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16263 |
|
16264 |
|
16265 { |
|
16266 |
|
16267 symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; |
|
16268 s4o.indent_right(); |
|
16269 s4o.print("__ne_"); |
|
16270 last_type_symbol->accept(*this); |
|
16271 s4o.print("("); |
|
16272 s4o.print_integer(nb_param); |
|
16273 s4o.print(",\n" + s4o.indent_spaces); |
|
16274 IN1_param_value->accept(*this); |
|
16275 s4o.print(",\n" + s4o.indent_spaces); |
|
16276 IN2_param_value->accept(*this); |
|
16277 |
|
16278 int base_num = 3; |
|
16279 symbol_c *param_value = NULL; |
|
16280 do{ |
|
16281 char my_name[10]; |
|
16282 sprintf(my_name, "IN%d", base_num++); |
|
16283 identifier_c param_name(my_name); |
|
16284 |
|
16285 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16286 param_value = function_call_param_iterator.search(¶m_name); |
|
16287 |
|
16288 /* Get the value from a foo(<param_value>) style call */ |
|
16289 if (param_value == NULL) |
|
16290 param_value = function_call_param_iterator.next(); |
|
16291 if (param_value != NULL){ |
|
16292 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
16293 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
16294 |
|
16295 /*Function specific CODE */ |
|
16296 s4o.print(",\n" + s4o.indent_spaces); |
|
16297 param_value->accept(*this); |
|
16298 |
|
16299 } |
|
16300 |
|
16301 }while(param_value != NULL); |
|
16302 s4o.print(")"); |
|
16303 s4o.indent_left(); |
|
16304 return NULL; |
|
16305 |
|
16306 |
|
16307 } |
|
16308 |
|
16309 ERROR; |
|
16310 } |
|
16311 |
|
16312 } |
|
16313 |
|
16314 ERROR; |
|
16315 } |
|
16316 |
|
16317 }/*function_ne*/ |
|
16318 break; |
|
16319 |
|
16320 /**** |
|
16321 *LEN |
|
16322 */ |
|
16323 case function_len : |
|
16324 { |
|
16325 symbol_c *last_type_symbol = NULL; |
|
16326 |
|
16327 { |
|
16328 identifier_c param_name("IN"); |
|
16329 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16330 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
16331 |
|
16332 /* Get the value from a foo(<param_value>) style call */ |
|
16333 if (IN_param_value == NULL) |
|
16334 IN_param_value = function_call_param_iterator.next(); |
|
16335 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
16336 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
16337 |
|
16338 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16339 { |
|
16340 |
|
16341 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
16342 s4o.print("__len("); |
|
16343 IN_param_value->accept(*this); |
|
16344 s4o.print(")"); |
|
16345 return NULL; |
|
16346 |
|
16347 } |
|
16348 |
|
16349 ERROR; |
|
16350 } |
|
16351 |
|
16352 }/*function_len*/ |
|
16353 break; |
|
16354 |
|
16355 /**** |
|
16356 *LEFT |
|
16357 */ |
|
16358 case function_left : |
|
16359 { |
|
16360 symbol_c *last_type_symbol = NULL; |
|
16361 |
|
16362 { |
|
16363 identifier_c param_name("IN"); |
|
16364 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16365 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
16366 |
|
16367 /* Get the value from a foo(<param_value>) style call */ |
|
16368 if (IN_param_value == NULL) |
|
16369 IN_param_value = function_call_param_iterator.next(); |
|
16370 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
16371 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
16372 |
|
16373 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16374 { |
|
16375 |
|
16376 { |
|
16377 identifier_c param_name("L"); |
|
16378 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16379 symbol_c *L_param_value = function_call_param_iterator.search(¶m_name); |
|
16380 |
|
16381 /* Get the value from a foo(<param_value>) style call */ |
|
16382 if (L_param_value == NULL) |
|
16383 L_param_value = function_call_param_iterator.next(); |
|
16384 symbol_c *L_type_symbol = search_expression_type->get_type(L_param_value); |
|
16385 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(L_type_symbol, last_type_symbol) ? search_expression_type->common_type(L_type_symbol, last_type_symbol) : L_type_symbol ; |
|
16386 |
|
16387 if(search_expression_type->is_integer_type(L_type_symbol)) |
|
16388 { |
|
16389 |
|
16390 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16391 s4o.print("__left("); |
|
16392 IN_param_value->accept(*this); |
|
16393 s4o.print(", "); |
|
16394 L_param_value->accept(*this); |
|
16395 s4o.print(")"); |
|
16396 return NULL; |
|
16397 |
|
16398 } |
|
16399 |
|
16400 ERROR; |
|
16401 } |
|
16402 |
|
16403 } |
|
16404 |
|
16405 ERROR; |
|
16406 } |
|
16407 |
|
16408 }/*function_left*/ |
|
16409 break; |
|
16410 |
|
16411 /**** |
|
16412 *RIGHT |
|
16413 */ |
|
16414 case function_right : |
|
16415 { |
|
16416 symbol_c *last_type_symbol = NULL; |
|
16417 |
|
16418 { |
|
16419 identifier_c param_name("IN"); |
|
16420 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16421 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
16422 |
|
16423 /* Get the value from a foo(<param_value>) style call */ |
|
16424 if (IN_param_value == NULL) |
|
16425 IN_param_value = function_call_param_iterator.next(); |
|
16426 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
16427 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
16428 |
|
16429 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16430 { |
|
16431 |
|
16432 { |
|
16433 identifier_c param_name("L"); |
|
16434 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16435 symbol_c *L_param_value = function_call_param_iterator.search(¶m_name); |
|
16436 |
|
16437 /* Get the value from a foo(<param_value>) style call */ |
|
16438 if (L_param_value == NULL) |
|
16439 L_param_value = function_call_param_iterator.next(); |
|
16440 symbol_c *L_type_symbol = search_expression_type->get_type(L_param_value); |
|
16441 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(L_type_symbol, last_type_symbol) ? search_expression_type->common_type(L_type_symbol, last_type_symbol) : L_type_symbol ; |
|
16442 |
|
16443 if(search_expression_type->is_integer_type(L_type_symbol)) |
|
16444 { |
|
16445 |
|
16446 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16447 s4o.print("__right("); |
|
16448 IN_param_value->accept(*this); |
|
16449 s4o.print(", "); |
|
16450 L_param_value->accept(*this); |
|
16451 s4o.print(")"); |
|
16452 return NULL; |
|
16453 |
|
16454 } |
|
16455 |
|
16456 ERROR; |
|
16457 } |
|
16458 |
|
16459 } |
|
16460 |
|
16461 ERROR; |
|
16462 } |
|
16463 |
|
16464 }/*function_right*/ |
|
16465 break; |
|
16466 |
|
16467 /**** |
|
16468 *MID |
|
16469 */ |
|
16470 case function_mid : |
|
16471 { |
|
16472 symbol_c *last_type_symbol = NULL; |
|
16473 |
|
16474 { |
|
16475 identifier_c param_name("IN"); |
|
16476 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16477 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
16478 |
|
16479 /* Get the value from a foo(<param_value>) style call */ |
|
16480 if (IN_param_value == NULL) |
|
16481 IN_param_value = function_call_param_iterator.next(); |
|
16482 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
16483 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
16484 |
|
16485 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16486 { |
|
16487 |
|
16488 { |
|
16489 identifier_c param_name("L"); |
|
16490 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16491 symbol_c *L_param_value = function_call_param_iterator.search(¶m_name); |
|
16492 |
|
16493 /* Get the value from a foo(<param_value>) style call */ |
|
16494 if (L_param_value == NULL) |
|
16495 L_param_value = function_call_param_iterator.next(); |
|
16496 symbol_c *L_type_symbol = search_expression_type->get_type(L_param_value); |
|
16497 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(L_type_symbol, last_type_symbol) ? search_expression_type->common_type(L_type_symbol, last_type_symbol) : L_type_symbol ; |
|
16498 |
|
16499 if(search_expression_type->is_integer_type(L_type_symbol)) |
|
16500 { |
|
16501 |
|
16502 { |
|
16503 identifier_c param_name("P"); |
|
16504 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16505 symbol_c *P_param_value = function_call_param_iterator.search(¶m_name); |
|
16506 |
|
16507 /* Get the value from a foo(<param_value>) style call */ |
|
16508 if (P_param_value == NULL) |
|
16509 P_param_value = function_call_param_iterator.next(); |
|
16510 symbol_c *P_type_symbol = search_expression_type->get_type(P_param_value); |
|
16511 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(P_type_symbol, last_type_symbol) ? search_expression_type->common_type(P_type_symbol, last_type_symbol) : P_type_symbol ; |
|
16512 |
|
16513 if(search_expression_type->is_integer_type(P_type_symbol)) |
|
16514 { |
|
16515 |
|
16516 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16517 s4o.print("__mid("); |
|
16518 IN_param_value->accept(*this); |
|
16519 s4o.print(", "); |
|
16520 L_param_value->accept(*this); |
|
16521 s4o.print(", "); |
|
16522 P_param_value->accept(*this); |
|
16523 s4o.print(")"); |
|
16524 return NULL; |
|
16525 |
|
16526 } |
|
16527 |
|
16528 ERROR; |
|
16529 } |
|
16530 |
|
16531 } |
|
16532 |
|
16533 ERROR; |
|
16534 } |
|
16535 |
|
16536 } |
|
16537 |
|
16538 ERROR; |
|
16539 } |
|
16540 |
|
16541 }/*function_mid*/ |
|
16542 break; |
|
16543 |
|
16544 /**** |
|
16545 *CONCAT |
|
16546 */ |
|
16547 case function_concat : |
|
16548 { |
|
16549 symbol_c *last_type_symbol = NULL; |
|
16550 |
|
16551 { |
|
16552 identifier_c param_name("IN1"); |
|
16553 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16554 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16555 |
|
16556 /* Get the value from a foo(<param_value>) style call */ |
|
16557 if (IN1_param_value == NULL) |
|
16558 IN1_param_value = function_call_param_iterator.next(); |
|
16559 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16560 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16561 |
|
16562 if(search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol)) |
|
16563 { |
|
16564 |
|
16565 { |
|
16566 identifier_c param_name("IN2"); |
|
16567 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16568 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16569 |
|
16570 /* Get the value from a foo(<param_value>) style call */ |
|
16571 if (IN2_param_value == NULL) |
|
16572 IN2_param_value = function_call_param_iterator.next(); |
|
16573 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16574 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16575 |
|
16576 if(search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol)) |
|
16577 { |
|
16578 |
|
16579 symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name; |
|
16580 s4o.print("__time_add("); |
|
16581 IN1_param_value->accept(*this); |
|
16582 s4o.print(", "); |
|
16583 IN2_param_value->accept(*this); |
|
16584 s4o.print(")"); |
|
16585 return NULL; |
|
16586 |
|
16587 } |
|
16588 |
|
16589 ERROR; |
|
16590 } |
|
16591 |
|
16592 } |
|
16593 |
|
16594 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16595 { |
|
16596 |
|
16597 { |
|
16598 identifier_c param_name("IN2"); |
|
16599 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16600 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16601 |
|
16602 /* Get the value from a foo(<param_value>) style call */ |
|
16603 if (IN2_param_value == NULL) |
|
16604 IN2_param_value = function_call_param_iterator.next(); |
|
16605 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16606 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16607 |
|
16608 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16609 { |
|
16610 |
|
16611 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16612 s4o.indent_right(); |
|
16613 s4o.print("__concat("); |
|
16614 s4o.print_integer(nb_param); |
|
16615 s4o.print(",\n" + s4o.indent_spaces); |
|
16616 IN1_param_value->accept(*this); |
|
16617 s4o.print(",\n" + s4o.indent_spaces); |
|
16618 IN2_param_value->accept(*this); |
|
16619 |
|
16620 int base_num = 3; |
|
16621 symbol_c *param_value = NULL; |
|
16622 do{ |
|
16623 char my_name[10]; |
|
16624 sprintf(my_name, "IN%d", base_num++); |
|
16625 identifier_c param_name(my_name); |
|
16626 |
|
16627 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16628 param_value = function_call_param_iterator.search(¶m_name); |
|
16629 |
|
16630 /* Get the value from a foo(<param_value>) style call */ |
|
16631 if (param_value == NULL) |
|
16632 param_value = function_call_param_iterator.next(); |
|
16633 if (param_value != NULL){ |
|
16634 symbol_c *current_type_symbol = search_expression_type->get_type(param_value); |
|
16635 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ; |
|
16636 |
|
16637 /*Function specific CODE */ |
|
16638 s4o.print(",\n" + s4o.indent_spaces); |
|
16639 param_value->accept(*this); |
|
16640 |
|
16641 } |
|
16642 |
|
16643 }while(param_value != NULL); |
|
16644 s4o.print(")"); |
|
16645 s4o.indent_left(); |
|
16646 return NULL; |
|
16647 |
|
16648 |
|
16649 } |
|
16650 |
|
16651 ERROR; |
|
16652 } |
|
16653 |
|
16654 } |
|
16655 |
|
16656 ERROR; |
|
16657 } |
|
16658 |
|
16659 }/*function_concat*/ |
|
16660 break; |
|
16661 |
|
16662 /**** |
|
16663 *INSERT |
|
16664 */ |
|
16665 case function_insert : |
|
16666 { |
|
16667 symbol_c *last_type_symbol = NULL; |
|
16668 |
|
16669 { |
|
16670 identifier_c param_name("IN1"); |
|
16671 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16672 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16673 |
|
16674 /* Get the value from a foo(<param_value>) style call */ |
|
16675 if (IN1_param_value == NULL) |
|
16676 IN1_param_value = function_call_param_iterator.next(); |
|
16677 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16678 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16679 |
|
16680 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16681 { |
|
16682 |
|
16683 { |
|
16684 identifier_c param_name("IN2"); |
|
16685 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16686 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16687 |
|
16688 /* Get the value from a foo(<param_value>) style call */ |
|
16689 if (IN2_param_value == NULL) |
|
16690 IN2_param_value = function_call_param_iterator.next(); |
|
16691 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16692 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16693 |
|
16694 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16695 { |
|
16696 |
|
16697 { |
|
16698 identifier_c param_name("P"); |
|
16699 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16700 symbol_c *P_param_value = function_call_param_iterator.search(¶m_name); |
|
16701 |
|
16702 /* Get the value from a foo(<param_value>) style call */ |
|
16703 if (P_param_value == NULL) |
|
16704 P_param_value = function_call_param_iterator.next(); |
|
16705 symbol_c *P_type_symbol = search_expression_type->get_type(P_param_value); |
|
16706 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(P_type_symbol, last_type_symbol) ? search_expression_type->common_type(P_type_symbol, last_type_symbol) : P_type_symbol ; |
|
16707 |
|
16708 if(search_expression_type->is_integer_type(P_type_symbol)) |
|
16709 { |
|
16710 |
|
16711 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16712 s4o.print("__insert("); |
|
16713 IN1_param_value->accept(*this); |
|
16714 s4o.print(", "); |
|
16715 IN2_param_value->accept(*this); |
|
16716 s4o.print(", "); |
|
16717 P_param_value->accept(*this); |
|
16718 s4o.print(")"); |
|
16719 return NULL; |
|
16720 |
|
16721 } |
|
16722 |
|
16723 ERROR; |
|
16724 } |
|
16725 |
|
16726 } |
|
16727 |
|
16728 ERROR; |
|
16729 } |
|
16730 |
|
16731 } |
|
16732 |
|
16733 ERROR; |
|
16734 } |
|
16735 |
|
16736 }/*function_insert*/ |
|
16737 break; |
|
16738 |
|
16739 /**** |
|
16740 *DELETE |
|
16741 */ |
|
16742 case function_delete : |
|
16743 { |
|
16744 symbol_c *last_type_symbol = NULL; |
|
16745 |
|
16746 { |
|
16747 identifier_c param_name("IN"); |
|
16748 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16749 symbol_c *IN_param_value = function_call_param_iterator.search(¶m_name); |
|
16750 |
|
16751 /* Get the value from a foo(<param_value>) style call */ |
|
16752 if (IN_param_value == NULL) |
|
16753 IN_param_value = function_call_param_iterator.next(); |
|
16754 symbol_c *IN_type_symbol = search_expression_type->get_type(IN_param_value); |
|
16755 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN_type_symbol, last_type_symbol) : IN_type_symbol ; |
|
16756 |
|
16757 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16758 { |
|
16759 |
|
16760 { |
|
16761 identifier_c param_name("L"); |
|
16762 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16763 symbol_c *L_param_value = function_call_param_iterator.search(¶m_name); |
|
16764 |
|
16765 /* Get the value from a foo(<param_value>) style call */ |
|
16766 if (L_param_value == NULL) |
|
16767 L_param_value = function_call_param_iterator.next(); |
|
16768 symbol_c *L_type_symbol = search_expression_type->get_type(L_param_value); |
|
16769 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(L_type_symbol, last_type_symbol) ? search_expression_type->common_type(L_type_symbol, last_type_symbol) : L_type_symbol ; |
|
16770 |
|
16771 if(search_expression_type->is_integer_type(L_type_symbol)) |
|
16772 { |
|
16773 |
|
16774 { |
|
16775 identifier_c param_name("P"); |
|
16776 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16777 symbol_c *P_param_value = function_call_param_iterator.search(¶m_name); |
|
16778 |
|
16779 /* Get the value from a foo(<param_value>) style call */ |
|
16780 if (P_param_value == NULL) |
|
16781 P_param_value = function_call_param_iterator.next(); |
|
16782 symbol_c *P_type_symbol = search_expression_type->get_type(P_param_value); |
|
16783 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(P_type_symbol, last_type_symbol) ? search_expression_type->common_type(P_type_symbol, last_type_symbol) : P_type_symbol ; |
|
16784 |
|
16785 if(search_expression_type->is_integer_type(P_type_symbol)) |
|
16786 { |
|
16787 |
|
16788 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16789 s4o.print("__delete("); |
|
16790 IN_param_value->accept(*this); |
|
16791 s4o.print(", "); |
|
16792 L_param_value->accept(*this); |
|
16793 s4o.print(", "); |
|
16794 P_param_value->accept(*this); |
|
16795 s4o.print(")"); |
|
16796 return NULL; |
|
16797 |
|
16798 } |
|
16799 |
|
16800 ERROR; |
|
16801 } |
|
16802 |
|
16803 } |
|
16804 |
|
16805 ERROR; |
|
16806 } |
|
16807 |
|
16808 } |
|
16809 |
|
16810 ERROR; |
|
16811 } |
|
16812 |
|
16813 }/*function_delete*/ |
|
16814 break; |
|
16815 |
|
16816 /**** |
|
16817 *REPLACE |
|
16818 */ |
|
16819 case function_replace : |
|
16820 { |
|
16821 symbol_c *last_type_symbol = NULL; |
|
16822 |
|
16823 { |
|
16824 identifier_c param_name("IN1"); |
|
16825 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16826 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16827 |
|
16828 /* Get the value from a foo(<param_value>) style call */ |
|
16829 if (IN1_param_value == NULL) |
|
16830 IN1_param_value = function_call_param_iterator.next(); |
|
16831 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16832 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16833 |
|
16834 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16835 { |
|
16836 |
|
16837 { |
|
16838 identifier_c param_name("IN2"); |
|
16839 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16840 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16841 |
|
16842 /* Get the value from a foo(<param_value>) style call */ |
|
16843 if (IN2_param_value == NULL) |
|
16844 IN2_param_value = function_call_param_iterator.next(); |
|
16845 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16846 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16847 |
|
16848 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16849 { |
|
16850 |
|
16851 { |
|
16852 identifier_c param_name("L"); |
|
16853 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16854 symbol_c *L_param_value = function_call_param_iterator.search(¶m_name); |
|
16855 |
|
16856 /* Get the value from a foo(<param_value>) style call */ |
|
16857 if (L_param_value == NULL) |
|
16858 L_param_value = function_call_param_iterator.next(); |
|
16859 symbol_c *L_type_symbol = search_expression_type->get_type(L_param_value); |
|
16860 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(L_type_symbol, last_type_symbol) ? search_expression_type->common_type(L_type_symbol, last_type_symbol) : L_type_symbol ; |
|
16861 |
|
16862 if(search_expression_type->is_integer_type(L_type_symbol)) |
|
16863 { |
|
16864 |
|
16865 { |
|
16866 identifier_c param_name("P"); |
|
16867 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16868 symbol_c *P_param_value = function_call_param_iterator.search(¶m_name); |
|
16869 |
|
16870 /* Get the value from a foo(<param_value>) style call */ |
|
16871 if (P_param_value == NULL) |
|
16872 P_param_value = function_call_param_iterator.next(); |
|
16873 symbol_c *P_type_symbol = search_expression_type->get_type(P_param_value); |
|
16874 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(P_type_symbol, last_type_symbol) ? search_expression_type->common_type(P_type_symbol, last_type_symbol) : P_type_symbol ; |
|
16875 |
|
16876 if(search_expression_type->is_integer_type(P_type_symbol)) |
|
16877 { |
|
16878 |
|
16879 symbol_c * return_type_symbol = &search_constant_type_c::string_type_name; |
|
16880 s4o.print("__replace("); |
|
16881 IN1_param_value->accept(*this); |
|
16882 s4o.print(", "); |
|
16883 IN2_param_value->accept(*this); |
|
16884 s4o.print(", "); |
|
16885 L_param_value->accept(*this); |
|
16886 s4o.print(", "); |
|
16887 P_param_value->accept(*this); |
|
16888 s4o.print(")"); |
|
16889 return NULL; |
|
16890 |
|
16891 } |
|
16892 |
|
16893 ERROR; |
|
16894 } |
|
16895 |
|
16896 } |
|
16897 |
|
16898 ERROR; |
|
16899 } |
|
16900 |
|
16901 } |
|
16902 |
|
16903 ERROR; |
|
16904 } |
|
16905 |
|
16906 } |
|
16907 |
|
16908 ERROR; |
|
16909 } |
|
16910 |
|
16911 }/*function_replace*/ |
|
16912 break; |
|
16913 |
|
16914 /**** |
|
16915 *FIND |
|
16916 */ |
|
16917 case function_find : |
|
16918 { |
|
16919 symbol_c *last_type_symbol = NULL; |
|
16920 |
|
16921 { |
|
16922 identifier_c param_name("IN1"); |
|
16923 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16924 symbol_c *IN1_param_value = function_call_param_iterator.search(¶m_name); |
|
16925 |
|
16926 /* Get the value from a foo(<param_value>) style call */ |
|
16927 if (IN1_param_value == NULL) |
|
16928 IN1_param_value = function_call_param_iterator.next(); |
|
16929 symbol_c *IN1_type_symbol = search_expression_type->get_type(IN1_param_value); |
|
16930 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ; |
|
16931 |
|
16932 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16933 { |
|
16934 |
|
16935 { |
|
16936 identifier_c param_name("IN2"); |
|
16937 /* Get the value from a foo(<param_name> = <param_value>) style call */ |
|
16938 symbol_c *IN2_param_value = function_call_param_iterator.search(¶m_name); |
|
16939 |
|
16940 /* Get the value from a foo(<param_value>) style call */ |
|
16941 if (IN2_param_value == NULL) |
|
16942 IN2_param_value = function_call_param_iterator.next(); |
|
16943 symbol_c *IN2_type_symbol = search_expression_type->get_type(IN2_param_value); |
|
16944 last_type_symbol = last_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ; |
|
16945 |
|
16946 if(search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol)) |
|
16947 { |
|
16948 |
|
16949 symbol_c * return_type_symbol = &search_constant_type_c::int_type_name; |
|
16950 s4o.print("__find("); |
|
16951 IN1_param_value->accept(*this); |
|
16952 s4o.print(", "); |
|
16953 IN2_param_value->accept(*this); |
|
16954 s4o.print(")"); |
|
16955 return NULL; |
|
16956 |
|
16957 } |
|
16958 |
|
16959 ERROR; |
|
16960 } |
|
16961 |
|
16962 } |
|
16963 |
|
16964 ERROR; |
|
16965 } |
|
16966 |
|
16967 }/*function_find*/ |
|
16968 break; |
|
16969 |
|
16970 case function_none : |
|
16971 ERROR; |
|
16972 } |
|
16973 return NULL; |
|