204 void function_param_iterator_c::reset(void) { |
204 void function_param_iterator_c::reset(void) { |
205 next_param = param_count = 0; |
205 next_param = param_count = 0; |
206 _first_extensible_param_index = -1; |
206 _first_extensible_param_index = -1; |
207 current_param_is_extensible = false; |
207 current_param_is_extensible = false; |
208 current_param_name = NULL; |
208 current_param_name = NULL; |
209 current_param_type = current_param_default_value = NULL; |
209 current_param_type = NULL; |
|
210 current_param_default_value = NULL; |
|
211 last_returned_parameter = NULL; /* the last parameter returned by search() or next() */ |
210 } |
212 } |
211 |
213 |
212 |
214 |
213 /* initialise the iterator object. |
215 /* initialise the iterator object. |
214 * We must be given a reference to one of the following |
216 * We must be given a reference to one of the following |
279 en_eno_param_implicit = false; |
283 en_eno_param_implicit = false; |
280 current_param_is_extensible = false; |
284 current_param_is_extensible = false; |
281 current_operation = function_param_iterator_c::search_op; |
285 current_operation = function_param_iterator_c::search_op; |
282 void *res = f_decl->accept(*this); |
286 void *res = f_decl->accept(*this); |
283 identifier_c *res_param_name = dynamic_cast<identifier_c *>((symbol_c *)res); |
287 identifier_c *res_param_name = dynamic_cast<identifier_c *>((symbol_c *)res); |
|
288 last_returned_parameter = res_param_name; |
284 return res_param_name; |
289 return res_param_name; |
285 } |
290 } |
286 |
291 |
287 /* Returns the currently referenced parameter's default value, |
292 /* Returns the currently referenced parameter's default value, |
288 * or NULL if none is specified in the function declrataion itself. |
293 * or NULL if none is specified in the function declrataion itself. |
289 */ |
294 */ |
290 symbol_c *function_param_iterator_c::default_value(void) { |
295 symbol_c *function_param_iterator_c::default_value(void) { |
|
296 if (NULL == last_returned_parameter) |
|
297 return NULL; |
291 return current_param_default_value; |
298 return current_param_default_value; |
292 } |
299 } |
293 |
300 |
294 /* Returns the currently referenced parameter's type name. */ |
301 /* Returns the currently referenced parameter's type name. */ |
295 symbol_c *function_param_iterator_c::param_type(void) { |
302 symbol_c *function_param_iterator_c::param_type(void) { |
|
303 if (NULL == last_returned_parameter) |
|
304 return NULL; |
296 return current_param_type; |
305 return current_param_type; |
297 } |
306 } |
298 |
307 |
299 /* Returns if currently referenced parameter is an implicit defined EN/ENO parameter. */ |
308 /* Returns if currently referenced parameter is an implicit defined EN/ENO parameter. */ |
300 bool function_param_iterator_c::is_en_eno_param_implicit(void) { |
309 bool function_param_iterator_c::is_en_eno_param_implicit(void) { |
|
310 if (NULL == last_returned_parameter) |
|
311 ERROR; |
301 return en_eno_param_implicit; |
312 return en_eno_param_implicit; |
302 } |
313 } |
303 |
314 |
304 /* Returns if currently referenced parameter is an extensible parameter. */ |
315 /* Returns if currently referenced parameter is an extensible parameter. */ |
305 /* extensible paramters only occur in some standard functions, e.g. AND(word#34, word#44, word#65); */ |
316 /* extensible paramters only occur in some standard functions, e.g. AND(word#34, word#44, word#65); */ |
306 bool function_param_iterator_c::is_extensible_param(void) { |
317 bool function_param_iterator_c::is_extensible_param(void) { |
|
318 if (NULL == last_returned_parameter) |
|
319 ERROR; |
307 return current_param_is_extensible; |
320 return current_param_is_extensible; |
308 } |
321 } |
309 |
322 |
310 /* Returns the index of the current extensible parameter. */ |
323 /* Returns the index of the current extensible parameter. */ |
311 /* If the current parameter is not an extensible paramter, returns -1 */ |
324 /* If the current parameter is not an extensible paramter, returns -1 */ |
312 int function_param_iterator_c::extensible_param_index(void) { |
325 int function_param_iterator_c::extensible_param_index(void) { |
|
326 if (NULL == last_returned_parameter) |
|
327 ERROR; |
313 return (current_param_is_extensible? current_extensible_param_index : -1); |
328 return (current_param_is_extensible? current_extensible_param_index : -1); |
314 } |
329 } |
315 |
330 |
316 /* Returns the index of the first extensible parameter, or -1 if no extensible parameter found. */ |
331 /* Returns the index of the first extensible parameter, or -1 if no extensible parameter found. */ |
317 /* WARNING: Will only return the correct value _after_ an extensible parameter has been found! */ |
332 /* WARNING: Will only return the correct value _after_ an extensible parameter has been found! */ |
321 |
336 |
322 /* Returns the currently referenced parameter's data passing direction. |
337 /* Returns the currently referenced parameter's data passing direction. |
323 * i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT |
338 * i.e. VAR_INPUT, VAR_OUTPUT or VAR_INOUT |
324 */ |
339 */ |
325 function_param_iterator_c::param_direction_t function_param_iterator_c::param_direction(void) { |
340 function_param_iterator_c::param_direction_t function_param_iterator_c::param_direction(void) { |
|
341 if (NULL == last_returned_parameter) |
|
342 ERROR; |
326 return current_param_direction; |
343 return current_param_direction; |
327 } |
344 } |
328 |
345 |
329 void *function_param_iterator_c::visit(implicit_definition_c *symbol) { |
346 void *function_param_iterator_c::visit(implicit_definition_c *symbol) { |
330 en_eno_param_implicit = true; |
347 en_eno_param_implicit = true; |