stage4/generate_cc/search_expression_type.cc
changeset 33 4507beb2aac6
parent 32 289256ec66f1
child 35 9f3d6c089533
equal deleted inserted replaced
32:289256ec66f1 33:4507beb2aac6
    30  *       2 + 3       -> returns reference to a int_type_name_c object.
    30  *       2 + 3       -> returns reference to a int_type_name_c object.
    31  *       22.2 - 5    -> returns reference to a real_type_name_c object.
    31  *       22.2 - 5    -> returns reference to a real_type_name_c object.
    32  *       etc...
    32  *       etc...
    33  */
    33  */
    34 
    34 
       
    35 #include "function_type_decl.h"
       
    36 #include "get_function_type_decl.c"
       
    37 
       
    38 #if 0
    35 typedef enum {function_add,
    39 typedef enum {function_add,
    36               function_sub,
    40               function_sub,
    37               function_and,
    41               function_and,
    38               function_or,
    42               function_or,
    39               function_sqrt,
    43               function_sqrt,
    51     return function_or;
    55     return function_or;
    52   else if (!strcasecmp(function_name->value, "SQRT"))
    56   else if (!strcasecmp(function_name->value, "SQRT"))
    53     return function_sqrt;
    57     return function_sqrt;
    54   else return function_none;
    58   else return function_none;
    55 }
    59 }
       
    60 #endif
    56 
    61 
    57 
    62 
    58 symbol_c *generate_param_name(const char *name) {
    63 symbol_c *generate_param_name(const char *name) {
    59   symbol_c *param_name = new identifier_c(name);
    64   symbol_c *param_name = new identifier_c(name);
    60   return param_name;
    65   return param_name;
   155     }
   160     }
   156     
   161     
   157   private:
   162   private:
   158 
   163 
   159   void *compute_standard_function_st(function_invocation_c *symbol) {
   164   void *compute_standard_function_st(function_invocation_c *symbol) {
       
   165 #if 0
   160     symbol_c *current_type = NULL;
   166     symbol_c *current_type = NULL;
   161     symbol_c *return_type = NULL;
   167     symbol_c *return_type = NULL;
       
   168 #endif
       
   169 
   162     function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
   170     function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
   163     
       
   164     function_call_param_iterator_c function_call_param_iterator(symbol);
   171     function_call_param_iterator_c function_call_param_iterator(symbol);
   165     
   172     search_expression_type_c* search_expression_type = this;
       
   173     #include "search_type_code.c"
       
   174     
       
   175 #if 0
   166     for(int current_param = 0; current_param < ((list_c *)symbol->parameter_assignment_list)->n; current_param++) {
   176     for(int current_param = 0; current_param < ((list_c *)symbol->parameter_assignment_list)->n; current_param++) {
   167       symbol_c *param_name = NULL;
   177       symbol_c *param_name = NULL;
   168       switch (current_function_type) {
   178       switch (current_function_type) {
   169         case function_add:
   179         case function_add:
   170         case function_and:
   180         case function_and:
   246           else ERROR;
   256           else ERROR;
   247           break;
   257           break;
   248         default: ERROR;
   258         default: ERROR;
   249       }
   259       }
   250     }
   260     }
   251     
       
   252     return (void *)return_type;
   261     return (void *)return_type;
       
   262 #endif
       
   263     
   253   }
   264   }
   254 
   265 
   255   public:
   266   public:
   256 
   267 
   257   void *compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_type) {
   268   void *compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_type) {
   258     symbol_c *current_type = NULL;
   269     /*symbol_c *current_type = NULL;*/
   259     symbol_c *return_type = NULL;
   270     symbol_c *return_type = NULL;
   260     function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
   271     function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
   261     if (current_function_type == function_none) ERROR;
   272     if (current_function_type == function_none) ERROR;
   262     
   273     
   263     function_call_param_iterator_c function_call_param_iterator(symbol);
   274     function_call_param_iterator_c function_call_param_iterator(symbol);
   298     }
   309     }
   299     
   310     
   300     return (void *)return_type;
   311     return (void *)return_type;
   301   }
   312   }
   302 
   313 
   303   static bool_type_name_c bool_type_name;
   314   /*static bool_type_name_c bool_type_name;*/
   304 
   315 
   305   /* A helper function... */
   316   /* A helper function... */
   306   void *compute_boolean_expression(symbol_c *left_type, symbol_c *right_type) {
   317   void *compute_boolean_expression(symbol_c *left_type, symbol_c *right_type) {
   307     if (!is_same_type(left_type, right_type))
   318     if (!is_same_type(left_type, right_type))
   308       ERROR;
   319       ERROR;
   500     return base_type(f_decl->type_name);
   511     return base_type(f_decl->type_name);
   501   }
   512   }
   502 
   513 
   503 };
   514 };
   504 
   515 
   505 bool_type_name_c     search_expression_type_c::bool_type_name;
   516 /*bool_type_name_c     search_expression_type_c::bool_type_name;*/
   506 
   517