diff -r 82cb6a64a763 -r f9fd63f64f5c stage3/datatype_functions.hh --- a/stage3/datatype_functions.hh Wed Feb 08 18:16:13 2012 +0000 +++ b/stage3/datatype_functions.hh Wed Feb 08 18:27:45 2012 +0000 @@ -30,6 +30,10 @@ +#define is_type(type_name_symbol, type_name_class) ((type_name_symbol == NULL) ? false : (typeid(*type_name_symbol) == typeid(type_name_class))) +#define sizeoftype(symbol) get_sizeof_datatype_c::getsize(symbol) + + /* A small helper class, to transform elementary data type to string. * this allows us to generate more relevant error messages... @@ -95,14 +99,11 @@ void *visit(safestring_type_name_c *symbol) {return (void *)"SAFESTRING"; }; void *visit(safewstring_type_name_c *symbol) {return (void *)"SAFEWSTRING"; }; }; -extern elementary_type_c *elementary_type; -#define is_type(type_name_symbol, type_name_class) ((type_name_symbol == NULL) ? false : (typeid(*type_name_symbol) == typeid(type_name_class))) -#define sizeoftype(symbol) get_sizeof_datatype_c::getsize(symbol) /* Widening Primitive Conversion */ struct widen_entry { @@ -173,32 +174,10 @@ bool is_SAFEBOOL_type (symbol_c *type_symbol); bool is_ANY_BOOL_compatible (symbol_c *type_symbol); -#if 0 -bool is_nonneg_literal_integer_type (symbol_c *type_symbol); -bool is_literal_integer_type (symbol_c *type_symbol); -bool is_literal_real_type (symbol_c *type_symbol); -bool is_literal_bool_type (symbol_c *type_symbol); - -/* Determine the common data type between two data types. - * If no common data type found, return NULL. - * - * If data types are identical, return the first (any would do...). - * If any of the data types is a literal, we confirm that - * the literal uses less bits than the fixed size data type. - * e.g. BYTE and 1024 returns NULL - * BYTE and 255 returns BYTE - * - * If two literals, then return the literal that requires more bits... - */ -symbol_c *common_type(symbol_c *first_type, symbol_c *second_type); -bool is_valid_assignment(symbol_c *var_type, symbol_c *value_type); -bool is_compatible_type(symbol_c *first_type, symbol_c *second_type); -#endif bool is_type_equal(symbol_c *first_type, symbol_c *second_type); // typedef bool (*helper_function_t) (symbol_c *type_symbol); /* a pointer to a function! */ - #endif /* _HELPER_FUNCTIONS_HH_ */