fixing formal function invocation in IL
authormario
Sun, 28 Oct 2007 16:07:52 +0100
changeset 71 c2c867171c07
parent 70 e1f0ebd2d9ec
child 72 328b794f8922
fixing formal function invocation in IL
stage4/generate_iec/generate_iec.cc
--- a/stage4/generate_iec/generate_iec.cc	Wed Oct 24 17:39:51 2007 +0200
+++ b/stage4/generate_iec/generate_iec.cc	Sun Oct 28 16:07:52 2007 +0100
@@ -1118,8 +1118,8 @@
   return NULL;
 }
 
-/* TRANSITION [transition_name] ['(' 'PRIORITY' ':=' integer ')']
- *   FROM steps TO steps 
+/* TRANSITION [transition_name] ['(''PRIORITY'':='integer')']
+ *   FROMstepsTO steps 
  *   ':' simple_instr_list | ':=' expression
  * END_TRANSITION
  */
@@ -1508,18 +1508,21 @@
 void *visit(il_formal_funct_call_c *symbol) {
   symbol->function_name->accept(*this);
   s4o.print("(");
+  s4o.print("\n");
   if (symbol->il_param_list != NULL) {
-    s4o.print("\n");
     s4o.indent_right();
     symbol->il_param_list->accept(*this);
     s4o.print(")");
+    s4o.indent_left();
   }
   return NULL;
 }
 
 
 /* | il_operand_list ',' il_operand */
-void *visit(il_operand_list_c *symbol) {return print_list(symbol, "", ", ");}
+void *visit(il_operand_list_c *symbol) {
+  return print_list(symbol, "", ", ");
+}
 
 /* | simple_instr_list il_simple_instruction */
 void *visit(simple_instr_list_c *symbol) {
@@ -1527,14 +1530,17 @@
 }
 
 /* | il_initial_param_list il_param_instruction */
-void *visit(il_param_list_c *symbol) {return print_list(symbol);}
+void *visit(il_param_list_c *symbol) {
+// return print_list(symbol);
+  return print_list(symbol,  s4o.indent_spaces, ",\n" + s4o.indent_spaces, "\n" + s4o.indent_spaces);
+}
 
 /*  il_assign_operator il_operand
  * | il_assign_operator '(' eol_list simple_instr_list ')'
  */
 void *visit(il_param_assignment_c *symbol) {
   symbol->il_assign_operator->accept(*this);
-  s4o.print(" ");
+  s4o.print(" := ");
   if (symbol->il_operand != NULL)
     symbol->il_operand->accept(*this);
   if (symbol->simple_instr_list != NULL) {
@@ -1542,8 +1548,8 @@
     s4o.indent_right();
     symbol->simple_instr_list->accept(*this);
     s4o.print(s4o.indent_spaces);
+    s4o.print(")");
     s4o.indent_left();
-    s4o.print(")");
   }
   return NULL;
 }
@@ -1551,6 +1557,7 @@
 /*  il_assign_out_operator variable */
 void *visit(il_param_out_assignment_c *symbol) {
   symbol->il_assign_out_operator->accept(*this);
+  s4o.print(" => ");
   symbol->variable->accept(*this);
   return NULL;
 }