459 } |
459 } |
460 |
460 |
461 |
461 |
462 |
462 |
463 |
463 |
464 /* A helper function... */ |
|
465 bool is_ANY_ELEMENTARY_type(symbol_c *type_symbol) { |
|
466 if (type_symbol == NULL) {return false;} |
|
467 return is_ANY_MAGNITUDE_type(type_symbol) |
|
468 || is_ANY_BIT_type (type_symbol) |
|
469 || is_ANY_STRING_type (type_symbol) |
|
470 || is_ANY_DATE_type (type_symbol); |
|
471 } |
|
472 |
|
473 /* A helper function... */ |
|
474 bool is_ANY_SAFEELEMENTARY_type(symbol_c *type_symbol) { |
|
475 if (type_symbol == NULL) {return false;} |
|
476 return is_ANY_SAFEMAGNITUDE_type(type_symbol) |
|
477 || is_ANY_SAFEBIT_type (type_symbol) |
|
478 || is_ANY_SAFESTRING_type (type_symbol) |
|
479 || is_ANY_SAFEDATE_type (type_symbol); |
|
480 } |
|
481 |
|
482 /* A helper function... */ |
|
483 bool is_ANY_ELEMENTARY_compatible(symbol_c *type_symbol) { |
|
484 if (type_symbol == NULL) {return false;} |
|
485 /* NOTE: doing |
|
486 * return is_ANY_SAFEELEMENTARY_type() || is_ANY_ELEMENTARY_type() |
|
487 * is incorrect, as the literals would never be considered compatible... |
|
488 */ |
|
489 return is_ANY_MAGNITUDE_compatible(type_symbol) |
|
490 || is_ANY_BIT_compatible (type_symbol) |
|
491 || is_ANY_STRING_compatible (type_symbol) |
|
492 || is_ANY_DATE_compatible (type_symbol); |
|
493 } |
|
494 |
|
495 |
|
496 /* A helper function... */ |
|
497 bool is_ANY_MAGNITUDE_type(symbol_c *type_symbol) { |
|
498 if (type_symbol == NULL) {return false;} |
|
499 if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;} |
|
500 return is_ANY_NUM_type(type_symbol); |
|
501 } |
|
502 |
|
503 /* A helper function... */ |
|
504 bool is_ANY_signed_MAGNITUDE_type(symbol_c *type_symbol) { |
|
505 if (type_symbol == NULL) {return false;} |
|
506 if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;} |
|
507 return is_ANY_signed_NUM_type(type_symbol); |
|
508 } |
|
509 |
|
510 /* A helper function... */ |
|
511 bool is_ANY_SAFEMAGNITUDE_type(symbol_c *type_symbol) { |
|
512 if (type_symbol == NULL) {return false;} |
|
513 if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;} |
|
514 return is_ANY_SAFENUM_type(type_symbol); |
|
515 } |
|
516 |
|
517 /* A helper function... */ |
|
518 bool is_ANY_signed_SAFEMAGNITUDE_type(symbol_c *type_symbol) { |
|
519 if (type_symbol == NULL) {return false;} |
|
520 if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;} |
|
521 return is_ANY_signed_SAFENUM_type(type_symbol); |
|
522 } |
|
523 |
|
524 /* A helper function... */ |
|
525 bool is_ANY_MAGNITUDE_compatible(symbol_c *type_symbol) { |
|
526 if (type_symbol == NULL) {return false;} |
|
527 if (is_ANY_MAGNITUDE_type (type_symbol)) {return true;} |
|
528 if (is_ANY_SAFEMAGNITUDE_type(type_symbol)) {return true;} |
|
529 return is_ANY_NUM_compatible(type_symbol); |
|
530 } |
|
531 |
|
532 /* A helper function... */ |
|
533 bool is_ANY_signed_MAGNITUDE_compatible(symbol_c *type_symbol) { |
|
534 if (type_symbol == NULL) {return false;} |
|
535 if (is_ANY_signed_MAGNITUDE_type (type_symbol)) {return true;} |
|
536 if (is_ANY_signed_SAFEMAGNITUDE_type(type_symbol)) {return true;} |
|
537 return is_ANY_signed_NUM_compatible(type_symbol); |
|
538 } |
|
539 |
|
540 /* A helper function... */ |
|
541 bool is_ANY_NUM_type(symbol_c *type_symbol) { |
|
542 if (type_symbol == NULL) {return false;} |
|
543 if (is_ANY_REAL_type(type_symbol)) {return true;} |
|
544 if (is_ANY_INT_type(type_symbol)) {return true;} |
|
545 return false; |
|
546 } |
|
547 |
|
548 /* A helper function... */ |
|
549 bool is_ANY_signed_NUM_type(symbol_c *type_symbol) { |
|
550 if (type_symbol == NULL) {return false;} |
|
551 if (is_ANY_REAL_type(type_symbol)) {return true;} |
|
552 if (is_ANY_signed_INT_type(type_symbol)) {return true;} |
|
553 return false; |
|
554 } |
|
555 |
|
556 /* A helper function... */ |
|
557 bool is_ANY_SAFENUM_type(symbol_c *type_symbol) { |
|
558 if (type_symbol == NULL) {return false;} |
|
559 return is_ANY_SAFEREAL_type(type_symbol) |
|
560 || is_ANY_SAFEINT_type (type_symbol); |
|
561 } |
|
562 |
|
563 /* A helper function... */ |
|
564 bool is_ANY_signed_SAFENUM_type(symbol_c *type_symbol) { |
|
565 if (type_symbol == NULL) {return false;} |
|
566 return is_ANY_SAFEREAL_type(type_symbol) |
|
567 || is_ANY_signed_SAFEINT_type (type_symbol); |
|
568 } |
|
569 |
|
570 /* A helper function... */ |
|
571 bool is_ANY_NUM_compatible(symbol_c *type_symbol) { |
|
572 if (type_symbol == NULL) {return false;} |
|
573 if (is_ANY_REAL_compatible(type_symbol)) {return true;} |
|
574 if (is_ANY_INT_compatible(type_symbol)) {return true;} |
|
575 return false; |
|
576 } |
|
577 |
|
578 /* A helper function... */ |
|
579 bool is_ANY_signed_NUM_compatible(symbol_c *type_symbol) { |
|
580 if (type_symbol == NULL) {return false;} |
|
581 if (is_ANY_REAL_compatible(type_symbol)) {return true;} |
|
582 if (is_ANY_signed_INT_compatible(type_symbol)) {return true;} |
|
583 return false; |
|
584 } |
|
585 |
|
586 /* A helper function... */ |
|
587 bool is_ANY_DATE_type(symbol_c *type_symbol) { |
|
588 if (type_symbol == NULL) {return false;} |
|
589 if (typeid(*type_symbol) == typeid(date_type_name_c)) {return true;} |
|
590 if (typeid(*type_symbol) == typeid(tod_type_name_c)) {return true;} |
|
591 if (typeid(*type_symbol) == typeid(dt_type_name_c)) {return true;} |
|
592 return false; |
|
593 } |
|
594 |
|
595 /* A helper function... */ |
|
596 bool is_ANY_SAFEDATE_type(symbol_c *type_symbol) { |
|
597 if (type_symbol == NULL) {return false;} |
|
598 if (typeid(*type_symbol) == typeid(safedate_type_name_c)) {return true;} |
|
599 if (typeid(*type_symbol) == typeid(safetod_type_name_c)) {return true;} |
|
600 if (typeid(*type_symbol) == typeid(safedt_type_name_c)) {return true;} |
|
601 return false; |
|
602 } |
|
603 |
|
604 /* A helper function... */ |
|
605 bool is_ANY_DATE_compatible(symbol_c *type_symbol) { |
|
606 if (type_symbol == NULL) {return false;} |
|
607 if (is_ANY_DATE_type (type_symbol)) {return true;} |
|
608 if (is_ANY_SAFEDATE_type(type_symbol)) {return true;} |
|
609 return false; |
|
610 } |
|
611 |
|
612 /* A helper function... */ |
|
613 bool is_ANY_STRING_type(symbol_c *type_symbol) { |
|
614 if (type_symbol == NULL) {return false;} |
|
615 if (typeid(*type_symbol) == typeid(string_type_name_c)) {return true;} |
|
616 if (typeid(*type_symbol) == typeid(wstring_type_name_c)) {return true;} |
|
617 return false; |
|
618 } |
|
619 |
|
620 /* A helper function... */ |
|
621 bool is_ANY_SAFESTRING_type(symbol_c *type_symbol) { |
|
622 if (type_symbol == NULL) {return false;} |
|
623 if (typeid(*type_symbol) == typeid(safestring_type_name_c)) {return true;} |
|
624 if (typeid(*type_symbol) == typeid(safewstring_type_name_c)) {return true;} |
|
625 return false; |
|
626 } |
|
627 |
|
628 /* A helper function... */ |
|
629 bool is_ANY_STRING_compatible(symbol_c *type_symbol) { |
|
630 if (type_symbol == NULL) {return false;} |
|
631 if (is_ANY_STRING_type (type_symbol)) {return true;} |
|
632 if (is_ANY_SAFESTRING_type(type_symbol)) {return true;} |
|
633 return false; |
|
634 } |
|
635 |
|
636 /* A helper function... */ |
|
637 bool is_ANY_INT_type(symbol_c *type_symbol) { |
|
638 if (type_symbol == NULL) {return false;} |
|
639 if (typeid(*type_symbol) == typeid(sint_type_name_c)) {return true;} |
|
640 if (typeid(*type_symbol) == typeid(int_type_name_c)) {return true;} |
|
641 if (typeid(*type_symbol) == typeid(dint_type_name_c)) {return true;} |
|
642 if (typeid(*type_symbol) == typeid(lint_type_name_c)) {return true;} |
|
643 if (typeid(*type_symbol) == typeid(usint_type_name_c)) {return true;} |
|
644 if (typeid(*type_symbol) == typeid(uint_type_name_c)) {return true;} |
|
645 if (typeid(*type_symbol) == typeid(udint_type_name_c)) {return true;} |
|
646 if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;} |
|
647 return false; |
|
648 } |
|
649 |
|
650 /* A helper function... */ |
|
651 bool is_ANY_signed_INT_type(symbol_c *type_symbol) { |
|
652 if (type_symbol == NULL) {return false;} |
|
653 if (typeid(*type_symbol) == typeid(sint_type_name_c)) {return true;} |
|
654 if (typeid(*type_symbol) == typeid(int_type_name_c)) {return true;} |
|
655 if (typeid(*type_symbol) == typeid(dint_type_name_c)) {return true;} |
|
656 if (typeid(*type_symbol) == typeid(lint_type_name_c)) {return true;} |
|
657 return false; |
|
658 } |
|
659 |
|
660 /* A helper function... */ |
|
661 bool is_ANY_signed_SAFEINT_type(symbol_c *type_symbol) { |
|
662 if (type_symbol == NULL) {return false;} |
|
663 if (typeid(*type_symbol) == typeid(safesint_type_name_c)) {return true;} |
|
664 if (typeid(*type_symbol) == typeid(safeint_type_name_c)) {return true;} |
|
665 if (typeid(*type_symbol) == typeid(safedint_type_name_c)) {return true;} |
|
666 if (typeid(*type_symbol) == typeid(safelint_type_name_c)) {return true;} |
|
667 return false; |
|
668 } |
|
669 |
|
670 /* A helper function... */ |
|
671 bool is_ANY_SAFEINT_type(symbol_c *type_symbol) { |
|
672 if (type_symbol == NULL) {return false;} |
|
673 if (typeid(*type_symbol) == typeid(safesint_type_name_c)) {return true;} |
|
674 if (typeid(*type_symbol) == typeid(safeint_type_name_c)) {return true;} |
|
675 if (typeid(*type_symbol) == typeid(safedint_type_name_c)) {return true;} |
|
676 if (typeid(*type_symbol) == typeid(safelint_type_name_c)) {return true;} |
|
677 if (typeid(*type_symbol) == typeid(safeusint_type_name_c)) {return true;} |
|
678 if (typeid(*type_symbol) == typeid(safeuint_type_name_c)) {return true;} |
|
679 if (typeid(*type_symbol) == typeid(safeudint_type_name_c)) {return true;} |
|
680 if (typeid(*type_symbol) == typeid(safeulint_type_name_c)) {return true;} |
|
681 return false; |
|
682 } |
|
683 |
|
684 /* A helper function... */ |
|
685 bool is_ANY_signed_INT_compatible(symbol_c *type_symbol) { |
|
686 if (type_symbol == NULL) {return false;} |
|
687 if (is_ANY_signed_INT_type (type_symbol)) {return true;} |
|
688 if (is_ANY_signed_SAFEINT_type(type_symbol)) {return true;} |
|
689 return false; |
|
690 } |
|
691 |
|
692 /* A helper function... */ |
|
693 bool is_ANY_INT_compatible(symbol_c *type_symbol) { |
|
694 if (type_symbol == NULL) {return false;} |
|
695 if (is_ANY_INT_type (type_symbol)) {return true;} |
|
696 if (is_ANY_SAFEINT_type(type_symbol)) {return true;} |
|
697 return false; |
|
698 } |
|
699 |
|
700 /* A helper function... */ |
|
701 bool is_ANY_REAL_type(symbol_c *type_symbol) { |
|
702 if (type_symbol == NULL) {return false;} |
|
703 if (typeid(*type_symbol) == typeid(real_type_name_c)) {return true;} |
|
704 if (typeid(*type_symbol) == typeid(lreal_type_name_c)) {return true;} |
|
705 return false; |
|
706 } |
|
707 |
|
708 /* A helper function... */ |
|
709 bool is_ANY_SAFEREAL_type(symbol_c *type_symbol) { |
|
710 if (type_symbol == NULL) {return false;} |
|
711 if (typeid(*type_symbol) == typeid(safereal_type_name_c)) {return true;} |
|
712 if (typeid(*type_symbol) == typeid(safelreal_type_name_c)) {return true;} |
|
713 return false; |
|
714 } |
|
715 |
|
716 /* A helper function... */ |
|
717 bool is_ANY_REAL_compatible(symbol_c *type_symbol) { |
|
718 if (type_symbol == NULL) {return false;} |
|
719 if (is_ANY_REAL_type (type_symbol)) {return true;} |
|
720 if (is_ANY_SAFEREAL_type(type_symbol)) {return true;} |
|
721 return false; |
|
722 } |
|
723 |
|
724 /* A helper function... */ |
|
725 bool is_ANY_BIT_type(symbol_c *type_symbol) { |
|
726 if (type_symbol == NULL) {return false;} |
|
727 if (typeid(*type_symbol) == typeid(bool_type_name_c)) {return true;} |
|
728 if (typeid(*type_symbol) == typeid(byte_type_name_c)) {return true;} |
|
729 if (typeid(*type_symbol) == typeid(word_type_name_c)) {return true;} |
|
730 if (typeid(*type_symbol) == typeid(dword_type_name_c)) {return true;} |
|
731 if (typeid(*type_symbol) == typeid(lword_type_name_c)) {return true;} |
|
732 return false; |
|
733 } |
|
734 |
|
735 /* A helper function... */ |
|
736 bool is_ANY_SAFEBIT_type(symbol_c *type_symbol) { |
|
737 if (type_symbol == NULL) {return false;} |
|
738 if (typeid(*type_symbol) == typeid(safebool_type_name_c)) {return true;} |
|
739 if (typeid(*type_symbol) == typeid(safebyte_type_name_c)) {return true;} |
|
740 if (typeid(*type_symbol) == typeid(safeword_type_name_c)) {return true;} |
|
741 if (typeid(*type_symbol) == typeid(safedword_type_name_c)) {return true;} |
|
742 if (typeid(*type_symbol) == typeid(safelword_type_name_c)) {return true;} |
|
743 return false; |
|
744 } |
|
745 |
|
746 /* A helper function... */ |
|
747 bool is_ANY_BIT_compatible(symbol_c *type_symbol) { |
|
748 if (type_symbol == NULL) {return false;} |
|
749 if (is_ANY_BIT_type (type_symbol)) {return true;} |
|
750 if (is_ANY_SAFEBIT_type(type_symbol)) {return true;} |
|
751 return false; |
|
752 } |
|
753 |
|
754 /* A helper function... */ |
|
755 bool is_BOOL_type(symbol_c *type_symbol) { |
|
756 if (type_symbol == NULL) {return false;} |
|
757 if (typeid(*type_symbol) == typeid(bool_type_name_c)) {return true;} |
|
758 return false; |
|
759 } |
|
760 |
|
761 /* A helper function... */ |
|
762 bool is_SAFEBOOL_type(symbol_c *type_symbol){ |
|
763 if (type_symbol == NULL) {return false;} |
|
764 if (typeid(*type_symbol) == typeid(safebool_type_name_c)) {return true;} |
|
765 return false; |
|
766 } |
|
767 |
|
768 /* A helper function... */ |
|
769 bool is_ANY_BOOL_compatible(symbol_c *type_symbol) { |
|
770 if (type_symbol == NULL) {return false;} |
|
771 if (is_BOOL_type (type_symbol)) {return true;} |
|
772 if (is_SAFEBOOL_type(type_symbol)) {return true;} |
|
773 return false; |
|
774 } |
|
775 |
|
776 |
|
777 |
464 |
778 |
465 |
779 |
466 |
780 bool is_type_equal(symbol_c *first_type, symbol_c *second_type) { |
467 bool is_type_equal(symbol_c *first_type, symbol_c *second_type) { |
781 if ((NULL == first_type) || (NULL == second_type)) |
468 if ((NULL == first_type) || (NULL == second_type)) |