stage3/datatype_functions.cc
author Mario de Sousa <msousa@fe.up.pt>
Thu, 15 Mar 2012 13:18:02 +0000
changeset 490 29f6ab0bf954
parent 484 f78750994a82
child 517 889f4e577964
permissions -rw-r--r--
Add EXPT widen table.
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     1
/*
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     3
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     4
 *  Copyright (C) 2009-2012  Mario de Sousa (msousa@fe.up.pt)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     5
 *  Copyright (C) 2012       Manuele Conti  (conti.ma@alice.it)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     6
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     7
 *  This program is free software: you can redistribute it and/or modify
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     8
 *  it under the terms of the GNU General Public License as published by
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     9
 *  the Free Software Foundation, either version 3 of the License, or
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    10
 *  (at your option) any later version.
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    11
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    12
 *  This program is distributed in the hope that it will be useful,
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    15
 *  GNU General Public License for more details.
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    16
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    17
 *  You should have received a copy of the GNU General Public License
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    19
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    20
 *
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    21
 * This code is made available on the understanding that it will not be
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    22
 * used in safety-critical situations without a full and competent review.
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    23
 */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    24
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    25
#include "datatype_functions.hh"
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    26
#include "../absyntax_utils/absyntax_utils.hh"
457
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
    27
#include <vector>
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
    28
// #include <algorithm>
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    29
434
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    30
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    31
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    32
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    33
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    34
elementary_type_c *elementary_type_c::singleton = NULL;
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    35
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    36
const char *elementary_type_c::to_string(symbol_c *symbol) {
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    37
  if (NULL == singleton)    singleton = new elementary_type_c;
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    38
  if (NULL == singleton)    ERROR;
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    39
  const char *res           = (const char *)symbol->accept(*singleton);
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    40
  if (NULL == res) {
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    41
	  int i = 1;
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    42
  }
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    43
  return res;
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    44
}
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    45
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    46
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    47
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    48
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    49
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    50
/* Macro that expand to subtypes */
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    51
/* copied from matiec/lib/create_standard_functions_txt.sh */
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    52
#define __ANY(DO)                 __ANY_DERIVED(DO) __ANY_ELEMENTARY(DO)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    53
#define __ANY_DERIVED(DO)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    54
#define __ANY_ELEMENTARY(DO)      __ANY_MAGNITUDE(DO) __ANY_BIT(DO) __ANY_STRING(DO) __ANY_DATE(DO)
484
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
    55
#define __ANY_MAGNITUDE(DO)       __ANY_NUM(DO) DO(time)
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
    56
#define __ANY_BIT(DO)             __ANY_NBIT(DO) DO(bool)
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    57
#define __ANY_NBIT(DO)            DO(byte) DO(word) DO(dword) DO(lword)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    58
//#define __ANY_STRING(DO)          DO(string) DO(wstring)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    59
#define __ANY_STRING(DO)          DO(string)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    60
#define __ANY_DATE(DO)            DO(date) DO(tod) DO(dt)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    61
#define __ANY_NUM(DO)             __ANY_REAL(DO) __ANY_INT(DO)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    62
#define __ANY_REAL(DO)            DO(real) DO(lreal)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    63
#define __ANY_INT(DO)             __ANY_SINT(DO) __ANY_UINT(DO)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    64
#define __ANY_SINT(DO)            DO(sint) DO(int) DO(dint) DO(lint)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    65
#define __ANY_UINT(DO)            DO(usint) DO(uint) DO(udint) DO(ulint)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    66
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    67
#define __ANY_1(DO,P1)            __ANY_DERIVED_1(DO,P1) __ANY_ELEMENTARY_1(DO,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    68
#define __ANY_DERIVED_1(DO,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    69
#define __ANY_ELEMENTARY_1(DO,P1) __ANY_MAGNITUDE_1(DO,P1) __ANY_BIT_1(DO,P1) __ANY_STRING_1(DO,P1) __ANY_DATE_1(DO,P1)
484
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
    70
#define __ANY_MAGNITUDE_1(DO,P1)  __ANY_NUM_1(DO,P1) DO(time,P1)
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
    71
#define __ANY_BIT_1(DO,P1)        __ANY_NBIT_1(DO,P1) DO(bool,P1)
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    72
#define __ANY_NBIT_1(DO,P1)       DO(byte,P1) DO(word,P1) DO(dword,P1) DO(lword,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    73
// #define __ANY_STRING_1(DO,P1)     DO(string,P1) DO(wstring,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    74
#define __ANY_STRING_1(DO,P1)     DO(string,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    75
#define __ANY_DATE_1(DO,P1)       DO(date,P1) DO(tod,P1) DO(dt,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    76
#define __ANY_NUM_1(DO,P1)        __ANY_REAL_1(DO,P1) __ANY_INT_1(DO,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    77
#define __ANY_REAL_1(DO,P1)       DO(real,P1) DO(lreal,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    78
#define __ANY_INT_1(DO,P1)        __ANY_SINT_1(DO,P1) __ANY_UINT_1(DO,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    79
#define __ANY_SINT_1(DO,P1)       DO(sint,P1) DO(int,P1) DO(dint,P1) DO(lint,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    80
#define __ANY_UINT_1(DO,P1)       DO(usint,P1) DO(uint,P1) DO(udint,P1) DO(ulint,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    81
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    82
490
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    83
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    84
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    85
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    86
/*******  TABLE 24: Standard arithmetic functions       *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    87
/*******    merged with                                 *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    88
/*******  TABLE 30: Functions of time data types        *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    89
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    90
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    91
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    92
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    93
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    94
const struct widen_entry widen_ADD_table[] = {
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
    95
#define __add(TYPE)       \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
    96
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
    97
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
    98
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
    99
    { &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     },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   100
    __ANY_NUM(__add)
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   101
#undef __add
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   102
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   103
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   104
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   105
    /*** Operations with TIME, DT and TOD... ***/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   106
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   107
    /*******************************************/ 
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   108
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::ok         },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   109
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::time_type_name,            &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   110
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   111
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   112
//  { &search_constant_type_c::time_type_name,          &search_constant_type_c::tod_type_name,             &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   113
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::time_type_name,            &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   114
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   115
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   116
//  { &search_constant_type_c::time_type_name,          &search_constant_type_c::dt_type_name,              &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   117
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   118
    /*******************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   119
    /* SAFE version on the left... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   120
    /*******************************/
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   121
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::ok         },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   122
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::time_type_name,            &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   123
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   124
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   125
//  { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::tod_type_name,             &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   126
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::time_type_name,            &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   127
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   128
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   129
//  { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::dt_type_name,              &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   130
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   131
    /********************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   132
    /* SAFE version on the right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   133
    /********************************/
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   134
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::safetime_type_name,        &search_constant_type_c::time_type_name,     widen_entry::ok         },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   135
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::safetime_type_name,        &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   136
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   137
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   138
//  { &search_constant_type_c::time_type_name,          &search_constant_type_c::safetod_type_name,         &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   139
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::safetime_type_name,        &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   140
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   141
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   142
//  { &search_constant_type_c::time_type_name,          &search_constant_type_c::safedt_type_name,          &search_constant_type_c::dt_type_name,       widen_entry::deprecated },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   143
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   144
    /*************************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   145
    /* SAFE version on left and right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   146
    /*************************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   147
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safetime_type_name, widen_entry::ok         },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   148
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safetod_type_name,  widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   149
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   150
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   151
//  { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safetod_type_name,         &search_constant_type_c::safetod_type_name,  widen_entry::deprecated },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   152
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safedt_type_name,   widen_entry::deprecated },         
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   153
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   154
    /* not currently supported by stage4, so it is best no tto add it for now... */
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   155
//  { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safedt_type_name,          &search_constant_type_c::safedt_type_name,   widen_entry::deprecated },
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   156
   
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   157
    { NULL, NULL, NULL, widen_entry::ok },
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   158
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   159
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   160
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   161
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   162
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   163
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   164
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   165
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   166
const struct widen_entry widen_SUB_table[] = {
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   167
#define __sub(TYPE)       \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   168
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   169
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   170
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   171
    { &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     },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   172
    __ANY_NUM(__sub)
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   173
#undef __sub
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   174
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   175
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   176
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   177
    /*** Operations with TIME, DT and TOD... ***/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   178
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   179
    /*******************************************/ 
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   180
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::ok         },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   181
    { &search_constant_type_c::date_type_name,          &search_constant_type_c::date_type_name,            &search_constant_type_c::time_type_name,     widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   182
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::time_type_name,            &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   183
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::tod_type_name,             &search_constant_type_c::time_type_name,     widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   184
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::time_type_name,            &search_constant_type_c::dt_type_name,       widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   185
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::dt_type_name,              &search_constant_type_c::time_type_name,     widen_entry::deprecated },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   186
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   187
    /*******************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   188
    /* SAFE version on the left... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   189
    /*******************************/
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   190
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::ok         },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   191
    { &search_constant_type_c::safedate_type_name,      &search_constant_type_c::date_type_name,            &search_constant_type_c::time_type_name,     widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   192
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::time_type_name,            &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   193
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::tod_type_name,             &search_constant_type_c::time_type_name,     widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   194
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::time_type_name,            &search_constant_type_c::dt_type_name,       widen_entry::deprecated },
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   195
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::dt_type_name,              &search_constant_type_c::time_type_name,     widen_entry::deprecated },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   196
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   197
    /********************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   198
    /* SAFE version on the right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   199
    /********************************/
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   200
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::safetime_type_name,        &search_constant_type_c::time_type_name,     widen_entry::ok         },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   201
    { &search_constant_type_c::date_type_name,          &search_constant_type_c::safedate_type_name,        &search_constant_type_c::time_type_name,     widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   202
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::safetime_type_name,        &search_constant_type_c::tod_type_name,      widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   203
    { &search_constant_type_c::tod_type_name,           &search_constant_type_c::safetod_type_name,         &search_constant_type_c::time_type_name,     widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   204
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::safetime_type_name,        &search_constant_type_c::dt_type_name,       widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   205
    { &search_constant_type_c::dt_type_name,            &search_constant_type_c::safedt_type_name,          &search_constant_type_c::time_type_name,     widen_entry::deprecated },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   206
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   207
    /*************************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   208
    /* SAFE version on left and right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   209
    /*************************************/
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   210
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safetime_type_name, widen_entry::ok         },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   211
    { &search_constant_type_c::safedate_type_name,      &search_constant_type_c::safedate_type_name,        &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   212
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safetod_type_name,  widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   213
    { &search_constant_type_c::safetod_type_name,       &search_constant_type_c::safetod_type_name,         &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   214
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safedt_type_name,   widen_entry::deprecated },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   215
    { &search_constant_type_c::safedt_type_name,        &search_constant_type_c::safedt_type_name,          &search_constant_type_c::safetime_type_name, widen_entry::deprecated },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   216
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   217
    { NULL, NULL, NULL, widen_entry::ok },
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   218
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   219
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   220
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   221
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   222
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   223
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   224
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   225
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   226
const struct widen_entry widen_MUL_table[] = {
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   227
#define __mul(TYPE)       \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   228
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   229
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   230
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   231
    { &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     },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   232
    __ANY_NUM(__mul)
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   233
#undef __mul
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   234
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   235
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   236
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   237
    /*** Operations with TIME, DT and TOD... ***/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   238
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   239
    /*******************************************/ 
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   240
#define __multime(TYPE)       \
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   241
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   242
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   243
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   244
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safetime_type_name, widen_entry::deprecated }, \
480
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   245
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'multiplication' is supposed to be commutative, we add it anyway... */                 \
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   246
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   247
    { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::time_type_name,            &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   248
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::safetime_type_name,        &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   249
    { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::safetime_type_name,        &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   250
    __ANY_NUM(__multime)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   251
#undef __multime
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   252
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   253
    { NULL, NULL, NULL, widen_entry::ok },
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   254
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   255
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   256
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   257
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   258
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   259
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   260
const struct widen_entry widen_DIV_table[] = {
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   261
#define __div(TYPE)       \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   262
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   263
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   264
    { &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     }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   265
    { &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     },
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   266
    __ANY_NUM(__div)
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   267
#undef __div
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   268
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   269
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   270
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   271
    /*** Operations with TIME, DT and TOD... ***/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   272
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   273
    /*******************************************/ 
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   274
#define __divtime(TYPE)       \
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   275
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   276
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   277
    { &search_constant_type_c::time_type_name,          &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::time_type_name,     widen_entry::deprecated }, \
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   278
    { &search_constant_type_c::safetime_type_name,      &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   279
    __ANY_NUM(__divtime)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   280
#undef __divtime
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   281
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   282
    { NULL, NULL, NULL, widen_entry::ok },
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   283
 };
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   284
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   285
 
480
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   286
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   287
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   288
const struct widen_entry widen_MOD_table[] = {
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   289
#define __mod(TYPE)       \
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   290
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   291
    { &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     }, \
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   292
    { &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     }, \
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   293
    { &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     },
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   294
    __ANY_NUM(__mod)
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   295
#undef __mod
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   296
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   297
    { NULL, NULL, NULL, widen_entry::ok },
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   298
};
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   299
 
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   300
 
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   301
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   302
490
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   303
const struct widen_entry widen_EXPT_table[] = {
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   304
#define __expt(IN2TYPE, IN1TYPE)       \
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   305
    { &search_constant_type_c::IN1TYPE##_type_name,        &search_constant_type_c::IN2TYPE##_type_name,          &search_constant_type_c::IN1TYPE##_type_name,       widen_entry::ok     }, \
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   306
    { &search_constant_type_c::safe##IN1TYPE##_type_name,  &search_constant_type_c::IN2TYPE##_type_name,          &search_constant_type_c::IN1TYPE##_type_name,       widen_entry::ok     }, \
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   307
    { &search_constant_type_c::IN1TYPE##_type_name,        &search_constant_type_c::safe##IN2TYPE##_type_name,    &search_constant_type_c::IN1TYPE##_type_name,       widen_entry::ok     }, \
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   308
    { &search_constant_type_c::safe##IN1TYPE##_type_name,  &search_constant_type_c::safe##IN2TYPE##_type_name,    &search_constant_type_c::safe##IN1TYPE##_type_name, widen_entry::ok     },
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   309
#define __IN2_anynum_(IN1_TYPENAME)   __ANY_NUM_1(__expt,IN1_TYPENAME)
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   310
    __ANY_REAL(__IN2_anynum_)
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   311
#undef __expt
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   312
#undef __IN2_anynum_
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   313
    { NULL, NULL, NULL, widen_entry::ok },
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   314
};
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   315
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   316
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   317
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   318
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   319
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   320
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   321
/*******                                                *******/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   322
/*******  TABLE 26: Standard bitwise Boolean functions  *******/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   323
/*******                                                *******/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   324
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   325
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   326
/**************************************************************/
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   327
/* table used by AND and ANDN operators, and and_expression */
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   328
const struct widen_entry widen_AND_table[] = {
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   329
#define __and(TYPE)       \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   330
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   331
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   332
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   333
    { &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     },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   334
    __ANY_BIT(__and)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   335
#undef __and
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   336
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   337
    { NULL, NULL, NULL, widen_entry::ok },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   338
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   339
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   340
/* table used by OR and ORN operators, and or_expression */
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   341
const struct widen_entry widen_OR_table[] = {
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   342
#define __or(TYPE)       \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   343
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   344
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   345
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   346
    { &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     },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   347
    __ANY_BIT(__or)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   348
#undef __or
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   349
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   350
    { NULL, NULL, NULL, widen_entry::ok },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   351
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   352
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   353
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   354
/* table used by XOR and XORN operators, and xor_expression */
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   355
const struct widen_entry widen_XOR_table[] = {
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   356
#define __xor(TYPE)       \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   357
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::TYPE##_type_name,       widen_entry::ok     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   358
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   359
    { &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     }, \
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   360
    { &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     },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   361
    __ANY_BIT(__xor)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   362
#undef __xor
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   363
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   364
    { NULL, NULL, NULL, widen_entry::ok },
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   365
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   366
484
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   367
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   368
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   369
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   370
/*******                                                *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   371
/*******  TABLE 28: Standard comparison functions       *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   372
/*******                                                *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   373
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   374
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   375
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   376
/* table used by GT, GE, EQ, LE, LT, and NE  operators, and equivalent ST expressions. */
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   377
const struct widen_entry widen_CMP_table[] = {
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   378
#define __cmp(TYPE)       \
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   379
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::bool_type_name,         widen_entry::ok     }, \
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   380
    { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::TYPE##_type_name,          &search_constant_type_c::bool_type_name,         widen_entry::ok     }, \
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   381
    { &search_constant_type_c::TYPE##_type_name,        &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::bool_type_name,         widen_entry::ok     }, \
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   382
    { &search_constant_type_c::safe##TYPE##_type_name,  &search_constant_type_c::safe##TYPE##_type_name,    &search_constant_type_c::safebool_type_name,     widen_entry::ok     },
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   383
    __ANY_ELEMENTARY(__cmp)
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   384
#undef __cmp
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   385
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   386
    { NULL, NULL, NULL, widen_entry::ok },
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   387
};
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   388
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   389
425
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   390
/* Search for a datatype inside a candidate_datatypes list.
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   391
 * Returns: position of datatype in the list, or -1 if not found.
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   392
 */
445
e6c34ee82954 Change name help function.
Conti Manuele <conti.ma@alice.it>
parents: 443
diff changeset
   393
int search_in_candidate_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes) {
443
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   394
	if (NULL == datatype) 
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   395
		return -1;
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   396
425
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   397
	for(unsigned int i = 0; i < candidate_datatypes.size(); i++)
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   398
		if (is_type_equal(datatype, candidate_datatypes[i]))
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   399
			return i;
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   400
	/* Not found ! */
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   401
	return -1;
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   402
}
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   403
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   404
443
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   405
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   406
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   407
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   408
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   409
457
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   410
/* Intersect two candidate_datatype_lists.
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   411
 * Remove from list1 (origin, dest.) all elements that are not found in list2 (with).
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   412
 * In essence, list1 will contain the result of the intersection of list1 with list2.
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   413
 * In other words, modify list1 so it only contains the elelements that are simultaneously in list1 and list2!
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   414
 */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   415
void intersect_candidate_datatype_list(symbol_c *list1 /*origin, dest.*/, symbol_c *list2 /*with*/) {
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   416
	if ((NULL == list1) || (NULL == list2))
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   417
		/* In principle, we should never call it with NULL values. Best to abort the compiler just in case! */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   418
		return;
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   419
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   420
	for(std::vector<symbol_c *>::iterator i = list1->candidate_datatypes.begin(); i < list1->candidate_datatypes.end(); ) {
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   421
		/* Note that we do _not_ increment i in the for() loop!
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   422
		 * When we erase an element from position i, a new element will take it's place, that must also be tested! 
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   423
		 */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   424
		if (search_in_candidate_datatype_list(*i, list2->candidate_datatypes) < 0)
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   425
			/* remove this element! This will change the value of candidate_datatypes.size() */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   426
			list1->candidate_datatypes.erase(i);
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   427
		else i++;
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   428
	}
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   429
}
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   430
443
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   431
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 436
diff changeset
   432
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   433
459
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   434
/* intersect the candidate_datatype lists of all prev_il_intructions, and set the local candidate_datatype list to the result! */
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   435
void intersect_prev_candidate_datatype_lists(il_instruction_c *symbol) {
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   436
	if (symbol->prev_il_instruction.empty())
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   437
		return;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   438
	
468
46f8154d506e Delete unecessary copy_candidate_datatype_list() function.
Mario de Sousa <msousa@fe.up.pt>
parents: 467
diff changeset
   439
	symbol->candidate_datatypes = symbol->prev_il_instruction[0]->candidate_datatypes;
459
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   440
	for (unsigned int i = 1; i < symbol->prev_il_instruction.size(); i++) {
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   441
		intersect_candidate_datatype_list(symbol /*origin, dest.*/, symbol->prev_il_instruction[i] /*with*/);
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   442
	}  
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   443
}
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   444
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   445
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   446
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   447
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   448
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   449
bool is_ANY_ELEMENTARY_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   450
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   451
  return is_ANY_MAGNITUDE_type(type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   452
      || is_ANY_BIT_type      (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   453
      || is_ANY_STRING_type   (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   454
      || is_ANY_DATE_type     (type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   455
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   456
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   457
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   458
bool is_ANY_SAFEELEMENTARY_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   459
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   460
  return is_ANY_SAFEMAGNITUDE_type(type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   461
      || is_ANY_SAFEBIT_type      (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   462
      || is_ANY_SAFESTRING_type   (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   463
      || is_ANY_SAFEDATE_type     (type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   464
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   465
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   466
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   467
bool is_ANY_ELEMENTARY_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   468
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   469
  /* NOTE: doing
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   470
   *          return is_ANY_SAFEELEMENTARY_type() || is_ANY_ELEMENTARY_type()
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   471
   *       is incorrect, as the literals would never be considered compatible...
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   472
   */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   473
  return is_ANY_MAGNITUDE_compatible(type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   474
      || is_ANY_BIT_compatible      (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   475
      || is_ANY_STRING_compatible   (type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   476
      || is_ANY_DATE_compatible     (type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   477
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   478
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   479
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   480
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   481
bool is_ANY_MAGNITUDE_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   482
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   483
  if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   484
  return is_ANY_NUM_type(type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   485
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   486
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   487
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   488
bool is_ANY_signed_MAGNITUDE_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   489
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   490
  if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   491
  return is_ANY_signed_NUM_type(type_symbol);
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   492
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   493
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   494
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   495
bool is_ANY_SAFEMAGNITUDE_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   496
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   497
  if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   498
  return is_ANY_SAFENUM_type(type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   499
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   500
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   501
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   502
bool is_ANY_signed_SAFEMAGNITUDE_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   503
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   504
  if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   505
  return is_ANY_signed_SAFENUM_type(type_symbol);
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   506
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   507
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   508
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   509
bool is_ANY_MAGNITUDE_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   510
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   511
  if (is_ANY_MAGNITUDE_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   512
  if (is_ANY_SAFEMAGNITUDE_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   513
  return is_ANY_NUM_compatible(type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   514
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   515
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   516
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   517
bool is_ANY_signed_MAGNITUDE_compatible(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   518
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   519
  if (is_ANY_signed_MAGNITUDE_type    (type_symbol))       {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   520
  if (is_ANY_signed_SAFEMAGNITUDE_type(type_symbol))       {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   521
  return is_ANY_signed_NUM_compatible(type_symbol);
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   522
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   523
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   524
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   525
bool is_ANY_NUM_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   526
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   527
  if (is_ANY_REAL_type(type_symbol))                       {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   528
  if (is_ANY_INT_type(type_symbol))                        {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   529
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   530
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   531
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   532
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   533
bool is_ANY_signed_NUM_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   534
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   535
  if (is_ANY_REAL_type(type_symbol))                       {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   536
  if (is_ANY_signed_INT_type(type_symbol))                 {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   537
  return false;
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   538
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   539
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   540
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   541
bool is_ANY_SAFENUM_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   542
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   543
  return is_ANY_SAFEREAL_type(type_symbol)
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   544
      || is_ANY_SAFEINT_type (type_symbol);
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   545
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   546
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   547
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   548
bool is_ANY_signed_SAFENUM_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   549
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   550
  return is_ANY_SAFEREAL_type(type_symbol)
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   551
      || is_ANY_signed_SAFEINT_type (type_symbol);
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   552
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   553
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   554
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   555
bool is_ANY_NUM_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   556
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   557
  if (is_ANY_REAL_compatible(type_symbol))                       {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   558
  if (is_ANY_INT_compatible(type_symbol))                        {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   559
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   560
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   561
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   562
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   563
bool is_ANY_signed_NUM_compatible(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   564
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   565
  if (is_ANY_REAL_compatible(type_symbol))                       {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   566
  if (is_ANY_signed_INT_compatible(type_symbol))                 {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   567
  return false;
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   568
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   569
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   570
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   571
bool is_ANY_DATE_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   572
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   573
  if (typeid(*type_symbol) == typeid(date_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   574
  if (typeid(*type_symbol) == typeid(tod_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   575
  if (typeid(*type_symbol) == typeid(dt_type_name_c))   {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   576
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   577
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   578
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   579
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   580
bool is_ANY_SAFEDATE_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   581
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   582
  if (typeid(*type_symbol) == typeid(safedate_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   583
  if (typeid(*type_symbol) == typeid(safetod_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   584
  if (typeid(*type_symbol) == typeid(safedt_type_name_c))   {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   585
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   586
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   587
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   588
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   589
bool is_ANY_DATE_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   590
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   591
  if (is_ANY_DATE_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   592
  if (is_ANY_SAFEDATE_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   593
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   594
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   595
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   596
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   597
bool is_ANY_STRING_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   598
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   599
  if (typeid(*type_symbol) == typeid(string_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   600
  if (typeid(*type_symbol) == typeid(wstring_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   601
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   602
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   603
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   604
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   605
bool is_ANY_SAFESTRING_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   606
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   607
  if (typeid(*type_symbol) == typeid(safestring_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   608
  if (typeid(*type_symbol) == typeid(safewstring_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   609
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   610
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   611
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   612
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   613
bool is_ANY_STRING_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   614
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   615
  if (is_ANY_STRING_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   616
  if (is_ANY_SAFESTRING_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   617
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   618
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   619
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   620
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   621
bool is_ANY_INT_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   622
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   623
  if (typeid(*type_symbol) == typeid(sint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   624
  if (typeid(*type_symbol) == typeid(int_type_name_c))   {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   625
  if (typeid(*type_symbol) == typeid(dint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   626
  if (typeid(*type_symbol) == typeid(lint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   627
  if (typeid(*type_symbol) == typeid(usint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   628
  if (typeid(*type_symbol) == typeid(uint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   629
  if (typeid(*type_symbol) == typeid(udint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   630
  if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   631
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   632
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   633
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   634
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   635
bool is_ANY_signed_INT_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   636
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   637
  if (typeid(*type_symbol) == typeid(sint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   638
  if (typeid(*type_symbol) == typeid(int_type_name_c))   {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   639
  if (typeid(*type_symbol) == typeid(dint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   640
  if (typeid(*type_symbol) == typeid(lint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   641
  return false;
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   642
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   643
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   644
/* A helper function... */
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   645
bool is_ANY_signed_SAFEINT_type(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   646
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   647
  if (typeid(*type_symbol) == typeid(safesint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   648
  if (typeid(*type_symbol) == typeid(safeint_type_name_c))   {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   649
  if (typeid(*type_symbol) == typeid(safedint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   650
  if (typeid(*type_symbol) == typeid(safelint_type_name_c))  {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   651
  return false;
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   652
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   653
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   654
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   655
bool is_ANY_SAFEINT_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   656
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   657
  if (typeid(*type_symbol) == typeid(safesint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   658
  if (typeid(*type_symbol) == typeid(safeint_type_name_c))   {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   659
  if (typeid(*type_symbol) == typeid(safedint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   660
  if (typeid(*type_symbol) == typeid(safelint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   661
  if (typeid(*type_symbol) == typeid(safeusint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   662
  if (typeid(*type_symbol) == typeid(safeuint_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   663
  if (typeid(*type_symbol) == typeid(safeudint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   664
  if (typeid(*type_symbol) == typeid(safeulint_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   665
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   666
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   667
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   668
/* A helper function... */
435
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   669
bool is_ANY_signed_INT_compatible(symbol_c *type_symbol) {
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   670
  if (type_symbol == NULL) {return false;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   671
  if (is_ANY_signed_INT_type    (type_symbol))              {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   672
  if (is_ANY_signed_SAFEINT_type(type_symbol))              {return true;}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   673
  return false;
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   674
}
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   675
82cb6a64a763 Change negation expression (neg_expression_c) to only allow signed data types.
Mario de Sousa <msousa@fe.up.pt>
parents: 434
diff changeset
   676
/* A helper function... */
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   677
bool is_ANY_INT_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   678
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   679
  if (is_ANY_INT_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   680
  if (is_ANY_SAFEINT_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   681
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   682
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   683
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   684
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   685
bool is_ANY_REAL_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   686
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   687
  if (typeid(*type_symbol) == typeid(real_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   688
  if (typeid(*type_symbol) == typeid(lreal_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   689
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   690
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   691
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   692
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   693
bool is_ANY_SAFEREAL_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   694
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   695
  if (typeid(*type_symbol) == typeid(safereal_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   696
  if (typeid(*type_symbol) == typeid(safelreal_type_name_c)) {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   697
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   698
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   699
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   700
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   701
bool is_ANY_REAL_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   702
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   703
  if (is_ANY_REAL_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   704
  if (is_ANY_SAFEREAL_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   705
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   706
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   707
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   708
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   709
bool is_ANY_BIT_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   710
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   711
  if (typeid(*type_symbol) == typeid(bool_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   712
  if (typeid(*type_symbol) == typeid(byte_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   713
  if (typeid(*type_symbol) == typeid(word_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   714
  if (typeid(*type_symbol) == typeid(dword_type_name_c))    {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   715
  if (typeid(*type_symbol) == typeid(lword_type_name_c))    {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   716
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   717
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   718
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   719
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   720
bool is_ANY_SAFEBIT_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   721
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   722
  if (typeid(*type_symbol) == typeid(safebool_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   723
  if (typeid(*type_symbol) == typeid(safebyte_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   724
  if (typeid(*type_symbol) == typeid(safeword_type_name_c))     {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   725
  if (typeid(*type_symbol) == typeid(safedword_type_name_c))    {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   726
  if (typeid(*type_symbol) == typeid(safelword_type_name_c))    {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   727
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   728
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   729
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   730
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   731
bool is_ANY_BIT_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   732
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   733
  if (is_ANY_BIT_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   734
  if (is_ANY_SAFEBIT_type(type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   735
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   736
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   737
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   738
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   739
bool is_BOOL_type(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   740
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   741
  if (typeid(*type_symbol) == typeid(bool_type_name_c))      {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   742
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   743
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   744
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   745
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   746
bool is_SAFEBOOL_type(symbol_c *type_symbol){
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   747
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   748
  if (typeid(*type_symbol) == typeid(safebool_type_name_c))  {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   749
  return false;
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   750
}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   751
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   752
/* A helper function... */
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   753
bool is_ANY_BOOL_compatible(symbol_c *type_symbol) {
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   754
  if (type_symbol == NULL) {return false;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   755
  if (is_BOOL_type    (type_symbol))              {return true;}
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   756
  if (is_SAFEBOOL_type(type_symbol))              {return true;}
436
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   757
  return false;
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   758
}
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   759
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   760
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   761
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   762
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   763
459
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   764
bool is_type_equal(symbol_c *first_type, symbol_c *second_type) {
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   765
  if ((NULL == first_type) || (NULL == second_type))
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   766
      return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   767
  if (typeid(* first_type) == typeid(invalid_type_name_c))
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   768
      return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   769
  if (typeid(*second_type) == typeid(invalid_type_name_c))
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   770
      return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   771
    
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   772
  if (is_ANY_ELEMENTARY_type(first_type)) {
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   773
      if (typeid(*first_type) == typeid(*second_type))
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   774
          return true;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   775
  } else   /* ANY_DERIVED */
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   776
      return (first_type == second_type);
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   777
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   778
  return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   779
}
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   780
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   781
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   782
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   783
bool is_type_valid(symbol_c *type) {
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   784
  if (NULL == type)
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   785
      return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   786
  if (typeid(*type) == typeid(invalid_type_name_c))
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   787
      return false;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   788
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   789
  return true;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   790
}