absyntax_utils/search_constant_type.cc
changeset 257 90782e241346
parent 202 da1a8186f86f
child 265 4d222f46f8cc
equal deleted inserted replaced
204:8ffa211b7f9a 257:90782e241346
    57   * numeric literal '30' must then be considered a LINT so the ADD function may be called
    57   * numeric literal '30' must then be considered a LINT so the ADD function may be called
    58   * with all inputs of the same data type.
    58   * with all inputs of the same data type.
    59   * If 'x' were a SINT, then the '30' would have to be a SINT too!
    59   * If 'x' were a SINT, then the '30' would have to be a SINT too!
    60   */
    60   */
    61 void *search_constant_type_c::visit(real_c *symbol)           {return (void *)symbol;}
    61 void *search_constant_type_c::visit(real_c *symbol)           {return (void *)symbol;}
       
    62 void *search_constant_type_c::visit(neg_real_c *symbol)       {return (void *)symbol;}
    62 void *search_constant_type_c::visit(integer_c *symbol)        {return (void *)symbol;}
    63 void *search_constant_type_c::visit(integer_c *symbol)        {return (void *)symbol;}
       
    64 void *search_constant_type_c::visit(neg_integer_c *symbol)    {return (void *)symbol;}
    63 void *search_constant_type_c::visit(binary_integer_c *symbol) {return (void *)symbol;}
    65 void *search_constant_type_c::visit(binary_integer_c *symbol) {return (void *)symbol;}
    64 void *search_constant_type_c::visit(octal_integer_c *symbol)  {return (void *)symbol;}
    66 void *search_constant_type_c::visit(octal_integer_c *symbol)  {return (void *)symbol;}
    65 void *search_constant_type_c::visit(hex_integer_c *symbol)    {return (void *)symbol;}
    67 void *search_constant_type_c::visit(hex_integer_c *symbol)    {return (void *)symbol;}
    66 
    68 
    67 void *search_constant_type_c::visit(integer_literal_c *symbol)
    69 void *search_constant_type_c::visit(integer_literal_c *symbol)
    88 /***************************/
    90 /***************************/
    89 /************************/
    91 /************************/
    90 /* B 1.2.3.1 - Duration */
    92 /* B 1.2.3.1 - Duration */
    91 /************************/
    93 /************************/
    92 void *search_constant_type_c::visit(neg_time_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    94 void *search_constant_type_c::visit(neg_time_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    93 void *search_constant_type_c::visit(duration_c *symbol) {return (void *)&time_type_name;}
    95 void *search_constant_type_c::visit(duration_c *symbol) {return (void *)(symbol->type_name);}
    94 void *search_constant_type_c::visit(fixed_point_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    96 void *search_constant_type_c::visit(fixed_point_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    95 void *search_constant_type_c::visit(days_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    97 void *search_constant_type_c::visit(days_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    96 void *search_constant_type_c::visit(hours_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    98 void *search_constant_type_c::visit(hours_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    97 void *search_constant_type_c::visit(minutes_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    99 void *search_constant_type_c::visit(minutes_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    98 void *search_constant_type_c::visit(seconds_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   100 void *search_constant_type_c::visit(seconds_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
    99 void *search_constant_type_c::visit(milliseconds_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   101 void *search_constant_type_c::visit(milliseconds_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   100 
   102 
   101 /************************************/
   103 /************************************/
   102 /* B 1.2.3.2 - Time of day and Date */
   104 /* B 1.2.3.2 - Time of day and Date */
   103 /************************************/
   105 /************************************/
   104 void *search_constant_type_c::visit(time_of_day_c *symbol) {return (void *)&tod_type_name;}
   106 void *search_constant_type_c::visit(time_of_day_c *symbol) {return (void *)(symbol->type_name);}
   105 void *search_constant_type_c::visit(daytime_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   107 void *search_constant_type_c::visit(daytime_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   106 void *search_constant_type_c::visit(date_c *symbol) {return (void *)&date_type_name;}
   108 void *search_constant_type_c::visit(date_c *symbol) {return (void *)(symbol->type_name);}
   107 void *search_constant_type_c::visit(date_literal_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   109 void *search_constant_type_c::visit(date_literal_c *symbol) {ERROR; return NULL;}  /* this member function should never be called. */
   108 void *search_constant_type_c::visit(date_and_time_c *symbol) {return (void *)&dt_type_name;}
   110 void *search_constant_type_c::visit(date_and_time_c *symbol) {return (void *)(symbol->type_name);}
       
   111 
   109 
   112 
   110 real_type_name_c     search_constant_type_c::real_type_name;
   113 real_type_name_c     search_constant_type_c::real_type_name;
   111 sint_type_name_c     search_constant_type_c::sint_type_name;
   114 sint_type_name_c     search_constant_type_c::sint_type_name;
   112 lint_type_name_c     search_constant_type_c::lint_type_name;
   115 lint_type_name_c     search_constant_type_c::lint_type_name;
   113 dint_type_name_c     search_constant_type_c::dint_type_name;
   116 dint_type_name_c     search_constant_type_c::dint_type_name;
   127 ulint_type_name_c    search_constant_type_c::ulint_type_name;
   130 ulint_type_name_c    search_constant_type_c::ulint_type_name;
   128 bool_type_name_c     search_constant_type_c::bool_type_name;
   131 bool_type_name_c     search_constant_type_c::bool_type_name;
   129 time_type_name_c     search_constant_type_c::time_type_name;
   132 time_type_name_c     search_constant_type_c::time_type_name;
   130 int_type_name_c      search_constant_type_c::int_type_name;
   133 int_type_name_c      search_constant_type_c::int_type_name;
   131 
   134 
   132 /*
   135 // safebool_type_name_c    search_constant_type_c::safebool_type_name;
   133 constant_real_type_name_c     search_constant_type_c::constant_real_type_name;
   136   /* The following is required because the expression (TOD_var - TOD_var) will result in a data type
   134 constant_int_type_name_c      search_constant_type_c::constant_int_type_name;
   137    *  (in this case, TIME) that is neither of the expression elements...
   135 */
   138    */
       
   139 safetime_type_name_c     search_constant_type_c::safetime_type_name;
       
   140 safetod_type_name_c      search_constant_type_c::safetod_type_name;
       
   141 safedt_type_name_c       search_constant_type_c::safedt_type_name;
       
   142 
       
   143 
       
   144 
   136 /* temporarily here until we remove the st_code_gen.c and il_code_gen.c files... */
   145 /* temporarily here until we remove the st_code_gen.c and il_code_gen.c files... */
   137 /* It should then move to search_expression_type_c                               */
   146 /* It should then move to search_expression_type_c                               */
   138 integer_c search_constant_type_c::integer("1");
   147 integer_c search_constant_type_c::integer("1");