merge
authorMario de Sousa <msousa@fe.up.pt>
Mon, 03 Dec 2012 18:44:16 +0000
changeset 766 ffed675e79d8
parent 762 a3d917474ae4 (current diff)
parent 765 d15f13bff9c6 (diff)
child 768 308022f26450
merge
--- a/stage1_2/create_enumtype_conversion_functions.cc	Mon Dec 03 14:06:49 2012 +0000
+++ b/stage1_2/create_enumtype_conversion_functions.cc	Mon Dec 03 18:44:16 2012 +0000
@@ -155,12 +155,12 @@
   IN: STRING;
   END_VAR
   IF IN = '<ENUM.VALUE_1>' THEN
-   STRING_TO_<ENUM> := <ENUM.VALUE_1>;
+   STRING_TO_<ENUM> := <ENUM>#<ENUM.VALUE_1>;
    RETURN;
   END_IF;
   ...
   IF IN = '<ENUM.VALU_N>' THEN
-   STRING_TO_<ENUM> := <ENUM.VALUE_N>;
+   STRING_TO_<ENUM> := <ENUM>#<ENUM.VALUE_N>;
    RETURN;
   END_IF;
   ENO := FALSE;
@@ -178,7 +178,7 @@
     for (itr = enumerateValues.begin(); itr != enumerateValues.end(); ++itr) {
        std::string value = *itr;
        text += "IF IN = '" + value + "' THEN\n";
-       text += " " + functionName + " := " + value + ";\n";
+       text += " " + functionName + " := " + enumerateName + "#" + value + ";\n";
        text += " RETURN;\n"; 
        text += "END_IF;\n";
     }
@@ -195,13 +195,13 @@
   VAR_INPUT
   IN: <ENUM>;
   END_VAR
-  IF IN = <ENUM.VALUE_1> THEN
-   <ENUM>_TO_STRING := '<ENUM.VALUE_1>';
+  IF IN = <ENUM>#<ENUM.VALUE_1> THEN
+   <ENUM>_TO_STRING := '<ENUM>#<ENUM.VALUE_1>';
    RETURN;
   END_IF;
   ...
-  IF IN = <ENUM.VALUE_N> THEN
-   <ENUM>_TO_STRING := '<ENUM.VALUE_N>';
+  IF IN = <ENUM>#<ENUM.VALUE_N> THEN
+   <ENUM>_TO_STRING := '<ENUM>#<ENUM.VALUE_N>';
    RETURN;
   END_IF;
   ENO := FALSE;
@@ -218,8 +218,8 @@
     text += "\nVAR_INPUT\nIN : " + enumerateName + ";\nEND_VAR\n";
     for (itr = enumerateValues.begin(); itr != enumerateValues.end(); ++itr) {
         std::string value = *itr;
-        text += "IF IN = " + value + " THEN\n";
-        text += " " + functionName + " := '" + value + "';\n";
+        text += "IF IN = " + enumerateName + "#" + value + " THEN\n";
+        text += " " + functionName + " := '" + enumerateName + "#" + value + "';\n";
         text += " RETURN;\n";
         text += "END_IF;\n";
     }
@@ -237,12 +237,12 @@
   IN: <INTEGER>;
   END_VAR
   IF IN = 1 THEN
-   <INTEGER>_TO_<ENUM> := <ENUM.VALUE_1>;
+   <INTEGER>_TO_<ENUM> := <ENUM>#<ENUM.VALUE_1>;
    RETURN;
   END_IF;
   ...
   IF IN = N THEN
-   <INTEGER>_TO_<ENUM> := <ENUM.VALUE_N>;
+   <INTEGER>_TO_<ENUM> := <ENUM>#<ENUM.VALUE_N>;
    RETURN;
   END_IF;
   ENO := FALSE;
@@ -266,7 +266,7 @@
         std::stringstream out;
         out << count;
         text += "IF IN = " + out.str() + " THEN\n";
-        text += " " + functionName + " := " + value + ";\n";
+        text += " " + functionName + " := " + enumerateName + "#" + value + ";\n";
         text += " RETURN;\n";
         text += "END_IF;\n";
         count++;
@@ -284,12 +284,12 @@
   VAR_INPUT
   IN: <INTEGER>;
   END_VAR
-  IF IN = <ENUM.VALUE_1> THEN
+  IF IN = <ENUM>#<ENUM.VALUE_1> THEN
    <ENUM>_TO_<INTEGER> := 1;
    RETURN;
   END_IF;
   ...
-  IF IN = <ENUM.VALUE_N> THEN
+  IF IN = <ENUM>#<ENUM.VALUE_N> THEN
    <ENUM>_TO_<INTEGER> := N;
    RETURN;
   END_IF;
@@ -313,7 +313,7 @@
         std::string value = *itr;
         std::stringstream out;
         out << count;
-        text += "IF IN = " + value + " THEN\n";
+        text += "IF IN = " + enumerateName + "#" + value + " THEN\n";
         text += " " + functionName + " := " + out.str() + ";\n";
         text += " RETURN;\n";
         text += "END_IF;\n";
--- a/stage3/fill_candidate_datatypes.cc	Mon Dec 03 14:06:49 2012 +0000
+++ b/stage3/fill_candidate_datatypes.cc	Mon Dec 03 18:44:16 2012 +0000
@@ -1817,14 +1817,15 @@
 	else ERROR;
 
 	generic_function_call_t fcall_param = {
-		/* fcall_param.function_name               = */ symbol->function_name,
-		/* fcall_param.nonformal_operand_list      = */ symbol->nonformal_param_list,
-		/* fcall_param.formal_operand_list         = */ symbol->formal_param_list,
-		/* enum {POU_FB, POU_function} POU_type    = */ generic_function_call_t::POU_function,
-		/* fcall_param.candidate_functions         = */ symbol->candidate_functions,
-		/* fcall_param.called_function_declaration = */ symbol->called_function_declaration,
-		/* fcall_param.extensible_param_count      = */ symbol->extensible_param_count
+			  function_name:                symbol->function_name,
+			  nonformal_operand_list:       symbol->nonformal_param_list,
+			  formal_operand_list:          symbol->formal_param_list,
+			  POU_type:                     generic_function_call_t::POU_function,
+			  candidate_functions:          symbol->candidate_functions,
+			  called_function_declaration:  symbol->called_function_declaration,
+			  extensible_param_count:       symbol->extensible_param_count
 	};
+
 	handle_function_call(symbol, fcall_param);
 
 	if (debug) std::cout << "function_invocation_c [" << symbol->candidate_datatypes.size() << "] result.\n";