stage4/generate_c/generate_c_il.cc
changeset 1011 76175defb87b
parent 971 8aee27d46208
child 1016 91bef6704b44
equal deleted inserted replaced
1010:242907849850 1011:76175defb87b
   325       if (NULL == operand->datatype) ERROR;
   325       if (NULL == operand->datatype) ERROR;
   326       if (NULL == this->implicit_variable_current.datatype) ERROR;
   326       if (NULL == this->implicit_variable_current.datatype) ERROR;
   327 
   327 
   328       this->implicit_variable_result.accept(*this);
   328       this->implicit_variable_result.accept(*this);
   329       s4o.print(" = ");
   329       s4o.print(" = ");
   330       s4o.print(operation);
   330       // print_compare_function is in generate_c_base_c, which is inherited by generate_c_il_c
   331       operand->datatype->accept(*this);
   331       print_compare_function(operation, operand->datatype, &(this->implicit_variable_current), operand);
   332       /* NOTE: we are calling a standard Function: 
       
   333        *         1st parameter: EN  (enable)
       
   334        *         2nd parameter: ENO (enable output)
       
   335        *         3rd parameter: number of operands we will be passing (required because we are calling an extensible standard function!)
       
   336        *         4th parameter: the left  hand side of the comparison expression (in out case, the IL implicit variable)
       
   337        *         4th parameter: the right hand side of the comparison expression (in out case, current operand)
       
   338        */
       
   339       s4o.print("(__BOOL_LITERAL(TRUE), NULL, 2, ");
       
   340       this->implicit_variable_current.accept(*this);
       
   341       s4o.print(", ");
       
   342       operand->accept(*this);
       
   343       s4o.print(")");
       
   344 
       
   345       return NULL;
   332       return NULL;
   346     }
   333     }
   347 
   334 
   348 
   335 
   349     /* A helper function... */
   336     /* A helper function... */
   935     if (function_type_suffix != NULL)
   922     if (function_type_suffix != NULL)
   936       function_type_suffix->accept(*this);
   923       function_type_suffix->accept(*this);
   937   }
   924   }
   938   s4o.print("(");
   925   s4o.print("(");
   939   s4o.indent_right();
   926   s4o.indent_right();
       
   927   s4o.print("\n"+s4o.indent_spaces);
   940   
   928   
   941   int nb_param = 0;
   929   int nb_param = 0;
   942   PARAM_LIST_ITERATOR() {
   930   PARAM_LIST_ITERATOR() {
   943     symbol_c *param_value = PARAM_VALUE;
   931     symbol_c *param_value = PARAM_VALUE;
   944     current_param_type = PARAM_TYPE;
   932     current_param_type = PARAM_TYPE;
   989       s4o.print(",\n"+s4o.indent_spaces);
   977       s4o.print(",\n"+s4o.indent_spaces);
   990     s4o.print(FB_FUNCTION_PARAM);
   978     s4o.print(FB_FUNCTION_PARAM);
   991   }
   979   }
   992   
   980   
   993   s4o.print(")");
   981   s4o.print(")");
       
   982   s4o.indent_left();  
   994 
   983 
   995   CLEAR_PARAM_LIST()
   984   CLEAR_PARAM_LIST()
   996 
   985 
   997   return NULL;
   986   return NULL;
   998 }
   987 }
  1709   return NULL;
  1698   return NULL;
  1710 }
  1699 }
  1711 
  1700 
  1712 void *visit(MOD_operator_c *symbol)	{XXX_operator(&(this->implicit_variable_result), " %= ", this->current_operand); return NULL;}
  1701 void *visit(MOD_operator_c *symbol)	{XXX_operator(&(this->implicit_variable_result), " %= ", this->current_operand); return NULL;}
  1713 
  1702 
  1714 void *visit(GT_operator_c *symbol)	{CMP_operator(this->current_operand, "GT_"); return NULL;}
  1703 void *visit(GT_operator_c *symbol)	{CMP_operator(this->current_operand, "GT"); return NULL;}
  1715 void *visit(GE_operator_c *symbol)	{CMP_operator(this->current_operand, "GE_"); return NULL;}
  1704 void *visit(GE_operator_c *symbol)	{CMP_operator(this->current_operand, "GE"); return NULL;}
  1716 void *visit(EQ_operator_c *symbol)	{CMP_operator(this->current_operand, "EQ_"); return NULL;}
  1705 void *visit(EQ_operator_c *symbol)	{CMP_operator(this->current_operand, "EQ"); return NULL;}
  1717 void *visit(LT_operator_c *symbol)	{CMP_operator(this->current_operand, "LT_"); return NULL;}
  1706 void *visit(LT_operator_c *symbol)	{CMP_operator(this->current_operand, "LT"); return NULL;}
  1718 void *visit(LE_operator_c *symbol)	{CMP_operator(this->current_operand, "LE_"); return NULL;}
  1707 void *visit(LE_operator_c *symbol)	{CMP_operator(this->current_operand, "LE"); return NULL;}
  1719 void *visit(NE_operator_c *symbol)	{CMP_operator(this->current_operand, "NE_"); return NULL;}
  1708 void *visit(NE_operator_c *symbol)	{CMP_operator(this->current_operand, "NE"); return NULL;}
  1720 
  1709 
  1721 
  1710 
  1722 //SYM_REF0(CAL_operator_c)
  1711 //SYM_REF0(CAL_operator_c)
  1723 // This method will be called from within the il_fb_call_c visitor method
  1712 // This method will be called from within the il_fb_call_c visitor method
  1724 void *visit(CAL_operator_c *symbol) {return NULL;}
  1713 void *visit(CAL_operator_c *symbol) {return NULL;}