Adding support for declare, init, get and set macros
authorlaurent
Sun, 29 Nov 2009 16:38:28 +0100
changeset 458 6e4ad5af894d
parent 457 91b28dd0c9c9
child 459 a29f6f3e8468
Adding support for declare, init, get and set macros
generate_IEC_std.py
--- a/generate_IEC_std.py	Mon Nov 02 18:51:27 2009 +0100
+++ b/generate_IEC_std.py	Sun Nov 29 16:38:28 2009 +0100
@@ -138,6 +138,7 @@
 {"""
                 if not do_type_search_only:
                     res += """
+    identifier_c %(input_name)s_param_name("%(input_name)s");
     /* Get the value from a foo(<param_name> = <param_value>) style call */
     symbol_c *%(input_name)s_param_value = &this->default_variable_name;
 """%{"input_name":Paramname}
@@ -148,9 +149,9 @@
             else:
                 res += """
 {
-    identifier_c param_name("%(input_name)s");
+    identifier_c %(input_name)s_param_name("%(input_name)s");
     /* Get the value from a foo(<param_name> = <param_value>) style call */
-    symbol_c *%(input_name)s_param_value = function_call_param_iterator.search_f(&param_name);
+    symbol_c *%(input_name)s_param_value = function_call_param_iterator.search_f(&%(input_name)s_param_name);
     symbol_c *%(input_name)s_type_symbol = NULL;
     
     /* Get the value from a foo(<param_value>) style call */
@@ -195,13 +196,14 @@
   nb_param = %(min_nb_param)d;
 char* nb_param_str = new char[10];
 sprintf(nb_param_str, "%%d", nb_param);
-ADD_PARAM_LIST((symbol_c*)(new integer_c((const char *)nb_param_str)), (symbol_c*)(new int_type_name_c()), function_param_iterator_c::direction_in)
+identifier_c nb_param_name("nb_param");
+ADD_PARAM_LIST(&nb_param_name, (symbol_c*)(new integer_c((const char *)nb_param_str)), (symbol_c*)(new int_type_name_c()), function_param_iterator_c::direction_in)
 """%{"min_nb_param" : len(fdecl["inputs"])}
             for paramname,paramtype,unused in fdecl["inputs"]:
                 res += """
 if (%(input_name)s_type_symbol == NULL)
   %(input_name)s_type_symbol = last_type_symbol;
-ADD_PARAM_LIST(%(input_name)s_param_value, %(input_name)s_type_symbol, function_param_iterator_c::direction_in)
+ADD_PARAM_LIST(&%(input_name)s_param_name, %(input_name)s_param_value, %(input_name)s_type_symbol, function_param_iterator_c::direction_in)
 """%{"input_name" : paramname}
             if fdecl["extensible"]:
                 res += """
@@ -223,7 +225,7 @@
         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 ;
     
         /*Function specific CODE */
-        ADD_PARAM_LIST(param_value, current_type_symbol, function_param_iterator_c::direction_in)
+        ADD_PARAM_LIST(&param_name, param_value, current_type_symbol, function_param_iterator_c::direction_in)
     }
     
 }while(param_value != NULL);