stage4/generate_c/generate_c_st.cc
changeset 349 b826f13c260e
parent 347 44ff2a6fcadc
child 375 7a11f9e9e703
equal deleted inserted replaced
348:990ecb883731 349:b826f13c260e
   609   }
   609   }
   610   ERROR;
   610   ERROR;
   611   return NULL;
   611   return NULL;
   612 }
   612 }
   613 
   613 
   614 /* TODO: power expression... */
       
   615 void *visit(power_expression_c *symbol) {
   614 void *visit(power_expression_c *symbol) {
   616   ERROR; 
   615   symbol_c *left_type = search_expression_type->get_type(symbol->l_exp);
   617   return print_binary_expression(symbol->l_exp, symbol->r_exp, " ** ");
   616   symbol_c *right_type = search_expression_type->get_type(symbol->r_exp);
       
   617   if (search_expression_type->is_real_type(left_type) && search_expression_type->is_num_type(right_type)) {
       
   618 	s4o.print("__expt_LREAL((BOOL)__BOOL_LITERAL(TRUE),\n");
       
   619 	s4o.indent_right();
       
   620 	s4o.print(s4o.indent_spaces + "NULL,\n");
       
   621 	s4o.print(s4o.indent_spaces + "(LREAL)(");
       
   622 	symbol->l_exp->accept(*this);
       
   623 	s4o.print("),\n");
       
   624 	s4o.print(s4o.indent_spaces + "(LREAL)(");
       
   625 	symbol->r_exp->accept(*this);
       
   626 	s4o.print("))");
       
   627     return NULL;
       
   628   }
       
   629   ERROR;
   618 }
   630 }
   619 
   631 
   620 void *visit(neg_expression_c *symbol) {
   632 void *visit(neg_expression_c *symbol) {
   621   return print_unary_expression(symbol->exp, " -");
   633   return print_unary_expression(symbol->exp, " -");
   622 }
   634 }