stage3/datatype_functions.cc
changeset 435 82cb6a64a763
parent 434 c1278e52bcbc
child 436 f9fd63f64f5c
equal deleted inserted replaced
434:c1278e52bcbc 435:82cb6a64a763
   218   if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
   218   if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
   219   return is_ANY_NUM_type(type_symbol);
   219   return is_ANY_NUM_type(type_symbol);
   220 }
   220 }
   221 
   221 
   222 /* A helper function... */
   222 /* A helper function... */
       
   223 bool is_ANY_signed_MAGNITUDE_type(symbol_c *type_symbol) {
       
   224   if (type_symbol == NULL) {return false;}
       
   225   if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
       
   226   return is_ANY_signed_NUM_type(type_symbol);
       
   227 }
       
   228 
       
   229 /* A helper function... */
   223 bool is_ANY_SAFEMAGNITUDE_type(symbol_c *type_symbol) {
   230 bool is_ANY_SAFEMAGNITUDE_type(symbol_c *type_symbol) {
   224   if (type_symbol == NULL) {return false;}
   231   if (type_symbol == NULL) {return false;}
   225   if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;}
   232   if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;}
   226   return is_ANY_SAFENUM_type(type_symbol);
   233   return is_ANY_SAFENUM_type(type_symbol);
   227 }
   234 }
   228 
   235 
   229 /* A helper function... */
   236 /* A helper function... */
       
   237 bool is_ANY_signed_SAFEMAGNITUDE_type(symbol_c *type_symbol) {
       
   238   if (type_symbol == NULL) {return false;}
       
   239   if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;}
       
   240   return is_ANY_signed_SAFENUM_type(type_symbol);
       
   241 }
       
   242 
       
   243 /* A helper function... */
   230 bool is_ANY_MAGNITUDE_compatible(symbol_c *type_symbol) {
   244 bool is_ANY_MAGNITUDE_compatible(symbol_c *type_symbol) {
   231   if (type_symbol == NULL) {return false;}
   245   if (type_symbol == NULL) {return false;}
   232   if (is_ANY_MAGNITUDE_type    (type_symbol))              {return true;}
   246   if (is_ANY_MAGNITUDE_type    (type_symbol))              {return true;}
   233   if (is_ANY_SAFEMAGNITUDE_type(type_symbol))              {return true;}
   247   if (is_ANY_SAFEMAGNITUDE_type(type_symbol))              {return true;}
   234 
       
   235   return is_ANY_NUM_compatible(type_symbol);
   248   return is_ANY_NUM_compatible(type_symbol);
       
   249 }
       
   250 
       
   251 /* A helper function... */
       
   252 bool is_ANY_signed_MAGNITUDE_compatible(symbol_c *type_symbol) {
       
   253   if (type_symbol == NULL) {return false;}
       
   254   if (is_ANY_signed_MAGNITUDE_type    (type_symbol))       {return true;}
       
   255   if (is_ANY_signed_SAFEMAGNITUDE_type(type_symbol))       {return true;}
       
   256   return is_ANY_signed_NUM_compatible(type_symbol);
   236 }
   257 }
   237 
   258 
   238 /* A helper function... */
   259 /* A helper function... */
   239 bool is_ANY_NUM_type(symbol_c *type_symbol) {
   260 bool is_ANY_NUM_type(symbol_c *type_symbol) {
   240   if (type_symbol == NULL) {return false;}
   261   if (type_symbol == NULL) {return false;}
   242   if (is_ANY_INT_type(type_symbol))                        {return true;}
   263   if (is_ANY_INT_type(type_symbol))                        {return true;}
   243   return false;
   264   return false;
   244 }
   265 }
   245 
   266 
   246 /* A helper function... */
   267 /* A helper function... */
       
   268 bool is_ANY_signed_NUM_type(symbol_c *type_symbol) {
       
   269   if (type_symbol == NULL) {return false;}
       
   270   if (is_ANY_REAL_type(type_symbol))                       {return true;}
       
   271   if (is_ANY_signed_INT_type(type_symbol))                 {return true;}
       
   272   return false;
       
   273 }
       
   274 
       
   275 /* A helper function... */
   247 bool is_ANY_SAFENUM_type(symbol_c *type_symbol) {
   276 bool is_ANY_SAFENUM_type(symbol_c *type_symbol) {
   248   if (type_symbol == NULL) {return false;}
   277   if (type_symbol == NULL) {return false;}
   249   return is_ANY_SAFEREAL_type(type_symbol)
   278   return is_ANY_SAFEREAL_type(type_symbol)
   250       || is_ANY_SAFEINT_type (type_symbol);
   279       || is_ANY_SAFEINT_type (type_symbol);
   251 }
   280 }
   252 
   281 
   253 /* A helper function... */
   282 /* A helper function... */
       
   283 bool is_ANY_signed_SAFENUM_type(symbol_c *type_symbol) {
       
   284   if (type_symbol == NULL) {return false;}
       
   285   return is_ANY_SAFEREAL_type(type_symbol)
       
   286       || is_ANY_signed_SAFEINT_type (type_symbol);
       
   287 }
       
   288 
       
   289 /* A helper function... */
   254 bool is_ANY_NUM_compatible(symbol_c *type_symbol) {
   290 bool is_ANY_NUM_compatible(symbol_c *type_symbol) {
   255   if (type_symbol == NULL) {return false;}
   291   if (type_symbol == NULL) {return false;}
   256   if (is_ANY_REAL_compatible(type_symbol))                       {return true;}
   292   if (is_ANY_REAL_compatible(type_symbol))                       {return true;}
   257   if (is_ANY_INT_compatible(type_symbol))                        {return true;}
   293   if (is_ANY_INT_compatible(type_symbol))                        {return true;}
       
   294   return false;
       
   295 }
       
   296 
       
   297 /* A helper function... */
       
   298 bool is_ANY_signed_NUM_compatible(symbol_c *type_symbol) {
       
   299   if (type_symbol == NULL) {return false;}
       
   300   if (is_ANY_REAL_compatible(type_symbol))                       {return true;}
       
   301   if (is_ANY_signed_INT_compatible(type_symbol))                 {return true;}
   258   return false;
   302   return false;
   259 }
   303 }
   260 
   304 
   261 /* A helper function... */
   305 /* A helper function... */
   262 bool is_ANY_DATE_type(symbol_c *type_symbol) {
   306 bool is_ANY_DATE_type(symbol_c *type_symbol) {
   322   if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;}
   366   if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;}
   323   return false;
   367   return false;
   324 }
   368 }
   325 
   369 
   326 /* A helper function... */
   370 /* A helper function... */
       
   371 bool is_ANY_signed_INT_type(symbol_c *type_symbol) {
       
   372   if (type_symbol == NULL) {return false;}
       
   373   if (typeid(*type_symbol) == typeid(sint_type_name_c))  {return true;}
       
   374   if (typeid(*type_symbol) == typeid(int_type_name_c))   {return true;}
       
   375   if (typeid(*type_symbol) == typeid(dint_type_name_c))  {return true;}
       
   376   if (typeid(*type_symbol) == typeid(lint_type_name_c))  {return true;}
       
   377   return false;
       
   378 }
       
   379 
       
   380 /* A helper function... */
       
   381 bool is_ANY_signed_SAFEINT_type(symbol_c *type_symbol) {
       
   382   if (type_symbol == NULL) {return false;}
       
   383   if (typeid(*type_symbol) == typeid(safesint_type_name_c))  {return true;}
       
   384   if (typeid(*type_symbol) == typeid(safeint_type_name_c))   {return true;}
       
   385   if (typeid(*type_symbol) == typeid(safedint_type_name_c))  {return true;}
       
   386   if (typeid(*type_symbol) == typeid(safelint_type_name_c))  {return true;}
       
   387   return false;
       
   388 }
       
   389 
       
   390 /* A helper function... */
   327 bool is_ANY_SAFEINT_type(symbol_c *type_symbol) {
   391 bool is_ANY_SAFEINT_type(symbol_c *type_symbol) {
   328   if (type_symbol == NULL) {return false;}
   392   if (type_symbol == NULL) {return false;}
   329   if (typeid(*type_symbol) == typeid(safesint_type_name_c))  {return true;}
   393   if (typeid(*type_symbol) == typeid(safesint_type_name_c))  {return true;}
   330   if (typeid(*type_symbol) == typeid(safeint_type_name_c))   {return true;}
   394   if (typeid(*type_symbol) == typeid(safeint_type_name_c))   {return true;}
   331   if (typeid(*type_symbol) == typeid(safedint_type_name_c))  {return true;}
   395   if (typeid(*type_symbol) == typeid(safedint_type_name_c))  {return true;}
   332   if (typeid(*type_symbol) == typeid(safelint_type_name_c))  {return true;}
   396   if (typeid(*type_symbol) == typeid(safelint_type_name_c))  {return true;}
   333   if (typeid(*type_symbol) == typeid(safeusint_type_name_c)) {return true;}
   397   if (typeid(*type_symbol) == typeid(safeusint_type_name_c)) {return true;}
   334   if (typeid(*type_symbol) == typeid(safeuint_type_name_c))  {return true;}
   398   if (typeid(*type_symbol) == typeid(safeuint_type_name_c))  {return true;}
   335   if (typeid(*type_symbol) == typeid(safeudint_type_name_c)) {return true;}
   399   if (typeid(*type_symbol) == typeid(safeudint_type_name_c)) {return true;}
   336   if (typeid(*type_symbol) == typeid(safeulint_type_name_c)) {return true;}
   400   if (typeid(*type_symbol) == typeid(safeulint_type_name_c)) {return true;}
       
   401   return false;
       
   402 }
       
   403 
       
   404 /* A helper function... */
       
   405 bool is_ANY_signed_INT_compatible(symbol_c *type_symbol) {
       
   406   if (type_symbol == NULL) {return false;}
       
   407   if (is_ANY_signed_INT_type    (type_symbol))              {return true;}
       
   408   if (is_ANY_signed_SAFEINT_type(type_symbol))              {return true;}
       
   409 //   if (is_literal_integer_type(type_symbol))          {return true;}
   337   return false;
   410   return false;
   338 }
   411 }
   339 
   412 
   340 /* A helper function... */
   413 /* A helper function... */
   341 bool is_ANY_INT_compatible(symbol_c *type_symbol) {
   414 bool is_ANY_INT_compatible(symbol_c *type_symbol) {