absyntax_utils/get_datatype_info.cc
changeset 676 ca4f17211251
parent 668 90b6eb7f1775
child 693 51a2fa6441b9
--- a/absyntax_utils/get_datatype_info.cc	Thu Oct 11 19:16:35 2012 +0100
+++ b/absyntax_utils/get_datatype_info.cc	Sat Oct 13 12:13:49 2012 +0100
@@ -3,6 +3,7 @@
  *
  *  Copyright (C) 2003-2012  Mario de Sousa (msousa@fe.up.pt)
  *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *  Copyright (C) 2012       Manuele Conti  (conti.ma@alice.it)
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -58,6 +59,40 @@
 
 
 
+
+bool get_datatype_info_c::is_type_equal(symbol_c *first_type, symbol_c *second_type) {
+  if ((NULL == first_type) || (NULL == second_type))
+      return false;
+  if (typeid(* first_type) == typeid(invalid_type_name_c))
+      return false;
+  if (typeid(*second_type) == typeid(invalid_type_name_c))
+      return false;
+    
+  if (get_datatype_info_c::is_ANY_ELEMENTARY(first_type)) {
+      if (typeid(*first_type) == typeid(*second_type))
+          return true;
+  } else   /* ANY_DERIVED */
+      return (first_type == second_type);
+
+  return false;
+}
+
+
+
+bool get_datatype_info_c::is_type_valid(symbol_c *type) {
+  if (NULL == type)
+      return false;
+  if (typeid(*type) == typeid(invalid_type_name_c))
+      return false;
+
+  return true;
+}
+
+
+
+
+
+
 bool get_datatype_info_c::is_sfc_initstep(symbol_c *type_symbol) {
   symbol_c *type_decl = search_base_type.get_basetype_decl(type_symbol); 
   if (typeid(*type_decl) == typeid(initial_step_c))                  {return true;}   /* INITIAL_STEP step_name ':' action_association_list END_STEP */  /* A pseudo data type! */
@@ -259,6 +294,7 @@
   if (type_symbol == NULL)                                     {return false;}
   if (is_ANY_SAFEREAL(type_symbol))                            {return true;}
   if (is_ANY_SAFEINT (type_symbol))                            {return true;}
+  return false;
 }
 
 
@@ -287,6 +323,7 @@
   if (type_symbol == NULL)                                     {return false;}
   if (is_ANY_SAFEREAL      (type_symbol))                      {return true;}
   if (is_ANY_signed_SAFEINT(type_symbol))                      {return true;}
+  return false;
 }