absyntax_utils/function_call_param_iterator.cc
changeset 625 c0bda77b37a0
parent 596 4efb11e44065
child 844 39c755f41ee8
--- a/absyntax_utils/function_call_param_iterator.cc	Tue Aug 14 19:40:01 2012 +0200
+++ b/absyntax_utils/function_call_param_iterator.cc	Wed Aug 22 16:46:17 2012 +0200
@@ -48,6 +48,7 @@
 
 #include "function_call_param_iterator.hh"
 #include <strings.h>
+#include "../main.hh" // required for ERROR() and ERROR_MSG() macros.
 
 
 //#define DEBUG
@@ -57,9 +58,6 @@
 #define TRACE(classname)
 #endif
 
-#define ERROR error_exit(__FILE__,__LINE__)
-/* function defined in main.cc */
-extern void error_exit(const char *file_name, int line_no);
 
 
 
@@ -184,6 +182,7 @@
  */
 symbol_c *function_call_param_iterator_c::next_f(void) {
   current_value = NULL;
+  current_assign_direction = assign_none;
   param_count = 0;
   iterate_f_next_param++;
   current_operation = function_call_param_iterator_c::iterate_f_op;
@@ -201,6 +200,7 @@
  */
 symbol_c *function_call_param_iterator_c::next_nf(void) {
   current_value = NULL;
+  current_assign_direction = assign_none;
   param_count = 0;
   iterate_nf_next_param++;
   current_operation = function_call_param_iterator_c::iterate_nf_op;
@@ -212,6 +212,7 @@
 /* Search for the value passed to the parameter named <param_name>...  */
 symbol_c *function_call_param_iterator_c::search_f(symbol_c *param_name) {
   current_value = NULL;
+  current_assign_direction = assign_none;
   if (NULL == param_name) ERROR;
   search_param_name = dynamic_cast<identifier_c *>(param_name);
   if (NULL == search_param_name) ERROR;
@@ -233,6 +234,12 @@
   return current_value;
 }
 
+/* Returns the value being passed to the current parameter. */
+function_call_param_iterator_c::assign_direction_t function_call_param_iterator_c::get_assign_direction(void) {
+  return current_assign_direction;
+}
+
+
 /********************************/
 /* B 1.7 Configuration elements */
 /********************************/
@@ -339,6 +346,7 @@
   if (NULL == symb_var)
     ERROR;
 
+  current_assign_direction = assign_in;
   return handle_parameter_assignment(symb_var->var_name, symbol->prog_data_source);
 }
 
@@ -355,6 +363,7 @@
   if (NULL == symb_var)
     ERROR;
 
+  current_assign_direction = assign_out;
   return handle_parameter_assignment(symb_var->var_name, symbol->data_sink);
 }
 
@@ -459,6 +468,7 @@
   // since we do not yet support it, it is best to simply stop than to fail silently...
   if (NULL != symbol->simple_instr_list) ERROR;
 
+  current_assign_direction = assign_in;
   return handle_parameter_assignment((symbol_c *)symbol->il_assign_operator->accept(*this), symbol->il_operand);
 }
 
@@ -466,6 +476,7 @@
 // SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable);
 void *function_call_param_iterator_c::visit(il_param_out_assignment_c *symbol) {
   TRACE("il_param_out_assignment_c");
+  current_assign_direction = assign_out;
   return handle_parameter_assignment((symbol_c *)symbol->il_assign_out_operator->accept(*this), symbol->variable);
 }
 
@@ -564,6 +575,7 @@
 // SYM_REF2(input_variable_param_assignment_c, variable_name, expression)
 void *function_call_param_iterator_c::visit(input_variable_param_assignment_c *symbol) {
   TRACE("input_variable_param_assignment_c");
+  current_assign_direction = assign_in;
   return handle_parameter_assignment(symbol->variable_name, symbol->expression);
 }
 
@@ -574,6 +586,7 @@
   // TODO : Handle not_param !!!
   if (NULL != symbol->not_param) ERROR;  // we do not yet support it, so it is best to simply stop than to fail silently...
 
+  current_assign_direction = assign_out;
   return handle_parameter_assignment(symbol->variable_name, symbol->variable);
 }