stage3/datatype_functions.cc
changeset 481 16f943328696
parent 480 8a58d7b8b26c
child 483 7f839fb100c1
equal deleted inserted replaced
480:8a58d7b8b26c 481:16f943328696
    51 /* copied from matiec/lib/create_standard_functions_txt.sh */
    51 /* copied from matiec/lib/create_standard_functions_txt.sh */
    52 #define __ANY(DO)                 __ANY_DERIVED(DO) __ANY_ELEMENTARY(DO)
    52 #define __ANY(DO)                 __ANY_DERIVED(DO) __ANY_ELEMENTARY(DO)
    53 #define __ANY_DERIVED(DO)
    53 #define __ANY_DERIVED(DO)
    54 #define __ANY_ELEMENTARY(DO)      __ANY_MAGNITUDE(DO) __ANY_BIT(DO) __ANY_STRING(DO) __ANY_DATE(DO)
    54 #define __ANY_ELEMENTARY(DO)      __ANY_MAGNITUDE(DO) __ANY_BIT(DO) __ANY_STRING(DO) __ANY_DATE(DO)
    55 #define __ANY_MAGNITUDE(DO)       __ANY_NUM(DO) DO(TIME)
    55 #define __ANY_MAGNITUDE(DO)       __ANY_NUM(DO) DO(TIME)
    56 #define __ANY_BIT(DO)             __ANY_NBIT(DO) DO(BOOL)
    56 #define __ANY_BIT(DO)             __ANY_NBIT(DO) DO(bool)
    57 #define __ANY_NBIT(DO)            DO(byte) DO(word) DO(dword) DO(lword)
    57 #define __ANY_NBIT(DO)            DO(byte) DO(word) DO(dword) DO(lword)
    58 //#define __ANY_STRING(DO)          DO(string) DO(wstring)
    58 //#define __ANY_STRING(DO)          DO(string) DO(wstring)
    59 #define __ANY_STRING(DO)          DO(string)
    59 #define __ANY_STRING(DO)          DO(string)
    60 #define __ANY_DATE(DO)            DO(date) DO(tod) DO(dt)
    60 #define __ANY_DATE(DO)            DO(date) DO(tod) DO(dt)
    61 #define __ANY_NUM(DO)             __ANY_REAL(DO) __ANY_INT(DO)
    61 #define __ANY_NUM(DO)             __ANY_REAL(DO) __ANY_INT(DO)
   292 
   292 
   293     { NULL, NULL, NULL, widen_entry::ok },
   293     { NULL, NULL, NULL, widen_entry::ok },
   294 };
   294 };
   295  
   295  
   296  
   296  
   297  
   297 
   298  
   298 
       
   299 /**************************************************************/
       
   300 /**************************************************************/
       
   301 /**************************************************************/
       
   302 /*******                                                *******/
       
   303 /*******  TABLE 26: Standard bitwise Boolean functions  *******/
       
   304 /*******                                                *******/
       
   305 /**************************************************************/
       
   306 /**************************************************************/
       
   307 /**************************************************************/
       
   308 
       
   309 const struct widen_entry widen_AND_table[] = {
       
   310 #define __and(TYPE)       \
       
   311     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   312     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   313     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   314     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok     },
       
   315     __ANY_BIT(__and)
       
   316 #undef __and
       
   317 
       
   318     { NULL, NULL, NULL, widen_entry::ok },
       
   319 };
       
   320 
       
   321 
       
   322 const struct widen_entry widen_OR_table[] = {
       
   323 #define __or(TYPE)       \
       
   324     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   325     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   326     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   327     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok     },
       
   328     __ANY_BIT(__or)
       
   329 #undef __or
       
   330 
       
   331     { NULL, NULL, NULL, widen_entry::ok },
       
   332 };
       
   333 
       
   334 
       
   335 
       
   336 const struct widen_entry widen_XOR_table[] = {
       
   337 #define __xor(TYPE)       \
       
   338     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   339     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   340     { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
       
   341     { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok     },
       
   342     __ANY_BIT(__xor)
       
   343 #undef __xor
       
   344 
       
   345     { NULL, NULL, NULL, widen_entry::ok },
       
   346 };
       
   347 
       
   348 
       
   349 
   299 /* Search for a datatype inside a candidate_datatypes list.
   350 /* Search for a datatype inside a candidate_datatypes list.
   300  * Returns: position of datatype in the list, or -1 if not found.
   351  * Returns: position of datatype in the list, or -1 if not found.
   301  */
   352  */
   302 int search_in_candidate_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes) {
   353 int search_in_candidate_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes) {
   303 	if (NULL == datatype) 
   354 	if (NULL == datatype)