--- a/stage4/generate_c/search_expression_type.cc Wed Oct 15 15:38:58 2008 +0200
+++ b/stage4/generate_c/search_expression_type.cc Fri Oct 24 16:37:46 2008 +0200
@@ -172,150 +172,6 @@
#include "search_type_code.c"
-#if 0
- void *compute_standard_function_st(function_invocation_c *symbol) {
- symbol_c *current_type = NULL;
- symbol_c *return_type = NULL;
-
- function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
- function_call_param_iterator_c function_call_param_iterator(symbol);
- search_expression_type_c* search_expression_type = this;
-
- for(int current_param = 0; current_param < ((list_c *)symbol->parameter_assignment_list)->n; current_param++) {
- symbol_c *param_name = NULL;
- switch (current_function_type) {
- case function_add:
- case function_and:
- case function_or:
- param_name = generate_param_name("IN%d", current_param + 1);
- break;
- case function_sub:
- if (current_param < 2)
- param_name = generate_param_name("IN%d", current_param + 1);
- else ERROR;
- break;
- default: ERROR;
- }
-
- /* Get the value from a foo(<param_name> = <param_value>) style call */
- symbol_c *param_value = function_call_param_iterator.search(param_name);
- delete param_name;
-
- /* Get the value from a foo(<param_value>) style call */
- if (param_value == NULL)
- param_value = function_call_param_iterator.next();
-
- if (param_value == NULL) ERROR;
-
- symbol_c *param_type = (symbol_c *)param_value->accept(*this);
-
- switch (current_function_type) {
- case function_add:
- if (current_param == 0)
- current_type = param_type;
- else if (current_param == 1) {
- if ((is_integer_type(current_type) && is_same_type(current_type, param_type)) ||
- (is_real_type(current_type) && is_same_type(current_type, param_type))) {
- current_type = common_type(current_type, param_type);
- return_type = current_type;
- }
- else if (is_time_type(current_type)) {
- if ((typeid(*current_type) == typeid(time_type_name_c)) && (typeid(*param_type) == typeid(time_type_name_c))) {return_type = (symbol_c *)&time_type_name;}
- else if (typeid(*current_type) == typeid(tod_type_name_c) && typeid(*param_type) == typeid(time_type_name_c)) {return_type = (symbol_c *)&tod_type_name;}
- else if (typeid(*current_type) == typeid(dt_type_name_c) && typeid(*param_type) == typeid(time_type_name_c)) {return_type = (symbol_c *)&dt_type_name;}
- else ERROR;
- }
- else ERROR;
- }
- else if (!is_time_type(current_type) && is_same_type(current_type, param_type)) {
- current_type = common_type(current_type, param_type);
- return_type = current_type;
- }
- else ERROR;
- break;
- case function_sub:
- if (current_param == 0)
- current_type = param_type;
- else if (current_param == 1) {
- if ((is_integer_type(current_type) && is_same_type(current_type, param_type)) ||
- (is_real_type(current_type) && is_same_type(current_type, param_type)))
- return_type = common_type(current_type, param_type);
- else if (is_time_type(current_type)) {
- if (typeid(*current_type) == typeid(time_type_name_c) && typeid(*param_type) == typeid(time_type_name_c)) {return_type = (symbol_c *)&time_type_name;}
- else if (typeid(*current_type) == typeid(date_type_name_c) && typeid(*param_type) == typeid(date_type_name_c)) {return_type = (symbol_c *)&time_type_name;}
- else if (typeid(*current_type) == typeid(tod_type_name_c) && typeid(*param_type) == typeid(time_type_name_c)) {return_type = (symbol_c *)&tod_type_name;}
- else if (typeid(*current_type) == typeid(tod_type_name_c) && typeid(*param_type) == typeid(tod_type_name_c)) {return_type = (symbol_c *)&time_type_name;}
- else if (typeid(*current_type) == typeid(dt_type_name_c) && typeid(*param_type) == typeid(time_type_name_c)) {return_type = (symbol_c *)&dt_type_name;}
- else if (typeid(*current_type) == typeid(dt_type_name_c) && typeid(*param_type) == typeid(dt_type_name_c)) {return_type = (symbol_c *)&time_type_name;}
- else ERROR;
- }
- else ERROR;
- }
- else ERROR;
- break;
- case function_and:
- case function_or:
- if (current_param == 0)
- if (is_binary_type(param_type))
- current_type = param_type;
- else ERROR;
- else if (is_same_type(current_type, param_type))
- return_type = common_type(current_type, param_type);
- else ERROR;
- break;
- default: ERROR;
- }
- }
- return (void *)return_type;
- }
-
- void *compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_type) {
- /*symbol_c *current_type = NULL;*/
- symbol_c *return_type = NULL;
- function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
- if (current_function_type == function_none) ERROR;
-
- function_call_param_iterator_c function_call_param_iterator(symbol);
-
- int nb_param = 1;
- if (symbol->il_operand_list != NULL)
- nb_param += ((list_c *)symbol->il_operand_list)->n;
-
- for(int current_param = 0; current_param < nb_param; current_param++) {
-
- if (current_param != 0) {
- symbol_c *param_name = NULL;
- switch (current_function_type) {
- default: ERROR;
- }
-
- /* Get the value from a foo(<param_name> = <param_value>) style call */
- symbol_c *param_value = function_call_param_iterator.search(param_name);
- delete param_name;
-
- /* Get the value from a foo(<param_value>) style call */
- if (param_value == NULL)
- param_value = function_call_param_iterator.next();
-
- if (param_value == NULL) ERROR;
-
- param_type = (symbol_c *)param_value->accept(*this);
- }
-
- switch (current_function_type) {
- case function_sqrt:
- if (current_param == 0 && is_real_type(param_type))
- return_type = param_type;
- else ERROR;
- break;
- default: ERROR;
- }
- }
-
- return (void *)return_type;
- }
-#endif
-
/*static bool_type_name_c bool_type_name;*/
/* A helper function... */
@@ -486,7 +342,7 @@
function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name);
if (f_decl == function_symtable.end_value()) {
- void *res = compute_standard_function_st(symbol);
+ void *res = compute_standard_function_default(symbol);
if (res == NULL)
ERROR;
return res;